From 693d52b57c0c44b49326a15b993e36ae2573de86 Mon Sep 17 00:00:00 2001 From: Todd Strader Date: Fri, 27 Mar 2020 14:51:44 -0400 Subject: [PATCH] More stuff working --- src/V3Width.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 2a8e47331..edf66b5d5 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -3585,6 +3585,8 @@ private: userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT, PRELIM).p()); m_leaveTypeof = false; bool equal = false; + // TODO -- remove + nodep->dumpTree(cout, "typeCompare: "); AstRefDType* refLhsp = VN_CAST(nodep->lhsp(), RefDType); AstRefDType* refRhsp = VN_CAST(nodep->rhsp(), RefDType); if (refLhsp && refRhsp) { @@ -3592,9 +3594,16 @@ private: AstNodeDType* typeRhsp = refRhsp->refDTypep(); if (AstBasicDType* basicLhsp = VN_CAST(typeLhsp, BasicDType)) { AstBasicDType* basicRhsp = VN_CAST(typeRhsp, BasicDType); - if (basicRhsp && basicLhsp->same(typeRhsp) - && basicLhsp->isSigned() == basicRhsp->isSigned()) { - equal = true; + // QUESTION -- AstBasicDType::same() doesn't check signedness . . . should it? + if (basicRhsp && basicLhsp->isSigned() == basicRhsp->isSigned()) { + AstBasicDTypeKwd kwdLhs = basicLhsp->keyword(); + AstBasicDTypeKwd kwdRhs = basicRhsp->keyword(); + if (basicLhsp->same(typeRhsp) || + (kwdLhs.isIntNumeric() && kwdRhs.isIntNumeric() + && kwdLhs.isFourstate() == kwdRhs.isFourstate() + && basicLhsp->nrange() == basicRhsp->nrange())) { + equal = true; + } } } else if (refLhsp->dtypep() == refRhsp->dtypep()) { equal = true;