Test assertion control with multiple class and interface instances
This commit is contained in:
parent
d9d153a217
commit
efa28f646a
|
|
@ -3,10 +3,13 @@
|
||||||
[0] %Error: t_assert_ctl_immediate.v:58: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:58: Assertion failed in top.t.module_with_assertctl: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:46: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:46: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:46: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:46: Assertion failed in top.t.module_with_assertctl.f_assert: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:146: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:159: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:124: Assertion failed in top.t.module_with_method_ctl.Ctl.check_positive: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:132: Assertion failed in top.t.module_with_method_ctl.Ctl.check_positive: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:156: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:169: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:91: Assertion failed in top.t.module_with_method_ctl.iface.check_positive: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:93: Assertion failed in top.t.module_with_method_ctl.iface.check_positive: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:167: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:180: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
[0] %Error: t_assert_ctl_immediate.v:173: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
[0] %Error: t_assert_ctl_immediate.v:186: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
|
[0] %Error: t_assert_ctl_immediate.v:195: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
|
[0] %Error: t_assert_ctl_immediate.v:199: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
|
[0] %Error: t_assert_ctl_immediate.v:203: Assertion failed in top.t.module_with_method_ctl: 'assert' failed.
|
||||||
*-* All Finished *-*
|
*-* All Finished *-*
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ endmodule
|
||||||
// - assert inside an interface function
|
// - assert inside an interface function
|
||||||
// - virtual interface dispatch to an assertion-control function
|
// - virtual interface dispatch to an assertion-control function
|
||||||
// - interface class (AstClass with isInterfaceClass) via a concrete impl
|
// - interface class (AstClass with isInterfaceClass) via a concrete impl
|
||||||
|
// - multiple instances of each thing: OFF via one instance, ON via another
|
||||||
|
// (assertion control is global per-context, IEEE 1800-2023 20.11)
|
||||||
|
|
||||||
interface AssertCtlIf;
|
interface AssertCtlIf;
|
||||||
function void suppress();
|
function void suppress();
|
||||||
|
|
@ -120,6 +122,12 @@ module module_with_method_ctl;
|
||||||
function void kill_all();
|
function void kill_all();
|
||||||
$assertkill;
|
$assertkill;
|
||||||
endfunction
|
endfunction
|
||||||
|
function void inst_off();
|
||||||
|
$assertoff;
|
||||||
|
endfunction
|
||||||
|
function void inst_on();
|
||||||
|
$asserton;
|
||||||
|
endfunction
|
||||||
function void check_positive(int v);
|
function void check_positive(int v);
|
||||||
assert (v > 0);
|
assert (v > 0);
|
||||||
endfunction
|
endfunction
|
||||||
|
|
@ -132,12 +140,17 @@ module module_with_method_ctl;
|
||||||
endclass
|
endclass
|
||||||
|
|
||||||
Ctl c;
|
Ctl c;
|
||||||
|
Ctl c2;
|
||||||
AssertCtlIf iface ();
|
AssertCtlIf iface ();
|
||||||
|
AssertCtlIf iface2 ();
|
||||||
IAssertCtlImpl impl;
|
IAssertCtlImpl impl;
|
||||||
|
IAssertCtlImpl impl2;
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
c = new;
|
c = new;
|
||||||
|
c2 = new;
|
||||||
impl = new;
|
impl = new;
|
||||||
|
impl2 = new;
|
||||||
|
|
||||||
// --- class method coverage ---
|
// --- class method coverage ---
|
||||||
Ctl::off_all();
|
Ctl::off_all();
|
||||||
|
|
@ -172,6 +185,23 @@ module module_with_method_ctl;
|
||||||
impl.enable();
|
impl.enable();
|
||||||
assert (0); // fires
|
assert (0); // fires
|
||||||
|
|
||||||
|
// --- multiple instances: OFF via one instance, ON via another ---
|
||||||
|
// Assertion control is global per-context (IEEE 1800-2023 20.11, no scope
|
||||||
|
// list), so OFF issued via one instance gates every assertion and ON issued
|
||||||
|
// via a different instance re-enables them.
|
||||||
|
c.inst_off(); // class: OFF via c
|
||||||
|
assert (0); // gated -> no fire
|
||||||
|
c2.inst_on(); // class: ON via c2
|
||||||
|
assert (0); // fires
|
||||||
|
iface.suppress(); // interface: OFF via iface
|
||||||
|
assert (0); // gated -> no fire
|
||||||
|
iface2.enable(); // interface: ON via iface2
|
||||||
|
assert (0); // fires
|
||||||
|
impl.suppress(); // interface class: OFF via impl
|
||||||
|
assert (0); // gated -> no fire
|
||||||
|
impl2.enable(); // interface class: ON via impl2
|
||||||
|
assert (0); // fires
|
||||||
|
|
||||||
// --- $assertkill (last: terminal per IEEE 1800-2023 Table 20-5) ---
|
// --- $assertkill (last: terminal per IEEE 1800-2023 Table 20-5) ---
|
||||||
c.kill_all();
|
c.kill_all();
|
||||||
assert (0); // killed -> no fire
|
assert (0); // killed -> no fire
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue