fix the aggressive return, add a lightweight check
This commit is contained in:
parent
d6946e0100
commit
2927aebe27
|
|
@ -3088,8 +3088,20 @@ class WidthVisitor final : public VNVisitor {
|
||||||
iterateCheck(nodep, "Dist Item", itemp, CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP);
|
iterateCheck(nodep, "Dist Item", itemp, CONTEXT_DET, FINAL, subDTypep, EXTEND_EXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inside a constraint, V3Randomize handles dist lowering with proper weights
|
// Inside a constraint, V3Randomize handles dist lowering with proper weights,
|
||||||
if (m_constraintp) return;
|
// but only for simple scalar/range items. Container-type items (queues, arrays)
|
||||||
|
// must be lowered here via insideItem() which knows how to expand them.
|
||||||
|
if (m_constraintp) {
|
||||||
|
bool canLower = true;
|
||||||
|
for (AstDistItem* ditemp = nodep->itemsp(); ditemp;
|
||||||
|
ditemp = VN_AS(ditemp->nextp(), DistItem)) {
|
||||||
|
if (!VN_IS(ditemp->rangep(), Const) && !VN_IS(ditemp->rangep(), InsideRange)) {
|
||||||
|
canLower = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (canLower) return;
|
||||||
|
}
|
||||||
|
|
||||||
// Outside constraint: lower to inside (ignores weights)
|
// Outside constraint: lower to inside (ignores weights)
|
||||||
AstNodeExpr* newp = nullptr;
|
AstNodeExpr* newp = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue