In order to turn off an immediate assertion, I need to specify its full path.
i.e: $assertoff (test.a_sc.ASRT)
Is there a way not to specify the full path?
i.e: $assertoff (ASRT) [this method does not work].
If not, is the only way is to wrap the assertion with ‘if’ statement, when I want to disable it?
Snapshot of current code:
module test;
bit a;
always begin : a_sc
ASRT: assert (a)
else $assertoff (test.a_sc.ASRT);
end
endmodule
module my_control (input bit clk, a, b);
// Assertion controls
let LOCK = 1; // assertion control type
let UNLOCK = 2; // assertion control type
let ON = 3; // assertion control type
let OFF = 4; // assertion control type
let KILL = 5; // assertion control type
let PASSON = 6; // assertion control type
let PASSOFF = 7; // assertion control type
let FAILON = 8; // assertion control type
let FAILOFF = 9; // assertion control type
let NONVACUOUSON = 10; // assertion control type
let VACUOUSOFF = 11; // assertion control type
initial begin : disable_assertions_during_reset
$display ("%0t %m Disabling assertions during init..", $time);
//$assertoff (0, top_tb.cpu_rtl_1);
// $assertoff;
$assertcontrol(OFF); // using default values of all other arguments
@ (top_tb.reset_n ==1'b1);
$display ("%0t %m Enabling assertions after init..", $time);
//$asserton (0, top_tb.cpu_rtl_1);
//$asserton;
$assertcontrol(ON);
end
always_comb ap_0: assert property (@(posedge clk) a) else $display("fail, my control a==%b", $sampled(a));
endmodule : my_control
Thank you Ben,
I’ll try to be more specific:
Please consider the following example:
I am trying to disable ‘CHK_ASRT’ only, not ‘CHK_ASRT2’.
Here it disable both.
Any solution without full path?
Thanks
Beeri
module test ();
shortint unsigned err_cnt;
initial begin : bg
fork
repeat (10) begin
CHK_ASRT:
assert ('0)
else begin
err_cnt++;
$error ("Found error #1");
//I only want to disable this checker
if (err_cnt == 2) $assertoff ; //But this also disables 'CHK_ASRT2'.
end
#1;
end
repeat (10) begin
CHK_ASRT_2:
assert ('0)
else
$error ("Found error #2");
//This checker should not be disabled, but the '$assertoff' disabled also this one
#1;
end
join
$finish;
end
endmodule : test
module test ();
shortint unsigned err_cnt;
bit a_en;
initial begin : bg
a_en=1'b1;
fork
repeat (10) begin
if(a_en) CHK_ASRT: assert ('0)
else begin
err_cnt++;
$error ("Found error #1");
//I only want to disable this checker
if (err_cnt == 2) a_en=1'b0; // $assertoff ; //But this also disables 'CHK_ASRT2'.
end
#1;
end
repeat (10) begin
CHK_ASRT_2:
assert ('0)
else
$error ("Found error #2");
//This checker should not be disabled, but the '$assertoff' disabled also this one
#1;
end
join
$finish;
end
endmodule : test