|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2013-12-1 12:35:25
|
显示全部楼层
阻塞和非阻塞
关于这个McuPlayer大哥在61楼说的很好了,我再补充一点自己小小的理解啊。
对于一个D触发器,我们用如下的方式实现:
module d_flip_flop(q3, d, clk);
output [7:0] q3;
input [7:0] d;
input clk;
reg [7:0] q3, q2, q1;
always @(posedge clk) begin
q1 = d;
q2 = q1;
q3 = q2;
end
endmodule
RTL图如捕获.png
如果把上面的代码改为
module d_flip_flop(q3, d, clk);
output [7:0] q3;
input [7:0] d;
input clk;
reg [7:0] q3, q2, q1;
always @(posedge clk) begin
q1 <= d;
q2 <=q1;
q3 <= q2;
end
endmodule
RTL图如捕获2.png
相信如果有什么不理解的,看了这两个例子也一定豁然开朗了吧。反正我有这样的感觉。
顺便再加一段:
module d_flip_flop (q3, d, clk);
output [7:0] q3;
input [7:0] d;
input clk;
reg [7:0] q3, q2, q1;
always @(posedge clk) begin
q3 = q2;
q2 = q1;
q1 = d;
end
endmodule
这段代码的RTL电路见捕获3.png |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|