From d9d153a217d12e8d7036b6f232c44f99b1e22fab Mon Sep 17 00:00:00 2001 From: Yilou Wang Date: Wed, 10 Jun 2026 15:55:34 +0200 Subject: [PATCH] Cover virtual interface dispatch in assertion control test --- test_regress/t/t_assert_ctl_immediate.out | 11 ++++++----- test_regress/t/t_assert_ctl_immediate.v | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/test_regress/t/t_assert_ctl_immediate.out b/test_regress/t/t_assert_ctl_immediate.out index b0cbe48c5..cfd6811b6 100644 --- a/test_regress/t/t_assert_ctl_immediate.out +++ b/test_regress/t/t_assert_ctl_immediate.out @@ -3,9 +3,10 @@ [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:138: Assertion failed in top.t.module_with_method_ctl: 'assert' failed. -[0] %Error: t_assert_ctl_immediate.v:122: Assertion failed in top.t.module_with_method_ctl.Ctl.check_positive: 'assert' failed. -[0] %Error: t_assert_ctl_immediate.v:148: Assertion failed in top.t.module_with_method_ctl: 'assert' failed. -[0] %Error: t_assert_ctl_immediate.v:90: Assertion failed in top.t.module_with_method_ctl.iface.check_positive: 'assert' failed. -[0] %Error: t_assert_ctl_immediate.v:158: Assertion failed in top.t.module_with_method_ctl: '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:124: 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:91: 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:173: Assertion failed in top.t.module_with_method_ctl: 'assert' failed. *-* All Finished *-* diff --git a/test_regress/t/t_assert_ctl_immediate.v b/test_regress/t/t_assert_ctl_immediate.v index 24f0abe27..18ef2775d 100644 --- a/test_regress/t/t_assert_ctl_immediate.v +++ b/test_regress/t/t_assert_ctl_immediate.v @@ -77,6 +77,7 @@ endmodule // - assert that lives inside a class method (obeys context-global gating) // - interface function $assertoff / $asserton // - assert inside an interface function +// - virtual interface dispatch to an assertion-control function // - interface class (AstClass with isInterfaceClass) via a concrete impl interface AssertCtlIf; @@ -109,6 +110,7 @@ endclass module module_with_method_ctl; class Ctl; + virtual AssertCtlIf vif; static function void off_all(); $assertcontrol(4); endfunction @@ -121,6 +123,12 @@ module module_with_method_ctl; function void check_positive(int v); assert (v > 0); endfunction + function void vif_suppress(); + vif.suppress(); + endfunction + function void vif_enable(); + vif.enable(); + endfunction endclass Ctl c; @@ -151,6 +159,13 @@ module module_with_method_ctl; iface.enable(); iface.check_positive(-2); // assert inside iface fn, fires + // --- virtual interface dispatch coverage --- + c.vif = iface; + c.vif_suppress(); + assert (0); // gated via virtual interface dispatch -> no fire + c.vif_enable(); + assert (0); // fires + // --- interface class via concrete impl --- impl.suppress(); assert (0); // gated via interface-class impl -> no fire