diff --git a/src/V3Fork.cpp b/src/V3Fork.cpp index 2e40faa24..c6f6b09d2 100644 --- a/src/V3Fork.cpp +++ b/src/V3Fork.cpp @@ -449,13 +449,7 @@ class DynScopeVisitor final : public VNVisitor { << nodep->varp()->verilogKwd() << " variable of a function after a timing control is not allowed"); } else { - 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"); + UASSERT_OBJ(nodep->varp()->lifetime().isAutomatic(), nodep, "writing to an automatic variable after a timing control"); } } if (!framep->instance().initialized()) framep->createInstancePrototype(); diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index 4e238c75f..ee2351a24 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -382,7 +382,11 @@ class LinkParseVisitor final : public VNVisitor { } } } else if (m_ftaskp) { - if (!nodep->lifetime().isAutomatic()) nodep->lifetime(VLifetime::AUTOMATIC_IMPLICIT); + if (m_ftaskp->existsAndNext([&](const AstNode* nodep) {return nodep->isTimingControl();})) { + nodep->lifetime(VLifetime::STATIC_IMPLICIT); + } else { + nodep->lifetime(VLifetime::AUTOMATIC_IMPLICIT); + } } else if (nodep->lifetime().isNone()) { // lifetime shouldn't be unknown, set static if none nodep->lifetime(VLifetime::STATIC_IMPLICIT);