specify block的总结
本贴简单的介绍了如何使用specify
block进行描述模块路径延时(module path delay)及其它相关信息:
specify block用来描述从源点(source:input/inout
port)到终点(destination:output/inout port)的路径延时(path
delay),由specify开始,到endspecify结束,并且只能在模块内部声明,具有精确性(accuracy)和模块性(modularity)的特点。specify
block可以用来执行以下三个任务: 一、描述横穿整个模块的各种路径及其延时。(module path delay)
二、脉冲过滤限制。(pulse filtering limit)
三、时序检查。(timing check) specify block有一个专用的关键字specparam用来进行参数声明,用法和parameter一样,不同点是两者的作用域不同:specparam只能在specify
block内部声明及使用,而parameter只能在specify block外部声明及使用。 Note:模块路径延迟(module path
delay)是一种常用的描述延时的模型,其它的还有分布延时(distributed delay)和块延时(lumped
delay)。
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:33 编辑
第一个任务:模块路径延时(module path delay) 一条模块路径可以是一条简单的路径(simple path),或者是一条边缘敏感的路径(edge sensitive
path),或者是一条状态依赖的路径(state dependent path)。 简单的路径(simple path),可以由以下两种格式中的任意一种来声明:
1、并行连接(patallel connection):source =>
destination 2、全连接(full
connection):source *> destination 例1:(a, b => q, qn) = 1; 等价于: (a => q) = 1; (b
=> qn) = 1; 而(a, b *> q, qn) =
1; 等价于: (a => q) = 1; (b => q) = 1; (a => qn) = 1; (b
=> qn) = 1;
http://bbs.eetop.cn/attachments/month_1201/12011316096c92956f3d780101.gifblock的总结" TITLE="(转)specify block的总结" />
parallel and full.GIF
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:33 编辑 边缘敏感的路径(edge sensitive
path),是那些源点(source)使用边沿触发的路径,并使用边缘标示符指明触发条件(posedge:上升沿,negedge:下降沿),如果没有指明的话,那么就是任何变化都会触发终点(destination)的变化。
例1:(posedge clk => (out +: in)) =
(1,2); 在clk的上升沿,从clk到out的模块路径,其上升延时是1,下降延时是2,从in到out的数据路径是同向传输,即out
= in。 例2:(negedge clk => (out -: in)) = (1,2);
在clk的下降沿,从clk到out的模块路径,其上升延时是1,下降延时是2,从in到out的数据路径是反向传输,即out
= ~in。 例3:(clk => (out : in)) = (1,2); clk的任何变化,从clk到out的模块路径,其上升延时是1,下降延时是2,从in到out的数据路径的传输是不可预知的,同向或者反向或者不变。
Note:模块路径的极性(module path
polarity):未知极性(unknown polarity,无),正极性(positive
polarity,+),负极性(negative polarity,-)。
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:36 编辑 状态依赖的路径(state dependent
path),是那些源点(source)以来指定条件状态的路径,使用if语句(不带else)。在条件=1 or X or
Z的情况下,认为条件成立。如果有一条路经,存在多个条件同时成立的情况,那么使用延时最小值的那条限制。
例1: specify if(a) (b => out)
= (1,2); if(~a) (b => out) =
(2,3); if(b) (a => out) =
(1,2); if(~b) (a => out) =
(2,3); endspecify 例2: specify if(rst) (posedge clk
=> (q +: data)) = (1,2); if(~rst)
(posedge clk => (q +: data)) = (2,3); endspecify 需要注意的是,所有输入状态都应该说明,否则没有说明的路径使用分布延时(distributed
delay),如果也没有声明分布延时(distributed delay)的话,那么使用零延时(zero
delay)。如果路径延时和分布延时同时声明的话,则选择最大的延时作为路径延时。另外,也可以使用ifnone语句,在其它所有条件都不满足的情况下,说明一个缺省的状态依赖路径延时。
例3: specify (posedge clk =>
(q +: data)) = (1,2); ifnone (clk
=> q) = (2,3); endspecify
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:36 编辑
第二个任务,脉冲过滤限制(pulse
filtering limit) 由于每条传播路径都具有一定的电容性和电阻性,电荷无法在一瞬间积累或消散,所以信号变化的物理特性是具有惯性的。为了更准确地描述这种能力,使用惯性延时(inertial
delay),它可以抑制持续信号比传播延时短的输入信号的变化。 例1:1ns宽度的窄脉宽通过一个传输延时为2ns的BUFFER,
http://bbs.eetop.cn/attachments/month_1201/12011316162532383bad5eefe4.gifblock的总结" TITLE="(转)specify block的总结" />
inertial delay.GIF
两个脉宽限制值:e-limit(error
limit)和r-limit(rejection limit),并且要求e-limit >=
r-limit,否则报错。当pulse width >= e-limit时,输出相应的逻辑值;当e-limit >
pulse width >= r-limit时,输出X值;当r-limit > pulse
width时,输出不发生变化。默认情况下,e-limit = r-limit = module transition
delay,也可以使用以下3种控制方式中的任意一种改变路径脉冲限制值: 1、使用verilog提供的PATHPULSE$参数,有些仿真器还要求同时使能相应的选项:比如VCS,添加+pathpulse选项。
PATHPULSE$ = (, ); PATHPULSE$$ = (, ); 例1: specify
(en => q) = 12; (data => q) = 10; (clr,
pre *> q) = 4; specparam
PATHPULSE$ = 3, PATHPULSE$en$q = (2,9),
PATHPULSE$clr$q = 1; endspecify
en => q的路径:reject-limit = 2, error-limit
=9; clr => q和pre =>
q的路径:reject-limit = error-limit = 1; data => q的路径:reject-limit = error-limit = 3;
2、使用仿真器专用的编译指导。比如VCS,+pulse_r/20(取20%)和+pulse_e/80(取80%),需要注意的是,这个选项要求放在读入RTL网表文件之后,否则设置无效。
3、使用SDF文件反标,并且SDF文件中的延时信息具有最高的优先级。SDF文件格式将在后面介绍。
脉冲过滤限制的默认格式存在两个缺点: 1、X状态的持续时间比较短。 2、在上升延时和下降延时不相等的情况下,如果脉冲过窄,那么可能出现跟随边缘(trailing
edge)先于或等于导引边缘(leading edge)的现象,这时就会淹没X状态。 可以通过修改默认格式,加以改善,具体如下: on-event vs on-detect:
http://bbs.eetop.cn/attachments/month_1201/120113161746ee580c2c6f703c.gifblock的总结" TITLE="(转)specify block的总结" />
detect vs event.GIF
negative width pulse detection:
http://bbs.eetop.cn/attachments/month_1201/1201131617e09813c16f30f066.gifblock的总结" TITLE="(转)specify block的总结" />
showcancelled.GIF
需要注意的是,showcancelled
list_path_of_outputs,必须在模块路径之前使用,才可以约束到该模块路径。
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:37 编辑
第三个任务,时序检查(timing
check) 描述设计要求的时序性能,所有的时序检查有一个参考事件(reference event)和一个数据事件(data
event),它们通过一个布尔表达式相联接,还包括一个可选的notifier寄存器选项,这个寄存器用来打印错误信息或者传播X状态。
这里把时序检查分成两组来说明: 第一组,检查时序窗口的稳定性,包括:setup、hold、recovery和removal。
setup:$setup (data_event, reference_event,
limit, notifier); 当reference_event
time - limit < data_event time < reference_event
time时,就会报告setup time violations。 hold:
$hold (reference_event, data_event, limit, notifier);
当reference_event time < data_event time
< reference_event time + limit时,就会报告hold time violations。
setup/hold:$setuphold (reference_event,
data_event, setup_limit, hold_limit, notifier); $setuphold是$setup和$hold两者的联合。例如: $setuphold (posedge clk, negedge d, 2, 1, notifier);
等于 $setup (negedge d, posedge clk, 2,
notifier); 和 $hold (posedge clk, negedge d, 1, notifier);
数据事件常常是数据信号,而参考事件常常是时钟信号,如下图:
http://bbs.eetop.cn/attachments/month_1201/120113162216ef92a54dfba36a.gifblock的总结" TITLE="(转)specify block的总结" />
setup and hold.GIF
recovery:$recovery (reference_event,
data_event, limit, notifier); 当data_event time - limit < reference_event time <
data_event time时,就会报告recovery time violations。 removal: $removal (reference_event, data_event, limit,
notifier); 当data_event time <
reference_event time < data_event time + limit时,就会报告removal time
violations。 recovery/removal:$recrem
(reference_event, data_event, recovery_limit, removal_limit,
notifier); $recrem是$recovery和$removal两者的联合。 $recrem (posedge clr, posedge clk, 2, 3, notifier);
等于 $recovery (posedge clr, posedge
clk, 2, notifier); 和 $removal (posedge clr, posedge clk, 3,
notifier); 数据事件常常是时钟信号,而参考事件常常是控制信号,比如清除信号或者置位信号,如下图:
http://bbs.eetop.cn/attachments/month_1201/1201131622578f0782f41a6119.gifblock的总结" TITLE="(转)specify block的总结" />
rec and rem.GIF
$setuphold和$recrem可以接受负值,同时需要激活仿真器的负值时序检查选项(比如VCS:+neg_tchk),同时还有一个限制:
setup_limit + hold_limit > 仿真精度(simulation
unit of precision), recovery_limit +
removal_limit > 仿真精度(simulation unit of precision),
否则仿真器会把负值当成0处理。
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:38 编辑 第二组,检查时钟和控制信号在指定事件之间的时间间隔,包括:skew、width、period和nochange。
skew:$skew
(reference_event, data_event, limit, notifier); 限制最大偏斜
$skew (posedge clk1, posedge clk2, 1,
notifier); 当data_event time -
reference_event > limit,则会报告skew time violations。
$skew是基于事件(event-based)的,如果监测到一个reference_event,那么就开始评估脉宽,只要监测到一个
data_event,就会生成相应的报告,直到监测到下一个reference_event,才重新开始新的监测。如果在监测到一个
data_event之前,又监测到一个reference_event,那么就放弃本次评估,重新开始新的评估。
width:$width (controlled_reference_event,
limit, threshold, notifier); 限制最小脉宽 $width (posedge in, 2, notifier); 这里data_event是隐含的,它等于reference_event的相反边缘,当width <
limit时,就会报告width time violations。 period:$period (controlled_reference_event, limit,
notifier); 限制最小周期 $period (negedge
clk, 10, notifier); 这里data_event是隐含的,它等于reference_event的相同边缘,当period <
limit时,就会报告period time violations。 nochange:$nochange (reference_event, data_event,
start_edge_offset, end_edge_offset, notifier); 当leading reference event time - start_edge_offset <
data_event < trailing reference event time +
end_edge_offset时,就会报告nochange time violations。例如:
$nochange (posedge clk, data, 0 , 0);
当在clk高电平期间,data发生任何变化,就会报告nochange time
violations。 有时候,路径上的时序检查是在一定条件成立的前提下进行的,这就需要引入条件操作符:&&&。需要注意的是,当存在两个及以上的
条件时,要求这些条件首先在specify块外部经过适当的组合逻辑产生一个新的控制信号,然后再引入到specify块内部使用。
例如: and u1
(clr_and_set, clr, set); specify $setup (negedge
data, posedge clk &&& clr_and_set, 3, notifier);
endspecify
[i=s] 本帖最后由 jun_dahai 于 2012-1-13
16:38 编辑 SDF文件简述: SDF文件包含指定路径延时(specify path delay),参数值(specparam
values),时序检查约束(timing check constraints),互连线延时(interconnect
delay),以及一些和仿真不相关的说明信息。反标SDF文件的过程,也算是更新specify
block相对应信息的过程,如果SDF文件没有包含某些信息,则参考specify block中的相应信息。
SDF时序信息在CELL内部描述,可以包含一个或多个DELAY、TIMINGCHECK和LABEL。DELAY部分包含指定路径的传播延时
(specify path delay)和互连线延时(interconnect
delay);TIMINGCHECK部分包含时序检查约束信息(timing check
constraint);LABEL部分包含新的参数值(specparam)。
DELAY部分:
http://bbs.eetop.cn/attachments/month_1201/1201131627b426c8afa8db7f57.gifblock的总结" TITLE="(转)specify block的总结" />
delay section.GIF
例1: SDF文件:(IOPATH in out (1.1::1.3) (1.5::1.7));
verilog specify path:(in => out) = (2,
3); 例2:
SDF文件:(COND en==1'b1 (IOPATH in out (1.2)
(1.6)); verilog specify path:if (en)
(in => out) = (1, 2); 互连线延时:(INTERCONNECT source_port load_port
delay_values) 例3: SDF文件:(INTERCONNECT u1/out u2/in (1.2::1.4)
(1.4::1.6));
TIMINGCHECK部分:
http://bbs.eetop.cn/attachments/month_1201/1201131628a52c71815d0ff955.gifblock的总结" TITLE="(转)specify block的总结" />
timing check.GIF
例4: SDF文件:(SETUP
(posedge data) (posedge clk) (3::4)); (HOLD (posedge data) (posedge clk) (1::2));
verilog timing checks:$setup (posedge data,
posedge clk, 1); $hold (posedge clk,
posedge data, 2); 例5: SDF文件:(SETUP (posedge
data) (COND rb==1'b1 (posedge clk)) (3::4)); (HOLD (posedge data) (COND rb==1'b1 (posedge clk))
(1::2)); verilog timing checks:$setup
(posedge data, posedge clk &&& rb, 1);
$hold (posedge clk &&& rb,
posedge data, 2);
LABEL部分: 例6: SDF文件:(LABEL (ABSOLUTE
(dh 60) (dl 40))) verilog文件:specparam dh = 60, dl=40;
SDF文件反标是一个有序的过程,这就意味着对于同一对source/load,后续的信息可能修改(INCREMENT)或者覆盖(ABSOLUTE)前面已经声明过的信息,这在反标($sdf_annotate)多个SDF文件时,就很可能发生的。
例7:覆盖前面的延时信息 (DELAY (ABSOLUTE (IOPATH A Z (1) (2)) (IOPATH A Z (2)
(3))))
我分成了几个小片,既方便看,也方便检错,希望可以帮到大家哈
關於 verilog 的所有語法及說明可以參考 cadence
ncverilog 中的說明,檔名好像是 vlgref.pdf (在 verilog-XL 的時代就有了),在那裏面就可以找到
standard cell 是如何 model function 和 timing 。
[i=s] 本帖最后由 wdm518 于 2012-8-20 15:58
编辑 $width(posedge A,time); $hold(); $setup(); 类似这种check 函数. check
的result 再哪里可以看到. 我用的是vcs. 谢谢.
回复 13# jun_dahai
希望可以做成PDF文档,方便大家传阅
回复 8# jun_dahai l 楼主你好 我有二个疑问.
width:$width (controlled_reference_event,
limit, threshold, notifier); 限制最小脉宽 $width (posedge in, 2,
notifier); 这里data_event是隐含的,它等于reference_event的相反边缘,当width <
limit时,就会报告width time violations。 整个系统函数 调用的时候
notifier 是个什么意思? 自己定义reg
notifier ? threshold整个参数可以省略吗($width
(posedge in, 2, notifier);)? 当width
< limit时,就会报告width time violations。 报告width time violations
再哪里看.我用的是vcs 最后整个result 怎么看. 我的意思是类似$display 之类的result
谢谢..
回复 17# wdm518
notifier是通告符,定义为REG类型,如果你激活了仿真工具的相应选项,那么在仿真的过程中,当你遇到TIMING
VIOLATIONS时,notifier就会从X状态变成稳定的0/1,并且DUT的所有数据就会全部变成X状态,仿真到此为止
可以不用管threshold,但如果你定义notifier标志时,需要用两个逗号隔开,表示使用默认shreshold值,比如:
$width(posedge dat, 1 ,, notifier); 可以在log file里查看
大哥有QQ吗 加个吧.还是不明白.反正我的log 没有任何TIMING
VIOLATIONS的信息. 我把limit 设置成1 . 判断的肯定大于1 . 没有任何 VIOLATIONS的信息.谢谢.
我QQ: 350236118.
回复 18# jun_dahai
notifier是通告符,定义为REG类型,如果你激活了仿真工具的相应选项, 整个选项再哪里选. 我用的vcs +
verdi.
加载中,请稍候......