Fix x-valued parameters with --x-assign unique (#5129).

This commit is contained in:
Wilson Snyder 2024-05-21 08:07:57 -04:00
parent 5f85c89425
commit f84592af49
5 changed files with 47 additions and 3 deletions

View File

@ -49,6 +49,7 @@ Verilator 5.025 devel
* Fix method calls parsing in constraints (#5110). [Arkadiusz Kozdra, Antmicro Ltd.]
* Fix vpiInertialDelay for memories (#5113). [Todd Strader]
* Fix references to ports in forks (#5123). [Krzysztof Bieganski, Antmicro Ltd.]
* Fix x-valued parameters with `--x-assign unique` (#5129). [Ethan Sifferman]
Verilator 5.024 2024-04-05

View File

@ -1744,9 +1744,9 @@ Summary:
.. note::
This option applies only to values explicitly written as X
in modules (not classes) in the Verilog source code. Initial values
of clocks are set to 0 unless `--x-initial-edge` is
This option applies only to values explicitly written as X in modules
(not classes, nor parameters) in the Verilog source code. Initial
values of clocks are set to 0 unless `--x-initial-edge` is
specified. Initial values of all other state holding variables are
controlled with `--x-initial`.

View File

@ -192,6 +192,11 @@ class UnknownVisitor final : public VNVisitor {
iterateChildren(nodep);
}
}
void visit(AstVar* nodep) override {
VL_RESTORER(m_allowXUnique);
if (nodep->isParam()) m_allowXUnique = false;
iterateChildren(nodep);
}
void visitEqNeqCase(AstNodeBiop* nodep) {
UINFO(4, " N/EQCASE->EQ " << nodep << endl);
V3Const::constifyEdit(nodep->lhsp()); // lhsp may change

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 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
scenarios(simulator => 1);
compile(
verilator_flags2 => ["--trace-fst --x-assign unique"],
);
execute(
check_finished => 1,
);
ok(1);
1;

View File

@ -0,0 +1,16 @@
// 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
module sub #(parameter P = 1'bx);
initial begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule
module t;
sub sub();
endmodule