verilog behavioral modeling--blocking and nonblocking
2014-11-04 15:14
351 查看
BLOCKING ASSIGNMENTS
1.A blocking procedural assignment statement shall be exectuted before the execution of the statements that follow it in a sequential block (我们一般都这样用)
2.A blocking procedural assignment statement shall not prevent the execution of statements that follow it in a parallel block(看来阻塞赋值不是永远阻塞后面的语句)
3.variable_lvalue = [delay_or_event_control] expression(variable_lvalue、delay_or_event_control 、expression 都有多种写法,可以参考IEEE标准)
If variable_lvalue require an evaluation,it shall be evaluated at the time specified by the intra-assignment timing control.
The = assignment operator used by blocking procedural assignments is also used by procedural continous assignments and continous assignments.
NONBLOCKING ASSIGNMENTS
1.the nonblocking procedural assignment allows assignment scheduling without blocking the procedural flow.
2.the nonblocking procedural assignment statement can be used whenever several variable assignments within the same time step can be made without regard to order or dependence upon each other.
3.variable_lvalue <=[delay_or_event_control] expression
If variable_lvalue requires an evaluation,it shall be evaluated at the same time as the expression on the right-hand side.
The order of evaluation of the variable_lvalue and the expression on the right-hand side is undefined if timing control is not specified.
4.<=符合重载 : 小于等于 非阻塞赋值
5.The nonblocking procedural assignments shall be evaluated in two steps .(跟time region有关)
step1:the simulator evaluates the right-hand side of the nonblocking assignments and shedules the assignments for the end of the current time step
step2:at the end of the current time step, the simulator updates the left-hand side of each nonblocking assignment statement
6.the order of the execution of distinct nonblocking assignments to a given variable shall be preserved. in other words ,if there is clear ordering of the execution of a set of nonbolcking assignments ,
then the order of the resulting updates of the destination of the nonblocking assignments shall be the same as the ordering of the execution.(非阻塞也是可以写成阻塞的方式的)
eg:
module mutipe;
reg a;
initial a = 1;
//the assigned value of the reg is determinate
initial begin
a<= #4 0;
a<= # 1 ;
end
endmodule
7.If the simulator executes two procedural blocks concurrently and if these procedural blocks contain nonblocking assignment operators to the same variable, the final value of that variable is indeterminate.
eg:
module multipe2;
reg a;
inital a =1;
initial a<= #4 0; //schedules 0 at time 4
initial a<= #4 1; //schedules 1 at time 4
//at time 4 ,a =??
//the assigned value of the reg is indeterminate
endmodule
8.always中可以blocking /nonblocking assignments
initial 中可以blocking/nonblocking assignments
似乎,我们一直关注的是always中组合逻辑用blocking,时序逻辑用nonblocking,initial中用blocking(此外系统函数必须放在initial 中)。
其实,如果begin-end / fork-join 规定的串行/并行 跟 blocking / nonblocking 规定的阻塞/非阻塞交叉产生的效果。
1.A blocking procedural assignment statement shall be exectuted before the execution of the statements that follow it in a sequential block (我们一般都这样用)
2.A blocking procedural assignment statement shall not prevent the execution of statements that follow it in a parallel block(看来阻塞赋值不是永远阻塞后面的语句)
3.variable_lvalue = [delay_or_event_control] expression(variable_lvalue、delay_or_event_control 、expression 都有多种写法,可以参考IEEE标准)
If variable_lvalue require an evaluation,it shall be evaluated at the time specified by the intra-assignment timing control.
The = assignment operator used by blocking procedural assignments is also used by procedural continous assignments and continous assignments.
NONBLOCKING ASSIGNMENTS
1.the nonblocking procedural assignment allows assignment scheduling without blocking the procedural flow.
2.the nonblocking procedural assignment statement can be used whenever several variable assignments within the same time step can be made without regard to order or dependence upon each other.
3.variable_lvalue <=[delay_or_event_control] expression
If variable_lvalue requires an evaluation,it shall be evaluated at the same time as the expression on the right-hand side.
The order of evaluation of the variable_lvalue and the expression on the right-hand side is undefined if timing control is not specified.
4.<=符合重载 : 小于等于 非阻塞赋值
5.The nonblocking procedural assignments shall be evaluated in two steps .(跟time region有关)
step1:the simulator evaluates the right-hand side of the nonblocking assignments and shedules the assignments for the end of the current time step
step2:at the end of the current time step, the simulator updates the left-hand side of each nonblocking assignment statement
6.the order of the execution of distinct nonblocking assignments to a given variable shall be preserved. in other words ,if there is clear ordering of the execution of a set of nonbolcking assignments ,
then the order of the resulting updates of the destination of the nonblocking assignments shall be the same as the ordering of the execution.(非阻塞也是可以写成阻塞的方式的)
eg:
module mutipe;
reg a;
initial a = 1;
//the assigned value of the reg is determinate
initial begin
a<= #4 0;
a<= # 1 ;
end
endmodule
7.If the simulator executes two procedural blocks concurrently and if these procedural blocks contain nonblocking assignment operators to the same variable, the final value of that variable is indeterminate.
eg:
module multipe2;
reg a;
inital a =1;
initial a<= #4 0; //schedules 0 at time 4
initial a<= #4 1; //schedules 1 at time 4
//at time 4 ,a =??
//the assigned value of the reg is indeterminate
endmodule
8.always中可以blocking /nonblocking assignments
initial 中可以blocking/nonblocking assignments
似乎,我们一直关注的是always中组合逻辑用blocking,时序逻辑用nonblocking,initial中用blocking(此外系统函数必须放在initial 中)。
其实,如果begin-end / fork-join 规定的串行/并行 跟 blocking / nonblocking 规定的阻塞/非阻塞交叉产生的效果。
相关文章推荐
- Verilog HDL 学习笔记2-blocking and non-blocking assignment
- ISE verilog 综合错误提示:ERROR:Xst:880 - "Johnson_source.v" line 45: Cannot mix blocking and non blocking
- ElasticMQ 0.7.0: Long Polling, Non-Blocking Implementation Using Akka and Spray
- 阻塞与非阻塞(blocking and non-blocking)
- Asynchronous and non-Blocking I/O 翻译[收藏好文]
- Use Thread Pools Correctly: Keep Tasks Short and Nonblocking
- Mix of blocking and non-blocking assignments to variable <en> is not a recommended coding practice.
- High Performance Ruby Part 3: non-blocking IO and web application scalability
- Node(11) Event Driven and Non-blocking
- 异步与非阻塞的区别(Difference between asynchronous and non-blocking)
- Blocking/Non-Blocking IO and SYN/ASYN IO
- Verilog非阻塞赋值的仿真/综合问题 (Nonblocking Assignments in Verilog Synthesis)-上-
- ISE错误:“Cannot mix blocking and non blocking assignments on signal ”
- Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms
- Verilog非阻塞赋值的仿真/综合问题(Nonblocking Assignments in Verilog Synthesis) -下-
- non-blocking and blocking mode
- Nonblocking I/O and select()
- SSIS 阻塞,半阻塞和全阻塞 (Non-blocking, semi-blocking and Fully-blocking) transformations清单
- Java Non-Blocking and Asynchronous IO with NIO & NIO.2 (JSR203) - Reactor/Proactor Implementations
- ISE错误:“Cannot mix blocking and non blocking assignments on signal ”