diff --git a/src/V3Ast.h b/src/V3Ast.h index 0fde13f57..a363deb0e 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -886,6 +886,7 @@ public: void numericFrom(AstNode* fromp) { numeric(fromp->numeric()); } void numeric(AstNumeric flag) { m_numeric = (int)flag; if (flag.isDouble()) width(64,64); } AstNumeric numeric() const { return AstNumeric(m_numeric); } + void dtypeFrom(AstNode* fromp) { if (fromp) { widthSignedFrom(fromp); }} bool isUnsigned() const { return numeric().isUnsigned(); } void didWidth(bool flag) { m_didWidth=flag; } bool didWidth() const { return m_didWidth; } @@ -1080,7 +1081,7 @@ struct AstNodeUniop : public AstNodeMath { // Unary math AstNodeUniop(FileLine* fl, AstNode* lhsp) : AstNodeMath(fl) { - if (lhsp) widthSignedFrom(lhsp); + dtypeFrom(lhsp); setOp1p(lhsp); } ASTNODE_BASE_FUNCS(NodeUniop) AstNode* lhsp() const { return op1p()->castNode(); } @@ -1160,8 +1161,8 @@ struct AstNodeBiComAsv : public AstNodeBiCom { struct AstNodeCond : public AstNodeTriop { AstNodeCond(FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p) : AstNodeTriop(fl, condp, expr1p, expr2p) { - if (expr1p) widthSignedFrom(expr1p); - else if (expr2p) widthSignedFrom(expr2p); + if (expr1p) dtypeFrom(expr1p); + else if (expr2p) dtypeFrom(expr2p); } ASTNODE_BASE_FUNCS(NodeCond) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, const V3Number& ths) { @@ -1213,7 +1214,7 @@ struct AstNodeAssign : public AstNodeStmt { AstNodeAssign(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeStmt(fl) { setOp1p(rhsp); setOp2p(lhsp); - if (lhsp) widthSignedFrom(lhsp); + dtypeFrom(lhsp); } ASTNODE_BASE_FUNCS(NodeAssign) virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp)=0; // Clone single node, just get same type back. diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index aa8656f05..c9ca0a047 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -435,7 +435,7 @@ private: public: AstEnumItemRef(FileLine* fl, AstEnumItem* itemp, AstPackage* packagep) : AstNodeMath(fl), m_itemp(itemp), m_packagep(packagep) { - if (m_itemp) widthSignedFrom(m_itemp); + dtypeFrom(m_itemp); } ASTNODE_NODE_FUNCS(EnumItemRef, ENUMITEMREF) virtual void dump(ostream& str); @@ -924,7 +924,7 @@ public: :AstNode(fl) , m_scopep(scopep), m_varp(varp) { m_circular = false; - widthSignedFrom(varp); + dtypeFrom(varp); } ASTNODE_NODE_FUNCS(VarScope, VARSCOPE) virtual void cloneRelink() { if (m_varp && m_varp->clonep()) { @@ -1444,7 +1444,7 @@ struct AstAlwaysPost : public AstNode { struct AstAssign : public AstNodeAssign { AstAssign(FileLine* fileline, AstNode* lhsp, AstNode* rhsp) : AstNodeAssign(fileline, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Assign, ASSIGN) virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) { return new AstAssign(this->fileline(), lhsp, rhsp); } @@ -2385,7 +2385,7 @@ public: AstTraceDecl(FileLine* fl, const string& showname, AstVar* varp) : AstNodeStmt(fl) , m_showname(showname) { - widthSignedFrom(varp); + dtypeFrom(varp); m_code = 0; m_codeInc = varp->dtypep()->arrayElements() * varp->widthWords(); AstBasicDType* bdtypep = varp->basicp(); @@ -2426,7 +2426,7 @@ private: public: AstTraceInc(FileLine* fl, AstTraceDecl* declp, AstNode* valuep) : AstNodeStmt(fl) { - widthSignedFrom(declp); + dtypeFrom(declp); m_declp = declp; addNOp2p(valuep); } @@ -2627,7 +2627,7 @@ struct AstUCFunc : public AstNodeMath { struct AstNegate : public AstNodeUniop { AstNegate(FileLine* fl, AstNode* lhsp) : AstNodeUniop(fl, lhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Negate, NEGATE) virtual void numberOperate(V3Number& out, const V3Number& lhs) { out.opNegate(lhs); } virtual string emitVerilog() { return "%f(- %l)"; } @@ -2707,7 +2707,7 @@ struct AstLogNot : public AstNodeUniop { }; struct AstNot : public AstNodeUniop { AstNot(FileLine* fl, AstNode* lhsp) : AstNodeUniop(fl, lhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Not, NOT) virtual void numberOperate(V3Number& out, const V3Number& lhs) { out.opNot(lhs); } virtual string emitVerilog() { return "%f(~ %l)"; } @@ -2887,7 +2887,7 @@ struct AstCast : public AstNode { // Cast to appropriate data type - note lhsp is value, to match AstTypedef, AstCCast, etc AstCast(FileLine* fl, AstNode* lhsp, AstNodeDType* dtp) : AstNode(fl) { setOp1p(lhsp); setOp2p(dtp); - if (dtp) { widthSignedFrom(dtp); } + dtypeFrom(dtp); } ASTNODE_NODE_FUNCS(Cast, CAST) virtual bool hasDType() const { return true; } @@ -2912,7 +2912,7 @@ public: } } AstCCast(FileLine* fl, AstNode* lhsp, AstNode* typeFromp) : AstNodeUniop(fl, lhsp) { - if (typeFromp) { widthSignedFrom(typeFromp); } + dtypeFrom(typeFromp); m_size=width(); } ASTNODE_NODE_FUNCS(CCast, CCAST) @@ -3108,7 +3108,7 @@ struct AstLogIff : public AstNodeBiCom { }; struct AstOr : public AstNodeBiComAsv { AstOr(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Or, OR) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opOr(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f| %r)"; } @@ -3120,7 +3120,7 @@ struct AstOr : public AstNodeBiComAsv { }; struct AstAnd : public AstNodeBiComAsv { AstAnd(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(And, AND) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opAnd(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f& %r)"; } @@ -3132,7 +3132,7 @@ struct AstAnd : public AstNodeBiComAsv { }; struct AstXor : public AstNodeBiComAsv { AstXor(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Xor, XOR) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opXor(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f^ %r)"; } @@ -3144,7 +3144,7 @@ struct AstXor : public AstNodeBiComAsv { }; struct AstXnor : public AstNodeBiComAsv { AstXnor(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Xnor, XNOR) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opXnor(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f^ ~ %r)"; } @@ -3407,7 +3407,7 @@ struct AstShiftRS : public AstNodeBiop { }; struct AstAdd : public AstNodeBiComAsv { AstAdd(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Add, ADD) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opAdd(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f+ %r)"; } @@ -3433,7 +3433,7 @@ struct AstAddD : public AstNodeBiComAsv { }; struct AstSub : public AstNodeBiop { AstSub(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Sub, SUB) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opSub(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f- %r)"; } @@ -3459,7 +3459,7 @@ struct AstSubD : public AstNodeBiop { }; struct AstMul : public AstNodeBiComAsv { AstMul(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Mul, MUL) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opMul(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f* %r)"; } @@ -3486,7 +3486,7 @@ struct AstMulD : public AstNodeBiComAsv { }; struct AstMulS : public AstNodeBiComAsv { AstMulS(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiComAsv(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(MulS, MULS) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opMulS(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f* %r)"; } @@ -3500,7 +3500,7 @@ struct AstMulS : public AstNodeBiComAsv { }; struct AstDiv : public AstNodeBiop { AstDiv(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Div, DIV) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opDiv(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f/ %r)"; } @@ -3526,7 +3526,7 @@ struct AstDivD : public AstNodeBiop { }; struct AstDivS : public AstNodeBiop { AstDivS(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(DivS, DIVS) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opDivS(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f/ %r)"; } @@ -3539,7 +3539,7 @@ struct AstDivS : public AstNodeBiop { }; struct AstModDiv : public AstNodeBiop { AstModDiv(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(ModDiv, MODDIV) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opModDiv(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f%% %r)"; } @@ -3551,7 +3551,7 @@ struct AstModDiv : public AstNodeBiop { }; struct AstModDivS : public AstNodeBiop { AstModDivS(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(ModDivS, MODDIVS) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opModDivS(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f%% %r)"; } @@ -3564,7 +3564,7 @@ struct AstModDivS : public AstNodeBiop { }; struct AstPow : public AstNodeBiop { AstPow(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(Pow, POW) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opPow(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f** %r)"; } @@ -3589,7 +3589,7 @@ struct AstPowD : public AstNodeBiop { }; struct AstPowS : public AstNodeBiop { AstPowS(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(PowS, POWS) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opPowS(lhs,rhs); } virtual string emitVerilog() { return "%k(%l %f** %r)"; } @@ -3680,7 +3680,7 @@ struct AstBufIf1 : public AstNodeBiop { // lhs is enable, rhs is data to drive // Note unlike the Verilog bufif1() UDP, this allows any width; each lhsp bit enables respective rhsp bit AstBufIf1(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) { - if (lhsp) widthSignedFrom(lhsp); } + dtypeFrom(lhsp); } ASTNODE_NODE_FUNCS(BufIf1, BUFIF1) virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opBufIf1(lhs,rhs); } virtual string emitVerilog() { return "bufif(%r,%l)"; } @@ -4134,7 +4134,7 @@ public: AstCMath(FileLine* fl, AstNode* exprsp) : AstNodeMath(fl), m_cleanOut(true) { addOp1p(exprsp); - widthSignedFrom(exprsp); + dtypeFrom(exprsp); } AstCMath(FileLine* fl, const string& textStmt, int setwidth, bool cleanOut=true) : AstNodeMath(fl), m_cleanOut(cleanOut) { diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 31e982c44..3fa3b9663 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -448,7 +448,7 @@ private: oldp->v3fatalSrc("Already constant??\n"); } AstNode* newp = new AstConst(oldp->fileline(), num); - newp->widthSignedFrom(oldp); + newp->dtypeFrom(oldp); if (debug()>5) oldp->dumpTree(cout," const_old: "); if (debug()>5) newp->dumpTree(cout," _new: "); oldp->replaceWith(newp); @@ -483,7 +483,7 @@ private: AstNode* newp = new AstAnd(nodep->fileline(), new AstConst(nodep->fileline(), 0), checkp->unlinkFrBack()); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; } @@ -530,7 +530,7 @@ private: void replaceWChild(AstNode* nodep, AstNode* childp) { // NODE(..., CHILD(...)) -> CHILD(...) childp->unlinkFrBackWithNext(); - childp->widthSignedFrom(nodep); + childp->dtypeFrom(nodep); nodep->replaceWith(childp); nodep->deleteTree(); nodep=NULL; } @@ -646,7 +646,7 @@ private: AstNode* newp = (nodep->castExtendS() ? (new AstExtendS(nodep->fileline(), arg0p))->castNode() : (new AstExtend (nodep->fileline(), arg0p))->castNode()); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; } void replacePowShift (AstNodeBiop* nodep) { // Pow or PowS @@ -655,8 +655,8 @@ private: AstShiftL* newp = new AstShiftL(nodep->fileline(), new AstConst(nodep->fileline(), 1), rhsp); - newp->widthSignedFrom(nodep); - newp->lhsp()->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); + newp->lhsp()->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; } void replaceMulShift (AstMul* nodep) { // Mul, but not MulS as not simple shift @@ -665,7 +665,7 @@ private: AstNode* opp = nodep->rhsp()->unlinkFrBack(); AstShiftL* newp = new AstShiftL(nodep->fileline(), opp, new AstConst(nodep->fileline(), amount)); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; } void replaceDivShift (AstDiv* nodep) { // Mul, but not MulS as not simple shift @@ -674,7 +674,7 @@ private: AstNode* opp = nodep->lhsp()->unlinkFrBack(); AstShiftR* newp = new AstShiftR(nodep->fileline(), opp, new AstConst(nodep->fileline(), amount)); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; } void replaceShiftOp (AstNodeBiop* nodep) { @@ -734,11 +734,11 @@ private: newp = new AstShiftL(nodep->fileline(), ap, new AstConst(nodep->fileline(), newshift)); } - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); newp = new AstAnd (nodep->fileline(), newp, new AstConst (nodep->fileline(), mask)); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; //newp->dumpTree(cout, " repShiftShift_new: "); newp->accept(*this); // Further reduce, either node may have more reductions. @@ -1157,7 +1157,7 @@ private: fromp, new AstConst(lsbp->fileline(), lsbp->toUInt() % fromp->width()), widthp); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); nodep->replaceWith(newp); nodep->deleteTree(); nodep=NULL; } @@ -1175,7 +1175,7 @@ private: bilhsp, lsbp->cloneTree(true), widthp->cloneTree(true))); fromp->rhsp(new AstSel(nodep->fileline(), birhsp, lsbp, widthp)); - fromp->widthSignedFrom(nodep); + fromp->dtypeFrom(nodep); nodep->replaceWith(fromp); nodep->deleteTree(); nodep=NULL; } void replaceSelIntoUniop(AstSel* nodep) { @@ -1189,7 +1189,7 @@ private: // fromp->lhsp(new AstSel(nodep->fileline(), bilhsp, lsbp->cloneTree(true), widthp->cloneTree(true))); - fromp->widthSignedFrom(nodep); + fromp->dtypeFrom(nodep); nodep->replaceWith(fromp); nodep->deleteTree(); nodep=NULL; } diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index 16c1af2ec..dccd26646 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -133,7 +133,7 @@ private: } else { if (width==0) { varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, oldvarscp->varp()); - varp->widthSignedFrom(oldvarscp); + varp->dtypeFrom(oldvarscp); } else { // Used for vset and dimensions, so can zero init varp = new AstVar (oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, VFlagBitPacked(), width); } diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 6a2baa0f3..ddbe9e2e5 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -320,7 +320,7 @@ private: AstNode* newp = lhsp; if (nodep->isQuad()) { if (lhsp->isQuad()) { - lhsp->widthSignedFrom(nodep); // Just mark it, else nop + lhsp->dtypeFrom(nodep); // Just mark it, else nop } else if (lhsp->isWide()) { nodep->v3fatalSrc("extending larger thing into smaller?"); } else { @@ -331,7 +331,7 @@ private: if (lhsp->isQuad() || lhsp->isWide()) { nodep->v3fatalSrc("extending larger thing into smaller?"); } else { - lhsp->widthSignedFrom(nodep); // Just mark it, else nop + lhsp->dtypeFrom(nodep); // Just mark it, else nop } } replaceWithDelete(nodep,newp); nodep=NULL; @@ -451,11 +451,11 @@ private: fromp, dropCondBound(lsbp), nodep->width()); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); if (!nodep->isQuad() && fromp->isQuad()) { newp = new AstCCast (newp->fileline(), newp, nodep); } - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); replaceWithDelete(nodep,newp); nodep=NULL; } } diff --git a/src/V3Width.cpp b/src/V3Width.cpp index b0932bb17..28b9c4877 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -849,7 +849,7 @@ private: if (!enump) nodep->v3fatalSrc("EnumItemRef can't deref back to an Enum"); enump->iterate(*this,vup); } - nodep->widthSignedFrom(nodep->itemp()); + nodep->dtypeFrom(nodep->itemp()); } virtual void visit(AstPslClocked* nodep, AstNUser*) { nodep->propp()->iterateAndNext(*this,WidthVP(1,1,BOTH).p()); @@ -1209,13 +1209,13 @@ private: if (nodep->lhsp()) { // Function hasn't been widthed, so make it so. nodep->iterateChildren(*this,WidthVP(ANYSIZE,0,BOTH).p()); - nodep->widthSignedFrom(m_funcp->fvarp()); + nodep->dtypeFrom(m_funcp->fvarp()); } } } virtual void visit(AstFuncRef* nodep, AstNUser* vup) { visit(nodep->castNodeFTaskRef(), vup); - nodep->widthSignedFrom(nodep->taskp()); + nodep->dtypeFrom(nodep->taskp()); //if (debug()) nodep->dumpTree(cout," FuncOut: "); } virtual void visit(AstNodeFTaskRef* nodep, AstNUser* vup) { @@ -1593,6 +1593,7 @@ private: // If errors are off, we need to follow the spec; thus we really need to do the max() // because the rhs could be larger, and we need to have proper editing to get the widths // to be the same for our operations. + //if (debug()>=9) { UINFO(0,"-rus "<c()<dumpTree(cout,"-rusin-"); } if (vup->c()->prelim()) { // First stage evaluation // Determine expression widths only relying on what's in the subops nodep->lhsp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,PRELIM).p()); @@ -1919,7 +1920,7 @@ private: } UINFO(6," ReplaceWithUOrSVersion: "<replaceWith(newp); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); pushDeletep(nodep); nodep=NULL; return newp; } @@ -1972,7 +1973,7 @@ private: } UINFO(6," ReplaceWithDVersion: "<replaceWith(newp); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); pushDeletep(nodep); nodep=NULL; return newp; } diff --git a/src/V3WidthCommit.h b/src/V3WidthCommit.h index 9caf07414..bad03125e 100644 --- a/src/V3WidthCommit.h +++ b/src/V3WidthCommit.h @@ -50,7 +50,7 @@ private: void replaceWithSignedVersion(AstNode* nodep, AstNode* newp) { UINFO(6," Replace "<replaceWith(newp); - newp->widthSignedFrom(nodep); + newp->dtypeFrom(nodep); pushDeletep(nodep); nodep=NULL; } public: diff --git a/src/V3WidthSel.cpp b/src/V3WidthSel.cpp index 2f5edbf50..32dd78650 100644 --- a/src/V3WidthSel.cpp +++ b/src/V3WidthSel.cpp @@ -128,7 +128,7 @@ private: AstNode* newp = new AstSub(rhsp->fileline(), new AstConst(rhsp->fileline(), AstConst::Unsized32(), lhs), rhsp); - newp->widthSignedFrom(rhsp); // Important as AstSub default is lhs's sign + newp->dtypeFrom(rhsp); // Important as AstSub default is lhs's sign return newp; }