forked from github/verilator
Internals: Use elementsConst for AstRange width.
This commit is contained in:
parent
7618133298
commit
da13ba6c67
@ -130,7 +130,6 @@ public:
|
||||
:AstNode(fl) {
|
||||
m_littleEndian = false;
|
||||
setOp2p(new AstConst(fl,msb)); setOp3p(new AstConst(fl,lsb));
|
||||
width(msb-lsb+1,msb-lsb+1);
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(Range, RANGE)
|
||||
AstNode* msbp() const { return op2p()->castNode(); } // op2 = Msb expression
|
||||
@ -271,7 +270,7 @@ private:
|
||||
if (keyword().width() > 1 && !isOpaque()) rangep = new AstRange(fileline(), keyword().width()-1, 0);
|
||||
width(keyword().width(), keyword().width());
|
||||
} else {
|
||||
widthFrom(rangep); // Maybe unknown if parameters underneath it
|
||||
width(rangep->elementsConst(), rangep->elementsConst()); // Maybe unknown if parameters underneath it
|
||||
}
|
||||
setNOp1p(rangep);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ private:
|
||||
int expwidth = nodep->exprp()->width();
|
||||
if (expwidth == pinwidth) {
|
||||
// NOP: Arrayed instants: widths match so connect to each instance
|
||||
} else if (expwidth == pinwidth*m_cellRangep->width()) {
|
||||
} else if (expwidth == pinwidth*m_cellRangep->elementsConst()) {
|
||||
// Arrayed instants: one bit for each of the instants (each assign is 1 pinwidth wide)
|
||||
AstNode* exprp = nodep->exprp()->unlinkFrBack();
|
||||
bool inputPin = nodep->modVarp()->isInput();
|
||||
|
@ -356,8 +356,7 @@ private:
|
||||
checkCvtUS(nodep->lsbp());
|
||||
int width = nodep->elementsConst();
|
||||
if (width > (1<<28)) nodep->v3error("Width of bit range is huge; vector of over 1billion bits: 0x"<<hex<<width);
|
||||
nodep->numeric(AstNumeric::UNSIGNED);
|
||||
nodep->width(width,width);
|
||||
// Note width() not set on range; use elementsConst()
|
||||
if (nodep->littleEndian()) {
|
||||
nodep->v3warn(LITENDIAN,"Little bit endian vector: MSB < LSB of bit range: "<<nodep->lsbConst()<<":"<<nodep->msbConst());
|
||||
}
|
||||
@ -620,7 +619,7 @@ private:
|
||||
virtual void visit(AstBasicDType* nodep, AstNUser* vup) {
|
||||
if (nodep->rangep()) {
|
||||
nodep->rangep()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p());
|
||||
nodep->widthFrom(nodep->rangep());
|
||||
nodep->width(nodep->rangep()->elementsConst(), nodep->rangep()->elementsConst());
|
||||
}
|
||||
// else width in node is correct; it was set based on keyword().width()
|
||||
// at construction time. Ditto signed, so "unsigned byte" etc works right.
|
||||
@ -1102,7 +1101,7 @@ private:
|
||||
bool inputPin = nodep->modVarp()->isInput();
|
||||
int awidth;
|
||||
if (m_cellRangep) {
|
||||
int numInsts = m_cellRangep->width();
|
||||
int numInsts = m_cellRangep->elementsConst();
|
||||
if (expwidth == pinwidth) {
|
||||
awidth = pinwidth; // Arrayed instants: widths match so connect to each instance
|
||||
} else if (expwidth == pinwidth*numInsts) {
|
||||
|
Loading…
Reference in New Issue
Block a user