Internals: Fix some cppcheck issues. Some dump functions fixed.

This commit is contained in:
Wilson Snyder 2022-07-30 10:01:25 -04:00
parent 1f9323d086
commit b9d7819faa
49 changed files with 192 additions and 174 deletions

View File

@ -326,6 +326,8 @@ CLANGTIDY_FLAGS = -config='' -checks='-fuchsia-*,-cppcoreguidelines-avoid-c-arra
CLANGTIDY_DEP = $(subst .h,.h.tidy,$(CPPCHECK_H)) \
$(subst .cpp,.cpp.tidy,$(CPPCHECK_CPP))
CLANGTIDY_DEFS = -DVL_DEBUG=1 -DVL_THREADED=1 -DVL_CPPCHECK=1
# cppcoreguidelines-avoid-goto modernize-avoid-c-arrays readability-magic-numbers readability-simplify-boolean-expr
# cppcoreguidelines-macro-usage
clang-tidy: $(CLANGTIDY_DEP)
%.cpp.tidy: %.cpp

View File

@ -679,7 +679,10 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
if (std::numeric_limits<T>::is_integer) {
constexpr int b = 128;
constexpr int w = VL_WORDS_I(b);
VlWide<w> tmp0, tmp1, tmp2, tmp3;
VlWide<w> tmp0;
VlWide<w> tmp1;
VlWide<w> tmp2;
VlWide<w> tmp3;
WDataInP shifted = VL_EXTEND_WQ(b, 0, tmp0, static_cast<QData>(ld));
if (shift < 0) {

View File

@ -76,15 +76,15 @@ private:
public:
// METHODS
// cppcheck-suppress truncLongCastReturn
virtual uint64_t count() const override { return *m_countp; }
virtual void zero() const override { *m_countp = 0; }
uint64_t count() const override { return *m_countp; }
void zero() const override { *m_countp = 0; }
// CONSTRUCTORS
// cppcheck-suppress noExplicitConstructor
explicit VerilatedCoverItemSpec(T* countp)
: m_countp{countp} {
*m_countp = 0;
}
virtual ~VerilatedCoverItemSpec() override = default;
~VerilatedCoverItemSpec() override = default;
};
//=============================================================================
@ -122,7 +122,7 @@ public:
protected:
friend class VerilatedCovContext;
virtual ~VerilatedCovImp() override { clearGuts(); }
~VerilatedCovImp() override { clearGuts(); }
private:
// PRIVATE METHODS
@ -511,8 +511,10 @@ VerilatedCovContext* VerilatedCov::threadCovp() VL_MT_SAFE {
VerilatedCovContext* VerilatedContext::coveragep() VL_MT_SAFE {
static VerilatedMutex s_mutex;
// cppcheck-suppress identicalInnerCondition
if (VL_UNLIKELY(!m_coveragep)) {
const VerilatedLockGuard lock{s_mutex};
// cppcheck-suppress identicalInnerCondition
if (VL_LIKELY(!m_coveragep)) { // Not redundant, prevents race
m_coveragep.reset(new VerilatedCovImp);
}

View File

@ -67,18 +67,18 @@ protected:
// Implementation of VerilatedTrace interface
// Called when the trace moves forward to a new time point
virtual void emitTimeChange(uint64_t timeui) override;
void emitTimeChange(uint64_t timeui) override;
// Hooks called from VerilatedTrace
virtual bool preFullDump() override { return isOpen(); }
virtual bool preChangeDump() override { return isOpen(); }
bool preFullDump() override { return isOpen(); }
bool preChangeDump() override { return isOpen(); }
// Trace buffer management
virtual Buffer* getTraceBuffer() override;
virtual void commitTraceBuffer(Buffer*) override;
Buffer* getTraceBuffer() override;
void commitTraceBuffer(Buffer*) override;
// Configure sub-class
virtual void configure(const VerilatedTraceConfig&) override;
void configure(const VerilatedTraceConfig&) override;
public:
//=========================================================================

View File

@ -60,6 +60,7 @@ public:
}
// Override VerilatedFstC. Must be called after starting simulation.
// cppcheck-suppress missingOverride // GCC won't accept override
virtual void open(const char* filename) /*override*/ VL_MT_SAFE;
private:

View File

@ -194,16 +194,16 @@ public:
/// Construct new object
VerilatedSave() = default;
/// Flush, close and destruct
virtual ~VerilatedSave() override { close(); }
~VerilatedSave() override { close(); }
// METHODS
/// Open the file; call isOpen() to see if errors
void open(const char* filenamep) VL_MT_UNSAFE_ONE;
/// Open the file; call isOpen() to see if errors
void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); }
/// Flush and close the file
virtual void close() override VL_MT_UNSAFE_ONE;
void close() override VL_MT_UNSAFE_ONE;
/// Flush data to file
virtual void flush() override VL_MT_UNSAFE_ONE;
void flush() override VL_MT_UNSAFE_ONE;
};
//=============================================================================
@ -221,7 +221,7 @@ public:
/// Construct new object
VerilatedRestore() = default;
/// Flush, close and destruct
virtual ~VerilatedRestore() override { close(); }
~VerilatedRestore() override { close(); }
// METHODS
/// Open the file; call isOpen() to see if errors
@ -229,9 +229,9 @@ public:
/// Open the file; call isOpen() to see if errors
void open(const std::string& filename) VL_MT_UNSAFE_ONE { open(filename.c_str()); }
/// Close the file
virtual void close() override VL_MT_UNSAFE_ONE;
virtual void flush() override VL_MT_UNSAFE_ONE {}
virtual void fill() override VL_MT_UNSAFE_ONE;
void close() override VL_MT_UNSAFE_ONE;
void flush() override VL_MT_UNSAFE_ONE {}
void fill() override VL_MT_UNSAFE_ONE;
};
//=============================================================================

View File

@ -91,9 +91,9 @@ class VlReadMem final {
const int m_bits; // Bit width of values
const std::string& m_filename; // Filename
const QData m_end; // End address (as specified by user)
FILE* m_fp; // File handle for filename
QData m_addr; // Next address to read
int m_linenum; // Line number last read from file
FILE* m_fp = nullptr; // File handle for filename
QData m_addr = 0; // Next address to read
int m_linenum = 0; // Line number last read from file
bool m_anyAddr = false; // Had address directive in the file
public:
VlReadMem(bool hex, int bits, const std::string& filename, QData start, QData end);
@ -107,8 +107,8 @@ public:
class VlWriteMem final {
const bool m_hex; // Hex format
const int m_bits; // Bit width of values
FILE* m_fp; // File handle for filename
QData m_addr; // Next address to write
FILE* m_fp = nullptr; // File handle for filename
QData m_addr = 0; // Next address to write
public:
VlWriteMem(bool hex, int bits, const std::string& filename, QData start, QData end);
~VlWriteMem();

View File

@ -102,18 +102,18 @@ protected:
// Implementation of VerilatedTrace interface
// Called when the trace moves forward to a new time point
virtual void emitTimeChange(uint64_t timeui) override;
void emitTimeChange(uint64_t timeui) override;
// Hooks called from VerilatedTrace
virtual bool preFullDump() override { return isOpen(); }
virtual bool preChangeDump() override;
bool preFullDump() override { return isOpen(); }
bool preChangeDump() override;
// Trace buffer management
virtual Buffer* getTraceBuffer() override;
virtual void commitTraceBuffer(Buffer*) override;
Buffer* getTraceBuffer() override;
void commitTraceBuffer(Buffer*) override;
// Configure sub-class
virtual void configure(const VerilatedTraceConfig&) override { return; };
void configure(const VerilatedTraceConfig&) override { return; };
public:
//=========================================================================

View File

@ -63,6 +63,7 @@ public:
}
// Override VerilatedVcdC. Must be called after starting simulation.
// cppcheck-suppress missingOverride // GCC won't accept override
virtual void open(const char* filename) /*override*/ VL_MT_SAFE;
private:

View File

@ -135,12 +135,12 @@ public:
VerilatedVpioTimedCb(uint64_t id, QData time)
: m_id{id}
, m_time{time} {}
virtual ~VerilatedVpioTimedCb() override = default;
~VerilatedVpioTimedCb() override = default;
static VerilatedVpioTimedCb* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioTimedCb*>(reinterpret_cast<VerilatedVpioTimedCb*>(h));
}
virtual uint32_t type() const override { return vpiCallback; }
virtual PLI_INT32 dovpi_remove_cb() override;
uint32_t type() const override { return vpiCallback; }
PLI_INT32 dovpi_remove_cb() override;
};
class VerilatedVpioReasonCb final : public VerilatedVpio {
@ -154,12 +154,12 @@ public:
VerilatedVpioReasonCb(uint64_t id, PLI_INT32 reason)
: m_id{id}
, m_reason{reason} {}
virtual ~VerilatedVpioReasonCb() override = default;
~VerilatedVpioReasonCb() override = default;
static VerilatedVpioReasonCb* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioReasonCb*>(reinterpret_cast<VerilatedVpioReasonCb*>(h));
}
virtual uint32_t type() const override { return vpiCallback; }
virtual PLI_INT32 dovpi_remove_cb() override;
uint32_t type() const override { return vpiCallback; }
PLI_INT32 dovpi_remove_cb() override;
};
class VerilatedVpioConst final : public VerilatedVpio {
@ -168,11 +168,11 @@ class VerilatedVpioConst final : public VerilatedVpio {
public:
explicit VerilatedVpioConst(int32_t num)
: m_num{num} {}
virtual ~VerilatedVpioConst() override = default;
~VerilatedVpioConst() override = default;
static VerilatedVpioConst* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioConst*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiConstant; }
uint32_t type() const override { return vpiConstant; }
int32_t num() const { return m_num; }
};
@ -200,10 +200,10 @@ public:
}
const VerilatedVar* varp() const { return m_varp; }
const VerilatedScope* scopep() const { return m_scopep; }
virtual uint32_t size() const override { return get_range().elements(); }
virtual const VerilatedRange* rangep() const override { return &get_range(); }
virtual const char* name() const override { return m_varp->name(); }
virtual const char* fullname() const override {
uint32_t size() const override { return get_range().elements(); }
const VerilatedRange* rangep() const override { return &get_range(); }
const char* name() const override { return m_varp->name(); }
const char* fullname() const override {
static VL_THREAD_LOCAL std::string t_out;
t_out = std::string{m_scopep->name()} + "." + name();
return t_out.c_str();
@ -214,12 +214,12 @@ class VerilatedVpioParam final : public VerilatedVpioVarBase {
public:
VerilatedVpioParam(const VerilatedVar* varp, const VerilatedScope* scopep)
: VerilatedVpioVarBase{varp, scopep} {}
virtual ~VerilatedVpioParam() override = default;
~VerilatedVpioParam() override = default;
static VerilatedVpioParam* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioParam*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiParameter; }
uint32_t type() const override { return vpiParameter; }
void* varDatap() const { return m_varp->datap(); }
};
@ -229,13 +229,13 @@ class VerilatedVpioRange final : public VerilatedVpio {
public:
explicit VerilatedVpioRange(const VerilatedRange* range)
: m_range{range} {}
virtual ~VerilatedVpioRange() override = default;
~VerilatedVpioRange() override = default;
static VerilatedVpioRange* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioRange*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiRange; }
virtual uint32_t size() const override { return m_range->elements(); }
virtual const VerilatedRange* rangep() const override { return m_range; }
uint32_t type() const override { return vpiRange; }
uint32_t size() const override { return m_range->elements(); }
const VerilatedRange* rangep() const override { return m_range; }
};
class VerilatedVpioRangeIter final : public VerilatedVpio {
@ -246,12 +246,12 @@ class VerilatedVpioRangeIter final : public VerilatedVpio {
public:
explicit VerilatedVpioRangeIter(const VerilatedRange* range)
: m_range{range} {}
virtual ~VerilatedVpioRangeIter() override = default;
~VerilatedVpioRangeIter() override = default;
static VerilatedVpioRangeIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioRangeIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiIterator; }
virtual vpiHandle dovpi_scan() override {
uint32_t type() const override { return vpiIterator; }
vpiHandle dovpi_scan() override {
if (VL_UNLIKELY(m_done)) {
delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle
return nullptr;
@ -268,14 +268,14 @@ protected:
public:
explicit VerilatedVpioScope(const VerilatedScope* scopep)
: m_scopep{scopep} {}
virtual ~VerilatedVpioScope() override = default;
~VerilatedVpioScope() override = default;
static VerilatedVpioScope* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioScope*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiScope; }
uint32_t type() const override { return vpiScope; }
const VerilatedScope* scopep() const { return m_scopep; }
virtual const char* name() const override { return m_scopep->name(); }
virtual const char* fullname() const override { return m_scopep->name(); }
const char* name() const override { return m_scopep->name(); }
const char* fullname() const override { return m_scopep->name(); }
};
class VerilatedVpioVar VL_NOT_FINAL : public VerilatedVpioVarBase {
@ -308,7 +308,7 @@ public:
m_mask.u32 = 0;
}
}
virtual ~VerilatedVpioVar() override {
~VerilatedVpioVar() override {
if (m_prevDatap) VL_DO_CLEAR(delete[] m_prevDatap, m_prevDatap = nullptr);
}
static VerilatedVpioVar* castp(vpiHandle h) {
@ -318,7 +318,7 @@ public:
uint8_t mask_byte(int idx) const { return m_mask.u8[idx & 3]; }
uint32_t entSize() const { return m_entSize; }
uint32_t index() const { return m_index; }
virtual uint32_t type() const override {
uint32_t type() const override {
return (varp()->dims() > 1) ? vpiMemory : vpiReg; // but might be wire, logic
}
void* prevDatap() const { return m_prevDatap; }
@ -339,14 +339,14 @@ public:
m_index = index;
m_varDatap = (static_cast<uint8_t*>(varp->datap())) + entSize() * offset;
}
virtual ~VerilatedVpioMemoryWord() override = default;
~VerilatedVpioMemoryWord() override = default;
static VerilatedVpioMemoryWord* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioMemoryWord*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiMemoryWord; }
virtual uint32_t size() const override { return varp()->packed().elements(); }
virtual const VerilatedRange* rangep() const override { return &(varp()->packed()); }
virtual const char* fullname() const override {
uint32_t type() const override { return vpiMemoryWord; }
uint32_t size() const override { return varp()->packed().elements(); }
const VerilatedRange* rangep() const override { return &(varp()->packed()); }
const char* fullname() const override {
static VL_THREAD_LOCAL std::string t_out;
constexpr size_t LEN_MAX_INDEX = 25;
char num[LEN_MAX_INDEX];
@ -364,12 +364,12 @@ class VerilatedVpioVarIter final : public VerilatedVpio {
public:
explicit VerilatedVpioVarIter(const VerilatedScope* scopep)
: m_scopep{scopep} {}
virtual ~VerilatedVpioVarIter() override = default;
~VerilatedVpioVarIter() override = default;
static VerilatedVpioVarIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioVarIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiIterator; }
virtual vpiHandle dovpi_scan() override {
uint32_t type() const override { return vpiIterator; }
vpiHandle dovpi_scan() override {
if (VL_LIKELY(m_scopep->varsp())) {
const VerilatedVarNameMap* const varsp = m_scopep->varsp();
if (VL_UNLIKELY(!m_started)) {
@ -405,15 +405,15 @@ public:
, m_varp{varp}
, m_iteration{varp->unpacked().right()}
, m_direction{VL_LIKELY(varp->unpacked().left() > varp->unpacked().right()) ? 1 : -1} {}
virtual ~VerilatedVpioMemoryWordIter() override = default;
~VerilatedVpioMemoryWordIter() override = default;
static VerilatedVpioMemoryWordIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioMemoryWordIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiIterator; }
uint32_t type() const override { return vpiIterator; }
void iterationInc() {
if (!(m_done = (m_iteration == m_varp->unpacked().left()))) m_iteration += m_direction;
}
virtual vpiHandle dovpi_scan() override {
vpiHandle dovpi_scan() override {
if (VL_UNLIKELY(m_done)) {
delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle
return nullptr;
@ -438,9 +438,9 @@ public:
static VerilatedVpioModule* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioModule*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiModule; }
virtual const char* name() const override { return m_name; }
virtual const char* fullname() const override { return m_fullname; }
uint32_t type() const override { return vpiModule; }
const char* name() const override { return m_name; }
const char* fullname() const override { return m_fullname; }
};
class VerilatedVpioModuleIter final : public VerilatedVpio {
@ -452,12 +452,12 @@ public:
: m_vec{&vec} {
m_it = m_vec->begin();
}
virtual ~VerilatedVpioModuleIter() override = default;
~VerilatedVpioModuleIter() override = default;
static VerilatedVpioModuleIter* castp(vpiHandle h) {
return dynamic_cast<VerilatedVpioModuleIter*>(reinterpret_cast<VerilatedVpio*>(h));
}
virtual uint32_t type() const override { return vpiIterator; }
virtual vpiHandle dovpi_scan() override {
uint32_t type() const override { return vpiIterator; }
vpiHandle dovpi_scan() override {
if (m_it == m_vec->end()) {
delete this; // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle
return nullptr;

View File

@ -456,7 +456,8 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read()
// or 0x0 if not implemented on this platform
#define VL_GET_CPU_TICK(val) \
{ \
uint32_t hi, lo; \
uint32_t hi; \
uint32_t lo; \
asm volatile("rdtsc" : "=a"(lo), "=d"(hi)); \
(val) = ((uint64_t)lo) | (((uint64_t)hi) << 32); \
}

View File

@ -75,7 +75,7 @@ public:
class LatchDetectGraph final : public V3Graph {
protected:
LatchDetectGraphVertex* m_curVertexp; // Current latch detection graph vertex
LatchDetectGraphVertex* m_curVertexp = nullptr; // Current latch detection graph vertex
std::vector<AstVarRef*> m_outputs; // Vector of lvalues encountered on this pass
VL_DEBUG_FUNC; // Declare debug()
@ -290,13 +290,13 @@ private:
// STATE
LatchDetectGraph m_graph; // Graph used to detect latches in combo always
// VISITORS
virtual void visit(AstVarRef* nodep) {
virtual void visit(AstVarRef* nodep) override {
const AstVar* const varp = nodep->varp();
if (nodep->access().isWriteOrRW() && varp->isSignal() && !varp->isUsedLoopIdx()) {
m_graph.addAssignment(nodep);
}
}
virtual void visit(AstNodeIf* nodep) {
virtual void visit(AstNodeIf* nodep) override {
if (!nodep->isBoundsCheck()) {
LatchDetectGraphVertex* const parentp = m_graph.currentp();
LatchDetectGraphVertex* const branchp = m_graph.addPathVertex(parentp, "BRANCH", true);
@ -308,7 +308,7 @@ private:
}
}
//--------------------
virtual void visit(AstNode* nodep) { iterateChildren(nodep); }
virtual void visit(AstNode* nodep) override { iterateChildren(nodep); }
public:
// CONSTRUCTORS
@ -317,7 +317,7 @@ public:
iterate(nodep);
m_graph.latchCheck(nodep, kwd == VAlwaysKwd::ALWAYS_LATCH);
}
virtual ~ActiveLatchCheckVisitor() = default;
~ActiveLatchCheckVisitor() override = default;
};
//######################################################################
@ -387,7 +387,7 @@ public:
: m_check{check} {
iterate(nodep);
}
virtual ~ActiveDlyVisitor() override = default;
~ActiveDlyVisitor() override = default;
};
//######################################################################
@ -530,7 +530,7 @@ private:
// Warn and/or convert any delayed assignments
if (combo && !sequent) {
ActiveDlyVisitor{nodep, ActiveDlyVisitor::CT_COMB};
{ ActiveDlyVisitor{nodep, ActiveDlyVisitor::CT_COMB}; }
const ActiveLatchCheckVisitor latchvisitor{nodep, kwd};
} else if (!combo && sequent) {
ActiveDlyVisitor{nodep, ActiveDlyVisitor::CT_SEQ};
@ -598,7 +598,7 @@ private:
public:
// CONSTRUCTORS
explicit ActiveVisitor(AstNetlist* nodep) { iterate(nodep); }
virtual ~ActiveVisitor() override = default;
~ActiveVisitor() override = default;
};
//######################################################################

View File

@ -2605,7 +2605,7 @@ protected:
: AstNodeMath{t, fl}
, m_access{access}
, m_name{name} {
this->varp(nullptr);
varp(nullptr);
}
AstNodeVarRef(VNType t, FileLine* fl, const string& name, AstVar* varp, const VAccess& access)
: AstNodeMath{t, fl}

View File

@ -489,7 +489,7 @@ string AstVar::cPubArgType(bool named, bool forReturn) const {
class dpiTypesToStringConverter VL_NOT_FINAL {
public:
virtual string openArray(const AstVar*) const { return "const svOpenArrayHandle"; }
virtual string bitLogicVector(const AstVar* varp, bool isBit) const {
virtual string bitLogicVector(const AstVar* /*varp*/, bool isBit) const {
return isBit ? "svBitVecVal" : "svLogicVecVal";
}
virtual string primitive(const AstVar* varp) const {
@ -659,7 +659,7 @@ public:
}
};
string AstNodeDType::cType(const string& name, bool forFunc, bool isRef) const {
string AstNodeDType::cType(const string& name, bool /*forFunc*/, bool isRef) const {
const CTypeRecursed info = cTypeRecurse(false);
return info.render(name, isRef);
}
@ -1326,8 +1326,9 @@ void AstClass::repairCache() {
clearCache();
for (auto* itemp = membersp(); itemp; itemp = itemp->nextp()) {
if (const auto* const scopep = VN_CAST(itemp, Scope)) {
for (auto* itemp = scopep->blocksp(); itemp; itemp = itemp->nextp())
insertCache(itemp);
for (auto* blockp = scopep->blocksp(); blockp; blockp = blockp->nextp()) {
insertCache(blockp);
}
} else {
insertCache(itemp);
}
@ -1354,7 +1355,7 @@ AstClass* AstClassExtends::classp() const {
return refp->classp();
}
void AstClassRefDType::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeDType::dump(str);
if (classOrPackagep()) str << " cpkg=" << nodeAddr(classOrPackagep());
if (classp()) {
str << " -> ";
@ -1385,7 +1386,7 @@ void AstEnumItemRef::dump(std::ostream& str) const {
}
}
void AstIfaceRefDType::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeDType::dump(str);
if (cellName() != "") str << " cell=" << cellName();
if (ifaceName() != "") str << " if=" << ifaceName();
if (modportName() != "") str << " mp=" << modportName();
@ -1434,7 +1435,7 @@ void AstJumpLabel::dump(std::ostream& str) const {
}
}
void AstLogOr::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeMath::dump(str);
if (sideEffect()) str << " [SIDE]";
}
void AstMemberSel::dump(std::ostream& str) const {
@ -1447,7 +1448,7 @@ void AstMemberSel::dump(std::ostream& str) const {
}
}
void AstMethodCall::dump(std::ostream& str) const {
this->AstNodeStmt::dump(str);
this->AstNodeFTaskRef::dump(str);
if (isStatement()) str << " [STMT]";
str << " -> ";
if (taskp()) {
@ -1533,7 +1534,7 @@ void AstRefDType::dump(std::ostream& str) const {
}
}
void AstNodeUOrStructDType::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeDType::dump(str);
if (packed()) str << " [PACKED]";
if (isFourstate()) str << " [4STATE]";
}
@ -1624,7 +1625,7 @@ void AstPackageImport::dump(std::ostream& str) const {
str << " -> " << packagep();
}
void AstPatMember::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeMath::dump(str);
if (isDefault()) str << " [DEFAULT]";
}
void AstNodeTriop::dump(std::ostream& str) const { this->AstNodeMath::dump(str); }
@ -1773,7 +1774,7 @@ void AstScope::dump(std::ostream& str) const {
str << " [modp=" << reinterpret_cast<const void*>(modp()) << "]";
}
void AstScopeName::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeMath::dump(str);
if (dpiExport()) str << " [DPIEX]";
if (forFormat()) str << " [FMT]";
}
@ -1840,7 +1841,7 @@ void AstNodeBlock::dump(std::ostream& str) const {
if (unnamed()) str << " [UNNAMED]";
}
void AstBegin::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeBlock::dump(str);
if (generate()) str << " [GEN]";
if (genforp()) str << " [GENFOR]";
if (implied()) str << " [IMPLIED]";
@ -1866,7 +1867,7 @@ void AstCoverInc::dump(std::ostream& str) const {
}
}
void AstFork::dump(std::ostream& str) const {
this->AstNode::dump(str);
this->AstNodeBlock::dump(str);
if (!joinType().join()) str << " [" << joinType() << "]";
}
void AstTraceDecl::dump(std::ostream& str) const {

View File

@ -186,7 +186,7 @@ public:
class AstEmpty final : public AstNode {
// Represents something missing, e.g. a missing argument in FOREACH
public:
AstEmpty(FileLine* fl)
explicit AstEmpty(FileLine* fl)
: ASTGEN_SUPER_Empty(fl) {}
ASTNODE_NODE_FUNCS(Empty)
virtual bool same(const AstNode* samep) const override { return true; }
@ -194,7 +194,7 @@ public:
class AstEmptyQueue final : public AstNodeMath {
public:
AstEmptyQueue(FileLine* fl)
explicit AstEmptyQueue(FileLine* fl)
: ASTGEN_SUPER_EmptyQueue(fl) {}
ASTNODE_NODE_FUNCS(EmptyQueue)
virtual string emitC() override { V3ERROR_NA_RETURN(""); }

View File

@ -48,7 +48,7 @@ static class BrokenCntGlobal {
uint8_t m_count = MIN_VALUE;
public:
uint8_t get() {
uint8_t get() const {
UASSERT(MIN_VALUE <= m_count && m_count <= MAX_VALUE, "Invalid generation number");
return m_count;
}

View File

@ -115,13 +115,13 @@ private:
// Move later, or we wouldn't keep interating the class
// We're really moving the VarScope but we might not
// have a pointer to it yet
m_toScopeMoves.push_back(std::make_pair(nodep, m_packageScopep));
m_toScopeMoves.emplace_back(std::make_pair(nodep, m_packageScopep));
}
if (!m_ftaskp && nodep->lifetime().isStatic()) {
m_toPackageMoves.push_back(std::make_pair(nodep, m_classPackagep));
m_toPackageMoves.emplace_back(std::make_pair(nodep, m_classPackagep));
// We're really moving the VarScope but we might not
// have a pointer to it yet
m_toScopeMoves.push_back(std::make_pair(nodep, m_packageScopep));
m_toScopeMoves.emplace_back(std::make_pair(nodep, m_packageScopep));
}
}
}
@ -137,7 +137,7 @@ private:
m_ftaskp = nodep;
iterateChildren(nodep);
if (m_packageScopep && nodep->lifetime().isStatic()) {
m_toScopeMoves.push_back(std::make_pair(nodep, m_packageScopep));
m_toScopeMoves.emplace_back(std::make_pair(nodep, m_packageScopep));
}
}
}
@ -152,12 +152,16 @@ private:
virtual void visit(AstInitial* nodep) override {
// But not AstInitialAutomatic, which remains under the class
iterateChildren(nodep);
if (m_packageScopep) { m_toScopeMoves.push_back(std::make_pair(nodep, m_packageScopep)); }
if (m_packageScopep) {
m_toScopeMoves.emplace_back(std::make_pair(nodep, m_packageScopep));
}
}
virtual void visit(AstInitialStatic* nodep) override {
// But not AstInitialAutomatic, which remains under the class
iterateChildren(nodep);
if (m_packageScopep) { m_toScopeMoves.push_back(std::make_pair(nodep, m_packageScopep)); }
if (m_packageScopep) {
m_toScopeMoves.emplace_back(std::make_pair(nodep, m_packageScopep));
}
}
virtual void visit(AstNodeMath* nodep) override {} // Short circuit

View File

@ -220,7 +220,9 @@ class CombineVisitor final : VNVisitor {
// CONSTRUCTORS
explicit CombineVisitor(AstNetlist* nodep) { iterate(nodep); }
~CombineVisitor() { V3Stats::addStat("Optimizations, Combined CFuncs", m_cfuncsCombined); }
~CombineVisitor() override {
V3Stats::addStat("Optimizations, Combined CFuncs", m_cfuncsCombined);
}
public:
static void apply(AstNetlist* netlistp) { CombineVisitor{netlistp}; }

View File

@ -325,7 +325,6 @@ class ConstBitOpTreeVisitor final : public VNVisitor {
return ResultTerm{resultp, ops, clean};
}
public:
// CONSTRUCTORS
VarInfo(ConstBitOpTreeVisitor* parent, AstVarRef* refp, int width)
: m_parentp{parent}
@ -754,10 +753,11 @@ public:
if (debug() >= 9) { // LCOV_EXCL_START
cout << "Bitop tree considered: " << endl;
for (AstNode* const termp : termps) termp->dumpTree("Reduced term: ");
for (const std::pair<AstNode*, FrozenNodeInfo>& termp : visitor.m_frozenNodes)
for (const std::pair<AstNode*, FrozenNodeInfo>& termp : visitor.m_frozenNodes) {
termp.first->dumpTree("Frozen term with lsb " + std::to_string(termp.second.m_lsb)
+ " polarity " + std::to_string(termp.second.m_polarity)
+ ": ");
}
cout << "Needs flipping: " << needsFlip << endl;
cout << "Needs cleaning: " << needsCleaning << endl;
cout << "Size: " << resultOps << " input size: " << visitor.m_ops << endl;

View File

@ -52,7 +52,7 @@ public:
V3DupFinder()
: m_hasherp{new V3Hasher}
, m_hasher{*m_hasherp} {}
V3DupFinder(const V3Hasher& hasher)
explicit V3DupFinder(const V3Hasher& hasher)
: m_hasherp{nullptr}
, m_hasher{hasher} {}
~V3DupFinder() {

View File

@ -600,7 +600,7 @@ void EmitCFunc::emitVarReset(AstVar* varp) {
// If an ARRAYINIT we initialize it using an initial block similar to a signal
// puts("// parameter "+varp->nameProtect()+" = "+varp->valuep()->name()+"\n");
} else if (const AstInitArray* const initarp = VN_CAST(varp->valuep(), InitArray)) {
if (AstAssocArrayDType* const adtypep = VN_CAST(dtypep, AssocArrayDType)) {
if (VN_IS(dtypep, AssocArrayDType)) {
if (initarp->defaultp()) {
emitSetVarConstant(varNameProtected + ".atDefault()",
VN_AS(initarp->defaultp(), Const));
@ -611,7 +611,7 @@ void EmitCFunc::emitVarReset(AstVar* varp) {
emitSetVarConstant(varNameProtected + ".at(" + cvtToStr(itr.first) + ")",
VN_AS(valuep, Const));
}
} else if (AstWildcardArrayDType* const adtypep = VN_CAST(dtypep, WildcardArrayDType)) {
} else if (VN_IS(dtypep, WildcardArrayDType)) {
if (initarp->defaultp()) {
emitSetVarConstant(varNameProtected + ".atDefault()",
VN_AS(initarp->defaultp(), Const));

View File

@ -236,10 +236,11 @@ class EmitCHeader final : public EmitCConstInit {
void emitAll(const AstNodeModule* modp) {
// Include files required by this AstNodeModule
if (const AstClass* const classp = VN_CAST(modp, Class)) {
if (classp->extendsp())
if (classp->extendsp()) {
puts("#include \""
+ prefixNameProtect(classp->extendsp()->classp()->classOrPackagep())
+ ".h\"\n");
}
}
emitModCUse(modp, VUseType::INT_INCLUDE);

View File

@ -208,19 +208,15 @@ class CMakeEmitter final {
*of << "target_link_libraries(${TOP_TARGET_NAME} PRIVATE " << prefix << ")\n";
if (!children.empty()) {
*of << "target_link_libraries(" << prefix << " INTERFACE";
for (V3HierBlock::HierBlockSet::const_iterator child = children.begin();
child != children.end(); ++child) {
*of << " " << (*child)->hierPrefix();
}
for (const auto& childr : children) { *of << " " << (childr)->hierPrefix(); }
*of << ")\n";
}
*of << "verilate(" << prefix << " PREFIX " << prefix << " TOP_MODULE "
<< hblockp->modp()->name() << " DIRECTORY "
<< deslash(v3Global.opt.makeDir() + "/" + prefix) << " SOURCES ";
for (V3HierBlock::HierBlockSet::const_iterator child = children.begin();
child != children.end(); ++child) {
for (const auto& childr : children) {
*of << " "
<< deslash(v3Global.opt.makeDir() + "/" + (*child)->hierWrapper(true));
<< deslash(v3Global.opt.makeDir() + "/" + childr->hierWrapper(true));
}
*of << " ";
const string vFile = hblockp->vFileIfNecessary();

View File

@ -689,5 +689,5 @@ public:
void V3EmitC::emitcModel() {
UINFO(2, __FUNCTION__ << ": " << endl);
{ EmitCModel emit(v3Global.rootp()); }
{ EmitCModel{v3Global.rootp()}; }
}

View File

@ -774,7 +774,7 @@ void EmitCSyms::emitSymImp() {
puts(protectIf(aboveScopep->nameDotless(), aboveScopep->protect()));
}
puts(".");
puts(protName.substr(protName.rfind(".") + 1));
puts(protName.substr(protName.rfind('.') + 1));
puts(" = &");
puts(protectIf(scopep->nameDotless(), scopep->protect()) + ";\n");
++m_numStmts;

View File

@ -72,10 +72,10 @@ int FileLineSingleton::nameToNumber(const string& filename) {
//! Experimental. Updated to also put out the language.
void FileLineSingleton::fileNameNumMapDumpXml(std::ostream& os) {
os << "<files>\n";
for (auto it = m_namemap.cbegin(); it != m_namemap.cend(); ++it) {
os << "<file id=\"" << filenameLetters(it->second) << "\" filename=\""
<< V3OutFormatter::quoteNameControls(it->first, V3OutFormatter::LA_XML)
<< "\" language=\"" << numberToLang(it->second).ascii() << "\"/>\n";
for (const auto& itr : m_namemap) {
os << "<file id=\"" << filenameLetters(itr.second) << "\" filename=\""
<< V3OutFormatter::quoteNameControls(itr.first, V3OutFormatter::LA_XML)
<< "\" language=\"" << numberToLang(itr.second).ascii() << "\"/>\n";
}
os << "</files>\n";
}

View File

@ -81,16 +81,16 @@ public:
AstScope* scopep() const { return m_scopep; }
bool reducible() const { return m_reducible; }
bool dedupable() const { return m_dedupable; }
void setConsumed(const char* consumedReason) {
void setConsumed(const char* /*consumedReason*/) {
m_consumed = true;
// UINFO(0, "\t\tSetConsumed "<<consumedReason<<" "<<this<<endl);
}
bool consumed() const { return m_consumed; }
void clearReducible(const char* nonReducibleReason) {
void clearReducible(const char* /*nonReducibleReason*/) {
m_reducible = false;
// UINFO(0, " NR: "<<nonReducibleReason<<" "<<name()<<endl);
}
void clearDedupable(const char* nonDedupableReason) {
void clearDedupable(const char* /*nonDedupableReason*/) {
m_dedupable = false;
// UINFO(0, " ND: "<<nonDedupableReason<<" "<<name()<<endl);
}

View File

@ -159,7 +159,7 @@ std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp) {
//######################################################################
// Edges
void V3GraphEdge::init(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top, int weight,
void V3GraphEdge::init(V3Graph* /*graphp*/, V3GraphVertex* fromp, V3GraphVertex* top, int weight,
bool cutable) {
UASSERT(fromp, "Null from pointer");
UASSERT(top, "Null to pointer");

View File

@ -494,7 +494,7 @@ private:
public:
// CONSTRUCTORS
HasherVisitor(AstNode* nodep)
explicit HasherVisitor(AstNode* nodep)
: m_cacheInUser4{true} {
iterate(nodep);
}
@ -517,7 +517,7 @@ V3Hash V3Hasher::operator()(AstNode* nodep) const {
V3Hash V3Hasher::rehash(AstNode* nodep) const {
nodep->user4(0);
HasherVisitor{nodep};
{ HasherVisitor{nodep}; }
return V3Hash(nodep->user4());
}

View File

@ -1902,7 +1902,7 @@ private:
static int debug() { return LinkDotState::debug(); }
// METHODS - Variables
void createImplicitVar(VSymEnt* lookupSymp, AstVarRef* nodep, AstNodeModule* modp,
void createImplicitVar(VSymEnt* /*lookupSymp*/, AstVarRef* nodep, AstNodeModule* modp,
VSymEnt* moduleSymp, bool noWarn) {
// Create implicit after warning
if (!nodep->varp()) {

View File

@ -445,7 +445,7 @@ private:
selp->rhsp()->unlinkFrBackWithNext()};
selp->replaceWith(newp);
VL_DO_DANGLING(selp->deleteTree(), selp);
} else if (AstSelLoopVars* const selp = VN_CAST(bracketp, SelLoopVars)) {
} else if (VN_IS(bracketp, SelLoopVars)) {
// Ok
} else {
nodep->v3error(

View File

@ -404,7 +404,7 @@ private:
return newFormat;
}
static void expectDescriptor(AstNode* nodep, AstNodeVarRef* filep) {
static void expectDescriptor(AstNode* /*nodep*/, AstNodeVarRef* filep) {
// This might fail on complex expressions like arrays
// We use attrFileDescr() only for lint suppression, so that's ok
if (filep && filep->varp()) filep->varp()->attrFileDescr(true);

View File

@ -69,7 +69,7 @@ private:
&& m_accessors(nodep).size() == 1); // .. a block temp used in a single CFunc
}
bool existsNonLeaf(const std::unordered_set<AstCFunc*>& funcps) {
static bool existsNonLeaf(const std::unordered_set<AstCFunc*>& funcps) {
for (const AstCFunc* const funcp : funcps) {
if (funcp->user1()) return true;
}

View File

@ -414,7 +414,7 @@ public:
// Given an AstNode list (held via AstNode::nextp()), move conditional statements as close
// together as possible
static AstNode* optimize(AstNode* nodep, const StmtPropertiesAllocator& stmtProperties) {
CodeMotionOptimizeVisitor{nodep, stmtProperties};
{ CodeMotionOptimizeVisitor{nodep, stmtProperties}; }
// It is possible for the head of the list to be moved later such that it is no longer
// in head position. If so, rewind the list and return the new head.
while (nodep->backp()->nextp() == nodep) nodep = nodep->backp();

View File

@ -737,7 +737,7 @@ class OrderBuildVisitor final : public VNVisitor {
virtual void visit(AstNode* nodep) override { iterateChildren(nodep); }
// CONSTRUCTOR
OrderBuildVisitor(AstNetlist* nodep) {
explicit OrderBuildVisitor(AstNetlist* nodep) {
// Enable debugging (3 is default if global debug; we want acyc debugging)
if (debug()) m_graphp->debug(5);
@ -753,7 +753,7 @@ class OrderBuildVisitor final : public VNVisitor {
// Build the rest of the graph
iterate(nodep);
}
virtual ~OrderBuildVisitor() = default;
~OrderBuildVisitor() override = default;
public:
// Process the netlist and return the constructed ordering graph. It's 'process' because
@ -1331,7 +1331,7 @@ class OrderProcess final : VNDeleter {
pushDeletep(m_deleteDomainp);
}
~OrderProcess() {
~OrderProcess() override {
// Stats
for (int type = 0; type < OrderVEdgeType::_ENUM_END; type++) {
const double count = double(m_statCut[type]);
@ -2103,9 +2103,9 @@ void V3Order::orderAll(AstNetlist* netlistp) {
// Build ordering graph
std::unique_ptr<OrderGraph> orderGraph = OrderBuildVisitor::process(netlistp);
// Order the netlist
OrderProcess::main(netlistp, *orderGraph.get());
OrderProcess::main(netlistp, *orderGraph);
// Reset debug level
orderGraph.get()->debug(V3Error::debugDefault());
orderGraph->debug(V3Error::debugDefault());
// Dump tree
V3Global::dumpCheckGlobalTree("order", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
}

View File

@ -26,7 +26,7 @@ class AstNetlist;
class V3Order final {
public:
static void orderAll(AstNetlist* nodep);
static void orderAll(AstNetlist* netlistp);
};
#endif // Guard

View File

@ -289,7 +289,7 @@ class ParamProcessor final {
}
}
}
string paramSmallName(AstNodeModule* modp, AstNode* varp) {
static string paramSmallName(AstNodeModule* modp, AstNode* varp) {
if (varp->user4() <= 1) makeSmallNames(modp);
int index = varp->user4() / 256;
const char ch = varp->user4() & 255;

View File

@ -468,13 +468,13 @@ void V3ParseImp::tokenPipeline() {
if (nexttok == yP_COLONCOLON) {
token = yaID__CC;
} else if (nexttok == '#') {
const V3ParseBisonYYSType curValue
const V3ParseBisonYYSType curValueHold
= yylval; // Remember value, as about to read ahead
{
const size_t depth = tokenPipeScanParam(0);
if (tokenPeekp(depth)->token == yP_COLONCOLON) token = yaID__CC;
}
yylval = curValue;
yylval = curValueHold;
}
}
// If add to above "else if", also add to "if (token" further above

View File

@ -261,7 +261,7 @@ private:
// METHODS
protected:
friend class PartPropagateCp<PartPropagateCpSelfTest>;
void notifyEdgeCp(V3GraphVertex* vxp, GraphWay way, V3GraphVertex* throughp,
void notifyEdgeCp(V3GraphVertex* /*vxp*/, GraphWay way, V3GraphVertex* throughp,
uint32_t cp) const {
const uint32_t throughCost = critPathCost(throughp, way);
UASSERT_SELFTEST(uint32_t, cp, (1 + throughCost));
@ -272,7 +272,7 @@ private:
// Don't need to check this in the self test; it supports an assert
// that runs in production code.
}
void setCritPathCost(V3GraphVertex* vxp, GraphWay way, uint32_t cost) {
void setCritPathCost(V3GraphVertex* vxp, GraphWay /*way*/, uint32_t cost) {
m_cp[vxp] = cost;
// Confirm that we only set each node's CP once. That's an
// important property of PartPropagateCp which allows it to be far
@ -281,7 +281,7 @@ private:
UASSERT_OBJ(it == m_seen.end(), vxp, "Set CP on node twice");
m_seen[vxp] = cost;
}
uint32_t critPathCost(V3GraphVertex* vxp, GraphWay way) const {
uint32_t critPathCost(V3GraphVertex* vxp, GraphWay /*way*/) const {
const auto it = m_cp.find(vxp);
if (it != m_cp.end()) return it->second;
return 0;
@ -743,7 +743,7 @@ public:
bool mergeWouldCreateCycle() const; // Instead of virtual method
bool removedFromSb() const { return (m_id & REMOVED_MASK) != 0; }
void removedFromSb(bool removed) { m_id |= REMOVED_MASK; }
void removedFromSb(bool /*removed*/) { m_id |= REMOVED_MASK; }
bool operator<(const MergeCandidate& other) const { return m_id < other.m_id; }
};

View File

@ -378,7 +378,7 @@ public:
: m_tempNames{"__Vtemp"} {
iterate(nodep);
}
virtual ~PremitVisitor() {
~PremitVisitor() override {
V3Stats::addStat("Optimizations, Prelim extracted value to ConstPool",
m_extractedToConstPool);
}

View File

@ -75,7 +75,7 @@ private:
}
}
void markAllDerived() {
for (auto p : m_baseToDerivedMap) {
for (const auto& p : m_baseToDerivedMap) {
if (p.first->user1()) markDerived(p.first);
}
}

View File

@ -67,11 +67,11 @@ private:
// METHODS
VL_DEBUG_FUNC; // Declare debug()
AstVar* findCreateVarTemp(FileLine* fl, AstCFunc* cfuncp) {
static AstVar* findCreateVarTemp(FileLine* fl, AstCFunc* cfuncp) {
AstVar* varp = VN_AS(cfuncp->user1p(), Var);
if (!varp) {
const string newvarname = string("__Vilp");
varp = new AstVar(fl, VVarType::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

@ -610,7 +610,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
AstVarRef* createTempVar(AstNode* context, AstNode* nodep, AstUnpackArrayDType* dtypep,
const std::string& name_prefix, std::vector<AstVar*>& vars,
int start_idx, bool lvalue, bool ftask) {
int start_idx, bool lvalue, bool /*ftask*/) {
FileLine* const fl = nodep->fileline();
const std::string name = m_tempNames.get(nodep) + "__" + name_prefix;
AstNodeAssign* const assignp = VN_CAST(context, NodeAssign);
@ -773,8 +773,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
public:
explicit SplitUnpackedVarVisitor(AstNetlist* nodep)
: m_refs{}
, m_tempNames{"__VsplitVar"} {
: m_tempNames{"__VsplitVar"} {
iterate(nodep);
}
~SplitUnpackedVarVisitor() override {
@ -1114,10 +1113,10 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
<< " is added for " << varp->prettyNameQ() << '\n');
}
}
static void updateReferences(AstVar* varp, PackedVarRef& ref,
static void updateReferences(AstVar* varp, PackedVarRef& pref,
const std::vector<SplitNewVar>& vars) {
for (const bool lvalue : {false, true}) { // Refer the new split variables
std::vector<PackedVarRefEntry>& refs = lvalue ? ref.lhs() : ref.rhs();
std::vector<PackedVarRefEntry>& refs = lvalue ? pref.lhs() : pref.rhs();
for (PackedVarRefEntry& ref : refs) {
auto varit
= std::upper_bound(vars.begin(), vars.end(), ref.lsb(), SplitNewVar::Match());

View File

@ -112,7 +112,7 @@ private:
AstVarScope* m_vscp; // AstVarScope being traced (non const to allow copy during sorting)
std::string m_path; // Path to enclosing module in hierarchy
std::string m_name; // Name of signal
Signal(AstVarScope* vscp)
explicit Signal(AstVarScope* vscp)
: m_vscp{vscp} {
// Compute path in hierarchy and signal name
const string& vcdName = AstNode::vcdName(vscp->varp()->name());
@ -312,13 +312,13 @@ private:
const string intfScopeName = irpName.substr(0, scopeLen);
if (scopeName != intfScopeName) continue;
string scopeName = AstNode::vcdName(irp->name());
if (scopeName.substr(0, 4) == "TOP ") scopeName.erase(0, 4);
string iscopeName = AstNode::vcdName(irp->name());
if (iscopeName.substr(0, 4) == "TOP ") iscopeName.erase(0, 4);
// Note this insert doesn't know what above is interfaces.
// Perhaps all scopes should be changed to include the VLT_TRACE_SCOPE characters.
// Instead we fix up when printing m_scopeSubFuncps
scopeName += getScopeChar(VLT_TRACE_SCOPE_INTERFACE) + ' ';
m_scopeSubFuncps.emplace(scopeName, m_subFuncps);
iscopeName += getScopeChar(VLT_TRACE_SCOPE_INTERFACE) + ' ';
m_scopeSubFuncps.emplace(iscopeName, m_subFuncps);
VL_DO_DANGLING(irp->unlinkFrBack(), irp);
}

View File

@ -607,7 +607,6 @@ class TristateVisitor final : public TristateBaseVisitor {
if (!outvarp) {
// This is the final pre-forced resolution of the tristate, so we apply
// the pull direction to any undriven pins.
V3Number pull(invarp, lhsp->width());
const AstPull* const pullp = static_cast<AstPull*>(lhsp->user3p());
bool pull1 = pullp && pullp->direction() == 1; // Else default is down
undrivenp
@ -989,12 +988,13 @@ class TristateVisitor final : public TristateBaseVisitor {
if (!dropop[2]) iterateAndNextNull(nodep->fhsp());
} else {
AstNode* nonXp = nullptr;
if (!dropop[0])
if (!dropop[0]) {
nonXp = nodep->rhsp();
else if (!dropop[1])
} else if (!dropop[1]) {
nonXp = nodep->thsp();
else if (!dropop[2])
} else if (!dropop[2]) {
nonXp = nodep->fhsp();
}
// Replace 'z with non-Z
if (dropop[0] || dropop[1] || dropop[2]) {
// Unsupported: A $countones('0) should compare with the enables, but we don't

View File

@ -48,7 +48,7 @@ public:
: m_mtaskIds(mtaskIds) { // Cannot be {} or GCC 4.8 false warning
m_serial = ++s_serialNext; // Cannot be ()/{} or GCC 4.8 false warning
}
virtual ~VarTspSorter() = default;
~VarTspSorter() override = default;
// METHODS
virtual bool operator<(const TspStateBase& other) const override {
return operator<(dynamic_cast<const VarTspSorter&>(other));

View File

@ -674,10 +674,11 @@ private:
AstNodeDType* const vdtypep = m_vup->dtypeNullSkipRefp();
if (VN_IS(vdtypep, QueueDType) || VN_IS(vdtypep, DynArrayDType)
|| VN_IS(vdtypep, UnpackArrayDType)) {
if (times != 1)
if (times != 1) {
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Non-1 replication to form "
<< vdtypep->prettyDTypeNameQ()
<< " data type");
}
// Don't iterate lhsp as SELF, the potential Concat below needs
// the adtypep passed down to recognize the QueueDType
userIterateAndNext(nodep->lhsp(), WidthVP(vdtypep, BOTH).p());
@ -1125,9 +1126,10 @@ private:
}
virtual void visit(AstEmptyQueue* nodep) override {
nodep->dtypeSetEmptyQueue();
if (!VN_IS(nodep->backp(), Assign))
if (!VN_IS(nodep->backp(), Assign)) {
nodep->v3warn(E_UNSUPPORTED,
"Unsupported/Illegal: empty queue ('{}') in this context");
}
}
virtual void visit(AstFell* nodep) override {
if (m_vup->prelim()) {
@ -4040,6 +4042,7 @@ private:
argsp->v3error("Illegal to foreach loop on basic '" + fromDtp->prettyTypeName()
+ "'");
VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep);
VL_DO_DANGLING(bodyPointp->deleteTree(), bodyPointp);
return;
}
if (varp) {
@ -4592,9 +4595,11 @@ private:
// TOP LEVEL NODE
if (nodep->modVarp() && nodep->modVarp()->isGParam()) {
// Widthing handled as special init() case
if (auto* const patternp = VN_CAST(nodep->exprp(), Pattern))
if (const auto* modVarp = nodep->modVarp())
if (auto* const patternp = VN_CAST(nodep->exprp(), Pattern)) {
if (const auto* modVarp = nodep->modVarp()) {
patternp->childDTypep(modVarp->childDTypep()->cloneTree(false));
}
}
userIterateChildren(nodep, WidthVP(SELF, BOTH).p());
} else if (!m_paramsOnly) {
if (!nodep->modVarp()->didWidth()) {

View File

@ -70,7 +70,7 @@ private:
, m_fromRange{fromRange} {}
~FromData() = default;
};
FromData fromDataForArray(AstNode* nodep, AstNode* basefromp) {
static FromData fromDataForArray(AstNode* nodep, AstNode* basefromp) {
// What is the data type and information for this SEL-ish's from()?
UINFO(9, " fromData start ddtypep = " << basefromp << endl);
VNumRange fromRange; // constructs to isRanged(false)

View File

@ -703,7 +703,7 @@ static void execHierVerilation() {
//######################################################################
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv, char** /*env*/) {
// General initialization
std::ios::sync_with_stdio();