Set width

Signed-off-by: Ryszard Rozak <rrozak@antmicro.com>
This commit is contained in:
Ryszard Rozak 2026-02-26 13:54:54 +01:00
parent f3c0dfba96
commit 09deb45883
1 changed files with 11 additions and 1 deletions

View File

@ -366,10 +366,20 @@ private:
varp->v3fatalSrc("Unsupported: Force of variable of unhandled data type");
return dtypep;
}
for (const auto& memberp : enMemberDTypes) enStructp->addMembersp(memberp);
int width = 0;
for (const auto& memberp : enMemberDTypes) {
enStructp->addMembersp(memberp);
const int memberWidth = memberp->width();
if (VN_IS(structp, StructDType)) {
width += memberWidth;
} else {
width = std::max(width, memberWidth);
}
}
v3Global.rootp()->typeTablep()->addTypesp(enStructp);
enStructp->name(structp->name() + "__VforceEn_t");
enStructp->dtypep(enStructp);
enStructp->widthForce(width, width);
enStructp->classOrPackagep(structp->classOrPackagep());
dtypep->user1p(enStructp);
AstTypedef* const typedefp