宽度可配置时如何写入脉冲宽度systemverilog断言

问题描述 投票:3回答:1

场景是:信号active可以是1个周期,2个周期,3个周期或4个周期宽度,具体取决于输入模块的config[1:0]

为此编写属性的最简单方法是:

property p_PropA;
    @(posedge clk) $rose active ##config ~active;
endproperty

但它在语法上是错误的。写这个断言的正确方法是什么?

system-verilog assertions system-verilog-assertions
1个回答
3
投票

您需要使用局部变量,请参阅IEEE Std 1800-2012§16.10局部变量

这是一个简单的例子:

property p_PropA;
  int count;
  @(posedge clk)
  ($rose(active),count=config) |->
    (active,count--)[*] ##1 (~active && count==0);
endproperty
© www.soinside.com 2019 - 2024. All rights reserved.