forked from github/verilator
Move matching check into AstBasicDType
This commit is contained in:
parent
6dd4ff021f
commit
d3ac16d6d9
@ -673,6 +673,16 @@ public:
|
|||||||
virtual bool same(const AstNode* samep) const { // width/widthMin/numeric compared elsewhere
|
virtual bool same(const AstNode* samep) const { // width/widthMin/numeric compared elsewhere
|
||||||
const AstBasicDType* sp = static_cast<const AstBasicDType*>(samep);
|
const AstBasicDType* sp = static_cast<const AstBasicDType*>(samep);
|
||||||
return m == sp->m; }
|
return m == sp->m; }
|
||||||
|
bool matching(const AstBasicDType* matchp) {
|
||||||
|
if (isSigned() == matchp->isSigned()
|
||||||
|
&& (same(matchp) ||
|
||||||
|
(isIntNumeric() && matchp->isIntNumeric()
|
||||||
|
&& isFourstate() == matchp->isFourstate()
|
||||||
|
&& nrange() == matchp->nrange()))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
virtual bool similarDType(AstNodeDType* samep) const {
|
virtual bool similarDType(AstNodeDType* samep) const {
|
||||||
return type()==samep->type() && same(samep); }
|
return type()==samep->type() && same(samep); }
|
||||||
virtual string name() const { return m.m_keyword.ascii(); }
|
virtual string name() const { return m.m_keyword.ascii(); }
|
||||||
@ -700,6 +710,7 @@ public:
|
|||||||
bool isString() const { return keyword().isString(); }
|
bool isString() const { return keyword().isString(); }
|
||||||
bool isSloppy() const { return keyword().isSloppy(); }
|
bool isSloppy() const { return keyword().isSloppy(); }
|
||||||
bool isZeroInit() const { return keyword().isZeroInit(); }
|
bool isZeroInit() const { return keyword().isZeroInit(); }
|
||||||
|
bool isIntNumeric() const { return keyword().isIntNumeric(); }
|
||||||
bool isRanged() const { return rangep() || m.m_nrange.ranged(); }
|
bool isRanged() const { return rangep() || m.m_nrange.ranged(); }
|
||||||
const VNumRange& nrange() const { return m.m_nrange; } // Generally the msb/lsb/etc funcs should be used instead
|
const VNumRange& nrange() const { return m.m_nrange; } // Generally the msb/lsb/etc funcs should be used instead
|
||||||
int msb() const { return (rangep() ? rangep()->msbConst() : m.m_nrange.hi()); }
|
int msb() const { return (rangep() ? rangep()->msbConst() : m.m_nrange.hi()); }
|
||||||
|
@ -3592,19 +3592,10 @@ private:
|
|||||||
if (refLhsp && refRhsp) {
|
if (refLhsp && refRhsp) {
|
||||||
AstNodeDType* typeLhsp = refLhsp->refDTypep();
|
AstNodeDType* typeLhsp = refLhsp->refDTypep();
|
||||||
AstNodeDType* typeRhsp = refRhsp->refDTypep();
|
AstNodeDType* typeRhsp = refRhsp->refDTypep();
|
||||||
if (AstBasicDType* basicLhsp = VN_CAST(typeLhsp, BasicDType)) {
|
AstBasicDType* basicLhsp = VN_CAST(typeLhsp, BasicDType);
|
||||||
AstBasicDType* basicRhsp = VN_CAST(typeRhsp, BasicDType);
|
AstBasicDType* basicRhsp = VN_CAST(typeRhsp, BasicDType);
|
||||||
// QUESTION -- AstBasicDType::same() doesn't check signedness . . . should it?
|
if (basicLhsp && basicRhsp && basicLhsp->matching(basicRhsp)) {
|
||||||
if (basicRhsp && basicLhsp->isSigned() == basicRhsp->isSigned()) {
|
equal = true;
|
||||||
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()) {
|
} else if (refLhsp->dtypep() == refRhsp->dtypep()) {
|
||||||
equal = true;
|
equal = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user