From 935b3bf9ea9d01dfc19e4aef8b426d4c28a34c4e Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 26 Mar 2026 08:51:07 +0100 Subject: [PATCH] Check for timing control only once Signed-off-by: Kamil Danecki --- src/V3LinkParse.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 23811b13d..9ae1493fa 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -69,6 +69,7 @@ class LinkParseVisitor final : public VNVisitor { int m_randSequenceNum = 0; // RandSequence uniqify number VLifetime m_lifetime = VLifetime::STATIC_IMPLICIT; // Propagating lifetime bool m_lifetimeAllowed = false; // True to allow lifetime settings + bool m_hasTimingControl = false; // If current task has timing control bool m_moduleWithGenericIface = false; // If current module contains generic interface std::set m_portDups; // Non-ANSI port datatype duplicating input/output decls @@ -248,6 +249,8 @@ class LinkParseVisitor final : public VNVisitor { VL_RESTORER(m_lifetime); VL_RESTORER(m_lifetimeAllowed); m_lifetimeAllowed = true; + VL_RESTORER(m_hasTimingControl); + m_hasTimingControl = nodep->exists([&](const AstNode* const nodep) {return nodep->isTimingControl();}); if (!nodep->lifetime().isNone()) { m_lifetime = nodep->lifetime().makeImplicit(); } else { @@ -382,7 +385,7 @@ class LinkParseVisitor final : public VNVisitor { } } } else if (m_ftaskp) { - if (m_ftaskp->lifetime().isStatic() && m_ftaskp->exists([&](const AstNode* nodep) {return nodep->isTimingControl();})) { + if (m_ftaskp->lifetime().isStatic() && m_hasTimingControl) { nodep->lifetime(VLifetime::STATIC_IMPLICIT); } else { nodep->lifetime(VLifetime::AUTOMATIC_IMPLICIT);