Add assertion on firing event inside class (#5597)

This commit is contained in:
Wilson Snyder 2024-11-09 09:28:40 -05:00
parent 138daaf565
commit 1e546bb9d9
4 changed files with 51 additions and 0 deletions

View File

@ -891,6 +891,7 @@ class DelayedVisitor final : public VNVisitor {
ifp->addThensp(newp);
}
UASSERT_OBJ(m_activep, nodep, "No active to handle FireEvent");
AstActive* const activep = new AstActive{flp, "nba-event", m_activep->sensesp()};
m_activep->addNextHere(activep);
activep->addStmtsp(prep);

View File

@ -0,0 +1,5 @@
%Error: Internal Error: t/t_event_class_fire.v:10:7: ../V3Delayed.cpp:#: No active to handle FireEvent
: ... note: In instance '$unit::Cls'
10 | ->> e;
| ^~~
... See the manual at https://verilator.org/verilator_doc.html for more assistance.

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 by Wilson Snyder. 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
# Issue #5597 makes this fail
test.compile(fails=test.vlt_all,
expect_filename=test.golden_filename,
verilator_flags2=['--timing'])
#test.execute()
test.passes()

View File

@ -0,0 +1,24 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2024 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
class Cls;
event e;
task trig_e();
->> e;
endtask
endclass
module top();
event e;
initial begin
Cls c;
c = new;
c.trig_e();
wait(e.triggered);
$write("*-* All Finished *-*\n");
$finish;
end
endmodule