Apply suggestion

Signed-off-by: Kamil Danecki <kdanecki@internships.antmicro.com>
This commit is contained in:
Kamil Danecki 2026-03-31 12:20:50 +02:00
parent 3e596e7f55
commit fbf110cd06
2 changed files with 2 additions and 3 deletions

View File

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

View File

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