Internals: Rename VSigning
This commit is contained in:
parent
fceedd9f4d
commit
def40fab9b
|
|
@ -1210,7 +1210,7 @@ void AstNode::v3errorEnd(std::ostringstream& str) const {
|
|||
|
||||
void AstNode::dtypeChgSigned(bool flag) {
|
||||
UASSERT_OBJ(dtypep(), this, "No dtype when changing to (un)signed");
|
||||
dtypeChgWidthSigned(dtypep()->width(), dtypep()->widthMin(), AstNumeric::fromBool(flag));
|
||||
dtypeChgWidthSigned(dtypep()->width(), dtypep()->widthMin(), VSigning::fromBool(flag));
|
||||
}
|
||||
void AstNode::dtypeChgWidth(int width, int widthMin) {
|
||||
UASSERT_OBJ(dtypep(), this,
|
||||
|
|
@ -1218,7 +1218,7 @@ void AstNode::dtypeChgWidth(int width, int widthMin) {
|
|||
dtypeChgWidthSigned(width, widthMin, dtypep()->numeric());
|
||||
}
|
||||
|
||||
void AstNode::dtypeChgWidthSigned(int width, int widthMin, AstNumeric numeric) {
|
||||
void AstNode::dtypeChgWidthSigned(int width, int widthMin, VSigning numeric) {
|
||||
if (!dtypep()) {
|
||||
// We allow dtypep() to be null, as before/during widthing dtypes are not resolved
|
||||
dtypeSetLogicUnsized(width, widthMin, numeric);
|
||||
|
|
@ -1240,21 +1240,21 @@ AstNodeDType* AstNode::findBasicDType(AstBasicDTypeKwd kwd) const {
|
|||
// More advanced types land under the module/task/etc
|
||||
return v3Global.rootp()->typeTablep()->findBasicDType(fileline(), kwd);
|
||||
}
|
||||
AstNodeDType* AstNode::findBitDType(int width, int widthMin, AstNumeric numeric) const {
|
||||
AstNodeDType* AstNode::findBitDType(int width, int widthMin, VSigning numeric) const {
|
||||
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::BIT,
|
||||
width, widthMin, numeric);
|
||||
}
|
||||
AstNodeDType* AstNode::findLogicDType(int width, int widthMin, AstNumeric numeric) const {
|
||||
AstNodeDType* AstNode::findLogicDType(int width, int widthMin, VSigning numeric) const {
|
||||
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC,
|
||||
width, widthMin, numeric);
|
||||
}
|
||||
AstNodeDType* AstNode::findLogicRangeDType(const VNumRange& range, int widthMin,
|
||||
AstNumeric numeric) const {
|
||||
VSigning numeric) const {
|
||||
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC,
|
||||
range, widthMin, numeric);
|
||||
}
|
||||
AstNodeDType* AstNode::findBitRangeDType(const VNumRange& range, int widthMin,
|
||||
AstNumeric numeric) const {
|
||||
VSigning numeric) const {
|
||||
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::BIT,
|
||||
range, widthMin, numeric);
|
||||
}
|
||||
|
|
|
|||
78
src/V3Ast.h
78
src/V3Ast.h
|
|
@ -94,16 +94,7 @@ inline std::ostream& operator<<(std::ostream& os, const AstType& rhs) { return o
|
|||
|
||||
//######################################################################
|
||||
|
||||
enum VSignedState {
|
||||
// This can't be in the fancy class as the lexer union will get upset
|
||||
signedst_UNSIGNED = 0,
|
||||
signedst_SIGNED = 1,
|
||||
signedst_NOSIGN = 2
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
|
||||
class AstNumeric {
|
||||
class VSigning {
|
||||
public:
|
||||
enum en {
|
||||
UNSIGNED,
|
||||
|
|
@ -116,35 +107,25 @@ public:
|
|||
static const char* const names[] = {"UNSIGNED", "SIGNED", "NOSIGN"};
|
||||
return names[m_e];
|
||||
}
|
||||
inline AstNumeric()
|
||||
inline VSigning()
|
||||
: m_e(UNSIGNED) {}
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
inline AstNumeric(en _e)
|
||||
inline VSigning(en _e)
|
||||
: m_e(_e) {}
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
inline AstNumeric(VSignedState signst) {
|
||||
if (signst == signedst_UNSIGNED) {
|
||||
m_e = UNSIGNED;
|
||||
} else if (signst == signedst_SIGNED) {
|
||||
m_e = SIGNED;
|
||||
} else {
|
||||
m_e = NOSIGN;
|
||||
}
|
||||
static inline VSigning fromBool(bool isSigned) { // Factory method
|
||||
return isSigned ? VSigning(SIGNED) : VSigning(UNSIGNED);
|
||||
}
|
||||
static inline AstNumeric fromBool(bool isSigned) { // Factory method
|
||||
return isSigned ? AstNumeric(SIGNED) : AstNumeric(UNSIGNED);
|
||||
}
|
||||
explicit inline AstNumeric(int _e)
|
||||
explicit inline VSigning(int _e)
|
||||
: m_e(static_cast<en>(_e)) {}
|
||||
operator en() const { return m_e; }
|
||||
inline bool isSigned() const { return m_e == SIGNED; }
|
||||
inline bool isNosign() const { return m_e == NOSIGN; }
|
||||
// No isUnsigned() as it's ambiguous if NOSIGN should be included or not.
|
||||
};
|
||||
inline bool operator==(const AstNumeric& lhs, const AstNumeric& rhs) { return lhs.m_e == rhs.m_e; }
|
||||
inline bool operator==(const AstNumeric& lhs, AstNumeric::en rhs) { return lhs.m_e == rhs; }
|
||||
inline bool operator==(AstNumeric::en lhs, const AstNumeric& rhs) { return lhs == rhs.m_e; }
|
||||
inline std::ostream& operator<<(std::ostream& os, const AstNumeric& rhs) {
|
||||
inline bool operator==(const VSigning& lhs, const VSigning& rhs) { return lhs.m_e == rhs.m_e; }
|
||||
inline bool operator==(const VSigning& lhs, VSigning::en rhs) { return lhs.m_e == rhs; }
|
||||
inline bool operator==(VSigning::en lhs, const VSigning& rhs) { return lhs == rhs.m_e; }
|
||||
inline std::ostream& operator<<(std::ostream& os, const VSigning& rhs) {
|
||||
return os << rhs.ascii();
|
||||
}
|
||||
|
||||
|
|
@ -998,7 +979,7 @@ class VBasicTypeKey {
|
|||
public:
|
||||
int m_width; // From AstNodeDType: Bit width of operation
|
||||
int m_widthMin; // From AstNodeDType: If unsized, bitwidth of minimum implementation
|
||||
AstNumeric m_numeric; // From AstNodeDType: Node is signed
|
||||
VSigning m_numeric; // From AstNodeDType: Node is signed
|
||||
AstBasicDTypeKwd m_keyword; // From AstBasicDType: What keyword created basic type
|
||||
VNumRange m_nrange; // From AstBasicDType: Numeric msb/lsb (if non-opaque keyword)
|
||||
inline bool operator==(const VBasicTypeKey& rhs) const {
|
||||
|
|
@ -1018,7 +999,7 @@ public:
|
|||
if (!(m_nrange == rhs.m_nrange)) return false; // lhs > rhs
|
||||
return false;
|
||||
}
|
||||
VBasicTypeKey(int width, int widthMin, AstNumeric numeric, AstBasicDTypeKwd kwd,
|
||||
VBasicTypeKey(int width, int widthMin, VSigning numeric, AstBasicDTypeKwd kwd,
|
||||
const VNumRange& nrange)
|
||||
: m_width(width)
|
||||
, m_widthMin(widthMin)
|
||||
|
|
@ -1638,17 +1619,17 @@ public:
|
|||
}
|
||||
void dtypeChgSigned(bool flag = true);
|
||||
void dtypeChgWidth(int width, int widthMin);
|
||||
void dtypeChgWidthSigned(int width, int widthMin, AstNumeric numeric);
|
||||
void dtypeSetBitUnsized(int width, int widthMin, AstNumeric numeric) {
|
||||
void dtypeChgWidthSigned(int width, int widthMin, VSigning numeric);
|
||||
void dtypeSetBitUnsized(int width, int widthMin, VSigning numeric) {
|
||||
dtypep(findBitDType(width, widthMin, numeric));
|
||||
}
|
||||
void dtypeSetBitSized(int width, AstNumeric numeric) {
|
||||
void dtypeSetBitSized(int width, VSigning numeric) {
|
||||
dtypep(findBitDType(width, width, numeric)); // Since sized, widthMin is width
|
||||
}
|
||||
void dtypeSetLogicUnsized(int width, int widthMin, AstNumeric numeric) {
|
||||
void dtypeSetLogicUnsized(int width, int widthMin, VSigning numeric) {
|
||||
dtypep(findLogicDType(width, widthMin, numeric));
|
||||
}
|
||||
void dtypeSetLogicSized(int width, AstNumeric numeric) {
|
||||
void dtypeSetLogicSized(int width, VSigning numeric) {
|
||||
dtypep(findLogicDType(width, width, numeric)); // Since sized, widthMin is width
|
||||
}
|
||||
void dtypeSetLogicBool() { dtypep(findLogicBoolDType()); }
|
||||
|
|
@ -1667,12 +1648,11 @@ public:
|
|||
AstNodeDType* findUInt32DType() { return findBasicDType(AstBasicDTypeKwd::UINT32); }
|
||||
AstNodeDType* findUInt64DType() { return findBasicDType(AstBasicDTypeKwd::UINT64); }
|
||||
AstNodeDType* findVoidDType() const;
|
||||
AstNodeDType* findBitDType(int width, int widthMin, AstNumeric numeric) const;
|
||||
AstNodeDType* findLogicDType(int width, int widthMin, AstNumeric numeric) const;
|
||||
AstNodeDType* findBitDType(int width, int widthMin, VSigning numeric) const;
|
||||
AstNodeDType* findLogicDType(int width, int widthMin, VSigning numeric) const;
|
||||
AstNodeDType* findLogicRangeDType(const VNumRange& range, int widthMin,
|
||||
AstNumeric numeric) const;
|
||||
AstNodeDType* findBitRangeDType(const VNumRange& range, int widthMin,
|
||||
AstNumeric numeric) const;
|
||||
VSigning numeric) const;
|
||||
AstNodeDType* findBitRangeDType(const VNumRange& range, int widthMin, VSigning numeric) const;
|
||||
AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd) const;
|
||||
AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
|
||||
|
||||
|
|
@ -2224,7 +2204,7 @@ class AstNodeDType : public AstNode {
|
|||
private:
|
||||
int m_width; // (also in AstTypeTable::Key) Bit width of operation
|
||||
int m_widthMin; // (also in AstTypeTable::Key) If unsized, bitwidth of minimum implementation
|
||||
AstNumeric m_numeric; // (also in AstTypeTable::Key) Node is signed
|
||||
VSigning m_numeric; // (also in AstTypeTable::Key) Node is signed
|
||||
// Other members
|
||||
bool m_generic; // Simple globally referenced type, don't garbage collect
|
||||
// Unique number assigned to each dtype during creation for IEEE matching
|
||||
|
|
@ -2287,10 +2267,10 @@ public:
|
|||
}
|
||||
//
|
||||
int width() const { return m_width; }
|
||||
void numeric(AstNumeric flag) { m_numeric = flag; }
|
||||
void numeric(VSigning flag) { m_numeric = flag; }
|
||||
bool isSigned() const { return m_numeric.isSigned(); }
|
||||
bool isNosign() const { return m_numeric.isNosign(); }
|
||||
AstNumeric numeric() const { return m_numeric; }
|
||||
VSigning numeric() const { return m_numeric; }
|
||||
int widthWords() const { return VL_WORDS_I(width()); }
|
||||
int widthMin() const { // If sized, the size, if unsized the min digits to represent it
|
||||
return m_widthMin ? m_widthMin : m_width;
|
||||
|
|
@ -2321,12 +2301,12 @@ private:
|
|||
MemberNameMap m_members;
|
||||
|
||||
public:
|
||||
AstNodeUOrStructDType(AstType t, FileLine* fl, AstNumeric numericUnpack)
|
||||
AstNodeUOrStructDType(AstType t, FileLine* fl, VSigning numericUnpack)
|
||||
: AstNodeDType(t, fl) {
|
||||
// AstNumeric::NOSIGN overloaded to indicate not packed
|
||||
m_packed = (numericUnpack != AstNumeric::NOSIGN);
|
||||
// VSigning::NOSIGN overloaded to indicate not packed
|
||||
m_packed = (numericUnpack != VSigning::NOSIGN);
|
||||
m_isFourstate = false; // V3Width computes
|
||||
numeric(AstNumeric::fromBool(numericUnpack.isSigned()));
|
||||
numeric(VSigning::fromBool(numericUnpack.isSigned()));
|
||||
}
|
||||
ASTNODE_BASE_FUNCS(NodeUOrStructDType)
|
||||
virtual const char* broken() const;
|
||||
|
|
@ -2458,7 +2438,7 @@ class AstNodeStream : public AstNodeBiop {
|
|||
public:
|
||||
AstNodeStream(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
|
||||
: AstNodeBiop(t, fl, lhsp, rhsp) {
|
||||
if (lhsp->dtypep()) { dtypeSetLogicSized(lhsp->dtypep()->width(), AstNumeric::UNSIGNED); }
|
||||
if (lhsp->dtypep()) { dtypeSetLogicSized(lhsp->dtypep()->width(), VSigning::UNSIGNED); }
|
||||
}
|
||||
ASTNODE_BASE_FUNCS(NodeStream)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -875,7 +875,7 @@ AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd)
|
|||
}
|
||||
|
||||
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, int width,
|
||||
int widthMin, AstNumeric numeric) {
|
||||
int widthMin, VSigning numeric) {
|
||||
AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, width, widthMin);
|
||||
AstBasicDType* newp = findInsertSameDType(new1p);
|
||||
if (newp != new1p) {
|
||||
|
|
@ -887,7 +887,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kw
|
|||
}
|
||||
|
||||
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, VNumRange range,
|
||||
int widthMin, AstNumeric numeric) {
|
||||
int widthMin, VSigning numeric) {
|
||||
AstBasicDType* new1p = new AstBasicDType(fl, kwd, numeric, range, widthMin);
|
||||
AstBasicDType* newp = findInsertSameDType(new1p);
|
||||
if (newp != new1p) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ private:
|
|||
dtypeSetString();
|
||||
} else {
|
||||
dtypeSetLogicUnsized(m_num.width(), (m_num.sized() ? 0 : m_num.widthMin()),
|
||||
AstNumeric::fromBool(m_num.isSigned()));
|
||||
VSigning::fromBool(m_num.isSigned()));
|
||||
}
|
||||
m_num.nodep(this);
|
||||
}
|
||||
|
|
@ -97,35 +97,35 @@ public:
|
|||
AstConst(FileLine* fl, uint32_t num)
|
||||
: ASTGEN_SUPER(fl)
|
||||
, m_num(this, 32, num) {
|
||||
dtypeSetLogicUnsized(m_num.width(), 0, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicUnsized(m_num.width(), 0, VSigning::UNSIGNED);
|
||||
}
|
||||
class Unsized32 {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, Unsized32, uint32_t num) // Unsized 32-bit integer of specified value
|
||||
: ASTGEN_SUPER(fl)
|
||||
, m_num(this, 32, num) {
|
||||
m_num.width(32, false);
|
||||
dtypeSetLogicUnsized(32, m_num.widthMin(), AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicUnsized(32, m_num.widthMin(), VSigning::UNSIGNED);
|
||||
}
|
||||
class Signed32 {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, Signed32, int32_t num) // Signed 32-bit integer of specified value
|
||||
: ASTGEN_SUPER(fl)
|
||||
, m_num(this, 32, num) {
|
||||
m_num.width(32, true);
|
||||
dtypeSetLogicUnsized(32, m_num.widthMin(), AstNumeric::SIGNED);
|
||||
dtypeSetLogicUnsized(32, m_num.widthMin(), VSigning::SIGNED);
|
||||
}
|
||||
class Unsized64 {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, Unsized64, vluint64_t num)
|
||||
: ASTGEN_SUPER(fl)
|
||||
, m_num(this, 64, 0) {
|
||||
m_num.setQuad(num);
|
||||
dtypeSetLogicSized(64, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(64, VSigning::UNSIGNED);
|
||||
}
|
||||
class SizedEData {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, SizedEData, vluint64_t num)
|
||||
: ASTGEN_SUPER(fl)
|
||||
, m_num(this, VL_EDATASIZE, 0) {
|
||||
m_num.setQuad(num);
|
||||
dtypeSetLogicSized(VL_EDATASIZE, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(VL_EDATASIZE, VSigning::UNSIGNED);
|
||||
}
|
||||
class RealDouble {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, RealDouble, double num)
|
||||
|
|
@ -735,24 +735,23 @@ private:
|
|||
} m;
|
||||
// See also in AstNodeDType: m_width, m_widthMin, m_numeric(issigned)
|
||||
public:
|
||||
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSignedState signst = signedst_NOSIGN)
|
||||
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, const VSigning& signst = VSigning::NOSIGN)
|
||||
: ASTGEN_SUPER(fl) {
|
||||
init(kwd, AstNumeric(signst), 0, -1, NULL);
|
||||
init(kwd, signst, 0, -1, NULL);
|
||||
}
|
||||
AstBasicDType(FileLine* fl, VFlagLogicPacked, int wantwidth)
|
||||
: ASTGEN_SUPER(fl) {
|
||||
init(AstBasicDTypeKwd::LOGIC, AstNumeric::NOSIGN, wantwidth, -1, NULL);
|
||||
init(AstBasicDTypeKwd::LOGIC, VSigning::NOSIGN, wantwidth, -1, NULL);
|
||||
}
|
||||
AstBasicDType(FileLine* fl, VFlagBitPacked, int wantwidth)
|
||||
: ASTGEN_SUPER(fl) {
|
||||
init(AstBasicDTypeKwd::BIT, AstNumeric::NOSIGN, wantwidth, -1, NULL);
|
||||
init(AstBasicDTypeKwd::BIT, VSigning::NOSIGN, wantwidth, -1, NULL);
|
||||
}
|
||||
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, AstNumeric numer, int wantwidth,
|
||||
int widthmin)
|
||||
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSigning numer, int wantwidth, int widthmin)
|
||||
: ASTGEN_SUPER(fl) {
|
||||
init(kwd, numer, wantwidth, widthmin, NULL);
|
||||
}
|
||||
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, AstNumeric numer, VNumRange range,
|
||||
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSigning numer, VNumRange range,
|
||||
int widthmin)
|
||||
: ASTGEN_SUPER(fl) {
|
||||
init(kwd, numer, range.elements(), widthmin, NULL);
|
||||
|
|
@ -760,7 +759,7 @@ public:
|
|||
}
|
||||
// See also addRange in verilog.y
|
||||
private:
|
||||
void init(AstBasicDTypeKwd kwd, AstNumeric numer, int wantwidth, int wantwidthmin,
|
||||
void init(AstBasicDTypeKwd kwd, VSigning numer, int wantwidth, int wantwidthmin,
|
||||
AstRange* rangep) {
|
||||
// wantwidth=0 means figure it out, but if a widthmin is >=0
|
||||
// we allow width 0 so that {{0{x}},y} works properly
|
||||
|
|
@ -771,11 +770,11 @@ private:
|
|||
if (keyword() == AstBasicDTypeKwd::LOGIC_IMPLICIT) {
|
||||
if (rangep || wantwidth) m.m_keyword = AstBasicDTypeKwd::LOGIC;
|
||||
}
|
||||
if (numer == AstNumeric::NOSIGN) {
|
||||
if (numer == VSigning::NOSIGN) {
|
||||
if (keyword().isSigned()) {
|
||||
numer = AstNumeric::SIGNED;
|
||||
numer = VSigning::SIGNED;
|
||||
} else if (keyword().isUnsigned()) {
|
||||
numer = AstNumeric::UNSIGNED;
|
||||
numer = VSigning::UNSIGNED;
|
||||
}
|
||||
}
|
||||
numeric(numer);
|
||||
|
|
@ -818,11 +817,11 @@ public:
|
|||
}
|
||||
AstRange* rangep() const { return VN_CAST(op1p(), Range); } // op1 = Range of variable
|
||||
void rangep(AstRange* nodep) { setNOp1p(nodep); }
|
||||
void setSignedState(VSignedState signst) {
|
||||
void setSignedState(const VSigning& signst) {
|
||||
// Note NOSIGN does NOT change the state; this is required by the parser
|
||||
if (signst == signedst_UNSIGNED) {
|
||||
if (signst == VSigning::UNSIGNED) {
|
||||
numeric(signst);
|
||||
} else if (signst == signedst_SIGNED) {
|
||||
} else if (signst == VSigning::SIGNED) {
|
||||
numeric(signst);
|
||||
}
|
||||
}
|
||||
|
|
@ -1187,8 +1186,8 @@ public:
|
|||
|
||||
class AstStructDType : public AstNodeUOrStructDType {
|
||||
public:
|
||||
// AstNumeric below is mispurposed to indicate if packed or not
|
||||
AstStructDType(FileLine* fl, AstNumeric numericUnpack)
|
||||
// VSigning below is mispurposed to indicate if packed or not
|
||||
AstStructDType(FileLine* fl, VSigning numericUnpack)
|
||||
: ASTGEN_SUPER(fl, numericUnpack) {}
|
||||
ASTNODE_NODE_FUNCS(StructDType)
|
||||
virtual string verilogKwd() const { return "struct"; }
|
||||
|
|
@ -1197,8 +1196,8 @@ public:
|
|||
class AstUnionDType : public AstNodeUOrStructDType {
|
||||
public:
|
||||
// UNSUP: bool isTagged;
|
||||
// AstNumeric below is mispurposed to indicate if packed or not
|
||||
AstUnionDType(FileLine* fl, AstNumeric numericUnpack)
|
||||
// VSigning below is mispurposed to indicate if packed or not
|
||||
AstUnionDType(FileLine* fl, VSigning numericUnpack)
|
||||
: ASTGEN_SUPER(fl, numericUnpack) {}
|
||||
ASTNODE_NODE_FUNCS(UnionDType)
|
||||
virtual string verilogKwd() const { return "union"; }
|
||||
|
|
@ -1592,13 +1591,13 @@ public:
|
|||
: ASTGEN_SUPER(fl, fromp, lsbp, widthp) {
|
||||
m_declElWidth = 1;
|
||||
if (VN_IS(widthp, Const)) {
|
||||
dtypeSetLogicSized(VN_CAST(widthp, Const)->toUInt(), AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(VN_CAST(widthp, Const)->toUInt(), VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
AstSel(FileLine* fl, AstNode* fromp, int lsb, int bitwidth)
|
||||
: ASTGEN_SUPER(fl, fromp, new AstConst(fl, lsb), new AstConst(fl, bitwidth)) {
|
||||
m_declElWidth = 1;
|
||||
dtypeSetLogicSized(bitwidth, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(bitwidth, VSigning::UNSIGNED);
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(Sel)
|
||||
virtual void dump(std::ostream& str) const;
|
||||
|
|
@ -1861,7 +1860,7 @@ public:
|
|||
, m_origName(name) {
|
||||
init();
|
||||
combineType(type);
|
||||
dtypeSetLogicSized(wantwidth, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(wantwidth, VSigning::UNSIGNED);
|
||||
m_declKwd = AstBasicDTypeKwd::LOGIC;
|
||||
}
|
||||
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagBitPacked, int wantwidth)
|
||||
|
|
@ -1870,7 +1869,7 @@ public:
|
|||
, m_origName(name) {
|
||||
init();
|
||||
combineType(type);
|
||||
dtypeSetBitSized(wantwidth, AstNumeric::UNSIGNED);
|
||||
dtypeSetBitSized(wantwidth, VSigning::UNSIGNED);
|
||||
m_declKwd = AstBasicDTypeKwd::BIT;
|
||||
}
|
||||
AstVar(FileLine* fl, AstVarType type, const string& name, AstVar* examplep)
|
||||
|
|
@ -5204,7 +5203,7 @@ public:
|
|||
: ASTGEN_SUPER(fl, lhsp) {}
|
||||
AstExtend(FileLine* fl, AstNode* lhsp, int width)
|
||||
: ASTGEN_SUPER(fl, lhsp) {
|
||||
dtypeSetLogicSized(width, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(width, VSigning::UNSIGNED);
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(Extend)
|
||||
virtual void numberOperate(V3Number& out, const V3Number& lhs) { out.opAssign(lhs); }
|
||||
|
|
@ -5225,7 +5224,7 @@ public:
|
|||
AstExtendS(FileLine* fl, AstNode* lhsp, int width)
|
||||
// Important that widthMin be correct, as opExtend requires it after V3Expand
|
||||
: ASTGEN_SUPER(fl, lhsp) {
|
||||
dtypeSetLogicSized(width, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(width, VSigning::UNSIGNED);
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(ExtendS)
|
||||
virtual void numberOperate(V3Number& out, const V3Number& lhs) {
|
||||
|
|
@ -5503,7 +5502,7 @@ public:
|
|||
m_size = setwidth;
|
||||
if (setwidth) {
|
||||
if (minwidth == -1) minwidth = setwidth;
|
||||
dtypeSetLogicUnsized(setwidth, minwidth, AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicUnsized(setwidth, minwidth, VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
AstCCast(FileLine* fl, AstNode* lhsp, AstNode* typeFromp)
|
||||
|
|
@ -6650,7 +6649,7 @@ class AstShiftL : public AstNodeBiop {
|
|||
public:
|
||||
AstShiftL(FileLine* fl, AstNode* lhsp, AstNode* rhsp, int setwidth = 0)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, AstNumeric::UNSIGNED); }
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, VSigning::UNSIGNED); }
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(ShiftL)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
|
|
@ -6672,7 +6671,7 @@ class AstShiftR : public AstNodeBiop {
|
|||
public:
|
||||
AstShiftR(FileLine* fl, AstNode* lhsp, AstNode* rhsp, int setwidth = 0)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, AstNumeric::UNSIGNED); }
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, VSigning::UNSIGNED); }
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(ShiftR)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
|
|
@ -6698,7 +6697,7 @@ public:
|
|||
AstShiftRS(FileLine* fl, AstNode* lhsp, AstNode* rhsp, int setwidth = 0)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
// Important that widthMin be correct, as opExtend requires it after V3Expand
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, AstNumeric::SIGNED); }
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, VSigning::SIGNED); }
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(ShiftRS)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
|
|
@ -7206,7 +7205,7 @@ public:
|
|||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
if (lhsp->dtypep() && rhsp->dtypep()) {
|
||||
dtypeSetLogicSized(lhsp->dtypep()->width() + rhsp->dtypep()->width(),
|
||||
AstNumeric::UNSIGNED);
|
||||
VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(Concat)
|
||||
|
|
@ -7256,7 +7255,7 @@ private:
|
|||
void init() {
|
||||
if (lhsp()) {
|
||||
if (const AstConst* constp = VN_CAST(rhsp(), Const)) {
|
||||
dtypeSetLogicSized(lhsp()->width() * constp->toUInt(), AstNumeric::UNSIGNED);
|
||||
dtypeSetLogicSized(lhsp()->width() * constp->toUInt(), VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7482,7 +7481,7 @@ class AstGetcN : public AstNodeBiop {
|
|||
public:
|
||||
AstGetcN(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
dtypeSetBitSized(8, AstNumeric::UNSIGNED);
|
||||
dtypeSetBitSized(8, VSigning::UNSIGNED);
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(GetcN)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
|
|
@ -7508,7 +7507,7 @@ class AstGetcRefN : public AstNodeBiop {
|
|||
public:
|
||||
AstGetcRefN(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
dtypeSetBitSized(8, AstNumeric::UNSIGNED);
|
||||
dtypeSetBitSized(8, VSigning::UNSIGNED);
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(GetcRefN)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
|
|
@ -8193,7 +8192,7 @@ public:
|
|||
, m_cleanOut(cleanOut)
|
||||
, m_pure(true) {
|
||||
addNOp1p(new AstText(fl, textStmt, true));
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, AstNumeric::UNSIGNED); }
|
||||
if (setwidth) { dtypeSetLogicSized(setwidth, VSigning::UNSIGNED); }
|
||||
}
|
||||
ASTNODE_NODE_FUNCS(CMath)
|
||||
virtual bool isGateOptimizable() const { return m_pure; }
|
||||
|
|
@ -8340,9 +8339,9 @@ public:
|
|||
AstVoidDType* findVoidDType(FileLine* fl);
|
||||
AstBasicDType* findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd);
|
||||
AstBasicDType* findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, int width, int widthMin,
|
||||
AstNumeric numeric);
|
||||
VSigning numeric);
|
||||
AstBasicDType* findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, VNumRange range,
|
||||
int widthMin, AstNumeric numeric);
|
||||
int widthMin, VSigning numeric);
|
||||
AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
|
||||
void clearCache();
|
||||
void repairCache();
|
||||
|
|
|
|||
|
|
@ -839,7 +839,7 @@ private:
|
|||
// use the lhs to replace the parent concat
|
||||
lp->lhsp()->replaceWith(newlp);
|
||||
lp->rhsp()->replaceWith(newrp);
|
||||
lp->dtypeChgWidthSigned(newlp->width(), newlp->width(), AstNumeric::UNSIGNED);
|
||||
lp->dtypeChgWidthSigned(newlp->width(), newlp->width(), VSigning::UNSIGNED);
|
||||
UINFO(5, "merged " << nodep << endl);
|
||||
VL_DO_DANGLING(rp->unlinkFrBack()->deleteTree(), rp);
|
||||
nodep->replaceWith(lp->unlinkFrBack());
|
||||
|
|
@ -1179,7 +1179,7 @@ private:
|
|||
AstNode* srcp = nodep->rhsp()->unlinkFrBack();
|
||||
// Connect the rhs to the stream operator and update its width
|
||||
VN_CAST(streamp, StreamL)->lhsp(srcp);
|
||||
streamp->dtypeSetLogicUnsized(srcp->width(), srcp->widthMin(), AstNumeric::UNSIGNED);
|
||||
streamp->dtypeSetLogicUnsized(srcp->width(), srcp->widthMin(), VSigning::UNSIGNED);
|
||||
// Shrink the RHS if necessary
|
||||
if (sWidth > dWidth) {
|
||||
streamp = new AstSel(streamp->fileline(), streamp, sWidth - dWidth, dWidth);
|
||||
|
|
@ -1239,7 +1239,7 @@ private:
|
|||
val.opShiftL(andConstp->num(), shiftConstp->num());
|
||||
AstAnd* newp = new AstAnd(nodep->fileline(), new AstConst(nodep->fileline(), val), fromp);
|
||||
// widthMin no longer applicable if different C-expanded width
|
||||
newp->dtypeSetLogicSized(nodep->width(), AstNumeric::UNSIGNED);
|
||||
newp->dtypeSetLogicSized(nodep->width(), VSigning::UNSIGNED);
|
||||
nodep->replaceWith(newp);
|
||||
VL_DO_DANGLING(nodep->deleteTree(), nodep);
|
||||
if (debug() >= 9) newp->dumpTree(cout, " _new: ");
|
||||
|
|
|
|||
|
|
@ -112,13 +112,11 @@ private:
|
|||
new AstConst(nodep->fileline(), word));
|
||||
} else if (nodep->isQuad() && word == 0) {
|
||||
AstNode* quadfromp = nodep->cloneTree(true);
|
||||
quadfromp->dtypeSetBitUnsized(VL_QUADSIZE, quadfromp->widthMin(),
|
||||
AstNumeric::UNSIGNED);
|
||||
quadfromp->dtypeSetBitUnsized(VL_QUADSIZE, quadfromp->widthMin(), VSigning::UNSIGNED);
|
||||
return new AstCCast(nodep->fileline(), quadfromp, VL_EDATASIZE);
|
||||
} else if (nodep->isQuad() && word == 1) {
|
||||
AstNode* quadfromp = nodep->cloneTree(true);
|
||||
quadfromp->dtypeSetBitUnsized(VL_QUADSIZE, quadfromp->widthMin(),
|
||||
AstNumeric::UNSIGNED);
|
||||
quadfromp->dtypeSetBitUnsized(VL_QUADSIZE, quadfromp->widthMin(), VSigning::UNSIGNED);
|
||||
return new AstCCast(nodep->fileline(),
|
||||
new AstShiftR(nodep->fileline(), quadfromp,
|
||||
new AstConst(nodep->fileline(), VL_EDATASIZE),
|
||||
|
|
@ -698,7 +696,7 @@ private:
|
|||
if (lhswidth == 1) {
|
||||
newp = new AstNegate(nodep->fileline(), lhsp->cloneTree(true));
|
||||
newp->dtypeSetLogicSized(VL_EDATASIZE,
|
||||
AstNumeric::UNSIGNED); // Replicate always unsigned
|
||||
VSigning::UNSIGNED); // Replicate always unsigned
|
||||
} else {
|
||||
newp = newAstWordSelClone(lhsp, w);
|
||||
for (unsigned repnum = 1; repnum < times; repnum++) {
|
||||
|
|
|
|||
|
|
@ -1340,7 +1340,7 @@ private:
|
|||
VL_DO_DANGLING(oldrhsp->deleteTree(), oldrhsp);
|
||||
m_assignp->dtypeChgWidthSigned(m_assignp->width() + assignp->width(),
|
||||
m_assignp->width() + assignp->width(),
|
||||
AstNumeric::SIGNED);
|
||||
VSigning::SIGNED);
|
||||
// don't need to delete, will be handled
|
||||
// assignp->unlinkFrBack(); VL_DO_DANGLING(assignp->deleteTree(),
|
||||
// assignp);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ struct V3ParseBisonYYSType {
|
|||
double cdouble;
|
||||
bool cbool;
|
||||
V3UniqState uniqstate;
|
||||
VSignedState signstate;
|
||||
V3ImportProperty iprop;
|
||||
VSigning::en signstate;
|
||||
V3ErrorCode::en errcodeen;
|
||||
AstAttrType::en attrtypeen;
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ private:
|
|||
// Change it variable
|
||||
FileLine* fl = nodep->fileline();
|
||||
AstNodeArrayDType* dtypep = new AstUnpackArrayDType(
|
||||
fl, nodep->findBitDType(m_outVarps.size(), m_outVarps.size(), AstNumeric::UNSIGNED),
|
||||
fl, nodep->findBitDType(m_outVarps.size(), m_outVarps.size(), VSigning::UNSIGNED),
|
||||
new AstRange(fl, VL_MASK_I(m_inWidth), 0));
|
||||
v3Global.rootp()->typeTablep()->addTypesp(dtypep);
|
||||
AstVar* chgVarp = new AstVar(fl, AstVarType::MODULETEMP,
|
||||
|
|
|
|||
|
|
@ -317,10 +317,10 @@ private:
|
|||
|
||||
// Widths: out signed/unsigned width = lhs width, input un|signed
|
||||
virtual void visit(AstSigned* nodep) VL_OVERRIDE {
|
||||
visit_signed_unsigned(nodep, AstNumeric::SIGNED);
|
||||
visit_signed_unsigned(nodep, VSigning::SIGNED);
|
||||
}
|
||||
virtual void visit(AstUnsigned* nodep) VL_OVERRIDE {
|
||||
visit_signed_unsigned(nodep, AstNumeric::UNSIGNED);
|
||||
visit_signed_unsigned(nodep, VSigning::UNSIGNED);
|
||||
}
|
||||
|
||||
// Widths: Output width from lhs, rhs<33 bits
|
||||
|
|
@ -369,7 +369,7 @@ private:
|
|||
// See similar handling in visit_cmp_eq_gt where created
|
||||
iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH);
|
||||
iterateCheckSigned32(nodep, "RHS", nodep->rhsp(), BOTH);
|
||||
nodep->dtypeSetBitSized(8, AstNumeric::UNSIGNED);
|
||||
nodep->dtypeSetBitSized(8, VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstGetcRefN* nodep) VL_OVERRIDE {
|
||||
|
|
@ -379,7 +379,7 @@ private:
|
|||
// See similar handling in visit_cmp_eq_gt where created
|
||||
iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH);
|
||||
iterateCheckSigned32(nodep, "RHS", nodep->rhsp(), BOTH);
|
||||
nodep->dtypeSetBitSized(8, AstNumeric::UNSIGNED);
|
||||
nodep->dtypeSetBitSized(8, VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstSubstrN* nodep) VL_OVERRIDE {
|
||||
|
|
@ -454,7 +454,7 @@ private:
|
|||
int width = std::max(nodep->expr1p()->width(), nodep->expr2p()->width());
|
||||
int mwidth = std::max(nodep->expr1p()->widthMin(), nodep->expr2p()->widthMin());
|
||||
bool issigned = nodep->expr1p()->isSigned() && nodep->expr2p()->isSigned();
|
||||
nodep->dtypeSetLogicUnsized(width, mwidth, AstNumeric::fromBool(issigned));
|
||||
nodep->dtypeSetLogicUnsized(width, mwidth, VSigning::fromBool(issigned));
|
||||
}
|
||||
}
|
||||
if (m_vup->final()) {
|
||||
|
|
@ -489,7 +489,7 @@ private:
|
|||
iterateCheckSizedSelf(nodep, "RHS", nodep->rhsp(), SELF, BOTH);
|
||||
nodep->dtypeSetLogicUnsized(nodep->lhsp()->width() + nodep->rhsp()->width(),
|
||||
nodep->lhsp()->widthMin() + nodep->rhsp()->widthMin(),
|
||||
AstNumeric::UNSIGNED);
|
||||
VSigning::UNSIGNED);
|
||||
// Cleanup zero width Verilog2001 {x,{0{foo}}} now,
|
||||
// otherwise having width(0) will cause later assertions to fire
|
||||
if (AstReplicate* repp = VN_CAST(nodep->lhsp(), Replicate)) {
|
||||
|
|
@ -586,7 +586,7 @@ private:
|
|||
} else {
|
||||
nodep->dtypeSetLogicUnsized((nodep->lhsp()->width() * times),
|
||||
(nodep->lhsp()->widthMin() * times),
|
||||
AstNumeric::UNSIGNED);
|
||||
VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
if (m_vup->final()) {
|
||||
|
|
@ -647,7 +647,7 @@ private:
|
|||
}
|
||||
}
|
||||
nodep->dtypeSetLogicUnsized(nodep->lhsp()->width(), nodep->lhsp()->widthMin(),
|
||||
AstNumeric::UNSIGNED);
|
||||
VSigning::UNSIGNED);
|
||||
}
|
||||
if (m_vup->final()) {
|
||||
if (!nodep->dtypep()->widthSized()) {
|
||||
|
|
@ -719,7 +719,7 @@ private:
|
|||
nodep->v3error("Unsupported: MSB < LSB of bit extract: "
|
||||
<< nodep->msbConst() << "<" << nodep->lsbConst());
|
||||
width = (nodep->lsbConst() - nodep->msbConst() + 1);
|
||||
nodep->dtypeSetLogicSized(width, AstNumeric::UNSIGNED);
|
||||
nodep->dtypeSetLogicSized(width, VSigning::UNSIGNED);
|
||||
nodep->widthp()->replaceWith(new AstConst(nodep->widthp()->fileline(), width));
|
||||
nodep->lsbp()->replaceWith(new AstConst(nodep->lsbp()->fileline(), 0));
|
||||
}
|
||||
|
|
@ -1035,7 +1035,7 @@ private:
|
|||
virtual void visit(AstUCFunc* nodep) VL_OVERRIDE {
|
||||
// Give it the size the user wants.
|
||||
if (m_vup && m_vup->prelim()) {
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::UNSIGNED); // We don't care
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::UNSIGNED); // We don't care
|
||||
// All arguments seek their natural sizes
|
||||
userIterateChildren(nodep, WidthVP(SELF, BOTH).p());
|
||||
}
|
||||
|
|
@ -1120,8 +1120,8 @@ private:
|
|||
iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH);
|
||||
// If it's a 32 bit number, we need a 6 bit number as we need to return '32'.
|
||||
int selwidth = V3Number::log2b(nodep->lhsp()->width()) + 1;
|
||||
nodep->dtypeSetLogicSized(
|
||||
selwidth, AstNumeric::UNSIGNED); // Spec doesn't indicate if an integer
|
||||
nodep->dtypeSetLogicSized(selwidth,
|
||||
VSigning::UNSIGNED); // Spec doesn't indicate if an integer
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCvtPackString* nodep) VL_OVERRIDE {
|
||||
|
|
@ -1261,7 +1261,7 @@ private:
|
|||
}
|
||||
default: {
|
||||
// Everything else resolved earlier
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::UNSIGNED); // Approximation, unsized 32
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::UNSIGNED); // Approximation, unsized 32
|
||||
UINFO(1, "Missing ATTR type case node: " << nodep << endl);
|
||||
nodep->v3fatalSrc("Missing ATTR type case");
|
||||
break;
|
||||
|
|
@ -1596,13 +1596,13 @@ private:
|
|||
// not "parameter logic foo" as you can extract
|
||||
// "foo[0]" from a parameter but not a wire
|
||||
nodep->dtypeChgWidthSigned(width, nodep->valuep()->widthMin(),
|
||||
AstNumeric::fromBool(issigned));
|
||||
VSigning::fromBool(issigned));
|
||||
nodep->dtypep(nodep->findLogicRangeDType(VNumRange(0, 0, false),
|
||||
nodep->valuep()->widthMin(),
|
||||
AstNumeric::fromBool(issigned)));
|
||||
VSigning::fromBool(issigned)));
|
||||
} else {
|
||||
nodep->dtypeChgWidthSigned(width, nodep->valuep()->widthMin(),
|
||||
AstNumeric::fromBool(issigned));
|
||||
VSigning::fromBool(issigned));
|
||||
}
|
||||
didchk = true;
|
||||
}
|
||||
|
|
@ -2958,7 +2958,7 @@ private:
|
|||
int mwidth = std::max(subDTypep->widthMin(), condp->widthMin());
|
||||
bool issigned = subDTypep->isSigned() && condp->isSigned();
|
||||
subDTypep
|
||||
= nodep->findLogicDType(width, mwidth, AstNumeric::fromBool(issigned));
|
||||
= nodep->findLogicDType(width, mwidth, VSigning::fromBool(issigned));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3245,13 +3245,13 @@ private:
|
|||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
// We only support string types, not packed array
|
||||
iterateCheckString(nodep, "$ferror string result", nodep->strp(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
}
|
||||
virtual void visit(AstFEof* nodep) VL_OVERRIDE {
|
||||
if (m_vup->prelim()) {
|
||||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
}
|
||||
virtual void visit(AstFFlush* nodep) VL_OVERRIDE {
|
||||
|
|
@ -3260,22 +3260,22 @@ private:
|
|||
}
|
||||
virtual void visit(AstFRewind* nodep) VL_OVERRIDE {
|
||||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
virtual void visit(AstFTell* nodep) VL_OVERRIDE {
|
||||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
virtual void visit(AstFSeek* nodep) VL_OVERRIDE {
|
||||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
iterateCheckSigned32(nodep, "$fseek offset", nodep->offset(), BOTH);
|
||||
iterateCheckSigned32(nodep, "$fseek operation", nodep->operation(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 1, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
virtual void visit(AstFGetC* nodep) VL_OVERRIDE {
|
||||
if (m_vup->prelim()) {
|
||||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 8, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 8, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
}
|
||||
virtual void visit(AstFGetS* nodep) VL_OVERRIDE {
|
||||
|
|
@ -3289,7 +3289,7 @@ private:
|
|||
if (m_vup->prelim()) {
|
||||
iterateCheckFileDesc(nodep, nodep->filep(), BOTH);
|
||||
iterateCheckSigned32(nodep, "$fungetc character", nodep->charp(), BOTH);
|
||||
nodep->dtypeSetLogicUnsized(32, 8, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeSetLogicUnsized(32, 8, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
}
|
||||
virtual void visit(AstFRead* nodep) VL_OVERRIDE {
|
||||
|
|
@ -3370,7 +3370,7 @@ private:
|
|||
if (m_vup->prelim()) {
|
||||
userIterateAndNext(nodep->searchp(), WidthVP(SELF, BOTH).p());
|
||||
userIterateAndNext(nodep->outp(), WidthVP(SELF, BOTH).p());
|
||||
nodep->dtypeChgWidthSigned(32, 1, AstNumeric::SIGNED); // Spec says integer return
|
||||
nodep->dtypeChgWidthSigned(32, 1, VSigning::SIGNED); // Spec says integer return
|
||||
}
|
||||
}
|
||||
virtual void visit(AstTimeFormat* nodep) VL_OVERRIDE {
|
||||
|
|
@ -3775,7 +3775,7 @@ private:
|
|||
// LHS presumed self-determined, then coerced to real
|
||||
if (m_vup->prelim()) { // First stage evaluation
|
||||
nodep->dtypeSetDouble();
|
||||
AstNodeDType* subDTypep = nodep->findLogicDType(64, 64, AstNumeric::UNSIGNED);
|
||||
AstNodeDType* subDTypep = nodep->findLogicDType(64, 64, VSigning::UNSIGNED);
|
||||
// Self-determined operand
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF, PRELIM).p());
|
||||
iterateCheck(nodep, "LHS", nodep->lhsp(), SELF, FINAL, subDTypep, EXTEND_EXP);
|
||||
|
|
@ -3787,7 +3787,7 @@ private:
|
|||
// LHS presumed self-determined, then coerced to real
|
||||
if (m_vup->prelim()) { // First stage evaluation
|
||||
nodep->dtypeSetDouble();
|
||||
AstNodeDType* subDTypep = nodep->findLogicDType(32, 32, AstNumeric::SIGNED);
|
||||
AstNodeDType* subDTypep = nodep->findLogicDType(32, 32, VSigning::SIGNED);
|
||||
// Self-determined operand
|
||||
userIterateAndNext(nodep->lhsp(), WidthVP(SELF, PRELIM).p());
|
||||
iterateCheck(nodep, "LHS", nodep->lhsp(), SELF, FINAL, subDTypep, EXTEND_EXP);
|
||||
|
|
@ -3906,7 +3906,7 @@ private:
|
|||
int width = std::max(nodep->lhsp()->width(), nodep->rhsp()->width());
|
||||
int ewidth = std::max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin());
|
||||
AstNodeDType* subDTypep
|
||||
= nodep->findLogicDType(width, ewidth, AstNumeric::fromBool(signedFl));
|
||||
= nodep->findLogicDType(width, ewidth, VSigning::fromBool(signedFl));
|
||||
bool warnOn = true;
|
||||
if (!signedFl && width == 32) {
|
||||
// Waive on unsigned < or <= if RHS is narrower, since can't give wrong answer
|
||||
|
|
@ -4001,7 +4001,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void visit_signed_unsigned(AstNodeUniop* nodep, AstNumeric rs_out) {
|
||||
void visit_signed_unsigned(AstNodeUniop* nodep, VSigning rs_out) {
|
||||
// CALLER: Signed, Unsigned
|
||||
// Width: lhs is self determined width
|
||||
// See IEEE-2012 6.24.1:
|
||||
|
|
@ -4096,7 +4096,7 @@ private:
|
|||
int width = std::max(nodep->lhsp()->width(), nodep->rhsp()->width());
|
||||
int mwidth = std::max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin());
|
||||
bool expSigned = (nodep->lhsp()->isSigned() && nodep->rhsp()->isSigned());
|
||||
nodep->dtypeChgWidthSigned(width, mwidth, AstNumeric::fromBool(expSigned));
|
||||
nodep->dtypeChgWidthSigned(width, mwidth, VSigning::fromBool(expSigned));
|
||||
}
|
||||
if (m_vup->final()) {
|
||||
AstNodeDType* expDTypep = m_vup->dtypeOverridep(nodep->dtypep());
|
||||
|
|
@ -4144,7 +4144,7 @@ private:
|
|||
int width = std::max(nodep->lhsp()->width(), nodep->rhsp()->width());
|
||||
int mwidth = std::max(nodep->lhsp()->widthMin(), nodep->rhsp()->widthMin());
|
||||
bool expSigned = (nodep->lhsp()->isSigned() && nodep->rhsp()->isSigned());
|
||||
nodep->dtypeChgWidthSigned(width, mwidth, AstNumeric::fromBool(expSigned));
|
||||
nodep->dtypeChgWidthSigned(width, mwidth, VSigning::fromBool(expSigned));
|
||||
}
|
||||
}
|
||||
if (m_vup->final()) {
|
||||
|
|
@ -4304,7 +4304,7 @@ private:
|
|||
linker.relink(newp);
|
||||
nodep = newp;
|
||||
}
|
||||
nodep->dtypeChgWidthSigned(expWidth, expWidth, AstNumeric::fromBool(expSigned));
|
||||
nodep->dtypeChgWidthSigned(expWidth, expWidth, VSigning::fromBool(expSigned));
|
||||
UINFO(4, " _new: " << nodep << endl);
|
||||
}
|
||||
|
||||
|
|
@ -4529,7 +4529,7 @@ private:
|
|||
subDTypep = nodep->findLogicDType(
|
||||
std::max(subDTypep->width(), underp->width()),
|
||||
std::max(subDTypep->widthMin(), underp->widthMin()),
|
||||
AstNumeric::fromBool(underp->isSigned()));
|
||||
VSigning::fromBool(underp->isSigned()));
|
||||
UINFO(9, "Assignment of opposite-signed RHS to LHS: " << nodep << endl);
|
||||
}
|
||||
underp = userIterateSubtreeReturnEdits(underp, WidthVP(subDTypep, FINAL).p());
|
||||
|
|
@ -4674,7 +4674,7 @@ private:
|
|||
if (warnOn) nodep->v3warn(REALCVT, "Implicit conversion of real to integer");
|
||||
AstNode* newp = new AstRToIRoundS(nodep->fileline(), nodep);
|
||||
linker.relink(newp);
|
||||
newp->dtypeSetBitSized(width, AstNumeric::SIGNED);
|
||||
newp->dtypeSetBitSized(width, VSigning::SIGNED);
|
||||
return newp;
|
||||
} else {
|
||||
return nodep;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ private:
|
|||
if (nodep->user1SetOnce()) return; // Process once
|
||||
nodep->widthMinFromWidth();
|
||||
// Too late to any unspecified sign to be anything but unsigned
|
||||
if (nodep->numeric().isNosign()) nodep->numeric(AstNumeric::UNSIGNED);
|
||||
if (nodep->numeric().isNosign()) nodep->numeric(VSigning::UNSIGNED);
|
||||
iterateChildren(nodep);
|
||||
nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep()));
|
||||
nodep->virtRefDType2p(editOneDType(nodep->virtRefDType2p()));
|
||||
|
|
|
|||
|
|
@ -1549,13 +1549,13 @@ non_integer_type<bdtypep>: // ==IEEE: non_integer_type
|
|||
;
|
||||
|
||||
signingE<signstate>: // IEEE: signing - plus empty
|
||||
/*empty*/ { $$ = signedst_NOSIGN; }
|
||||
/*empty*/ { $$ = VSigning::NOSIGN; }
|
||||
| signing { $$ = $1; }
|
||||
;
|
||||
|
||||
signing<signstate>: // ==IEEE: signing
|
||||
ySIGNED { $<fl>$ = $<fl>1; $$ = signedst_SIGNED; }
|
||||
| yUNSIGNED { $<fl>$ = $<fl>1; $$ = signedst_UNSIGNED; }
|
||||
ySIGNED { $<fl>$ = $<fl>1; $$ = VSigning::SIGNED; }
|
||||
| yUNSIGNED { $<fl>$ = $<fl>1; $$ = VSigning::UNSIGNED; }
|
||||
;
|
||||
|
||||
//************************************************
|
||||
|
|
@ -1784,9 +1784,9 @@ taggedE:
|
|||
;
|
||||
|
||||
packedSigningE<signstate>:
|
||||
// // AstNumeric::NOSIGN overloaded to indicate not packed
|
||||
/*empty*/ { $$ = signedst_NOSIGN; }
|
||||
| yPACKED signingE { $$ = $2; if ($$ == signedst_NOSIGN) $$ = signedst_UNSIGNED; }
|
||||
// // VSigning::NOSIGN overloaded to indicate not packed
|
||||
/*empty*/ { $$ = VSigning::NOSIGN; }
|
||||
| yPACKED signingE { $$ = $2; if ($$ == VSigning::NOSIGN) $$ = VSigning::UNSIGNED; }
|
||||
;
|
||||
|
||||
//************************************************
|
||||
|
|
|
|||
Loading…
Reference in New Issue