From 77e6a21224d76ff2a0335c907c20a25736bbfb9b Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sun, 14 Jun 2026 16:29:27 +0100 Subject: [PATCH] Internals: Inline AstVar::isToggleCoverable() Inline into the single call site, remove unnecessary isSc() and isPrimaryIO() guards (these flags are set only in a later pass). No functional change. --- src/V3AstNodeOther.h | 6 ------ src/V3Coverage.cpp | 9 ++++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 1308818be..b08033033 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -2458,12 +2458,6 @@ public: bool isWor() const { return varType().isWor(); } bool isWiredNet() const { return varType().isWiredNet(); } bool isTemp() const { return varType().isTemp(); } - bool isToggleCoverable() const { - return ((isIO() || isSignal()) - && (isIO() || isBitLogic()) - // Wrapper would otherwise duplicate wrapped module's coverage - && !isSc() && !isPrimaryIO() && !isConst() && !isDouble() && !isString()); - } bool isClassMember() const { return varType() == VVarType::MEMBER; } bool isVirtIface() const { if (AstIfaceRefDType* const dtp = VN_CAST(dtypep(), IfaceRefDType)) { diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index 6d1ff5bc1..12bb973dc 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -166,10 +166,13 @@ class CoverageVisitor final : public VNVisitor { // METHODS + // Return non-nullptr reason if this variable shouldn't have toggle coverage const char* varIgnoreToggle(const AstVar* nodep) { - // Return true if this shouldn't be traced - // See also similar rule in V3TraceDecl::varIgnoreTrace - if (!nodep->isToggleCoverable()) return "Not relevant signal type"; + const bool cover = nodep->isIO() || (nodep->isSignal() && nodep->isBitLogic()); + if (!cover) return "Not relevant signal"; + if (nodep->isConst()) return "Signal is constant"; + if (nodep->isDouble()) return "Signal is double"; + if (nodep->isString()) return "Signal is string"; if (!v3Global.opt.coverageUnderscore()) { const string prettyName = nodep->prettyName(); if (prettyName[0] == '_') return "Leading underscore";