diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index 7ec8b2511..fa339c062 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -298,16 +298,15 @@ class BeginVisitor final : public VNVisitor { VL_DO_DANGLING(pushDeletep(nodep), nodep); } void visit(AstVar* nodep) override { + if (nodep->user1SetOnce()) { return; } // If static variable, move it outside a function. if (nodep->lifetime().isStatic() && m_ftaskp) { - if (nodep->user1()) { return; } const std::string newName = m_ftaskp->name() + "__Vstatic__" + dot(m_unnamedScope, nodep->name()); if (nodep->isIO()) { // Create a port that is used for passing value between argument and static // variable AstVar* const portp = nodep->cloneTreePure(false); - portp->user1(true); nodep->replaceWith(portp); if (nodep->isInput() || nodep->isInout()) { diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index 9d9f7dcdb..e0329c2c2 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -446,7 +446,7 @@ class DynScopeVisitor final : public VNVisitor { nodep->v3error("Writing to an " << nodep->varp()->verilogKwd() << " automatic variable of a " << (m_inFunc ? "function" : "task") - << " after a timing control is not allowed"); + << " after a timing control is not allowed (IEEE 1800-2023 13.2.2)"); } if (!framep->instance().initialized()) framep->createInstancePrototype(); framep->captureVarInsert(nodep->varp());