diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 3452c9b2f..d95001a2b 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -463,14 +463,19 @@ class UndrivenVisitor final : public VNVisitorConst { } if (entryp->isDrivenWhole() && !m_inBBox && !VN_IS(nodep, VarXRef) && !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType) - && nodep->fileline() != entryp->getNodeFileLinep() && !entryp->isUnderGen() + && nodep->fileline() != entryp->getNodeFileLinep() + && !entryp->isUnderGen() // EOM //&& entryp->getNodep()) { - && (entryp->getNodep() || (V3UndrivenCapture::enableWriteSummary && entryp->getCallNodep()))) { + && (entryp->getNodep() + || (V3UndrivenCapture::enableWriteSummary && entryp->getCallNodep()))) { // EOM - const AstNode* const otherWritep = entryp->getNodep() ? static_cast(entryp->getNodep()) - : (V3UndrivenCapture::enableWriteSummary ? entryp->getCallNodep() : nullptr); + const AstNode* const otherWritep + = entryp->getNodep() + ? static_cast(entryp->getNodep()) + : (V3UndrivenCapture::enableWriteSummary ? entryp->getCallNodep() + : nullptr); if (m_alwaysCombp && (!entryp->isDrivenAlwaysCombWhole() @@ -481,7 +486,8 @@ class UndrivenVisitor final : public VNVisitorConst { "Variable written to in always_comb also written by other process" << " (IEEE 1800-2023 9.2.2.2): " << nodep->prettyNameQ() << '\n' << nodep->warnOther() << '\n' - << nodep->warnContextPrimary() << '\n' + << nodep->warnContextPrimary() + << '\n' // EOM //<< entryp->getNodep()->warnOther() << otherWritep->warnOther() @@ -495,7 +501,8 @@ class UndrivenVisitor final : public VNVisitorConst { << " (IEEE 1800-2023 9.2.2.2): " << nodep->prettyNameQ() << '\n' << nodep->warnOther() << '\n' - << nodep->warnContextPrimary() << '\n' + << nodep->warnContextPrimary() + << '\n' //EOM //<< entryp->getNodep()->warnOther() << otherWritep->warnOther() @@ -578,19 +585,19 @@ class UndrivenVisitor final : public VNVisitorConst { if (!m_enableWriteSummary || !m_capturep) return; // If writeSummary is enabled, task/function definitions are treated as non-executed. - // Do not apply writeSummary at calls inside a task definition, or they will look like independent drivers (phantom MULTIDRIVEN). - // did the lambda on purpose - lessen chance of screwup in future edits. + // Do not apply writeSummary at calls inside a task definition, or they will look like + // independent drivers (phantom MULTIDRIVEN). did the lambda on purpose - lessen chance of + // screwup in future edits. //const auto inExecutedContext = [this]() const { - // return !(m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && !m_inBBox); + // return !(m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && + // !m_inBBox); //}; const auto inExecutedContext = [this]() { return !(m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && !m_inBBox); }; - if (!inExecutedContext()) { - return; - } + if (!inExecutedContext()) { return; } AstNodeFTask* const calleep = nodep->taskp(); if (!calleep) return; @@ -635,10 +642,12 @@ public: // CONSTRUCTORS // EOM // explicit UndrivenVisitor(AstNetlist* nodep) { iterateConst(nodep); } - explicit UndrivenVisitor(AstNetlist* nodep, V3UndrivenCapture* capturep, bool enableWriteSummary) : - m_capturep{capturep}, - m_enableWriteSummary{enableWriteSummary} - { iterateConst(nodep); } + explicit UndrivenVisitor(AstNetlist* nodep, V3UndrivenCapture* capturep, + bool enableWriteSummary) + : m_capturep{capturep} + , m_enableWriteSummary{enableWriteSummary} { + iterateConst(nodep); + } ~UndrivenVisitor() override { for (UndrivenVarEntry* ip : m_entryps[1]) ip->reportViolations(); diff --git a/src/V3UndrivenCapture.cpp b/src/V3UndrivenCapture.cpp index b7b2b439b..795fd69de 100644 --- a/src/V3UndrivenCapture.cpp +++ b/src/V3UndrivenCapture.cpp @@ -66,7 +66,9 @@ private: void visit(AstNodeVarRef* nodep) override { if (m_curTaskp && nodep->access().isWriteOrRW()) { ++g_stats.varWrites; - UINFO(DBG, "UndrivenCapture: direct write in " << taskNameQ(m_curTaskp) << " var=" << nodep->varp()->prettyNameQ() << " at " << nodep->fileline()); + UINFO(DBG, "UndrivenCapture: direct write in " + << taskNameQ(m_curTaskp) << " var=" << nodep->varp()->prettyNameQ() + << " at " << nodep->fileline()); m_cap.info(m_curTaskp).directWrites.push_back(nodep->varp()); } iterateChildrenConst(nodep); @@ -77,11 +79,13 @@ private: if (m_curTaskp) { if (AstNodeFTask* const calleep = nodep->taskp()) { ++g_stats.callEdges; - UINFO(DBG, "UndrivenCapture: call edge " << taskNameQ(m_curTaskp) << " -> " << taskNameQ(calleep)); + UINFO(DBG, "UndrivenCapture: call edge " << taskNameQ(m_curTaskp) << " -> " + << taskNameQ(calleep)); m_cap.info(m_curTaskp).callees.push_back(calleep); m_cap.info(calleep); } else { - UINFO(DBG, "UndrivenCapture: unresolved call in " << taskNameQ(m_curTaskp) << " name=" << nodep->name()); + UINFO(DBG, "UndrivenCapture: unresolved call in " << taskNameQ(m_curTaskp) + << " name=" << nodep->name()); } } iterateChildrenConst(nodep); // still scan pins/args @@ -118,7 +122,9 @@ V3UndrivenCapture::V3UndrivenCapture(AstNetlist* netlistp) { // Compute summaries for all tasks for (const auto& kv : m_info) (void)computeWriteSummary(kv.first); - UINFO(DBG, "UndrivenCapture: stats ftasks=" << g_stats.ftasks << " varWrites=" << g_stats.varWrites << " callEdges=" << g_stats.callEdges << " uniqueTasks=" << m_info.size()); + UINFO(DBG, "UndrivenCapture: stats ftasks=" + << g_stats.ftasks << " varWrites=" << g_stats.varWrites + << " callEdges=" << g_stats.callEdges << " uniqueTasks=" << m_info.size()); } void V3UndrivenCapture::gather(AstNetlist* netlistp) { @@ -142,11 +148,14 @@ const std::vector& V3UndrivenCapture::computeWriteSummar FTaskInfo& info = m_info[taskp]; if (info.state == State::DONE) { - UINFO(DBG, "UndrivenCapture: writeSummary cached size=" << info.writeSummary.size() << " for " << taskNameQ(taskp)); + UINFO(DBG, "UndrivenCapture: writeSummary cached size=" << info.writeSummary.size() + << " for " << taskNameQ(taskp)); return info.writeSummary; } if (info.state == State::VISITING) { - UINFO(DBG, "UndrivenCapture: recursion detected at " << taskNameQ(taskp) << " returning directWrites size=" << info.directWrites.size()); + UINFO(DBG, "UndrivenCapture: recursion detected at " + << taskNameQ(taskp) + << " returning directWrites size=" << info.directWrites.size()); // Cycle detected. Simple behaviour: // return directWrites only to guarantee termination. if (info.writeSummary.empty()) info.writeSummary = info.directWrites; @@ -168,7 +177,8 @@ const std::vector& V3UndrivenCapture::computeWriteSummar sortUniqueVars(info.writeSummary); - UINFO(DBG, "UndrivenCapture: writeSummary computed size=" << info.writeSummary.size() << " for " << taskNameQ(taskp)); + UINFO(DBG, "UndrivenCapture: writeSummary computed size=" << info.writeSummary.size() + << " for " << taskNameQ(taskp)); info.state = State::DONE; return info.writeSummary; @@ -180,11 +190,10 @@ void V3UndrivenCapture::debugDumpTask(FTask taskp, int level) const { UINFO(level, "UndrivenCapture: no entry for task " << taskp); return; } - UINFO(level, "UndrivenCapture: dump task " - << taskp << " " << taskp->prettyNameQ() - << " directWrites=" << infop->directWrites.size() - << " callees=" << infop->callees.size() - << " writeSummary=" << infop->writeSummary.size()); + UINFO(level, "UndrivenCapture: dump task " << taskp << " " << taskp->prettyNameQ() + << " directWrites=" << infop->directWrites.size() + << " callees=" << infop->callees.size() + << " writeSummary=" << infop->writeSummary.size()); } V3UndrivenCapture::FTaskInfo& V3UndrivenCapture::info(FTask taskp) { return m_info[taskp]; } diff --git a/src/V3UndrivenCapture.h b/src/V3UndrivenCapture.h index f5c127513..c940c53bf 100644 --- a/src/V3UndrivenCapture.h +++ b/src/V3UndrivenCapture.h @@ -70,7 +70,8 @@ public: // Lookup task/function capture info (nullptr if unknown). const FTaskInfo* find(FTask taskp) const; - // Get write through write through write, etc (call chain) writeSummary for a task/function (creates empty entry if needed). + // Get write through write through write, etc (call chain) writeSummary for a task/function + // (creates empty entry if needed). const std::vector& writeSummary(FTask taskp); // Optional: dump one task's summary (for debug bring-up). diff --git a/test_regress/t/t_lint_taskcall_multidriven_bad.py b/test_regress/t/t_lint_taskcall_multidriven_bad.py old mode 100644 new mode 100755