Fix error on "unique case" with no cases.

This commit is contained in:
Wilson Snyder 2017-11-21 21:52:37 -05:00
parent 0d645757e7
commit 7c443ab108
3 changed files with 11 additions and 0 deletions

View File

@ -20,6 +20,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix false unused warning on interfaces, bug1241. [Laurens van Dam]
**** Fix error on "unique case" with no cases.
* Verilator 3.914 2017-10-14

View File

@ -202,6 +202,9 @@ private:
AstNode *newifp = nodep->cloneTree(false);
bool allow_none = nodep->unique0Pragma();
// Empty case means no property
if (!propp) propp = new AstConst(nodep->fileline(), AstConst::LogicFalse());
// Note: if this ends with an 'else', then we don't need to validate that one of the
// predicates evaluates to true.
AstNode* ohot = ((allow_none || hasDefaultElse)
@ -259,6 +262,9 @@ private:
else propp = onep;
}
}
// Empty case means no property
if (!propp) propp = new AstConst(nodep->fileline(), AstConst::LogicFalse());
bool allow_none = has_default || nodep->unique0Pragma();
AstNode* ohot = (allow_none
? static_cast<AstNode*>(new AstOneHot0(nodep->fileline(), propp))

View File

@ -20,6 +20,9 @@ module t;
2'b01 : ;
2'b1? : ;
endcase
unique casez (1'b1)
default: ;
endcase
$write("*-* All Finished *-*\n");
$finish;
end