宽度可配置时如何编写脉冲宽度systemverilog断言
How to write pulse width systemverilog assertion when width is configurable
场景是:
信号 active
可以是 1 个周期、2 个周期、3 个周期或 4 个周期宽度,具体取决于 config[1:0]
模块的输入
为此编写 属性 的最简单方法是:
property p_PropA;
@(posedge clk) $rose active ##config ~active;
endproperty
但这在语法上是错误的。
这个断言的正确写法是什么?
您需要使用局部变量,参见 IEEE Std 1800-2012 § 16.10 局部变量
这是一个简单的例子:
property p_PropA;
int count;
@(posedge clk)
($rose(active),count=config) |->
(active,count--)[*] ##1 (~active && count==0);
endproperty
场景是:
信号 active
可以是 1 个周期、2 个周期、3 个周期或 4 个周期宽度,具体取决于 config[1:0]
模块的输入
为此编写 属性 的最简单方法是:
property p_PropA;
@(posedge clk) $rose active ##config ~active;
endproperty
但这在语法上是错误的。 这个断言的正确写法是什么?
您需要使用局部变量,参见 IEEE Std 1800-2012 § 16.10 局部变量
这是一个简单的例子:
property p_PropA;
int count;
@(posedge clk)
($rose(active),count=config) |->
(active,count--)[*] ##1 (~active && count==0);
endproperty