verilog的一点体验

[复制链接]
2306|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 | 显示全部楼层
不错啊
ghkt2000 发表于 2013-5-11 00:01 | 显示全部楼层
可以啊!
jahnson066 发表于 2013-5-11 17:44 | 显示全部楼层
菜鸟来此学习一下,又有收获了。顶猴哥
menglong200806 发表于 2013-5-11 21:46 | 显示全部楼层
学习一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:                     2014, 追逐梦想

264

主题

17215

帖子

523

粉丝
快速回复 在线客服 返回列表 返回顶部