V3Number cleanup
This commit is contained in:
parent
a3fd105acb
commit
654571bd1c
|
|
@ -86,42 +86,42 @@ public:
|
|||
}
|
||||
AstConst(FileLine* fl, uint32_t num)
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(this, 32, num)) {
|
||||
, m_num(this, 32, num) {
|
||||
dtypeSetLogicSized(m_num.width(), 0, AstNumeric::UNSIGNED);
|
||||
}
|
||||
class Unsized32 {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, Unsized32, uint32_t num) // Unsized 32-bit integer of specified value
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(this, 32, num)) {
|
||||
, m_num(this, 32, num) {
|
||||
m_num.width(32, false);
|
||||
dtypeSetLogicSized(32, m_num.widthMin(), AstNumeric::UNSIGNED);
|
||||
}
|
||||
class Signed32 {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, Signed32, int32_t num) // Signed 32-bit integer of specified value
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(this, 32, num)) {
|
||||
, m_num(this, 32, num) {
|
||||
m_num.width(32, 32);
|
||||
dtypeSetLogicSized(32, m_num.widthMin(), AstNumeric::SIGNED);
|
||||
}
|
||||
class RealDouble {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, RealDouble, double num)
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(this, 64)) { m_num.setDouble(num); dtypeSetDouble(); }
|
||||
, m_num(this, 64) { m_num.setDouble(num); dtypeSetDouble(); }
|
||||
class String {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, String, const string& num)
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(V3Number::String(), this, num)) { dtypeSetString(); }
|
||||
, m_num(V3Number::String(), this, num) { dtypeSetString(); }
|
||||
class LogicFalse {};
|
||||
AstConst(FileLine* fl, LogicFalse) // Shorthand const 0, dtype should be a logic of size 1
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(this, 1, 0)) { dtypeSetLogicBool(); }
|
||||
, m_num(this, 1, 0) { dtypeSetLogicBool(); }
|
||||
class LogicTrue {};
|
||||
AstConst(FileLine* fl, LogicTrue) // Shorthand const 1, dtype should be a logic of size 1
|
||||
: AstNodeMath(fl)
|
||||
, m_num(V3Number(this, 1, 1)) { dtypeSetLogicBool(); }
|
||||
, m_num(this, 1, 1) { dtypeSetLogicBool(); }
|
||||
ASTNODE_NODE_FUNCS(Const)
|
||||
virtual string name() const { return num().ascii(); } // * = Value
|
||||
virtual const V3Number& num() const { return m_num; } // * = Value
|
||||
const V3Number& num() const { return m_num; } // * = Value
|
||||
uint32_t toUInt() const { return num().toUInt(); }
|
||||
vlsint32_t toSInt() const { return num().toSInt(); }
|
||||
vluint64_t toUQuad() const { return num().toUQuad(); }
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ private:
|
|||
int width = itemp->width();
|
||||
int lsb = itemp->lsb();
|
||||
int msb = lsb + width - 1;
|
||||
V3Number fieldNum = V3Number(nump, width);
|
||||
V3Number fieldNum(nump, width);
|
||||
fieldNum.opSel(*nump, msb, lsb);
|
||||
out<<itemp->name()<<": ";
|
||||
if (AstNodeDType * childTypep = itemp->subDTypep()) {
|
||||
|
|
@ -153,7 +153,7 @@ private:
|
|||
int width = childTypep->width();
|
||||
int lsb = width * element;
|
||||
int msb = lsb + width - 1;
|
||||
V3Number fieldNum = V3Number(nump, width);
|
||||
V3Number fieldNum(nump, width);
|
||||
fieldNum.opSel(*nump, msb, lsb);
|
||||
int arrayElem = arrayp->lsb() + element;
|
||||
out<<arrayElem<<" = "<<prettyNumber(&fieldNum, childTypep);
|
||||
|
|
@ -568,14 +568,14 @@ private:
|
|||
|
||||
void handleAssignSel(AstNodeAssign* nodep, AstSel* selp) {
|
||||
AstVarRef* varrefp = NULL;
|
||||
V3Number lsb = V3Number(nodep);
|
||||
V3Number lsb(nodep);
|
||||
iterateAndNextNull(nodep->rhsp()); // Value to assign
|
||||
handleAssignSelRecurse(nodep, selp, varrefp/*ref*/, lsb/*ref*/, 0);
|
||||
if (!m_checkOnly && optimizable()) {
|
||||
UASSERT_OBJ(varrefp, nodep,
|
||||
"Indicated optimizable, but no variable found on RHS of select");
|
||||
AstNode* vscp = varOrScope(varrefp);
|
||||
V3Number outnum = V3Number(nodep);
|
||||
V3Number outnum(nodep);
|
||||
if (V3Number* vscpnump = fetchOutNumberNull(vscp)) {
|
||||
outnum = *vscpnump;
|
||||
} else if (V3Number* vscpnump = fetchNumberNull(vscp)) {
|
||||
|
|
@ -606,7 +606,7 @@ private:
|
|||
lsbRef = *fetchNumber(selp->lsbp());
|
||||
return; // And presumably still optimizable()
|
||||
} else if (AstSel* subselp = VN_CAST(selp->lhsp(), Sel)) {
|
||||
V3Number sublsb = V3Number(nodep);
|
||||
V3Number sublsb(nodep);
|
||||
handleAssignSelRecurse(nodep, subselp, outVarrefpRef, sublsb/*ref*/, depth+1);
|
||||
if (optimizable()) {
|
||||
lsbRef = sublsb;
|
||||
|
|
|
|||
Loading…
Reference in New Issue