Fix structure parameter constant propagation, bug968.

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Todd Strader 2015-09-29 21:02:33 -04:00 committed by Wilson Snyder
parent 6bda57da5d
commit 3c336e179f
4 changed files with 54 additions and 1 deletions

View File

@ -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]

View File

@ -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) {

View 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;

View 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