Support generic interface arrays (#7604)

This commit is contained in:
Krzysztof Bieganski
2026-06-02 22:28:50 -04:00
committed by GitHub
parent 0c9448dadd
commit 7664bbb3ef
15 changed files with 157 additions and 35 deletions
+13 -3
View File
@@ -1710,7 +1710,9 @@ class ParamProcessor final {
bool& any_overridesr, IfaceRefRefs& ifaceRefRefs) {
for (AstPin* pinp = pinsp; pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
const AstVar* const modvarp = pinp->modVarp();
if (modvarp && VN_IS(modvarp->subDTypep(), IfaceGenericDType)) continue;
if (modvarp && VN_IS(arraySubDTypeDeepp(modvarp->subDTypep()), IfaceGenericDType)) {
continue;
}
if (modvarp->isIfaceRef()) {
// arraySubDTypeDeepp returns input unchanged if not an array.
AstIfaceRefDType* const portIrefp
@@ -1798,10 +1800,12 @@ class ParamProcessor final {
for (const AstNode* nodep = pinsp; nodep; nodep = nodep->nextp()) {
if (const AstPin* const pinp = VN_CAST(nodep, Pin)) {
if (AstVar* const varp = pinp->modVarp()) {
AstNodeDType* dtypep = varp->childDTypep()->elemDTypep();
if (AstIfaceGenericDType* const ifaceGDTypep
= VN_CAST(varp->childDTypep(), IfaceGenericDType)) {
= VN_CAST(dtypep, IfaceGenericDType)) {
const auto iter = paramspMap.find(varp->name());
if (iter == paramspMap.end()) continue;
AstNode* const backp = ifaceGDTypep->backp();
ifaceGDTypep->unlinkFrBack();
const AstPin* const paramp = iter->second;
paramspMap.erase(iter);
@@ -1812,7 +1816,13 @@ class ParamProcessor final {
ifaceGDTypep->name(), ifacerefp->ifaceName(),
ifaceGDTypep->modportName()};
newIfacerefp->ifacep(ifacerefp->ifacep());
varp->childDTypep(newIfacerefp);
if (auto* const arrDtp = VN_CAST(backp, NodeArrayDType)) {
arrDtp->childDTypep(newIfacerefp);
} else if (auto* const arrDtp = VN_CAST(backp, BracketArrayDType)) {
arrDtp->childDTypep(newIfacerefp);
} else {
varp->childDTypep(newIfacerefp);
}
VL_DO_DANGLING(m_deleter.pushDeletep(ifaceGDTypep), ifaceGDTypep);
if (paramspMap.empty()) return;
}