mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 00:30:34 +02:00
Support generic interface arrays (#7604)
This commit is contained in:
+13
-3
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user