Support constrained random for arrays in structs (#5765) (#5802)

This commit is contained in:
Yilou Wang
2025-02-24 17:51:51 -05:00
committed by GitHub
parent 5daf7385f1
commit dae4c8ee22
6 changed files with 205 additions and 7 deletions
+6 -3
View File
@@ -712,9 +712,12 @@ class ConstraintExprVisitor final : public VNVisitor {
}
void visit(AstStructSel* nodep) override {
if (VN_IS(nodep->fromp()->dtypep()->skipRefp(), StructDType)) {
AstMemberDType* memberp
= VN_AS(nodep->fromp()->dtypep()->skipRefp(), StructDType)->membersp();
while (memberp->nextp()) {
AstNodeExpr* const fromp = nodep->fromp();
if (VN_IS(fromp, StructSel)) {
VN_AS(fromp->dtypep()->skipRefp(), StructDType)->markConstrainedRand(true);
}
AstMemberDType* memberp = VN_AS(fromp->dtypep()->skipRefp(), StructDType)->membersp();
while (memberp) {
if (memberp->name() == nodep->name()) {
memberp->markConstrainedRand(true);
break;