- 1
- 0
- 约5.63千字
- 约 64页
- 2017-01-11 发布于湖北
- 举报
阻塞非阻塞使用原则: 块语句:begin end 总是在always内部 按顺序执行 举例: reg qa,qb,qc; always @(posedge clk) begin qa =d; qb =qa; qc =qb; end 赋值语句: 持续赋值语句 过程赋值语句 持续赋值语句: assign c=ab; 过程赋值语句: 非阻塞赋值 “ = ” 阻塞赋值 “ = ” 分为两步骤:右式计算、左式更新 非阻塞赋值 : 当前语句的执行不会阻塞下一语句的执行 语句之间并发执行 左式更新在块结束后才进行 阻塞赋值 : 当前语句的执行会阻塞下一语句的执行 语句之间顺序执行 右式计算和左式更新同时进行 举例 : module nonblocking(clk,reset,a,b); input clk,reset; input [3:0]a; output [3:0]b; reg [3:0]b;reg [3:0]y; always @(posedge clk or negedge reset) begin if(!reset) begin y=0; b=0; end else begin y=a; b=y; end end endmodule 结果 : 举例 : module nonblocking(clk,reset,a,b); input clk,reset; input [3:0]a; output [3:0]b; reg [3:0]b;reg [3:0]y; always @(posedge clk or negedge reset) begin if(!reset) begin y=0; b=0; end else begin b=y; y=a; end end endmodule 结果 : 举例 : module blocking(clk,reset,a,b); input clk,reset; input [3:0]a; output [3:0]b; reg [3:0]b;reg [3:0]y; always @(posedge clk or negedge reset) begin if(!reset) begin y=0; b=0; end else begin y=a; b=y; end end endmodule 结果 : 举例 : module blocking(clk,reset,a,b); input clk,reset; input [3:0]a; output [3:0]b; reg [3:0]b;reg [3:0]y; always @(posedge clk or negedge reset) begin if(!reset) begin y=0; b=0; end else begin b=y; y=a; end end endmodule 结果 : 举例 : module nonblocking(clk,reset,a,b); input clk,reset; input [3:0]a; output [3:0]b; reg [3:0]b;reg [3:0]y; always @(posedge clk or negedge reset) begin if(!reset) begin y=0; b=0; end else begin y=a; b=y; end end endmodule 结果 : 举例 : module nonblocking(clk,reset,a,b); input clk,reset; input [3:0]a; output [3:0]b; reg [3:0]b;reg [3:0]y; always @(posedge clk or negedge reset) begin if(!reset) begin y=0; b=0; end else begin y=a; b=y; end end endmodule 结果 : 有clock的always进程要使用non-blocking always@(po
您可能关注的文档
- (精)TDCS系统(第一二章)——最新.ppt
- (精)TG-0033机床夹具设计1——最新.ppt
- (精)tlxdjjc11《土力学与地基基础》第十一章桩基础及其他深基础——最新.ppt
- (精)TS码流分析——最新.ppt
- (精)T形、双筋梁——最新.ppt
- (精)UG软件设计培训课程基础教程——最新.ppt
- (精)unit 2 english around the world period 1——最新.ppt
- (精)unit 2 english around the world Using language——最新.ppt
- (精)Unit 2 English around the world Language points——最新.ppt
- (精)Unit 2 English around the world 课件——最新.ppt
原创力文档

文档评论(0)