Fix struct array assignment (#5455) (#5537)

This commit is contained in:
Yilou Wang
2024-10-21 09:54:33 -04:00
committed by GitHub
parent 76fe224e7c
commit 8c3cc3af8f
6 changed files with 114 additions and 83 deletions
-10
View File
@@ -1390,15 +1390,6 @@ class RandomizeVisitor final : public VNVisitor {
return new AstVar{fl, VVarType::VAR, uniqueNamep->get(""),
dtypep->findBasicDType(VBasicDTypeKwd::UINT32)};
};
auto handleUnsupportedStruct = [&](AstNodeExpr* tempElementp) {
if (VN_IS(tempElementp->dtypep()->skipRefp(), StructDType)) {
tempElementp->dtypep()->v3warn(
E_UNSUPPORTED,
"Unsupported: CreateArrayForeachLoop currently does not support "
"this data type. (Struct-Array unconstrained "
"randomization is not fully supported)");
}
};
auto createForeachLoop = [&](AstNodeExpr* tempElementp, AstVar* randLoopIndxp) {
AstSelLoopVars* const randLoopVarp
= new AstSelLoopVars{fl, exprp->cloneTree(false), randLoopIndxp};
@@ -1422,7 +1413,6 @@ class RandomizeVisitor final : public VNVisitor {
tempElementp->dtypep(tempDTypep->subDTypep());
tempDTypep = tempDTypep->virtRefDTypep();
}
handleUnsupportedStruct(tempElementp);
stmtsp = createForeachLoop(tempElementp, randLoopIndxp);
return stmtsp;
}