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