Fix lost `$stop` on implied assertion `$error` failures.

This commit is contained in:
Wilson Snyder 2026-03-28 10:57:59 -04:00
parent 31757df229
commit e0b4d5ad44
5 changed files with 58 additions and 3 deletions

View File

@ -107,6 +107,7 @@ Verilator 5.047 devel
* Fix false ASSIGNIN on interface input ports driven from outside (#7322). [Yilou Wang]
* Fix static initialization order for packages with class hierarchies (#7324). [Yilou Wang]
* Fix `disable iff` imply-delay statement linking (#7337). [Nick Brereton]
* Fix lost `$stop` on implied assertion `$error` failures.
Verilator 5.046 2026-02-28

View File

@ -737,9 +737,8 @@ class AssertVisitor final : public VNVisitor {
// Cover adds COVERINC by AstNode::addNext, thus need to clone next too.
nodep->replaceWith(m_passsp->cloneTree(true));
} else if (!nodep->pass() && m_failsp) {
// Asserts with multiple statements are wrapped in implicit begin/end blocks so no
// need to clone next.
nodep->replaceWith(m_failsp->cloneTree(false));
// Stop may be added, thus need to clone next too.
nodep->replaceWith(m_failsp->cloneTree(true));
} else {
nodep->unlinkFrBack();
}

View File

@ -0,0 +1,3 @@
[50] %Error: t_assert_property_stop_bad.v:24: Assertion failed in t.__VforkTask_0: 'assert' failed.
%Error: t/t_assert_property_stop_bad.v:24: Verilog $stop
Aborting...

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.compile(verilator_flags2=['--binary'])
test.execute(fails=True, expect_filename=test.golden_filename)
test.passes()

View File

@ -0,0 +1,34 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
module t;
bit valid;
bit clk;
logic [7:0] out;
logic [7:0] in;
initial begin
valid = 1;
out = 2;
in = 2;
end
property prop;
@(posedge clk) (valid) |-> ##2 (out == in + 3);
endproperty
assert property (prop);
initial begin
forever begin
#(10) clk = ~clk;
end
end
initial #200 $finish;
endmodule