Internals: Rename Ast on non-node classes (#3262). No functional change.

This commit has the following replacements applied:

	s/\bAstUserInUseBase\b/VNUserInUseBase/g;
        s/\bAstAttrType\b/VAttrType/g;
        s/\bAstBasicDTypeKwd\b/VBasicDTypeKwd/g;
        s/\bAstDisplayType\b/VDisplayType/g;
        s/\bAstNDeleter\b/VNDeleter/g;
        s/\bAstNRelinker\b/VNRelinker/g;
        s/\bAstNVisitor\b/VNVisitor/g;
        s/\bAstPragmaType\b/VPragmaType/g;
        s/\bAstType\b/VNType/g;
        s/\bAstUser1InUse\b/VNUser1InUse/g;
        s/\bAstUser2InUse\b/VNUser2InUse/g;
        s/\bAstUser3InUse\b/VNUser3InUse/g;
        s/\bAstUser4InUse\b/VNUser4InUse/g;
        s/\bAstUser5InUse\b/VNUser5InUse/g;
        s/\bAstVarType\b/VVarType/g;
This commit is contained in:
Wilson Snyder 2022-01-02 13:56:40 -05:00
parent 73374a0303
commit e6857df5c6
96 changed files with 1015 additions and 1030 deletions

View File

@ -114,11 +114,11 @@ By convention, each function/method uses the variable ``nodep`` as a
pointer to the ``AstNode`` currently being processed.
``AstNVisitor``
``VNVisitor``
^^^^^^^^^^^^^^^
The passes are implemented by AST visitor classes. These are implemented by
subclasses of the abstract class, ``AstNVisitor``. Each pass creates an
subclasses of the abstract class, ``VNVisitor``. Each pass creates an
instance of the visitor class, which in turn implements a method to perform
the pass.
@ -523,10 +523,10 @@ optimization passes. This allows separation of the pass algorithm from the
AST on which it operates. Wikipedia provides an introduction to the concept
at https://en.wikipedia.org/wiki/Visitor_pattern.
As noted above, all visitors are derived classes of ``AstNVisitor``. All
As noted above, all visitors are derived classes of ``VNVisitor``. All
derived classes of ``AstNode`` implement the ``accept`` method, which takes
as argument a reference to an instance or a ``AstNVisitor`` derived class
and applies the visit method of the ``AstNVisitor`` to the invoking AstNode
as argument a reference to an instance or a ``VNVisitor`` derived class
and applies the visit method of the ``VNVisitor`` to the invoking AstNode
instance (i.e. ``this``).
One possible difficulty is that a call to ``accept`` may perform an edit
@ -604,8 +604,8 @@ There are three ways data is passed between visitor functions.
Iterators
---------
``AstNVisitor`` provides a set of iterators to facilitate walking over
the tree. Each operates on the current ``AstNVisitor`` class (as this)
``VNVisitor`` provides a set of iterators to facilitate walking over
the tree. Each operates on the current ``VNVisitor`` class (as this)
and takes an argument type ``AstNode*``.
``iterate``

View File

@ -199,7 +199,7 @@ public:
//######################################################################
// Collect existing active names
class ActiveBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class ActiveBaseVisitor VL_NOT_FINAL : public VNVisitor {
protected:
VL_DEBUG_FUNC; // Declare debug()
};
@ -299,7 +299,7 @@ private:
// NODE STATE
// Input:
// AstVar::user1p // V2LatchGraphVertex* The vertex handling this node
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
LatchDetectGraph m_graph; // Graph used to detect latches in combo always
// VISITORS

View File

@ -35,14 +35,14 @@
//######################################################################
// Active class functions
class ActiveTopVisitor final : public AstNVisitor {
class ActiveTopVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist
// AstNode::user() bool. True if processed
// Each call to V3Const::constify
// AstNode::user4() Used by V3Const::constify, called below
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
SenTreeFinder m_finder; // Find global sentree's / add them under the AstTopScope

View File

@ -25,12 +25,12 @@
//######################################################################
// Assert class functions
class AssertVisitor final : public AstNVisitor {
class AssertVisitor final : public VNVisitor {
private:
// NODE STATE/TYPES
// Cleared on netlist
// AstNode::user() -> bool. True if processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
AstNodeModule* m_modp = nullptr; // Last module
@ -52,7 +52,7 @@ private:
+ ((message != "") ? ": " : "") + message + "\n");
}
void replaceDisplay(AstDisplay* nodep, const string& prefix) {
nodep->displayType(AstDisplayType::DT_WRITE);
nodep->displayType(VDisplayType::DT_WRITE);
nodep->fmtp()->text(assertDisplayMessage(nodep, prefix, nodep->fmtp()->text()));
// cppcheck-suppress nullPointer
AstNode* const timenewp = new AstTime(nodep->fileline(), m_modp->timeunit());
@ -67,8 +67,8 @@ private:
}
AstVarRef* newMonitorNumVarRefp(AstNode* nodep, VAccess access) {
if (!m_monitorNumVarp) {
m_monitorNumVarp = new AstVar{nodep->fileline(), AstVarType::MODULETEMP,
"__VmonitorNum", nodep->findUInt64DType()};
m_monitorNumVarp = new AstVar{nodep->fileline(), VVarType::MODULETEMP, "__VmonitorNum",
nodep->findUInt64DType()};
v3Global.rootp()->dollarUnitPkgAddp()->addStmtp(m_monitorNumVarp);
}
const auto varrefp = new AstVarRef(nodep->fileline(), m_monitorNumVarp, access);
@ -77,8 +77,8 @@ private:
}
AstVarRef* newMonitorOffVarRefp(AstNode* nodep, VAccess access) {
if (!m_monitorOffVarp) {
m_monitorOffVarp = new AstVar{nodep->fileline(), AstVarType::MODULETEMP,
"__VmonitorOff", nodep->findBitDType()};
m_monitorOffVarp = new AstVar{nodep->fileline(), VVarType::MODULETEMP, "__VmonitorOff",
nodep->findBitDType()};
v3Global.rootp()->dollarUnitPkgAddp()->addStmtp(m_monitorOffVarp);
}
const auto varrefp = new AstVarRef(nodep->fileline(), m_monitorOffVarp, access);
@ -105,8 +105,8 @@ private:
AstNode* newFireAssertUnchecked(AstNode* nodep, const string& message) {
// Like newFireAssert() but omits the asserts-on check
AstDisplay* const dispp = new AstDisplay(nodep->fileline(), AstDisplayType::DT_ERROR,
message, nullptr, nullptr);
AstDisplay* const dispp
= new AstDisplay(nodep->fileline(), VDisplayType::DT_ERROR, message, nullptr, nullptr);
dispp->fmtp()->timeunit(m_modp->timeunit());
AstNode* const bodysp = dispp;
replaceDisplay(dispp, "%%Error"); // Convert to standard DISPLAY format
@ -341,7 +341,7 @@ private:
m_modp->addStmtp(alwaysp);
for (uint32_t i = 0; i < ticks; ++i) {
AstVar* const outvarp = new AstVar(
nodep->fileline(), AstVarType::MODULETEMP,
nodep->fileline(), VVarType::MODULETEMP,
"_Vpast_" + cvtToStr(m_modPastNum++) + "_" + cvtToStr(i), inp->dtypep());
m_modp->addStmtp(outvarp);
AstNode* const assp = new AstAssignDly(
@ -362,15 +362,15 @@ private:
virtual void visit(AstDisplay* nodep) override {
iterateChildren(nodep);
// Replace the special types with standard text
if (nodep->displayType() == AstDisplayType::DT_INFO) {
if (nodep->displayType() == VDisplayType::DT_INFO) {
replaceDisplay(nodep, "-Info");
} else if (nodep->displayType() == AstDisplayType::DT_WARNING) {
} else if (nodep->displayType() == VDisplayType::DT_WARNING) {
replaceDisplay(nodep, "%%Warning");
} else if (nodep->displayType() == AstDisplayType::DT_ERROR
|| nodep->displayType() == AstDisplayType::DT_FATAL) {
} else if (nodep->displayType() == VDisplayType::DT_ERROR
|| nodep->displayType() == VDisplayType::DT_FATAL) {
replaceDisplay(nodep, "%%Error");
} else if (nodep->displayType() == AstDisplayType::DT_MONITOR) {
nodep->displayType(AstDisplayType::DT_DISPLAY);
} else if (nodep->displayType() == VDisplayType::DT_MONITOR) {
nodep->displayType(VDisplayType::DT_DISPLAY);
const auto fl = nodep->fileline();
const auto monNum = ++m_monitorNum;
// Where $monitor was we do "__VmonitorNum = N;"
@ -388,12 +388,12 @@ private:
ifp->branchPred(VBranchPred::BP_UNLIKELY);
AstNode* const newp = new AstAlwaysPostponed{fl, ifp};
m_modp->addStmtp(newp);
} else if (nodep->displayType() == AstDisplayType::DT_STROBE) {
nodep->displayType(AstDisplayType::DT_DISPLAY);
} else if (nodep->displayType() == VDisplayType::DT_STROBE) {
nodep->displayType(VDisplayType::DT_DISPLAY);
// Need one-shot
const auto fl = nodep->fileline();
const auto varp
= new AstVar{fl, AstVarType::MODULETEMP, "__Vstrobe" + cvtToStr(m_modStrobeNum++),
= new AstVar{fl, VVarType::MODULETEMP, "__Vstrobe" + cvtToStr(m_modStrobeNum++),
nodep->findBitDType()};
m_modp->addStmtp(varp);
// Where $strobe was we do "__Vstrobe = '1;"

View File

@ -26,7 +26,7 @@
//######################################################################
// Assert class functions
class AssertPreVisitor final : public AstNVisitor {
class AssertPreVisitor final : public VNVisitor {
// Removes clocks and other pre-optimizations
// Eventually inlines calls to sequences, properties, etc.
// We're not parsing the tree, or anything more complicated.

View File

@ -36,29 +36,29 @@ vluint64_t AstNode::s_editCntGbl = 0; // Hot cache line
// along with each userp, and thus by bumping this count we can make it look
// as if we iterated across the entire tree to set all the userp's to null.
int AstNode::s_cloneCntGbl = 0;
uint32_t AstUser1InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t AstUser2InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t AstUser3InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t AstUser4InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t AstUser5InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t VNUser1InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t VNUser2InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t VNUser3InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t VNUser4InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
uint32_t VNUser5InUse::s_userCntGbl = 0; // Hot cache line, leave adjacent
bool AstUser1InUse::s_userBusy = false;
bool AstUser2InUse::s_userBusy = false;
bool AstUser3InUse::s_userBusy = false;
bool AstUser4InUse::s_userBusy = false;
bool AstUser5InUse::s_userBusy = false;
bool VNUser1InUse::s_userBusy = false;
bool VNUser2InUse::s_userBusy = false;
bool VNUser3InUse::s_userBusy = false;
bool VNUser4InUse::s_userBusy = false;
bool VNUser5InUse::s_userBusy = false;
int AstNodeDType::s_uniqueNum = 0;
//######################################################################
// V3AstType
std::ostream& operator<<(std::ostream& os, AstType rhs);
std::ostream& operator<<(std::ostream& os, VNType rhs);
//######################################################################
// Creators
AstNode::AstNode(AstType t, FileLine* fl)
AstNode::AstNode(VNType t, FileLine* fl)
: m_type{t}
, m_fileline{fl} {
m_headtailp = this; // When made, we're a list of only a single element
@ -796,7 +796,7 @@ void AstNode::operator delete(void* objp, size_t size) {
//======================================================================
// Iterators
void AstNode::iterateChildren(AstNVisitor& v) {
void AstNode::iterateChildren(VNVisitor& v) {
// This is a very hot function
// Optimization note: Grabbing m_op#p->m_nextp is a net loss
ASTNODE_PREFETCH(m_op1p);
@ -809,7 +809,7 @@ void AstNode::iterateChildren(AstNVisitor& v) {
if (m_op4p) m_op4p->iterateAndNext(v);
}
void AstNode::iterateChildrenConst(AstNVisitor& v) {
void AstNode::iterateChildrenConst(VNVisitor& v) {
// This is a very hot function
ASTNODE_PREFETCH(m_op1p);
ASTNODE_PREFETCH(m_op2p);
@ -821,7 +821,7 @@ void AstNode::iterateChildrenConst(AstNVisitor& v) {
if (m_op4p) m_op4p->iterateAndNextConst(v);
}
void AstNode::iterateAndNext(AstNVisitor& v) {
void AstNode::iterateAndNext(VNVisitor& v) {
// This is a very hot function
// IMPORTANT: If you replace a node that's the target of this iterator,
// then the NEW node will be iterated on next, it isn't skipped!
@ -855,7 +855,7 @@ void AstNode::iterateAndNext(AstNVisitor& v) {
}
}
void AstNode::iterateListBackwards(AstNVisitor& v) {
void AstNode::iterateListBackwards(VNVisitor& v) {
AstNode* nodep = this;
while (nodep->m_nextp) nodep = nodep->m_nextp;
while (nodep) {
@ -869,14 +869,14 @@ void AstNode::iterateListBackwards(AstNVisitor& v) {
}
}
void AstNode::iterateChildrenBackwards(AstNVisitor& v) {
void AstNode::iterateChildrenBackwards(VNVisitor& v) {
if (m_op1p) m_op1p->iterateListBackwards(v);
if (m_op2p) m_op2p->iterateListBackwards(v);
if (m_op3p) m_op3p->iterateListBackwards(v);
if (m_op4p) m_op4p->iterateListBackwards(v);
}
void AstNode::iterateAndNextConst(AstNVisitor& v) {
void AstNode::iterateAndNextConst(VNVisitor& v) {
// Keep following the current list even if edits change it
AstNode* nodep = this;
do {
@ -887,7 +887,7 @@ void AstNode::iterateAndNextConst(AstNVisitor& v) {
} while (nodep);
}
AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) {
AstNode* AstNode::iterateSubtreeReturnEdits(VNVisitor& v) {
// Some visitors perform tree edits (such as V3Const), and may even
// replace/delete the exact nodep that the visitor is called with. If
// this happens, the parent will lose the handle to the node that was
@ -1242,27 +1242,27 @@ void AstNode::dtypeChgWidthSigned(int width, int widthMin, VSigning numeric) {
}
}
AstNodeDType* AstNode::findBasicDType(AstBasicDTypeKwd kwd) const {
AstNodeDType* AstNode::findBasicDType(VBasicDTypeKwd kwd) const {
// For 'simple' types we use the global directory. These are all unsized.
// More advanced types land under the module/task/etc
return v3Global.rootp()->typeTablep()->findBasicDType(fileline(), kwd);
}
AstNodeDType* AstNode::findBitDType(int width, int widthMin, VSigning numeric) const {
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::BIT,
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), VBasicDTypeKwd::BIT,
width, widthMin, numeric);
}
AstNodeDType* AstNode::findLogicDType(int width, int widthMin, VSigning numeric) const {
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC,
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), VBasicDTypeKwd::LOGIC,
width, widthMin, numeric);
}
AstNodeDType* AstNode::findLogicRangeDType(const VNumRange& range, int widthMin,
VSigning numeric) const {
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::LOGIC,
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), VBasicDTypeKwd::LOGIC,
range, widthMin, numeric);
}
AstNodeDType* AstNode::findBitRangeDType(const VNumRange& range, int widthMin,
VSigning numeric) const {
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), AstBasicDTypeKwd::BIT,
return v3Global.rootp()->typeTablep()->findLogicBitDType(fileline(), VBasicDTypeKwd::BIT,
range, widthMin, numeric);
}
AstBasicDType* AstNode::findInsertSameDType(AstBasicDType* nodep) {

View File

@ -82,7 +82,7 @@ using MTaskIdSet = std::set<int>; // Set of mtaskIds for Var sorting
//######################################################################
class AstType final {
class VNType final {
public:
#include "V3Ast__gen_types.h" // From ./astgen
// Above include has:
@ -90,18 +90,18 @@ public:
// const char* ascii() const {...};
enum en m_e;
// cppcheck-suppress uninitVar // responsibility of each subclass
inline AstType() {}
inline VNType() {}
// cppcheck-suppress noExplicitConstructor
inline AstType(en _e)
inline VNType(en _e)
: m_e{_e} {}
explicit inline AstType(int _e)
explicit inline VNType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; }
};
inline bool operator==(const AstType& lhs, const AstType& rhs) { return lhs.m_e == rhs.m_e; }
inline bool operator==(const AstType& lhs, AstType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(AstType::en lhs, const AstType& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const AstType& rhs) { return os << rhs.ascii(); }
inline bool operator==(const VNType& lhs, const VNType& rhs) { return lhs.m_e == rhs.m_e; }
inline bool operator==(const VNType& lhs, VNType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(VNType::en lhs, const VNType& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const VNType& rhs) { return os << rhs.ascii(); }
//######################################################################
@ -215,7 +215,7 @@ inline std::ostream& operator<<(std::ostream& os, const VSigning& rhs) {
//######################################################################
class AstPragmaType final {
class VPragmaType final {
public:
enum en : uint8_t {
ILLEGAL,
@ -231,20 +231,20 @@ public:
ENUM_SIZE
};
enum en m_e;
inline AstPragmaType()
inline VPragmaType()
: m_e{ILLEGAL} {}
// cppcheck-suppress noExplicitConstructor
inline AstPragmaType(en _e)
inline VPragmaType(en _e)
: m_e{_e} {}
explicit inline AstPragmaType(int _e)
explicit inline VPragmaType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; }
};
inline bool operator==(const AstPragmaType& lhs, const AstPragmaType& rhs) {
inline bool operator==(const VPragmaType& lhs, const VPragmaType& rhs) {
return lhs.m_e == rhs.m_e;
}
inline bool operator==(const AstPragmaType& lhs, AstPragmaType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(AstPragmaType::en lhs, const AstPragmaType& rhs) { return lhs == rhs.m_e; }
inline bool operator==(const VPragmaType& lhs, VPragmaType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(VPragmaType::en lhs, const VPragmaType& rhs) { return lhs == rhs.m_e; }
//######################################################################
@ -334,7 +334,7 @@ inline bool operator==(VEdgeType::en lhs, const VEdgeType& rhs) { return lhs ==
//######################################################################
class AstAttrType final {
class VAttrType final {
public:
// clang-format off
enum en: uint8_t {
@ -399,24 +399,22 @@ public:
// clang-format on
return names[m_e];
}
inline AstAttrType()
inline VAttrType()
: m_e{ILLEGAL} {}
// cppcheck-suppress noExplicitConstructor
inline AstAttrType(en _e)
inline VAttrType(en _e)
: m_e{_e} {}
explicit inline AstAttrType(int _e)
explicit inline VAttrType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; }
};
inline bool operator==(const AstAttrType& lhs, const AstAttrType& rhs) {
return lhs.m_e == rhs.m_e;
}
inline bool operator==(const AstAttrType& lhs, AstAttrType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(AstAttrType::en lhs, const AstAttrType& rhs) { return lhs == rhs.m_e; }
inline bool operator==(const VAttrType& lhs, const VAttrType& rhs) { return lhs.m_e == rhs.m_e; }
inline bool operator==(const VAttrType& lhs, VAttrType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(VAttrType::en lhs, const VAttrType& rhs) { return lhs == rhs.m_e; }
//######################################################################
class AstBasicDTypeKwd final {
class VBasicDTypeKwd final {
public:
enum en : uint8_t {
UNKNOWN,
@ -463,17 +461,16 @@ public:
return names[m_e];
}
static void selfTest() {
UASSERT(0 == strcmp(AstBasicDTypeKwd(_ENUM_MAX).ascii(), " MAX"),
"SelfTest: Enum mismatch");
UASSERT(0 == strcmp(AstBasicDTypeKwd(_ENUM_MAX).dpiType(), " MAX"),
UASSERT(0 == strcmp(VBasicDTypeKwd(_ENUM_MAX).ascii(), " MAX"), "SelfTest: Enum mismatch");
UASSERT(0 == strcmp(VBasicDTypeKwd(_ENUM_MAX).dpiType(), " MAX"),
"SelfTest: Enum mismatch");
}
inline AstBasicDTypeKwd()
inline VBasicDTypeKwd()
: m_e{UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline AstBasicDTypeKwd(en _e)
inline VBasicDTypeKwd(en _e)
: m_e{_e} {}
explicit inline AstBasicDTypeKwd(int _e)
explicit inline VBasicDTypeKwd(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; }
int width() const {
@ -556,13 +553,13 @@ public:
}
}
};
inline bool operator==(const AstBasicDTypeKwd& lhs, const AstBasicDTypeKwd& rhs) {
inline bool operator==(const VBasicDTypeKwd& lhs, const VBasicDTypeKwd& rhs) {
return lhs.m_e == rhs.m_e;
}
inline bool operator==(const AstBasicDTypeKwd& lhs, AstBasicDTypeKwd::en rhs) {
inline bool operator==(const VBasicDTypeKwd& lhs, VBasicDTypeKwd::en rhs) {
return lhs.m_e == rhs;
}
inline bool operator==(AstBasicDTypeKwd::en lhs, const AstBasicDTypeKwd& rhs) {
inline bool operator==(VBasicDTypeKwd::en lhs, const VBasicDTypeKwd& rhs) {
return lhs == rhs.m_e;
}
@ -685,7 +682,7 @@ inline std::ostream& operator<<(std::ostream& os, const VJoinType& rhs) {
//######################################################################
class AstVarType final {
class VVarType final {
public:
enum en : uint8_t {
UNKNOWN,
@ -710,12 +707,12 @@ public:
MEMBER
};
enum en m_e;
inline AstVarType()
inline VVarType()
: m_e{UNKNOWN} {}
// cppcheck-suppress noExplicitConstructor
inline AstVarType(en _e)
inline VVarType(en _e)
: m_e{_e} {}
explicit inline AstVarType(int _e)
explicit inline VVarType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; }
const char* ascii() const {
@ -744,10 +741,10 @@ public:
return (m_e == BLOCKTEMP || m_e == MODULETEMP || m_e == STMTTEMP || m_e == XTEMP);
}
};
inline bool operator==(const AstVarType& lhs, const AstVarType& rhs) { return lhs.m_e == rhs.m_e; }
inline bool operator==(const AstVarType& lhs, AstVarType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(AstVarType::en lhs, const AstVarType& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const AstVarType& rhs) {
inline bool operator==(const VVarType& lhs, const VVarType& rhs) { return lhs.m_e == rhs.m_e; }
inline bool operator==(const VVarType& lhs, VVarType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(VVarType::en lhs, const VVarType& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const VVarType& rhs) {
return os << rhs.ascii();
}
@ -879,7 +876,7 @@ inline bool operator==(VCaseType::en lhs, const VCaseType& rhs) { return lhs ==
//######################################################################
class AstDisplayType final {
class VDisplayType final {
public:
enum en : uint8_t {
DT_DISPLAY,
@ -892,12 +889,12 @@ public:
DT_FATAL
};
enum en m_e;
AstDisplayType()
VDisplayType()
: m_e{DT_DISPLAY} {}
// cppcheck-suppress noExplicitConstructor
AstDisplayType(en _e)
VDisplayType(en _e)
: m_e{_e} {}
explicit inline AstDisplayType(int _e)
explicit inline VDisplayType(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
operator en() const { return m_e; }
bool addNewline() const { return m_e != DT_WRITE; }
@ -908,15 +905,11 @@ public:
return names[m_e];
}
};
inline bool operator==(const AstDisplayType& lhs, const AstDisplayType& rhs) {
inline bool operator==(const VDisplayType& lhs, const VDisplayType& rhs) {
return lhs.m_e == rhs.m_e;
}
inline bool operator==(const AstDisplayType& lhs, AstDisplayType::en rhs) {
return lhs.m_e == rhs;
}
inline bool operator==(AstDisplayType::en lhs, const AstDisplayType& rhs) {
return lhs == rhs.m_e;
}
inline bool operator==(const VDisplayType& lhs, VDisplayType::en rhs) { return lhs.m_e == rhs; }
inline bool operator==(VDisplayType::en lhs, const VDisplayType& rhs) { return lhs == rhs.m_e; }
//######################################################################
@ -1080,7 +1073,7 @@ public:
const int m_width; // From AstNodeDType: Bit width of operation
const int m_widthMin; // From AstNodeDType: If unsized, bitwidth of minimum implementation
const VSigning m_numeric; // From AstNodeDType: Node is signed
const AstBasicDTypeKwd m_keyword; // From AstBasicDType: What keyword created basic type
const VBasicDTypeKwd m_keyword; // From AstBasicDType: What keyword created basic type
const VNumRange m_nrange; // From AstBasicDType: Numeric msb/lsb (if non-opaque keyword)
bool operator==(const VBasicTypeKey& rhs) const {
return m_width == rhs.m_width && m_widthMin == rhs.m_widthMin && m_numeric == rhs.m_numeric
@ -1099,7 +1092,7 @@ public:
if (!(m_nrange == rhs.m_nrange)) return false; // lhs > rhs
return false;
}
VBasicTypeKey(int width, int widthMin, VSigning numeric, AstBasicDTypeKwd kwd,
VBasicTypeKey(int width, int widthMin, VSigning numeric, VBasicDTypeKwd kwd,
const VNumRange& nrange)
: m_width{width}
, m_widthMin{widthMin}
@ -1151,7 +1144,7 @@ public:
//
// Where AstNode->user2() is going to be used, for example, you write:
//
// AstUser2InUse m_userres;
// VNUser2InUse m_userres;
//
// This will clear the tree, and prevent another visitor from clobbering
// user2. When the member goes out of scope it will be automagically
@ -1188,58 +1181,58 @@ protected:
// We let AstNode peek into here, because when under low optimization even
// an accessor would be way too slow.
// clang-format off
class AstUser1InUse final : VNUserInUseBase {
class VNUser1InUse final : VNUserInUseBase {
protected:
friend class AstNode;
static uint32_t s_userCntGbl; // Count of which usage of userp() this is
static bool s_userBusy; // Count is in use
public:
AstUser1InUse() { allocate(1, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~AstUser1InUse() { free (1, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
VNUser1InUse() { allocate(1, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~VNUser1InUse() { free (1, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void clear() { clearcnt(1, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void check() { checkcnt(1, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
};
class AstUser2InUse final : VNUserInUseBase {
class VNUser2InUse final : VNUserInUseBase {
protected:
friend class AstNode;
static uint32_t s_userCntGbl; // Count of which usage of userp() this is
static bool s_userBusy; // Count is in use
public:
AstUser2InUse() { allocate(2, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~AstUser2InUse() { free (2, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
VNUser2InUse() { allocate(2, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~VNUser2InUse() { free (2, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void clear() { clearcnt(2, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void check() { checkcnt(2, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
};
class AstUser3InUse final : VNUserInUseBase {
class VNUser3InUse final : VNUserInUseBase {
protected:
friend class AstNode;
static uint32_t s_userCntGbl; // Count of which usage of userp() this is
static bool s_userBusy; // Count is in use
public:
AstUser3InUse() { allocate(3, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~AstUser3InUse() { free (3, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
VNUser3InUse() { allocate(3, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~VNUser3InUse() { free (3, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void clear() { clearcnt(3, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void check() { checkcnt(3, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
};
class AstUser4InUse final : VNUserInUseBase {
class VNUser4InUse final : VNUserInUseBase {
protected:
friend class AstNode;
static uint32_t s_userCntGbl; // Count of which usage of userp() this is
static bool s_userBusy; // Count is in use
public:
AstUser4InUse() { allocate(4, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~AstUser4InUse() { free (4, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
VNUser4InUse() { allocate(4, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~VNUser4InUse() { free (4, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void clear() { clearcnt(4, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void check() { checkcnt(4, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
};
class AstUser5InUse final : VNUserInUseBase {
class VNUser5InUse final : VNUserInUseBase {
protected:
friend class AstNode;
static uint32_t s_userCntGbl; // Count of which usage of userp() this is
static bool s_userBusy; // Count is in use
public:
AstUser5InUse() { allocate(5, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~AstUser5InUse() { free (5, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
VNUser5InUse() { allocate(5, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
~VNUser5InUse() { free (5, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void clear() { clearcnt(5, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
static void check() { checkcnt(5, s_userCntGbl/*ref*/, s_userBusy/*ref*/); }
};
@ -1272,10 +1265,10 @@ public:
};
//######################################################################
// AstNVisitor -- Allows new functions to be called on each node
// VNVisitor -- Allows new functions to be called on each node
// type without changing the base classes. See "Modern C++ Design".
class AstNVisitor VL_NOT_FINAL : public VNDeleter {
class VNVisitor VL_NOT_FINAL : public VNDeleter {
friend class AstNode;
public:
@ -1364,10 +1357,10 @@ class AstNode VL_NOT_FINAL {
AstNode* m_op4p = nullptr; // Generic pointer 4
AstNode** m_iterpp
= nullptr; // Pointer to node iterating on, change it if we replace this node.
const AstType m_type; // Node sub-type identifier
const VNType m_type; // Node sub-type identifier
// ^ ASTNODE_PREFETCH depends on above ordering of members
// AstType is 2 bytes, so we can stick another 6 bytes after it to utilize what would
// VNType is 2 bytes, so we can stick another 6 bytes after it to utilize what would
// otherwise be padding (on a 64-bit system). We stick the attribute flags, broken state,
// and the clone count here.
@ -1455,7 +1448,7 @@ public:
protected:
// CONSTRUCTORS
AstNode(AstType t, FileLine* fl);
AstNode(VNType t, FileLine* fl);
virtual AstNode* clone() = 0; // Generally, cloneTree is what you want instead
virtual void cloneRelink() {}
void cloneRelinkTree();
@ -1494,7 +1487,7 @@ protected:
public:
// ACCESSORS
inline AstType type() const { return m_type; }
inline VNType type() const { return m_type; }
const char* typeName() const { return type().ascii(); } // See also prettyTypeName
AstNode* nextp() const { return m_nextp; }
AstNode* backp() const { return m_backp; }
@ -1604,73 +1597,73 @@ public:
// clang-format off
VNUser user1u() const {
// Slows things down measurably, so disabled by default
//UASSERT_STATIC(AstUser1InUse::s_userBusy, "userp set w/o busy");
return ((m_user1Cnt==AstUser1InUse::s_userCntGbl) ? m_user1u : VNUser(0));
//UASSERT_STATIC(VNUser1InUse::s_userBusy, "userp set w/o busy");
return ((m_user1Cnt==VNUser1InUse::s_userCntGbl) ? m_user1u : VNUser(0));
}
AstNode* user1p() const { return user1u().toNodep(); }
void user1u(const VNUser& user) { m_user1u=user; m_user1Cnt=AstUser1InUse::s_userCntGbl; }
void user1u(const VNUser& user) { m_user1u=user; m_user1Cnt=VNUser1InUse::s_userCntGbl; }
void user1p(void* userp) { user1u(VNUser(userp)); }
int user1() const { return user1u().toInt(); }
void user1(int val) { user1u(VNUser(val)); }
int user1Inc(int val=1) { int v=user1(); user1(v+val); return v; }
int user1SetOnce() { int v=user1(); if (!v) user1(1); return v; } // Better for cache than user1Inc()
static void user1ClearTree() { AstUser1InUse::clear(); } // Clear userp()'s across the entire tree
static void user1ClearTree() { VNUser1InUse::clear(); } // Clear userp()'s across the entire tree
VNUser user2u() const {
// Slows things down measurably, so disabled by default
//UASSERT_STATIC(AstUser2InUse::s_userBusy, "userp set w/o busy");
return ((m_user2Cnt==AstUser2InUse::s_userCntGbl) ? m_user2u : VNUser(0));
//UASSERT_STATIC(VNUser2InUse::s_userBusy, "userp set w/o busy");
return ((m_user2Cnt==VNUser2InUse::s_userCntGbl) ? m_user2u : VNUser(0));
}
AstNode* user2p() const { return user2u().toNodep(); }
void user2u(const VNUser& user) { m_user2u=user; m_user2Cnt=AstUser2InUse::s_userCntGbl; }
void user2u(const VNUser& user) { m_user2u=user; m_user2Cnt=VNUser2InUse::s_userCntGbl; }
void user2p(void* userp) { user2u(VNUser(userp)); }
int user2() const { return user2u().toInt(); }
void user2(int val) { user2u(VNUser(val)); }
int user2Inc(int val=1) { int v=user2(); user2(v+val); return v; }
int user2SetOnce() { int v=user2(); if (!v) user2(1); return v; } // Better for cache than user2Inc()
static void user2ClearTree() { AstUser2InUse::clear(); } // Clear userp()'s across the entire tree
static void user2ClearTree() { VNUser2InUse::clear(); } // Clear userp()'s across the entire tree
VNUser user3u() const {
// Slows things down measurably, so disabled by default
//UASSERT_STATIC(AstUser3InUse::s_userBusy, "userp set w/o busy");
return ((m_user3Cnt==AstUser3InUse::s_userCntGbl) ? m_user3u : VNUser(0));
//UASSERT_STATIC(VNUser3InUse::s_userBusy, "userp set w/o busy");
return ((m_user3Cnt==VNUser3InUse::s_userCntGbl) ? m_user3u : VNUser(0));
}
AstNode* user3p() const { return user3u().toNodep(); }
void user3u(const VNUser& user) { m_user3u=user; m_user3Cnt=AstUser3InUse::s_userCntGbl; }
void user3u(const VNUser& user) { m_user3u=user; m_user3Cnt=VNUser3InUse::s_userCntGbl; }
void user3p(void* userp) { user3u(VNUser(userp)); }
int user3() const { return user3u().toInt(); }
void user3(int val) { user3u(VNUser(val)); }
int user3Inc(int val=1) { int v=user3(); user3(v+val); return v; }
int user3SetOnce() { int v=user3(); if (!v) user3(1); return v; } // Better for cache than user3Inc()
static void user3ClearTree() { AstUser3InUse::clear(); } // Clear userp()'s across the entire tree
static void user3ClearTree() { VNUser3InUse::clear(); } // Clear userp()'s across the entire tree
VNUser user4u() const {
// Slows things down measurably, so disabled by default
//UASSERT_STATIC(AstUser4InUse::s_userBusy, "userp set w/o busy");
return ((m_user4Cnt==AstUser4InUse::s_userCntGbl) ? m_user4u : VNUser(0));
//UASSERT_STATIC(VNUser4InUse::s_userBusy, "userp set w/o busy");
return ((m_user4Cnt==VNUser4InUse::s_userCntGbl) ? m_user4u : VNUser(0));
}
AstNode* user4p() const { return user4u().toNodep(); }
void user4u(const VNUser& user) { m_user4u=user; m_user4Cnt=AstUser4InUse::s_userCntGbl; }
void user4u(const VNUser& user) { m_user4u=user; m_user4Cnt=VNUser4InUse::s_userCntGbl; }
void user4p(void* userp) { user4u(VNUser(userp)); }
int user4() const { return user4u().toInt(); }
void user4(int val) { user4u(VNUser(val)); }
int user4Inc(int val=1) { int v=user4(); user4(v+val); return v; }
int user4SetOnce() { int v=user4(); if (!v) user4(1); return v; } // Better for cache than user4Inc()
static void user4ClearTree() { AstUser4InUse::clear(); } // Clear userp()'s across the entire tree
static void user4ClearTree() { VNUser4InUse::clear(); } // Clear userp()'s across the entire tree
VNUser user5u() const {
// Slows things down measurably, so disabled by default
//UASSERT_STATIC(AstUser5InUse::s_userBusy, "userp set w/o busy");
return ((m_user5Cnt==AstUser5InUse::s_userCntGbl) ? m_user5u : VNUser(0));
//UASSERT_STATIC(VNUser5InUse::s_userBusy, "userp set w/o busy");
return ((m_user5Cnt==VNUser5InUse::s_userCntGbl) ? m_user5u : VNUser(0));
}
AstNode* user5p() const { return user5u().toNodep(); }
void user5u(const VNUser& user) { m_user5u=user; m_user5Cnt=AstUser5InUse::s_userCntGbl; }
void user5u(const VNUser& user) { m_user5u=user; m_user5Cnt=VNUser5InUse::s_userCntGbl; }
void user5p(void* userp) { user5u(VNUser(userp)); }
int user5() const { return user5u().toInt(); }
void user5(int val) { user5u(VNUser(val)); }
int user5Inc(int val=1) { int v=user5(); user5(v+val); return v; }
int user5SetOnce() { int v=user5(); if (!v) user5(1); return v; } // Better for cache than user5Inc()
static void user5ClearTree() { AstUser5InUse::clear(); } // Clear userp()'s across the entire tree
static void user5ClearTree() { VNUser5InUse::clear(); } // Clear userp()'s across the entire tree
// clang-format on
AstNode* usernp(int n) const; // Return user1..userN based on provided n
@ -1727,13 +1720,13 @@ public:
void dtypeSetVoid() { dtypep(findVoidDType()); }
// Data type locators
AstNodeDType* findBitDType() { return findBasicDType(AstBasicDTypeKwd::LOGIC); }
AstNodeDType* findDoubleDType() { return findBasicDType(AstBasicDTypeKwd::DOUBLE); }
AstNodeDType* findStringDType() { return findBasicDType(AstBasicDTypeKwd::STRING); }
AstNodeDType* findSigned32DType() { return findBasicDType(AstBasicDTypeKwd::INTEGER); }
AstNodeDType* findUInt32DType() { return findBasicDType(AstBasicDTypeKwd::UINT32); }
AstNodeDType* findUInt64DType() { return findBasicDType(AstBasicDTypeKwd::UINT64); }
AstNodeDType* findCHandleDType() { return findBasicDType(AstBasicDTypeKwd::CHANDLE); }
AstNodeDType* findBitDType() { return findBasicDType(VBasicDTypeKwd::LOGIC); }
AstNodeDType* findDoubleDType() { return findBasicDType(VBasicDTypeKwd::DOUBLE); }
AstNodeDType* findStringDType() { return findBasicDType(VBasicDTypeKwd::STRING); }
AstNodeDType* findSigned32DType() { return findBasicDType(VBasicDTypeKwd::INTEGER); }
AstNodeDType* findUInt32DType() { return findBasicDType(VBasicDTypeKwd::UINT32); }
AstNodeDType* findUInt64DType() { return findBasicDType(VBasicDTypeKwd::UINT64); }
AstNodeDType* findCHandleDType() { return findBasicDType(VBasicDTypeKwd::CHANDLE); }
AstNodeDType* findEmptyQueueDType() const;
AstNodeDType* findVoidDType() const;
AstNodeDType* findQueueIndexDType() const;
@ -1742,7 +1735,7 @@ public:
AstNodeDType* findLogicRangeDType(const VNumRange& range, int widthMin,
VSigning numeric) const;
AstNodeDType* findBitRangeDType(const VNumRange& range, int widthMin, VSigning numeric) const;
AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd) const;
AstNodeDType* findBasicDType(VBasicDTypeKwd kwd) const;
static AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
// METHODS - dump and error
@ -1845,26 +1838,26 @@ public:
virtual const char* broken() const { return nullptr; }
// INVOKERS
virtual void accept(AstNVisitor& v) = 0;
virtual void accept(VNVisitor& v) = 0;
protected:
// All AstNVisitor related functions are called as methods off the visitor
friend class AstNVisitor;
// Use instead AstNVisitor::iterateChildren
void iterateChildren(AstNVisitor& v);
// Use instead AstNVisitor::iterateChildrenBackwards
void iterateChildrenBackwards(AstNVisitor& v);
// Use instead AstNVisitor::iterateChildrenConst
void iterateChildrenConst(AstNVisitor& v);
// Use instead AstNVisitor::iterateAndNextNull
void iterateAndNext(AstNVisitor& v);
// Use instead AstNVisitor::iterateAndNextConstNull
void iterateAndNextConst(AstNVisitor& v);
// Use instead AstNVisitor::iterateSubtreeReturnEdits
AstNode* iterateSubtreeReturnEdits(AstNVisitor& v);
// All VNVisitor related functions are called as methods off the visitor
friend class VNVisitor;
// Use instead VNVisitor::iterateChildren
void iterateChildren(VNVisitor& v);
// Use instead VNVisitor::iterateChildrenBackwards
void iterateChildrenBackwards(VNVisitor& v);
// Use instead VNVisitor::iterateChildrenConst
void iterateChildrenConst(VNVisitor& v);
// Use instead VNVisitor::iterateAndNextNull
void iterateAndNext(VNVisitor& v);
// Use instead VNVisitor::iterateAndNextConstNull
void iterateAndNextConst(VNVisitor& v);
// Use instead VNVisitor::iterateSubtreeReturnEdits
AstNode* iterateSubtreeReturnEdits(VNVisitor& v);
private:
void iterateListBackwards(AstNVisitor& v);
void iterateListBackwards(VNVisitor& v);
// For internal use only.
template <typename T> inline static bool privateTypeTest(const AstNode* nodep);
@ -1954,7 +1947,7 @@ inline void VNRelinker::relink(AstNode* newp) { newp->AstNode::relink(this); }
class AstNodeMath VL_NOT_FINAL : public AstNode {
// Math -- anything that's part of an expression tree
protected:
AstNodeMath(AstType t, FileLine* fl)
AstNodeMath(VNType t, FileLine* fl)
: AstNode{t, fl} {}
public:
@ -1976,7 +1969,7 @@ public:
class AstNodeTermop VL_NOT_FINAL : public AstNodeMath {
// Terminal operator -- a operator with no "inputs"
protected:
AstNodeTermop(AstType t, FileLine* fl)
AstNodeTermop(VNType t, FileLine* fl)
: AstNodeMath{t, fl} {}
public:
@ -1984,14 +1977,14 @@ public:
// Know no children, and hot function, so skip iterator for speed
// See checkTreeIter also that asserts no children
// cppcheck-suppress functionConst
void iterateChildren(AstNVisitor& v) {}
void iterateChildren(VNVisitor& v) {}
virtual void dump(std::ostream& str) const override;
};
class AstNodeUniop VL_NOT_FINAL : public AstNodeMath {
// Unary math
protected:
AstNodeUniop(AstType t, FileLine* fl, AstNode* lhsp)
AstNodeUniop(VNType t, FileLine* fl, AstNode* lhsp)
: AstNodeMath{t, fl} {
dtypeFrom(lhsp);
setOp1p(lhsp);
@ -2018,7 +2011,7 @@ public:
class AstNodeBiop VL_NOT_FINAL : public AstNodeMath {
// Binary math
protected:
AstNodeBiop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
AstNodeBiop(VNType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeMath{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
@ -2051,7 +2044,7 @@ public:
class AstNodeTriop VL_NOT_FINAL : public AstNodeMath {
// Trinary math
protected:
AstNodeTriop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
AstNodeTriop(VNType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths)
: AstNodeMath{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
@ -2085,7 +2078,7 @@ public:
class AstNodeQuadop VL_NOT_FINAL : public AstNodeMath {
// Quaternary math
protected:
AstNodeQuadop(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths, AstNode* fhs)
AstNodeQuadop(VNType t, FileLine* fl, AstNode* lhs, AstNode* rhs, AstNode* ths, AstNode* fhs)
: AstNodeMath{t, fl} {
setOp1p(lhs);
setOp2p(rhs);
@ -2123,7 +2116,7 @@ public:
class AstNodeBiCom VL_NOT_FINAL : public AstNodeBiop {
// Binary math with commutative properties
protected:
AstNodeBiCom(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
AstNodeBiCom(VNType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiop{t, fl, lhs, rhs} {}
public:
@ -2133,7 +2126,7 @@ public:
class AstNodeBiComAsv VL_NOT_FINAL : public AstNodeBiCom {
// Binary math with commutative & associative properties
protected:
AstNodeBiComAsv(AstType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
AstNodeBiComAsv(VNType t, FileLine* fl, AstNode* lhs, AstNode* rhs)
: AstNodeBiCom{t, fl, lhs, rhs} {}
public:
@ -2142,7 +2135,7 @@ public:
class AstNodeCond VL_NOT_FINAL : public AstNodeTriop {
protected:
AstNodeCond(AstType t, FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p)
AstNodeCond(VNType t, FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p)
: AstNodeTriop{t, fl, condp, expr1p, expr2p} {
if (expr1p) {
dtypeFrom(expr1p);
@ -2179,7 +2172,7 @@ private:
string m_name; // Name of block
bool m_unnamed; // Originally unnamed (name change does not affect this)
protected:
AstNodeBlock(AstType t, FileLine* fl, const string& name, AstNode* stmtsp)
AstNodeBlock(VNType t, FileLine* fl, const string& name, AstNode* stmtsp)
: AstNode{t, fl}
, m_name{name} {
addNOp1p(stmtsp);
@ -2200,7 +2193,7 @@ public:
class AstNodePreSel VL_NOT_FINAL : public AstNode {
// Something that becomes an AstSel
protected:
AstNodePreSel(AstType t, FileLine* fl, AstNode* fromp, AstNode* rhs, AstNode* ths)
AstNodePreSel(VNType t, FileLine* fl, AstNode* fromp, AstNode* rhs, AstNode* ths)
: AstNode{t, fl} {
setOp1p(fromp);
setOp2p(rhs);
@ -2224,7 +2217,7 @@ public:
class AstNodeProcedure VL_NOT_FINAL : public AstNode {
// IEEE procedure: initial, final, always
protected:
AstNodeProcedure(AstType t, FileLine* fl, AstNode* bodysp)
AstNodeProcedure(VNType t, FileLine* fl, AstNode* bodysp)
: AstNode{t, fl} {
addNOp2p(bodysp);
}
@ -2242,7 +2235,7 @@ class AstNodeStmt VL_NOT_FINAL : public AstNode {
// Statement -- anything that's directly under a function
bool m_statement; // Really a statement (e.g. not a function with return)
protected:
AstNodeStmt(AstType t, FileLine* fl, bool statement = true)
AstNodeStmt(VNType t, FileLine* fl, bool statement = true)
: AstNode{t, fl}
, m_statement{statement} {}
@ -2260,7 +2253,7 @@ public:
class AstNodeAssign VL_NOT_FINAL : public AstNodeStmt {
protected:
AstNodeAssign(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
AstNodeAssign(VNType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeStmt{t, fl} {
setOp1p(rhsp);
setOp2p(lhsp);
@ -2286,7 +2279,7 @@ public:
class AstNodeFor VL_NOT_FINAL : public AstNodeStmt {
protected:
AstNodeFor(AstType t, FileLine* fl, AstNode* initsp, AstNode* condp, AstNode* incsp,
AstNodeFor(VNType t, FileLine* fl, AstNode* initsp, AstNode* condp, AstNode* incsp,
AstNode* bodysp)
: AstNodeStmt{t, fl} {
addNOp1p(initsp);
@ -2311,7 +2304,7 @@ private:
VBranchPred m_branchPred; // Branch prediction as taken/untaken?
bool m_isBoundsCheck; // True if this if node was inserted for array bounds checking
protected:
AstNodeIf(AstType t, FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp)
AstNodeIf(VNType t, FileLine* fl, AstNode* condp, AstNode* ifsp, AstNode* elsesp)
: AstNodeStmt{t, fl} {
setOp1p(condp);
addNOp2p(ifsp);
@ -2339,7 +2332,7 @@ public:
class AstNodeCase VL_NOT_FINAL : public AstNodeStmt {
protected:
AstNodeCase(AstType t, FileLine* fl, AstNode* exprp, AstNode* casesp)
AstNodeCase(VNType t, FileLine* fl, AstNode* exprp, AstNode* casesp)
: AstNodeStmt{t, fl} {
setOp1p(exprp);
addNOp2p(casesp);
@ -2368,13 +2361,13 @@ private:
string m_selfPointer; // Output code object pointer (e.g.: 'this')
protected:
AstNodeVarRef(AstType t, FileLine* fl, const string& name, const VAccess& access)
AstNodeVarRef(VNType t, FileLine* fl, const string& name, const VAccess& access)
: AstNodeMath{t, fl}
, m_access{access}
, m_name{name} {
this->varp(nullptr);
}
AstNodeVarRef(AstType t, FileLine* fl, const string& name, AstVar* varp, const VAccess& access)
AstNodeVarRef(VNType t, FileLine* fl, const string& name, AstVar* varp, const VAccess& access)
: AstNodeMath{t, fl}
, m_access{access}
, m_name{name} {
@ -2405,7 +2398,7 @@ public:
// Know no children, and hot function, so skip iterator for speed
// See checkTreeIter also that asserts no children
// cppcheck-suppress functionConst
void iterateChildren(AstNVisitor& v) {}
void iterateChildren(VNVisitor& v) {}
};
class AstNodeText VL_NOT_FINAL : public AstNode {
@ -2414,7 +2407,7 @@ private:
protected:
// Node that simply puts text into the output stream
AstNodeText(AstType t, FileLine* fl, const string& textp)
AstNodeText(VNType t, FileLine* fl, const string& textp)
: AstNode{t, fl} {
m_text = textp; // Copy it
}
@ -2444,7 +2437,7 @@ private:
protected:
// CONSTRUCTORS
AstNodeDType(AstType t, FileLine* fl)
AstNodeDType(VNType t, FileLine* fl)
: AstNode{t, fl} {
m_width = 0;
m_widthMin = 0;
@ -2546,7 +2539,7 @@ private:
const int m_uniqueNum;
protected:
AstNodeUOrStructDType(AstType t, FileLine* fl, VSigning numericUnpack)
AstNodeUOrStructDType(VNType t, FileLine* fl, VSigning numericUnpack)
: AstNodeDType{t, fl}
, m_uniqueNum{uniqueNumInc()} {
// VSigning::NOSIGN overloaded to indicate not packed
@ -2610,7 +2603,7 @@ private:
AstNodeDType* m_refDTypep = nullptr; // Elements of this type (after widthing)
AstNode* rangenp() const { return op2p(); } // op2 = Array(s) of variable
protected:
AstNodeArrayDType(AstType t, FileLine* fl)
AstNodeArrayDType(VNType t, FileLine* fl)
: AstNodeDType{t, fl} {}
public:
@ -2669,7 +2662,7 @@ public:
class AstNodeSel VL_NOT_FINAL : public AstNodeBiop {
// Single bit range extraction, perhaps with non-constant selection or array selection
protected:
AstNodeSel(AstType t, FileLine* fl, AstNode* fromp, AstNode* bitp)
AstNodeSel(VNType t, FileLine* fl, AstNode* fromp, AstNode* bitp)
: AstNodeBiop{t, fl, fromp, bitp} {}
public:
@ -2687,7 +2680,7 @@ public:
class AstNodeStream VL_NOT_FINAL : public AstNodeBiop {
// Verilog {rhs{lhs}} - Note rhsp() is the slice size, not the lhsp()
protected:
AstNodeStream(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
AstNodeStream(VNType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeBiop{t, fl, lhsp, rhsp} {
if (lhsp->dtypep()) dtypeSetLogicSized(lhsp->dtypep()->width(), VSigning::UNSIGNED);
}
@ -2706,7 +2699,7 @@ class AstNodeCCall VL_NOT_FINAL : public AstNodeStmt {
string m_argTypes;
protected:
AstNodeCCall(AstType t, FileLine* fl, AstCFunc* funcp, AstNode* argsp = nullptr)
AstNodeCCall(VNType t, FileLine* fl, AstCFunc* funcp, AstNode* argsp = nullptr)
: AstNodeStmt{t, fl, true}
, m_funcp{funcp} {
addNOp2p(argsp);
@ -2761,7 +2754,7 @@ private:
bool m_virtual : 1; // Virtual method in class
VLifetime m_lifetime; // Lifetime
protected:
AstNodeFTask(AstType t, FileLine* fl, const string& name, AstNode* stmtsp)
AstNodeFTask(VNType t, FileLine* fl, const string& name, AstNode* stmtsp)
: AstNode{t, fl}
, m_name{name}
, m_taskPublic{false}
@ -2869,12 +2862,12 @@ private:
string m_inlinedDots; // Dotted hierarchy flattened out
bool m_pli = false; // Pli system call ($name)
protected:
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp)
AstNodeFTaskRef(VNType t, FileLine* fl, bool statement, AstNode* namep, AstNode* pinsp)
: AstNodeStmt{t, fl, statement} {
setOp1p(namep);
addNOp3p(pinsp);
}
AstNodeFTaskRef(AstType t, FileLine* fl, bool statement, const string& name, AstNode* pinsp)
AstNodeFTaskRef(VNType t, FileLine* fl, bool statement, const string& name, AstNode* pinsp)
: AstNodeStmt{t, fl, statement}
, m_name{name} {
addNOp3p(pinsp);
@ -2932,7 +2925,7 @@ private:
VTimescale m_timeunit; // Global time unit
VOptionBool m_unconnectedDrive; // State of `unconnected_drive
protected:
AstNodeModule(AstType t, FileLine* fl, const string& name)
AstNodeModule(VNType t, FileLine* fl, const string& name)
: AstNode{t, fl}
, m_name{name}
, m_origName{name}
@ -2992,7 +2985,7 @@ public:
class AstNodeRange VL_NOT_FINAL : public AstNode {
// A range, sized or unsized
protected:
AstNodeRange(AstType t, FileLine* fl)
AstNodeRange(VNType t, FileLine* fl)
: AstNode{t, fl} {}
public:
@ -3001,26 +2994,24 @@ public:
};
//######################################################################
// Inline AstNVisitor METHODS
// Inline VNVisitor METHODS
inline void AstNVisitor::iterate(AstNode* nodep) { nodep->accept(*this); }
inline void AstNVisitor::iterateNull(AstNode* nodep) {
inline void VNVisitor::iterate(AstNode* nodep) { nodep->accept(*this); }
inline void VNVisitor::iterateNull(AstNode* nodep) {
if (VL_LIKELY(nodep)) nodep->accept(*this);
}
inline void AstNVisitor::iterateChildren(AstNode* nodep) { nodep->iterateChildren(*this); }
inline void AstNVisitor::iterateChildrenBackwards(AstNode* nodep) {
inline void VNVisitor::iterateChildren(AstNode* nodep) { nodep->iterateChildren(*this); }
inline void VNVisitor::iterateChildrenBackwards(AstNode* nodep) {
nodep->iterateChildrenBackwards(*this);
}
inline void AstNVisitor::iterateChildrenConst(AstNode* nodep) {
nodep->iterateChildrenConst(*this);
}
inline void AstNVisitor::iterateAndNextNull(AstNode* nodep) {
inline void VNVisitor::iterateChildrenConst(AstNode* nodep) { nodep->iterateChildrenConst(*this); }
inline void VNVisitor::iterateAndNextNull(AstNode* nodep) {
if (VL_LIKELY(nodep)) nodep->iterateAndNext(*this);
}
inline void AstNVisitor::iterateAndNextConstNull(AstNode* nodep) {
inline void VNVisitor::iterateAndNextConstNull(AstNode* nodep) {
if (VL_LIKELY(nodep)) nodep->iterateAndNextConst(*this);
}
inline AstNode* AstNVisitor::iterateSubtreeReturnEdits(AstNode* nodep) {
inline AstNode* VNVisitor::iterateSubtreeReturnEdits(AstNode* nodep) {
return nodep->iterateSubtreeReturnEdits(*this);
}

View File

@ -303,17 +303,17 @@ bool AstVar::isScBigUint() const {
&& !isScBv());
}
void AstVar::combineType(AstVarType type) {
void AstVar::combineType(VVarType type) {
// These flags get combined with the existing settings of the flags.
// We don't test varType for certain types, instead set flags since
// when we combine wires cross-hierarchy we need a union of all characteristics.
m_varType = type;
// These flags get combined with the existing settings of the flags.
if (type == AstVarType::TRIWIRE || type == AstVarType::TRI0 || type == AstVarType::TRI1) {
if (type == VVarType::TRIWIRE || type == VVarType::TRI0 || type == VVarType::TRI1) {
m_tristate = true;
}
if (type == AstVarType::TRI0) m_isPulldown = true;
if (type == AstVarType::TRI1) m_isPullup = true;
if (type == VVarType::TRI0) m_isPulldown = true;
if (type == VVarType::TRI1) m_isPullup = true;
}
string AstVar::verilogKwd() const {
@ -321,11 +321,11 @@ string AstVar::verilogKwd() const {
return direction().verilogKwd();
} else if (isTristate()) {
return "tri";
} else if (varType() == AstVarType::WIRE) {
} else if (varType() == VVarType::WIRE) {
return "wire";
} else if (varType() == AstVarType::WREAL) {
} else if (varType() == VVarType::WREAL) {
return "wreal";
} else if (varType() == AstVarType::IFACEREF) {
} else if (varType() == VVarType::IFACEREF) {
return "ifaceref";
} else {
return dtypep()->name();
@ -355,10 +355,10 @@ string AstVar::vlArgType(bool named, bool forReturn, bool forFunc, const string&
string AstVar::vlEnumType() const {
string arg;
const AstBasicDType* const bdtypep = basicp();
const bool strtype = bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::STRING;
if (bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::CHARPTR) {
const bool strtype = bdtypep && bdtypep->keyword() == VBasicDTypeKwd::STRING;
if (bdtypep && bdtypep->keyword() == VBasicDTypeKwd::CHARPTR) {
return "VLVT_PTR";
} else if (bdtypep && bdtypep->keyword() == AstBasicDTypeKwd::SCOPEPTR) {
} else if (bdtypep && bdtypep->keyword() == VBasicDTypeKwd::SCOPEPTR) {
return "VLVT_PTR";
} else if (strtype) {
arg += "VLVT_STRING";
@ -485,7 +485,7 @@ public:
}
virtual string primitive(const AstVar* varp) const {
string type;
const AstBasicDTypeKwd keyword = varp->basicp()->keyword();
const VBasicDTypeKwd keyword = varp->basicp()->keyword();
if (keyword.isDpiUnsignable() && !varp->basicp()->isSigned()) type = "unsigned ";
type += keyword.dpiType();
return type;
@ -517,8 +517,7 @@ string AstVar::dpiArgType(bool named, bool forReturn) const {
virtual string primitive(const AstVar* varp) const override {
string type = dpiTypesToStringConverter::primitive(varp);
if (varp->isWritable() || VN_IS(varp->dtypep()->skipRefp(), UnpackArrayDType)) {
if (!varp->isWritable()
&& varp->basicp()->keyword() != AstBasicDTypeKwd::STRING)
if (!varp->isWritable() && varp->basicp()->keyword() != VBasicDTypeKwd::STRING)
type = "const " + type;
type += "*";
}
@ -559,7 +558,7 @@ string AstVar::dpiTmpVarType(const string& varName) const {
virtual string primitive(const AstVar* varp) const override {
string type = dpiTypesToStringConverter::primitive(varp);
if (varp->isWritable() || VN_IS(varp->dtypep()->skipRefp(), UnpackArrayDType)) {
if (!varp->isWritable() && varp->basicp()->keyword() == AstBasicDTypeKwd::CHANDLE)
if (!varp->isWritable() && varp->basicp()->keyword() == VBasicDTypeKwd::CHANDLE)
type = "const " + type;
}
type += ' ' + m_name + arraySuffix(varp, 0);
@ -688,9 +687,9 @@ AstNodeDType::CTypeRecursed AstNodeDType::cTypeRecurse(bool compound) const {
const string bitvec = (!bdtypep->isOpaque() && !v3Global.opt.protectIds())
? "/*" + cvtToStr(dtypep->width() - 1) + ":0*/"
: "";
if (bdtypep->keyword() == AstBasicDTypeKwd::CHARPTR) {
if (bdtypep->keyword() == VBasicDTypeKwd::CHARPTR) {
info.m_type = "const char*";
} else if (bdtypep->keyword() == AstBasicDTypeKwd::SCOPEPTR) {
} else if (bdtypep->keyword() == VBasicDTypeKwd::SCOPEPTR) {
info.m_type = "const VerilatedScope*";
} else if (bdtypep->keyword().isDouble()) {
info.m_type = "double";
@ -799,7 +798,7 @@ AstNode* AstArraySel::baseFromp(AstNode* nodep, bool overMembers) {
continue;
}
// AstNodeSelPre stashes the associated variable under an ATTROF
// of AstAttrType::VAR_BASE/MEMBER_BASE so it isn't constified
// of VAttrType::VAR_BASE/MEMBER_BASE so it isn't constified
else if (VN_IS(nodep, AttrOf)) {
nodep = VN_AS(nodep, AttrOf)->fromp();
continue;
@ -902,7 +901,7 @@ bool AstSenTree::hasCombo() const {
AstTypeTable::AstTypeTable(FileLine* fl)
: ASTGEN_SUPER_TypeTable(fl) {
for (int i = 0; i < AstBasicDTypeKwd::_ENUM_MAX; ++i) m_basicps[i] = nullptr;
for (int i = 0; i < VBasicDTypeKwd::_ENUM_MAX; ++i) m_basicps[i] = nullptr;
}
void AstTypeTable::clearCache() {
@ -953,7 +952,7 @@ AstQueueDType* AstTypeTable::findQueueIndexDType(FileLine* fl) {
return m_queueIndexp;
}
AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd) {
AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, VBasicDTypeKwd kwd) {
if (m_basicps[kwd]) return m_basicps[kwd];
//
AstBasicDType* const new1p = new AstBasicDType(fl, kwd);
@ -971,7 +970,7 @@ AstBasicDType* AstTypeTable::findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd)
return newp;
}
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, int width,
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd, int width,
int widthMin, VSigning numeric) {
AstBasicDType* const new1p = new AstBasicDType(fl, kwd, numeric, width, widthMin);
AstBasicDType* const newp = findInsertSameDType(new1p);
@ -983,7 +982,7 @@ AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kw
return newp;
}
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd,
AstBasicDType* AstTypeTable::findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd,
const VNumRange& range, int widthMin,
VSigning numeric) {
AstBasicDType* const new1p = new AstBasicDType(fl, kwd, numeric, range, widthMin);
@ -1018,7 +1017,7 @@ AstConstPool::AstConstPool(FileLine* fl)
AstVarScope* AstConstPool::createNewEntry(const string& name, AstNode* initp) {
FileLine* const fl = initp->fileline();
AstVar* const varp = new AstVar(fl, AstVarType::MODULETEMP, name, initp->dtypep());
AstVar* const varp = new AstVar(fl, VVarType::MODULETEMP, name, initp->dtypep());
varp->isConst(true);
varp->isStatic(true);
varp->valuep(initp->cloneTree(false));
@ -1627,10 +1626,10 @@ void AstMTaskBody::dump(std::ostream& str) const {
}
void AstTypeTable::dump(std::ostream& str) const {
this->AstNode::dump(str);
for (int i = 0; i < static_cast<int>(AstBasicDTypeKwd::_ENUM_MAX); ++i) {
for (int i = 0; i < static_cast<int>(VBasicDTypeKwd::_ENUM_MAX); ++i) {
if (AstBasicDType* const subnodep = m_basicps[i]) {
str << '\n'; // Newline from caller, so newline first
str << "\t\t" << std::setw(8) << AstBasicDTypeKwd(i).ascii();
str << "\t\t" << std::setw(8) << VBasicDTypeKwd(i).ascii();
str << " -> ";
subnodep->dump(str);
}

View File

@ -26,7 +26,7 @@
// Standard defines for all AstNode final classes
#define ASTNODE_NODE_FUNCS_NO_DTOR(name) \
virtual void accept(AstNVisitor& v) override { v.visit(this); } \
virtual void accept(VNVisitor& v) override { v.visit(this); } \
virtual AstNode* clone() override { return new Ast##name(*this); } \
static Ast##name* cloneTreeNull(Ast##name* nodep, bool cloneNextLink) { \
return nodep ? nodep->cloneTree(cloneNextLink) : nullptr; \
@ -391,10 +391,10 @@ class AstParamTypeDType final : public AstNodeDType {
// Parents: MODULE
// A parameter type statement; much like a var or typedef
private:
const AstVarType m_varType; // Type of variable (for localparam vs. param)
const VVarType m_varType; // Type of variable (for localparam vs. param)
string m_name; // Name of variable
public:
AstParamTypeDType(FileLine* fl, AstVarType type, const string& name, VFlagChildDType,
AstParamTypeDType(FileLine* fl, VVarType type, const string& name, VFlagChildDType,
AstNodeDType* dtp)
: ASTGEN_SUPER_ParamTypeDType(fl)
, m_varType{type}
@ -428,9 +428,9 @@ public:
virtual bool maybePointedTo() const override { return true; }
virtual bool hasDType() const override { return true; }
virtual void name(const string& flag) override { m_name = flag; }
AstVarType varType() const { return m_varType; } // * = Type of variable
VVarType varType() const { return m_varType; } // * = Type of variable
bool isParam() const { return true; }
bool isGParam() const { return (varType() == AstVarType::GPARAM); }
bool isGParam() const { return (varType() == VVarType::GPARAM); }
virtual bool isCompound() const override {
v3fatalSrc("call isCompound on subdata type, not reference");
return false;
@ -824,7 +824,7 @@ class AstBasicDType final : public AstNodeDType {
// Children: RANGE (converted to constant in V3Width)
private:
struct Members {
AstBasicDTypeKwd m_keyword; // (also in VBasicTypeKey) What keyword created basic type
VBasicDTypeKwd m_keyword; // (also in VBasicTypeKey) What keyword created basic type
VNumRange m_nrange; // (also in VBasicTypeKey) Numeric msb/lsb (if non-opaque keyword)
bool operator==(const Members& rhs) const {
return rhs.m_keyword == m_keyword && rhs.m_nrange == m_nrange;
@ -832,31 +832,30 @@ private:
} m;
// See also in AstNodeDType: m_width, m_widthMin, m_numeric(issigned)
public:
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, const VSigning& signst = VSigning::NOSIGN)
AstBasicDType(FileLine* fl, VBasicDTypeKwd kwd, const VSigning& signst = VSigning::NOSIGN)
: ASTGEN_SUPER_BasicDType(fl) {
init(kwd, signst, 0, -1, nullptr);
}
AstBasicDType(FileLine* fl, VFlagLogicPacked, int wantwidth)
: ASTGEN_SUPER_BasicDType(fl) {
init(AstBasicDTypeKwd::LOGIC, VSigning::NOSIGN, wantwidth, -1, nullptr);
init(VBasicDTypeKwd::LOGIC, VSigning::NOSIGN, wantwidth, -1, nullptr);
}
AstBasicDType(FileLine* fl, VFlagBitPacked, int wantwidth)
: ASTGEN_SUPER_BasicDType(fl) {
init(AstBasicDTypeKwd::BIT, VSigning::NOSIGN, wantwidth, -1, nullptr);
init(VBasicDTypeKwd::BIT, VSigning::NOSIGN, wantwidth, -1, nullptr);
}
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSigning numer, int wantwidth, int widthmin)
AstBasicDType(FileLine* fl, VBasicDTypeKwd kwd, VSigning numer, int wantwidth, int widthmin)
: ASTGEN_SUPER_BasicDType(fl) {
init(kwd, numer, wantwidth, widthmin, nullptr);
}
AstBasicDType(FileLine* fl, AstBasicDTypeKwd kwd, VSigning numer, VNumRange range,
int widthmin)
AstBasicDType(FileLine* fl, VBasicDTypeKwd kwd, VSigning numer, VNumRange range, int widthmin)
: ASTGEN_SUPER_BasicDType(fl) {
init(kwd, numer, range.elements(), widthmin, nullptr);
m.m_nrange = range; // as init() presumes lsb==0, but range.lsb() might not be
}
// See also addRange in verilog.y
private:
void init(AstBasicDTypeKwd kwd, VSigning numer, int wantwidth, int wantwidthmin,
void init(VBasicDTypeKwd 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
@ -864,8 +863,8 @@ private:
m.m_keyword = kwd;
// Implicitness: // "parameter X" is implicit and sized from initial
// value, "parameter reg x" not
if (keyword() == AstBasicDTypeKwd::LOGIC_IMPLICIT) {
if (rangep || wantwidth) m.m_keyword = AstBasicDTypeKwd::LOGIC;
if (keyword() == VBasicDTypeKwd::LOGIC_IMPLICIT) {
if (rangep || wantwidth) m.m_keyword = VBasicDTypeKwd::LOGIC;
}
if (numer == VSigning::NOSIGN) {
if (keyword().isSigned()) {
@ -930,7 +929,7 @@ public:
// (Slow) recurses - Width in bytes rounding up 1,2,4,8,12,...
virtual int widthTotalBytes() const override;
virtual bool isFourstate() const override { return keyword().isFourstate(); }
AstBasicDTypeKwd keyword() const { // Avoid using - use isSomething accessors instead
VBasicDTypeKwd keyword() const { // Avoid using - use isSomething accessors instead
return m.m_keyword;
}
bool isBitLogic() const { return keyword().isBitLogic(); }
@ -941,10 +940,10 @@ public:
bool isZeroInit() const { return keyword().isZeroInit(); }
bool isRanged() const { return rangep() || m.m_nrange.ranged(); }
bool isDpiBitVec() const { // DPI uses svBitVecVal
return keyword() == AstBasicDTypeKwd::BIT && isRanged();
return keyword() == VBasicDTypeKwd::BIT && isRanged();
}
bool isDpiLogicVec() const { // DPI uses svLogicVecVal
return keyword().isFourstate() && !(keyword() == AstBasicDTypeKwd::LOGIC && !isRanged());
return keyword().isFourstate() && !(keyword() == VBasicDTypeKwd::LOGIC && !isRanged());
}
bool isDpiPrimitive() const { // DPI uses a primitive type
return !isDpiBitVec() && !isDpiLogicVec();
@ -959,7 +958,7 @@ public:
bool littleEndian() const {
return (rangep() ? rangep()->littleEndian() : m.m_nrange.littleEndian());
}
bool implicit() const { return keyword() == AstBasicDTypeKwd::LOGIC_IMPLICIT; }
bool implicit() const { return keyword() == VBasicDTypeKwd::LOGIC_IMPLICIT; }
VNumRange declRange() const { return isRanged() ? VNumRange{left(), right()} : VNumRange{}; }
void cvtRangeConst() { // Convert to smaller representation
if (rangep() && VN_IS(rangep()->leftp(), Const) && VN_IS(rangep()->rightp(), Const)) {
@ -1956,10 +1955,10 @@ private:
string m_name; // Name of variable
string m_origName; // Original name before dot addition
string m_tag; // Holds the string of the verilator tag -- used in XML output.
AstVarType m_varType; // Type of variable
VVarType m_varType; // Type of variable
VDirection m_direction; // Direction input/output etc
VDirection m_declDirection; // Declared direction input/output etc
AstBasicDTypeKwd m_declKwd; // Keyword at declaration time
VBasicDTypeKwd m_declKwd; // Keyword at declaration time
VLifetime m_lifetime; // Lifetime
VVarAttrClocker m_attrClocker;
MTaskIdSet m_mtaskIds; // MTaskID's that read or write this var
@ -2044,7 +2043,7 @@ private:
}
public:
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagChildDType, AstNodeDType* dtp)
AstVar(FileLine* fl, VVarType type, const string& name, VFlagChildDType, AstNodeDType* dtp)
: ASTGEN_SUPER_Var(fl)
, m_name{name}
, m_origName{name} {
@ -2055,10 +2054,10 @@ public:
if (dtp->basicp()) {
m_declKwd = dtp->basicp()->keyword();
} else {
m_declKwd = AstBasicDTypeKwd::LOGIC;
m_declKwd = VBasicDTypeKwd::LOGIC;
}
}
AstVar(FileLine* fl, AstVarType type, const string& name, AstNodeDType* dtp)
AstVar(FileLine* fl, VVarType type, const string& name, AstNodeDType* dtp)
: ASTGEN_SUPER_Var(fl)
, m_name{name}
, m_origName{name} {
@ -2069,28 +2068,28 @@ public:
if (dtp->basicp()) {
m_declKwd = dtp->basicp()->keyword();
} else {
m_declKwd = AstBasicDTypeKwd::LOGIC;
m_declKwd = VBasicDTypeKwd::LOGIC;
}
}
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagLogicPacked, int wantwidth)
AstVar(FileLine* fl, VVarType type, const string& name, VFlagLogicPacked, int wantwidth)
: ASTGEN_SUPER_Var(fl)
, m_name{name}
, m_origName{name} {
init();
combineType(type);
dtypeSetLogicSized(wantwidth, VSigning::UNSIGNED);
m_declKwd = AstBasicDTypeKwd::LOGIC;
m_declKwd = VBasicDTypeKwd::LOGIC;
}
AstVar(FileLine* fl, AstVarType type, const string& name, VFlagBitPacked, int wantwidth)
AstVar(FileLine* fl, VVarType type, const string& name, VFlagBitPacked, int wantwidth)
: ASTGEN_SUPER_Var(fl)
, m_name{name}
, m_origName{name} {
init();
combineType(type);
dtypeSetBitSized(wantwidth, VSigning::UNSIGNED);
m_declKwd = AstBasicDTypeKwd::BIT;
m_declKwd = VBasicDTypeKwd::BIT;
}
AstVar(FileLine* fl, AstVarType type, const string& name, AstVar* examplep)
AstVar(FileLine* fl, VVarType type, const string& name, AstVar* examplep)
: ASTGEN_SUPER_Var(fl)
, m_name{name}
, m_origName{name} {
@ -2107,7 +2106,7 @@ public:
virtual bool maybePointedTo() const override { return true; }
virtual string origName() const override { return m_origName; } // * = Original name
void origName(const string& name) { m_origName = name; }
AstVarType varType() const { return m_varType; } // * = Type of variable
VVarType varType() const { return m_varType; } // * = Type of variable
void direction(const VDirection& flag) {
m_direction = flag;
if (m_direction == VDirection::INOUT) m_tristate = true;
@ -2116,7 +2115,7 @@ public:
bool isIO() const { return m_direction != VDirection::NONE; }
void declDirection(const VDirection& flag) { m_declDirection = flag; }
VDirection declDirection() const { return m_declDirection; }
void varType(AstVarType type) { m_varType = type; }
void varType(VVarType type) { m_varType = type; }
void varType2Out() {
m_tristate = false;
m_direction = VDirection::OUTPUT;
@ -2125,7 +2124,7 @@ public:
m_tristate = false;
m_direction = VDirection::INPUT;
}
AstBasicDTypeKwd declKwd() const { return m_declKwd; }
VBasicDTypeKwd declKwd() const { return m_declKwd; }
string scType() const; // Return SysC type: bool, uint32_t, uint64_t, sc_bv
// Return C /*public*/ type for argument: bool, uint32_t, uint64_t, etc.
string cPubArgType(bool named, bool forReturn) const;
@ -2137,7 +2136,7 @@ public:
string vlEnumType() const; // Return VerilatorVarType: VLVT_UINT32, etc
string vlEnumDir() const; // Return VerilatorVarDir: VLVD_INOUT, etc
string vlPropDecl(const string& propName) const; // Return VerilatorVarProps declaration
void combineType(AstVarType type);
void combineType(VVarType type);
virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); }
// op1 = Range of variable
AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); }
@ -2215,7 +2214,7 @@ public:
bool isTristate() const { return m_tristate; }
bool isPrimaryIO() const { return m_primaryIO; }
bool isPrimaryInish() const { return isPrimaryIO() && isNonOutput(); }
bool isIfaceRef() const { return (varType() == AstVarType::IFACEREF); }
bool isIfaceRef() const { return (varType() == VVarType::IFACEREF); }
bool isIfaceParent() const { return m_isIfaceParent; }
bool isSignal() const { return varType().isSignal(); }
bool isTemp() const { return varType().isTemp(); }
@ -2225,14 +2224,14 @@ public:
// Wrapper would otherwise duplicate wrapped module's coverage
&& !isSc() && !isPrimaryIO() && !isConst() && !isDouble() && !isString());
}
bool isClassMember() const { return varType() == AstVarType::MEMBER; }
bool isStatementTemp() const { return (varType() == AstVarType::STMTTEMP); }
bool isXTemp() const { return (varType() == AstVarType::XTEMP); }
bool isClassMember() const { return varType() == VVarType::MEMBER; }
bool isStatementTemp() const { return (varType() == VVarType::STMTTEMP); }
bool isXTemp() const { return (varType() == VVarType::XTEMP); }
bool isParam() const {
return (varType() == AstVarType::LPARAM || varType() == AstVarType::GPARAM);
return (varType() == VVarType::LPARAM || varType() == VVarType::GPARAM);
}
bool isGParam() const { return (varType() == AstVarType::GPARAM); }
bool isGenVar() const { return (varType() == AstVarType::GENVAR); }
bool isGParam() const { return (varType() == VVarType::GPARAM); }
bool isGenVar() const { return (varType() == VVarType::GENVAR); }
bool isBitLogic() const {
AstBasicDType* bdtypep = basicp();
return bdtypep && bdtypep->isBitLogic();
@ -2294,8 +2293,8 @@ public:
if (typevarp->attrScClocked()) attrScClocked(true);
}
void inlineAttrReset(const string& name) {
if (direction() == VDirection::INOUT && varType() == AstVarType::WIRE) {
m_varType = AstVarType::TRIWIRE;
if (direction() == VDirection::INOUT && varType() == VVarType::WIRE) {
m_varType = VVarType::TRIWIRE;
}
m_direction = VDirection::NONE;
m_name = name;
@ -3955,17 +3954,17 @@ class AstDisplay final : public AstNodeStmt {
// Children: file which must be a varref
// Children: SFORMATF to generate print string
private:
AstDisplayType m_displayType;
VDisplayType m_displayType;
public:
AstDisplay(FileLine* fl, AstDisplayType dispType, const string& text, AstNode* filep,
AstDisplay(FileLine* fl, VDisplayType dispType, const string& text, AstNode* filep,
AstNode* exprsp, char missingArgChar = 'd')
: ASTGEN_SUPER_Display(fl) {
setOp1p(new AstSFormatF(fl, text, true, exprsp, missingArgChar));
setNOp3p(filep);
m_displayType = dispType;
}
AstDisplay(FileLine* fl, AstDisplayType dispType, AstNode* filep, AstNode* exprsp,
AstDisplay(FileLine* fl, VDisplayType dispType, AstNode* filep, AstNode* exprsp,
char missingArgChar = 'd')
: ASTGEN_SUPER_Display(fl) {
setOp1p(new AstSFormatF(fl, AstSFormatF::NoFormat(), exprsp, missingArgChar));
@ -3993,8 +3992,8 @@ public:
return displayType() == static_cast<const AstDisplay*>(samep)->displayType();
}
virtual int instrCount() const override { return INSTR_COUNT_PLI; }
AstDisplayType displayType() const { return m_displayType; }
void displayType(AstDisplayType type) { m_displayType = type; }
VDisplayType displayType() const { return m_displayType; }
void displayType(VDisplayType type) { m_displayType = type; }
// * = Add a newline for $display
bool addNewline() const { return displayType().addNewline(); }
void fmtp(AstSFormatF* nodep) { addOp1p(nodep); } // op1 = To-String formatter
@ -4030,10 +4029,10 @@ class AstElabDisplay final : public AstNode {
// Parents: stmtlist
// Children: SFORMATF to generate print string
private:
AstDisplayType m_displayType;
VDisplayType m_displayType;
public:
AstElabDisplay(FileLine* fl, AstDisplayType dispType, AstNode* exprsp)
AstElabDisplay(FileLine* fl, VDisplayType dispType, AstNode* exprsp)
: ASTGEN_SUPER_ElabDisplay(fl) {
setOp1p(new AstSFormatF(fl, AstSFormatF::NoFormat(), exprsp));
m_displayType = dispType;
@ -4057,8 +4056,8 @@ public:
return displayType() == static_cast<const AstElabDisplay*>(samep)->displayType();
}
virtual int instrCount() const override { return INSTR_COUNT_PLI; }
AstDisplayType displayType() const { return m_displayType; }
void displayType(AstDisplayType type) { m_displayType = type; }
VDisplayType displayType() const { return m_displayType; }
void displayType(VDisplayType type) { m_displayType = type; }
void fmtp(AstSFormatF* nodep) { addOp1p(nodep); } // op1 = To-String formatter
AstSFormatF* fmtp() const { return VN_AS(op1p(), SFormatF); }
};
@ -4406,7 +4405,7 @@ class AstNodeReadWriteMem VL_NOT_FINAL : public AstNodeStmt {
private:
const bool m_isHex; // readmemh, not readmemb
public:
AstNodeReadWriteMem(AstType t, FileLine* fl, bool hex, AstNode* filenamep, AstNode* memp,
AstNodeReadWriteMem(VNType t, FileLine* fl, bool hex, AstNode* filenamep, AstNode* memp,
AstNode* lsbp, AstNode* msbp)
: AstNodeStmt(t, fl)
, m_isHex(hex) {
@ -5171,15 +5170,15 @@ public:
class AstPragma final : public AstNode {
private:
const AstPragmaType m_pragType; // Type of pragma
const VPragmaType m_pragType; // Type of pragma
public:
// Pragmas don't result in any output code, they're just flags that affect
// other processing in verilator.
AstPragma(FileLine* fl, AstPragmaType pragType)
AstPragma(FileLine* fl, VPragmaType pragType)
: ASTGEN_SUPER_Pragma(fl)
, m_pragType{pragType} {}
ASTNODE_NODE_FUNCS(Pragma)
AstPragmaType pragType() const { return m_pragType; } // *=type of the pragma
VPragmaType pragType() const { return m_pragType; } // *=type of the pragma
virtual bool isPredictOptimizable() const override { return false; }
virtual bool same(const AstNode* samep) const override {
return pragType() == static_cast<const AstPragma*>(samep)->pragType();
@ -5341,8 +5340,8 @@ private:
const VNumRange m_bitRange; // Property of var the trace details
const VNumRange m_arrayRange; // Property of var the trace details
const uint32_t m_codeInc; // Code increment
const AstVarType m_varType; // Type of variable (for localparam vs. param)
const AstBasicDTypeKwd m_declKwd; // Keyword at declaration time
const VVarType m_varType; // Type of variable (for localparam vs. param)
const VBasicDTypeKwd m_declKwd; // Keyword at declaration time
const VDirection m_declDirection; // Declared direction input/output etc
public:
AstTraceDecl(FileLine* fl, const string& showname,
@ -5374,8 +5373,8 @@ public:
uint32_t codeInc() const { return m_codeInc; }
const VNumRange& bitRange() const { return m_bitRange; }
const VNumRange& arrayRange() const { return m_arrayRange; }
AstVarType varType() const { return m_varType; }
AstBasicDTypeKwd declKwd() const { return m_declKwd; }
VVarType varType() const { return m_varType; }
VBasicDTypeKwd declKwd() const { return m_declKwd; }
VDirection declDirection() const { return m_declDirection; }
AstNode* valuep() const { return op1p(); }
};
@ -5473,10 +5472,9 @@ public:
class AstAttrOf final : public AstNode {
private:
// Return a value of a attribute, for example a LSB or array LSB of a signal
AstAttrType m_attrType; // What sort of extraction
VAttrType m_attrType; // What sort of extraction
public:
AstAttrOf(FileLine* fl, AstAttrType attrtype, AstNode* fromp = nullptr,
AstNode* dimp = nullptr)
AstAttrOf(FileLine* fl, VAttrType attrtype, AstNode* fromp = nullptr, AstNode* dimp = nullptr)
: ASTGEN_SUPER_AttrOf(fl) {
setNOp1p(fromp);
setNOp2p(dimp);
@ -5485,7 +5483,7 @@ public:
ASTNODE_NODE_FUNCS(AttrOf)
AstNode* fromp() const { return op1p(); }
AstNode* dimp() const { return op2p(); }
AstAttrType attrType() const { return m_attrType; }
VAttrType attrType() const { return m_attrType; }
virtual void dump(std::ostream& str = std::cout) const override;
};
@ -6374,7 +6372,7 @@ public:
class AstNodeSystemUniop VL_NOT_FINAL : public AstNodeUniop {
public:
AstNodeSystemUniop(AstType t, FileLine* fl, AstNode* lhsp)
AstNodeSystemUniop(VNType t, FileLine* fl, AstNode* lhsp)
: AstNodeUniop(t, fl, lhsp) {
dtypeSetDouble();
}
@ -8253,7 +8251,7 @@ public:
class AstNodeSystemBiop VL_NOT_FINAL : public AstNodeBiop {
public:
AstNodeSystemBiop(AstType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
AstNodeSystemBiop(VNType t, FileLine* fl, AstNode* lhsp, AstNode* rhsp)
: AstNodeBiop(t, fl, lhsp, rhsp) {
dtypeSetDouble();
}
@ -8657,7 +8655,7 @@ private:
const bool m_immediate; // Immediate assertion/cover
string m_name; // Name to report
public:
AstNodeCoverOrAssert(AstType t, FileLine* fl, AstNode* propp, AstNode* passsp, bool immediate,
AstNodeCoverOrAssert(VNType t, FileLine* fl, AstNode* propp, AstNode* passsp, bool immediate,
const string& name = "")
: AstNodeStmt{t, fl}
, m_immediate{immediate}
@ -8725,7 +8723,7 @@ class AstNodeSimpleText VL_NOT_FINAL : public AstNodeText {
private:
bool m_tracking; // When emit, it's ok to parse the string to do indentation
public:
AstNodeSimpleText(AstType t, FileLine* fl, const string& textp, bool tracking = false)
AstNodeSimpleText(VNType t, FileLine* fl, const string& textp, bool tracking = false)
: AstNodeText(t, fl, textp)
, m_tracking(tracking) {}
ASTNODE_BASE_FUNCS(NodeSimpleText)
@ -8838,7 +8836,7 @@ class AstNodeFile VL_NOT_FINAL : public AstNode {
private:
string m_name; ///< Filename
public:
AstNodeFile(AstType t, FileLine* fl, const string& name)
AstNodeFile(VNType t, FileLine* fl, const string& name)
: AstNode(t, fl) {
m_name = name;
}
@ -9265,7 +9263,7 @@ class AstTypeTable final : public AstNode {
AstEmptyQueueDType* m_emptyQueuep = nullptr;
AstQueueDType* m_queueIndexp = nullptr;
AstVoidDType* m_voidp = nullptr;
AstBasicDType* m_basicps[AstBasicDTypeKwd::_ENUM_MAX];
AstBasicDType* m_basicps[VBasicDTypeKwd::_ENUM_MAX];
//
using DetailedMap = std::map<VBasicTypeKey, AstBasicDType*>;
DetailedMap m_detailedMap;
@ -9283,10 +9281,10 @@ public:
virtual void cloneRelink() override { V3ERROR_NA; }
AstNodeDType* typesp() const { return VN_AS(op1p(), NodeDType); } // op1 = List of dtypes
void addTypesp(AstNodeDType* nodep) { addOp1p(nodep); }
AstBasicDType* findBasicDType(FileLine* fl, AstBasicDTypeKwd kwd);
AstBasicDType* findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, int width, int widthMin,
AstBasicDType* findBasicDType(FileLine* fl, VBasicDTypeKwd kwd);
AstBasicDType* findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd, int width, int widthMin,
VSigning numeric);
AstBasicDType* findLogicBitDType(FileLine* fl, AstBasicDTypeKwd kwd, const VNumRange& range,
AstBasicDType* findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd, const VNumRange& range,
int widthMin, VSigning numeric);
AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
AstEmptyQueueDType* findEmptyQueueDType(FileLine* fl);

View File

@ -72,15 +72,15 @@ protected:
AstUserAllocatorBase() {
// This simplifies statically as T_UserN is constant. In C++17, use 'if constexpr'.
if (T_UserN == 1) {
AstUser1InUse::check();
VNUser1InUse::check();
} else if (T_UserN == 2) {
AstUser2InUse::check();
VNUser2InUse::check();
} else if (T_UserN == 3) {
AstUser3InUse::check();
VNUser3InUse::check();
} else if (T_UserN == 4) {
AstUser4InUse::check();
VNUser4InUse::check();
} else {
AstUser5InUse::check();
VNUser5InUse::check();
}
}

View File

@ -41,7 +41,7 @@ private:
// NODE STATE
// Entire netlist:
// AstNodeFTask::user1 -> bool, 1=processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
bool m_anyFuncInBegin = false;
public:
@ -56,7 +56,7 @@ public:
//######################################################################
class BeginVisitor final : public AstNVisitor {
class BeginVisitor final : public VNVisitor {
private:
// STATE
BeginState* const m_statep; // Current global state
@ -271,7 +271,7 @@ public:
//######################################################################
class BeginRelinkVisitor final : public AstNVisitor {
class BeginRelinkVisitor final : public VNVisitor {
// Replace tasks with new pointer
private:
// NODE STATE

View File

@ -35,12 +35,12 @@
//######################################################################
// Branch state, as a visitor of each AstNode
class BranchVisitor final : public AstNVisitor {
class BranchVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist:
// AstFTask::user1() -> int. Number of references
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
int m_likely = false; // Excuses for branch likely taken

View File

@ -140,7 +140,7 @@ bool V3Broken::isLinkable(const AstNode* nodep) { return s_linkableTable.isLinka
//######################################################################
// Mark every node in the tree
class BrokenMarkVisitor final : public AstNVisitor {
class BrokenMarkVisitor final : public VNVisitor {
private:
const uint8_t m_brokenCntCurrent = s_brokenCntGlobal.get();
@ -166,7 +166,7 @@ public:
//######################################################################
// Check every node in tree
class BrokenCheckVisitor final : public AstNVisitor {
class BrokenCheckVisitor final : public VNVisitor {
bool m_inScope = false; // Under AstScope
// Constants for marking we are under/not under a node

View File

@ -36,10 +36,10 @@
// Visit within a module all nodes and data types they reference, finding
// any classes so we can make sure they are defined when Verilated code
// compiles
class CUseVisitor final : public AstNVisitor {
class CUseVisitor final : public VNVisitor {
// NODE STATE
// AstNode::user1() -> bool. True if already visited
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// MEMBERS
bool m_impOnly = false; // In details needed only for implementation

View File

@ -50,7 +50,7 @@
//######################################################################
class CaseLintVisitor final : public AstNVisitor {
class CaseLintVisitor final : public VNVisitor {
private:
const AstNodeCase* m_caseExprp
= nullptr; // Under a CASE value node, if so the relevant case statement
@ -117,12 +117,12 @@ public:
//######################################################################
// Case state, as a visitor of each AstNode
class CaseVisitor final : public AstNVisitor {
class CaseVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared each Case
// AstIf::user3() -> bool. Set true to indicate clone not needed
const AstUser3InUse m_inuser3;
const VNUser3InUse m_inuser3;
// STATE
VDouble0 m_statCaseFast; // Statistic tracking

View File

@ -49,12 +49,12 @@
//######################################################################
// Cast state, as a visitor of each AstNode
class CastVisitor final : public AstNVisitor {
class CastVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist:
// AstNode::user() // bool. Indicates node is of known size
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE

View File

@ -41,7 +41,7 @@ constexpr int CDC_WEIGHT_ASYNC = 0x1000; // Weight for edges that feed async lo
//######################################################################
class CdcBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class CdcBaseVisitor VL_NOT_FINAL : public VNVisitor {
public:
VL_DEBUG_FUNC; // Declare debug()
};
@ -217,9 +217,9 @@ private:
// AstVarScope::user2 -> bool Used in sensitivity list
// {statement}Node::user1p -> CdcLogicVertex* for this statement
// AstNode::user3 -> bool True indicates to print %% (via V3EmitV)
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
// STATE
V3Graph m_graph; // Scoreboard of var usages/dependencies

View File

@ -115,7 +115,7 @@ public:
//######################################################################
// Utility visitor to find elements to be compared
class ChangedInsertVisitor final : public AstNVisitor {
class ChangedInsertVisitor final : public VNVisitor {
private:
// STATE
ChangedState* m_statep = nullptr; // Shared state across visitors
@ -220,7 +220,7 @@ public:
// ...
// CHANGEDET(VARREF(_last), VARREF(var))
AstVar* const newvarp
= new AstVar{varp->fileline(), AstVarType::MODULETEMP, newvarname, varp};
= new AstVar{varp->fileline(), VVarType::MODULETEMP, newvarname, varp};
m_statep->m_topModp->addStmtp(newvarp);
m_newvscp = new AstVarScope{m_vscp->fileline(), m_statep->m_scopetopp, newvarp};
m_statep->m_scopetopp->addVarp(m_newvscp);
@ -241,12 +241,12 @@ public:
//######################################################################
// Changed state, as a visitor of each AstNode
class ChangedVisitor final : public AstNVisitor {
class ChangedVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist:
// AstVarScope::user1() -> bool. True indicates processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
ChangedState* const m_statep; // Shared state across visitors

View File

@ -29,12 +29,12 @@
//######################################################################
class ClassVisitor final : public AstNVisitor {
class ClassVisitor final : public VNVisitor {
private:
// NODE STATE
// AstClass::user1() -> bool. True if iterated already
// AstVar::user1p() -> AstVarScope* Scope used with this var
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// MEMBERS
string m_prefix; // String prefix to add to name based on hier

View File

@ -35,16 +35,16 @@
//######################################################################
// Clean state, as a visitor of each AstNode
class CleanVisitor final : public AstNVisitor {
class CleanVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist:
// AstNode::user() -> CleanState. For this node, 0==UNKNOWN
// AstNode::user2() -> bool. True indicates widthMin has been propagated
// AstNodeDType::user3() -> AstNodeDType*. Alternative node with C size
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
// TYPES
enum CleanState : uint8_t { CS_UNKNOWN, CS_CLEAN, CS_DIRTY };

View File

@ -40,7 +40,7 @@
//######################################################################
// Convert every WRITE AstVarRef to a READ ref
class ConvertWriteRefsToRead final : public AstNVisitor {
class ConvertWriteRefsToRead final : public VNVisitor {
private:
// MEMBERS
AstNode* m_result = nullptr;
@ -68,12 +68,12 @@ public:
//######################################################################
// Clock state, as a visitor of each AstNode
class ClockVisitor final : public AstNVisitor {
class ClockVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared each Module:
// AstVarScope::user1p() -> AstVarScope*. Temporary signal that was created.
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
AstNodeModule* m_modp = nullptr; // Current module
@ -99,7 +99,7 @@ private:
}
const string newvarname
= (string("__Vclklast__") + vscp->scopep()->nameDotless() + "__" + varp->name());
AstVar* const newvarp = new AstVar(vscp->fileline(), AstVarType::MODULETEMP, newvarname,
AstVar* const newvarp = new AstVar(vscp->fileline(), VVarType::MODULETEMP, newvarname,
VFlagLogicPacked(), 1);
newvarp->noReset(true); // Reset by below assign
m_modp->addStmtp(newvarp);

View File

@ -34,7 +34,7 @@
//######################################################################
class CombBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class CombBaseVisitor VL_NOT_FINAL : public VNVisitor {
protected:
// STATE
@ -121,8 +121,8 @@ class CombineVisitor final : CombBaseVisitor {
private:
// NODE STATE
// Entire netlist:
const AstUser3InUse m_user3InUse; // Marks replaced AstCFuncs
// AstUser4InUse part of V3Hasher in V3DupFinder
const VNUser3InUse m_user3InUse; // Marks replaced AstCFuncs
// VNUser4InUse part of V3Hasher in V3DupFinder
// STATE
VDouble0 m_cfuncsCombined; // Statistic tracking

View File

@ -109,7 +109,7 @@ void V3Common::commonAll() {
// NODE STATE
// Entire netlist:
// AstClass::user1() -> bool. True if class needs to_string dumper
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// Create ToString methods
makeVlToString(classp);
makeToString(classp);

View File

@ -85,9 +85,9 @@ public:
// Only public_flat_rw has the sensitity tree
class V3ConfigVarAttr final {
public:
AstAttrType m_type; // Type of attribute
VAttrType m_type; // Type of attribute
AstSenTree* m_sentreep; // Sensitivity tree for public_flat_rw
V3ConfigVarAttr(AstAttrType type, AstSenTree* sentreep)
V3ConfigVarAttr(VAttrType type, AstSenTree* sentreep)
: m_type{type}
, m_sentreep{sentreep} {}
};
@ -105,7 +105,7 @@ public:
for (const_iterator it = begin(); it != end(); ++it) {
AstNode* const newp = new AstAttrOf(varp->fileline(), it->m_type);
varp->addAttrsp(newp);
if (it->m_type == AstAttrType::VAR_PUBLIC_FLAT_RW && it->m_sentreep) {
if (it->m_type == VAttrType::VAR_PUBLIC_FLAT_RW && it->m_sentreep) {
newp->addNext(new AstAlwaysPublic(varp->fileline(), it->m_sentreep, nullptr));
}
}
@ -141,9 +141,9 @@ public:
void apply(AstNodeFTask* ftaskp) const {
if (m_noinline)
ftaskp->addStmtsp(new AstPragma(ftaskp->fileline(), AstPragmaType::NO_INLINE_TASK));
ftaskp->addStmtsp(new AstPragma(ftaskp->fileline(), VPragmaType::NO_INLINE_TASK));
if (m_public)
ftaskp->addStmtsp(new AstPragma(ftaskp->fileline(), AstPragmaType::PUBLIC_TASK));
ftaskp->addStmtsp(new AstPragma(ftaskp->fileline(), VPragmaType::PUBLIC_TASK));
// Only functions can have isolate (return value)
if (VN_IS(ftaskp, Func)) ftaskp->attrIsolateAssign(m_isolate);
}
@ -158,7 +158,7 @@ class V3ConfigModule final {
V3ConfigFTaskResolver m_tasks; // Functions/tasks in module
V3ConfigVarResolver m_vars; // Variables in module
std::unordered_set<std::string> m_coverageOffBlocks; // List of block names for coverage_off
std::set<AstPragmaType> m_modPragmas; // List of Pragmas for modules
std::set<VPragmaType> m_modPragmas; // List of Pragmas for modules
bool m_inline = false; // Whether to force the inline
bool m_inlineValue = false; // The inline value (on/off)
@ -186,12 +186,12 @@ public:
m_inline = true;
m_inlineValue = set;
}
void addModulePragma(AstPragmaType pragma) { m_modPragmas.insert(pragma); }
void addModulePragma(VPragmaType pragma) { m_modPragmas.insert(pragma); }
void apply(AstNodeModule* modp) {
if (m_inline) {
const AstPragmaType type
= m_inlineValue ? AstPragmaType::INLINE_MODULE : AstPragmaType::NO_INLINE_MODULE;
const VPragmaType type
= m_inlineValue ? VPragmaType::INLINE_MODULE : VPragmaType::NO_INLINE_MODULE;
AstNode* const nodep = new AstPragma(modp->fileline(), type);
modp->addStmtp(nodep);
}
@ -202,7 +202,7 @@ public:
}
void applyBlock(AstNodeBlock* nodep) {
const AstPragmaType pragma = AstPragmaType::COVERAGE_BLOCK_OFF;
const VPragmaType pragma = VPragmaType::COVERAGE_BLOCK_OFF;
if (!nodep->unnamed()) {
for (const string& i : m_coverageOffBlocks) {
if (VString::wildmatch(nodep->name(), i)) {
@ -247,7 +247,7 @@ std::ostream& operator<<(std::ostream& os, const V3ConfigIgnoresLine& rhs) {
// Some attributes are attached to entities of the occur on a fileline
// and multiple attributes can be attached to a line
using V3ConfigLineAttribute = std::bitset<AstPragmaType::ENUM_SIZE>;
using V3ConfigLineAttribute = std::bitset<VPragmaType::ENUM_SIZE>;
// File entity
class V3ConfigFile final {
@ -266,7 +266,7 @@ class V3ConfigFile final {
} m_lastIgnore; // Last ignore line run
// Match a given line and attribute to the map, line 0 is any
bool lineMatch(int lineno, AstPragmaType type) {
bool lineMatch(int lineno, VPragmaType type) {
if (m_lineAttrs.find(0) != m_lineAttrs.end() && m_lineAttrs[0][type]) return true;
if (m_lineAttrs.find(lineno) == m_lineAttrs.end()) return false;
return m_lineAttrs[lineno][type];
@ -287,7 +287,7 @@ public:
m_waivers.reserve(m_waivers.size() + file.m_waivers.size());
m_waivers.insert(m_waivers.end(), file.m_waivers.begin(), file.m_waivers.end());
}
void addLineAttribute(int lineno, AstPragmaType attr) { m_lineAttrs[lineno].set(attr); }
void addLineAttribute(int lineno, VPragmaType attr) { m_lineAttrs[lineno].set(attr); }
void addIgnore(V3ErrorCode code, int lineno, bool on) {
m_ignLines.insert(V3ConfigIgnoresLine(code, lineno, on));
m_lastIgnore.it = m_ignLines.begin();
@ -298,7 +298,7 @@ public:
void applyBlock(AstNodeBlock* nodep) {
// Apply to block at this line
const AstPragmaType pragma = AstPragmaType::COVERAGE_BLOCK_OFF;
const VPragmaType pragma = VPragmaType::COVERAGE_BLOCK_OFF;
if (lineMatch(nodep->fileline()->lineno(), pragma)) {
nodep->addStmtsp(new AstPragma(nodep->fileline(), pragma));
}
@ -306,8 +306,8 @@ public:
void applyCase(AstCase* nodep) {
// Apply to this case at this line
const int lineno = nodep->fileline()->lineno();
if (lineMatch(lineno, AstPragmaType::FULL_CASE)) nodep->fullPragma(true);
if (lineMatch(lineno, AstPragmaType::PARALLEL_CASE)) nodep->parallelPragma(true);
if (lineMatch(lineno, VPragmaType::FULL_CASE)) nodep->fullPragma(true);
if (lineMatch(lineno, VPragmaType::PARALLEL_CASE)) nodep->parallelPragma(true);
}
inline void applyIgnores(FileLine* filelinep) {
// HOT routine, called each parsed token line of this filename
@ -383,17 +383,17 @@ V3ConfigResolver V3ConfigResolver::s_singleton;
void V3Config::addCaseFull(const string& filename, int lineno) {
V3ConfigFile& file = V3ConfigResolver::s().files().at(filename);
file.addLineAttribute(lineno, AstPragmaType::FULL_CASE);
file.addLineAttribute(lineno, VPragmaType::FULL_CASE);
}
void V3Config::addCaseParallel(const string& filename, int lineno) {
V3ConfigFile& file = V3ConfigResolver::s().files().at(filename);
file.addLineAttribute(lineno, AstPragmaType::PARALLEL_CASE);
file.addLineAttribute(lineno, VPragmaType::PARALLEL_CASE);
}
void V3Config::addCoverageBlockOff(const string& filename, int lineno) {
V3ConfigFile& file = V3ConfigResolver::s().files().at(filename);
file.addLineAttribute(lineno, AstPragmaType::COVERAGE_BLOCK_OFF);
file.addLineAttribute(lineno, VPragmaType::COVERAGE_BLOCK_OFF);
}
void V3Config::addCoverageBlockOff(const string& module, const string& blockname) {
@ -422,7 +422,7 @@ void V3Config::addInline(FileLine* fl, const string& module, const string& ftask
}
}
void V3Config::addModulePragma(const string& module, AstPragmaType pragma) {
void V3Config::addModulePragma(const string& module, VPragmaType pragma) {
V3ConfigResolver::s().modules().at(module).addModulePragma(pragma);
}
@ -432,25 +432,25 @@ void V3Config::addProfileData(FileLine* fl, const string& model, const string& k
}
void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftask,
const string& var, AstAttrType attr, AstSenTree* sensep) {
const string& var, VAttrType attr, AstSenTree* sensep) {
// Semantics: sensep only if public_flat_rw
if ((attr != AstAttrType::VAR_PUBLIC_FLAT_RW) && sensep) {
if ((attr != VAttrType::VAR_PUBLIC_FLAT_RW) && sensep) {
sensep->v3error("sensitivity not expected for attribute");
return;
}
// Semantics: Most of the attributes operate on signals
if (var.empty()) {
if (attr == AstAttrType::VAR_ISOLATE_ASSIGNMENTS) {
if (attr == VAttrType::VAR_ISOLATE_ASSIGNMENTS) {
if (ftask.empty()) {
fl->v3error("isolate_assignments only applies to signals or functions/tasks");
} else {
V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setIsolate(true);
}
} else if (attr == AstAttrType::VAR_PUBLIC) {
} else if (attr == VAttrType::VAR_PUBLIC) {
if (ftask.empty()) {
// public module, this is the only exception from var here
V3ConfigResolver::s().modules().at(module).addModulePragma(
AstPragmaType::PUBLIC_MODULE);
VPragmaType::PUBLIC_MODULE);
} else {
V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setPublic(true);
}

View File

@ -34,12 +34,12 @@ public:
static void addCoverageBlockOff(const string& module, const string& blockname);
static void addIgnore(V3ErrorCode code, bool on, const string& filename, int min, int max);
static void addInline(FileLine* fl, const string& module, const string& ftask, bool on);
static void addModulePragma(const string& module, AstPragmaType pragma);
static void addModulePragma(const string& module, VPragmaType pragma);
static void addProfileData(FileLine* fl, const string& model, const string& key,
vluint64_t cost);
static void addWaiver(V3ErrorCode code, const string& filename, const string& message);
static void addVarAttr(FileLine* fl, const string& module, const string& ftask,
const string& signal, AstAttrType type, AstSenTree* nodep);
const string& signal, VAttrType type, AstSenTree* nodep);
static void applyCase(AstCase* nodep);
static void applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep);

View File

@ -38,7 +38,7 @@
//######################################################################
// Utilities
class ConstVarMarkVisitor final : public AstNVisitor {
class ConstVarMarkVisitor final : public VNVisitor {
// NODE STATE
// AstVar::user4p -> bool, Var marked, 0=not set yet
private:
@ -57,7 +57,7 @@ public:
virtual ~ConstVarMarkVisitor() override = default;
};
class ConstVarFindVisitor final : public AstNVisitor {
class ConstVarFindVisitor final : public VNVisitor {
// NODE STATE
// AstVar::user4p -> bool, input from ConstVarMarkVisitor
// MEMBERS
@ -106,11 +106,11 @@ static int countTrailingZeroes(uint64_t val) {
// This visitor can be used in the post-expanded Ast from V3Expand, where the Ast satisfies:
// - Constants are 64 bit at most (because words are accessed via AstWordSel)
// - Variables are scoped.
class ConstBitOpTreeVisitor final : public AstNVisitor {
class ConstBitOpTreeVisitor final : public VNVisitor {
// NODE STATE
// AstVarRef::user4u -> Base index of m_varInfos that points VarInfo
// AstVarScope::user4u -> Same as AstVarRef::user4
const AstUser4InUse m_inuser4;
const VNUser4InUse m_inuser4;
// TYPES
@ -806,7 +806,7 @@ public:
//######################################################################
// Const state, as a visitor of each AstNode
class ConstVisitor final : public AstNVisitor {
class ConstVisitor final : public VNVisitor {
private:
// NODE STATE
// ** only when m_warn/m_doExpensive is set. If state is needed other times,
@ -1978,7 +1978,7 @@ private:
if (m_warn && !VN_IS(nodep, AssignDly)) { // Is same var on LHS and RHS?
// Note only do this (need user4) when m_warn, which is
// done as unique visitor
const AstUser4InUse m_inuser4;
const VNUser4InUse m_inuser4;
const ConstVarMarkVisitor mark{nodep->lhsp()};
const ConstVarFindVisitor find{nodep->rhsp()};
if (find.found()) need_temp = true;
@ -2029,10 +2029,10 @@ private:
// We could create just one temp variable, but we'll get better optimization
// if we make one per term.
AstVar* const temp1p
= new AstVar(sel1p->fileline(), AstVarType::BLOCKTEMP,
= new AstVar(sel1p->fileline(), VVarType::BLOCKTEMP,
m_concswapNames.get(sel1p), VFlagLogicPacked(), msb1 - lsb1 + 1);
AstVar* const temp2p
= new AstVar(sel2p->fileline(), AstVarType::BLOCKTEMP,
= new AstVar(sel2p->fileline(), VVarType::BLOCKTEMP,
m_concswapNames.get(sel2p), VFlagLogicPacked(), msb2 - lsb2 + 1);
m_modp->addStmtp(temp1p);
m_modp->addStmtp(temp2p);
@ -2698,7 +2698,7 @@ private:
// SENGATE(SENITEM(x)) -> SENITEM(x), then let it collapse with the
// other SENITEM(x).
{
const AstUser4InUse m_inuse4;
const VNUser4InUse m_inuse4;
// Mark x in SENITEM(x)
for (AstSenItem* senp = nodep->sensesp(); senp;
senp = VN_AS(senp->nextp(), SenItem)) {
@ -2900,10 +2900,10 @@ private:
AstDisplay* const prevp = VN_CAST(nodep->backp(), Display);
if (!prevp) return false;
if (!((prevp->displayType() == nodep->displayType())
|| (prevp->displayType() == AstDisplayType::DT_WRITE
&& nodep->displayType() == AstDisplayType::DT_DISPLAY)
|| (prevp->displayType() == AstDisplayType::DT_DISPLAY
&& nodep->displayType() == AstDisplayType::DT_WRITE)))
|| (prevp->displayType() == VDisplayType::DT_WRITE
&& nodep->displayType() == VDisplayType::DT_DISPLAY)
|| (prevp->displayType() == VDisplayType::DT_DISPLAY
&& nodep->displayType() == VDisplayType::DT_WRITE)))
return false;
if ((prevp->filep() && !nodep->filep()) || (!prevp->filep() && nodep->filep())
|| !prevp->filep()->sameTree(nodep->filep()))
@ -2928,8 +2928,8 @@ private:
//
UINFO(9, "DISPLAY(SF({a})) DISPLAY(SF({b})) -> DISPLAY(SF({a}+{b}))" << endl);
// Convert DT_DISPLAY to DT_WRITE as may allow later optimizations
if (prevp->displayType() == AstDisplayType::DT_DISPLAY) {
prevp->displayType(AstDisplayType::DT_WRITE);
if (prevp->displayType() == VDisplayType::DT_DISPLAY) {
prevp->displayType(VDisplayType::DT_WRITE);
pformatp->text(pformatp->text() + "\n");
}
// We can't replace prev() as the edit tracking iterators will get confused.

View File

@ -37,7 +37,7 @@
//######################################################################
// Coverage state, as a visitor of each AstNode
class CoverageVisitor final : public AstNVisitor {
class CoverageVisitor final : public VNVisitor {
private:
// TYPES
using LinenoSet = std::set<int>;
@ -73,7 +73,7 @@ private:
// NODE STATE
// Entire netlist:
// AstIf::user1() -> bool. True indicates ifelse processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
CheckState m_state; // State save-restored on each new coverage scope/block
@ -123,8 +123,8 @@ private:
AstCoverInc* const incp = new AstCoverInc(fl, declp);
if (!trace_var_name.empty() && v3Global.opt.traceCoverage()) {
AstVar* const varp = new AstVar(incp->fileline(), AstVarType::MODULETEMP,
trace_var_name, incp->findUInt32DType());
AstVar* const varp = new AstVar(incp->fileline(), VVarType::MODULETEMP, trace_var_name,
incp->findUInt32DType());
varp->trace(true);
varp->fileline()->modifyWarnOff(V3ErrorCode::UNUSED, true);
m_modp->addStmtp(varp);
@ -280,7 +280,7 @@ private:
// Add signal to hold the old value
const string newvarname = string("__Vtogcov__") + nodep->shortName();
AstVar* const chgVarp
= new AstVar(nodep->fileline(), AstVarType::MODULETEMP, newvarname, nodep);
= new AstVar(nodep->fileline(), VVarType::MODULETEMP, newvarname, nodep);
chgVarp->fileline()->modifyWarnOff(V3ErrorCode::UNUSED, true);
m_modp->addStmtp(chgVarp);
@ -498,7 +498,7 @@ private:
m_state.m_on = false;
}
virtual void visit(AstPragma* nodep) override {
if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
if (nodep->pragType() == VPragmaType::COVERAGE_BLOCK_OFF) {
// Skip all NEXT nodes under this block, and skip this if/case branch
UINFO(4, " OFF: h" << m_state.m_handle << " " << nodep << endl);
m_state.m_on = false;

View File

@ -30,10 +30,10 @@
//######################################################################
// CoverageJoin state, as a visitor of each AstNode
class CoverageJoinVisitor final : public AstNVisitor {
class CoverageJoinVisitor final : public VNVisitor {
private:
// NODE STATE
// AstUser4InUse In V3Hasher via V3DupFinder
// VNUser4InUse In V3Hasher via V3DupFinder
// STATE
std::vector<AstCoverToggle*> m_toggleps; // List of of all AstCoverToggle's

View File

@ -45,7 +45,7 @@
//######################################################################
class DeadModVisitor final : public AstNVisitor {
class DeadModVisitor final : public VNVisitor {
// In a module that is dead, cleanup the in-use counts of the modules
private:
// NODE STATE
@ -68,7 +68,7 @@ public:
//######################################################################
// Dead state, as a visitor of each AstNode
class DeadVisitor final : public AstNVisitor {
class DeadVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire Netlist:
@ -76,7 +76,7 @@ private:
// AstVar::user1() -> int. Count of number of references
// AstVarScope::user1() -> int. Count of number of references
// AstNodeDType::user1() -> int. Count of number of references
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// TYPES
using AssignMap = std::multimap<AstVarScope*, AstNodeAssign*>;

View File

@ -63,7 +63,7 @@
//######################################################################
// Delayed state, as a visitor of each AstNode
class DelayedVisitor final : public AstNVisitor {
class DelayedVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared each module:
@ -81,11 +81,11 @@ private:
// Cleared each scope/active:
// AstAssignDly::user3() -> AstVarScope*. __Vdlyvset__ created for this assign
// AstAlwaysPost::user3() -> AstVarScope*. __Vdlyvset__ last referenced in IF
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const AstUser5InUse m_inuser5;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
const VNUser5InUse m_inuser5;
// STATE
AstActive* m_activep = nullptr; // Current activate
@ -139,13 +139,13 @@ private:
varp = it->second;
} else {
if (newdtypep) {
varp = new AstVar(oldvarscp->fileline(), AstVarType::BLOCKTEMP, name, newdtypep);
varp = new AstVar(oldvarscp->fileline(), VVarType::BLOCKTEMP, name, newdtypep);
} else if (width == 0) {
varp = new AstVar(oldvarscp->fileline(), AstVarType::BLOCKTEMP, name,
varp = new AstVar(oldvarscp->fileline(), VVarType::BLOCKTEMP, name,
oldvarscp->varp());
varp->dtypeFrom(oldvarscp);
} else { // Used for vset and dimensions, so can zero init
varp = new AstVar(oldvarscp->fileline(), AstVarType::BLOCKTEMP, name,
varp = new AstVar(oldvarscp->fileline(), VVarType::BLOCKTEMP, name,
VFlagBitPacked(), width);
}
addmodp->addStmtp(varp);

View File

@ -35,7 +35,7 @@
//######################################################################
class DepthVisitor final : public AstNVisitor {
class DepthVisitor final : public VNVisitor {
private:
// NODE STATE
@ -52,7 +52,7 @@ private:
void createDeepTemp(AstNode* nodep) {
UINFO(6, " Deep " << nodep << endl);
// if (debug() >= 9) nodep->dumpTree(cout, "deep:");
AstVar* const varp = new AstVar{nodep->fileline(), AstVarType::STMTTEMP,
AstVar* const varp = new AstVar{nodep->fileline(), VVarType::STMTTEMP,
m_tempNames.get(nodep), nodep->dtypep()};
UASSERT_OBJ(m_cfuncp, nodep, "Deep expression not under a function");
m_cfuncp->addInitsp(varp);

View File

@ -32,7 +32,7 @@
//######################################################################
class DepthBlockVisitor final : public AstNVisitor {
class DepthBlockVisitor final : public VNVisitor {
private:
// NODE STATE

View File

@ -34,12 +34,12 @@
//######################################################################
class DescopeVisitor final : public AstNVisitor {
class DescopeVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared entire netlist
// AstCFunc::user() // bool. Indicates processing completed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// TYPES
using FuncMmap = std::multimap<std::string, AstCFunc*>;
@ -168,7 +168,7 @@ private:
// Not really any way the user could do this, and we'd need
// to come up with some return value
// newfuncp->addStmtsp(new AstDisplay(newfuncp->fileline(),
// AstDisplayType::DT_WARNING,
// VDisplayType::DT_WARNING,
// string("%%Error: ")+name+"() called with bad
// scope", nullptr));
// newfuncp->addStmtsp(new AstStop(newfuncp->fileline()));

View File

@ -234,7 +234,7 @@ void EmitCBaseVisitor::emitModCUse(const AstNodeModule* modp, VUseType useType)
puts(nl);
}
void EmitCBaseVisitor::emitTextSection(const AstNodeModule* modp, AstType type) {
void EmitCBaseVisitor::emitTextSection(const AstNodeModule* modp, VNType type) {
int last_line = -999;
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
if (const AstNodeText* const textp = VN_CAST(nodep, NodeText)) {

View File

@ -34,7 +34,7 @@ class EmitCParentModule final {
// NODE STATE
// AstFunc::user4p() AstNodeModule* Parent module pointer
// AstVar::user4p() AstNodeModule* Parent module pointer
const AstUser4InUse user4InUse;
const VNUser4InUse user4InUse;
public:
EmitCParentModule();
@ -48,7 +48,7 @@ public:
//######################################################################
// Base Visitor class -- holds output file pointer
class EmitCBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class EmitCBaseVisitor VL_NOT_FINAL : public VNVisitor {
public:
// STATE
V3OutCFile* m_ofp = nullptr;
@ -106,7 +106,7 @@ public:
void emitCFuncDecl(const AstCFunc* funcp, const AstNodeModule* modp, bool cLinkage = false);
void emitVarDecl(const AstVar* nodep, bool asRef = false);
void emitModCUse(const AstNodeModule* modp, VUseType useType);
void emitTextSection(const AstNodeModule* modp, AstType type);
void emitTextSection(const AstNodeModule* modp, VNType type);
// CONSTRUCTORS
EmitCBaseVisitor() = default;
@ -116,7 +116,7 @@ public:
//######################################################################
// Count operations under the given node, as a visitor of each AstNode
class EmitCBaseCounterVisitor final : public AstNVisitor {
class EmitCBaseCounterVisitor final : public VNVisitor {
private:
// MEMBERS
int m_count = 0; // Number of statements

View File

@ -307,7 +307,7 @@ void EmitCFunc::displayArg(AstNode* dispp, AstNode** elistp, bool isScan, const
}
emitDispState.pushFormat(pfmt);
if (!ignore) {
if (argp->dtypep()->basicp()->keyword() == AstBasicDTypeKwd::STRING) {
if (argp->dtypep()->basicp()->keyword() == VBasicDTypeKwd::STRING) {
// string in SystemVerilog is std::string in C++ which is not POD
emitDispState.pushArg(' ', nullptr, "-1");
} else {
@ -684,7 +684,7 @@ string EmitCFunc::emitVarResetRecurse(const AstVar* varp, const string& varNameP
depth + 1, suffix + "[" + ivar + "]");
const string post = "}\n";
return below.empty() ? "" : pre + below + post;
} else if (basicp && basicp->keyword() == AstBasicDTypeKwd::STRING) {
} else if (basicp && basicp->keyword() == VBasicDTypeKwd::STRING) {
// String's constructor deals with it
return "";
} else if (basicp) {

View File

@ -34,10 +34,10 @@ constexpr int EMITC_NUM_CONSTW = 8;
//######################################################################
// Emit lazy forward declarations
class EmitCLazyDecls final : public AstNVisitor {
class EmitCLazyDecls final : public VNVisitor {
// NODE STATE/TYPES
// AstNode::user2() -> bool. Already emitted decl for symbols.
const AstUser2InUse m_inuser2;
const VNUser2InUse m_inuser2;
// MEMBERS
std::unordered_set<string> m_emittedManually; // Set of names already declared manually.

View File

@ -243,7 +243,7 @@ class EmitCHeader final : public EmitCConstInit {
emitModCUse(modp, VUseType::INT_FWD_CLASS);
// From `systemc_header
emitTextSection(modp, AstType::atScHdr);
emitTextSection(modp, VNType::atScHdr);
// Open class body {{{
if (const AstClass* const classp = VN_CAST(modp, Class)) {
@ -271,7 +271,7 @@ class EmitCHeader final : public EmitCConstInit {
emitFuncDecls(modp, /* inClassBody: */ true);
// From `systemc_interface
emitTextSection(modp, AstType::atScInt);
emitTextSection(modp, VNType::atScInt);
// Close class body
if (!VN_IS(modp, Class)) {

View File

@ -31,7 +31,7 @@
//######################################################################
// Visitor that gathers the headers required by an AstCFunc
class EmitCGatherDependencies final : AstNVisitor {
class EmitCGatherDependencies final : VNVisitor {
// Ordered set, as it is used as a key in another map.
std::set<string> m_dependencies; // Header names to be included in output C++ file
@ -186,7 +186,7 @@ class EmitCImp final : EmitCFunc {
puts("\n");
for (const string& name : headers) puts("#include \"" + name + ".h\"\n");
emitTextSection(m_modp, AstType::atScImpHdr);
emitTextSection(m_modp, VNType::atScImpHdr);
}
void emitStaticVarDefns(const AstNodeModule* modp) {
@ -266,7 +266,7 @@ class EmitCImp final : EmitCFunc {
putsDecoration("// Reset structure values\n");
puts(modName + "__" + protect("_ctor_var_reset") + "(this);\n");
emitTextSection(modp, AstType::atScCtor);
emitTextSection(modp, VNType::atScCtor);
puts("}\n");
}
@ -329,7 +329,7 @@ class EmitCImp final : EmitCFunc {
void emitDestructorImp(const AstNodeModule* modp) {
puts("\n");
puts(prefixNameProtect(modp) + "::~" + prefixNameProtect(modp) + "() {\n");
emitTextSection(modp, AstType::atScDtor);
emitTextSection(modp, VNType::atScDtor);
puts("}\n");
splitSizeInc(10);
}
@ -395,7 +395,7 @@ class EmitCImp final : EmitCFunc {
// Want to detect types that are represented as arrays
// (i.e. packed types of more than 64 bits).
if (elementp->isWide()
&& !(basicp && basicp->keyword() == AstBasicDTypeKwd::STRING)) {
&& !(basicp && basicp->keyword() == VBasicDTypeKwd::STRING)) {
const int vecnum = vects++;
const string ivar = string("__Vi") + cvtToStr(vecnum);
puts("for (int __Vi" + cvtToStr(vecnum) + "=" + cvtToStr(0));
@ -441,7 +441,7 @@ class EmitCImp final : EmitCFunc {
emitCoverageImp();
} else {
// From `systemc_implementation
emitTextSection(modp, AstType::atScImp);
emitTextSection(modp, VNType::atScImp);
}
}
void emitCommonImp(const AstNodeModule* modp) {
@ -556,7 +556,7 @@ class EmitCTrace final : EmitCFunc {
// NODE STATE/TYPES
// Cleared on netlist
// AstNode::user1() -> int. Enum number
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// MEMBERS
const bool m_slow; // Making slow file
@ -647,35 +647,35 @@ class EmitCTrace final : EmitCFunc {
}
//
// fstVarType
const AstVarType vartype = nodep->varType();
const AstBasicDTypeKwd kwd = nodep->declKwd();
const VVarType vartype = nodep->varType();
const VBasicDTypeKwd kwd = nodep->declKwd();
string fstvt;
// Doubles have special decoding properties, so must indicate if a double
if (nodep->dtypep()->basicp()->isDouble()) {
if (vartype == AstVarType::GPARAM || vartype == AstVarType::LPARAM) {
if (vartype == VVarType::GPARAM || vartype == VVarType::LPARAM) {
fstvt = "FST_VT_VCD_REAL_PARAMETER";
} else {
fstvt = "FST_VT_VCD_REAL";
}
}
// clang-format off
else if (vartype == AstVarType::GPARAM) { fstvt = "FST_VT_VCD_PARAMETER"; }
else if (vartype == AstVarType::LPARAM) { fstvt = "FST_VT_VCD_PARAMETER"; }
else if (vartype == AstVarType::SUPPLY0) { fstvt = "FST_VT_VCD_SUPPLY0"; }
else if (vartype == AstVarType::SUPPLY1) { fstvt = "FST_VT_VCD_SUPPLY1"; }
else if (vartype == AstVarType::TRI0) { fstvt = "FST_VT_VCD_TRI0"; }
else if (vartype == AstVarType::TRI1) { fstvt = "FST_VT_VCD_TRI1"; }
else if (vartype == AstVarType::TRIWIRE) { fstvt = "FST_VT_VCD_TRI"; }
else if (vartype == AstVarType::WIRE) { fstvt = "FST_VT_VCD_WIRE"; }
else if (vartype == AstVarType::PORT) { fstvt = "FST_VT_VCD_WIRE"; }
else if (vartype == VVarType::GPARAM) { fstvt = "FST_VT_VCD_PARAMETER"; }
else if (vartype == VVarType::LPARAM) { fstvt = "FST_VT_VCD_PARAMETER"; }
else if (vartype == VVarType::SUPPLY0) { fstvt = "FST_VT_VCD_SUPPLY0"; }
else if (vartype == VVarType::SUPPLY1) { fstvt = "FST_VT_VCD_SUPPLY1"; }
else if (vartype == VVarType::TRI0) { fstvt = "FST_VT_VCD_TRI0"; }
else if (vartype == VVarType::TRI1) { fstvt = "FST_VT_VCD_TRI1"; }
else if (vartype == VVarType::TRIWIRE) { fstvt = "FST_VT_VCD_TRI"; }
else if (vartype == VVarType::WIRE) { fstvt = "FST_VT_VCD_WIRE"; }
else if (vartype == VVarType::PORT) { fstvt = "FST_VT_VCD_WIRE"; }
//
else if (kwd == AstBasicDTypeKwd::INTEGER) { fstvt = "FST_VT_VCD_INTEGER"; }
else if (kwd == AstBasicDTypeKwd::BIT) { fstvt = "FST_VT_SV_BIT"; }
else if (kwd == AstBasicDTypeKwd::LOGIC) { fstvt = "FST_VT_SV_LOGIC"; }
else if (kwd == AstBasicDTypeKwd::INT) { fstvt = "FST_VT_SV_INT"; }
else if (kwd == AstBasicDTypeKwd::SHORTINT) { fstvt = "FST_VT_SV_SHORTINT"; }
else if (kwd == AstBasicDTypeKwd::LONGINT) { fstvt = "FST_VT_SV_LONGINT"; }
else if (kwd == AstBasicDTypeKwd::BYTE) { fstvt = "FST_VT_SV_BYTE"; }
else if (kwd == VBasicDTypeKwd::INTEGER) { fstvt = "FST_VT_VCD_INTEGER"; }
else if (kwd == VBasicDTypeKwd::BIT) { fstvt = "FST_VT_SV_BIT"; }
else if (kwd == VBasicDTypeKwd::LOGIC) { fstvt = "FST_VT_SV_LOGIC"; }
else if (kwd == VBasicDTypeKwd::INT) { fstvt = "FST_VT_SV_INT"; }
else if (kwd == VBasicDTypeKwd::SHORTINT) { fstvt = "FST_VT_SV_SHORTINT"; }
else if (kwd == VBasicDTypeKwd::LONGINT) { fstvt = "FST_VT_SV_LONGINT"; }
else if (kwd == VBasicDTypeKwd::BYTE) { fstvt = "FST_VT_SV_BYTE"; }
else { fstvt = "FST_VT_SV_BIT"; }
// clang-format on
//

View File

@ -34,7 +34,7 @@ class EmitCSyms final : EmitCBaseVisitor {
// NODE STATE
// Cleared on Netlist
// AstNodeModule::user1() -> bool. Set true __Vconfigure called
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// TYPES
struct ScopeData {

View File

@ -824,7 +824,7 @@ public:
AstSenTree* domainp, bool user3mark)
: EmitVBaseVisitor{false, domainp}
, m_formatter{os, prefix, flWidth} {
if (user3mark) AstUser3InUse::check();
if (user3mark) VNUser3InUse::check();
iterate(nodep);
}
virtual ~EmitVPrefixedVisitor() override = default;

View File

@ -28,7 +28,7 @@
//######################################################################
// Emit statements and math operators
class EmitXmlFileVisitor final : public AstNVisitor {
class EmitXmlFileVisitor final : public VNVisitor {
// NODE STATE
// Entire netlist:
// AstNode::user1 -> uint64_t, number to connect crossrefs
@ -184,7 +184,7 @@ class EmitXmlFileVisitor final : public AstNVisitor {
outputChildrenEnd(nodep, "");
}
virtual void visit(AstVar* nodep) override {
const AstVarType typ = nodep->varType();
const VVarType typ = nodep->varType();
const string kw = nodep->verilogKwd();
const string vt = nodep->dtypep()->name();
outputTag(nodep, "");
@ -193,7 +193,7 @@ class EmitXmlFileVisitor final : public AstNVisitor {
putsQuoted(kw);
if (nodep->pinNum() != 0) puts(" pinIndex=\"" + cvtToStr(nodep->pinNum()) + "\"");
puts(" vartype=");
putsQuoted(!vt.empty() ? vt : typ == AstVarType::PORT ? "port" : "unknown");
putsQuoted(!vt.empty() ? vt : typ == VVarType::PORT ? "port" : "unknown");
} else {
puts(" vartype=");
putsQuoted(!vt.empty() ? vt : kw);
@ -321,7 +321,7 @@ public:
//######################################################################
// List of module files xml visitor
class ModuleFilesXmlVisitor final : public AstNVisitor {
class ModuleFilesXmlVisitor final : public VNVisitor {
private:
// MEMBERS
std::ostream& m_os;
@ -369,7 +369,7 @@ public:
//######################################################################
// Hierarchy of Cells visitor
class HierCellsXmlVisitor final : public AstNVisitor {
class HierCellsXmlVisitor final : public VNVisitor {
private:
// MEMBERS
std::ostream& m_os;

View File

@ -38,11 +38,11 @@
//######################################################################
// Expand state, as a visitor of each AstNode
class ExpandVisitor final : public AstNVisitor {
class ExpandVisitor final : public VNVisitor {
private:
// NODE STATE
// AstNode::user1() -> bool. Processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
AstNode* m_stmtp = nullptr; // Current statement

View File

@ -52,7 +52,7 @@
//######################################################################
// Force shared state
class ForceBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class ForceBaseVisitor VL_NOT_FINAL : public VNVisitor {
// TYPES
public:
// Enum value must correspond to which user#p is used
@ -99,7 +99,7 @@ public:
<< nodep->warnMore()
<< "... Suggest assign it to/from a temporary net and force/release that");
}
auto* const newp = new AstVar{nodep->fileline(), AstVarType::MODULETEMP,
auto* const newp = new AstVar{nodep->fileline(), VVarType::MODULETEMP,
nodep->name() + fvarName(fvar), nodep};
newp->user1(true);
UINFO(9, "getForceVar for " << nodep << endl);
@ -189,10 +189,10 @@ class ForceVisitor final : public ForceBaseVisitor {
private:
// NODE STATE
// See ForceBaseVisitor
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
// STATE
bool m_anyForce = false; // Any force, need reconciliation step

View File

@ -43,7 +43,7 @@ constexpr int GATE_DEDUP_MAX_DEPTH = 20;
//######################################################################
class GateBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class GateBaseVisitor VL_NOT_FINAL : public VNVisitor {
public:
VL_DEBUG_FUNC; // Declare debug()
};
@ -309,8 +309,8 @@ private:
// AstVarScope::user2 -> bool: Signal used in SenItem in *this* always statement
// AstVar::user2 -> bool: Warned about SYNCASYNCNET
// AstNodeVarRef::user2 -> bool: ConcatOffset visited
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// STATE
V3Graph m_graph; // Scoreboard of var usages/dependencies
@ -905,11 +905,11 @@ private:
// Set to nullptr if this assign's tree was later replaced
// Ast*::user5p -> AstNode* of assign if condition, for isSame() in test for duplicate
// Set to nullptr if this assign's tree was later replaced
// AstUser1InUse m_inuser1; (Allocated for use in GateVisitor)
// AstUser2InUse m_inuser2; (Allocated for use in GateVisitor)
const AstUser3InUse m_inuser3;
// AstUser4InUse m_inuser4; (Allocated for use in V3Hasher via V3DupFinder)
const AstUser5InUse m_inuser5;
// VNUser1InUse m_inuser1; (Allocated for use in GateVisitor)
// VNUser2InUse m_inuser2; (Allocated for use in GateVisitor)
const VNUser3InUse m_inuser3;
// VNUser4InUse m_inuser4; (Allocated for use in V3Hasher via V3DupFinder)
const VNUser5InUse m_inuser5;
V3DupFinder m_dupFinder; // Duplicate finder for rhs of assigns
std::unordered_set<AstNode*> m_nodeDeleteds; // Any node in this hash was deleted
@ -1125,7 +1125,7 @@ class GateDedupeGraphVisitor final : public GateGraphBaseVisitor {
private:
// NODE STATE
// AstVarScope::user2p -> bool: already visited
// AstUser2InUse m_inuser2; (Allocated for use in GateVisitor)
// VNUser2InUse m_inuser2; (Allocated for use in GateVisitor)
VDouble0 m_numDeduped; // Statistic tracking
GateDedupeVarVisitor m_varVisitor; // Looks for a dupe of the logic
int m_depth = 0; // Iteration depth

View File

@ -29,7 +29,7 @@
//######################################################################
// GenClk state, as a visitor of each AstNode
class GenClkBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class GenClkBaseVisitor VL_NOT_FINAL : public VNVisitor {
protected:
VL_DEBUG_FUNC; // Declare debug()
};
@ -43,8 +43,8 @@ private:
// Cleared on top scope
// AstVarScope::user2() -> AstVarScope*. Signal replacing activation with
// AstVarRef::user3() -> bool. Signal is replaced activation (already done)
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
// STATE
const AstActive* m_activep = nullptr; // Inside activate statement
@ -76,7 +76,7 @@ private:
// ...
// ASSIGN(VARREF(inpclk), VARREF(var))
AstVar* const newvarp
= new AstVar(varp->fileline(), AstVarType::MODULETEMP, newvarname, varp);
= new AstVar(varp->fileline(), VVarType::MODULETEMP, newvarname, varp);
m_topModp->addStmtp(newvarp);
AstVarScope* const newvscp = new AstVarScope(vscp->fileline(), m_scopetopp, newvarp);
m_scopetopp->addVarp(newvscp);
@ -141,7 +141,7 @@ private:
// NODE STATE
// Cleared on top scope
// AstVarScope::user() -> bool. Set when the var has been used as clock
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
bool m_tracingCall = false; // Iterating into a call to a cfunc

View File

@ -46,7 +46,7 @@ void V3Global::checkTree() const { rootp()->checkTree(); }
void V3Global::readFiles() {
// NODE STATE
// AstNode::user4p() // VSymEnt* Package and typedef symbol names
const AstUser4InUse inuser4;
const VNUser4InUse inuser4;
VInFilter filter(v3Global.opt.pipeFilter());
V3ParseSym parseSyms(v3Global.rootp()); // Symbol table must be common across all parsing

View File

@ -24,11 +24,11 @@
//######################################################################
// Visitor that computes node hashes
class HasherVisitor final : public AstNVisitor {
class HasherVisitor final : public VNVisitor {
private:
// NODE STATE
// AstNode::user4() -> V3Hash. Hash value of this node (hash of 0 is illegal)
// AstUser4InUse in V3Hasher.h
// VNUser4InUse in V3Hasher.h
// STATE
V3Hash m_hash; // Hash value accumulator

View File

@ -32,7 +32,7 @@
class V3Hasher final {
// NODE STATE
// AstNode::user4() -> V3Hash. Hash value of this node (hash of 0 is illegal)
const AstUser4InUse m_inuser4;
const VNUser4InUse m_inuser4;
public:
// CONSTRUCTORS

View File

@ -36,7 +36,7 @@
// Then user can build Verilated module as usual.
//
// Here is more detailed internal process.
// 1) Parser adds AstPragmaType::HIER_BLOCK of AstPragma to modules
// 1) Parser adds VPragmaType::HIER_BLOCK of AstPragma to modules
// that are marked with /*verilator hier_block*/ metacomment in Verilator run a).
// 2) AstModule with HIER_BLOCK pragma is marked modp->hier_block(true)
// in V3LinkResolve.cpp during run a).
@ -236,10 +236,10 @@ string V3HierBlock::commandArgsFileName(bool forCMake) const {
//######################################################################
// Collect how hierarchical blocks are used
class HierBlockUsageCollectVisitor final : public AstNVisitor {
class HierBlockUsageCollectVisitor final : public VNVisitor {
// NODE STATE
// AstNode::user1() -> bool. Processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
using ModuleSet = std::unordered_set<const AstModule*>;
@ -247,7 +247,7 @@ class HierBlockUsageCollectVisitor final : public AstNVisitor {
AstModule* m_modp = nullptr; // The current module
AstModule* m_hierBlockp = nullptr; // The nearest parent module that is a hierarchical block
ModuleSet m_referred; // Modules that have hier_block pragma
V3HierBlock::GParams m_gparams; // list of variables that is AstVarType::GPARAM
V3HierBlock::GParams m_gparams; // list of variables that is VVarType::GPARAM
virtual void visit(AstModule* nodep) override {
// Don't visit twice

View File

@ -44,7 +44,7 @@ static const int INLINE_MODS_SMALLER = 100; // If a mod is < this # nodes, can
//######################################################################
// Inline state, as a visitor of each AstNode
class InlineMarkVisitor final : public AstNVisitor {
class InlineMarkVisitor final : public VNVisitor {
private:
// NODE STATE
// Output
@ -53,9 +53,9 @@ private:
// AstNodeModule::user2() // CIL_*. Allowed to automatically inline module
// AstNodeModule::user3() // int. Number of cells referencing this module
// AstNodeModule::user4() // int. Statements in module
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
// For the user2 field:
enum : uint8_t {
@ -127,7 +127,7 @@ private:
iterateChildren(nodep);
}
virtual void visit(AstPragma* nodep) override {
if (nodep->pragType() == AstPragmaType::INLINE_MODULE) {
if (nodep->pragType() == VPragmaType::INLINE_MODULE) {
// UINFO(0, "PRAG MARK " << m_modp << endl);
if (!m_modp) {
nodep->v3error("Inline pragma not under a module"); // LCOV_EXCL_LINE
@ -136,7 +136,7 @@ private:
}
// Remove so don't propagate to upper cell...
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->pragType() == AstPragmaType::NO_INLINE_MODULE) {
} else if (nodep->pragType() == VPragmaType::NO_INLINE_MODULE) {
if (!m_modp) {
nodep->v3error("Inline pragma not under a module"); // LCOV_EXCL_LINE
} else if (!v3Global.opt.flatten()) {
@ -235,7 +235,7 @@ public:
// Using clonep(), find cell cross references.
// clone() must not be called inside this visitor
class InlineCollectVisitor final : public AstNVisitor {
class InlineCollectVisitor final : public VNVisitor {
private:
// NODE STATE
// Output:
@ -262,7 +262,7 @@ public:
//######################################################################
// After cell is cloned, relink the new module's contents
class InlineRelinkVisitor final : public AstNVisitor {
class InlineRelinkVisitor final : public VNVisitor {
private:
// NODE STATE
// Input:
@ -480,7 +480,7 @@ public:
//######################################################################
// Inline state, as a visitor of each AstNode
class InlineVisitor final : public AstNVisitor {
class InlineVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared entire netlist
@ -493,10 +493,10 @@ private:
// // is a direct connect to
// AstVar::user3() // bool Don't alias the user2, keep it as signal
// AstCell::user4 // AstCell* of the created clone
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const AstUser5InUse m_inuser5;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
const VNUser5InUse m_inuser5;
// STATE
AstNodeModule* m_modp = nullptr; // Current module
@ -620,11 +620,11 @@ public:
//######################################################################
// Track interface references under the Cell they reference
class InlineIntfRefVisitor final : public AstNVisitor {
class InlineIntfRefVisitor final : public VNVisitor {
private:
// NODE STATE
// AstVar::user1p() // AstCell which this Var points to
const AstUser2InUse m_inuser2;
const VNUser2InUse m_inuser2;
string m_scope; // Scope name
@ -708,8 +708,8 @@ public:
void V3Inline::inlineAll(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ": " << endl);
const AstUser1InUse m_inuser1; // output of InlineMarkVisitor,
// input to InlineVisitor.
const VNUser1InUse m_inuser1; // output of InlineMarkVisitor,
// input to InlineVisitor.
// Scoped to clean up temp userN's
{ InlineMarkVisitor{nodep}; }
{ InlineVisitor{nodep}; }

View File

@ -34,12 +34,12 @@
//######################################################################
// Inst state, as a visitor of each AstNode
class InstVisitor final : public AstNVisitor {
class InstVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared each Cell:
// AstPin::user1p() -> bool. True if created assignment already
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
AstCell* m_cellp = nullptr; // Current cell
@ -139,7 +139,7 @@ public:
//######################################################################
class InstDeModVarVisitor final : public AstNVisitor {
class InstDeModVarVisitor final : public VNVisitor {
// Expand all module variables, and save names for later reference
private:
// STATE
@ -190,7 +190,7 @@ public:
//######################################################################
class InstDeVisitor final : public AstNVisitor {
class InstDeVisitor final : public VNVisitor {
// Find all cells with arrays, and convert to non-arrayed
private:
// STATE
@ -564,7 +564,7 @@ public:
// Prevent name conflict if both tri & non-tri add signals
+ (forTristate ? "t" : "") + "__" + cellp->name() + "__" + pinp->name());
AstVar* const newvarp
= new AstVar(pinVarp->fileline(), AstVarType::MODULETEMP, newvarname, pinVarp);
= new AstVar(pinVarp->fileline(), VVarType::MODULETEMP, newvarname, pinVarp);
// Important to add statement next to cell, in case there is a
// generate with same named cell
cellp->addNextHere(newvarp);

View File

@ -29,12 +29,12 @@
/// we'll count instructions from either the 'if' or the 'else' branch,
/// whichever is larger. We know we won't run both.
class InstrCountVisitor final : public AstNVisitor {
class InstrCountVisitor final : public VNVisitor {
private:
// NODE STATE
// AstNode::user4() -> int. Path cost + 1, 0 means don't dump
// AstNode::user5() -> bool. Processed if assertNoDups
const AstUser4InUse m_inuser4;
const VNUser4InUse m_inuser4;
// MEMBERS
uint32_t m_instrCount = 0; // Running count of instructions
@ -258,7 +258,7 @@ private:
};
// Iterate the graph printing the critical path marked by previous visitation
class InstrCountDumpVisitor final : public AstNVisitor {
class InstrCountDumpVisitor final : public VNVisitor {
private:
// NODE STATE
// AstNode::user4() -> int. Path cost, 0 means don't dump

View File

@ -41,7 +41,7 @@
class LifeState final {
// NODE STATE
// See below
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
public:
@ -267,7 +267,7 @@ public:
//######################################################################
// Life state, as a visitor of each AstNode
class LifeVisitor final : public AstNVisitor {
class LifeVisitor final : public VNVisitor {
private:
// STATE
LifeState* const m_statep; // Current state
@ -449,7 +449,7 @@ public:
//######################################################################
class LifeTopVisitor final : public AstNVisitor {
class LifeTopVisitor final : public VNVisitor {
// Visit all top nodes searching for functions that are entry points we want to start
// finding code within.
private:

View File

@ -40,7 +40,7 @@
//######################################################################
// LifePost class functions
class LifePostElimVisitor final : public AstNVisitor {
class LifePostElimVisitor final : public VNVisitor {
private:
bool m_tracingCall = false; // Iterating into a CCall to a CFunc
@ -128,12 +128,12 @@ struct LifePostLocation {
//######################################################################
// LifePost delay elimination
class LifePostDlyVisitor final : public AstNVisitor {
class LifePostDlyVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on entire tree
// AstVarScope::user4() -> AstVarScope*: Passed to LifePostElim to substitute this var
const AstUser4InUse m_inuser4;
const VNUser4InUse m_inuser4;
// STATE
uint32_t m_sequence = 0; // Sequence number of assigns/varrefs,

View File

@ -91,7 +91,7 @@ void LinkCellsGraph::loopsMessageCb(V3GraphVertex* vertexp) {
//######################################################################
// Link state, as a visitor of each AstNode
class LinkCellsVisitor final : public AstNVisitor {
class LinkCellsVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist:
@ -101,8 +101,8 @@ private:
// AstCell::user2() // bool clone renaming completed
// Allocated across all readFiles in V3Global::readFiles:
// AstNode::user4p() // VSymEnt* Package and typedef symbol names
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// STATE
VInFilter* const m_filterp; // Parser filter
@ -434,10 +434,10 @@ private:
AstNodeArrayDType* const arrp
= new AstUnpackArrayDType(nodep->fileline(), VFlagChildDType(), idtypep,
nodep->rangep()->cloneTree(true));
varp = new AstVar(nodep->fileline(), AstVarType::IFACEREF, varName,
varp = new AstVar(nodep->fileline(), VVarType::IFACEREF, varName,
VFlagChildDType(), arrp);
} else {
varp = new AstVar(nodep->fileline(), AstVarType::IFACEREF, varName,
varp = new AstVar(nodep->fileline(), VVarType::IFACEREF, varName,
VFlagChildDType(), idtypep);
}
varp->isIfaceParent(true);

View File

@ -129,9 +129,9 @@ private:
// AstVar::user4() // bool. True if port set for this variable
// AstNodeBlock::user4() // bool. Did name processing
// AstNodeModule::user4() // bool. Live module
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser4InUse m_inuser4;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser4InUse m_inuser4;
public:
// ENUMS
@ -706,7 +706,7 @@ LinkDotState* LinkDotState::s_errorThisp = nullptr;
//======================================================================
class LinkDotFindVisitor final : public AstNVisitor {
class LinkDotFindVisitor final : public VNVisitor {
// STATE
LinkDotState* const m_statep; // State to pass between visitors, including symbol table
AstNodeModule* m_classOrPackagep = nullptr; // Current package
@ -1015,10 +1015,10 @@ class LinkDotFindVisitor final : public AstNVisitor {
if (dtypep) {
dtypep->unlinkFrBack();
} else {
dtypep = new AstBasicDType(nodep->fileline(), AstBasicDTypeKwd::LOGIC);
dtypep = new AstBasicDType(nodep->fileline(), VBasicDTypeKwd::LOGIC);
}
AstVar* const newvarp
= new AstVar(nodep->fileline(), AstVarType::VAR, nodep->name(),
= new AstVar(nodep->fileline(), VVarType::VAR, nodep->name(),
VFlagChildDType(), dtypep); // Not dtype resolved yet
newvarp->direction(VDirection::OUTPUT);
newvarp->lifetime(VLifetime::AUTOMATIC);
@ -1132,9 +1132,8 @@ class LinkDotFindVisitor final : public AstNVisitor {
// We first search if the parameter is overwritten and then replace it with a
// new value. It will keep the same FileLine information.
if (v3Global.opt.hasParameter(nodep->name())) {
AstVar* const newp
= new AstVar(nodep->fileline(), AstVarType(AstVarType::GPARAM),
nodep->name(), nodep);
AstVar* const newp = new AstVar(
nodep->fileline(), VVarType(VVarType::GPARAM), nodep->name(), nodep);
newp->combineType(nodep);
const string svalue = v3Global.opt.parameter(nodep->name());
if (AstNode* const valuep
@ -1302,7 +1301,7 @@ class LinkDotFindVisitor final : public AstNVisitor {
AstVar* argrefp = nullptr;
if (const auto parserefp = VN_CAST(argp, ParseRef)) {
// We use an int type, this might get changed in V3Width when types resolve
argrefp = new AstVar{parserefp->fileline(), AstVarType::BLOCKTEMP,
argrefp = new AstVar{parserefp->fileline(), VVarType::BLOCKTEMP,
parserefp->name(), argp->findSigned32DType()};
parserefp->replaceWith(argrefp);
VL_DO_DANGLING(parserefp->deleteTree(), parserefp);
@ -1382,7 +1381,7 @@ public:
//======================================================================
class LinkDotParamVisitor final : public AstNVisitor {
class LinkDotParamVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on global
@ -1574,7 +1573,7 @@ public:
//======================================================================
class LinkDotScopeVisitor final : public AstNVisitor {
class LinkDotScopeVisitor final : public VNVisitor {
// STATE
LinkDotState* const m_statep; // State to pass between visitors, including symbol table
@ -1741,7 +1740,7 @@ public:
//======================================================================
// Iterate an interface to resolve modports
class LinkDotIfaceVisitor final : public AstNVisitor {
class LinkDotIfaceVisitor final : public VNVisitor {
// STATE
LinkDotState* const m_statep; // State to pass between visitors, including symbol table
VSymEnt* m_curSymp; // Symbol Entry for current table, where to lookup/insert
@ -1834,7 +1833,7 @@ void LinkDotState::computeIfaceModSyms() {
//======================================================================
class LinkDotResolveVisitor final : public AstNVisitor {
class LinkDotResolveVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on global
@ -1844,8 +1843,8 @@ private:
// *::user4() -> See LinkDotState
// Cleared on Cell
// AstVar::user5() // bool. True if pin used in this cell
const AstUser3InUse m_inuser3;
const AstUser5InUse m_inuser5;
const VNUser3InUse m_inuser3;
const VNUser5InUse m_inuser5;
// TYPES
enum DotPosition : uint8_t {
@ -1924,7 +1923,7 @@ private:
<< (suggest.empty() ? "" : nodep->warnMore() + suggest));
}
}
AstVar* const newp = new AstVar(nodep->fileline(), AstVarType::WIRE, nodep->name(),
AstVar* const newp = new AstVar(nodep->fileline(), VVarType::WIRE, nodep->name(),
VFlagLogicPacked(), 1);
newp->trace(modp->modTrace());
nodep->varp(newp);

View File

@ -47,7 +47,7 @@
//######################################################################
class LinkIncVisitor final : public AstNVisitor {
class LinkIncVisitor final : public VNVisitor {
private:
// TYPES
enum InsertMode : uint8_t {
@ -205,7 +205,7 @@ private:
// Prepare a temporary variable
FileLine* const fl = backp->fileline();
const string name = string("__Vincrement") + cvtToStr(++m_modIncrementsNum);
AstVar* const varp = new AstVar(fl, AstVarType::BLOCKTEMP, name, VFlagChildDType(),
AstVar* const varp = new AstVar(fl, VVarType::BLOCKTEMP, name, VFlagChildDType(),
varrefp->varp()->subDTypep()->cloneTree(true));
// Declare the variable

View File

@ -41,7 +41,7 @@
//######################################################################
class LinkJumpVisitor final : public AstNVisitor {
class LinkJumpVisitor final : public VNVisitor {
private:
// STATE
AstNodeModule* m_modp = nullptr; // Current module
@ -153,8 +153,8 @@ private:
AstNode* const countp = nodep->countp()->unlinkFrBackWithNext();
const string name = string("__Vrepeat") + cvtToStr(m_modRepeatNum++);
// Spec says value is integral, if negative is ignored
AstVar* const varp = new AstVar(nodep->fileline(), AstVarType::BLOCKTEMP, name,
nodep->findSigned32DType());
AstVar* const varp
= new AstVar(nodep->fileline(), VVarType::BLOCKTEMP, name, nodep->findSigned32DType());
varp->usedLoopIdx(true);
m_modp->addStmtp(varp);
AstNode* initsp = new AstAssign(

View File

@ -30,7 +30,7 @@
//######################################################################
// Link state, as a visitor of each AstNode
class LinkLValueVisitor final : public AstNVisitor {
class LinkLValueVisitor final : public VNVisitor {
private:
// NODE STATE

View File

@ -34,14 +34,14 @@
//######################################################################
// Link state, as a visitor of each AstNode
class LinkParseVisitor final : public AstNVisitor {
class LinkParseVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on netlist
// AstNode::user1() -> bool. True if processed
// AstNode::user2() -> bool. True if fileline recomputed
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// TYPES
using ImplTypedefMap = std::map<const std::pair<void*, std::string>, AstTypedef*>;
@ -232,11 +232,11 @@ private:
if (v3Global.opt.publicFlatRW()) {
switch (nodep->varType()) {
case AstVarType::VAR: // FALLTHRU
case AstVarType::GPARAM: // FALLTHRU
case AstVarType::LPARAM: // FALLTHRU
case AstVarType::PORT: // FALLTHRU
case AstVarType::WIRE: nodep->sigUserRWPublic(true); break;
case VVarType::VAR: // FALLTHRU
case VVarType::GPARAM: // FALLTHRU
case VVarType::LPARAM: // FALLTHRU
case VVarType::PORT: // FALLTHRU
case VVarType::WIRE: nodep->sigUserRWPublic(true); break;
default: break;
}
}
@ -298,41 +298,41 @@ private:
virtual void visit(AstAttrOf* nodep) override {
cleanFileline(nodep);
iterateChildren(nodep);
if (nodep->attrType() == AstAttrType::DT_PUBLIC) {
if (nodep->attrType() == VAttrType::DT_PUBLIC) {
AstTypedef* const typep = VN_AS(nodep->backp(), Typedef);
UASSERT_OBJ(typep, nodep, "Attribute not attached to typedef");
typep->attrPublic(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_CLOCK_ENABLE) {
} else if (nodep->attrType() == VAttrType::VAR_CLOCK_ENABLE) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->attrClockEn(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_PUBLIC) {
} else if (nodep->attrType() == VAttrType::VAR_PUBLIC) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->sigUserRWPublic(true);
m_varp->sigModPublic(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT) {
} else if (nodep->attrType() == VAttrType::VAR_PUBLIC_FLAT) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->sigUserRWPublic(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT_RD) {
} else if (nodep->attrType() == VAttrType::VAR_PUBLIC_FLAT_RD) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->sigUserRdPublic(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_PUBLIC_FLAT_RW) {
} else if (nodep->attrType() == VAttrType::VAR_PUBLIC_FLAT_RW) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->sigUserRWPublic(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_ISOLATE_ASSIGNMENTS) {
} else if (nodep->attrType() == VAttrType::VAR_ISOLATE_ASSIGNMENTS) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->attrIsolateAssign(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_SFORMAT) {
} else if (nodep->attrType() == VAttrType::VAR_SFORMAT) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->attrSFormat(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_SPLIT_VAR) {
} else if (nodep->attrType() == VAttrType::VAR_SPLIT_VAR) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
if (!VN_IS(m_modp, Module)) {
m_varp->v3warn(
@ -344,15 +344,15 @@ private:
m_varp->attrSplitVar(true);
}
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_SC_BV) {
} else if (nodep->attrType() == VAttrType::VAR_SC_BV) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->attrScBv(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_CLOCKER) {
} else if (nodep->attrType() == VAttrType::VAR_CLOCKER) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->attrClocker(VVarAttrClocker::CLOCKER_YES);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
} else if (nodep->attrType() == AstAttrType::VAR_NO_CLOCKER) {
} else if (nodep->attrType() == VAttrType::VAR_NO_CLOCKER) {
UASSERT_OBJ(m_varp, nodep, "Attribute not attached to variable");
m_varp->attrClocker(VVarAttrClocker::CLOCKER_NO);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);

View File

@ -38,12 +38,12 @@
//######################################################################
// Link state, as a visitor of each AstNode
class LinkResolveVisitor final : public AstNVisitor {
class LinkResolveVisitor final : public VNVisitor {
private:
// NODE STATE
// Entire netlist:
// AstCaseItem::user2() // bool Moved default caseitems
const AstUser2InUse m_inuser2;
const VNUser2InUse m_inuser2;
// STATE
// Below state needs to be preserved between each module call.
@ -96,7 +96,7 @@ private:
}
virtual void visit(AstVar* nodep) override {
iterateChildren(nodep);
if (m_classp && !nodep->isParam()) nodep->varType(AstVarType::MEMBER);
if (m_classp && !nodep->isParam()) nodep->varType(VVarType::MEMBER);
if (m_ftaskp) nodep->funcLocal(true);
if (nodep->isSigModPublic()) {
nodep->sigModPublic(false); // We're done with this attribute
@ -156,7 +156,7 @@ private:
if (sensp && !VN_IS(sensp, NodeVarRef) && !VN_IS(sensp, Const)) {
// Make a new temp wire
const string newvarname = "__Vsenitemexpr" + cvtToStr(++m_senitemCvtNum);
AstVar* const newvarp = new AstVar(sensp->fileline(), AstVarType::MODULETEMP,
AstVar* const newvarp = new AstVar(sensp->fileline(), VVarType::MODULETEMP,
newvarname, VFlagLogicPacked(), 1);
// We can't just add under the module, because we may be
// inside a generate, begin, etc.
@ -223,20 +223,20 @@ private:
AstNode* const basefromp = AstArraySel::baseFromp(nodep, false);
if (AstNodeVarRef* const varrefp
= VN_CAST(basefromp, NodeVarRef)) { // Maybe varxref - so need to clone
nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::VAR_BASE,
nodep->attrp(new AstAttrOf(nodep->fileline(), VAttrType::VAR_BASE,
varrefp->cloneTree(false)));
} else if (AstUnlinkedRef* const uvxrp
= VN_CAST(basefromp, UnlinkedRef)) { // Maybe unlinked - so need to clone
nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::VAR_BASE,
nodep->attrp(new AstAttrOf(nodep->fileline(), VAttrType::VAR_BASE,
uvxrp->cloneTree(false)));
} else if (auto* const fromp = VN_CAST(basefromp, LambdaArgRef)) {
nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::VAR_BASE,
nodep->attrp(new AstAttrOf(nodep->fileline(), VAttrType::VAR_BASE,
fromp->cloneTree(false)));
} else if (AstMemberSel* const fromp = VN_CAST(basefromp, MemberSel)) {
nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::MEMBER_BASE,
nodep->attrp(new AstAttrOf(nodep->fileline(), VAttrType::MEMBER_BASE,
fromp->cloneTree(false)));
} else if (AstEnumItemRef* const fromp = VN_CAST(basefromp, EnumItemRef)) {
nodep->attrp(new AstAttrOf(nodep->fileline(), AstAttrType::ENUM_BASE,
nodep->attrp(new AstAttrOf(nodep->fileline(), VAttrType::ENUM_BASE,
fromp->cloneTree(false)));
} else if (VN_IS(basefromp, Replicate)) {
// From {...}[...] syntax in IEEE 2017
@ -261,7 +261,7 @@ private:
}
virtual void visit(AstPragma* nodep) override {
if (nodep->pragType() == AstPragmaType::HIER_BLOCK) {
if (nodep->pragType() == VPragmaType::HIER_BLOCK) {
UASSERT_OBJ(m_modp, nodep, "HIER_BLOCK not under a module");
// If this is hierarchical mode which is to lib-create,
// sub modules do not have hier_block meta comment in the source code.
@ -271,18 +271,18 @@ private:
m_modp->hierBlock(v3Global.opt.hierarchical());
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (nodep->pragType() == AstPragmaType::PUBLIC_MODULE) {
} else if (nodep->pragType() == VPragmaType::PUBLIC_MODULE) {
UASSERT_OBJ(m_modp, nodep, "PUBLIC_MODULE not under a module");
m_modp->modPublic(true);
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (nodep->pragType() == AstPragmaType::PUBLIC_TASK) {
} else if (nodep->pragType() == VPragmaType::PUBLIC_TASK) {
UASSERT_OBJ(m_ftaskp, nodep, "PUBLIC_TASK not under a task");
m_ftaskp->taskPublic(true);
m_modp->modPublic(true); // Need to get to the task...
nodep->unlinkFrBack();
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (nodep->pragType() == AstPragmaType::COVERAGE_BLOCK_OFF) {
} else if (nodep->pragType() == VPragmaType::COVERAGE_BLOCK_OFF) {
if (!v3Global.opt.coverageLine()) { // No need for block statements; may optimize
// better without
nodep->unlinkFrBack();
@ -544,7 +544,7 @@ public:
// Recurses cells backwards, so we can pick up those things that propagate
// from child cells up to the top module.
class LinkBotupVisitor final : public AstNVisitor {
class LinkBotupVisitor final : public VNVisitor {
private:
// STATE
AstNodeModule* m_modp = nullptr; // Current module

View File

@ -36,7 +36,7 @@
//######################################################################
// LocalizeVisitor
class LocalizeVisitor final : public AstNVisitor {
class LocalizeVisitor final : public VNVisitor {
private:
// NODE STATE
// AstVarScope::user1() -> Bool indicating VarScope is not optimizable.
@ -45,10 +45,10 @@ private:
// AstVarScope::user3p() -> Set of CFuncs referencing this VarScope. (via m_accessors)
// AstCFunc::user4p() -> Multimap of 'VarScope -> VarRefs that reference that VarScope'
// in this function. (via m_references)
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
AstUser3Allocator<AstVarScope, std::unordered_set<AstCFunc*>> m_accessors;
AstUser4Allocator<AstCFunc, std::unordered_multimap<const AstVarScope*, AstVarRef*>>
@ -65,7 +65,7 @@ private:
bool isOptimizable(AstVarScope* nodep) {
return !nodep->user1() || // Not marked as not optimizable, or ...
(nodep->varp()->varType() == AstVarType::BLOCKTEMP
(nodep->varp()->varType() == VVarType::BLOCKTEMP
&& m_accessors(nodep).size() == 1); // .. a block temp used in a single CFunc
}

View File

@ -60,7 +60,7 @@ enum class Mergeable {
NO_IMPURE // Tree cannot be merged because it contains an impure node
};
class CheckMergeableVisitor final : public AstNVisitor {
class CheckMergeableVisitor final : public VNVisitor {
private:
// STATE
bool m_condAssign = false; // Does this tree contain an assignment to a condition variable??
@ -109,7 +109,7 @@ public:
}
};
class MarkVarsVisitor final : public AstNVisitor {
class MarkVarsVisitor final : public VNVisitor {
private:
// METHODS
VL_DEBUG_FUNC; // Declare debug()
@ -126,13 +126,13 @@ public:
void mark(AstNode* node) { iterate(node); }
};
class MergeCondVisitor final : public AstNVisitor {
class MergeCondVisitor final : public VNVisitor {
private:
// NODE STATE
// AstVar::user1 -> Flag set for variables referenced by m_mgCondp
// AstNode::user2 -> Flag marking node as included in merge because cheap to duplicate
const AstUser1InUse m_user1InUse;
const AstUser2InUse m_user2InUse;
const VNUser1InUse m_user1InUse;
const VNUser2InUse m_user2InUse;
// STATE
VDouble0 m_statMerges; // Statistic tracking

View File

@ -30,14 +30,14 @@
//######################################################################
// Name state, as a visitor of each AstNode
class NameVisitor final : public AstNVisitor {
class NameVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on Netlist
// AstCell::user1() -> bool. Set true if already processed
// AstScope::user1() -> bool. Set true if already processed
// AstVar::user1() -> bool. Set true if already processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
const AstNodeModule* m_modp = nullptr;

View File

@ -152,7 +152,7 @@ static bool domainsExclusive(const AstSenTree* fromp, const AstSenTree* top) {
// Predicate returning true if the LHS of the given assignment is a signal marked as clocker
static bool isClockerAssignment(AstNodeAssign* nodep) {
class Visitor final : public AstNVisitor {
class Visitor final : public VNVisitor {
public:
bool m_clkAss = false; // There is signals marked as clocker in the assignment
private:
@ -203,7 +203,7 @@ void OrderGraph::loopsVertexCb(V3GraphVertex* vertexp) {
// produce a CLKDATA warning if so.
//
class OrderClkMarkVisitor final : public AstNVisitor {
class OrderClkMarkVisitor final : public VNVisitor {
bool m_hasClk = false; // flag indicating whether there is clock signal on rhs
bool m_inClocked = false; // Currently inside a sequential block
bool m_newClkMarked; // Flag for deciding whether a new run is needed
@ -356,7 +356,7 @@ public:
// OrderBuildVisitor builds the ordering graph of the entire netlist, and
// removes any nodes that are no longer required once the graph is built
class OrderBuildVisitor final : public AstNVisitor {
class OrderBuildVisitor final : public VNVisitor {
// TYPES
enum VarUsage : uint8_t { VU_CON = 0x1, VU_GEN = 0x2 };
using VarVertexType = OrderUser::VarVertexType;
@ -364,8 +364,8 @@ class OrderBuildVisitor final : public AstNVisitor {
// NODE STATE
// AstVarScope::user1 -> OrderUser instance for variable (via m_orderUser)
// AstVarScope::user2 -> VarUsage within logic blocks
const AstUser1InUse user1InUse;
const AstUser2InUse user2InUse;
const VNUser1InUse user1InUse;
const VNUser2InUse user2InUse;
AstUser1Allocator<AstVarScope, OrderUser> m_orderUser;
// STATE
@ -1041,7 +1041,7 @@ class OrderProcess final : VNDeleter {
// NODE STATE
// AstNodeModule::user3 -> int: Number of AstCFuncs created under this module
// AstNode::user4 -> Used by V3Const::constifyExpensiveEdit
const AstUser3InUse user3InUse;
const VNUser3InUse user3InUse;
// STATE
OrderGraph& m_graph; // The ordering graph

View File

@ -226,8 +226,8 @@ class ParamProcessor final {
// AstGenFor::user5() // bool True if processed
// AstVar::user5() // bool True if constant propagated
// AstCell::user5p() // string* Generate portion of hierarchical name
const AstUser4InUse m_inuser4;
const AstUser5InUse m_inuser5;
const VNUser4InUse m_inuser4;
const VNUser5InUse m_inuser5;
// User1/2/3 used by constant function simulations
// TYPES
@ -835,7 +835,7 @@ public:
//######################################################################
// Process parameter visitor
class ParamVisitor final : public AstNVisitor {
class ParamVisitor final : public VNVisitor {
// STATE
ParamProcessor m_processor; // De-parameterize a cell, build modules
UnrollStateful m_unroller; // Loop unroller

View File

@ -152,14 +152,14 @@ AstVar* V3ParseGrammar::createVariable(FileLine* fileline, const string& name,
AstNodeDType* dtypep = GRAMMARP->m_varDTypep;
UINFO(5, " creVar " << name << " decl=" << GRAMMARP->m_varDecl << " io="
<< GRAMMARP->m_varIO << " dt=" << (dtypep ? "set" : "") << endl);
if (GRAMMARP->m_varIO == VDirection::NONE && GRAMMARP->m_varDecl == AstVarType::PORT) {
if (GRAMMARP->m_varIO == VDirection::NONE && GRAMMARP->m_varDecl == VVarType::PORT) {
// Just a port list with variable name (not v2k format); AstPort already created
if (dtypep) fileline->v3warn(E_UNSUPPORTED, "Unsupported: Ranges ignored in port-lists");
return nullptr;
}
if (GRAMMARP->m_varDecl == AstVarType::WREAL) {
if (GRAMMARP->m_varDecl == VVarType::WREAL) {
// dtypep might not be null, might be implicit LOGIC before we knew better
dtypep = new AstBasicDType(fileline, AstBasicDTypeKwd::DOUBLE);
dtypep = new AstBasicDType(fileline, VBasicDTypeKwd::DOUBLE);
}
if (!dtypep) { // Created implicitly
dtypep = new AstBasicDType(fileline, LOGIC_IMPLICIT);
@ -168,15 +168,15 @@ AstVar* V3ParseGrammar::createVariable(FileLine* fileline, const string& name,
}
// UINFO(0,"CREVAR "<<fileline->ascii()<<" decl="<<GRAMMARP->m_varDecl.ascii()<<"
// io="<<GRAMMARP->m_varIO.ascii()<<endl);
AstVarType type = GRAMMARP->m_varDecl;
if (type == AstVarType::UNKNOWN) {
VVarType type = GRAMMARP->m_varDecl;
if (type == VVarType::UNKNOWN) {
if (GRAMMARP->m_varIO.isAny()) {
type = AstVarType::PORT;
type = VVarType::PORT;
} else {
fileline->v3fatalSrc("Unknown signal type declared: " << type.ascii());
}
}
if (type == AstVarType::GENVAR) {
if (type == VVarType::GENVAR) {
if (arrayp) fileline->v3error("Genvars may not be arrayed: " << name);
}
@ -189,16 +189,16 @@ AstVar* V3ParseGrammar::createVariable(FileLine* fileline, const string& name,
nodep->ansi(m_pinAnsi);
nodep->declTyped(m_varDeclTyped);
nodep->lifetime(m_varLifetime);
if (GRAMMARP->m_varDecl != AstVarType::UNKNOWN) nodep->combineType(GRAMMARP->m_varDecl);
if (GRAMMARP->m_varDecl != VVarType::UNKNOWN) nodep->combineType(GRAMMARP->m_varDecl);
if (GRAMMARP->m_varIO != VDirection::NONE) {
nodep->declDirection(GRAMMARP->m_varIO);
nodep->direction(GRAMMARP->m_varIO);
}
if (GRAMMARP->m_varDecl == AstVarType::SUPPLY0) {
if (GRAMMARP->m_varDecl == VVarType::SUPPLY0) {
nodep->addNext(V3ParseGrammar::createSupplyExpr(fileline, nodep->name(), 0));
}
if (GRAMMARP->m_varDecl == AstVarType::SUPPLY1) {
if (GRAMMARP->m_varDecl == VVarType::SUPPLY1) {
nodep->addNext(V3ParseGrammar::createSupplyExpr(fileline, nodep->name(), 1));
}
if (VN_IS(dtypep, ParseTypeDType)) {

View File

@ -119,7 +119,7 @@ struct V3ParseBisonYYSType {
V3ImportProperty iprop;
VSigning::en signstate;
V3ErrorCode::en errcodeen;
AstAttrType::en attrtypeen;
VAttrType::en attrtypeen;
VLifetime::en lifetime;
#include "V3Ast__gen_yystype.h"

View File

@ -1698,7 +1698,7 @@ const GraphWay* PartContraction::s_shortestWaywardCpInclusiveWay = nullptr;
// Scan node, indicate whether it contains a call to a DPI imported
// routine.
class DpiImportCallVisitor final : public AstNVisitor {
class DpiImportCallVisitor final : public VNVisitor {
private:
bool m_hasDpiHazard = false; // Found a DPI import call.
bool m_tracingCall = false; // Iterating into a CCall to a CFunc
@ -2565,7 +2565,7 @@ void V3Partition::go(V3Graph* mtasksp) {
{
// The V3InstrCount within LogicMTask will set user5 on each AST
// node, to assert that we never count any node twice.
const AstUser5InUse inUser5;
const VNUser5InUse inUser5;
Vx2MTaskMap vx2mtask;
for (V3GraphVertex* vxp = m_fineDepsGraphp->verticesBeginp(); vxp;
vxp = vxp->verticesNextp()) {
@ -2909,8 +2909,8 @@ static void addMTaskToFunction(const ThreadSchedule& schedule, const uint32_t th
// state variable and wait to be notified.
const string name = "__Vm_mtaskstate_" + cvtToStr(mtaskp->id());
AstBasicDType* const mtaskStateDtypep
= v3Global.rootp()->typeTablep()->findBasicDType(fl, AstBasicDTypeKwd::MTASKSTATE);
AstVar* const varp = new AstVar(fl, AstVarType::MODULETEMP, name, mtaskStateDtypep);
= v3Global.rootp()->typeTablep()->findBasicDType(fl, VBasicDTypeKwd::MTASKSTATE);
AstVar* const varp = new AstVar(fl, VVarType::MODULETEMP, name, mtaskStateDtypep);
varp->valuep(new AstConst(fl, nDependencies));
varp->protect(false); // Do not protect as we still have references in AstText
modp->addStmtp(varp);
@ -3001,9 +3001,9 @@ static const std::vector<AstCFunc*> createThreadFunctions(const ThreadSchedule&
// Create the fake "final" mtask state variable
AstBasicDType* const mtaskStateDtypep
= v3Global.rootp()->typeTablep()->findBasicDType(fl, AstBasicDTypeKwd::MTASKSTATE);
= v3Global.rootp()->typeTablep()->findBasicDType(fl, VBasicDTypeKwd::MTASKSTATE);
AstVar* const varp
= new AstVar(fl, AstVarType::MODULETEMP, "__Vm_mtaskstate_final", mtaskStateDtypep);
= new AstVar(fl, VVarType::MODULETEMP, "__Vm_mtaskstate_final", mtaskStateDtypep);
varp->valuep(new AstConst(fl, funcps.size()));
varp->protect(false); // Do not protect as we still have references in AstText
modp->addStmtp(varp);

View File

@ -40,11 +40,11 @@ constexpr int STATIC_CONST_MIN_WIDTH = 256; // Minimum size to extract to stati
//######################################################################
// Structure for global state
class PremitAssignVisitor final : public AstNVisitor {
class PremitAssignVisitor final : public VNVisitor {
private:
// NODE STATE
// AstVar::user3() // bool; occurs on LHS of current assignment
const AstUser3InUse m_inuser3;
const VNUser3InUse m_inuser3;
// STATE
bool m_noopt = false; // Disable optimization of variables in this block
@ -54,7 +54,7 @@ private:
// VISITORS
virtual void visit(AstNodeAssign* nodep) override {
// AstNode::user3ClearTree(); // Implied by AstUser3InUse
// AstNode::user3ClearTree(); // Implied by VNUser3InUse
// LHS first as fewer varrefs
iterateAndNextNull(nodep->lhsp());
// Now find vars marked as lhs
@ -86,15 +86,15 @@ public:
//######################################################################
// Premit state, as a visitor of each AstNode
class PremitVisitor final : public AstNVisitor {
class PremitVisitor final : public VNVisitor {
private:
// NODE STATE
// AstNodeMath::user() -> bool. True if iterated already
// AstShiftL::user2() -> bool. True if converted to conditional
// AstShiftR::user2() -> bool. True if converted to conditional
// *::user3() -> See PremitAssignVisitor
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// STATE
AstCFunc* m_cfuncp = nullptr; // Current block
@ -185,7 +185,7 @@ private:
++m_extractedToConstPool;
} else {
// Keep as local temporary. Name based on hash of node for output stability.
varp = new AstVar(fl, AstVarType::STMTTEMP, m_tempNames.get(nodep), nodep->dtypep());
varp = new AstVar(fl, VVarType::STMTTEMP, m_tempNames.get(nodep), nodep->dtypep());
m_cfuncp->addInitsp(varp);
// Put assignment before the referencing statement
insertBeforeStmt(new AstAssign(fl, new AstVarRef(fl, varp, VAccess::WRITE), nodep));

View File

@ -28,7 +28,7 @@
//######################################################################
// ProtectLib top-level visitor
class ProtectVisitor final : public AstNVisitor {
class ProtectVisitor final : public VNVisitor {
private:
AstVFile* m_vfilep = nullptr; // DPI-enabled Verilog wrapper
AstCFile* m_cfilep = nullptr; // C implementation of DPI functions
@ -471,7 +471,7 @@ private:
static void addLocalVariable(AstTextBlock* textp, AstVar* varp, const char* suffix) {
AstVar* const newVarp
= new AstVar(varp->fileline(), AstVarType::VAR, varp->name() + suffix, varp->dtypep());
= new AstVar(varp->fileline(), VVarType::VAR, varp->name() + suffix, varp->dtypep());
textp->addNodep(newVarp);
}

View File

@ -32,12 +32,12 @@
//######################################################################
// Visitor that marks classes needing a randomize() method
class RandomizeMarkVisitor final : public AstNVisitor {
class RandomizeMarkVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on Netlist
// AstClass::user1() -> bool. Set true to indicate needs randomize processing
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
using DerivedSet = std::unordered_set<AstClass*>;
using BaseToDerivedMap = std::unordered_map<AstClass*, DerivedSet>;
@ -112,14 +112,14 @@ public:
//######################################################################
// Visitor that defines a randomize method where needed
class RandomizeVisitor final : public AstNVisitor {
class RandomizeVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on Netlist
// AstClass::user1() -> bool. Set true to indicate needs randomize processing
// AstEnumDType::user2() -> AstVar*. Pointer to table with enum values
// AstUser1InUse m_inuser1; (Allocated for use in RandomizeMarkVisitor)
const AstUser2InUse m_inuser2;
// VNUser1InUse m_inuser1; (Allocated for use in RandomizeMarkVisitor)
const VNUser2InUse m_inuser2;
// STATE
size_t m_enumValueTabCount = 0; // Number of tables with enum values created
@ -136,7 +136,7 @@ private:
AstInitArray* const initp = new AstInitArray(nodep->fileline(), vardtypep, nullptr);
v3Global.rootp()->typeTablep()->addTypesp(vardtypep);
AstVar* const varp
= new AstVar(nodep->fileline(), AstVarType::MODULETEMP,
= new AstVar(nodep->fileline(), VVarType::MODULETEMP,
"__Venumvaltab_" + cvtToStr(m_enumValueTabCount++), vardtypep);
varp->isConst(true);
varp->isStatic(true);
@ -182,7 +182,7 @@ private:
auto* const randp = new AstRand(fl, nullptr, false);
auto* const moddivp
= new AstModDiv(fl, randp, new AstConst(fl, enumDtp->itemCount()));
randp->dtypep(varrefp->findBasicDType(AstBasicDTypeKwd::UINT32));
randp->dtypep(varrefp->findBasicDType(VBasicDTypeKwd::UINT32));
moddivp->dtypep(enumDtp);
valp = new AstArraySel(fl, tabRefp, moddivp);
} else {
@ -264,7 +264,7 @@ AstFunc* V3Randomize::newRandomizeFunc(AstClass* nodep) {
if (!funcp) {
auto* const dtypep
= nodep->findBitDType(32, 32, VSigning::SIGNED); // IEEE says int return of 0/1
auto* const fvarp = new AstVar(nodep->fileline(), AstVarType::MEMBER, "randomize", dtypep);
auto* const fvarp = new AstVar(nodep->fileline(), VVarType::MEMBER, "randomize", dtypep);
fvarp->lifetime(VLifetime::AUTOMATIC);
fvarp->funcLocal(true);
fvarp->funcReturn(true);

View File

@ -41,11 +41,11 @@
//######################################################################
class ReloopVisitor final : public AstNVisitor {
class ReloopVisitor final : public VNVisitor {
private:
// NODE STATE
// AstCFunc::user1p -> Var* for temp var, 0=not set yet
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
VDouble0 m_statReloops; // Statistic tracking
@ -71,7 +71,7 @@ private:
AstVar* varp = VN_AS(cfuncp->user1p(), Var);
if (!varp) {
const string newvarname = string("__Vilp");
varp = new AstVar(fl, AstVarType::STMTTEMP, newvarname, VFlagLogicPacked(), 32);
varp = new AstVar(fl, VVarType::STMTTEMP, newvarname, VFlagLogicPacked(), 32);
UASSERT_OBJ(cfuncp, fl, "Assignment not under a function");
cfuncp->addInitsp(varp);
cfuncp->user1p(varp);

View File

@ -36,13 +36,13 @@
//######################################################################
// Scope class functions
class ScopeVisitor final : public AstNVisitor {
class ScopeVisitor final : public VNVisitor {
private:
// NODE STATE
// AstVar::user1p -> AstVarScope replacement for this variable
// AstTask::user2p -> AstTask*. Replacement task
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// TYPES
// These cannot be unordered unless make a specialized hashing pair (gcc-8)
@ -320,7 +320,7 @@ public:
//######################################################################
// Scope cleanup -- remove unused activates
class ScopeCleanupVisitor final : public AstNVisitor {
class ScopeCleanupVisitor final : public VNVisitor {
private:
// STATE
AstScope* m_scopep = nullptr; // Current scope we are building

View File

@ -61,7 +61,7 @@ public:
~SimStackNode() = default;
};
class SimulateVisitor VL_NOT_FINAL : public AstNVisitor {
class SimulateVisitor VL_NOT_FINAL : public VNVisitor {
// Simulate a node tree, returning value of variables
// Two major operating modes:
// Test the tree to see if it is conformant
@ -72,9 +72,9 @@ class SimulateVisitor VL_NOT_FINAL : public AstNVisitor {
private:
// NODE STATE
// Cleared on each always/assignw
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
// Checking:
// AstVar(Scope)::user1() -> VarUsage. Set true to indicate tracking as lvalue/rvalue
@ -1100,12 +1100,12 @@ private:
if (m_params) {
AstConst* const textp = fetchConst(nodep->fmtp());
switch (nodep->displayType()) {
case AstDisplayType::DT_DISPLAY: // FALLTHRU
case AstDisplayType::DT_INFO: v3warn(USERINFO, textp->name()); break;
case AstDisplayType::DT_ERROR: v3warn(USERERROR, textp->name()); break;
case AstDisplayType::DT_WARNING: v3warn(USERWARN, textp->name()); break;
case AstDisplayType::DT_FATAL: v3warn(USERFATAL, textp->name()); break;
case AstDisplayType::DT_WRITE: // FALLTHRU
case VDisplayType::DT_DISPLAY: // FALLTHRU
case VDisplayType::DT_INFO: v3warn(USERINFO, textp->name()); break;
case VDisplayType::DT_ERROR: v3warn(USERERROR, textp->name()); break;
case VDisplayType::DT_WARNING: v3warn(USERWARN, textp->name()); break;
case VDisplayType::DT_FATAL: v3warn(USERFATAL, textp->name()); break;
case VDisplayType::DT_WRITE: // FALLTHRU
default: clearOptimizable(nodep, "Unexpected display type");
}
}

View File

@ -44,13 +44,13 @@
//*************************************************************************
class SliceVisitor final : public AstNVisitor {
class SliceVisitor final : public VNVisitor {
// NODE STATE
// Cleared on netlist
// AstNodeAssign::user1() -> bool. True if find is complete
// AstNodeUniop::user1() -> bool. True if find is complete
// AstArraySel::user1p() -> AstVarRef. The VarRef that the final ArraySel points to
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
AstNode* m_assignp = nullptr; // Assignment we are under
@ -196,12 +196,12 @@ class SliceVisitor final : public AstNVisitor {
logp = clonep;
} else {
switch (nodep->type()) {
case AstType::atEq: // FALLTHRU
case AstType::atEqCase:
case VNType::atEq: // FALLTHRU
case VNType::atEqCase:
logp = new AstLogAnd(nodep->fileline(), logp, clonep);
break;
case AstType::atNeq: // FALLTHRU
case AstType::atNeqCase:
case VNType::atNeq: // FALLTHRU
case VNType::atNeqCase:
logp = new AstLogOr(nodep->fileline(), logp, clonep);
break;
default:

View File

@ -235,17 +235,17 @@ public:
//######################################################################
// Split class functions
class SplitReorderBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class SplitReorderBaseVisitor VL_NOT_FINAL : public VNVisitor {
private:
// NODE STATE
// AstVarScope::user1p -> Var SplitNodeVertex* for usage var, 0=not set yet
// AstVarScope::user2p -> Var SplitNodeVertex* for delayed assignment var, 0=not set yet
// Ast*::user3p -> Statement SplitLogicVertex* (temporary only)
// Ast*::user4 -> Current ordering number (reorderBlock usage)
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
protected:
// STATE
@ -623,7 +623,7 @@ private:
using ColorSet = std::unordered_set<uint32_t>;
using AlwaysVec = std::vector<AstAlways*>;
class IfColorVisitor final : public AstNVisitor {
class IfColorVisitor final : public VNVisitor {
// MEMBERS
ColorSet m_colors; // All colors in the original always block
@ -681,7 +681,7 @@ private:
VL_UNCOPYABLE(IfColorVisitor);
};
class EmitSplitVisitor final : public AstNVisitor {
class EmitSplitVisitor final : public VNVisitor {
// MEMBERS
const AstAlways* const m_origAlwaysp; // Block that *this will split
const IfColorVisitor* const m_ifColorp; // Digest of results of prior coloring
@ -793,7 +793,7 @@ private:
VL_UNCOPYABLE(EmitSplitVisitor);
};
class RemovePlaceholdersVisitor final : public AstNVisitor {
class RemovePlaceholdersVisitor final : public VNVisitor {
std::unordered_set<AstNode*> m_removeSet; // placeholders to be removed
public:
explicit RemovePlaceholdersVisitor(AstNode* nodep) {

View File

@ -33,7 +33,7 @@
//######################################################################
class SplitAsBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class SplitAsBaseVisitor VL_NOT_FINAL : public VNVisitor {
public:
// METHODS
VL_DEBUG_FUNC; // Declare debug()
@ -128,7 +128,7 @@ class SplitAsVisitor final : public SplitAsBaseVisitor {
private:
// NODE STATE
// AstAlways::user() -> bool. True if already processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
VDouble0 m_statSplits; // Statistic tracking

View File

@ -127,7 +127,7 @@
struct SplitVarImpl {
// NODE STATE
// AstNodeModule::user1() -> Block number counter for generating unique names
const AstUser1InUse m_user1InUse; // Only used in SplitUnpackedVarVisitor
const VNUser1InUse m_user1InUse; // Only used in SplitUnpackedVarVisitor
static AstNodeAssign* newAssign(FileLine* fileline, AstNode* lhsp, AstNode* rhsp,
const AstVar* varp) {
@ -141,7 +141,7 @@ struct SplitVarImpl {
// These check functions return valid pointer to the reason text if a variable cannot be split.
// Check if a var type can be split
static const char* cannotSplitVarTypeReason(AstVarType type) {
static const char* cannotSplitVarTypeReason(VVarType type) {
// Only SplitUnpackedVarVisitor can split WREAL. SplitPackedVarVisitor cannot.
const bool ok
= type == type.VAR || type == type.WIRE || type == type.PORT || type == type.WREAL;
@ -359,7 +359,7 @@ public:
void add(AstVarRef* nodep) { m_refs.insert(nodep); }
void add(AstSel* nodep) { m_sels.insert(nodep); }
void remove(AstNode* nodep) {
struct Visitor : public AstNVisitor {
struct Visitor : public VNVisitor {
RefsInModule& m_parent;
virtual void visit(AstNode* nodep) override { iterateChildren(nodep); }
virtual void visit(AstVar* nodep) override { m_parent.m_vars.erase(nodep); }
@ -373,7 +373,7 @@ public:
} v(*this);
v.iterate(nodep);
}
void visit(AstNVisitor* visitor) {
void visit(VNVisitor* visitor) {
for (AstVar* const varp : m_vars) visitor->iterate(varp);
for (AstSel* const selp : m_sels) {
// If m_refs includes VarRef from ArraySel, remove it
@ -397,7 +397,7 @@ public:
using SplitVarRefsMap = std::map<AstNodeModule*, RefsInModule, AstNodeComparator>;
class SplitUnpackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
using VarSet = std::set<AstVar*, AstNodeComparator>;
VarSet m_foundTargetVar;
UnpackRefMap m_refs;
@ -437,12 +437,12 @@ class SplitUnpackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
iterate(nodep);
}
}
void pushDeletep(AstNode* nodep) { // overriding AstNVisitor::pusDeletep()
void pushDeletep(AstNode* nodep) { // overriding VNVisitor::pusDeletep()
UASSERT_OBJ(m_modp, nodep, "Must not nullptr");
m_refsForPackedSplit[m_modp].remove(nodep);
AstNVisitor::pushDeletep(nodep);
VNVisitor::pushDeletep(nodep);
}
AstVar* newVar(FileLine* fl, AstVarType type, const std::string& name, AstNodeDType* dtp) {
AstVar* newVar(FileLine* fl, VVarType type, const std::string& name, AstNodeDType* dtp) {
AstVar* const varp = new AstVar{fl, type, name, dtp};
UASSERT_OBJ(m_modp, varp, "Must not nullptr");
m_refsForPackedSplit[m_modp].add(varp);
@ -619,7 +619,7 @@ class SplitUnpackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
// variable can be added.
insertBeginIfNecessary(assignp, m_modp);
}
AstVar* const varp = newVar(fl, AstVarType::VAR, name, dtypep);
AstVar* const varp = newVar(fl, VVarType::VAR, name, dtypep);
// Variable will be registered in the caller side.
UINFO(3, varp->prettyNameQ()
<< " is created lsb:" << dtypep->lo() << " msb:" << dtypep->hi() << "\n");
@ -701,7 +701,7 @@ class SplitUnpackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
// Unpacked array is traced as var(idx), not var[idx].
const std::string name
= varp->name() + AstNode::encodeName('(' + cvtToStr(i + dtypep->lo()) + ')');
AstVar* const newp = newVar(varp->fileline(), AstVarType::VAR, name, subTypep);
AstVar* const newp = newVar(varp->fileline(), VVarType::VAR, name, subTypep);
newp->propagateAttrFrom(varp);
// If varp is an IO, varp will remain and will be traced.
newp->trace(!varp->isIO() && varp->isTrace());
@ -960,7 +960,7 @@ public:
}
};
class SplitPackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
AstNetlist* const m_netp;
const AstNodeModule* m_modp = nullptr; // Current module (just for log)
int m_numSplit = 0; // Total number of split variables
@ -1091,11 +1091,11 @@ class SplitPackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
AstBasicDType* dtypep;
switch (basicp->keyword()) {
case AstBasicDTypeKwd::BIT:
case VBasicDTypeKwd::BIT:
dtypep = new AstBasicDType{varp->subDTypep()->fileline(), VFlagBitPacked(),
newvar.bitwidth()};
break;
case AstBasicDTypeKwd::LOGIC:
case VBasicDTypeKwd::LOGIC:
dtypep = new AstBasicDType{varp->subDTypep()->fileline(), VFlagLogicPacked(),
newvar.bitwidth()};
break;
@ -1103,7 +1103,7 @@ class SplitPackedVarVisitor final : public AstNVisitor, public SplitVarImpl {
}
dtypep->rangep(new AstRange{
varp->fileline(), VNumRange{newvar.msb(), newvar.lsb(), basicp->littleEndian()}});
newvar.varp(new AstVar{varp->fileline(), AstVarType::VAR, name, dtypep});
newvar.varp(new AstVar{varp->fileline(), VVarType::VAR, name, dtypep});
newvar.varp()->propagateAttrFrom(varp);
newvar.varp()->funcLocal(varp->isFuncLocal() || varp->isFuncReturn());
// Enable this line to trace split variable directly:

View File

@ -30,7 +30,7 @@
//######################################################################
// Stats class functions
class StatsVisitor final : public AstNVisitor {
class StatsVisitor final : public VNVisitor {
private:
// NODE STATE/TYPES
@ -48,7 +48,7 @@ private:
bool m_tracingCall; // Iterating into a CCall to a CFunc
std::vector<VDouble0> m_statTypeCount; // Nodes of given type
VDouble0 m_statAbove[AstType::_ENUM_END][AstType::_ENUM_END]; // Nodes of given type
VDouble0 m_statAbove[VNType::_ENUM_END][VNType::_ENUM_END]; // Nodes of given type
std::array<VDouble0, VBranchPred::_ENUM_END> m_statPred; // Nodes of given type
VDouble0 m_statInstr; // Instruction count
VDouble0 m_statInstrFast; // Instruction count, non-slow() eval functions only
@ -214,7 +214,7 @@ public:
m_instrs = 0;
m_tracingCall = false;
// Initialize arrays
m_statTypeCount.resize(AstType::_ENUM_END);
m_statTypeCount.resize(VNType::_ENUM_END);
// Process
iterate(nodep);
}
@ -247,19 +247,19 @@ public:
}
}
// Node types
for (int type = 0; type < AstType::_ENUM_END; type++) {
for (int type = 0; type < VNType::_ENUM_END; type++) {
const double count = double(m_statTypeCount.at(type));
if (count != 0.0) {
V3Stats::addStat(m_stage, string("Node count, ") + AstType(type).ascii(), count);
V3Stats::addStat(m_stage, string("Node count, ") + VNType(type).ascii(), count);
}
}
for (int type = 0; type < AstType::_ENUM_END; type++) {
for (int type2 = 0; type2 < AstType::_ENUM_END; type2++) {
for (int type = 0; type < VNType::_ENUM_END; type++) {
for (int type2 = 0; type2 < VNType::_ENUM_END; type2++) {
const double count = double(m_statAbove[type][type2]);
if (count != 0.0) {
V3Stats::addStat(m_stage,
(string("Node pairs, ") + AstType(type).ascii() + "_"
+ AstType(type2).ascii()),
(string("Node pairs, ") + VNType(type).ascii() + "_"
+ VNType(type2).ascii()),
count);
}
}

View File

@ -36,7 +36,7 @@
//######################################################################
// Common debugging baseclass
class SubstBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class SubstBaseVisitor VL_NOT_FINAL : public VNVisitor {
public:
VL_DEBUG_FUNC; // Declare debug()
};
@ -227,8 +227,8 @@ private:
// Passed to SubstUseVisitor
// AstVar::user1p -> SubstVar* for usage var, 0=not set yet
// AstVar::user2 -> int step number for last assignment, 0=not set yet
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// STATE
std::vector<SubstVarEntry*> m_entryps; // Nodes to delete when we are finished

View File

@ -144,7 +144,7 @@ public:
//######################################################################
// Table class functions
class TableVisitor final : public AstNVisitor {
class TableVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on each always/assignw
@ -247,7 +247,7 @@ private:
// We will need a table index variable, create it here.
AstVar* const indexVarp
= new AstVar(fl, AstVarType::BLOCKTEMP, "__Vtableidx" + cvtToStr(m_modTables),
= new AstVar(fl, VVarType::BLOCKTEMP, "__Vtableidx" + cvtToStr(m_modTables),
VFlagBitPacked(), m_inWidthBits);
m_modp->addStmtp(indexVarp);
AstVarScope* const indexVscp = new AstVarScope(indexVarp->fileline(), m_scopep, indexVarp);

View File

@ -91,15 +91,15 @@ public:
//######################################################################
class TaskStateVisitor final : public AstNVisitor {
class TaskStateVisitor final : public VNVisitor {
private:
// NODE STATE
// Output:
// AstNodeFTask::user3p // AstScope* this FTask is under
// AstNodeFTask::user4p // GraphFTaskVertex* this FTask is under
// AstVar::user4p // GraphFTaskVertex* this variable is declared in
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
// TYPES
using VarToScopeMap = std::map<std::pair<AstScope*, AstVar*>, AstVarScope*>;
@ -219,7 +219,7 @@ private:
}
}
virtual void visit(AstPragma* nodep) override {
if (nodep->pragType() == AstPragmaType::NO_INLINE_TASK) {
if (nodep->pragType() == VPragmaType::NO_INLINE_TASK) {
// Just mark for the next steps, and we're done with it.
m_curVxp->noInline(true);
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
@ -286,7 +286,7 @@ public:
//######################################################################
class TaskRelinkVisitor final : public AstNVisitor {
class TaskRelinkVisitor final : public VNVisitor {
// Replace varrefs with new var pointer
private:
// NODE STATE
@ -340,7 +340,7 @@ struct TaskDpiUtils {
static bool dpiToInternalFrStmt(AstVar* portp, const string& frName, string& frstmt,
string& ket) {
ket.clear();
if (portp->basicp() && portp->basicp()->keyword() == AstBasicDTypeKwd::CHANDLE) {
if (portp->basicp() && portp->basicp()->keyword() == VBasicDTypeKwd::CHANDLE) {
frstmt = "VL_CVT_VP_Q(" + frName;
ket = ")";
} else if ((portp->basicp() && portp->basicp()->isDpiPrimitive())) {
@ -366,10 +366,10 @@ struct TaskDpiUtils {
//######################################################################
// Gather non-local variables written by an AstCFunc
class TaskGatherWrittenVisitor final : public AstNVisitor {
class TaskGatherWrittenVisitor final : public VNVisitor {
// NODE STATE
// AstVarScope::user5 -> Already considered variable
const AstUser5InUse m_user5InUse;
const VNUser5InUse m_user5InUse;
std::vector<AstVarScope*> m_writtenVariables; // Variables written
@ -399,7 +399,7 @@ public:
//######################################################################
// Task state, as a visitor of each AstNode
class TaskVisitor final : public AstNVisitor {
class TaskVisitor final : public VNVisitor {
private:
// NODE STATE
// Each module:
@ -407,8 +407,8 @@ private:
// Each funccall
// to TaskRelinkVisitor:
// AstVar::user2p // AstVarScope* to replace varref with
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// TYPES
enum InsertMode : uint8_t {
@ -432,17 +432,16 @@ private:
VL_DEBUG_FUNC; // Declare debug()
AstVarScope* createFuncVar(AstCFunc* funcp, const string& name, AstVar* examplep) {
AstVar* const newvarp
= new AstVar(funcp->fileline(), AstVarType::BLOCKTEMP, name, examplep);
AstVar* const newvarp = new AstVar(funcp->fileline(), VVarType::BLOCKTEMP, name, examplep);
newvarp->funcLocal(true);
funcp->addInitsp(newvarp);
AstVarScope* const newvscp = new AstVarScope(funcp->fileline(), m_scopep, newvarp);
m_scopep->addVarp(newvscp);
return newvscp;
}
AstVarScope* createInputVar(AstCFunc* funcp, const string& name, AstBasicDTypeKwd kwd) {
AstVar* const newvarp = new AstVar(funcp->fileline(), AstVarType::BLOCKTEMP, name,
funcp->findBasicDType(kwd));
AstVarScope* createInputVar(AstCFunc* funcp, const string& name, VBasicDTypeKwd kwd) {
AstVar* const newvarp
= new AstVar(funcp->fileline(), VVarType::BLOCKTEMP, name, funcp->findBasicDType(kwd));
newvarp->funcLocal(true);
newvarp->direction(VDirection::INPUT);
funcp->addArgsp(newvarp);
@ -460,7 +459,7 @@ private:
// We choose to do it under whichever called this function, which results
// in more cache locality.
AstVar* const newvarp
= new AstVar{invarp->fileline(), AstVarType::BLOCKTEMP, name, invarp};
= new AstVar{invarp->fileline(), VVarType::BLOCKTEMP, name, invarp};
newvarp->funcLocal(false);
newvarp->propagateAttrFrom(invarp);
m_modp->addStmtp(newvarp);
@ -1105,7 +1104,7 @@ private:
// This flag is set any time a DPI export is invoked, and cleared at the end of eval.
FileLine* const fl = m_topScopep->fileline();
AstVar* const varp
= new AstVar{fl, AstVarType::VAR, "__Vdpi_export_trigger", VFlagBitPacked{}, 1};
= new AstVar{fl, VVarType::VAR, "__Vdpi_export_trigger", VFlagBitPacked{}, 1};
m_topScopep->scopep()->modp()->addStmtp(varp);
dpiExportTriggerp = new AstVarScope{fl, m_topScopep->scopep(), varp};
m_topScopep->scopep()->addVarp(dpiExportTriggerp);
@ -1233,9 +1232,9 @@ private:
}
if (nodep->dpiContext()) {
// First three args go to dpiContext call
createInputVar(cfuncp, "__Vscopep", AstBasicDTypeKwd::SCOPEPTR);
createInputVar(cfuncp, "__Vfilenamep", AstBasicDTypeKwd::CHARPTR);
createInputVar(cfuncp, "__Vlineno", AstBasicDTypeKwd::INT);
createInputVar(cfuncp, "__Vscopep", VBasicDTypeKwd::SCOPEPTR);
createInputVar(cfuncp, "__Vfilenamep", VBasicDTypeKwd::CHARPTR);
createInputVar(cfuncp, "__Vlineno", VBasicDTypeKwd::INT);
}
if (nodep->dpiExport()) {
@ -1751,9 +1750,9 @@ string V3Task::assignInternalToDpi(AstVar* portp, bool isPtr, const string& frSu
}
} else {
const bool isChandle
= portp->basicp() && portp->basicp()->keyword() == AstBasicDTypeKwd::CHANDLE;
= portp->basicp() && portp->basicp()->keyword() == VBasicDTypeKwd::CHANDLE;
const bool isString
= portp->basicp() && portp->basicp()->keyword() == AstBasicDTypeKwd::STRING;
= portp->basicp() && portp->basicp()->keyword() == VBasicDTypeKwd::STRING;
const string idx = portp->name() + "__Vidx";
stmt = "for (size_t " + idx + " = 0; " + idx + " < " + cvtToStr(unpackSize) + "; ++" + idx
+ ") ";

View File

@ -162,10 +162,10 @@ private:
// AstVarScope::user1() // V3GraphVertex* for this node
// AstCCall::user2() // bool; walked next list for other ccalls
// Ast*::user3() // TraceActivityVertex* for this node
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
// AstUser4InUse In V3Hasher via V3DupFinder
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
// VNUser4InUse In V3Hasher via V3DupFinder
// STATE
AstNodeModule* m_topModp = nullptr; // Module to add variables to
@ -448,7 +448,7 @@ private:
AstNodeDType* const newArrDtp = new AstUnpackArrayDType(flp, newScalarDtp, newArange);
v3Global.rootp()->typeTablep()->addTypesp(newArrDtp);
AstVar* const newvarp
= new AstVar(flp, AstVarType::MODULETEMP, "__Vm_traceActivity", newArrDtp);
= new AstVar(flp, VVarType::MODULETEMP, "__Vm_traceActivity", newArrDtp);
m_topModp->addStmtp(newvarp);
AstVarScope* const newvscp = new AstVarScope(flp, m_topScopep, newvarp);
m_topScopep->addVarp(newvscp);

View File

@ -72,7 +72,7 @@
//######################################################################
class TristateBaseVisitor VL_NOT_FINAL : public AstNVisitor {
class TristateBaseVisitor VL_NOT_FINAL : public VNVisitor {
public:
// METHODS
VL_DEBUG_FUNC; // Declare debug()
@ -122,7 +122,7 @@ public:
class TristateGraph final {
// NODE STATE
// AstVar::user5p -> TristateVertex* for variable being built
// AstUser5InUse m_inuser5; // In visitor below
// VNUser5InUse m_inuser5; // In visitor below
// TYPES
public:
@ -330,11 +330,11 @@ class TristateVisitor final : public TristateBaseVisitor {
// See TristateGraph:
// AstVar::user5p -> TristateVertex* for variable being built
// AstStmt*::user5p -> TristateVertex* for this statement
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const AstUser3InUse m_inuser3;
const AstUser4InUse m_inuser4;
const AstUser5InUse m_inuser5;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
const VNUser3InUse m_inuser3;
const VNUser4InUse m_inuser4;
const VNUser5InUse m_inuser5;
// TYPES
using RefVec = std::vector<AstVarRef*>;
@ -395,7 +395,7 @@ class TristateVisitor final : public TristateBaseVisitor {
AstVar* getCreateEnVarp(AstVar* invarp) {
// Return the master __en for the specified input variable
if (!invarp->user1p()) {
AstVar* const newp = new AstVar(invarp->fileline(), AstVarType::MODULETEMP,
AstVar* const newp = new AstVar(invarp->fileline(), VVarType::MODULETEMP,
invarp->name() + "__en", invarp);
UINFO(9, " newenv " << newp << endl);
modAddStmtp(invarp, newp);
@ -406,7 +406,7 @@ class TristateVisitor final : public TristateBaseVisitor {
AstVar* getCreateOutVarp(AstVar* invarp) {
// Return the master __out for the specified input variable
if (!invarp->user4p()) {
AstVar* const newp = new AstVar(invarp->fileline(), AstVarType::MODULETEMP,
AstVar* const newp = new AstVar(invarp->fileline(), VVarType::MODULETEMP,
invarp->name() + "__out", invarp);
UINFO(9, " newout " << newp << endl);
modAddStmtp(invarp, newp);
@ -415,7 +415,7 @@ class TristateVisitor final : public TristateBaseVisitor {
return VN_AS(invarp->user4p(), Var);
}
AstVar* getCreateUnconnVarp(AstNode* fromp, AstNodeDType* dtypep) {
AstVar* const newp = new AstVar(fromp->fileline(), AstVarType::MODULETEMP,
AstVar* const newp = new AstVar(fromp->fileline(), VVarType::MODULETEMP,
"__Vtriunconn" + cvtToStr(m_unique++), dtypep);
UINFO(9, " newunc " << newp << endl);
modAddStmtp(newp, newp);
@ -565,7 +565,7 @@ class TristateVisitor final : public TristateBaseVisitor {
const int w = lhsp->width();
// create the new lhs driver for this var
AstVar* const newlhsp = new AstVar(lhsp->fileline(), AstVarType::MODULETEMP,
AstVar* const newlhsp = new AstVar(lhsp->fileline(), VVarType::MODULETEMP,
lhsp->name() + "__out" + cvtToStr(m_unique),
VFlagBitPacked(), w); // 2-state ok; sep enable
UINFO(9, " newout " << newlhsp << endl);
@ -574,7 +574,7 @@ class TristateVisitor final : public TristateBaseVisitor {
refp->name(newlhsp->name());
// create a new var for this drivers enable signal
AstVar* const newenp = new AstVar(lhsp->fileline(), AstVarType::MODULETEMP,
AstVar* const newenp = new AstVar(lhsp->fileline(), VVarType::MODULETEMP,
lhsp->name() + "__en" + cvtToStr(m_unique++),
VFlagBitPacked(), w); // 2-state ok
UINFO(9, " newenp " << newenp << endl);
@ -1159,7 +1159,7 @@ class TristateVisitor final : public TristateBaseVisitor {
// Create the output enable pin, connect to new signal
AstNode* enrefp;
{
AstVar* const enVarp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP,
AstVar* const enVarp = new AstVar(nodep->fileline(), VVarType::MODULETEMP,
nodep->name() + "__en" + cvtToStr(m_unique++),
VFlagBitPacked(), enModVarp->width());
enModVarp->direction(VDirection::INPUT);

View File

@ -235,15 +235,15 @@ public:
//######################################################################
// Undriven state, as a visitor of each AstNode
class UndrivenVisitor final : public AstNVisitor {
class UndrivenVisitor final : public VNVisitor {
private:
// NODE STATE
// Netlist:
// AstVar::user1p -> UndrivenVar* for usage var, 0=not set yet
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// Each always:
// AstNode::user2p -> UndrivenVar* for usage var, 0=not set yet
const AstUser2InUse m_inuser2;
const VNUser2InUse m_inuser2;
// STATE
std::array<std::vector<UndrivenVarEntry*>, 3> m_entryps; // Nodes to delete when finished

View File

@ -42,15 +42,15 @@
//######################################################################
class UnknownVisitor final : public AstNVisitor {
class UnknownVisitor final : public VNVisitor {
private:
// NODE STATE
// Cleared on Netlist
// AstSel::user() -> bool. Set true if already processed
// AstArraySel::user() -> bool. Set true if already processed
// AstNode::user2p() -> AstIf* Inserted if assignment for conditional
const AstUser1InUse m_inuser1;
const AstUser2InUse m_inuser2;
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// STATE
AstNodeModule* m_modp = nullptr; // Current module
@ -118,7 +118,7 @@ private:
replaceHandle.relink(newp);
} else {
AstVar* const varp
= new AstVar(fl, AstVarType::MODULETEMP, m_lvboundNames.get(prep), prep->dtypep());
= new AstVar(fl, VVarType::MODULETEMP, m_lvboundNames.get(prep), prep->dtypep());
m_modp->addStmtp(varp);
AstNode* const abovep = prep->backp(); // Grab above point before we replace 'prep'
prep->replaceWith(new AstVarRef(fl, varp, VAccess::WRITE));
@ -331,7 +331,7 @@ private:
// We use the special XTEMP type so it doesn't break pure functions
UASSERT_OBJ(m_modp, nodep, "X number not under module");
AstVar* const newvarp
= new AstVar(nodep->fileline(), AstVarType::XTEMP, m_xrandNames.get(nodep),
= new AstVar(nodep->fileline(), VVarType::XTEMP, m_xrandNames.get(nodep),
VFlagLogicPacked(), nodep->width());
newvarp->lifetime(VLifetime::STATIC);
++m_statUnkVars;

View File

@ -39,7 +39,7 @@
//######################################################################
// Unroll state, as a visitor of each AstNode
class UnrollVisitor final : public AstNVisitor {
class UnrollVisitor final : public VNVisitor {
private:
// STATE
AstVar* m_forVarp; // Iterator variable

View File

@ -78,7 +78,7 @@ unsigned VarTspSorter::s_serialNext = 0;
class VariableOrder final {
// NODE STATE
// AstVar::user1() -> attributes, via m_attributes
const AstUser1InUse m_user1InUse; // AstVar
const VNUser1InUse m_user1InUse; // AstVar
struct VarAttributes {
uint32_t stratum; // Roughly equivalent to alignment requirement, to avoid padding

View File

@ -180,7 +180,7 @@ std::ostream& operator<<(std::ostream& str, const WidthVP* vup) {
//######################################################################
class WidthClearVisitor final {
// Rather than a AstNVisitor, can just quickly touch every node
// Rather than a VNVisitor, can just quickly touch every node
void clearWidthRecurse(AstNode* nodep) {
for (; nodep; nodep = nodep->nextp()) {
nodep->didWidth(false);
@ -203,10 +203,10 @@ public:
//######################################################################
class WidthVisitor final : public AstNVisitor {
class WidthVisitor final : public VNVisitor {
private:
// TYPES
using TableMap = std::map<std::pair<const AstNodeDType*, AstAttrType>, AstVar*>;
using TableMap = std::map<std::pair<const AstNodeDType*, VAttrType>, AstVar*>;
using PatVecMap = std::map<int, AstPatMember*>;
// STATE
@ -1337,34 +1337,34 @@ private:
if (nodep->dimp()) userIterateAndNext(nodep->dimp(), WidthVP(SELF, BOTH).p());
// Don't iterate children, don't want to lose VarRef.
switch (nodep->attrType()) {
case AstAttrType::VAR_BASE:
case AstAttrType::MEMBER_BASE:
case AstAttrType::ENUM_BASE:
case VAttrType::VAR_BASE:
case VAttrType::MEMBER_BASE:
case VAttrType::ENUM_BASE:
// Soon to be handled in V3LinkWidth SEL generation, under attrp() and newSubLsbOf
break;
case AstAttrType::DIM_DIMENSIONS:
case AstAttrType::DIM_UNPK_DIMENSIONS: {
case VAttrType::DIM_DIMENSIONS:
case VAttrType::DIM_UNPK_DIMENSIONS: {
UASSERT_OBJ(nodep->fromp() && nodep->fromp()->dtypep(), nodep, "Unsized expression");
const std::pair<uint32_t, uint32_t> dim = nodep->fromp()->dtypep()->dimensions(true);
const int val = (nodep->attrType() == AstAttrType::DIM_UNPK_DIMENSIONS
? dim.second
: (dim.first + dim.second));
const int val
= (nodep->attrType() == VAttrType::DIM_UNPK_DIMENSIONS ? dim.second
: (dim.first + dim.second));
nodep->replaceWith(new AstConst(nodep->fileline(), AstConst::Signed32(), val));
VL_DO_DANGLING(nodep->deleteTree(), nodep);
break;
}
case AstAttrType::DIM_BITS:
case AstAttrType::DIM_HIGH:
case AstAttrType::DIM_INCREMENT:
case AstAttrType::DIM_LEFT:
case AstAttrType::DIM_LOW:
case AstAttrType::DIM_RIGHT:
case AstAttrType::DIM_SIZE: {
case VAttrType::DIM_BITS:
case VAttrType::DIM_HIGH:
case VAttrType::DIM_INCREMENT:
case VAttrType::DIM_LEFT:
case VAttrType::DIM_LOW:
case VAttrType::DIM_RIGHT:
case VAttrType::DIM_SIZE: {
UASSERT_OBJ(nodep->fromp() && nodep->fromp()->dtypep(), nodep, "Unsized expression");
AstNodeDType* const dtypep = nodep->fromp()->dtypep();
if (VN_IS(dtypep, QueueDType)) {
switch (nodep->attrType()) {
case AstAttrType::DIM_SIZE: {
case VAttrType::DIM_SIZE: {
AstNode* const newp = new AstCMethodHard(
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", nullptr);
newp->dtypeSetSigned32();
@ -1374,15 +1374,15 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
break;
}
case AstAttrType::DIM_LEFT:
case AstAttrType::DIM_LOW: {
case VAttrType::DIM_LEFT:
case VAttrType::DIM_LOW: {
AstNode* const newp = new AstConst(nodep->fileline(), AstConst::Signed32(), 0);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
break;
}
case AstAttrType::DIM_RIGHT:
case AstAttrType::DIM_HIGH: {
case VAttrType::DIM_RIGHT:
case VAttrType::DIM_HIGH: {
AstNode* const sizep = new AstCMethodHard(
nodep->fileline(), nodep->fromp()->unlinkFrBack(), "size", nullptr);
sizep->dtypeSetSigned32();
@ -1395,14 +1395,14 @@ private:
VL_DO_DANGLING(nodep->deleteTree(), nodep);
break;
}
case AstAttrType::DIM_INCREMENT: {
case VAttrType::DIM_INCREMENT: {
AstNode* const newp
= new AstConst(nodep->fileline(), AstConst::Signed32(), -1);
nodep->replaceWith(newp);
VL_DO_DANGLING(nodep->deleteTree(), nodep);
break;
}
case AstAttrType::DIM_BITS: {
case VAttrType::DIM_BITS: {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: $bits for queue");
break;
}
@ -1446,7 +1446,7 @@ private:
}
break;
}
case AstAttrType::TYPENAME: {
case VAttrType::TYPENAME: {
UASSERT_OBJ(nodep->fromp(), nodep, "Unprovided expression");
const string result = nodep->fromp()->dtypep()->prettyDTypeName();
AstNode* const newp = new AstConst(nodep->fileline(), AstConst::String(), result);
@ -1482,7 +1482,7 @@ private:
UASSERT_OBJ(basicp->width() <= 1, basicp,
"must be 1 bit but actually " << basicp->width() << " bits");
AstBasicDType* const newp = new AstBasicDType(
basicp->fileline(), AstBasicDTypeKwd::LOGIC, basicp->numeric());
basicp->fileline(), VBasicDTypeKwd::LOGIC, basicp->numeric());
newp->widthForce(1, 1);
basicp->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(basicp), basicp);
@ -1684,13 +1684,13 @@ private:
const bool assoc = maxval > ENUM_LOOKUP_BITS;
AstNode* testp = nullptr;
if (assoc) {
AstVar* const varp = enumVarp(enumDtp, AstAttrType::ENUM_VALID, true, 0);
AstVar* const varp = enumVarp(enumDtp, VAttrType::ENUM_VALID, true, 0);
testp = new AstAssocSel{fl, newVarRefDollarUnit(varp),
nodep->fromp()->cloneTree(false)};
} else {
const int selwidth = V3Number::log2b(maxval) + 1; // Width to address a bit
AstVar* const varp
= enumVarp(enumDtp, AstAttrType::ENUM_VALID, false, (1ULL << selwidth) - 1);
= enumVarp(enumDtp, VAttrType::ENUM_VALID, false, (1ULL << selwidth) - 1);
FileLine* const fl_nowarn = new FileLine(fl);
fl_nowarn->warnOff(V3ErrorCode::WIDTH, true);
testp = new AstCond{
@ -2615,13 +2615,13 @@ private:
nodep->replaceWith(newp);
VL_DO_DANGLING(pushDeletep(nodep), nodep);
} else if (nodep->name() == "name" || nodep->name() == "next" || nodep->name() == "prev") {
AstAttrType attrType;
VAttrType attrType;
if (nodep->name() == "name") {
attrType = AstAttrType::ENUM_NAME;
attrType = VAttrType::ENUM_NAME;
} else if (nodep->name() == "next") {
attrType = AstAttrType::ENUM_NEXT;
attrType = VAttrType::ENUM_NEXT;
} else if (nodep->name() == "prev") {
attrType = AstAttrType::ENUM_PREV;
attrType = VAttrType::ENUM_PREV;
} else {
nodep->v3fatalSrc("Bad case");
}
@ -3872,7 +3872,7 @@ private:
// do body while (index__Vfirst || 0 != array.next(index))
varp->dtypeFrom(adtypep->keyDTypep());
AstVar* const first_varp = new AstVar{
fl, AstVarType::BLOCKTEMP, varp->name() + "__Vfirst", VFlagBitPacked{}, 1};
fl, VVarType::BLOCKTEMP, varp->name() + "__Vfirst", VFlagBitPacked{}, 1};
first_varp->usedLoopIdx(true);
AstNode* const firstp = new AstMethodCall{
fl, fromp->cloneTree(false), "first",
@ -4172,10 +4172,10 @@ private:
string text = nodep->fmtp()->text();
if (text.empty()) text = "Elaboration system task message (IEEE 1800-2017 20.11)";
switch (nodep->displayType()) {
case AstDisplayType::DT_INFO: nodep->v3warn(USERINFO, text); break;
case AstDisplayType::DT_ERROR: nodep->v3warn(USERERROR, text); break;
case AstDisplayType::DT_WARNING: nodep->v3warn(USERWARN, text); break;
case AstDisplayType::DT_FATAL: nodep->v3warn(USERFATAL, text); break;
case VDisplayType::DT_INFO: nodep->v3warn(USERINFO, text); break;
case VDisplayType::DT_ERROR: nodep->v3warn(USERERROR, text); break;
case VDisplayType::DT_WARNING: nodep->v3warn(USERWARN, text); break;
case VDisplayType::DT_FATAL: nodep->v3warn(USERFATAL, text); break;
default: UASSERT_OBJ(false, nodep, "Unexpected elaboration display type");
}
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
@ -4619,11 +4619,11 @@ private:
}
if (portDtypep->basicp()->width() != pinDtypep->basicp()->width()
|| (portDtypep->basicp()->keyword() != pinDtypep->basicp()->keyword()
&& !(portDtypep->basicp()->keyword() == AstBasicDTypeKwd::LOGIC_IMPLICIT
&& pinDtypep->basicp()->keyword() == AstBasicDTypeKwd::LOGIC)
&& !(portDtypep->basicp()->keyword() == AstBasicDTypeKwd::LOGIC
&& !(portDtypep->basicp()->keyword() == VBasicDTypeKwd::LOGIC_IMPLICIT
&& pinDtypep->basicp()->keyword() == VBasicDTypeKwd::LOGIC)
&& !(portDtypep->basicp()->keyword() == VBasicDTypeKwd::LOGIC
&& pinDtypep->basicp()->keyword()
== AstBasicDTypeKwd::LOGIC_IMPLICIT))) {
== VBasicDTypeKwd::LOGIC_IMPLICIT))) {
pinp->v3warn(E_UNSUPPORTED,
"Shape of the argument does not match the shape of the parameter "
<< "(" << pinDtypep->basicp()->prettyDTypeNameQ() << " v.s. "
@ -4683,13 +4683,13 @@ private:
// Connection list is now incorrect (has extra args in it).
goto reloop; // so exit early; next loop will correct it
} //
else if (portp->basicp() && portp->basicp()->keyword() == AstBasicDTypeKwd::STRING
else if (portp->basicp() && portp->basicp()->keyword() == VBasicDTypeKwd::STRING
&& !VN_IS(pinp, CvtPackString)
&& !VN_IS(pinp, SFormatF) // Already generates a string
&& !VN_IS(portp->dtypep(), UnpackArrayDType) // Unpacked array must match
&& !(VN_IS(pinp, VarRef)
&& VN_AS(pinp, VarRef)->varp()->basicp()->keyword()
== AstBasicDTypeKwd::STRING)) {
== VBasicDTypeKwd::STRING)) {
UINFO(4, " Add CvtPackString: " << pinp << endl);
VNRelinker handle;
pinp->unlinkFrBack(&handle); // No next, that's the next pin
@ -5530,7 +5530,7 @@ private:
} else if (VN_IS(underp->dtypep(), ClassRefDType)
|| (VN_IS(underp->dtypep(), BasicDType)
&& VN_AS(underp->dtypep(), BasicDType)->keyword()
== AstBasicDTypeKwd::CHANDLE)) {
== VBasicDTypeKwd::CHANDLE)) {
// Allow warning-free "if (handle)"
VL_DO_DANGLING(fixWidthReduce(underp), underp); // Changed
} else if (!underp->dtypep()->basicp()) {
@ -5788,15 +5788,15 @@ private:
if (!nodep->dtypep()) nodep->dtypeFrom(nodep->lhsp());
// To simplify callers, some node types don't need to change
switch (nodep->type()) {
case AstType::atEq: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atNeq: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atEqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atNeqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atEqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atNeqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atAdd: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atSub: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case AstType::atShiftL: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atEq: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atNeq: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atEqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atNeqCase: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atEqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atNeqWild: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atAdd: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atSub: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
case VNType::atShiftL: nodep->dtypeChgSigned(signedFlavorNeeded); return nullptr;
default: break;
}
FileLine* const fl = nodep->fileline();
@ -5804,22 +5804,22 @@ private:
AstNode* const rhsp = nodep->rhsp()->unlinkFrBack();
AstNodeBiop* newp = nullptr;
switch (nodep->type()) {
case AstType::atGt: newp = new AstGtS(fl, lhsp, rhsp); break;
case AstType::atGtS: newp = new AstGt(fl, lhsp, rhsp); break;
case AstType::atGte: newp = new AstGteS(fl, lhsp, rhsp); break;
case AstType::atGteS: newp = new AstGte(fl, lhsp, rhsp); break;
case AstType::atLt: newp = new AstLtS(fl, lhsp, rhsp); break;
case AstType::atLtS: newp = new AstLt(fl, lhsp, rhsp); break;
case AstType::atLte: newp = new AstLteS(fl, lhsp, rhsp); break;
case AstType::atLteS: newp = new AstLte(fl, lhsp, rhsp); break;
case AstType::atDiv: newp = new AstDivS(fl, lhsp, rhsp); break;
case AstType::atDivS: newp = new AstDiv(fl, lhsp, rhsp); break;
case AstType::atModDiv: newp = new AstModDivS(fl, lhsp, rhsp); break;
case AstType::atModDivS: newp = new AstModDiv(fl, lhsp, rhsp); break;
case AstType::atMul: newp = new AstMulS(fl, lhsp, rhsp); break;
case AstType::atMulS: newp = new AstMul(fl, lhsp, rhsp); break;
case AstType::atShiftR: newp = new AstShiftRS(fl, lhsp, rhsp); break;
case AstType::atShiftRS: newp = new AstShiftR(fl, lhsp, rhsp); break;
case VNType::atGt: newp = new AstGtS(fl, lhsp, rhsp); break;
case VNType::atGtS: newp = new AstGt(fl, lhsp, rhsp); break;
case VNType::atGte: newp = new AstGteS(fl, lhsp, rhsp); break;
case VNType::atGteS: newp = new AstGte(fl, lhsp, rhsp); break;
case VNType::atLt: newp = new AstLtS(fl, lhsp, rhsp); break;
case VNType::atLtS: newp = new AstLt(fl, lhsp, rhsp); break;
case VNType::atLte: newp = new AstLteS(fl, lhsp, rhsp); break;
case VNType::atLteS: newp = new AstLte(fl, lhsp, rhsp); break;
case VNType::atDiv: newp = new AstDivS(fl, lhsp, rhsp); break;
case VNType::atDivS: newp = new AstDiv(fl, lhsp, rhsp); break;
case VNType::atModDiv: newp = new AstModDivS(fl, lhsp, rhsp); break;
case VNType::atModDivS: newp = new AstModDiv(fl, lhsp, rhsp); break;
case VNType::atMul: newp = new AstMulS(fl, lhsp, rhsp); break;
case VNType::atMulS: newp = new AstMul(fl, lhsp, rhsp); break;
case VNType::atShiftR: newp = new AstShiftRS(fl, lhsp, rhsp); break;
case VNType::atShiftRS: newp = new AstShiftR(fl, lhsp, rhsp); break;
default: // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node needs sign change, but bad case: " << nodep);
break;
@ -5840,25 +5840,25 @@ private:
AstNodeBiop* newp = nullptr;
// No width change on output;... // All below have bool or double outputs
switch (nodep->type()) {
case AstType::atAdd: newp = new AstAddD(fl, lhsp, rhsp); break;
case AstType::atSub: newp = new AstSubD(fl, lhsp, rhsp); break;
case AstType::atPow: newp = new AstPowD(fl, lhsp, rhsp); break;
case AstType::atEq:
case AstType::atEqCase: newp = new AstEqD(fl, lhsp, rhsp); break;
case AstType::atNeq:
case AstType::atNeqCase: newp = new AstNeqD(fl, lhsp, rhsp); break;
case AstType::atGt:
case AstType::atGtS: newp = new AstGtD(fl, lhsp, rhsp); break;
case AstType::atGte:
case AstType::atGteS: newp = new AstGteD(fl, lhsp, rhsp); break;
case AstType::atLt:
case AstType::atLtS: newp = new AstLtD(fl, lhsp, rhsp); break;
case AstType::atLte:
case AstType::atLteS: newp = new AstLteD(fl, lhsp, rhsp); break;
case AstType::atDiv:
case AstType::atDivS: newp = new AstDivD(fl, lhsp, rhsp); break;
case AstType::atMul:
case AstType::atMulS: newp = new AstMulD(fl, lhsp, rhsp); break;
case VNType::atAdd: newp = new AstAddD(fl, lhsp, rhsp); break;
case VNType::atSub: newp = new AstSubD(fl, lhsp, rhsp); break;
case VNType::atPow: newp = new AstPowD(fl, lhsp, rhsp); break;
case VNType::atEq:
case VNType::atEqCase: newp = new AstEqD(fl, lhsp, rhsp); break;
case VNType::atNeq:
case VNType::atNeqCase: newp = new AstNeqD(fl, lhsp, rhsp); break;
case VNType::atGt:
case VNType::atGtS: newp = new AstGtD(fl, lhsp, rhsp); break;
case VNType::atGte:
case VNType::atGteS: newp = new AstGteD(fl, lhsp, rhsp); break;
case VNType::atLt:
case VNType::atLtS: newp = new AstLtD(fl, lhsp, rhsp); break;
case VNType::atLte:
case VNType::atLteS: newp = new AstLteD(fl, lhsp, rhsp); break;
case VNType::atDiv:
case VNType::atDivS: newp = new AstDivD(fl, lhsp, rhsp); break;
case VNType::atMul:
case VNType::atMulS: newp = new AstMulD(fl, lhsp, rhsp); break;
default: // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node needs conversion to double, but bad case: " << nodep);
break;
@ -5879,18 +5879,18 @@ private:
AstNodeBiop* newp = nullptr;
// No width change on output;... // All below have bool or double outputs
switch (nodep->type()) {
case AstType::atEq:
case AstType::atEqCase: newp = new AstEqN(fl, lhsp, rhsp); break;
case AstType::atNeq:
case AstType::atNeqCase: newp = new AstNeqN(fl, lhsp, rhsp); break;
case AstType::atGt:
case AstType::atGtS: newp = new AstGtN(fl, lhsp, rhsp); break;
case AstType::atGte:
case AstType::atGteS: newp = new AstGteN(fl, lhsp, rhsp); break;
case AstType::atLt:
case AstType::atLtS: newp = new AstLtN(fl, lhsp, rhsp); break;
case AstType::atLte:
case AstType::atLteS: newp = new AstLteN(fl, lhsp, rhsp); break;
case VNType::atEq:
case VNType::atEqCase: newp = new AstEqN(fl, lhsp, rhsp); break;
case VNType::atNeq:
case VNType::atNeqCase: newp = new AstNeqN(fl, lhsp, rhsp); break;
case VNType::atGt:
case VNType::atGtS: newp = new AstGtN(fl, lhsp, rhsp); break;
case VNType::atGte:
case VNType::atGteS: newp = new AstGteN(fl, lhsp, rhsp); break;
case VNType::atLt:
case VNType::atLtS: newp = new AstLtN(fl, lhsp, rhsp); break;
case VNType::atLte:
case VNType::atLteS: newp = new AstLteN(fl, lhsp, rhsp); break;
default: // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node needs conversion to string, but bad case: " << nodep);
break;
@ -5909,7 +5909,7 @@ private:
AstNode* const lhsp = nodep->lhsp()->unlinkFrBack();
AstNodeUniop* newp = nullptr;
switch (nodep->type()) {
case AstType::atNegate: newp = new AstNegateD(fl, lhsp); break;
case VNType::atNegate: newp = new AstNegateD(fl, lhsp); break;
default: // LCOV_EXCL_LINE
nodep->v3fatalSrc("Node needs conversion to double, but bad case: " << nodep);
break;
@ -5986,7 +5986,7 @@ private:
return dtnodep;
}
AstConst* dimensionValue(FileLine* fileline, AstNodeDType* nodep, AstAttrType attrType,
AstConst* dimensionValue(FileLine* fileline, AstNodeDType* nodep, VAttrType attrType,
int dim) {
// Return the dimension value for the specified attribute and constant dimension
AstNodeDType* dtypep = nodep->skipRefp();
@ -6011,7 +6011,7 @@ private:
AstConst* valp = nullptr; // If nullptr, construct from val
int val = 0;
switch (attrType) {
case AstAttrType::DIM_BITS: {
case VAttrType::DIM_BITS: {
int bits = 1;
while (dtypep) {
// UINFO(9, " bits at "<<bits<<" "<<dtypep<<endl);
@ -6039,14 +6039,14 @@ private:
}
break; // LCOV_EXCL_LINE
}
case AstAttrType::DIM_HIGH: val = !declRange.ranged() ? 0 : declRange.hi(); break;
case AstAttrType::DIM_LEFT: val = !declRange.ranged() ? 0 : declRange.left(); break;
case AstAttrType::DIM_LOW: val = !declRange.ranged() ? 0 : declRange.lo(); break;
case AstAttrType::DIM_RIGHT: val = !declRange.ranged() ? 0 : declRange.right(); break;
case AstAttrType::DIM_INCREMENT:
case VAttrType::DIM_HIGH: val = !declRange.ranged() ? 0 : declRange.hi(); break;
case VAttrType::DIM_LEFT: val = !declRange.ranged() ? 0 : declRange.left(); break;
case VAttrType::DIM_LOW: val = !declRange.ranged() ? 0 : declRange.lo(); break;
case VAttrType::DIM_RIGHT: val = !declRange.ranged() ? 0 : declRange.right(); break;
case VAttrType::DIM_INCREMENT:
val = (declRange.ranged() && declRange.littleEndian()) ? -1 : 1;
break;
case AstAttrType::DIM_SIZE: val = !declRange.ranged() ? 0 : declRange.elements(); break;
case VAttrType::DIM_SIZE: val = !declRange.ranged() ? 0 : declRange.elements(); break;
default: nodep->v3fatalSrc("Missing DIM ATTR type case"); break;
}
if (!valp) valp = new AstConst(fileline, AstConst::Signed32(), val);
@ -6054,7 +6054,7 @@ private:
<< ")=" << valp << endl);
return valp;
}
AstVar* dimensionVarp(AstNodeDType* nodep, AstAttrType attrType, uint32_t msbdim) {
AstVar* dimensionVarp(AstNodeDType* nodep, VAttrType attrType, uint32_t msbdim) {
// Return a variable table which has specified dimension properties for this variable
const auto pos = m_tableMap.find(std::make_pair(nodep, attrType));
if (pos != m_tableMap.end()) return pos->second;
@ -6063,7 +6063,7 @@ private:
new AstRange(nodep->fileline(), msbdim, 0));
AstInitArray* const initp = new AstInitArray(nodep->fileline(), vardtypep, nullptr);
v3Global.rootp()->typeTablep()->addTypesp(vardtypep);
AstVar* const varp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP,
AstVar* const varp = new AstVar(nodep->fileline(), VVarType::MODULETEMP,
"__Vdimtab_" + VString::downcase(attrType.ascii())
+ cvtToStr(m_dtTables++),
vardtypep);
@ -6101,16 +6101,16 @@ private:
}
return maxval;
}
AstVar* enumVarp(AstEnumDType* nodep, AstAttrType attrType, bool assoc, uint32_t msbdim) {
AstVar* enumVarp(AstEnumDType* nodep, VAttrType attrType, bool assoc, uint32_t msbdim) {
// Return a variable table which has specified dimension properties for this variable
const auto pos = m_tableMap.find(std::make_pair(nodep, attrType));
if (pos != m_tableMap.end()) return pos->second;
UINFO(9, "Construct Venumtab attr=" << attrType.ascii() << " assoc=" << assoc
<< " max=" << msbdim << " for " << nodep << endl);
AstNodeDType* basep;
if (attrType == AstAttrType::ENUM_NAME) {
if (attrType == VAttrType::ENUM_NAME) {
basep = nodep->findStringDType();
} else if (attrType == AstAttrType::ENUM_VALID) {
} else if (attrType == VAttrType::ENUM_VALID) {
// TODO in theory we could bit-pack the bits in the table, but
// would require additional operations to extract, so only
// would be worth it for larger tables which perhaps could be
@ -6128,7 +6128,7 @@ private:
}
AstInitArray* const initp = new AstInitArray(nodep->fileline(), vardtypep, nullptr);
v3Global.rootp()->typeTablep()->addTypesp(vardtypep);
AstVar* const varp = new AstVar(nodep->fileline(), AstVarType::MODULETEMP,
AstVar* const varp = new AstVar(nodep->fileline(), VVarType::MODULETEMP,
"__Venumtab_" + VString::downcase(attrType.ascii())
+ cvtToStr(m_dtTables++),
vardtypep);
@ -6139,11 +6139,11 @@ private:
v3Global.rootp()->dollarUnitPkgAddp()->addStmtp(varp);
// Default for all unspecified values
if (attrType == AstAttrType::ENUM_NAME) {
if (attrType == VAttrType::ENUM_NAME) {
initp->defaultp(new AstConst(nodep->fileline(), AstConst::String(), ""));
} else if (attrType == AstAttrType::ENUM_NEXT || attrType == AstAttrType::ENUM_PREV) {
} else if (attrType == VAttrType::ENUM_NEXT || attrType == VAttrType::ENUM_PREV) {
initp->defaultp(new AstConst(nodep->fileline(), V3Number(nodep, nodep->width(), 0)));
} else if (attrType == AstAttrType::ENUM_VALID) {
} else if (attrType == VAttrType::ENUM_VALID) {
initp->defaultp(new AstConst{nodep->fileline(), AstConst::BitFalse{}});
} else {
nodep->v3fatalSrc("Bad case");
@ -6161,13 +6161,13 @@ private:
const AstConst* const vconstp = VN_AS(itemp->valuep(), Const);
UASSERT_OBJ(vconstp, nodep, "Enum item without constified value");
const vluint64_t i = vconstp->toUQuad();
if (attrType == AstAttrType::ENUM_NAME) {
if (attrType == VAttrType::ENUM_NAME) {
values[i] = new AstConst(nodep->fileline(), AstConst::String(), itemp->name());
} else if (attrType == AstAttrType::ENUM_NEXT) {
} else if (attrType == VAttrType::ENUM_NEXT) {
values[i] = (nextp ? nextp : firstp)->valuep()->cloneTree(false); // A const
} else if (attrType == AstAttrType::ENUM_PREV) {
} else if (attrType == VAttrType::ENUM_PREV) {
values[i] = prevp->valuep()->cloneTree(false); // A const
} else if (attrType == AstAttrType::ENUM_VALID) {
} else if (attrType == VAttrType::ENUM_VALID) {
values[i] = new AstConst(nodep->fileline(), AstConst::BitTrue{});
} else {
nodep->v3fatalSrc("Bad case");

View File

@ -34,7 +34,7 @@
/// Remove all $signed, $unsigned, we're done with them.
/// This step is only called on real V3Width, not intermediate e.g. widthParams
class WidthRemoveVisitor final : public AstNVisitor {
class WidthRemoveVisitor final : public VNVisitor {
private:
// METHODS
void replaceWithSignedVersion(AstNode* nodep, AstNode* newp) {
@ -64,10 +64,10 @@ public:
// Now that all widthing is complete,
// Copy all width() to widthMin(). V3Const expects this
class WidthCommitVisitor final : public AstNVisitor {
class WidthCommitVisitor final : public VNVisitor {
// NODE STATE
// AstVar::user1p -> bool, processed
const AstUser1InUse m_inuser1;
const VNUser1InUse m_inuser1;
// STATE
AstNodeModule* m_modp = nullptr;

View File

@ -36,7 +36,7 @@
//######################################################################
// Width state, as a visitor of each AstNode
class WidthSelVisitor final : public AstNVisitor {
class WidthSelVisitor final : public VNVisitor {
private:
// IMPORTANT
//**** This is not a normal visitor, in that all iteration is instead

View File

@ -589,7 +589,7 @@ static void verilate(const string& argString) {
// Internal tests (after option parsing as need debug() setting,
// and after removing files as may make debug output)
AstBasicDTypeKwd::selfTest();
VBasicDTypeKwd::selfTest();
if (v3Global.opt.debugSelfTest()) {
VHashSha256::selfTest();
VSpellCheck::selfTest();

View File

@ -525,13 +525,13 @@ def write_impl(filename):
fh.write("return ")
if re.search(r'^Node', typen):
fh.write(
"static_cast<int>(nodep->type()) >= static_cast<int>(AstType::first"
"static_cast<int>(nodep->type()) >= static_cast<int>(VNType::first"
+ typen + ") && ")
fh.write(
"static_cast<int>(nodep->type()) <= static_cast<int>(AstType::last"
"static_cast<int>(nodep->type()) <= static_cast<int>(VNType::last"
+ typen + "); ")
else:
fh.write("nodep->type() == AstType::at" + typen + "; ")
fh.write("nodep->type() == VNType::at" + typen + "; ")
fh.write("}\n")
@ -619,7 +619,7 @@ def write_macros(filename):
typen = match.group(1)
base = match.group(4)
if not typen.startswith("Node"):
macro = "#define ASTGEN_SUPER_{t}(...) {b}(AstType::at{t}, __VA_ARGS__)\n" \
macro = "#define ASTGEN_SUPER_{t}(...) {b}(VNType::at{t}, __VA_ARGS__)\n" \
.format(b=base, t=typen)
fh.write(macro)

View File

@ -51,7 +51,7 @@
class V3ParseGrammar {
public:
bool m_impliedDecl = false; // Allow implied wire declarations
AstVarType m_varDecl; // Type for next signal declaration (reg/wire/etc)
VVarType m_varDecl; // Type for next signal declaration (reg/wire/etc)
bool m_varDeclTyped = false; // Var got reg/wire for dedup check
VDirection m_varIO; // Direction for next signal declaration (reg/wire/etc)
VLifetime m_varLifetime; // Static/Automatic for next signal
@ -74,7 +74,7 @@ public:
// CONSTRUCTORS
V3ParseGrammar() {
m_varDecl = AstVarType::UNKNOWN;
m_varDecl = VVarType::UNKNOWN;
m_varIO = VDirection::NONE;
}
static V3ParseGrammar* singletonp() {
@ -97,8 +97,7 @@ public:
return new AstText(fileline, newtext);
}
AstDisplay* createDisplayError(FileLine* fileline) {
AstDisplay* nodep
= new AstDisplay(fileline, AstDisplayType::DT_ERROR, "", nullptr, nullptr);
AstDisplay* nodep = new AstDisplay(fileline, VDisplayType::DT_ERROR, "", nullptr, nullptr);
nodep->addNext(new AstStop(fileline, true));
return nodep;
}
@ -134,7 +133,7 @@ public:
<< name << "'");
}
}
void setVarDecl(AstVarType type) { m_varDecl = type; }
void setVarDecl(VVarType type) { m_varDecl = type; }
void setDType(AstNodeDType* dtypep) {
if (m_varDTypep) VL_DO_CLEAR(m_varDTypep->deleteTree(), m_varDTypep = nullptr);
m_varDTypep = dtypep;
@ -170,7 +169,7 @@ public:
if (dtypep->implicit()) {
// It's no longer implicit but a wire logic type
AstBasicDType* const newp = new AstBasicDType{
dtypep->fileline(), AstBasicDTypeKwd::LOGIC, dtypep->numeric(),
dtypep->fileline(), VBasicDTypeKwd::LOGIC, dtypep->numeric(),
dtypep->width(), dtypep->widthMin()};
VL_DO_DANGLING(dtypep->deleteTree(), dtypep);
dtypep = newp;
@ -189,8 +188,8 @@ public:
}
};
const AstBasicDTypeKwd LOGIC = AstBasicDTypeKwd::LOGIC; // Shorthand "LOGIC"
const AstBasicDTypeKwd LOGIC_IMPLICIT = AstBasicDTypeKwd::LOGIC_IMPLICIT;
const VBasicDTypeKwd LOGIC = VBasicDTypeKwd::LOGIC; // Shorthand "LOGIC"
const VBasicDTypeKwd LOGIC_IMPLICIT = VBasicDTypeKwd::LOGIC_IMPLICIT;
int V3ParseGrammar::s_modTypeImpNum = 0;
@ -224,7 +223,7 @@ int V3ParseGrammar::s_modTypeImpNum = 0;
GRAMMARP->m_varDeclTyped = false; \
}
#define VARDECL(type) \
{ GRAMMARP->setVarDecl(AstVarType::type); }
{ GRAMMARP->setVarDecl(VVarType::type); }
#define VARIO(type) \
{ GRAMMARP->m_varIO = VDirection::type; }
#define VARLIFE(flag) \
@ -1205,7 +1204,7 @@ udpFront<nodeModulep>:
{ $$ = new AstPrimitive($<fl>3, *$3); $$->inLibrary(true);
$$->lifetime($2);
$$->modTrace(false);
$$->addStmtp(new AstPragma($<fl>3, AstPragmaType::INLINE_MODULE));
$$->addStmtp(new AstPragma($<fl>3, VPragmaType::INLINE_MODULE));
GRAMMARP->m_tracingParse = false;
PARSEP->rootp()->addModulep($$);
SYMP->pushNew($$); }
@ -1281,7 +1280,7 @@ portAndTagE<nodep>:
{ int p = PINNUMINC();
const string name = "__pinNumber" + cvtToStr(p);
$$ = new AstPort{CRELINE(), p, name};
AstVar* varp = new AstVar{CRELINE(), AstVarType::PORT, name, VFlagChildDType{},
AstVar* varp = new AstVar{CRELINE(), VVarType::PORT, name, VFlagChildDType{},
new AstBasicDType{CRELINE(), LOGIC_IMPLICIT}};
varp->declDirection(VDirection::INPUT);
varp->direction(VDirection::INPUT);
@ -1624,7 +1623,7 @@ list_of_genvar_identifiers<nodep>: // IEEE: list_of_genvar_identifiers (for decl
genvar_identifierDecl<varp>: // IEEE: genvar_identifier (for declaration)
id/*new-genvar_identifier*/ sigAttrListE
{ VARRESET_NONLIST(GENVAR);
VARDTYPE(new AstBasicDType($<fl>1, AstBasicDTypeKwd::INTEGER));
VARDTYPE(new AstBasicDType($<fl>1, VBasicDTypeKwd::INTEGER));
$$ = VARDONEA($<fl>1, *$1, nullptr, $2); }
;
@ -1779,24 +1778,24 @@ tf_port_declaration<nodep>: // ==IEEE: tf_port_declaration
;
integer_atom_type<basicDTypep>: // ==IEEE: integer_atom_type
yBYTE { $$ = new AstBasicDType($1,AstBasicDTypeKwd::BYTE); }
| ySHORTINT { $$ = new AstBasicDType($1,AstBasicDTypeKwd::SHORTINT); }
| yINT { $$ = new AstBasicDType($1,AstBasicDTypeKwd::INT); }
| yLONGINT { $$ = new AstBasicDType($1,AstBasicDTypeKwd::LONGINT); }
| yINTEGER { $$ = new AstBasicDType($1,AstBasicDTypeKwd::INTEGER); }
| yTIME { $$ = new AstBasicDType($1,AstBasicDTypeKwd::TIME); }
yBYTE { $$ = new AstBasicDType($1,VBasicDTypeKwd::BYTE); }
| ySHORTINT { $$ = new AstBasicDType($1,VBasicDTypeKwd::SHORTINT); }
| yINT { $$ = new AstBasicDType($1,VBasicDTypeKwd::INT); }
| yLONGINT { $$ = new AstBasicDType($1,VBasicDTypeKwd::LONGINT); }
| yINTEGER { $$ = new AstBasicDType($1,VBasicDTypeKwd::INTEGER); }
| yTIME { $$ = new AstBasicDType($1,VBasicDTypeKwd::TIME); }
;
integer_vector_type<basicDTypep>: // ==IEEE: integer_atom_type
yBIT { $$ = new AstBasicDType($1,AstBasicDTypeKwd::BIT); }
| yLOGIC { $$ = new AstBasicDType($1,AstBasicDTypeKwd::LOGIC); }
| yREG { $$ = new AstBasicDType($1,AstBasicDTypeKwd::LOGIC); } // logic==reg
yBIT { $$ = new AstBasicDType($1,VBasicDTypeKwd::BIT); }
| yLOGIC { $$ = new AstBasicDType($1,VBasicDTypeKwd::LOGIC); }
| yREG { $$ = new AstBasicDType($1,VBasicDTypeKwd::LOGIC); } // logic==reg
;
non_integer_type<basicDTypep>: // ==IEEE: non_integer_type
yREAL { $$ = new AstBasicDType($1,AstBasicDTypeKwd::DOUBLE); }
| yREALTIME { $$ = new AstBasicDType($1,AstBasicDTypeKwd::DOUBLE); }
| ySHORTREAL { $$ = new AstBasicDType($1,AstBasicDTypeKwd::DOUBLE); UNSUPREAL($1); }
yREAL { $$ = new AstBasicDType($1,VBasicDTypeKwd::DOUBLE); }
| yREALTIME { $$ = new AstBasicDType($1,VBasicDTypeKwd::DOUBLE); }
| ySHORTREAL { $$ = new AstBasicDType($1,VBasicDTypeKwd::DOUBLE); UNSUPREAL($1); }
;
signingE<signstate>: // IEEE: signing - plus empty
@ -1859,19 +1858,19 @@ data_typeNoRef<nodeDTypep>: // ==IEEE: data_type, excluding class_type etc refe
SYMP,VFlagChildDType(),$1),$2,true); }
| enumDecl { $$ = new AstDefImplicitDType($1->fileline(),"__typeimpenum"+cvtToStr(GRAMMARP->s_modTypeImpNum++),
SYMP,VFlagChildDType(),$1); }
| ySTRING { $$ = new AstBasicDType($1,AstBasicDTypeKwd::STRING); }
| yCHANDLE { $$ = new AstBasicDType($1,AstBasicDTypeKwd::CHANDLE); }
| yEVENT { $$ = new AstBasicDType($1,AstBasicDTypeKwd::EVENTVALUE); }
| ySTRING { $$ = new AstBasicDType($1,VBasicDTypeKwd::STRING); }
| yCHANDLE { $$ = new AstBasicDType($1,VBasicDTypeKwd::CHANDLE); }
| yEVENT { $$ = new AstBasicDType($1,VBasicDTypeKwd::EVENTVALUE); }
// // Rules overlap virtual_interface_declaration
// // Parameters here are SV2009
// // IEEE has ['.' modport] but that will conflict with port
// // declarations which decode '.' modport themselves, so
// // instead see data_typeVar
| yVIRTUAL__INTERFACE yINTERFACE id/*interface*/
{ $$ = new AstBasicDType{$1, AstBasicDTypeKwd::CHANDLE};
{ $$ = new AstBasicDType{$1, VBasicDTypeKwd::CHANDLE};
BBUNSUP($1, "Unsupported: virtual interface"); }
| yVIRTUAL__anyID id/*interface*/
{ $$ = new AstBasicDType{$1, AstBasicDTypeKwd::CHANDLE};
{ $$ = new AstBasicDType{$1, VBasicDTypeKwd::CHANDLE};
BBUNSUP($1, "Unsupported: virtual data type"); }
| type_reference { $$ = $1; }
// // IEEE: class_scope: see data_type above
@ -2050,7 +2049,7 @@ enumDecl<nodeDTypep>:
;
enum_base_typeE<nodeDTypep>: // IEEE: enum_base_type
/* empty */ { $$ = new AstBasicDType(CRELINE(), AstBasicDTypeKwd::INT); }
/* empty */ { $$ = new AstBasicDType(CRELINE(), VBasicDTypeKwd::INT); }
// // Not in spec, but obviously "enum [1:0]" should work
// // implicit_type expanded, without empty
// // Note enum base types are always packed data types
@ -2256,7 +2255,7 @@ dtypeAttrList<nodep>:
;
dtypeAttr<nodep>:
yVL_PUBLIC { $$ = new AstAttrOf($1,AstAttrType::DT_PUBLIC); }
yVL_PUBLIC { $$ = new AstAttrOf($1,VAttrType::DT_PUBLIC); }
;
vlTag: // verilator tag handling
@ -2300,10 +2299,10 @@ non_port_module_item<nodep>: // ==IEEE: non_port_module_item
| yaSCIMPH { $$ = new AstScImpHdr($<fl>1,*$1); }
| yaSCCTOR { $$ = new AstScCtor($<fl>1,*$1); }
| yaSCDTOR { $$ = new AstScDtor($<fl>1,*$1); }
| yVL_HIER_BLOCK { $$ = new AstPragma($1,AstPragmaType::HIER_BLOCK); }
| yVL_INLINE_MODULE { $$ = new AstPragma($1,AstPragmaType::INLINE_MODULE); }
| yVL_NO_INLINE_MODULE { $$ = new AstPragma($1,AstPragmaType::NO_INLINE_MODULE); }
| yVL_PUBLIC_MODULE { $$ = new AstPragma($1,AstPragmaType::PUBLIC_MODULE); v3Global.dpi(true); }
| yVL_HIER_BLOCK { $$ = new AstPragma($1,VPragmaType::HIER_BLOCK); }
| yVL_INLINE_MODULE { $$ = new AstPragma($1,VPragmaType::INLINE_MODULE); }
| yVL_NO_INLINE_MODULE { $$ = new AstPragma($1,VPragmaType::NO_INLINE_MODULE); }
| yVL_PUBLIC_MODULE { $$ = new AstPragma($1,VPragmaType::PUBLIC_MODULE); v3Global.dpi(true); }
;
module_or_generate_item<nodep>: // ==IEEE: module_or_generate_item
@ -2647,19 +2646,19 @@ sigAttrList<nodep>:
;
sigAttr<nodep>:
yVL_CLOCKER { $$ = new AstAttrOf($1,AstAttrType::VAR_CLOCKER); }
| yVL_NO_CLOCKER { $$ = new AstAttrOf($1,AstAttrType::VAR_NO_CLOCKER); }
| yVL_CLOCK_ENABLE { $$ = new AstAttrOf($1,AstAttrType::VAR_CLOCK_ENABLE); }
| yVL_PUBLIC { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT_RD { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT_RD); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT_RW { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT_RW); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT_RW attr_event_control { $$ = new AstAttrOf($1,AstAttrType::VAR_PUBLIC_FLAT_RW); v3Global.dpi(true);
yVL_CLOCKER { $$ = new AstAttrOf($1,VAttrType::VAR_CLOCKER); }
| yVL_NO_CLOCKER { $$ = new AstAttrOf($1,VAttrType::VAR_NO_CLOCKER); }
| yVL_CLOCK_ENABLE { $$ = new AstAttrOf($1,VAttrType::VAR_CLOCK_ENABLE); }
| yVL_PUBLIC { $$ = new AstAttrOf($1,VAttrType::VAR_PUBLIC); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT { $$ = new AstAttrOf($1,VAttrType::VAR_PUBLIC_FLAT); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT_RD { $$ = new AstAttrOf($1,VAttrType::VAR_PUBLIC_FLAT_RD); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT_RW { $$ = new AstAttrOf($1,VAttrType::VAR_PUBLIC_FLAT_RW); v3Global.dpi(true); }
| yVL_PUBLIC_FLAT_RW attr_event_control { $$ = new AstAttrOf($1,VAttrType::VAR_PUBLIC_FLAT_RW); v3Global.dpi(true);
$$ = $$->addNext(new AstAlwaysPublic($1,$2,nullptr)); }
| yVL_ISOLATE_ASSIGNMENTS { $$ = new AstAttrOf($1,AstAttrType::VAR_ISOLATE_ASSIGNMENTS); }
| yVL_SC_BV { $$ = new AstAttrOf($1,AstAttrType::VAR_SC_BV); }
| yVL_SFORMAT { $$ = new AstAttrOf($1,AstAttrType::VAR_SFORMAT); }
| yVL_SPLIT_VAR { $$ = new AstAttrOf($1,AstAttrType::VAR_SPLIT_VAR); }
| yVL_ISOLATE_ASSIGNMENTS { $$ = new AstAttrOf($1,VAttrType::VAR_ISOLATE_ASSIGNMENTS); }
| yVL_SC_BV { $$ = new AstAttrOf($1,VAttrType::VAR_SC_BV); }
| yVL_SFORMAT { $$ = new AstAttrOf($1,VAttrType::VAR_SFORMAT); }
| yVL_SPLIT_VAR { $$ = new AstAttrOf($1,VAttrType::VAR_SPLIT_VAR); }
;
rangeListE<nodeRangep>: // IEEE: [{packed_dimension}]
@ -2772,7 +2771,7 @@ instDecl<nodep>:
} }
// // IEEE: interface_identifier' .' modport_identifier list_of_interface_identifiers
| id/*interface*/ '.' id/*modport*/
/*mid*/ { VARRESET_NONLIST(AstVarType::IFACEREF);
/*mid*/ { VARRESET_NONLIST(VVarType::IFACEREF);
VARDTYPE(new AstIfaceRefDType($<fl>1, $<fl>3, "", *$1, *$3)); }
/*cont*/ mpInstnameList ';'
{ $$ = VARDONEP($5,nullptr,nullptr); }
@ -3233,7 +3232,7 @@ statementFor<beginp>: // IEEE: part of statement
;
statementVerilatorPragmas<nodep>:
yVL_COVERAGE_BLOCK_OFF { $$ = new AstPragma($1,AstPragmaType::COVERAGE_BLOCK_OFF); }
yVL_COVERAGE_BLOCK_OFF { $$ = new AstPragma($1,VPragmaType::COVERAGE_BLOCK_OFF); }
;
//UNSUPoperator_assignment<nodep>: // IEEE: operator_assignment
@ -3633,59 +3632,59 @@ system_t_call<nodep>: // IEEE: system_tf_call (as task)
| yD_SWRITEH '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'h'); }
| yD_SWRITEO '(' expr ',' exprDispList ')' { $$ = new AstSFormat($1, $3, $5, 'o'); }
//
| yD_DISPLAY parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr); }
| yD_DISPLAY '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3); }
| yD_DISPLAYB parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr, 'b'); }
| yD_DISPLAYB '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3, 'b'); }
| yD_DISPLAYH parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr, 'h'); }
| yD_DISPLAYH '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3, 'h'); }
| yD_DISPLAYO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, nullptr, 'o'); }
| yD_DISPLAYO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, nullptr, $3, 'o'); }
| yD_MONITOR '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, nullptr, $3); }
| yD_MONITORB '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, nullptr, $3, 'b'); }
| yD_MONITORH '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, nullptr, $3, 'h'); }
| yD_MONITORO '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, nullptr, $3, 'o'); }
| yD_STROBE '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, nullptr, $3); }
| yD_STROBEB '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, nullptr, $3, 'b'); }
| yD_STROBEH '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, nullptr, $3, 'h'); }
| yD_STROBEO '(' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, nullptr, $3, 'o'); }
| yD_DISPLAY parenE { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, nullptr); }
| yD_DISPLAY '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, $3); }
| yD_DISPLAYB parenE { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, nullptr, 'b'); }
| yD_DISPLAYB '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, $3, 'b'); }
| yD_DISPLAYH parenE { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, nullptr, 'h'); }
| yD_DISPLAYH '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, $3, 'h'); }
| yD_DISPLAYO parenE { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, nullptr, 'o'); }
| yD_DISPLAYO '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, nullptr, $3, 'o'); }
| yD_MONITOR '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, nullptr, $3); }
| yD_MONITORB '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, nullptr, $3, 'b'); }
| yD_MONITORH '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, nullptr, $3, 'h'); }
| yD_MONITORO '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, nullptr, $3, 'o'); }
| yD_STROBE '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, nullptr, $3); }
| yD_STROBEB '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, nullptr, $3, 'b'); }
| yD_STROBEH '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, nullptr, $3, 'h'); }
| yD_STROBEO '(' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, nullptr, $3, 'o'); }
| yD_WRITE parenE { $$ = nullptr; } // NOP
| yD_WRITE '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3); }
| yD_WRITE '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_WRITE, nullptr, $3); }
| yD_WRITEB parenE { $$ = nullptr; } // NOP
| yD_WRITEB '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3, 'b'); }
| yD_WRITEB '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_WRITE, nullptr, $3, 'b'); }
| yD_WRITEH parenE { $$ = nullptr; } // NOP
| yD_WRITEH '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3, 'h'); }
| yD_WRITEH '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_WRITE, nullptr, $3, 'h'); }
| yD_WRITEO parenE { $$ = nullptr; } // NOP
| yD_WRITEO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WRITE, nullptr, $3, 'o'); }
| yD_FDISPLAY '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr); }
| yD_FDISPLAY '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5); }
| yD_FDISPLAYB '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr, 'b'); }
| yD_FDISPLAYB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5, 'b'); }
| yD_FDISPLAYH '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr, 'h'); }
| yD_FDISPLAYH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5, 'h'); }
| yD_FDISPLAYO '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, nullptr, 'o'); }
| yD_FDISPLAYO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_DISPLAY, $3, $5, 'o'); }
| yD_FMONITOR '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, $3, $5); }
| yD_FMONITORB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, $3, $5, 'b'); }
| yD_FMONITORH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, $3, $5, 'h'); }
| yD_FMONITORO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_MONITOR, $3, $5, 'o'); }
| yD_FSTROBE '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, $3, $5); }
| yD_FSTROBEB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, $3, $5, 'b'); }
| yD_FSTROBEH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, $3, $5, 'h'); }
| yD_FSTROBEO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_STROBE, $3, $5, 'o'); }
| yD_FWRITE '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_WRITE, $3, $5); }
| yD_FWRITEB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_WRITE, $3, $5, 'b'); }
| yD_FWRITEH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_WRITE, $3, $5, 'h'); }
| yD_FWRITEO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, AstDisplayType::DT_WRITE, $3, $5, 'o'); }
| yD_INFO parenE { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, nullptr, nullptr); }
| yD_INFO '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_INFO, nullptr, $3); }
| yD_WARNING parenE { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING, nullptr, nullptr); }
| yD_WARNING '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_WARNING, nullptr, $3); }
| yD_WRITEO '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_WRITE, nullptr, $3, 'o'); }
| yD_FDISPLAY '(' expr ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, nullptr); }
| yD_FDISPLAY '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, $5); }
| yD_FDISPLAYB '(' expr ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, nullptr, 'b'); }
| yD_FDISPLAYB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, $5, 'b'); }
| yD_FDISPLAYH '(' expr ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, nullptr, 'h'); }
| yD_FDISPLAYH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, $5, 'h'); }
| yD_FDISPLAYO '(' expr ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, nullptr, 'o'); }
| yD_FDISPLAYO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_DISPLAY, $3, $5, 'o'); }
| yD_FMONITOR '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, $3, $5); }
| yD_FMONITORB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, $3, $5, 'b'); }
| yD_FMONITORH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, $3, $5, 'h'); }
| yD_FMONITORO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_MONITOR, $3, $5, 'o'); }
| yD_FSTROBE '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, $3, $5); }
| yD_FSTROBEB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, $3, $5, 'b'); }
| yD_FSTROBEH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, $3, $5, 'h'); }
| yD_FSTROBEO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_STROBE, $3, $5, 'o'); }
| yD_FWRITE '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_WRITE, $3, $5); }
| yD_FWRITEB '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_WRITE, $3, $5, 'b'); }
| yD_FWRITEH '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_WRITE, $3, $5, 'h'); }
| yD_FWRITEO '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1, VDisplayType::DT_WRITE, $3, $5, 'o'); }
| yD_INFO parenE { $$ = new AstDisplay($1,VDisplayType::DT_INFO, nullptr, nullptr); }
| yD_INFO '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_INFO, nullptr, $3); }
| yD_WARNING parenE { $$ = new AstDisplay($1,VDisplayType::DT_WARNING, nullptr, nullptr); }
| yD_WARNING '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_WARNING, nullptr, $3); }
| yD_ERROR parenE { $$ = GRAMMARP->createDisplayError($1); }
| yD_ERROR '(' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_ERROR, nullptr, $3); $$->addNext(new AstStop($1, true)); }
| yD_FATAL parenE { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, nullptr, nullptr); $$->addNext(new AstStop($1, false)); }
| yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, nullptr, nullptr); $$->addNext(new AstStop($1, false)); DEL($3); }
| yD_FATAL '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, nullptr, $5); $$->addNext(new AstStop($1, false)); DEL($3); }
| yD_ERROR '(' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_ERROR, nullptr, $3); $$->addNext(new AstStop($1, true)); }
| yD_FATAL parenE { $$ = new AstDisplay($1,VDisplayType::DT_FATAL, nullptr, nullptr); $$->addNext(new AstStop($1, false)); }
| yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,VDisplayType::DT_FATAL, nullptr, nullptr); $$->addNext(new AstStop($1, false)); DEL($3); }
| yD_FATAL '(' expr ',' exprDispList ')' { $$ = new AstDisplay($1,VDisplayType::DT_FATAL, nullptr, $5); $$->addNext(new AstStop($1, false)); DEL($3); }
//
| yD_MONITOROFF parenE { $$ = new AstMonitorOff($1, true); }
| yD_MONITORON parenE { $$ = new AstMonitorOff($1, false); }
@ -3741,8 +3740,8 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
| yD_ATAN '(' expr ')' { $$ = new AstAtanD($1,$3); }
| yD_ATAN2 '(' expr ',' expr ')' { $$ = new AstAtan2D($1,$3,$5); }
| yD_ATANH '(' expr ')' { $$ = new AstAtanhD($1,$3); }
| yD_BITS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_BITS,$3); }
| yD_BITS '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_BITS,$3,$5); }
| yD_BITS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_BITS,$3); }
| yD_BITS '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_BITS,$3,$5); }
| yD_BITSTOREAL '(' expr ')' { $$ = new AstBitsToRealD($1,$3); }
| yD_BITSTOSHORTREAL '(' expr ')' { $$ = new AstBitsToRealD($1,$3); UNSUPREAL($1); }
| yD_CEIL '(' expr ')' { $$ = new AstCeilD($1,$3); }
@ -3758,7 +3757,7 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
{ $$ = new AstCountBits($1, $3, $5, $7, $9);
BBUNSUP($11, "Unsupported: $countbits with more than 3 control fields"); }
| yD_COUNTONES '(' expr ')' { $$ = new AstCountOnes($1,$3); }
| yD_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_DIMENSIONS,$3); }
| yD_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_DIMENSIONS,$3); }
| yD_EXP '(' expr ')' { $$ = new AstExpD($1,$3); }
| yD_FELL '(' expr ')' { $$ = new AstFell($1,$3); }
| yD_FELL '(' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $fell and clock arguments"); }
@ -3774,20 +3773,20 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
| yD_FSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstFScanF($1,*$5,$3,$6); }
| yD_FSEEK '(' idClassSel ',' expr ',' expr ')' { $$ = new AstFSeek($1,$3,$5,$7); }
| yD_FTELL '(' idClassSel ')' { $$ = new AstFTell($1, $3); }
| yD_HIGH '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_HIGH,$3,nullptr); }
| yD_HIGH '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_HIGH,$3,$5); }
| yD_HIGH '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_HIGH,$3,nullptr); }
| yD_HIGH '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_HIGH,$3,$5); }
| yD_HYPOT '(' expr ',' expr ')' { $$ = new AstHypotD($1,$3,$5); }
| yD_INCREMENT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_INCREMENT,$3,nullptr); }
| yD_INCREMENT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_INCREMENT,$3,$5); }
| yD_INCREMENT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_INCREMENT,$3,nullptr); }
| yD_INCREMENT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_INCREMENT,$3,$5); }
| yD_ISUNBOUNDED '(' expr ')' { $$ = new AstIsUnbounded($1, $3); }
| yD_ISUNKNOWN '(' expr ')' { $$ = new AstIsUnknown($1, $3); }
| yD_ITOR '(' expr ')' { $$ = new AstIToRD($1,$3); }
| yD_LEFT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LEFT,$3,nullptr); }
| yD_LEFT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LEFT,$3,$5); }
| yD_LEFT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_LEFT,$3,nullptr); }
| yD_LEFT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_LEFT,$3,$5); }
| yD_LN '(' expr ')' { $$ = new AstLogD($1,$3); }
| yD_LOG10 '(' expr ')' { $$ = new AstLog10D($1,$3); }
| yD_LOW '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LOW,$3,nullptr); }
| yD_LOW '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_LOW,$3,$5); }
| yD_LOW '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_LOW,$3,nullptr); }
| yD_LOW '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_LOW,$3,$5); }
| yD_ONEHOT '(' expr ')' { $$ = new AstOneHot($1,$3); }
| yD_ONEHOT0 '(' expr ')' { $$ = new AstOneHot0($1,$3); }
| yD_PAST '(' expr ')' { $$ = new AstPast($1,$3, nullptr); }
@ -3800,8 +3799,8 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
| yD_REALTIME parenE { $$ = new AstTimeD($1, VTimescale(VTimescale::NONE)); }
| yD_REALTOBITS '(' expr ')' { $$ = new AstRealToBits($1,$3); }
| yD_REWIND '(' idClassSel ')' { $$ = new AstFSeek($1, $3, new AstConst($1, 0), new AstConst($1, 0)); }
| yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,nullptr); }
| yD_RIGHT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_RIGHT,$3,$5); }
| yD_RIGHT '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_RIGHT,$3,nullptr); }
| yD_RIGHT '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_RIGHT,$3,$5); }
| yD_ROSE '(' expr ')' { $$ = new AstRose($1,$3); }
| yD_ROSE '(' expr ',' expr ')' { $$ = $3; BBUNSUP($1, "Unsupported: $rose and clock arguments"); }
| yD_RTOI '(' expr ')' { $$ = new AstRToIS($1,$3); }
@ -3811,8 +3810,8 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
| yD_SIGNED '(' expr ')' { $$ = new AstSigned($1,$3); }
| yD_SIN '(' expr ')' { $$ = new AstSinD($1,$3); }
| yD_SINH '(' expr ')' { $$ = new AstSinhD($1,$3); }
| yD_SIZE '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_SIZE,$3,nullptr); }
| yD_SIZE '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_SIZE,$3,$5); }
| yD_SIZE '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_SIZE,$3,nullptr); }
| yD_SIZE '(' exprOrDataType ',' expr ')' { $$ = new AstAttrOf($1,VAttrType::DIM_SIZE,$3,$5); }
| yD_SQRT '(' expr ')' { $$ = new AstSqrtD($1,$3); }
| yD_SSCANF '(' expr ',' str commaVRDListE ')' { $$ = new AstSScanF($1,*$5,$3,$6); }
| yD_STIME parenE { $$ = new AstSel($1, new AstTime($1, VTimescale(VTimescale::NONE)), 0, 32); }
@ -3822,9 +3821,9 @@ system_f_call_or_t<nodep>: // IEEE: part of system_tf_call (can be task or func)
| yD_TANH '(' expr ')' { $$ = new AstTanhD($1,$3); }
| yD_TESTPLUSARGS '(' str ')' { $$ = new AstTestPlusArgs($1,*$3); }
| yD_TIME parenE { $$ = new AstTime($1, VTimescale(VTimescale::NONE)); }
| yD_TYPENAME '(' exprOrDataType ')' { $$ = new AstAttrOf($1, AstAttrType::TYPENAME, $3); }
| yD_TYPENAME '(' exprOrDataType ')' { $$ = new AstAttrOf($1, VAttrType::TYPENAME, $3); }
| yD_UNGETC '(' expr ',' expr ')' { $$ = new AstFUngetC($1, $5, $3); } // Arg swap to file first
| yD_UNPACKED_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,AstAttrType::DIM_UNPK_DIMENSIONS,$3); }
| yD_UNPACKED_DIMENSIONS '(' exprOrDataType ')' { $$ = new AstAttrOf($1,VAttrType::DIM_UNPK_DIMENSIONS,$3); }
| yD_UNSIGNED '(' expr ')' { $$ = new AstUnsigned($1, $3); }
| yD_URANDOM '(' expr ')' { $$ = new AstRand($1, $3, true); }
| yD_URANDOM parenE { $$ = new AstRand($1, nullptr, true); }
@ -3840,15 +3839,15 @@ elaboration_system_task<nodep>: // IEEE: elaboration_system_task (1800-2009)
elaboration_system_task_guts<nodep>: // IEEE: part of elaboration_system_task (1800-2009)
// // $fatal first argument is exit number, must be constant
yD_INFO parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_INFO, nullptr); }
| yD_INFO '(' exprList ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_INFO, $3); }
| yD_WARNING parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_WARNING, nullptr); }
| yD_WARNING '(' exprList ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_WARNING, $3); }
| yD_ERROR parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_ERROR, nullptr); }
| yD_ERROR '(' exprList ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_ERROR, $3); }
| yD_FATAL parenE { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, nullptr); }
| yD_FATAL '(' expr ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, nullptr); DEL($3); }
| yD_FATAL '(' expr ',' exprListE ')' { $$ = new AstElabDisplay($1, AstDisplayType::DT_FATAL, $5); DEL($3); }
yD_INFO parenE { $$ = new AstElabDisplay($1, VDisplayType::DT_INFO, nullptr); }
| yD_INFO '(' exprList ')' { $$ = new AstElabDisplay($1, VDisplayType::DT_INFO, $3); }
| yD_WARNING parenE { $$ = new AstElabDisplay($1, VDisplayType::DT_WARNING, nullptr); }
| yD_WARNING '(' exprList ')' { $$ = new AstElabDisplay($1, VDisplayType::DT_WARNING, $3); }
| yD_ERROR parenE { $$ = new AstElabDisplay($1, VDisplayType::DT_ERROR, nullptr); }
| yD_ERROR '(' exprList ')' { $$ = new AstElabDisplay($1, VDisplayType::DT_ERROR, $3); }
| yD_FATAL parenE { $$ = new AstElabDisplay($1, VDisplayType::DT_FATAL, nullptr); }
| yD_FATAL '(' expr ')' { $$ = new AstElabDisplay($1, VDisplayType::DT_FATAL, nullptr); DEL($3); }
| yD_FATAL '(' expr ',' exprListE ')' { $$ = new AstElabDisplay($1, VDisplayType::DT_FATAL, $5); DEL($3); }
;
//UNSUPproperty_actual_arg<nodep>: // ==IEEE: property_actual_arg
@ -4052,8 +4051,8 @@ tf_item_declaration<nodep>: // ==IEEE: tf_item_declaration
;
tf_item_declarationVerilator<nodep>: // Verilator extensions
yVL_PUBLIC { $$ = new AstPragma($1,AstPragmaType::PUBLIC_TASK); v3Global.dpi(true); }
| yVL_NO_INLINE_TASK { $$ = new AstPragma($1,AstPragmaType::NO_INLINE_TASK); }
yVL_PUBLIC { $$ = new AstPragma($1,VPragmaType::PUBLIC_TASK); v3Global.dpi(true); }
| yVL_NO_INLINE_TASK { $$ = new AstPragma($1,VPragmaType::NO_INLINE_TASK); }
;
tf_port_listE<nodep>: // IEEE: tf_port_list + empty
@ -6421,7 +6420,7 @@ vltItem:
| yVLT_FULL_CASE yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM
{ V3Config::addCaseFull(*$3, $5->toUInt()); }
| yVLT_HIER_BLOCK vltDModuleE
{ V3Config::addModulePragma(*$2, AstPragmaType::HIER_BLOCK); }
{ V3Config::addModulePragma(*$2, VPragmaType::HIER_BLOCK); }
| yVLT_PARALLEL_CASE yVLT_D_FILE yaSTRING
{ V3Config::addCaseParallel(*$3, 0); }
| yVLT_PARALLEL_CASE yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM
@ -6478,17 +6477,17 @@ vltVarAttrVarE<strp>:
;
vltVarAttrFront<attrtypeen>:
yVLT_CLOCK_ENABLE { $$ = AstAttrType::VAR_CLOCK_ENABLE; }
| yVLT_CLOCKER { $$ = AstAttrType::VAR_CLOCKER; }
| yVLT_ISOLATE_ASSIGNMENTS { $$ = AstAttrType::VAR_ISOLATE_ASSIGNMENTS; }
| yVLT_NO_CLOCKER { $$ = AstAttrType::VAR_NO_CLOCKER; }
| yVLT_PUBLIC { $$ = AstAttrType::VAR_PUBLIC; v3Global.dpi(true); }
| yVLT_PUBLIC_FLAT { $$ = AstAttrType::VAR_PUBLIC_FLAT; v3Global.dpi(true); }
| yVLT_PUBLIC_FLAT_RD { $$ = AstAttrType::VAR_PUBLIC_FLAT_RD; v3Global.dpi(true); }
| yVLT_PUBLIC_FLAT_RW { $$ = AstAttrType::VAR_PUBLIC_FLAT_RW; v3Global.dpi(true); }
| yVLT_SC_BV { $$ = AstAttrType::VAR_SC_BV; }
| yVLT_SFORMAT { $$ = AstAttrType::VAR_SFORMAT; }
| yVLT_SPLIT_VAR { $$ = AstAttrType::VAR_SPLIT_VAR; }
yVLT_CLOCK_ENABLE { $$ = VAttrType::VAR_CLOCK_ENABLE; }
| yVLT_CLOCKER { $$ = VAttrType::VAR_CLOCKER; }
| yVLT_ISOLATE_ASSIGNMENTS { $$ = VAttrType::VAR_ISOLATE_ASSIGNMENTS; }
| yVLT_NO_CLOCKER { $$ = VAttrType::VAR_NO_CLOCKER; }
| yVLT_PUBLIC { $$ = VAttrType::VAR_PUBLIC; v3Global.dpi(true); }
| yVLT_PUBLIC_FLAT { $$ = VAttrType::VAR_PUBLIC_FLAT; v3Global.dpi(true); }
| yVLT_PUBLIC_FLAT_RD { $$ = VAttrType::VAR_PUBLIC_FLAT_RD; v3Global.dpi(true); }
| yVLT_PUBLIC_FLAT_RW { $$ = VAttrType::VAR_PUBLIC_FLAT_RW; v3Global.dpi(true); }
| yVLT_SC_BV { $$ = VAttrType::VAR_SC_BV; }
| yVLT_SFORMAT { $$ = VAttrType::VAR_SFORMAT; }
| yVLT_SPLIT_VAR { $$ = VAttrType::VAR_SPLIT_VAR; }
;
//**********************************************************************