Fix reporting struct members as reserved words, bug741.

This commit is contained in:
Wilson Snyder 2014-04-15 19:35:44 -04:00
parent 0dbdbffba7
commit 6b2ee0fcf3
4 changed files with 22 additions and 0 deletions

View File

@ -31,6 +31,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix power operator calculation, bug730, bug735. [Clifford Wolf]
**** Fix reporting struct members as reserved words, bug741. [Chris Randall]
**** Fix Mac OS-X test issues. [Holger Waechtler]
**** Fix C++-2011 warnings.

View File

@ -203,6 +203,7 @@ class EmitCSyms : EmitCBaseVisitor {
}
}
virtual void visit(AstVar* nodep, AstNUser*) {
nameCheck(nodep);
nodep->iterateChildren(*this);
if (nodep->isSigUserRdPublic()
&& !nodep->isParam()) { // The VPI functions require a pointer to allow modification, but parameters are constants
@ -220,6 +221,7 @@ class EmitCSyms : EmitCBaseVisitor {
nodep->iterateChildren(*this);
}
virtual void visit(AstCFunc* nodep, AstNUser*) {
nameCheck(nodep);
if (nodep->dpiImport() || nodep->dpiExportWrapper()) {
m_dpis.push_back(nodep);
}

View File

@ -107,6 +107,18 @@ private:
nodep->iterateChildren(*this);
}
}
virtual void visit(AstMemberDType* nodep, AstNUser*) {
if (!nodep->user1()) {
rename(nodep, false);
nodep->iterateChildren(*this);
}
}
virtual void visit(AstMemberSel* nodep, AstNUser*) {
if (!nodep->user1()) {
rename(nodep, false);
nodep->iterateChildren(*this);
}
}
virtual void visit(AstScope* nodep, AstNUser*) {
if (!nodep->user1SetOnce()) {
if (nodep->aboveScopep()) nodep->aboveScopep()->iterate(*this);

View File

@ -15,10 +15,16 @@ module t (/*AUTOARG*/
reg vector; // OK, as not public
reg switch /*verilator public*/; // Bad
typedef struct packed {
logic [31:0] vector; // OK, as not public
} test;
test t;
// global is a 1800-2009 reserved word, but we allow it when possible.
reg global;
initial begin
t.vector = 1;
$write("*-* All Finished *-*\n");
$finish;
end