Fix false INFINITELOOP on forever..mailbox.get() (#4323).

This commit is contained in:
Wilson Snyder 2023-09-15 22:05:55 -04:00
parent aa608472ae
commit 19f7279542
6 changed files with 71 additions and 2 deletions

View File

@ -19,6 +19,7 @@ Verilator 5.015 devel
* Support no-parentheses calls to static methods (#4432). [Krzysztof Boroński]
* Support 'let'.
* Fix Windows filename format, etc (#3873) (#4421). [Anthony Donlon].
* Fix false INFINITELOOP on forever..mailbox.get() (#4323). [Srinivasan Venkataramanan]
* Fix data type of condition operation on class objects (#4345) (#4352). [Ryszard Rozak, Antmicro Ltd]
* Fix ++/-- under statements (#4399). [Aleksander Kiryk, Antmicro Ltd]
* Fix detection of mixed blocking and nonblocking assignment in nested assignments (#4404). [Ryszard Rozak, Antmicro Ltd]

View File

@ -3204,8 +3204,17 @@ private:
iterateChildren(nodep);
}
void visit(AstFuncRef* nodep) override {
void visit(AstNodeCCall* nodep) override {
iterateChildren(nodep);
m_hasJumpDelay = true; // As don't analyze inside tasks for timing controls
}
void visit(AstNodeFTaskRef* nodep) override {
// Note excludes AstFuncRef as other visitor below
iterateChildren(nodep);
m_hasJumpDelay = true; // As don't analyze inside tasks for timing controls
}
void visit(AstFuncRef* nodep) override {
visit(static_cast<AstNodeFTaskRef*>(nodep));
if (m_params) { // Only parameters force us to do constant function call propagation
replaceWithSimulation(nodep);
}

View File

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

View File

@ -0,0 +1,36 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
mailbox #(int) mbox;
task main();
// See issue #4323; not an INFINITELOOP due to delay inside get()
forever begin
int i;
mbox.get(i);
$display("[%0t] Got %0d", $time, i);
end
endtask
initial begin
mbox = new (1);
#10;
fork
main();
join_none
#10;
mbox.put(10);
mbox.put(11);
#10;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule

View File

@ -10,5 +10,6 @@ module t ();
forever begin end
// verilator lint_off UNSIGNED
for (reg [31:0] i=0; i>=0; i=i+1) begin end
$display; // So loop not eaten
end
endmodule

View File

@ -15,7 +15,6 @@ compile(
"-Wno-PKGNODECL -Wno-IMPLICITSTATIC -Wno-CONSTRAINTIGN -Wno-MISINDENT",
"-Wno-CASEINCOMPLETE -Wno-CASTCONST -Wno-SYMRSVDWORD -Wno-WIDTHEXPAND -Wno-WIDTHTRUNC",
"-Wno-REALCVT", # TODO note mostly related to $realtime - could suppress or fix upstream
"-Wno-INFINITELOOP" , # TODO issue #4323, false warning
"-Wno-RANDC", # TODO issue #4349, add support
"-Wno-ZERODLY", # TODO issue #4494, add support
],