mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Add assertion on firing event inside class (#5597)
This commit is contained in:
parent
138daaf565
commit
1e546bb9d9
@ -891,6 +891,7 @@ class DelayedVisitor final : public VNVisitor {
|
|||||||
ifp->addThensp(newp);
|
ifp->addThensp(newp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UASSERT_OBJ(m_activep, nodep, "No active to handle FireEvent");
|
||||||
AstActive* const activep = new AstActive{flp, "nba-event", m_activep->sensesp()};
|
AstActive* const activep = new AstActive{flp, "nba-event", m_activep->sensesp()};
|
||||||
m_activep->addNextHere(activep);
|
m_activep->addNextHere(activep);
|
||||||
activep->addStmtsp(prep);
|
activep->addStmtsp(prep);
|
||||||
|
5
test_regress/t/t_event_class_fire.out
Normal file
5
test_regress/t/t_event_class_fire.out
Normal 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.
|
21
test_regress/t/t_event_class_fire.py
Executable file
21
test_regress/t/t_event_class_fire.py
Executable 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()
|
24
test_regress/t/t_event_class_fire.v
Normal file
24
test_regress/t/t_event_class_fire.v
Normal 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
|
Loading…
Reference in New Issue
Block a user