打印

verilog的一点体验

[复制链接]
1869|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
GoldSunMonkey|  楼主 | 2013-5-10 00:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
verilog 中,过程赋值语句(always块中“=”与“<=”)的左边不能用wire型,一般用reg型信号。但是如果这个always块表现的是一个组合逻辑的话,实际综合的结果,常常使得这些reg型信号被优化掉或展现为wire。

有点奇怪的矛盾。

比如:

module test(
    input a,
    input b,
  input[1:0] f,
    output c,
  output e
    );
reg d;
assign c = a & b;
assign e = d & a & b;


// Usage of asynchronous resets may negatively impact FPGA resources
// and timing. In general faster and smaller FPGA designs will
// result from not using asynchronous resets. Please refer to
// the Synthesis and Simulation Design Guide for more information.

   // Always specify an else statement with a combinatorial if statement in
   //    order to avoid the inference of a latch

always @*
   if (b) begin
      d = f[0];
   end
   else d = a;
   

endmodule

相关帖子

沙发
resxpl| | 2013-5-10 20:33 | 只看该作者
边沿触发的<=实现为reg, 其他的都是wire

使用特权

评论回复
板凳
GoldSunMonkey|  楼主 | 2013-5-10 23:17 | 只看该作者
resxpl 发表于 2013-5-10 20:33
边沿触发的

:)嘿嘿,获得你的关注了

使用特权

评论回复
地板
wmsk| | 2013-5-10 23:52 | 只看该作者
不错啊

使用特权

评论回复
5
ghkt2000| | 2013-5-11 00:01 | 只看该作者
可以啊!

使用特权

评论回复
6
jahnson066| | 2013-5-11 17:44 | 只看该作者
菜鸟来此学习一下,又有收获了。顶猴哥

使用特权

评论回复
7
menglong200806| | 2013-5-11 21:46 | 只看该作者
学习一下

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:                     2014, 追逐梦想

264

主题

17215

帖子

523

粉丝