mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Improve message for priority case assertion failure (#4905)
This commit is contained in:
+12
-7
@@ -286,13 +286,19 @@ class AssertVisitor final : public VNVisitor {
|
||||
itemp = VN_AS(itemp->nextp(), CaseItem)) {
|
||||
if (itemp->isDefault()) has_default = true;
|
||||
}
|
||||
const AstNodeDType* exprDtypep = nodep->exprp()->dtypep()->skipRefp();
|
||||
string valFmt;
|
||||
if (exprDtypep->isIntegralOrPacked())
|
||||
valFmt = " for '" + cvtToStr(exprDtypep->widthMin()) + "'h%X'";
|
||||
if (nodep->fullPragma() || nodep->priorityPragma()) {
|
||||
// Need to add a default if there isn't one already
|
||||
++m_statAsFull;
|
||||
if (!has_default) {
|
||||
nodep->addItemsp(new AstCaseItem{
|
||||
nodep->fileline(), nullptr /*DEFAULT*/,
|
||||
newFireAssert(nodep, "synthesis full_case, but non-match found")});
|
||||
newFireAssert(
|
||||
nodep, nodep->pragmaString() + ", but non-match found" + valFmt,
|
||||
valFmt.empty() ? nullptr : nodep->exprp()->cloneTreePure(false))});
|
||||
}
|
||||
}
|
||||
if (nodep->parallelPragma() || nodep->uniquePragma() || nodep->unique0Pragma()) {
|
||||
@@ -344,14 +350,13 @@ class AssertVisitor final : public VNVisitor {
|
||||
new AstLogNot{nodep->fileline(), propp->cloneTreePure(false)}};
|
||||
AstNodeExpr* const exprp = nodep->exprp();
|
||||
const string pragmaStr = nodep->pragmaString();
|
||||
const string valFmt = "'" + cvtToStr(exprp->dtypep()->widthMin()) + "'h%X'";
|
||||
if (!allow_none)
|
||||
zeroIfp->addThensp(
|
||||
newFireAssert(nodep, pragmaStr + ", but none matched for " + valFmt,
|
||||
exprp->cloneTreePure(false)));
|
||||
zeroIfp->addElsesp(newFireAssert(
|
||||
nodep, pragmaStr + ", but multiple matches found for " + valFmt,
|
||||
exprp->cloneTreePure(false)));
|
||||
newFireAssert(nodep, pragmaStr + ", but none matched" + valFmt,
|
||||
valFmt.empty() ? nullptr : exprp->cloneTreePure(false)));
|
||||
zeroIfp->addElsesp(
|
||||
newFireAssert(nodep, pragmaStr + ", but multiple matches found" + valFmt,
|
||||
valFmt.empty() ? nullptr : exprp->cloneTreePure(false)));
|
||||
ohotIfp->addThensp(zeroIfp);
|
||||
ohotIfp->isBoundsCheck(true); // To avoid LATCH warning
|
||||
ohotIfp->branchPred(VBranchPred::BP_UNLIKELY);
|
||||
|
||||
Reference in New Issue
Block a user