forked from github/verilator
Fix structure parameter constant propagation, bug968.
Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
parent
6bda57da5d
commit
3c336e179f
2
Changes
2
Changes
@ -13,6 +13,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||
|
||||
**** Fix internal error on dotted refs into generates, bug958. [Jie Xu]
|
||||
|
||||
**** Fix structure parameter constant propagation, bug968. [Todd Strader]
|
||||
|
||||
**** Fix mis-optimizing public DPI functions, bug963. [Wei Song]
|
||||
|
||||
|
||||
|
@ -261,7 +261,8 @@ private:
|
||||
// as we don't figure out variable ordering.
|
||||
// Delayed is OK though, as we'll decode the next state separately.
|
||||
if (!nodep->varp()->dtypeSkipRefp()->castBasicDType()
|
||||
&& !nodep->varp()->dtypeSkipRefp()->castPackArrayDType())
|
||||
&& !nodep->varp()->dtypeSkipRefp()->castPackArrayDType()
|
||||
&& !nodep->varp()->dtypeSkipRefp()->castStructDType())
|
||||
clearOptimizable(nodep,"Array references/not basic");
|
||||
if (nodep->lvalue()) {
|
||||
if (m_inDlyAssign) {
|
||||
|
18
test_regress/t/t_static_elab_struct.pl
Executable file
18
test_regress/t/t_static_elab_struct.pl
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/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.
|
||||
|
||||
compile (
|
||||
);
|
||||
|
||||
execute (
|
||||
check_finished=>1,
|
||||
);
|
||||
|
||||
ok(1);
|
||||
1;
|
32
test_regress/t/t_static_elab_struct.v
Normal file
32
test_regress/t/t_static_elab_struct.v
Normal file
@ -0,0 +1,32 @@
|
||||
// DESCRIPTION: Verilator: Simple static elaboration case
|
||||
//
|
||||
// This file ONLY is placed into the Public Domain, for any use,
|
||||
// without warranty, 2015 by Todd Strader.
|
||||
|
||||
module t (/*AUTOARG*/);
|
||||
|
||||
typedef struct packed {
|
||||
logic [ 31 : 0 ] _five;
|
||||
} five_t;
|
||||
|
||||
function five_t gimme_five ();
|
||||
automatic five_t result;
|
||||
|
||||
result._five = 5;
|
||||
|
||||
return result;
|
||||
endfunction
|
||||
|
||||
localparam five_t FIVE = gimme_five();
|
||||
|
||||
initial begin
|
||||
if (FIVE._five != 5) begin
|
||||
$display("%%Error: Got 0b%b instead of 5", FIVE._five);
|
||||
$stop;
|
||||
end
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
||||
endmodule
|
Loading…
Reference in New Issue
Block a user