forked from github/verilator
Fix generate case with empty body statements.
This commit is contained in:
parent
15d0ec317d
commit
10d0088f73
1
Changes
1
Changes
@ -85,6 +85,7 @@ Verilator 5.006 2023-01-22
|
|||||||
* Fix elaboration of member selected classes (#3890). [Ilya Barkov]
|
* Fix elaboration of member selected classes (#3890). [Ilya Barkov]
|
||||||
* Fix mismatched widths in DFG (#3872). [Geza Lore, Yike Zhou]
|
* Fix mismatched widths in DFG (#3872). [Geza Lore, Yike Zhou]
|
||||||
* Fix lint for non-integral types in packed structs.
|
* Fix lint for non-integral types in packed structs.
|
||||||
|
* Fix generate case with empty body statements.
|
||||||
|
|
||||||
|
|
||||||
Verilator 5.004 2022-12-14
|
Verilator 5.004 2022-12-14
|
||||||
|
@ -1250,6 +1250,7 @@ class ParamVisitor final : public VNVisitor {
|
|||||||
}
|
}
|
||||||
void visit(AstGenCase* nodep) override {
|
void visit(AstGenCase* nodep) override {
|
||||||
UINFO(9, " GENCASE " << nodep << endl);
|
UINFO(9, " GENCASE " << nodep << endl);
|
||||||
|
bool hit = false;
|
||||||
AstNode* keepp = nullptr;
|
AstNode* keepp = nullptr;
|
||||||
iterateAndNextNull(nodep->exprp());
|
iterateAndNextNull(nodep->exprp());
|
||||||
V3Case::caseLint(nodep);
|
V3Case::caseLint(nodep);
|
||||||
@ -1275,7 +1276,10 @@ class ParamVisitor final : public VNVisitor {
|
|||||||
if (const AstConst* const ccondp = VN_CAST(ep, Const)) {
|
if (const AstConst* const ccondp = VN_CAST(ep, Const)) {
|
||||||
V3Number match{nodep, 1};
|
V3Number match{nodep, 1};
|
||||||
match.opEq(ccondp->num(), exprp->num());
|
match.opEq(ccondp->num(), exprp->num());
|
||||||
if (!keepp && match.isNeqZero()) keepp = itemp->stmtsp();
|
if (!hit && match.isNeqZero()) {
|
||||||
|
hit = true;
|
||||||
|
keepp = itemp->stmtsp();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
itemp->v3error("Generate Case item does not evaluate to constant");
|
itemp->v3error("Generate Case item does not evaluate to constant");
|
||||||
}
|
}
|
||||||
@ -1286,7 +1290,10 @@ class ParamVisitor final : public VNVisitor {
|
|||||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp;
|
for (AstCaseItem* itemp = nodep->itemsp(); itemp;
|
||||||
itemp = VN_AS(itemp->nextp(), CaseItem)) {
|
itemp = VN_AS(itemp->nextp(), CaseItem)) {
|
||||||
if (itemp->isDefault()) {
|
if (itemp->isDefault()) {
|
||||||
if (!keepp) keepp = itemp->stmtsp();
|
if (!hit) {
|
||||||
|
hit = true;
|
||||||
|
keepp = itemp->stmtsp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Replace
|
// Replace
|
||||||
|
Loading…
Reference in New Issue
Block a user