Fix error when force assignment is used with ref function args (#6244)

This commit is contained in:
Ryszard Rozak
2025-07-31 12:48:37 +02:00
committed by GitHub
parent 9d38e63269
commit d8f1e1113a
6 changed files with 103 additions and 4 deletions
+5 -4
View File
@@ -364,9 +364,6 @@ class ForceReplaceVisitor final : public VNVisitor {
// Replace VarRef from forced LHS with rdVscp.
if (ForceState::ForceComponentsVarScope* const fcp
= m_state.tryGetForceComponents(nodep)) {
FileLine* const flp = nodep->fileline();
AstVarRef* const origp = new AstVarRef{flp, nodep->varScopep(), VAccess::READ};
ForceState::markNonReplaceable(origp);
nodep->varp(fcp->m_rdVscp->varp());
nodep->varScopep(fcp->m_rdVscp);
}
@@ -398,7 +395,11 @@ class ForceReplaceVisitor final : public VNVisitor {
break;
}
default:
nodep->v3error("Unsupported: Signals used via read-write reference cannot be forced");
if (!m_inLogic) return;
if (m_state.tryGetForceComponents(nodep) || ForceState::getValVscp(nodep)) {
nodep->v3error(
"Unsupported: Signals used via read-write reference cannot be forced");
}
break;
}
}