mirror of
https://github.com/verilator/verilator.git
synced 2025-01-09 08:07:46 +00:00
Internals: Refactor param array handling to use subroutine. No functional change intended.
This commit is contained in:
parent
47f040a5fd
commit
3963a50aef
@ -176,6 +176,13 @@ private:
|
|||||||
}
|
}
|
||||||
return string("z") + cvtToStr(num);
|
return string("z") + cvtToStr(num);
|
||||||
}
|
}
|
||||||
|
AstNodeDType* arraySubDTypep(AstNodeDType* nodep) {
|
||||||
|
// If an unpacked array, return the subDTypep under it
|
||||||
|
if (AstUnpackArrayDType* adtypep = VN_CAST(nodep, UnpackArrayDType)) {
|
||||||
|
return adtypep->subDTypep();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
void collectPins(CloneMap* clonemapp, AstNodeModule* modp) {
|
void collectPins(CloneMap* clonemapp, AstNodeModule* modp) {
|
||||||
// Grab all I/O so we can remap our pins later
|
// Grab all I/O so we can remap our pins later
|
||||||
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
|
for (AstNode* stmtp = modp->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
|
||||||
@ -585,7 +592,7 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
|||||||
pinp->v3error("Attempted parameter setting of non-parameter: Param "
|
pinp->v3error("Attempted parameter setting of non-parameter: Param "
|
||||||
<< pinp->prettyNameQ() << " of " << nodep->prettyNameQ());
|
<< pinp->prettyNameQ() << " of " << nodep->prettyNameQ());
|
||||||
} else if (VN_IS(pinp->exprp(), InitArray)
|
} else if (VN_IS(pinp->exprp(), InitArray)
|
||||||
&& VN_IS(modvarp->subDTypep(), UnpackArrayDType)) {
|
&& arraySubDTypep(modvarp->subDTypep())) {
|
||||||
// Array assigned to array
|
// Array assigned to array
|
||||||
AstNode* exprp = pinp->exprp();
|
AstNode* exprp = pinp->exprp();
|
||||||
longname += "_" + paramSmallName(srcModp, modvarp) + paramValueNumber(exprp);
|
longname += "_" + paramSmallName(srcModp, modvarp) + paramValueNumber(exprp);
|
||||||
@ -647,10 +654,8 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
|||||||
AstVar* modvarp = pinp->modVarp();
|
AstVar* modvarp = pinp->modVarp();
|
||||||
if (modvarp->isIfaceRef()) {
|
if (modvarp->isIfaceRef()) {
|
||||||
AstIfaceRefDType* portIrefp = VN_CAST(modvarp->subDTypep(), IfaceRefDType);
|
AstIfaceRefDType* portIrefp = VN_CAST(modvarp->subDTypep(), IfaceRefDType);
|
||||||
if (!portIrefp && VN_IS(modvarp->subDTypep(), UnpackArrayDType)) {
|
if (!portIrefp && arraySubDTypep(modvarp->subDTypep())) {
|
||||||
portIrefp
|
portIrefp = VN_CAST(arraySubDTypep(modvarp->subDTypep()), IfaceRefDType);
|
||||||
= VN_CAST(VN_CAST(modvarp->subDTypep(), UnpackArrayDType)->subDTypep(),
|
|
||||||
IfaceRefDType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AstIfaceRefDType* pinIrefp = NULL;
|
AstIfaceRefDType* pinIrefp = NULL;
|
||||||
@ -662,34 +667,20 @@ void ParamVisitor::visitCell(AstCell* nodep, const string& hierName) {
|
|||||||
} else if (exprp && exprp->op1p() && VN_IS(exprp->op1p(), VarRef)
|
} else if (exprp && exprp->op1p() && VN_IS(exprp->op1p(), VarRef)
|
||||||
&& VN_CAST(exprp->op1p(), VarRef)->varp()
|
&& VN_CAST(exprp->op1p(), VarRef)->varp()
|
||||||
&& VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()
|
&& VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()
|
||||||
&& VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(),
|
&& arraySubDTypep(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep())
|
||||||
UnpackArrayDType)
|
&& VN_CAST(
|
||||||
&& VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(),
|
arraySubDTypep(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()),
|
||||||
UnpackArrayDType)
|
IfaceRefDType)) {
|
||||||
->subDTypep()
|
pinIrefp = VN_CAST(
|
||||||
&& VN_CAST(VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(),
|
arraySubDTypep(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep()),
|
||||||
UnpackArrayDType)
|
IfaceRefDType);
|
||||||
->subDTypep(),
|
|
||||||
IfaceRefDType)) {
|
|
||||||
pinIrefp = VN_CAST(VN_CAST(VN_CAST(exprp->op1p(), VarRef)->varp()->subDTypep(),
|
|
||||||
UnpackArrayDType)
|
|
||||||
->subDTypep(),
|
|
||||||
IfaceRefDType);
|
|
||||||
} else if (exprp && VN_IS(exprp, VarRef) && VN_CAST(exprp, VarRef)->varp()
|
} else if (exprp && VN_IS(exprp, VarRef) && VN_CAST(exprp, VarRef)->varp()
|
||||||
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
&& VN_CAST(exprp, VarRef)->varp()->subDTypep()
|
||||||
&& VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(),
|
&& arraySubDTypep(VN_CAST(exprp, VarRef)->varp()->subDTypep())
|
||||||
UnpackArrayDType)
|
&& VN_CAST(arraySubDTypep(VN_CAST(exprp, VarRef)->varp()->subDTypep()),
|
||||||
&& VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(),
|
|
||||||
UnpackArrayDType)
|
|
||||||
->subDTypep()
|
|
||||||
&& VN_CAST(VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(),
|
|
||||||
UnpackArrayDType)
|
|
||||||
->subDTypep(),
|
|
||||||
IfaceRefDType)) {
|
IfaceRefDType)) {
|
||||||
pinIrefp = VN_CAST(
|
pinIrefp = VN_CAST(arraySubDTypep(VN_CAST(exprp, VarRef)->varp()->subDTypep()),
|
||||||
VN_CAST(VN_CAST(exprp, VarRef)->varp()->subDTypep(), UnpackArrayDType)
|
IfaceRefDType);
|
||||||
->subDTypep(),
|
|
||||||
IfaceRefDType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UINFO(9, " portIfaceRef " << portIrefp << endl);
|
UINFO(9, " portIfaceRef " << portIrefp << endl);
|
||||||
|
Loading…
Reference in New Issue
Block a user