Internals: Remove dead code, fix or sign off coverage

Remove/fix/signoff uncontroversial code coverage holes. Also added a
couple TODOs that should be investigated at some point
This commit is contained in:
Geza Lore
2025-10-08 08:24:06 +01:00
parent 1a8f9f0483
commit 838b8a2bec
47 changed files with 267 additions and 731 deletions
+4 -7
View File
@@ -157,12 +157,10 @@ public:
typename std::enable_if<std::is_pointer<T>::value, T>::type to() const VL_MT_SAFE {
return reinterpret_cast<T>(m_u.up);
}
WidthVP* c() const { return to<WidthVP*>(); }
VSymEnt* toSymEnt() const { return to<VSymEnt*>(); }
AstNode* toNodep() const VL_MT_SAFE { return to<AstNode*>(); }
V3GraphVertex* toGraphVertex() const { return to<V3GraphVertex*>(); }
int toInt() const { return m_u.ui; }
static VNUser fromInt(int i) { return VNUser{i}; }
};
//######################################################################
@@ -358,7 +356,6 @@ public:
UASSERT_STATIC(!m_backp, "Active linker must be relink()ed before destruction"););
}
inline void relink(AstNode* newp);
AstNode* oldp() const { return m_oldp; }
void dump(std::ostream& str = std::cout) const;
};
inline std::ostream& operator<<(std::ostream& os, const VNRelinker& rhs) {
@@ -967,21 +964,21 @@ protected:
// For internal use only.
template <typename T_TargetType, typename T_DeclType>
constexpr static bool uselessCast() VL_PURE {
constexpr static bool uselessCast() VL_PURE { // LCOV_EXCL_START
using NonRef = typename std::remove_reference<T_DeclType>::type;
using NonPtr = typename std::remove_pointer<NonRef>::type;
using NonCV = typename std::remove_cv<NonPtr>::type;
return std::is_base_of<T_TargetType, NonCV>::value;
}
} // LCOV_EXCL_STOP
// For internal use only.
template <typename T_TargetType, typename T_DeclType>
constexpr static bool impossibleCast() VL_PURE {
constexpr static bool impossibleCast() VL_PURE { // LCOV_EXCL_START
using NonRef = typename std::remove_reference<T_DeclType>::type;
using NonPtr = typename std::remove_pointer<NonRef>::type;
using NonCV = typename std::remove_cv<NonPtr>::type;
return !std::is_base_of<NonCV, T_TargetType>::value;
}
} // LCOV_EXCL_STOP
public:
// For use via the VN_IS macro only, or in templated code
-32
View File
@@ -1439,38 +1439,6 @@ inline std::ostream& operator<<(std::ostream& os, const VNumRange& rhs) {
// ######################################################################
class VParseRefExp final {
public:
enum en : uint8_t {
PX_NONE, // Used in V3LinkParse only
PX_ROOT,
PX_TEXT // Unknown ID component
};
enum en m_e;
VParseRefExp()
: m_e{PX_NONE} {}
// cppcheck-suppress noExplicitConstructor
constexpr VParseRefExp(en _e)
: m_e{_e} {}
explicit VParseRefExp(int _e)
: m_e(static_cast<en>(_e)) {} // Need () or GCC 4.8 false warning
constexpr operator en() const { return m_e; }
const char* ascii() const {
static const char* const names[] = {"", "$root", "TEXT", "PREDOT"};
return names[m_e];
}
};
constexpr bool operator==(const VParseRefExp& lhs, const VParseRefExp& rhs) {
return lhs.m_e == rhs.m_e;
}
constexpr bool operator==(const VParseRefExp& lhs, VParseRefExp::en rhs) { return lhs.m_e == rhs; }
constexpr bool operator==(VParseRefExp::en lhs, const VParseRefExp& rhs) { return lhs == rhs.m_e; }
inline std::ostream& operator<<(std::ostream& os, const VParseRefExp& rhs) {
return os << rhs.ascii();
}
// ######################################################################
class VPragmaType final {
public:
enum en : uint8_t {
-7
View File
@@ -102,13 +102,6 @@ int AstRange::rightConst() const VL_MT_STABLE {
return (constp ? constp->toSInt() : 0);
}
AstPin::AstPin(FileLine* fl, int pinNum, AstVarRef* varname, AstNode* exprp)
: ASTGEN_SUPER_Pin(fl)
, m_pinNum{pinNum}
, m_name{varname->name()} {
this->exprp(exprp);
}
AstPackArrayDType::AstPackArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp,
AstRange* rangep)
: ASTGEN_SUPER_PackArrayDType(fl) {
+43 -355
View File
File diff suppressed because it is too large Load Diff
+8 -31
View File
@@ -322,7 +322,6 @@ public:
void level(int value) { m_level = value; }
int level() const VL_MT_SAFE { return m_level; }
string libname() const { return m_libname; }
string prettyLibnameQ() const { return "'" + prettyName(libname()) + "'"; }
bool isTop() const VL_MT_SAFE { return level() == 1; }
bool modPublic() const { return m_modPublic; }
void modPublic(bool flag) { m_modPublic = flag; }
@@ -409,13 +408,12 @@ public:
void text(const string& value) { m_text = value; }
};
class AstNodeSimpleText VL_NOT_FINAL : public AstNodeText {
bool m_tracking; // When emit, it's ok to parse the string to do indentation
const bool m_tracking; // When emit, it's ok to parse the string to do indentation
public:
AstNodeSimpleText(VNType t, FileLine* fl, const string& textp, bool tracking = false)
: AstNodeText{t, fl, textp}
, m_tracking{tracking} {}
ASTGEN_MEMBERS_AstNodeSimpleText;
void tracking(bool flag) { m_tracking = flag; }
bool tracking() const { return m_tracking; }
};
@@ -725,14 +723,11 @@ class AstCellInline final : public AstNode {
// @astgen ptr := m_scopep : Optional[AstScope] // The scope that the cell is inlined into
string m_name; // Cell name, possibly {a}__DOT__{b}...
const string m_origModName; // Original name of module, ignoring name() changes, for LinkDot
VTimescale m_timeunit; // Parent module time unit
public:
AstCellInline(FileLine* fl, const string& name, const string& origModName,
const VTimescale& timeunit)
AstCellInline(FileLine* fl, const string& name, const string& origModName)
: ASTGEN_SUPER_CellInline(fl)
, m_name{name}
, m_origModName{origModName}
, m_timeunit{timeunit} {}
, m_origModName{origModName} {}
ASTGEN_MEMBERS_AstCellInline;
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
@@ -741,8 +736,6 @@ public:
bool maybePointedTo() const override VL_MT_SAFE { return true; }
string origModName() const { return m_origModName; } // * = modp()->origName() before inlining
void name(const string& name) override { m_name = name; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; }
};
class AstCellInlineScope final : public AstNode {
// A particular scoped usage of a Cell Inline
@@ -770,7 +763,6 @@ public:
string origModName() const {
return m_cellp->origModName();
} // * = modp()->origName() before inlining
void scopep(AstScope* nodep) { m_scopep = nodep; }
};
class AstClassExtends final : public AstNode {
// class extends class name, or class implements class name
@@ -943,7 +935,7 @@ public:
explicit AstConstPool(FileLine* fl);
ASTGEN_MEMBERS_AstConstPool;
bool maybePointedTo() const override VL_MT_SAFE { return true; }
void cloneRelink() override { UASSERT(!clonep(), "Not cloneable"); }
void cloneRelink() override { V3ERROR_NA; } // Not cloneable
AstModule* modp() const { return m_modp; }
// Find a table (unpacked array) within the constant pool which is initialized with the
@@ -1108,7 +1100,7 @@ public:
explicit AstExecGraph(FileLine* fl, const string& name) VL_MT_DISABLED;
~AstExecGraph() override;
ASTGEN_MEMBERS_AstExecGraph;
void cloneRelink() override { UASSERT(!clonep(), "Not cloneable"); }
void cloneRelink() override { V3ERROR_NA; } // Not cloneable
const char* broken() const override {
BROKEN_RTN(!m_depGraphp);
return nullptr;
@@ -1256,7 +1248,7 @@ class AstModportVarRef final : public AstNode {
//
// @astgen ptr := m_varp : Optional[AstVar] // Link to the actual Var
string m_name; // Name of the variable referenced
VDirection m_direction; // Direction of the variable (in/out)
const VDirection m_direction; // Direction of the variable (in/out)
public:
AstModportVarRef(FileLine* fl, const string& name, VDirection::en direction)
: ASTGEN_SUPER_ModportVarRef(fl)
@@ -1266,7 +1258,6 @@ public:
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
string name() const override VL_MT_STABLE { return m_name; }
void direction(const VDirection& flag) { m_direction = flag; }
VDirection direction() const { return m_direction; }
AstVar* varp() const VL_MT_STABLE { return m_varp; } // [After Link] Pointer to variable
void varp(AstVar* varp) { m_varp = varp; }
@@ -1297,7 +1288,7 @@ public:
AstNetlist();
ASTGEN_MEMBERS_AstNetlist;
void deleteContents();
void cloneRelink() override { UASSERT(!clonep(), "Not cloneable"); }
void cloneRelink() override { V3ERROR_NA; } // Not cloneable
string name() const override VL_MT_STABLE { return "$root"; }
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
@@ -1343,12 +1334,6 @@ class AstPackageExport final : public AstNode {
string m_pkgName; // Module the cell instances
public:
AstPackageExport(FileLine* fl, AstPackage* packagep, const string& name)
: ASTGEN_SUPER_PackageExport(fl)
, m_name{name}
, m_packagep{packagep} {
pkgNameFrom();
}
AstPackageExport(FileLine* fl, const string& pkgName, const string& name)
: ASTGEN_SUPER_PackageExport(fl)
, m_name{name}
@@ -1362,9 +1347,6 @@ public:
string prettyPkgNameQ() const { return "'" + prettyName(pkgName()) + "'"; }
AstPackage* packagep() const { return m_packagep; }
void packagep(AstPackage* nodep) { m_packagep = nodep; }
private:
void pkgNameFrom();
};
class AstPackageExportStarStar final : public AstNode {
// A package export *::* declaration
@@ -1424,7 +1406,6 @@ public:
, m_name{name} {
this->exprp(exprp);
}
inline AstPin(FileLine* fl, int pinNum, AstVarRef* varname, AstNode* exprp);
ASTGEN_MEMBERS_AstPin;
void cloneRelink() override {} // TODO V3Param shouldn't require avoiding cloneRelinkGen
void dump(std::ostream& str) const override;
@@ -1698,7 +1679,7 @@ public:
explicit AstTypeTable(FileLine* fl);
ASTGEN_MEMBERS_AstTypeTable;
bool maybePointedTo() const override VL_MT_SAFE { return true; }
void cloneRelink() override { UASSERT(!clonep(), "Not cloneable"); }
void cloneRelink() override { V3ERROR_NA; } // Not cloneable
AstBasicDType* findBasicDType(FileLine* fl, VBasicDTypeKwd kwd);
AstBasicDType* findLogicBitDType(FileLine* fl, VBasicDTypeKwd kwd, int width, int widthMin,
VSigning numeric);
@@ -1863,7 +1844,6 @@ class AstVar final : public AstNode {
bool m_primaryIO : 1; // In/out to top level (or directly assigned from same)
bool m_primaryClock : 1; // In/out to top level and is, or combinationally drives a SenItem
bool m_sc : 1; // SystemC variable
bool m_scClocked : 1; // SystemC sc_clk<> needed
bool m_scSensitive : 1; // SystemC sensitive() needed
bool m_sigPublic : 1; // User C code accesses this signal or is top signal
bool m_sigModPublic : 1; // User C code accesses this signal and module
@@ -1913,7 +1893,6 @@ class AstVar final : public AstNode {
m_primaryIO = false;
m_primaryClock = false;
m_sc = false;
m_scClocked = false;
m_scSensitive = false;
m_usedParam = false;
m_usedLoopIdx = false;
@@ -2052,7 +2031,6 @@ public:
void declTyped(bool flag) { m_declTyped = flag; }
void sensIfacep(AstIface* nodep) { m_sensIfacep = nodep; }
void attrFileDescr(bool flag) { m_fileDescr = flag; }
void attrScClocked(bool flag) { m_scClocked = flag; }
void attrScBv(bool flag) { m_attrScBv = flag; }
void attrIsolateAssign(bool flag) { m_attrIsolateAssign = flag; }
void attrSFormat(bool flag) { m_attrSFormat = flag; }
@@ -2195,7 +2173,6 @@ public:
bool isPulldown() const { return m_isPulldown; }
bool attrScBv() const { return m_attrScBv; }
bool attrFileDescr() const { return m_fileDescr; }
bool attrScClocked() const { return m_scClocked; }
bool attrSFormat() const { return m_attrSFormat; }
bool attrSplitVar() const { return m_attrSplitVar; }
bool attrIsolateAssign() const { return m_attrIsolateAssign; }
+4 -12
View File
@@ -254,9 +254,7 @@ public:
: ASTGEN_SUPER_Break(fl) {}
ASTGEN_MEMBERS_AstBreak;
string verilogKwd() const override { return "break"; }
bool isBrancher() const override {
return true; // SPECIAL: We don't process code after breaks
}
bool isBrancher() const override { V3ERROR_NA_RETURN(true); } // Node removed early
};
class AstCReset final : public AstNodeStmt {
// Reset variable at startup
@@ -399,9 +397,7 @@ public:
: ASTGEN_SUPER_Continue(fl) {}
ASTGEN_MEMBERS_AstContinue;
string verilogKwd() const override { return "continue"; }
bool isBrancher() const override {
return true; // SPECIAL: We don't process code after breaks
}
bool isBrancher() const override { V3ERROR_NA_RETURN(true); } // Node removed early
};
class AstCoverInc final : public AstNodeStmt {
// Coverage analysis point; increment coverage count
@@ -485,9 +481,7 @@ public:
void dump(std::ostream& str) const override;
void targetp(AstNode* nodep) { m_targetp = nodep; }
AstNode* targetp() const { return m_targetp; }
bool isBrancher() const override {
return true; // SPECIAL: We don't process code after breaks
}
bool isBrancher() const override { V3ERROR_NA_RETURN(true); } // Node removed early
};
class AstDisableFork final : public AstNodeStmt {
// A "disable fork" statement
@@ -820,9 +814,7 @@ public:
}
ASTGEN_MEMBERS_AstReturn;
string verilogKwd() const override { return "return"; }
bool isBrancher() const override {
return true; // SPECIAL: We don't process code after breaks
}
bool isBrancher() const override { V3ERROR_NA_RETURN(true); } // Node removed early
};
class AstSFormat final : public AstNodeStmt {
// Parents: statement container
-14
View File
@@ -513,7 +513,6 @@ void AstVar::combineType(const AstVar* otherp) {
if (otherp->isSigModPublic()) sigModPublic(true);
if (otherp->isSigUserRdPublic()) sigUserRdPublic(true);
if (otherp->isSigUserRWPublic()) sigUserRWPublic(true);
if (otherp->attrScClocked()) attrScClocked(true);
if (otherp->varType() == VVarType::PORT) {
varType(otherp->varType());
direction(otherp->direction());
@@ -2203,8 +2202,6 @@ void AstPrintTimeScale::dumpJson(std::ostream& str) const {
dumpJsonGen(str);
}
void AstNodeTermop::dump(std::ostream& str) const { this->AstNodeExpr::dump(str); }
void AstNodeTermop::dumpJson(std::ostream& str) const { dumpJsonGen(str); }
void AstTime::dump(std::ostream& str) const {
this->AstNodeTermop::dump(str);
str << " " << timeunit();
@@ -2479,9 +2476,6 @@ void AstPackageExport::dump(std::ostream& str) const {
}
}
void AstPackageExport::dumpJson(std::ostream& str) const { dumpJsonGen(str); }
void AstPackageExport::pkgNameFrom() {
if (packagep()) m_pkgName = packagep()->name();
}
void AstPackageImport::dump(std::ostream& str) const {
this->AstNode::dump(str);
if (packagep()) {
@@ -2834,14 +2828,6 @@ void AstStrengthSpec::dumpJson(std::ostream& str) const {
dumpJsonStr(str, "strength1", m_s1.ascii());
dumpJsonGen(str);
}
void AstParseRef::dump(std::ostream& str) const {
this->AstNode::dump(str);
str << " [" << expect().ascii() << "]";
}
void AstParseRef::dumpJson(std::ostream& str) const {
dumpJsonStr(str, "expect", expect().ascii());
dumpJsonGen(str);
}
void AstClassOrPackageRef::dump(std::ostream& str) const {
this->AstNode::dump(str);
if (classOrPackageNodep()) str << " cpkg=" << nodeAddr(classOrPackageNodep());
+2 -2
View File
@@ -91,7 +91,7 @@ class BeginVisitor final : public VNVisitor {
// Create CellInline for dotted var resolution
if (!m_ftaskp) {
AstCellInline* const inlinep
= new AstCellInline{flp, m_unnamedScope, blockName, m_modp->timeunit()};
= new AstCellInline{flp, m_unnamedScope, blockName};
m_modp->addInlinesp(inlinep); // Must be parsed before any AstCells
}
}
@@ -407,7 +407,7 @@ static AstNode* createForeachLoop(AstNodeForeach* nodep, AstNode* bodysp, AstVar
condp = new AstGteS{fl, varRefp, rightp};
inc = false;
break;
default: UASSERT_OBJ(0, varp, "Missing comparison handling"); break;
default: varp->v3fatalSrc("Missing comparison handling"); break;
}
AstNodeExpr* incp;
if (inc)
+1 -1
View File
@@ -383,7 +383,7 @@ public:
// allow old rules to still match using a final '*'
string newMatch = match;
if (newMatch.empty() || newMatch.back() != '*') newMatch += '*';
m_waivers.emplace_back(WaiverSetting{code, contents, newMatch});
m_waivers.emplace_back(code, contents, newMatch);
}
void applyBlock(AstGenBlock* nodep) {
+1 -1
View File
@@ -296,7 +296,7 @@ static void dumpDotVertex(std::ostream& os, const DfgVertex& vtx) {
} else if (varVtxp->is<DfgVarArray>()) {
os << ", shape=box3d";
} else {
varVtxp->v3fatalSrc("Unhandled DfgVertexVar sub-type"); // LCOV_EXCL_LINE
varVtxp->v3fatalSrc("Unhandled DfgVertexVar sub-type");
}
// Color
if (varp->direction() == VDirection::INPUT) {
+2
View File
@@ -319,6 +319,7 @@ public:
inline bool isCheaperThanLoad() const;
// Methods that allow DfgVertex to participate in error reporting/messaging
// LCOV_EXCL_START
void v3errorEnd(std::ostringstream& str) const VL_RELEASE(V3Error::s().m_mutex) {
m_filelinep->v3errorEnd(str);
}
@@ -332,6 +333,7 @@ public:
string warnContextSecondary() const { return fileline()->warnContextSecondary(); }
string warnMore() const VL_REQUIRES(V3Error::s().m_mutex) { return fileline()->warnMore(); }
string warnOther() const VL_REQUIRES(V3Error::s().m_mutex) { return fileline()->warnOther(); }
// LCOV_EXCL_STOP
private:
// For internal use only.
+1 -1
View File
@@ -1121,7 +1121,7 @@ class FixUpIndependentRanges final {
if (const DfgVertexVar* const varp = vtx.cast<DfgVertexVar>()) {
return varp->nodep()->name();
}
vtx.v3fatalSrc("Unhandled node type"); // LCOV_EXCL_LINE
vtx.v3fatalSrc("Unhandled node type");
}
// Trace drivers of independent bits of 'vtxp' in the range '[hi:lo]'
+9 -6
View File
@@ -46,13 +46,15 @@ class V3DfgCse final {
static V3Hash vertexSelfHash(const DfgVertex& vtx) {
switch (vtx.type()) {
// Unhandled vertices
case VDfgType::Logic:
case VDfgType::Unresolved: vtx.v3fatalSrc("Should not have reached CSE");
case VDfgType::Logic: // LCOV_EXCL_LINE
case VDfgType::Unresolved: // LCOV_EXCL_STOP
vtx.v3fatalSrc("Should not have reached CSE");
// Special vertices
case VDfgType::Const:
case VDfgType::Const: // LCOV_EXCL_START
case VDfgType::VarArray:
case VDfgType::VarPacked: vtx.v3fatalSrc("Hash should have been pre-computed");
case VDfgType::VarPacked: // LCOV_EXCL_STOP
vtx.v3fatalSrc("Hash should have been pre-computed");
// Vertices with internal information
case VDfgType::Sel: return V3Hash{vtx.as<DfgSel>()->lsb()};
@@ -155,8 +157,9 @@ class V3DfgCse final {
// by 'vertexEquivalent'.
switch (a.type()) {
// Unhandled vertices
case VDfgType::Logic:
case VDfgType::Unresolved: a.v3fatalSrc("Should not have reached CSE");
case VDfgType::Logic: // LCOV_EXCL_START
case VDfgType::Unresolved: // LCOV_EXCL_STOP
a.v3fatalSrc("Should not have reached CSE");
// Special vertices
case VDfgType::Const: return a.as<DfgConst>()->num().isCaseEq(b.as<DfgConst>()->num());
+1 -3
View File
@@ -168,9 +168,7 @@ public:
UASSERT(lo + size - 1 < dtype.size(), "Out of range");
return DfgDataType::array(dtype.elemDtype(), size);
}
case Kind::Null: {
UASSERT(false, "Type cannot be selected from");
}
case Kind::Null: v3fatal("Type cannot be selected from"); // LCOV_EXCL_LINE
}
VL_UNREACHABLE;
}
+4 -4
View File
@@ -170,7 +170,7 @@ class AstToDfgConverter final : public VNVisitor {
} else if (newp->is<DfgVarArray>()) {
newp->srcp(make<DfgSpliceArray>(newp->fileline(), newp->dtype()));
} else {
nodep->v3fatalSrc("Unhandled DfgVertexVar sub-type"); // LCOV_EXCL_LINE
nodep->v3fatalSrc("Unhandled DfgVertexVar sub-type");
}
// Use new temporary
@@ -245,7 +245,7 @@ class AstToDfgConverter final : public VNVisitor {
DfgSpliceArray* const newp = make<DfgSpliceArray>(flp, dtype);
splicep->addDriver(newp, index, flp);
} else {
nodep->v3fatalSrc("Unhandled data type kind"); // LCOV_EXCL_LINE
nodep->v3fatalSrc("Unhandled data type kind");
}
}
@@ -345,7 +345,7 @@ class AstToDfgConverter final : public VNVisitor {
sap->addDriver(item.m_rhsp, item.m_idx, flp);
}
} else {
item.m_lhsp->v3fatalSrc("Unhandled DfgVertexSplice sub-type"); // LCOV_EXCL_LINE
item.m_lhsp->v3fatalSrc("Unhandled DfgVertexSplice sub-type");
}
}
@@ -894,7 +894,7 @@ class AstToDfgSynthesize final {
} else if (var.is<DfgVarArray>()) {
splicep = make<DfgSpliceArray>(var.fileline(), var.dtype());
} else {
var.v3fatalSrc("Unhandled DfgVertexVar sub-type"); // LCOV_EXCL_LINE
var.v3fatalSrc("Unhandled DfgVertexVar sub-type");
}
for (const Driver& d : newDrivers) splicep->addDriver(d.m_vtxp, d.m_lo, d.m_flp);
return splicep;
+9 -13
View File
@@ -193,21 +193,17 @@ void EmitCBaseVisitorConst::emitVarDecl(const AstVar* nodep, bool asRef) {
if (nodep->isIO() && nodep->isSc()) {
UASSERT_OBJ(basicp, nodep, "Unimplemented: Outputting this data type");
if (nodep->attrScClocked() && nodep->isReadOnly()) {
putns(nodep, "sc_core::sc_in_clk ");
if (nodep->isInout()) {
putns(nodep, "sc_core::sc_inout<");
} else if (nodep->isWritable()) {
putns(nodep, "sc_core::sc_out<");
} else if (nodep->isNonOutput()) {
putns(nodep, "sc_core::sc_in<");
} else {
if (nodep->isInout()) {
putns(nodep, "sc_core::sc_inout<");
} else if (nodep->isWritable()) {
putns(nodep, "sc_core::sc_out<");
} else if (nodep->isNonOutput()) {
putns(nodep, "sc_core::sc_in<");
} else {
nodep->v3fatalSrc("Unknown type");
}
puts(nodep->scType());
puts("> ");
nodep->v3fatalSrc("Unknown type");
}
puts(nodep->scType());
puts("> ");
if (asRef) {
if (refNeedParens) putns(nodep, "(");
putns(nodep, "&");
+4 -5
View File
@@ -247,12 +247,11 @@ void EmitCFunc::displayArg(AstNode* dispp, AstNode** elistp, bool isScan, const
AstNode* argp = nullptr;
if (!ignore) {
argp = *elistp;
if (VL_UNCOVERABLE(!argp)) {
if (VL_UNCOVERABLE(!argp)) { // LCOV_EXCL_START
// expectDisplay() checks this first, so internal error if found here
dispp->v3error(
"Internal: Missing arguments for $display-like format"); // LCOV_EXCL_LINE
return; // LCOV_EXCL_LINE
}
dispp->v3error("Internal: Missing arguments for $display-like format");
return;
} // LCOV_EXCL_STOP
// Prep for next parameter
*elistp = (*elistp)->nextp();
if (argp->widthMin() > VL_VALUE_STRING_MAX_WIDTH) {
+2
View File
@@ -26,6 +26,8 @@
VL_DEFINE_DEBUG_FUNCTIONS;
// TODO: this file is completely uncovered by tests
// ######################################################################
// Emit statements
+1 -4
View File
@@ -367,10 +367,6 @@ class EmitCSyms final : EmitCBaseVisitorConst {
if ((nodep->isSigUserRdPublic() || nodep->isSigUserRWPublic()) && !m_cfuncp)
m_modVars.emplace_back(m_modp, nodep);
}
void visit(AstVarScope* nodep) override {
iterateChildrenConst(nodep);
m_statVarScopeBytes += nodep->varp()->dtypep()->widthTotalBytes();
}
void visit(AstNodeCoverDecl* nodep) override {
// Assign numbers to all bins, so we know how big of an array to use
if (!nodep->dataDeclNullp()) { // else duplicate we don't need code for
@@ -830,6 +826,7 @@ void EmitCSyms::emitSymImp() {
if (v3Global.opt.debugStackCheck()) stackSize += 1024 * 1024 * 1024;
V3Stats::addStat("Size prediction, Stack (bytes)", stackSize);
puts("Verilated::stackCheck(" + cvtToStr(stackSize) + ");\n");
// TODO: 'm_statVarScopeBytes' is always 0, AstVarScope doesn't reach here (V3Descope)
V3Stats::addStat("Size prediction, Heap, from Var Scopes (bytes)", m_statVarScopeBytes);
V3Stats::addStat(V3Stats::STAT_MODEL_SIZE, stackSize + m_statVarScopeBytes);
}
+2 -2
View File
@@ -104,7 +104,7 @@ void V3ErrorGuarded::vlAbortOrExit() VL_REQUIRES(m_mutex) {
VL_GCOV_DUMP();
// Exit without triggering any global destructors. Used to prevent
// detached V3ThreadPool jobs accessing destroyed static objects.
::_exit(1);
::_exit(1); // LCOV_EXCL_LINE
}
v3Global.vlExit(1);
#else
@@ -375,7 +375,7 @@ void V3Error::vlAbort() {
v3Global.shutdown();
#endif
VL_GCOV_DUMP();
std::abort();
std::abort(); // LCOV_EXCL_LINE
}
std::ostringstream& V3Error::v3errorPrep(V3ErrorCode code) VL_ACQUIRE(s().m_mutex) {
V3Error::s().m_mutex.lock();
-2
View File
@@ -133,8 +133,6 @@ public:
V3OutFormatter(Language lang);
virtual ~V3OutFormatter() = default;
// ACCESSORS
int column() const { return m_column; }
int blockIndent() const { return m_blockIndent; }
void blockIndent(int flag) { m_blockIndent = flag; }
// METHODS
void printf(const char* fmt...) VL_ATTR_PRINTF(2);
+3 -3
View File
@@ -105,7 +105,7 @@ template V3GraphEdge* V3GraphVertex::findConnectingEdgep<GraphWay::FORWARD>(V3Gr
template V3GraphEdge* V3GraphVertex::findConnectingEdgep<GraphWay::REVERSE>(V3GraphVertex*);
// cppcheck-has-bug-suppress constParameter
void V3GraphVertex::v3errorEnd(const std::ostringstream& str) const
void V3GraphVertex::v3errorEnd(const std::ostringstream& str) const // LCOV_EXCL_START
VL_RELEASE(V3Error::s().m_mutex) {
std::ostringstream nsstr;
nsstr << str.str();
@@ -119,9 +119,9 @@ void V3GraphVertex::v3errorEnd(const std::ostringstream& str) const
void V3GraphVertex::v3errorEndFatal(const std::ostringstream& str) const
VL_RELEASE(V3Error::s().m_mutex) {
v3errorEnd(str);
assert(0); // LCOV_EXCL_LINE
assert(0);
VL_UNREACHABLE;
}
} // LCOV_EXCL_STOP
std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp) {
os << " VERTEX=" << vertexp->name();
+1 -2
View File
@@ -359,8 +359,7 @@ class HasherVisitor final : public VNVisitorConst {
m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, []() {});
}
void visit(AstParseRef* nodep) override {
m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() {
m_hash += nodep->expect();
m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [this, nodep]() { //
m_hash += nodep->name();
});
}
-2
View File
@@ -51,8 +51,6 @@ public:
const GParams& gparams() const { return m_params; };
const GTypeParams& gTypeParams() const { return m_typeParams; };
GParams& gparams() { return m_params; };
GTypeParams& gTypeParams() { return m_typeParams; };
void swap(V3HierBlockParams& other) {
m_params.swap(other.m_params);
+3 -3
View File
@@ -520,7 +520,7 @@ void connectPort(AstNodeModule* modp, AstVar* nodep, AstNodeExpr* pinExprp) {
} else if (nodep->direction() == VDirection::OUTPUT) {
modp->addStmtsp(new AstAssignW{flp, pinRef(VAccess::WRITE), portRef(VAccess::READ)});
} else {
pinExprp->v3fatalSrc("V3Tristate left INOUT port"); // LCOV_EXCL_LINE
pinExprp->v3fatalSrc("V3Tristate left INOUT port");
}
}
@@ -555,8 +555,8 @@ void inlineCell(AstNodeModule* modp, AstCell* cellp, bool last) {
}
// Create data for resolving hierarchical references later.
modp->addInlinesp(new AstCellInline{cellp->fileline(), cellp->name(),
cellp->modp()->origName(), cellp->modp()->timeunit()});
modp->addInlinesp(
new AstCellInline{cellp->fileline(), cellp->name(), cellp->modp()->origName()});
// Connect the pins on the instance
for (AstPin* pinp = cellp->pinsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) {
+4 -4
View File
@@ -470,10 +470,10 @@ class LinkCellsVisitor final : public VNVisitor {
if (pinStar) {
UINFO(9, " need .* PORT " << portp);
// Create any not already connected
AstPin* const newp = new AstPin{
nodep->fileline(), 0, portp->name(),
new AstParseRef{nodep->fileline(), VParseRefExp::PX_TEXT,
portp->name(), nullptr, nullptr}};
AstPin* const newp
= new AstPin{nodep->fileline(), 0, portp->name(),
new AstParseRef{nodep->fileline(), portp->name(),
nullptr, nullptr}};
newp->svDotName(true);
newp->svImplicit(true);
nodep->addPinsp(newp);
+5 -6
View File
@@ -541,9 +541,9 @@ public:
continue;
} else if (ifacerefp->ifaceViaCellp()->dead()
|| !existsNodeSym(ifacerefp->ifaceViaCellp())) {
UASSERT_OBJ(false, ifacerefp->ifaceViaCellp(),
"Interface referenced by virtual iface is dead. "
"Dead interfaces have required linking steps skipped");
ifacerefp->ifaceViaCellp()->v3fatalSrc(
"Interface referenced by virtual iface is dead. "
"Dead interfaces have required linking steps skipped");
}
VSymEnt* const ifaceSymp = getNodeSym(ifacerefp->ifaceViaCellp());
VSymEnt* ifOrPortSymp = ifaceSymp;
@@ -2664,8 +2664,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
if (classExtendsp->argsp()) pinsp = classExtendsp->argsp()->cloneTree(true);
AstNew* const newExprp = new AstNew{fl, pinsp};
newExprp->isImplicit(true);
AstDot* const superNewp
= new AstDot{fl, false, new AstParseRef{fl, VParseRefExp::PX_ROOT, "super"}, newExprp};
AstDot* const superNewp = new AstDot{fl, false, new AstParseRef{fl, "super"}, newExprp};
AstNodeStmt* const superNewStmtp = superNewp->makeStmt();
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
// super.new shall be the first statement (IEEE 1800-2023 8.15)
@@ -3510,7 +3509,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
allowVar = true;
} else {
UINFO(1, "ds=" << m_ds.ascii());
nodep->v3fatalSrc("Unhandled VParseRefExp");
nodep->v3fatalSrc("Unhandled DotPosition");
}
// Lookup
VSymEnt* foundp;
+3 -3
View File
@@ -397,9 +397,9 @@ class LinkParseVisitor final : public VNVisitor {
newfl->warnOff(V3ErrorCode::E_CONSTWRITTEN, true);
// Create a ParseRef to the wire. We cannot use the var as it may be deleted if
// it's a port (see t_var_set_link.v)
AstAssign* const assp = new AstAssign{
newfl, new AstParseRef{newfl, VParseRefExp::PX_TEXT, nodep->name()},
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr)};
AstAssign* const assp
= new AstAssign{newfl, new AstParseRef{newfl, nodep->name()},
VN_AS(nodep->valuep()->unlinkFrBack(), NodeExpr)};
if (nodep->lifetime().isAutomatic()) {
nodep->addNextHere(new AstInitialAutomatic{newfl, assp});
} else {
+2 -2
View File
@@ -54,7 +54,7 @@ class V3MutexConfig final {
public:
static V3MutexConfig& s() VL_MT_SAFE {
static V3MutexConfig s;
static V3MutexConfig s{};
return s;
}
@@ -67,7 +67,7 @@ public:
// requires <iostream>
// avoided to reduce compile time
// std::cerr << "%Error: V3Mutex already configured." << std::endl;
std::abort();
std::abort(); // LCOV_EXCL_LINE
}
}
bool lockConfig() VL_MT_SAFE { return m_lockConfig; }
+1 -3
View File
@@ -873,9 +873,7 @@ string V3Number::displayed(FileLine* fl, const string& vformat) const VL_MT_STAB
str = displayPad(fmtsizen, ' ', left, toString());
return str;
}
default:
fl->v3fatalSrc("Unknown $display-like format code for number: %" << pos[0]);
return "ERR";
default: fl->v3fatalSrc("Unknown $display-like format code for number: %" << pos[0]);
}
}
+3 -3
View File
@@ -69,9 +69,9 @@ private:
// CONSTANTS
// At least 2 words (64 fourstate bits). 4 words (128 fourstate bits) in most cases,
// i.e. when std::string has 32 bytes.
static constexpr int INLINE_WORDS = vlstd::max(
static_cast<size_t>(2), vlstd::max(sizeof(std::string) / sizeof(ValueAndX),
sizeof(std::vector<ValueAndX>) / sizeof(ValueAndX)));
static constexpr int INLINE_WORDS = std::max(
static_cast<size_t>(2), std::max(sizeof(std::string) / sizeof(ValueAndX),
sizeof(std::vector<ValueAndX>) / sizeof(ValueAndX)));
// When m_width > MAX_INLINE_WIDTH number is stored in m_dynamicNumber.
// Otherwise number is stored in m_inlineNumber.
static constexpr int MAX_INLINE_WIDTH = INLINE_WORDS * sizeof(ValueAndX) / 2 * 8;
-6
View File
@@ -354,7 +354,6 @@ private:
string m_buildDepBin; // main switch: --build-dep-bin {filename}
string m_diagnosticsSarifOutput; // main switch: --diagnostics-sarif-output
string m_exeName; // main switch: -o {name}
string m_flags; // main switch: -f {name}
VFileLibList m_hierParamsFile; // main switch: --hierarchical-params-file
string m_jsonOnlyOutput; // main switch: --json-only-output
string m_jsonOnlyMetaOutput; // main switch: --json-only-meta-output
@@ -479,7 +478,6 @@ public:
bool preprocResolve() const { return m_preprocResolve; }
int preprocTokenLimit() const { return m_preprocTokenLimit; }
bool underlineZero() const { return m_underlineZero; }
string flags() const { return m_flags; }
bool systemC() const VL_MT_SAFE { return m_systemC; }
bool savable() const VL_MT_SAFE { return m_savable; }
bool stats() const { return m_stats; }
@@ -492,7 +490,6 @@ public:
bool autoflush() const { return m_autoflush; }
bool bboxSys() const { return m_bboxSys; }
bool bboxUnsup() const { return m_bboxUnsup; }
bool binary() const { return m_binary; }
bool build() const { return m_build; }
string buildDepBin() const { return m_buildDepBin; }
void buildDepBin(const string& flag) { m_buildDepBin = flag; }
@@ -622,9 +619,6 @@ public:
return trace() && traceEnabledVcd() && (threads() > 1 || hierChild() > 1);
}
bool useFstWriterThread() const { return traceThreads() && traceEnabledFst(); }
unsigned vmTraceThreads() const {
return useTraceParallel() ? threads() : useTraceOffload() ? 1 : 0;
}
int unrollCount() const { return m_unrollCount; }
int unrollCountAdjusted(const VOptionBool& full, bool generate, bool simulate);
int unrollStmts() const { return m_unrollStmts; }
+7 -9
View File
@@ -43,15 +43,13 @@ using ExternalDomainsProvider = std::function<void(const AstVarScope*, std::vect
// Map from Trigger Sensitivity tree to original Sensitivity tree
using TrigToSenMap = std::unordered_map<const AstSenTree*, const AstSenTree*>;
AstCFunc* order(
AstNetlist* netlistp, //
const std::vector<V3Sched::LogicByScope*>& logic, //
const TrigToSenMap& trigToSen, //
const string& tag, //
bool parallel, //
bool slow, //
const ExternalDomainsProvider& externalDomains
= [](const AstVarScope*, std::vector<AstSenTree*>&) {}) VL_MT_DISABLED;
AstCFunc* order(AstNetlist* netlistp, //
const std::vector<V3Sched::LogicByScope*>& logic, //
const TrigToSenMap& trigToSen, //
const string& tag, //
bool parallel, //
bool slow, //
const ExternalDomainsProvider& externalDomains) VL_MT_DISABLED;
void selfTestParallel();
+5 -5
View File
@@ -337,11 +337,11 @@ class OrderGraphBuilder final : public VNVisitor {
//--- Ignored nodes
void visit(AstVar*) override {}
void visit(AstVarScope* nodep) override {}
void visit(AstCell*) override {} // Only interested in the respective AstScope
void visit(AstTypeTable*) override {}
void visit(AstConstPool*) override {}
void visit(AstClass*) override {}
void visit(AstVarScope* nodep) override { nodep->v3fatalSrc("Should not reach V3Order"); }
void visit(AstCell* nodep) override { nodep->v3fatalSrc("Should not reach V3Order"); }
void visit(AstTypeTable* nodep) override { nodep->v3fatalSrc("Should not reach V3Order"); }
void visit(AstConstPool* nodep) override { nodep->v3fatalSrc("Should not reach V3Order"); }
void visit(AstClass* nodep) override { nodep->v3fatalSrc("Should not reach V3Order"); }
void visit(AstCFunc*) override {
// Calls to DPI exports handled with AstCCall. /* verilator public */ functions are
// ignored for now (and hence potentially mis-ordered), but could use the same or
+1 -1
View File
@@ -489,7 +489,7 @@ int V3Os::system(const string& command) {
const int ret = ::system(command.c_str());
if (VL_UNCOVERABLE(ret == -1)) {
v3fatal("Failed to execute command:" // LCOV_EXCL_LINE
<< command << " " << std::strerror(errno));
<< command << " " << std::strerror(errno)); // LCOV_EXCL_LINE
return -1; // LCOV_EXCL_LINE
} else {
UASSERT(WIFEXITED(ret), "system(" << command << ") returned unexpected value of " << ret);
+3 -4
View File
@@ -97,10 +97,9 @@ AstArg* V3ParseGrammar::argWrapList(AstNodeExpr* nodep) {
}
AstNode* V3ParseGrammar::createSupplyExpr(FileLine* fileline, const string& name, int value) {
AstAssignW* assignp
= new AstAssignW{fileline, new AstParseRef{fileline, VParseRefExp::PX_TEXT, name},
value ? new AstConst{fileline, AstConst::All1{}}
: new AstConst{fileline, AstConst::All0{}}};
AstAssignW* assignp = new AstAssignW{fileline, new AstParseRef{fileline, name},
value ? new AstConst{fileline, AstConst::All1{}}
: new AstConst{fileline, AstConst::All0{}}};
AstStrengthSpec* strengthSpecp
= new AstStrengthSpec{fileline, VStrength::SUPPLY, VStrength::SUPPLY};
assignp->strengthSpecp(strengthSpecp);
+1 -1
View File
@@ -177,7 +177,7 @@ public:
return new AstSenTree{fl, new AstSenItem{fl, VEdgeType::ET_COMBO_STAR, nullptr}};
}
AstNodeExpr* createGlobalClockParseRef(FileLine* fl) {
return new AstParseRef{fl, VParseRefExp::PX_TEXT, "__024global_clock", nullptr, nullptr};
return new AstParseRef{fl, "__024global_clock", nullptr, nullptr};
}
AstSenTree* createGlobalClockSenTree(FileLine* fl) {
return createSenTreeChanged(fl, createGlobalClockParseRef(fl));
+1 -2
View File
@@ -1329,8 +1329,7 @@ int V3PreProcImp::getStateToken() {
define(fileline(), m_lastSym, value, formals, false);
}
} else {
const string msg = "Bad define text, unexpected "s + tokenName(tok) + "\n";
v3fatalSrc(msg);
v3fatalSrc("Bad define text, unexpected "s + tokenName(tok) + "\n");
}
statePop();
// DEFVALUE is terminated by a return, but lex can't return both tokens.
+6 -5
View File
@@ -316,7 +316,9 @@ class SliceVisitor final : public VNVisitor {
"Array initialization should have been removed earlier");
}
void expandBiOp(AstNodeBiop* nodep) {
template <typename T_NodeBiop>
void expandBiOp(T_NodeBiop* biopp) {
AstNodeBiop* nodep = biopp;
if (nodep->user1SetOnce()) return; // Process once
UINFO(9, " Bi-Eq/Neq expansion " << nodep);
@@ -330,10 +332,9 @@ class SliceVisitor final : public VNVisitor {
// EQ(a,b) -> LOGAND(EQ(ARRAYSEL(a,0), ARRAYSEL(b,0)), ...[1])
// Original node is replaced, so it is safe to copy it one time even if it is
// impure.
AstNodeBiop* const clonep = VN_AS(
nodep->cloneType(cloneAndSel(nodep->lhsp(), elements, elemIdx, elemIdx != 0),
cloneAndSel(nodep->rhsp(), elements, elemIdx, elemIdx != 0)),
NodeBiop);
T_NodeBiop* const clonep = new T_NodeBiop{
nodep->fileline(), cloneAndSel(nodep->lhsp(), elements, elemIdx, elemIdx != 0),
cloneAndSel(nodep->rhsp(), elements, elemIdx, elemIdx != 0)};
if (elemIdx == 0) {
nodep->foreach([this](AstExprStmt* const exprp) {
// Result expression is always evaluated to the same value, so the
-6
View File
@@ -21,12 +21,6 @@
namespace vlstd {
// constexpr std::max with arguments passed by value (required by constexpr before C++14)
template <typename T>
constexpr T max(T a, T b) {
return a > b ? a : b;
}
// C++17 is_invocable
template <typename F, typename... Args>
struct is_invocable
-16
View File
@@ -58,22 +58,6 @@ typename std::enable_if<std::is_integral<T>::value, std::string>::type cvtToHex(
return os.str();
}
inline uint32_t cvtToHash(const void* vp) {
// We can shove a 64 bit pointer into a 32 bit bucket
// On 32-bit systems, lower is always 0, but who cares?
union {
const void* up;
struct {
uint32_t upper;
uint32_t lower;
} l;
} u;
u.l.upper = 0;
u.l.lower = 0;
u.up = vp;
return u.l.upper ^ u.l.lower;
}
inline string ucfirst(const string& text) {
string result = text;
result[0] = std::toupper(result[0]);
+2 -2
View File
@@ -344,10 +344,10 @@ class TraceDeclVisitor final : public VNVisitor {
void checkCalls(const AstCFunc* funcp) {
if (!v3Global.opt.debugCheck()) return;
checkCallsRecurse(funcp);
if (!m_declUncalledps.empty()) {
if (!m_declUncalledps.empty()) { // LCOV_EXCL_START
for (auto tracep : m_declUncalledps) UINFO(0, "-nodep " << tracep);
(*(m_declUncalledps.begin()))->v3fatalSrc("Created TraceDecl which is never called");
}
} // LCOV_EXCL_STOP
}
void checkCallsRecurse(const AstCFunc* funcp) {
funcp->foreach([this](const AstNode* nodep) {
+2 -2
View File
@@ -547,8 +547,8 @@ class UndrivenVisitor final : public VNVisitorConst {
void visit(AstNodeCoverDecl*) override {}
void visit(AstCoverInc*) override {}
void visit(AstCoverToggle*) override {}
void visit(AstTraceDecl*) override {}
void visit(AstTraceInc*) override {}
void visit(AstTraceDecl* nodep) override { nodep->v3fatalSrc("Should not exist yet"); }
void visit(AstTraceInc* nodep) override { nodep->v3fatalSrc("Should not exist yet"); }
// iterate
void visit(AstConst* nodep) override {}
+3 -26
View File
@@ -5487,11 +5487,7 @@ class WidthVisitor final : public VNVisitor {
assertAtStatement(nodep);
iterateCheckBool(nodep, "Loop Condition", nodep->condp(), BOTH);
}
void visit(AstRepeat* nodep) override {
assertAtStatement(nodep);
userIterateAndNext(nodep->countp(), WidthVP{SELF, BOTH}.p());
userIterateAndNext(nodep->stmtsp(), nullptr);
}
void visit(AstRepeat* nodep) override { nodep->v3fatalSrc("'repeat' missed in LinkJump"); }
void visit(AstNodeIf* nodep) override {
assertAtStatement(nodep);
// UINFOTREE(1, nodep, "", "IfPre");
@@ -5863,10 +5859,7 @@ class WidthVisitor final : public VNVisitor {
nodep->text(newFormat);
UINFO(9, " Display out " << nodep->text());
}
void visit(AstCReturn* nodep) override {
assertAtStatement(nodep);
userIterateAndNext(nodep->lhsp(), WidthVP{SELF, BOTH}.p());
}
void visit(AstCReturn* nodep) override { nodep->v3fatalSrc("Should not exist yet"); }
void visit(AstConstraintRef* nodep) override { userIterateChildren(nodep, nullptr); }
void visit(AstDisplay* nodep) override {
assertAtStatement(nodep);
@@ -6428,23 +6421,7 @@ class WidthVisitor final : public VNVisitor {
nodep->didWidth(true);
nodep->doingWidth(false);
}
void visit(AstReturn* nodep) override {
// IEEE: Assignment-like context
assertAtStatement(nodep);
if (!m_funcp) {
if (nodep->lhsp()) { // Return w/o value ok other places
nodep->v3error("Return with return value isn't underneath a function");
}
} else {
if (nodep->lhsp()) {
// Function hasn't been widthed, so make it so.
nodep->dtypeFrom(m_funcp->fvarp());
// AstPattern requires assignments to pass datatype on PRELIM
userIterateAndNext(nodep->lhsp(), WidthVP{nodep->dtypep(), PRELIM}.p());
iterateCheckAssign(nodep, "Return value", nodep->lhsp(), FINAL, nodep->dtypep());
}
}
}
void visit(AstReturn* nodep) override { nodep->v3fatalSrc("'return' missed in LinkJump"); }
AstPackage* getItemPackage(AstNode* pkgItemp) {
while (pkgItemp->backp() && pkgItemp->backp()->nextp() == pkgItemp) {
+33 -33
View File
@@ -2209,7 +2209,7 @@ tf_variable_identifier<varp>: // IEEE: part of list_of_tf_variable_ide
id variable_dimensionListE sigAttrListE exprEqE
{ $$ = VARDONEA($<fl>1, *$1, $2, $3);
if ($4) AstNode::addNext<AstNode, AstNode>(
$$, new AstAssign{$4->fileline(), new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1}, $4}); }
$$, new AstAssign{$4->fileline(), new AstParseRef{$<fl>1, *$1}, $4}); }
;
variable_declExpr<nodep>: // IEEE: part of variable_decl_assignment - rhs of expr
@@ -2974,7 +2974,7 @@ netSig<varp>: // IEEE: net_decl_assignment - one element from
| netId variable_dimensionListE sigAttrListE '=' expr
{ $$ = VARDONEA($<fl>1, *$1, $2, $3);
AstDelay* const delayp = $$->delayp() ? $$->delayp()->unlinkFrBack() : nullptr;
AstAssignW* const assignp = new AstAssignW{$4, new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1}, $5, delayp};
AstAssignW* const assignp = new AstAssignW{$4, new AstParseRef{$<fl>1, *$1}, $5, delayp};
if (GRAMMARP->m_netStrengthp) assignp->strengthSpecp(GRAMMARP->m_netStrengthp->cloneTree(false));
AstNode::addNext<AstNode, AstNode>($$, assignp); }
;
@@ -3222,11 +3222,11 @@ instParamItem<pinp>: // IEEE: named_parameter_assignment + empty
$$->svDotName(true); }
| '.' idSVKwd
{ $$ = new AstPin{$<fl>2, PINNUMINC(), *$2,
new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2, nullptr, nullptr}};
new AstParseRef{$<fl>2, *$2, nullptr, nullptr}};
$$->svDotName(true); $$->svImplicit(true); }
| '.' idAny
{ $$ = new AstPin{$<fl>2, PINNUMINC(), *$2,
new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2, nullptr, nullptr}};
new AstParseRef{$<fl>2, *$2, nullptr, nullptr}};
$$->svDotName(true); $$->svImplicit(true); }
// // mintypmax is expanded here, as it might be a UDP or gate primitive
// // data_type for 'parameter type' hookups
@@ -3261,11 +3261,11 @@ instPinItemE<pinp>: // IEEE: named_port_connection + empty
$$->svDotName(true); }
| '.' idSVKwd
{ $$ = new AstPin{$<fl>2, PINNUMINC(), *$2,
new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2, nullptr, nullptr}};
new AstParseRef{$<fl>2, *$2, nullptr, nullptr}};
$$->svDotName(true); $$->svImplicit(true); }
| '.' idAny
{ $$ = new AstPin{$<fl>2, PINNUMINC(), *$2,
new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2, nullptr, nullptr}};
new AstParseRef{$<fl>2, *$2, nullptr, nullptr}};
$$->svDotName(true); $$->svImplicit(true); }
// // mintypmax is expanded here, as it might be a UDP or gate primitive
//UNSUP pev_expr below
@@ -3916,7 +3916,7 @@ patternKey<nodep>: // IEEE: merge structure_pattern_key, array_patt
// // expanded from simple_type ps_parameter_identifier (part of simple_type)
| packageClassScope id
{ $$ = AstDot::newIfPkg($<fl>1, $1,
new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2, nullptr, nullptr}); }
new AstParseRef{$<fl>2, *$2, nullptr, nullptr}); }
| packageClassScopeE idType
{ AstRefDType* const refp = new AstRefDType{$<fl>2, *$2, $1, nullptr};
$$ = refp; }
@@ -3956,14 +3956,14 @@ for_initializationItem<nodep>: // IEEE: variable_assignment + for_varia
AstVar* const varp = VARDONEA($<fl>2, *$2, nullptr, nullptr);
varp->lifetime(VLifetime::AUTOMATIC_EXPLICIT);
$$ = varp;
$$->addNext(new AstAssign{$3, new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2}, $4}); }
$$->addNext(new AstAssign{$3, new AstParseRef{$<fl>2, *$2}, $4}); }
// // IEEE-2012:
| yVAR data_type idAny/*new*/ '=' expr
{ VARRESET_NONLIST(VAR); VARDTYPE($2);
AstVar* const varp = VARDONEA($<fl>3, *$3, nullptr, nullptr);
varp->lifetime(VLifetime::AUTOMATIC_EXPLICIT);
$$ = varp;
$$->addNext(new AstAssign{$4, new AstParseRef{$<fl>3, VParseRefExp::PX_TEXT, *$3}, $5}); }
$$->addNext(new AstAssign{$4, new AstParseRef{$<fl>3, *$3}, $5}); }
// // IEEE: variable_assignment
// // UNSUP variable_lvalue below
| id/*newOrExisting*/ '=' expr
@@ -3971,9 +3971,9 @@ for_initializationItem<nodep>: // IEEE: variable_assignment + for_varia
AstVar* const varp = VARDONEA($<fl>1, *$1, nullptr, nullptr);
varp->lifetime(VLifetime::AUTOMATIC_EXPLICIT);
$$ = varp;
$$->addNext(new AstAssign{$2, new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1}, $3});
$$->addNext(new AstAssign{$2, new AstParseRef{$<fl>1, *$1}, $3});
} else {
$$ = new AstAssign{$2, new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1}, $3};
$$ = new AstAssign{$2, new AstParseRef{$<fl>1, *$1}, $3};
}
}
;
@@ -5149,8 +5149,8 @@ exprScope<nodeExprp>: // scope and variable for use to inside an e
// // IEEE: [ implicit_class_handle . | class_scope | package_scope ] hierarchical_identifier select
// // Or method_call_body without parenthesis
// // See also varRefClassBit, which is the non-expr version of most of this
yTHIS { $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "this"}; }
| yD_ROOT { $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "$root"}; }
yTHIS { $$ = new AstParseRef{$<fl>1, "this"}; }
| yD_ROOT { $$ = new AstParseRef{$<fl>1, "$root"}; }
| idArrayed { $$ = $1; }
| packageClassScope idArrayed { $$ = AstDot::newIfPkg($2->fileline(), $1, $2); }
| ~l~expr '.' idArrayed { $$ = new AstDot{$<fl>2, false, $1, $3}; }
@@ -5158,14 +5158,14 @@ exprScope<nodeExprp>: // scope and variable for use to inside an e
| ~l~expr '.' ySUPER
{ AstParseRef* const anodep = VN_CAST($1, ParseRef);
if (anodep && anodep->name() == "this") {
$$ = new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "super"};
$$ = new AstParseRef{$<fl>1, "super"};
$1->deleteTree();
} else {
$$ = $1; $$->v3error("Syntax error: 'super' must be first name component, or after 'this.'");
}
}
// // Part of implicit_class_handle
| ySUPER { $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "super"}; }
| ySUPER { $$ = new AstParseRef{$<fl>1, "super"}; }
;
fexprScope<nodeExprp>: // exprScope, For use as first part of statement (disambiguates <=)
@@ -5854,7 +5854,7 @@ idPathpulse<strp>: // Id for specparam PATHPULSE$, IEEE: part of pulse_control_
idAnyAsParseRef<parseRefp>: // Any kind of identifier as a ParseRef
idAny
{ $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1}; }
{ $$ = new AstParseRef{$<fl>1, *$1}; }
;
@@ -5918,11 +5918,11 @@ idClass<nodeExprp>: // Misc Ref to dotted, and/or arrayed, and/or bi
idDotted { $$ = $1; }
// // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
| yTHIS '.' idDotted
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "this"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "this"}, $3}; }
| ySUPER '.' idDotted
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "super"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "super"}, $3}; }
| yTHIS '.' ySUPER '.' idDotted
{ $$ = new AstDot{$4, false, new AstParseRef{$<fl>3, VParseRefExp::PX_ROOT, "super"}, $5}; }
{ $$ = new AstDot{$4, false, new AstParseRef{$<fl>3, "super"}, $5}; }
// // Expanded: package_scope idDottedSel
| packageClassScope idDotted { $$ = new AstDot{$<fl>2, true, $1, $2}; }
;
@@ -5931,11 +5931,11 @@ idClassSel<nodeExprp>: // Misc Ref to dotted, and/or arrayed, and/or bi
idDottedSel { $$ = $1; }
// // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
| yTHIS '.' idDottedSel
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "this"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "this"}, $3}; }
| ySUPER '.' idDottedSel
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "super"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "super"}, $3}; }
| yTHIS '.' ySUPER '.' idDottedSel
{ $$ = new AstDot{$4, false, new AstParseRef{$<fl>3, VParseRefExp::PX_ROOT, "super"}, $5}; }
{ $$ = new AstDot{$4, false, new AstParseRef{$<fl>3, "super"}, $5}; }
// // Expanded: package_scope idDottedSel
| packageClassScope idDottedSel { $$ = new AstDot{$<fl>2, true, $1, $2}; }
;
@@ -5944,30 +5944,30 @@ idClassSelForeach<nodeExprp>:
idDottedForeach { $$ = $1; }
// // IEEE: [ implicit_class_handle . | package_scope ] hierarchical_variable_identifier select
| yTHIS '.' idDottedForeach
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "this"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "this"}, $3}; }
| ySUPER '.' idDottedForeach
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "super"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "super"}, $3}; }
| yTHIS '.' ySUPER '.' idDottedForeach
{ $$ = new AstDot{$4, false, new AstParseRef{$<fl>3, VParseRefExp::PX_ROOT, "super"}, $5}; }
{ $$ = new AstDot{$4, false, new AstParseRef{$<fl>3, "super"}, $5}; }
// // Expanded: package_scope idForeach
| packageClassScope idDottedForeach { $$ = new AstDot{$<fl>2, true, $1, $2}; }
;
idDotted<nodeExprp>:
yD_ROOT '.' idDottedMore
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "$root"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "$root"}, $3}; }
| idDottedMore { $$ = $1; }
;
idDottedSel<nodeExprp>:
yD_ROOT '.' idDottedSelMore
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "$root"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "$root"}, $3}; }
| idDottedSelMore { $$ = $1; }
;
idDottedForeach<nodeExprp>:
yD_ROOT '.' idDottedMoreForeach
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, VParseRefExp::PX_ROOT, "$root"}, $3}; }
{ $$ = new AstDot{$2, false, new AstParseRef{$<fl>1, "$root"}, $3}; }
| idDottedMoreForeach { $$ = $1; }
;
@@ -5993,7 +5993,7 @@ idDottedMoreForeach<nodeExprp>:
// enum_identifier
idArrayed<nodeExprp>: // IEEE: id + select
id
{ $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1, nullptr, nullptr}; }
{ $$ = new AstParseRef{$<fl>1, *$1, nullptr, nullptr}; }
// // IEEE: id + part_select_range/constant_part_select_range
| idArrayed '[' expr ']' { $$ = new AstSelBit{$2, $1, $3}; } // Or AstArraySel, don't know yet.
| idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract{$2, $1, $3, $5}; }
@@ -6004,7 +6004,7 @@ idArrayed<nodeExprp>: // IEEE: id + select
idArrayedForeach<nodeExprp>: // IEEE: id + select (under foreach expression)
id
{ $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1, nullptr, nullptr}; }
{ $$ = new AstParseRef{$<fl>1, *$1, nullptr, nullptr}; }
// // IEEE: id + part_select_range/constant_part_select_range
| idArrayed '[' expr ']' { $$ = new AstSelBit{$2, $1, $3}; } // Or AstArraySel, don't know yet.
| idArrayed '[' constExpr ':' constExpr ']' { $$ = new AstSelExtract{$2, $1, $3, $5}; }
@@ -6023,13 +6023,13 @@ idArrayedForeach<nodeExprp>: // IEEE: id + select (under foreach expression)
// VarRef without any dots or vectorizaion
varRefBase<parseRefp>:
id { $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1}; }
id { $$ = new AstParseRef{$<fl>1, *$1}; }
;
// ParseRef
parseRefBase<nodep>:
id
{ $$ = new AstParseRef{$<fl>1, VParseRefExp::PX_TEXT, *$1, nullptr, nullptr}; }
{ $$ = new AstParseRef{$<fl>1, *$1, nullptr, nullptr}; }
;
// yaSTRING shouldn't be used directly, instead via an abstraction below
@@ -6084,7 +6084,7 @@ clocking_event<senItemp>: // IEEE: clocking_event
//UNSUP: '@' idClassSel/*ps_identifier*/
'@' id
{ $$ = new AstSenItem{$<fl>2, VEdgeType::ET_CHANGED,
new AstParseRef{$<fl>2, VParseRefExp::PX_TEXT, *$2, nullptr, nullptr}}; }
new AstParseRef{$<fl>2, *$2, nullptr, nullptr}}; }
| '@' '(' event_expression ')' { $$ = $3; }
;