Fix constant function calls with uninit value (#2995).
This commit is contained in:
parent
e1f9fffb42
commit
2143bcfad5
1
Changes
1
Changes
|
|
@ -19,6 +19,7 @@ Verilator 4.203 devel
|
||||||
* Fix initialization of assoc in assoc array (#2914). [myftptoyman]
|
* Fix initialization of assoc in assoc array (#2914). [myftptoyman]
|
||||||
* Fix merging of assignments in C++ code (#2970). [Ruper Swarbrick]
|
* Fix merging of assignments in C++ code (#2970). [Ruper Swarbrick]
|
||||||
* Fix --protect-ids when using SV classes (#2994). [Geza Lore]
|
* Fix --protect-ids when using SV classes (#2994). [Geza Lore]
|
||||||
|
* Fix constant function calls with uninit value (#2995). [yanx21]
|
||||||
|
|
||||||
|
|
||||||
Verilator 4.202 2021-04-24
|
Verilator 4.202 2021-04-24
|
||||||
|
|
|
||||||
|
|
@ -979,6 +979,17 @@ private:
|
||||||
}
|
}
|
||||||
SimStackNode stackNode(nodep, &tconnects);
|
SimStackNode stackNode(nodep, &tconnects);
|
||||||
m_callStack.push_front(&stackNode);
|
m_callStack.push_front(&stackNode);
|
||||||
|
// Clear output variable
|
||||||
|
if (auto* const basicp = VN_CAST(funcp->fvarp(), Var)->basicp()) {
|
||||||
|
AstConst cnst(funcp->fvarp()->fileline(), AstConst::WidthedValue(), basicp->widthMin(),
|
||||||
|
0);
|
||||||
|
if (basicp->isZeroInit()) {
|
||||||
|
cnst.num().setAllBits0();
|
||||||
|
} else {
|
||||||
|
cnst.num().setAllBitsX();
|
||||||
|
}
|
||||||
|
newValue(funcp->fvarp(), &cnst);
|
||||||
|
}
|
||||||
// Evaluate the function
|
// Evaluate the function
|
||||||
iterate(funcp);
|
iterate(funcp);
|
||||||
m_callStack.pop_front();
|
m_callStack.pop_front();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2021 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(
|
||||||
|
);
|
||||||
|
|
||||||
|
execute(
|
||||||
|
check_finished => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
ok(1);
|
||||||
|
1;
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||||
|
// any use, without warranty, 2021 by Wilson Snyder.
|
||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
function int zeroed;
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function automatic integer what_bit;
|
||||||
|
input [31:0] a;
|
||||||
|
// what_bit = 0;
|
||||||
|
for (int i = 31; i >= 0; i = i - 1) begin
|
||||||
|
if (a[i] == 1'b1) begin
|
||||||
|
what_bit = i;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
module t(/*AUTOARG*/);
|
||||||
|
|
||||||
|
parameter ZERO = zeroed();
|
||||||
|
|
||||||
|
parameter PP = what_bit(0);
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
if (ZERO != 0) $stop;
|
||||||
|
if (PP != 'x) $stop;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue