Fix enums in sensitivity lists

This commit is contained in:
Wilson Snyder 2013-02-02 14:37:18 -05:00
parent b4a8be07f3
commit ffb187ae15
3 changed files with 12 additions and 1 deletions

View File

@ -1273,6 +1273,7 @@ private:
nodep->iterateChildren(*this);
if (m_doNConst
&& (nodep->sensp()->castConst()
|| nodep->sensp()->castEnumItemRef()
|| (nodep->varrefp() && nodep->varrefp()->varp()->isParam()))) {
// Constants in sensitivity lists may be removed (we'll simplify later)
if (nodep->isClocked()) { // A constant can never get a pos/negexge
@ -1301,6 +1302,9 @@ private:
if (!senvarp) sensp->v3fatalSrc("Non-varref sensitivity variable");
sensp->replaceWith(senvarp);
sensp->deleteTree(); sensp=NULL;
} else if (!m_doNConst // Deal with later when doNConst missing
&& (nodep->sensp()->castEnumItemRef()
|| nodep->sensp()->castConst())) {
} else {
if (nodep->hasVar() && !nodep->varrefp()) nodep->v3fatalSrc("Null sensitivity variable");
}

View File

@ -183,7 +183,8 @@ private:
}
}
}
if (!nodep->sensp()->castNodeVarRef()) {
if (!nodep->sensp()->castNodeVarRef()
&& !nodep->sensp()->castEnumItemRef()) { // V3Const will cleanup
if (debug()) nodep->dumpTree(cout,"-tree: ");
nodep->v3error("Unsupported: Complex statement in sensitivity list");
}

View File

@ -15,6 +15,12 @@ module t;
reg [1:0] ttype;
reg m;
enum bit [1:0] { LOCAL } l;
always @ (m or 1'b0 or LOCAL) begin
// Don't complain about constants in sensitivity lists
end
initial begin
ttype = pkg::E__NOT;
m = (ttype == pkg::E__VAL);