diff --git a/src/V3Active.cpp b/src/V3Active.cpp index 92a9c0918..1495cccff 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -655,7 +655,8 @@ class CovergroupSamplingVisitor final : public VNVisitor { if (AstCovergroup* const cgp = VN_CAST(memberp, Covergroup)) { // Unlink eventp from cgp so it survives cgp's deletion, // then take ownership in the map for use during the second pass. - if (cgp->eventp()) m_covergroupEvents[classp] = cgp->eventp()->unlinkFrBack(); + if (cgp->eventp()) + m_covergroupEvents[classp] = cgp->eventp()->unlinkFrBack(); cgp->unlinkFrBack(); VL_DO_DANGLING(cgp->deleteTree(), cgp); break; @@ -688,7 +689,8 @@ class CovergroupSamplingVisitor final : public VNVisitor { // Check if this covergroup has an automatic sampling event const auto evtIt = m_covergroupEvents.find(classp); - if (evtIt == m_covergroupEvents.end()) return; // No automatic sampling for this covergroup + if (evtIt == m_covergroupEvents.end()) + return; // No automatic sampling for this covergroup AstSenTree* const eventp = evtIt->second; // Get the sample CFunc from the map populated during the first pass diff --git a/src/V3Covergroup.cpp b/src/V3Covergroup.cpp index e6d9a01cd..d96f914e7 100644 --- a/src/V3Covergroup.cpp +++ b/src/V3Covergroup.cpp @@ -706,13 +706,11 @@ class FunctionalCoverageVisitor final : public VNVisitor { // Add default case (reset to state 0) to prevent CASEINCOMPLETE warnings, // since the state variable is wider than the number of valid states. - AstCaseItem* defaultItemp - = new AstCaseItem{binp->fileline(), nullptr, - new AstAssign{binp->fileline(), - new AstVarRef{binp->fileline(), stateVarp, - VAccess::WRITE}, - new AstConst{binp->fileline(), - AstConst::WidthedValue{}, 8, 0}}}; + AstCaseItem* defaultItemp = new AstCaseItem{ + binp->fileline(), nullptr, + new AstAssign{binp->fileline(), + new AstVarRef{binp->fileline(), stateVarp, VAccess::WRITE}, + new AstConst{binp->fileline(), AstConst::WidthedValue{}, 8, 0}}}; casep->addItemsp(defaultItemp); m_sampleFuncp->addStmtsp(casep); @@ -830,8 +828,7 @@ class FunctionalCoverageVisitor final : public VNVisitor { AstNodeExpr* makeRangeCondition(FileLine* fl, AstNodeExpr* exprp, AstNodeExpr* minp, AstNodeExpr* maxp) { if (exprp->isSigned()) { - return new AstAnd{fl, - new AstGteS{fl, exprp->cloneTree(false), minp->cloneTree(false)}, + return new AstAnd{fl, new AstGteS{fl, exprp->cloneTree(false), minp->cloneTree(false)}, new AstLteS{fl, exprp->cloneTree(false), maxp->cloneTree(false)}}; } // Unsigned: skip bounds that are trivially satisfied for the expression width @@ -841,8 +838,8 @@ class FunctionalCoverageVisitor final : public VNVisitor { bool skipLowerCheck = (minConstp && minConstp->toUQuad() == 0); bool skipUpperCheck = false; if (maxConstp && exprWidth > 0 && exprWidth <= 64) { - const uint64_t maxVal = (exprWidth == 64) ? ~static_cast(0) - : ((1ULL << exprWidth) - 1ULL); + const uint64_t maxVal + = (exprWidth == 64) ? ~static_cast(0) : ((1ULL << exprWidth) - 1ULL); skipUpperCheck = (maxConstp->toUQuad() == maxVal); } if (skipLowerCheck && skipUpperCheck) { @@ -904,9 +901,7 @@ class FunctionalCoverageVisitor final : public VNVisitor { } } - if (!condp) { - UINFO(4, " No valid transition conditions could be built" << endl); - } + if (!condp) { UINFO(4, " No valid transition conditions could be built" << endl); } return condp; } @@ -1336,9 +1331,8 @@ class FunctionalCoverageVisitor final : public VNVisitor { if (isWildcard) { rangeCondp = buildWildcardCondition(binp, exprp, constp); } else { - rangeCondp - = new AstEq{binp->fileline(), exprp->cloneTree(false), - constp->cloneTree(false)}; + rangeCondp = new AstEq{binp->fileline(), exprp->cloneTree(false), + constp->cloneTree(false)}; } } @@ -1590,14 +1584,21 @@ class FunctionalCoverageVisitor final : public VNVisitor { const std::string pageName = "v_covergroup/" + m_covergroupp->name(); AstCStmt* cstmtp = new AstCStmt{fl}; cstmtp->add("VL_COVER_INSERT(vlSymsp->_vm_contextp__->coveragep(), " - "\"" + hierName + "\", &("); + "\"" + + hierName + "\", &("); AstVarRef* const binVarRefp = new AstVarRef{fl, varp, VAccess::READ}; binVarRefp->selfPointer(VSelfPointerText{VSelfPointerText::This{}}); cstmtp->add(binVarRefp); - cstmtp->add("), \"page\", \"" + pageName + "\", " - "\"filename\", \"" + fl->filename() + "\", " - "\"lineno\", \"" + std::to_string(fl->lineno()) + "\", " - "\"column\", \"" + std::to_string(fl->firstColumn()) + "\", "); + cstmtp->add("), \"page\", \"" + pageName + + "\", " + "\"filename\", \"" + + fl->filename() + + "\", " + "\"lineno\", \"" + + std::to_string(fl->lineno()) + + "\", " + "\"column\", \"" + + std::to_string(fl->firstColumn()) + "\", "); if (binp->binsType() == VCoverBinsType::BINS_IGNORE) { cstmtp->add("\"bin\", \"" + binName + "\", \"bin_type\", \"ignore\");"); } else if (binp->binsType() == VCoverBinsType::BINS_ILLEGAL) {