mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
+14
-3
@@ -595,6 +595,7 @@ class AssertVisitor final : public VNVisitor {
|
||||
AstNodeExpr* propp = nullptr;
|
||||
for (AstCaseItem* itemp = nodep->itemsp(); itemp;
|
||||
itemp = VN_AS(itemp->nextp(), CaseItem)) {
|
||||
AstNodeExpr* itembitp = nullptr;
|
||||
for (AstNodeExpr* icondp = itemp->condsp(); icondp;
|
||||
icondp = VN_AS(icondp->nextp(), NodeExpr)) {
|
||||
AstNodeExpr* onep;
|
||||
@@ -612,17 +613,27 @@ class AssertVisitor final : public VNVisitor {
|
||||
nodep->exprp()->cloneTreePure(false),
|
||||
icondp->cloneTreePure(false));
|
||||
}
|
||||
// OR together all conditions within the same case item
|
||||
if (onep) {
|
||||
if (itembitp) {
|
||||
itembitp = new AstOr{icondp->fileline(), onep, itembitp};
|
||||
} else {
|
||||
itembitp = onep;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (itembitp) {
|
||||
if (propp) {
|
||||
propp = new AstConcat{icondp->fileline(), onep, propp};
|
||||
propp = new AstConcat{itemp->fileline(), itembitp, propp};
|
||||
} else {
|
||||
propp = onep;
|
||||
propp = itembitp;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Empty case means no property
|
||||
if (!propp) propp = new AstConst{nodep->fileline(), AstConst::BitFalse{}};
|
||||
const bool allow_none = has_default || nodep->unique0Pragma();
|
||||
// The following assertion lools as below.
|
||||
// The following assertion looks as below.
|
||||
// if (!$onehot(propp)) begin
|
||||
// if (propp == '0) begin if (!allow_none) $error("none match"); end
|
||||
// else $error("multiple match");
|
||||
|
||||
Reference in New Issue
Block a user