Handle more complex array selects

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
Ryszard Rozak 2026-01-22 13:30:51 +01:00
parent 0560332356
commit b231727a1f
1 changed files with 6 additions and 15 deletions

View File

@ -484,21 +484,12 @@ class ForceConvertVisitor final : public VNVisitor {
});
// Replace write refs on RHS
if (VN_IS(resetRdp->rhsp(), ArraySel)) {
AstNodeExpr* exprp = resetRdp->rhsp();
while (AstArraySel* const selp = VN_CAST(exprp, ArraySel)) {
exprp = selp->fromp();
}
if (AstVarRef* const refp = VN_CAST(exprp, VarRef)) {
AstVarScope* const vscp = refp->varScopep();
AstNodeExpr* const origRhsp = resetRdp->rhsp();
origRhsp->replaceWith(
m_state.getForceComponents(vscp).forcedUpdate(vscp, origRhsp, refp));
VL_DO_DANGLING(origRhsp->deleteTree(), origRhsp);
} else {
exprp->v3warn(
E_UNSUPPORTED,
"Unsupported: Release statement argument is too complex array select");
}
AstVarRef* const refp = VN_AS(AstNodeVarRef::varRefLValueRecurse(resetRdp->rhsp()), VarRef);
AstVarScope* const vscp = refp->varScopep();
AstNodeExpr* const origRhsp = resetRdp->rhsp();
origRhsp->replaceWith(
m_state.getForceComponents(vscp).forcedUpdate(vscp, origRhsp, refp));
VL_DO_DANGLING(origRhsp->deleteTree(), origRhsp);
} else {
resetRdp->rhsp()->foreach([this](AstVarRef* refp) {
if (refp->access() != VAccess::WRITE) return;