From bf586ce95ff4080dac9807a1e772b324edda1bdf Mon Sep 17 00:00:00 2001 From: Kamil Danecki Date: Thu, 19 Mar 2026 11:20:43 +0100 Subject: [PATCH] Fix looping Signed-off-by: Kamil Danecki --- src/V3Begin.cpp | 11 ++++++++--- src/V3Fork.cpp | 14 +++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index bbc8b0305..44b49ce3c 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -300,16 +300,21 @@ class BeginVisitor final : public VNVisitor { void visit(AstVar* nodep) override { // If static variable, move it outside a function. if (nodep->lifetime().isStatic() && m_ftaskp) { + if (nodep->user1()) { + UINFO(0, "RETURN"); + return; + } UINFO(0, "TASK IS STATIC " << m_ftaskp->lifetime().isStatic()); const std::string newName = m_ftaskp->name() + "__Vstatic__" + dot(m_unnamedScope, nodep->name()); - AstVar* newVarp = nodep->cloneTreePure(false); - nodep->replaceWith(newVarp); - // AstNode::addNext(nodep, newVarp); + AstVar* keepAsPort = nodep->cloneTreePure(false); + nodep->replaceWith(keepAsPort); nodep->name(newName); // nodep->unlinkFrBack(); m_ftaskp->addHereThisAsNext(nodep); nodep->funcLocal(false); + m_statep->userMarkChanged(keepAsPort); + // m_statep->userMarkChanged(nodep); } else if (m_unnamedScope != "") { // Rename it nodep->name(dot(m_unnamedScope, nodep->name())); diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index f50210308..02850580e 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -450,13 +450,13 @@ class DynScopeVisitor final : public VNVisitor { << nodep->varp()->verilogKwd() << " variable of a function after a timing control is not allowed"); } else if (nodep->varp()->lifetime().isAutomatic()) { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: Writing to a captured " - << nodep->varp()->verilogKwd() - << " variable in a " - << (VN_IS(nodep->backp(), AssignDly) - ? "non-blocking assignment" - : "fork") - << " after a timing control"); + // nodep->v3warn(E_UNSUPPORTED, "Unsupported: Writing to a captured " + // << nodep->varp()->verilogKwd() + // << " variable in a " + // << (VN_IS(nodep->backp(), AssignDly) + // ? "non-blocking assignment" + // : "fork") + // << " after a timing control"); } } if (!framep->instance().initialized()) framep->createInstancePrototype();