diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index 6390c6906..820930c58 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -2162,19 +2162,15 @@ class ConstraintExprVisitor final : public VNVisitor { // Generate solveBefore() calls for each (lhs, rhs) variable pair. // Do NOT iterate children -- these are variable references, not constraint expressions. FileLine* const fl = nodep->fileline(); - for (AstNodeExpr* const listp : {nodep->lhssp(), nodep->rhssp()}) { - for (AstNodeExpr* ep = listp; ep; ep = VN_CAST(ep->nextp(), NodeExpr)) { - if (VN_IS(ep->dtypep()->skipRefp(), AssocArrayDType)) { - ep->v3warn(E_UNSUPPORTED, - "Unsupported: 'solve ... before' with associative array"); - VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); - return; - } - } - } AstNodeModule* const genModp = VN_AS(m_genp->user2p(), NodeModule); for (AstNodeExpr* lhsp = nodep->lhssp(); lhsp; lhsp = VN_CAST(lhsp->nextp(), NodeExpr)) { + if (VN_IS(lhsp->dtypep()->skipRefp(), AssocArrayDType)) { + lhsp->v3warn(E_UNSUPPORTED, + "Unsupported: 'solve ... before' with associative array"); + VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); + return; + } AstNodeExpr* const lhsTestp = buildSolveBeforeNameExpr(fl, lhsp); if (!lhsTestp) { lhsp->v3fatalSrc("Unexpected expression type in solve...before lhs"); @@ -2183,6 +2179,12 @@ class ConstraintExprVisitor final : public VNVisitor { VL_DO_DANGLING(lhsTestp->deleteTree(), lhsTestp); for (AstNodeExpr* rhsp = nodep->rhssp(); rhsp; rhsp = VN_CAST(rhsp->nextp(), NodeExpr)) { + if (VN_IS(rhsp->dtypep()->skipRefp(), AssocArrayDType)) { + rhsp->v3warn(E_UNSUPPORTED, + "Unsupported: 'solve ... before' with associative array"); + VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); + return; + } AstNodeExpr* const rhsNamep = buildSolveBeforeNameExpr(fl, rhsp); if (!rhsNamep) { rhsp->v3fatalSrc("Unexpected expression type in solve...before rhs");