Fix optimized-out sentrees with --timing (#5080) (#5349)

Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
This commit is contained in:
Krzysztof Bieganski 2024-08-08 22:57:12 +02:00 committed by GitHub
parent b7af859ba3
commit 97e9996f0b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 49 additions and 0 deletions

View File

@ -2830,6 +2830,8 @@ class ConstVisitor final : public VNVisitor {
void visit(AstSenItem* nodep) override {
iterateChildren(nodep);
if (m_doNConst
&& !v3Global.opt.timing().isSetTrue() // If --timing, V3Sched would turn this into an
// infinite loop. See #5080
&& (VN_IS(nodep->sensp(), Const) || VN_IS(nodep->sensp(), EnumItemRef)
|| (nodep->varrefp() && nodep->varrefp()->varp()->isParam()))) {
// Constants in sensitivity lists may be removed (we'll simplify later)

View File

@ -0,0 +1,22 @@
#!/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 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"],
);
execute(
check_finished => 1,
);
ok(1);
1;

View File

@ -0,0 +1,25 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2022 by Antmicro Ltd.
// SPDX-License-Identifier: CC0-1.0
module t;
wire sig;
foo foo(sig);
initial #1 begin
$write("*-* All Finished *-*\n");
$finish();
end
endmodule
module foo(inout sig);
reg cond = $c(0);
always @(sig) begin
if (cond) begin
#1; $c("");
end
end
endmodule