SystemVerilog断言错误:非常使用非常量表达式

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

SLV_DCR_TIMEOUT_WAIT是寄存器中编程的值,因此它不是常量值。如何在断言中使用相同的内容。

assign DCR_CLK = testbench.sw_top_inst.DUT.megatron_x.megatron_cib.dcr_slave_cfg.DCR_clk;
assign DCR_TIMEOUT_WAIT = testbench.sw_top_inst.DUT.megatron_x.megatron_cib.dcr_slave_cfg.dcr_timeout_wait[15:0];
assign SLV_DCR_TIMEOUT_WAIT = testbench.sw_top_inst.DUT.megatron_x.megatron_cib.dcr_slave_cfg.Sl_dcrTimeoutWait;
assign SCRUB_INIT = testbench.sw_top_inst.DUT.megatron_x.megatron_cib.dcr_slave_cfg.scrub_init;

// end

//=================ASSERTION TO CHECK SLV_DCR_TIMEOUT_WAIT============================//
property slv_dcr_timeout_wait;
    @(posedge DCR_CLK) disable iff (!DCR_TIMEOUT_WAIT)
        $rose(SCRUB_INIT) |-> $rose(SLV_DCR_TIMEOUT_WAIT) ##(DCR_TIMEOUT_WAIT) $fell(SLV_DCR_TIMEOUT_WAIT);
endproperty: slv_dcr_timeout_wait

assert property (slv_dcr_timeout_wait);

错误信息 :

错误 - [SVA-INCE]非法使用非常量表达式 /lsi/designs/rsd_megatron/team/singhs/megatron/sim/testbench/mss_tb/interfaces/mss_internal_signal_if.sv,41 mss_internal_signal_if,“DCR_TIMEOUT_WAIT” 对于诸如延迟和重复范围的情况,属性,序列和断言中不允许使用非常量表达式。 请用精化时间常数替换违规表达式。

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

正如您所注意到的,问题在于##(DCR_TIMEOUT_WAIT),SystemVerilog希望它是一个常量值。我使用局部变量计数器来解决这个问题。参见IEEE Std 1800-2012§16.10局部变量

使用局部变量创建通用脉冲检查序列:

sequence pulse_seq(local logic sig, local int limit);
  int cnt = limit;
  $rose(sig) ##0 (sig && cnt>0, cnt--)[*] ##1 ($fell(sig) && cnt==0);
endsequence

然后将其插入断言中:

property slv_dcr_timeout_wait;
  @(posedge DCR_CLK)
  $rose(SCRUB_INIT) && (DCR_TIMEOUT_WAIT>0)  |->
    pulse_seq(SLV_DCR_TIMEOUT_WAIT,DCR_TIMEOUT_WAIT);
endproperty : slv_dcr_timeout_wait

assert property (slv_dcr_timeout_wait);

请注意,我删除了disable iff (!DCR_TIMEOUT_WAIT)and到触发器我将触发条件更改为$rose(SCRUB_INIT) && (DCR_TIMEOUT_WAIT>0)。禁用是异步操作,应该用于中止已经启动的序列。

概念证明here(注意:Riviera-PRO EDU 2014.10似乎不能正确支持sequence端口列表,我不得不对信号进行硬编码。应该可以在任何支持IEEE Std 1800-2005或更高版本的完整模拟器中工作)

© www.soinside.com 2019 - 2024. All rights reserved.