mirror of
https://github.com/verilator/verilator.git
synced 2025-05-01 04:56:54 +00:00
Patch to fix for bug1135.
This commit is contained in:
parent
a6b78cbbee
commit
8f2bc6e028
@ -333,15 +333,18 @@ private:
|
|||||||
// Clone the var referenced by the pin, and clone each var referenced by the varref
|
// Clone the var referenced by the pin, and clone each var referenced by the varref
|
||||||
// Clone pin varp:
|
// Clone pin varp:
|
||||||
for (int i = pinArrp->lsb(); i <= pinArrp->msb(); ++i) {
|
for (int i = pinArrp->lsb(); i <= pinArrp->msb(); ++i) {
|
||||||
AstIfaceRefDType* ifaceRefp = pinArrp->subDTypep()->castIfaceRefDType();
|
|
||||||
ifaceRefp->cellp(NULL);
|
|
||||||
|
|
||||||
string varNewName = pinVarp->name() + "__BRA__" + cvtToStr(i) + "__KET__";
|
string varNewName = pinVarp->name() + "__BRA__" + cvtToStr(i) + "__KET__";
|
||||||
VarNameMap::iterator it = m_modVarNameMap.find(varNewName);
|
VarNameMap::iterator it = m_modVarNameMap.find(varNewName);
|
||||||
AstVar* varNewp;
|
AstVar* varNewp = NULL;
|
||||||
|
|
||||||
|
// Only clone the var once for each module
|
||||||
|
if (!pinVarp->backp()) {
|
||||||
if (it != m_modVarNameMap.end()) {
|
if (it != m_modVarNameMap.end()) {
|
||||||
varNewp = it->second;
|
varNewp = it->second;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
AstIfaceRefDType* ifaceRefp = pinArrp->subDTypep()->castIfaceRefDType();
|
||||||
|
ifaceRefp->cellp(NULL);
|
||||||
varNewp = pinVarp->cloneTree(false);
|
varNewp = pinVarp->cloneTree(false);
|
||||||
m_modVarNameMap.insert(make_pair(varNewName, varNewp));
|
m_modVarNameMap.insert(make_pair(varNewName, varNewp));
|
||||||
varNewp->name(varNewName);
|
varNewp->name(varNewName);
|
||||||
@ -353,6 +356,11 @@ private:
|
|||||||
prevp->addNextHere(varNewp);
|
prevp->addNextHere(varNewp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (varNewp == NULL) {
|
||||||
|
nodep->v3fatalSrc("Module dearray failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// But clone the pin for each module instance
|
||||||
// Now also clone the pin itself and update its varref
|
// Now also clone the pin itself and update its varref
|
||||||
AstPin* newp = nodep->cloneTree(false);
|
AstPin* newp = nodep->cloneTree(false);
|
||||||
newp->modVarp(varNewp);
|
newp->modVarp(varNewp);
|
||||||
|
@ -102,4 +102,19 @@ module t
|
|||||||
.uids ( uids ),
|
.uids ( uids ),
|
||||||
.thing_inp( thing_inp ),
|
.thing_inp( thing_inp ),
|
||||||
.thing_out( thing_out ));
|
.thing_out( thing_out ));
|
||||||
|
|
||||||
|
// Previously there was a problem in V3Inst if non-default parameters was used
|
||||||
|
localparam K = 2;
|
||||||
|
the_intf #(.M(K)) thing_inp2();
|
||||||
|
the_intf #(.M(K)) thing_out2();
|
||||||
|
|
||||||
|
Thinker #(
|
||||||
|
.M ( K ),
|
||||||
|
.N ( N ))
|
||||||
|
thinker2(
|
||||||
|
.clk ( clk ),
|
||||||
|
.reset ( reset ),
|
||||||
|
.uids ( uids ),
|
||||||
|
.thing_inp( thing_inp2 ),
|
||||||
|
.thing_out( thing_out2 ));
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user