Set static when task has timing control

Signed-off-by: Kamil Danecki <kdanecki@internships.antmicro.com>
This commit is contained in:
Kamil Danecki 2026-03-20 14:32:20 +01:00
parent d2f34b9974
commit adb298dce1
2 changed files with 6 additions and 8 deletions

View File

@ -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();

View File

@ -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);