Set the global `usesTiming` flag if forks exist (#4274)

This commit is contained in:
Krzysztof Bieganski 2023-06-06 15:35:12 +02:00 committed by GitHub
parent 186c851695
commit 058233fc87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 0 deletions

View File

@ -216,6 +216,13 @@ private:
m_procp = nodep; m_procp = nodep;
iterateChildren(nodep); iterateChildren(nodep);
} }
void visit(AstFork* nodep) override {
v3Global.setUsesTiming(); // Even if there are no event controls, we have to set this flag
// so that transformForks() in V3SchedTiming gets called and
// removes all forks and begins
if (nodep->isTimingControl() && m_procp) m_procp->user2(T_SUSP);
iterateChildren(nodep);
}
void visit(AstNode* nodep) override { void visit(AstNode* nodep) override {
if (nodep->isTimingControl()) { if (nodep->isTimingControl()) {
v3Global.setUsesTiming(); v3Global.setUsesTiming();

View File

@ -0,0 +1,28 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2023 by Antmicro Ltd. 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
scenarios(simulator => 1);
if (!$Self->have_coroutines) {
skip("No coroutine support");
}
else {
compile(
verilator_flags2 => ["--exe --main --timing"],
make_main => 0,
);
execute(
check_finished => 1,
);
}
ok(1);
1;

View File

@ -0,0 +1,15 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Antmicro Ltd.
// SPDX-License-Identifier: CC0-1.0
module t;
initial
fork
begin
$write("*-* All Finished *-*\n");
$finish;
end
join_none
endmodule