Internals: Change order of V3Number constructor args to follow V3Const. No functional change intended.
This commit is contained in:
parent
8efc9d6219
commit
caca1fcef0
|
|
@ -972,13 +972,13 @@ public:
|
|||
class StringToParse {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, StringToParse, const char* sourcep)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num{this, sourcep} {
|
||||
, m_num{this, V3Number::VerilogNumberLiteral{}, sourcep} {
|
||||
initWithNumber();
|
||||
}
|
||||
class VerilogStringLiteral {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, VerilogStringLiteral, const string& str)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num{V3Number::VerilogStringLiteral{}, this, str} {
|
||||
, m_num{this, V3Number::VerilogStringLiteral{}, str} {
|
||||
initWithNumber();
|
||||
}
|
||||
AstConst(FileLine* fl, uint32_t num)
|
||||
|
|
@ -1024,7 +1024,7 @@ public:
|
|||
class String {}; // for creator type-overload selection
|
||||
AstConst(FileLine* fl, String, const string& num)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num{V3Number::String{}, this, num} {
|
||||
, m_num{this, V3Number::String{}, num} {
|
||||
dtypeSetString();
|
||||
}
|
||||
class BitFalse {};
|
||||
|
|
@ -1043,28 +1043,28 @@ public:
|
|||
class All0 {};
|
||||
AstConst(FileLine* fl, All0)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num(this, "'0") { // Need () constructor
|
||||
, m_num{this, V3Number::VerilogNumberLiteral{}, "'0"} {
|
||||
initWithNumber();
|
||||
fl->warnOff(V3ErrorCode::NEWERSTD, true);
|
||||
}
|
||||
class All1 {};
|
||||
AstConst(FileLine* fl, All1)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num(this, "'1") { // Need () constructor
|
||||
, m_num{this, V3Number::VerilogNumberLiteral{}, "'1"} {
|
||||
initWithNumber();
|
||||
fl->warnOff(V3ErrorCode::NEWERSTD, true);
|
||||
}
|
||||
class Null {};
|
||||
AstConst(FileLine* fl, Null)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num{V3Number::Null{}, this} {
|
||||
, m_num{this, V3Number::Null{}} {
|
||||
dtypeSetBit(); // Events 1 bit, objects 64 bits, so autoExtend=1 and use bit here
|
||||
initWithNumber();
|
||||
}
|
||||
class OneStep {};
|
||||
AstConst(FileLine* fl, OneStep)
|
||||
: ASTGEN_SUPER_Const(fl)
|
||||
, m_num{V3Number::OneStep{}, this} {
|
||||
, m_num{this, V3Number::OneStep{}} {
|
||||
dtypeSetLogicSized(64, VSigning::UNSIGNED);
|
||||
initWithNumber();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,6 +596,7 @@ void EmitCFunc::emitConstant(AstConst* nodep, AstVarRef* assigntop, const string
|
|||
}
|
||||
|
||||
void EmitCFunc::emitConstantString(const AstConst* nodep) {
|
||||
// Const might be a Verilog array-type string, but need to always output std::string
|
||||
putnbs(nodep, "std::string{");
|
||||
const string str = nodep->num().toString();
|
||||
if (!str.empty()) putsQuoted(str);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ void V3Number::v3errorEndFatal(const std::ostringstream& str) const
|
|||
// Read class functions
|
||||
// CREATION
|
||||
|
||||
V3Number::V3Number(VerilogStringLiteral, AstNode* nodep, const string& str) {
|
||||
V3Number::V3Number(AstNode* nodep, VerilogStringLiteral, const string& str) {
|
||||
// Create a number using a verilog string as the value, thus 8 bits per character.
|
||||
if (str.empty()) { // IEEE 1800-2023 11.10.3 "" = "\000"
|
||||
init(nodep, 8);
|
||||
|
|
|
|||
|
|
@ -488,28 +488,29 @@ public:
|
|||
opCleanThis();
|
||||
}
|
||||
// Create from a verilog 32'hxxxx number.
|
||||
V3Number(AstNode* nodep, const char* sourcep) { create(nodep, sourcep); }
|
||||
V3Number(FileLine* flp, const char* sourcep) { create(flp, sourcep); }
|
||||
class VerilogNumberLiteral {}; // For creator type-overload selection
|
||||
V3Number(AstNode* nodep, VerilogNumberLiteral, const char* sourcep) { create(nodep, sourcep); }
|
||||
V3Number(FileLine* flp, VerilogNumberLiteral, const char* sourcep) { create(flp, sourcep); }
|
||||
class VerilogStringLiteral {}; // For creator type-overload selection
|
||||
V3Number(VerilogStringLiteral, AstNode* nodep, const string& str);
|
||||
V3Number(AstNode* nodep, VerilogStringLiteral, const string& str);
|
||||
class Double {};
|
||||
V3Number(Double, AstNode* nodep, double value) {
|
||||
V3Number(AstNode* nodep, Double, double value) {
|
||||
init(nodep, 64);
|
||||
setDouble(value);
|
||||
}
|
||||
class String {};
|
||||
V3Number(String, AstNode* nodep, const string& value) {
|
||||
V3Number(AstNode* nodep, String, const string& value) {
|
||||
init(nodep);
|
||||
setString(value);
|
||||
m_data.m_fromString = true;
|
||||
}
|
||||
class OneStep {};
|
||||
V3Number(OneStep, AstNode* nodep) {
|
||||
V3Number(AstNode* nodep, OneStep) {
|
||||
init(nodep, 64);
|
||||
m_data.m_is1Step = true;
|
||||
}
|
||||
class Null {};
|
||||
V3Number(Null, AstNode* nodep) {
|
||||
V3Number(AstNode* nodep, Null) {
|
||||
init(nodep);
|
||||
m_data.setLogic();
|
||||
m_data.m_isNull = true;
|
||||
|
|
@ -525,10 +526,6 @@ public:
|
|||
opCleanThis();
|
||||
m_fileline = nump->fileline();
|
||||
}
|
||||
V3Number(AstNode* nodep, double value) {
|
||||
init(nodep, 64);
|
||||
setDouble(value);
|
||||
}
|
||||
V3Number(AstNode* nodep, const AstNodeDType* nodedtypep);
|
||||
|
||||
V3Number(const V3Number& other) = default;
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ public:
|
|||
if (pinValuep->isDouble()) {
|
||||
var = pinValuep->num().toDouble();
|
||||
} else { // Cast from integer to real
|
||||
V3Number varNum{pinValuep, 0.0};
|
||||
V3Number varNum{pinValuep, V3Number::Double{}, 0.0};
|
||||
varNum.opIToRD(pinValuep->num());
|
||||
var = varNum.toDouble();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ public:
|
|||
return strp;
|
||||
}
|
||||
V3Number* newNumber(FileLine* flp, const char* text) {
|
||||
V3Number* nump = new V3Number{flp, text};
|
||||
V3Number* nump = new V3Number{flp, V3Number::VerilogNumberLiteral{}, text};
|
||||
m_numberps.push_back(nump);
|
||||
return nump;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -540,9 +540,9 @@ class UnknownVisitor final : public VNVisitor {
|
|||
// TODO make a tieoff function that takes AstNode and returns typed value
|
||||
V3Number xnum{nodep, nodep->width()};
|
||||
if (nodeDtp->isDouble()) {
|
||||
xnum = V3Number{V3Number::Double{}, nodep, 0.0};
|
||||
xnum = V3Number{nodep, V3Number::Double{}, 0.0};
|
||||
} else if (nodeDtp->isString()) {
|
||||
xnum = V3Number{V3Number::String{}, nodep, ""};
|
||||
xnum = V3Number{nodep, V3Number::String{}, ""};
|
||||
} else {
|
||||
xnum.setAllBitsX();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue