forked from github/verilator
Fix assignment temporaries not using real types.
This commit is contained in:
parent
ccb6545c32
commit
ca57edfa0b
@ -118,7 +118,7 @@ private:
|
|||||||
nodep->v3warn(BLKANDNBLK,"Unsupported: Blocked and non-blocking assignments to same variable: "<<nodep->varp()->prettyName());
|
nodep->v3warn(BLKANDNBLK,"Unsupported: Blocked and non-blocking assignments to same variable: "<<nodep->varp()->prettyName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AstVarScope* createVarSc(AstVarScope* oldvarscp, string name, int width/*0==fromoldvar*/) {
|
AstVarScope* createVarSc(AstVarScope* oldvarscp, string name, int width/*0==fromoldvar*/, AstNodeDType* newdtypep) {
|
||||||
// Because we've already scoped it, we may need to add both the AstVar and the AstVarScope
|
// Because we've already scoped it, we may need to add both the AstVar and the AstVarScope
|
||||||
if (!oldvarscp->scopep()) oldvarscp->v3fatalSrc("Var unscoped");
|
if (!oldvarscp->scopep()) oldvarscp->v3fatalSrc("Var unscoped");
|
||||||
AstVar* varp;
|
AstVar* varp;
|
||||||
@ -129,7 +129,9 @@ private:
|
|||||||
// Created module's AstVar earlier under some other scope
|
// Created module's AstVar earlier under some other scope
|
||||||
varp = it->second;
|
varp = it->second;
|
||||||
} else {
|
} else {
|
||||||
if (width==0) {
|
if (newdtypep) {
|
||||||
|
varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, newdtypep);
|
||||||
|
} else if (width==0) {
|
||||||
varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, oldvarscp->varp());
|
varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, oldvarscp->varp());
|
||||||
varp->dtypeFrom(oldvarscp);
|
varp->dtypeFrom(oldvarscp);
|
||||||
} else { // Used for vset and dimensions, so can zero init
|
} else { // Used for vset and dimensions, so can zero init
|
||||||
@ -219,7 +221,7 @@ private:
|
|||||||
} else {
|
} else {
|
||||||
string bitvarname = (string("__Vdlyvdim")+cvtToStr(dimension)
|
string bitvarname = (string("__Vdlyvdim")+cvtToStr(dimension)
|
||||||
+"__"+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
+"__"+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
||||||
AstVarScope* bitvscp = createVarSc(varrefp->varScopep(), bitvarname, dimp->width());
|
AstVarScope* bitvscp = createVarSc(varrefp->varScopep(), bitvarname, dimp->width(), NULL);
|
||||||
AstAssign* bitassignp
|
AstAssign* bitassignp
|
||||||
= new AstAssign (nodep->fileline(),
|
= new AstAssign (nodep->fileline(),
|
||||||
new AstVarRef(nodep->fileline(), bitvscp, true),
|
new AstVarRef(nodep->fileline(), bitvscp, true),
|
||||||
@ -237,7 +239,7 @@ private:
|
|||||||
bitreadp = lsbvaluep;
|
bitreadp = lsbvaluep;
|
||||||
} else {
|
} else {
|
||||||
string bitvarname = (string("__Vdlyvlsb__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
string bitvarname = (string("__Vdlyvlsb__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
||||||
AstVarScope* bitvscp = createVarSc(varrefp->varScopep(), bitvarname, lsbvaluep->width());
|
AstVarScope* bitvscp = createVarSc(varrefp->varScopep(), bitvarname, lsbvaluep->width(), NULL);
|
||||||
AstAssign* bitassignp = new AstAssign (nodep->fileline(),
|
AstAssign* bitassignp = new AstAssign (nodep->fileline(),
|
||||||
new AstVarRef(nodep->fileline(), bitvscp, true),
|
new AstVarRef(nodep->fileline(), bitvscp, true),
|
||||||
lsbvaluep);
|
lsbvaluep);
|
||||||
@ -252,7 +254,7 @@ private:
|
|||||||
valreadp = nodep->rhsp()->unlinkFrBack();
|
valreadp = nodep->rhsp()->unlinkFrBack();
|
||||||
} else {
|
} else {
|
||||||
string valvarname = (string("__Vdlyvval__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
string valvarname = (string("__Vdlyvval__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
||||||
AstVarScope* valvscp = createVarSc(varrefp->varScopep(), valvarname, nodep->rhsp()->width());
|
AstVarScope* valvscp = createVarSc(varrefp->varScopep(), valvarname, 0, nodep->rhsp()->dtypep());
|
||||||
newlhsp = new AstVarRef(nodep->fileline(), valvscp, true);
|
newlhsp = new AstVarRef(nodep->fileline(), valvscp, true);
|
||||||
valreadp = new AstVarRef(nodep->fileline(), valvscp, false);
|
valreadp = new AstVarRef(nodep->fileline(), valvscp, false);
|
||||||
}
|
}
|
||||||
@ -270,7 +272,7 @@ private:
|
|||||||
++m_statSharedSet;
|
++m_statSharedSet;
|
||||||
} else { // Create new one
|
} else { // Create new one
|
||||||
string setvarname = (string("__Vdlyvset__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
string setvarname = (string("__Vdlyvset__")+oldvarp->shortName()+"__v"+cvtToStr(modVecNum));
|
||||||
setvscp = createVarSc(varrefp->varScopep(), setvarname, 1);
|
setvscp = createVarSc(varrefp->varScopep(), setvarname, 1, NULL);
|
||||||
setinitp = new AstAssignPre (nodep->fileline(),
|
setinitp = new AstAssignPre (nodep->fileline(),
|
||||||
new AstVarRef(nodep->fileline(), setvscp, true),
|
new AstVarRef(nodep->fileline(), setvscp, true),
|
||||||
new AstConst(nodep->fileline(), 0));
|
new AstConst(nodep->fileline(), 0));
|
||||||
@ -399,7 +401,7 @@ private:
|
|||||||
}
|
}
|
||||||
if (!dlyvscp) { // First use of this delayed variable
|
if (!dlyvscp) { // First use of this delayed variable
|
||||||
string newvarname = (string("__Vdly__")+nodep->varp()->shortName());
|
string newvarname = (string("__Vdly__")+nodep->varp()->shortName());
|
||||||
dlyvscp = createVarSc(oldvscp, newvarname, 0);
|
dlyvscp = createVarSc(oldvscp, newvarname, 0, NULL);
|
||||||
AstNodeAssign* prep
|
AstNodeAssign* prep
|
||||||
= new AstAssignPre (nodep->fileline(),
|
= new AstAssignPre (nodep->fileline(),
|
||||||
new AstVarRef(nodep->fileline(), dlyvscp, true),
|
new AstVarRef(nodep->fileline(), dlyvscp, true),
|
||||||
|
Loading…
Reference in New Issue
Block a user