Fix enum items under packages.

This commit is contained in:
Wilson Snyder 2013-02-02 14:11:50 -05:00
parent 4968a2abc5
commit b4a8be07f3
3 changed files with 53 additions and 0 deletions

View File

@ -103,6 +103,7 @@ public:
if (!diddump && v3Global.opt.dumpTree()) { if (!diddump && v3Global.opt.dumpTree()) {
diddump = true; diddump = true;
m_syms.dumpFilePrefixed("linkdot-preerr"); m_syms.dumpFilePrefixed("linkdot-preerr");
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("linkdot-preerr.tree"));
} }
} }
@ -1445,6 +1446,10 @@ private:
} }
} }
} }
virtual void visit(AstEnumItemRef* nodep, AstNUser*) {
// EnumItemRef may be under a dot. Should already be resolved.
nodep->iterateChildren(*this);
}
virtual void visit(AstVar* nodep, AstNUser*) { virtual void visit(AstVar* nodep, AstNUser*) {
checkNoDot(nodep); checkNoDot(nodep);
nodep->iterateChildren(*this); nodep->iterateChildren(*this);

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,30 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013 by Wilson Snyder.
package pkg;
typedef enum bit [1:0]
{
E__NOT = 2'b00,
E__VAL = 2'b11
} E_t;
endpackage
module t;
reg [1:0] ttype;
reg m;
initial begin
ttype = pkg::E__NOT;
m = (ttype == pkg::E__VAL);
if (m != 1'b0) $stop;
ttype = pkg::E__VAL;
m = (ttype == pkg::E__VAL);
if (m != 1'b1) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule