verilog behaviral modeling -- procedural timing contronls
1.delay control : an expression specifies the time duration between initially encountering the statement and when the statement actually executes.
the delay expressiong can be dynamic function of the state of the circuit,but it can be a simple number that separates statement
executions in time.
2.event control: which allows statement execution to be delayed until the occurence of some simulation event occurring in a procedure executing
concurrently with this procedure.
a simulation event can be a change of value on a net or variable(an implicit event) or the occurrence of an explicity named event
that is triggered from other procedures(an explicit event).
most often , an event control is p positive or negative edge on a clock signal.
Simulation time can advance by one of the following three methods:
1.a delay control ----> introduced by the symbol #
2.an event control -----> introduced by the symbol @
3.the wait statement ----> operates like a combination of the event control and the while loop
Delay control:
1.the delay expression evaluates to an unknow or high-impedance value, it shall be interpreted as zero delay.
2.the delay expression evaluates to a negative value, it shall be interpreted as a two-complement unsigned integer of
the same size as a time variable.
3.specify parameters are permitted in the delay expression.
eg: #10 rega = regb;
#D rega = regb; //D is parameter
#((d+e)/2) rega = regb;
#regr regr = regr + 1; // delay is the value in regr
Event control:
1.implicity event( a value change on a net or variable)
2.explicity event(the occurrence of a declared event即named event)
1.a negedge : from 1 to x / z /0; from x /z to 0
2.a posedge : from x/z/0 to 1 ; from x /z to 1
1.an implicity event shall be detected on any change in the value of the expression.
2.an edge event shall be detected only on the least significant bit (LSB)of the expression.
3.a change of value in any operand of the expression without a change in the expression in the result of the expression shall not be detected as an event.
@xx statements;
@(posedge xx) statements;
@(negedge xx) statements;
an event shall not hold any data. The following are the characteristic of a named event:
---It can be made to occur at any particular time.
---It has no time duration
--- Its occurrence can be recognized by using the event control
事件event 可以做或运算:
@(trig or enable) rega = regb;
@(posedge clk_a or posedge clk_b or trig) rega = regb;
可以把上面的or换成逗号(,)。
对@*解析:
All net and variable indentifiers that appear in the statement will be automatically added to the event expression with
these exception:
1.Identifiers that only appear in wait or event expressions
2.Identifiers that only appear as a hierachical_variable_identifier in the variable_lvalue of the left_hand side of assignments
Nets and variables that appear on the right_hand side of assignments,in function and task calls, in case and conditional expressions, as an index variable on the left-hand side of assignments, or as variables in case item expressions shall all be included by these rules.
eg1: //此例子或许可以实现event与操作
always@* begin ///equivalent to @(b)
@(i) kid = b; //i is not added to @*
end
eg2:
always@*begin //same as @(a or en)
y = 8'bff;
y[a] = !en;
eg3:
always@* begin //same as @(a or en)
next = 4'b0;
case(1'b1)
state[IDLE] : if(go) next[READ] = 1'b1;
else next[IDLE] = 1'b1;
state[READ] : next[DLY] = 1'b1;
state[DLY] : if(!ws) next[DONE] = 1'b1;
else next[READ] = 1'b1;
state[DONE] : next[IDLE] = 1'b1;
endcase
end
level-sensitive event control / edge-senstive event control
1.@(xx)
@(posedge xx)
@(negedge xx)
分别是双边沿、上升沿、下降沿三种事件控制格式。
2.wait(xx) 是电平事件控制 ,xx为真是执行wait后面的语句。
intra-assignment timing controls / inter-assignment timing controls
1. An intra-assignment delay or event control shall delay the assignment of the new value to the left-hand side,but
right-hand expression shall be evaluated before the delay,instead of after the delay .
2. the intra-assignment delay and event control can be applied to both blocking assignments and nonblocking assignments.(此条Verilog标准讲的不是很细,有些模糊)
3.the number of occurrences of an event can be variable
repeat (a) @(event_expression)
INTRA-ASSIGNMENT TIMING CONTROL EQUIVALENCE(有些像非阻塞赋值)
with intra-assignment construct without intra-assignment construct
a = #5 b; ===========================================> begin
temp =b;
# a = temp;
end
---------------------------------------------------------------------------------------------------------------------------------------------------------
a = @(posedge clk) b; begin
temp = b;
@(posedge clk);
a = temp;
end
----------------------------------------------------------------------------------------------------------------------------------------------------------
a = repeat(3) @(posedge clk) b; begin
temp = b;
@(posedge clk);
@(posedge clk);
@(posedge clk);
a = temp;
end
PS:1.intra-assignment can prevent a race-condition
fork ///data swap
a = #4 b;
b = #4 a;
end
2.intra-assignment waiting for events is also effective
fork ///data shift
a = @(posedge clk) b;
b = @(posedge clk) c;
end
verilog behaviral modeling -- procedural timing contronls的更多相关文章
- verilog behavioral modeling --procedural assignments
1.procedural assignments are used for updating reg ,integer , time ,real,realtime and memory data ty ...
- verilog behavioral modeling ---Block statements
block statements : 1. sequential block : begin-end block 2.parallel block : fork - join bloc ...
- verilog behavioral modeling --loop statement
1.forever 2.repeat 3.while 4.for The for statement accomplishes the same results as the following ps ...
- ModelSim+Synplify+Quartus的Alte
[page_break] 本文适合初学者,源代码:mux4_to_1.v 工作内容: 1.设计一个多路选择器,利用ModelSimSE做功能仿真: 2.利用Synplify Pro进行综合,生成xx ...
- Linking code for an enhanced application binary interface (ABI) with decode time instruction optimization
A code sequence made up multiple instructions and specifying an offset from a base address is identi ...
- Verilog中的specify block和timing check
在ASIC设计中,有两种HDL construct来描述delay信息: 1)Distributed delays:通过specify event经过gates和nets的time,来描述delay; ...
- Verilog Tips and Interview Questions
Verilog Interiew Quetions Collection : What is the difference between $display and $monitor and $wr ...
- verilog FAQ(zz)
1. What is the race condition in verilog? Ans :The situation when two expressions are allowed to exe ...
- 9.3.1 The assign and deassign procedural statements
IEEE Std 1364™-2001, IEEE Standard Verilog® Hardware Description Language The assign procedural cont ...
随机推荐
- 黑马Stream流学习 Stream流 函数式接口 Lambda表达式 方法引用
- 使用JMeter上传文件
使用JMeter录制文件上载 创建JMeter测试计划的最简单方法是使用HTTP(s)测试脚本记录器记录相应的请求.JMeter充当代理服务器,捕获Web浏览器与被测应用程序(AUT)之间的所有流量, ...
- 学习express(一)
菜鸟教程简介:Express 是一个简洁而灵活的 node.js Web应用框架, 提供了一系列强大特性帮助你创建各种 Web 应用,和丰富的 HTTP 工具. 使用 Express 可以快速地搭建一 ...
- IIS 服务器支持下载apk 文件
前不久,在本地IIS文件下部署一个网站,可以下载apk文件,就是测试apk应用升级,发现访问不能下载,原因是IIS没有配置对这种apk文件的处理程序. 解决方案如下所示: 1.打开IIS, 找到MIM ...
- python GIL锁问题
一.GIL是什么 官方解释: In CPython, the global interpreter lock, or GIL, is a mutex that prevents multiple na ...
- 异步 ThreadPool
线程池是单例,一个进程里只有一个线程池 private void btnThreadPool_Click(object sender, EventArgs e) { Stopwatch watch = ...
- 最近在准备面试,总结了几个java中面向对象的几个问题,问题本事还不够全面,要想知道还是要自己去找,但是在面试上应该是没多大问题了
Overload(重载)与Override(重写)的区别 重载:发生在一个类中,方法名称相同,参数列表不同,方法体不同(看对象类型) 重写:发生在父类中,方法名称相同,参数列表相同,方法体不同(看引用 ...
- C#入门(2)
C#入门(2) Exception 基本异常的核心成员: System.Exception Property Meaning Data read-only,实现了IDirectory接口的一些键值对, ...
- 诊断 Grid Infrastructure 启动问题 (文档 ID 1623340.1)
适用于: Oracle Database - Enterprise Edition - 版本 11.2.0.1 和更高版本本文档所含信息适用于所有平台 用途 本文提供了诊断 11GR2 和 12C G ...
- 92.背包问题(lintcode)
注意j-A[i-1]必须大于等于0,只大于0会报错 class Solution { public: /** * @param m: An integer m denotes the size of ...