Fix struct.enum.name method calls, bug855.

This commit is contained in:
Wilson Snyder 2015-10-23 22:57:15 -04:00
parent 281f4e04ee
commit 215d5f68b0
4 changed files with 44 additions and 1 deletions

View File

@ -29,6 +29,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix $fwrite to constant stderr/stdout, bug961. [Wei Song]
**** Fix struct.enum.name method calls, bug855. [Jonathon Donaldson]
* Verilator 3.876 2015-08-12

View File

@ -1389,7 +1389,7 @@ private:
} else {
AstSel* newp = new AstSel(nodep->fileline(), nodep->fromp()->unlinkFrBack(),
memberp->lsb(), memberp->width());
newp->dtypep(memberp->skipRefp()); // Must skip over the member to find the union; as the member may disappear later
newp->dtypep(memberp->subDTypep()->skipRefToEnump()); // Must skip over the member to find the union; as the member may disappear later
newp->didWidth(true); // Don't replace dtype with basic type
UINFO(9," MEMBERSEL -> "<<newp<<endl);
UINFO(9," dt-> "<<newp->dtypep()<<endl);

18
test_regress/t/t_enum_name3.pl Executable file
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,23 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2014 by Jonathon Donaldson.
// bug855
module our;
typedef enum logic {n,N} T_Flg_N;
typedef struct packed {
T_Flg_N N;
} T_PS_Reg;
T_PS_Reg PS = 1'b1;
initial begin
$write ("P:%s\n", PS.N.name);
$write("*-* All Finished *-*\n");
$finish;
end
endmodule