转载自https://www.cnblogs.com/hxing/p/9584190.html
一、specify的含义
specify block用来描述从源点(source:input/inout port)到终点(destination:output/inout port)的路径延时(path delay),由specify开始,到endspecify结束,并且只能在模块内部声明,具有精确性(accuracy)和模块性(modularity)的特点。
二、specify的作用
specify block可以用来执行以下三个任务:
2.1、描述横穿整个模块的各种路径及其延时。(module path delay)
2.2、脉冲过滤限制。(pulse filtering limit)
2.3、时序检查。(timing check) specify block有一个专用的关键字specparam用来进行参数声明,用法和parameter一样,不同点是两者的作用域不同:specparam只能在specify block内部声明及使用,而parameter只能在specify block外部声明及使用。
2.1、第一个任务:
模块路径延时(module path delay)
一条模块路径可以是一条简单的路径(simple path),或者是一条边缘敏感的路径(edge sensitive path),或者是一条状态依赖的路径(state dependent path)。
2.1.1、simple path,可以由以下两种格式中的任意一种来声明:
1)、并行连接(patallel connection):source => destination
2)、全连接(full connection): source *> destination
例: (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;
2.1.2、edge sensitive path
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,-)。
2.1.3、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 =>