mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Internals: Some clang-tidy cleanups. No functional change intended.
This commit is contained in:
parent
cdeb6e792f
commit
b8e804f05b
@ -215,7 +215,7 @@ std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE {
|
||||
char* const bufp = new char[len + 1];
|
||||
VL_VSNPRINTF(bufp, len + 1, formatp, ap);
|
||||
|
||||
const std::string out{bufp, len};
|
||||
std::string out{bufp, len}; // Not const to allow move optimization
|
||||
delete[] bufp;
|
||||
return out;
|
||||
}
|
||||
@ -970,14 +970,14 @@ void _vl_vsformat(std::string& output, const char* formatp, va_list ap) VL_MT_SA
|
||||
}
|
||||
|
||||
static inline bool _vl_vsss_eof(FILE* fp, int floc) VL_MT_SAFE {
|
||||
if (fp) {
|
||||
if (VL_LIKELY(fp)) {
|
||||
return std::feof(fp) ? true : false; // true : false to prevent MSVC++ warning
|
||||
} else {
|
||||
return floc < 0;
|
||||
}
|
||||
}
|
||||
static inline void _vl_vsss_advance(FILE* fp, int& floc) VL_MT_SAFE {
|
||||
if (fp) {
|
||||
if (VL_LIKELY(fp)) {
|
||||
std::fgetc(fp);
|
||||
} else {
|
||||
floc -= 8;
|
||||
@ -986,7 +986,7 @@ static inline void _vl_vsss_advance(FILE* fp, int& floc) VL_MT_SAFE {
|
||||
static inline int _vl_vsss_peek(FILE* fp, int& floc, const WDataInP fromp,
|
||||
const std::string& fstr) VL_MT_SAFE {
|
||||
// Get a character without advancing
|
||||
if (fp) {
|
||||
if (VL_LIKELY(fp)) {
|
||||
const int data = std::fgetc(fp);
|
||||
if (data == EOF) return EOF;
|
||||
ungetc(data, fp);
|
||||
@ -2259,7 +2259,7 @@ VerilatedContext::VerilatedContext()
|
||||
Verilated::threadContextp(this);
|
||||
m_ns.m_profThreadsFilename = "profile_threads.dat";
|
||||
m_fdps.resize(31);
|
||||
std::fill(m_fdps.begin(), m_fdps.end(), (FILE*)0);
|
||||
std::fill(m_fdps.begin(), m_fdps.end(), static_cast<FILE*>(nullptr));
|
||||
m_fdFreeMct.resize(30);
|
||||
for (std::size_t i = 0, id = 1; i < m_fdFreeMct.size(); ++i, ++id) m_fdFreeMct[i] = id;
|
||||
}
|
||||
@ -2422,7 +2422,7 @@ void VerilatedContext::internalsDump() const VL_MT_SAFE {
|
||||
void VerilatedContextImp::commandArgsAddGuts(int argc, const char** argv) VL_REQUIRES(m_argMutex) {
|
||||
if (!m_args.m_argVecLoaded) m_args.m_argVec.clear();
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
m_args.m_argVec.push_back(argv[i]);
|
||||
m_args.m_argVec.emplace_back(argv[i]);
|
||||
commandArgVl(argv[i]);
|
||||
}
|
||||
m_args.m_argVecLoaded = true; // Can't just test later for empty vector, no arguments is ok
|
||||
|
@ -143,8 +143,9 @@ private:
|
||||
std::string rtn;
|
||||
for (const char* pos = text.c_str(); *pos; ++pos) {
|
||||
if (!std::isprint(*pos) || *pos == '%' || *pos == '"') {
|
||||
char hex[10];
|
||||
VL_SNPRINTF(hex, 10, "%%%02X", pos[0]);
|
||||
constexpr size_t LEN_MAX_HEX = 20;
|
||||
char hex[LEN_MAX_HEX];
|
||||
VL_SNPRINTF(hex, LEN_MAX_HEX, "%%%02X", pos[0]);
|
||||
rtn += hex;
|
||||
} else {
|
||||
rtn += *pos;
|
||||
|
@ -386,7 +386,7 @@ static void _vl_svPutLogicArrElemVecVal(const svOpenArrayHandle d, const svLogic
|
||||
|
||||
// Return bit from simulator open array
|
||||
static svBit _vl_svGetBitArrElem(const svOpenArrayHandle s, int nargs, int indx1, int indx2,
|
||||
int indx3, int indx4) VL_MT_SAFE {
|
||||
int indx3, int) VL_MT_SAFE {
|
||||
// One extra index supported, as need bit number
|
||||
const VerilatedDpiOpenVar* const varp = _vl_openhandle_varp(s);
|
||||
void* const datap = _vl_sv_adjusted_datap(varp, nargs, indx1, indx2, indx3);
|
||||
@ -401,7 +401,7 @@ static svBit _vl_svGetBitArrElem(const svOpenArrayHandle s, int nargs, int indx1
|
||||
}
|
||||
// Update simulator open array from bit
|
||||
static void _vl_svPutBitArrElem(const svOpenArrayHandle d, svBit value, int nargs, int indx1,
|
||||
int indx2, int indx3, int indx4) VL_MT_SAFE {
|
||||
int indx2, int indx3, int) VL_MT_SAFE {
|
||||
// One extra index supported, as need bit number
|
||||
value &= 1; // Make sure clean
|
||||
const VerilatedDpiOpenVar* const varp = _vl_openhandle_varp(d);
|
||||
|
@ -53,29 +53,31 @@
|
||||
|
||||
//=============================================================================
|
||||
// Check that vltscope_t matches fstScopeType
|
||||
static_assert((int)FST_ST_VCD_MODULE == (int)VLT_TRACE_SCOPE_MODULE,
|
||||
|
||||
static_assert(static_cast<int>(FST_ST_VCD_MODULE) == static_cast<int>(VLT_TRACE_SCOPE_MODULE),
|
||||
"VLT_TRACE_SCOPE_MODULE mismatches");
|
||||
static_assert((int)FST_ST_VCD_TASK == (int)VLT_TRACE_SCOPE_TASK,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_TASK) == static_cast<int>(VLT_TRACE_SCOPE_TASK),
|
||||
"VLT_TRACE_SCOPE_TASK mismatches");
|
||||
static_assert((int)FST_ST_VCD_FUNCTION == (int)VLT_TRACE_SCOPE_FUNCTION,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_FUNCTION) == static_cast<int>(VLT_TRACE_SCOPE_FUNCTION),
|
||||
"VLT_TRACE_SCOPE_FUNCTION mismatches");
|
||||
static_assert((int)FST_ST_VCD_BEGIN == (int)VLT_TRACE_SCOPE_BEGIN,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_BEGIN) == static_cast<int>(VLT_TRACE_SCOPE_BEGIN),
|
||||
"VLT_TRACE_SCOPE_BEGIN mismatches");
|
||||
static_assert((int)FST_ST_VCD_FORK == (int)VLT_TRACE_SCOPE_FORK,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_FORK) == static_cast<int>(VLT_TRACE_SCOPE_FORK),
|
||||
"VLT_TRACE_SCOPE_FORK mismatches");
|
||||
static_assert((int)FST_ST_VCD_GENERATE == (int)VLT_TRACE_SCOPE_GENERATE,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_GENERATE) == static_cast<int>(VLT_TRACE_SCOPE_GENERATE),
|
||||
"VLT_TRACE_SCOPE_GENERATE mismatches");
|
||||
static_assert((int)FST_ST_VCD_STRUCT == (int)VLT_TRACE_SCOPE_STRUCT,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_STRUCT) == static_cast<int>(VLT_TRACE_SCOPE_STRUCT),
|
||||
"VLT_TRACE_SCOPE_STRUCT mismatches");
|
||||
static_assert((int)FST_ST_VCD_UNION == (int)VLT_TRACE_SCOPE_UNION,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_UNION) == static_cast<int>(VLT_TRACE_SCOPE_UNION),
|
||||
"VLT_TRACE_SCOPE_UNION mismatches");
|
||||
static_assert((int)FST_ST_VCD_CLASS == (int)VLT_TRACE_SCOPE_CLASS,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_CLASS) == static_cast<int>(VLT_TRACE_SCOPE_CLASS),
|
||||
"VLT_TRACE_SCOPE_CLASS mismatches");
|
||||
static_assert((int)FST_ST_VCD_INTERFACE == (int)VLT_TRACE_SCOPE_INTERFACE,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_INTERFACE)
|
||||
== static_cast<int>(VLT_TRACE_SCOPE_INTERFACE),
|
||||
"VLT_TRACE_SCOPE_INTERFACE mismatches");
|
||||
static_assert((int)FST_ST_VCD_PACKAGE == (int)VLT_TRACE_SCOPE_PACKAGE,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_PACKAGE) == static_cast<int>(VLT_TRACE_SCOPE_PACKAGE),
|
||||
"VLT_TRACE_SCOPE_PACKAGE mismatches");
|
||||
static_assert((int)FST_ST_VCD_PROGRAM == (int)VLT_TRACE_SCOPE_PROGRAM,
|
||||
static_assert(static_cast<int>(FST_ST_VCD_PROGRAM) == static_cast<int>(VLT_TRACE_SCOPE_PROGRAM),
|
||||
"VLT_TRACE_SCOPE_PROGRAM mismatches");
|
||||
|
||||
//=============================================================================
|
||||
@ -191,8 +193,8 @@ void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstV
|
||||
tmpModName = *new_it;
|
||||
tmpModName.pop_back();
|
||||
// If the scope ends with a non-ascii character, it will be 0x80 + fstScopeType
|
||||
fstWriterSetScope(m_fst, (fstScopeType)(new_it->back() & 0x7f), tmpModName.c_str(),
|
||||
nullptr);
|
||||
fstWriterSetScope(m_fst, static_cast<fstScopeType>(new_it->back() & 0x7f),
|
||||
tmpModName.c_str(), nullptr);
|
||||
} else
|
||||
fstWriterSetScope(m_fst, FST_ST_VCD_SCOPE, new_it->c_str(), nullptr);
|
||||
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
|
||||
// FILE* list constructed from a file-descriptor
|
||||
class VerilatedFpList final {
|
||||
FILE* m_fp[31];
|
||||
FILE* m_fp[31] = {};
|
||||
std::size_t m_sz = 0;
|
||||
|
||||
public:
|
||||
|
@ -48,7 +48,8 @@ VlMTaskVertex::VlMTaskVertex(vluint32_t upstreamDepCount)
|
||||
// VlWorkerThread
|
||||
|
||||
VlWorkerThread::VlWorkerThread(VlThreadPool* poolp, VerilatedContext* contextp, bool profiling)
|
||||
: m_poolp{poolp}
|
||||
: m_ready_size{0}
|
||||
, m_poolp{poolp}
|
||||
, m_profiling{profiling} // Must init this last -- after setting up fields that it might read:
|
||||
, m_exiting{false}
|
||||
, m_cthread{startWorker, this}
|
||||
|
@ -271,8 +271,9 @@ void VerilatedVcd::printStr(const char* str) {
|
||||
}
|
||||
|
||||
void VerilatedVcd::printQuad(vluint64_t n) {
|
||||
char buf[100];
|
||||
VL_SNPRINTF(buf, 100, "%" VL_PRI64 "u", n);
|
||||
constexpr size_t LEN_STR_QUAD = 40;
|
||||
char buf[LEN_STR_QUAD];
|
||||
VL_SNPRINTF(buf, LEN_STR_QUAD, "%" VL_PRI64 "u", n);
|
||||
printStr(buf);
|
||||
}
|
||||
|
||||
@ -355,9 +356,9 @@ void VerilatedVcd::dumpHeader() {
|
||||
const time_t tick = time(nullptr);
|
||||
tm ticktm;
|
||||
VL_LOCALTIME_R(&tick, &ticktm);
|
||||
constexpr int bufsize = 50;
|
||||
char buf[bufsize];
|
||||
std::strftime(buf, bufsize, "%c", &ticktm);
|
||||
constexpr size_t LEN_BUF = 50;
|
||||
char buf[LEN_BUF];
|
||||
std::strftime(buf, LEN_BUF, "%c", &ticktm);
|
||||
printStr(buf);
|
||||
}
|
||||
printStr(" $end\n");
|
||||
|
@ -343,8 +343,9 @@ public:
|
||||
virtual const VerilatedRange* rangep() const override { return &(varp()->packed()); }
|
||||
virtual const char* fullname() const override {
|
||||
static VL_THREAD_LOCAL std::string t_out;
|
||||
char num[25];
|
||||
VL_SNPRINTF(num, 25, "%d", m_index);
|
||||
constexpr size_t LEN_MAX_INDEX = 25;
|
||||
char num[LEN_MAX_INDEX];
|
||||
VL_SNPRINTF(num, LEN_MAX_INDEX, "%d", m_index);
|
||||
t_out = std::string{scopep()->name()} + "." + name() + "[" + num + "]";
|
||||
return t_out.c_str();
|
||||
}
|
||||
@ -484,7 +485,7 @@ public:
|
||||
m_cbData.obj = m_varo.castVpiHandle();
|
||||
m_varo.createPrevDatap();
|
||||
} else {
|
||||
m_cbData.obj = NULL;
|
||||
m_cbData.obj = nullptr;
|
||||
}
|
||||
}
|
||||
~VerilatedVpiCbHolder() = default;
|
||||
@ -631,12 +632,13 @@ public:
|
||||
void* const prevDatap
|
||||
= varop->prevDatap(); // Was malloced when we added the callback
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: value_test %s v[0]=%d/%d %p %p\n",
|
||||
varop->fullname(), *((CData*)newDatap),
|
||||
*((CData*)prevDatap), newDatap, prevDatap););
|
||||
varop->fullname(), *(static_cast<CData*>(newDatap)),
|
||||
*(static_cast<CData*>(prevDatap)), newDatap,
|
||||
prevDatap););
|
||||
if (std::memcmp(prevDatap, newDatap, varop->entSize()) != 0) {
|
||||
VL_DEBUG_IF_PLI(VL_DBG_MSGF("- vpi: value_callback %" VL_PRI64
|
||||
"d %s v[0]=%d\n",
|
||||
ho.id(), varop->fullname(), *((CData*)newDatap)););
|
||||
VL_DEBUG_IF_PLI(
|
||||
VL_DBG_MSGF("- vpi: value_callback %" VL_PRI64 "d %s v[0]=%d\n", ho.id(),
|
||||
varop->fullname(), *(static_cast<CData*>(newDatap))););
|
||||
update.insert(varop);
|
||||
vpi_get_value(ho.cb_datap()->obj, ho.cb_datap()->value);
|
||||
(ho.cb_rtnp())(ho.cb_datap());
|
||||
@ -707,7 +709,8 @@ public:
|
||||
va_end(args);
|
||||
m_errorInfo.state = vpiPLI;
|
||||
t_filehold = file;
|
||||
setError((PLI_BYTE8*)m_buff, nullptr, const_cast<PLI_BYTE8*>(t_filehold.c_str()), line);
|
||||
setError(static_cast<PLI_BYTE8*>(m_buff), nullptr,
|
||||
const_cast<PLI_BYTE8*>(t_filehold.c_str()), line);
|
||||
}
|
||||
p_vpi_error_info getError() {
|
||||
if (m_flag) return &m_errorInfo;
|
||||
@ -1109,7 +1112,7 @@ const char* VerilatedVpiError::strFromVpiProp(PLI_INT32 vpiVal) VL_MT_SAFE {
|
||||
#define SELF_CHECK_RESULT_CSTR(got, exp) \
|
||||
if (0 != std::strcmp((got), (exp))) { \
|
||||
std::string msg \
|
||||
= std::string{"%Error: "} + "GOT = '" + got + "'" + " EXP = '" + exp + "'"; \
|
||||
= std::string{"%Error: "} + "GOT = '" + (got) + "'" + " EXP = '" + (exp) + "'"; \
|
||||
VL_FATAL_MT(__FILE__, __LINE__, "", msg.c_str()); \
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ public:
|
||||
: V3GraphVertex{graphp}
|
||||
, m_name{name}
|
||||
, m_type{type} {}
|
||||
virtual string name() const { return m_name + " " + typestr(); }
|
||||
virtual string dotColor() const { return user() ? "green" : "black"; }
|
||||
virtual string name() const override { return m_name + " " + typestr(); }
|
||||
virtual string dotColor() const override { return user() ? "green" : "black"; }
|
||||
virtual int type() const { return m_type; }
|
||||
};
|
||||
|
||||
@ -120,7 +120,7 @@ protected:
|
||||
|
||||
public:
|
||||
LatchDetectGraph() { clear(); }
|
||||
~LatchDetectGraph() { clear(); }
|
||||
virtual ~LatchDetectGraph() override { clear(); }
|
||||
// ACCESSORS
|
||||
LatchDetectGraphVertex* currentp() { return m_curVertexp; }
|
||||
void currentp(LatchDetectGraphVertex* vertex) { m_curVertexp = vertex; }
|
||||
|
@ -1716,7 +1716,7 @@ public:
|
||||
VSigning numeric) const;
|
||||
AstNodeDType* findBitRangeDType(const VNumRange& range, int widthMin, VSigning numeric) const;
|
||||
AstNodeDType* findBasicDType(AstBasicDTypeKwd kwd) const;
|
||||
AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
|
||||
static AstBasicDType* findInsertSameDType(AstBasicDType* nodep);
|
||||
|
||||
// METHODS - dump and error
|
||||
void v3errorEnd(std::ostringstream& str) const;
|
||||
|
@ -43,8 +43,8 @@ private:
|
||||
AstUser1InUse m_inuser1;
|
||||
|
||||
// STATE
|
||||
int m_likely; // Excuses for branch likely taken
|
||||
int m_unlikely; // Excuses for branch likely not taken
|
||||
int m_likely = false; // Excuses for branch likely taken
|
||||
int m_unlikely = false; // Excuses for branch likely not taken
|
||||
std::vector<AstCFunc*> m_cfuncsp; // List of all tasks
|
||||
|
||||
// METHODS
|
||||
|
@ -164,10 +164,11 @@ class ConstBitOpTreeVisitor final : public AstNVisitor {
|
||||
"bit:" << bit << " newWidth:" << newWidth);
|
||||
m_bitPolarity.setAllBitsX();
|
||||
for (int i = 0; i < oldPol.width(); ++i) {
|
||||
if (oldPol.bitIs0(i))
|
||||
if (oldPol.bitIs0(i)) {
|
||||
m_bitPolarity.setBit(i, '0');
|
||||
else if (oldPol.bitIs1(i))
|
||||
} else if (oldPol.bitIs1(i)) {
|
||||
m_bitPolarity.setBit(i, '1');
|
||||
}
|
||||
}
|
||||
}
|
||||
UASSERT_OBJ(bit < m_bitPolarity.width(), m_refp,
|
||||
@ -306,19 +307,20 @@ class ConstBitOpTreeVisitor final : public AstNVisitor {
|
||||
}
|
||||
|
||||
bool ok = !m_failed;
|
||||
if (expectConst)
|
||||
if (expectConst) {
|
||||
ok &= !info.m_refp && info.m_constp;
|
||||
else
|
||||
} else {
|
||||
ok &= info.m_refp && !info.m_constp;
|
||||
}
|
||||
return ok ? info : LeafInfo{};
|
||||
}
|
||||
AstNode* combineTree(AstNode* lhsp, AstNode* rhsp) {
|
||||
if (!lhsp) return rhsp;
|
||||
if (isAndTree())
|
||||
if (isAndTree()) {
|
||||
return new AstAnd(m_rootp->fileline(), lhsp, rhsp);
|
||||
else if (isOrTree())
|
||||
} else if (isOrTree()) {
|
||||
return new AstOr(m_rootp->fileline(), lhsp, rhsp);
|
||||
else {
|
||||
} else {
|
||||
UASSERT_OBJ(isXorTree(), m_rootp, "must be either Xor or RedXor");
|
||||
return new AstXor(m_rootp->fileline(), lhsp, rhsp);
|
||||
}
|
||||
@ -836,7 +838,8 @@ private:
|
||||
} else if (AstShiftL* const shiftp = VN_CAST(nodep->rhsp(), ShiftL)) {
|
||||
if (const AstConst* scp = VN_CAST_CONST(shiftp->rhsp(), Const)) {
|
||||
// Check if mask is full over the non-zero bits
|
||||
V3Number maskLo(nodep, nodep->width()), maskHi(nodep, nodep->width());
|
||||
V3Number maskLo(nodep, nodep->width());
|
||||
V3Number maskHi(nodep, nodep->width());
|
||||
maskLo.setMask(nodep->width() - scp->num().toUInt());
|
||||
maskHi.opShiftL(maskLo, scp->num());
|
||||
return checkMask(maskHi);
|
||||
|
@ -57,7 +57,7 @@ protected:
|
||||
puts("\n");
|
||||
for (uint32_t n = 0; n < size; ++n) {
|
||||
m_unpackedWord = n;
|
||||
if (n) puts(n % tabMod ? ", " : ",\n");
|
||||
if (n) puts((n % tabMod) ? ", " : ",\n");
|
||||
iterate(nodep->getIndexDefaultedValuep(n));
|
||||
}
|
||||
puts("\n");
|
||||
@ -87,7 +87,7 @@ protected:
|
||||
if (m_inUnpacked) puts(" // VlWide " + cvtToStr(m_unpackedWord));
|
||||
puts("\n");
|
||||
for (uint32_t n = 0; n < size; ++n) {
|
||||
if (n) puts(n % 4 ? ", " : ",\n");
|
||||
if (n) puts((n % 4) ? ", " : ",\n");
|
||||
ofp()->printf("0x%08" PRIx32, num.edataWord(n));
|
||||
}
|
||||
puts("\n");
|
||||
|
@ -91,7 +91,7 @@ class EmitCLazyDecls final : public AstNVisitor {
|
||||
VL_DEBUG_FUNC;
|
||||
|
||||
public:
|
||||
EmitCLazyDecls(EmitCBaseVisitor& emitter)
|
||||
explicit EmitCLazyDecls(EmitCBaseVisitor& emitter)
|
||||
: m_emitter(emitter) {}
|
||||
void emit(AstNode* nodep) {
|
||||
m_needsBlankLine = false;
|
||||
|
@ -93,6 +93,8 @@ private:
|
||||
puts("topp->final();\n");
|
||||
puts("return 0;\n");
|
||||
puts("}\n");
|
||||
|
||||
m_ofp = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,6 @@ private:
|
||||
AstNode* m_insStmtp = nullptr; // Where to insert statement
|
||||
bool m_unsupportedHere = false; // Used to detect where it's not supported yet
|
||||
|
||||
private:
|
||||
void insertBeforeStmt(AstNode* nodep, AstNode* newp) {
|
||||
// Return node that must be visited, if any
|
||||
// See also AstNode::addBeforeStmt; this predates that function
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
|
||||
public:
|
||||
// Remove marks from AstVars (clear user1)
|
||||
void clear() { AstNode::user1ClearTree(); }
|
||||
static void clear() { AstNode::user1ClearTree(); }
|
||||
|
||||
// Mark all AstVars referenced by setting user1
|
||||
void mark(AstNode* node) { iterate(node); }
|
||||
@ -142,7 +142,7 @@ private:
|
||||
// it is in a supported position, which are:
|
||||
// - RHS is the Cond
|
||||
// - RHS is And(Const, Cond). This And is inserted often by V3Clean.
|
||||
AstNodeCond* extractCond(AstNode* rhsp) {
|
||||
static AstNodeCond* extractCond(AstNode* rhsp) {
|
||||
if (AstNodeCond* const condp = VN_CAST(rhsp, NodeCond)) {
|
||||
return condp;
|
||||
} else if (AstAnd* const andp = VN_CAST(rhsp, And)) {
|
||||
@ -160,7 +160,7 @@ private:
|
||||
// wide, but working that out here is a bit difficult. As this masking is
|
||||
// rarely required (only when trying to merge a "cond & value" with an
|
||||
// earlier ternary), we will just always mask it for safety.
|
||||
AstNode* maskLsb(AstNode* nodep) {
|
||||
static AstNode* maskLsb(AstNode* nodep) {
|
||||
AstNode* const maskp = new AstConst(nodep->fileline(), AstConst::BitTrue());
|
||||
return new AstAnd(nodep->fileline(), nodep, maskp);
|
||||
}
|
||||
|
@ -422,22 +422,22 @@ V3Number& V3Number::setSingleBits(char value) {
|
||||
}
|
||||
|
||||
V3Number& V3Number::setAllBits0() {
|
||||
for (int i = 0; i < words(); i++) { m_value[i] = {0, 0}; }
|
||||
for (int i = 0; i < words(); i++) m_value[i] = {0, 0};
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::setAllBits1() {
|
||||
for (int i = 0; i < words(); i++) { m_value[i] = {~0u, 0}; }
|
||||
for (int i = 0; i < words(); i++) m_value[i] = {~0U, 0};
|
||||
opCleanThis();
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::setAllBitsX() {
|
||||
// Use setAllBitsXRemoved if calling this based on a non-X/Z input value such as divide by zero
|
||||
for (int i = 0; i < words(); i++) { m_value[i] = {~0u, ~0u}; }
|
||||
for (int i = 0; i < words(); i++) m_value[i] = {~0U, ~0U};
|
||||
opCleanThis();
|
||||
return *this;
|
||||
}
|
||||
V3Number& V3Number::setAllBitsZ() {
|
||||
for (int i = 0; i < words(); i++) { m_value[i] = {0, ~0u}; }
|
||||
for (int i = 0; i < words(); i++) m_value[i] = {0, ~0U};
|
||||
opCleanThis();
|
||||
return *this;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ class ParamProcessor final {
|
||||
// METHODS
|
||||
VL_DEBUG_FUNC; // Declare debug()
|
||||
|
||||
void makeSmallNames(AstNodeModule* modp) {
|
||||
static void makeSmallNames(AstNodeModule* modp) {
|
||||
std::vector<int> usedLetter;
|
||||
usedLetter.resize(256);
|
||||
// Pass 1, assign first letter to each gparam's name
|
||||
|
@ -991,6 +991,7 @@ private:
|
||||
}
|
||||
}
|
||||
SimStackNode stackNode(nodep, &tconnects);
|
||||
// cppcheck-suppress danglingLifetime
|
||||
m_callStack.push_back(&stackNode);
|
||||
// Clear output variable
|
||||
if (auto* const basicp = VN_CAST(funcp->fvarp(), Var)->basicp()) {
|
||||
|
@ -1231,9 +1231,10 @@ public:
|
||||
} else {
|
||||
reason = "its type is unknown"; // LCOV_EXCL_LINE
|
||||
}
|
||||
if (reason)
|
||||
if (reason) {
|
||||
UINFO(5,
|
||||
"Check " << nodep->prettyNameQ() << " cannot split because" << reason << endl);
|
||||
}
|
||||
return reason;
|
||||
}
|
||||
VL_DEBUG_FUNC; // Declare debug()
|
||||
|
@ -24,12 +24,6 @@
|
||||
|
||||
class AstNetlist;
|
||||
|
||||
#define STAT_ADD_UINFO(level, text, value) \
|
||||
do { \
|
||||
UINFO((level), "addStat " << text << " " << value << endl); \
|
||||
V3Stats::addStat(text, value); \
|
||||
} while (0)
|
||||
|
||||
//============================================================================
|
||||
|
||||
class VDouble0 final {
|
||||
|
@ -499,7 +499,7 @@ public:
|
||||
: m_xpos{xpos}
|
||||
, m_ypos{ypos}
|
||||
, m_serial{++s_serialNext} {}
|
||||
~TspTestState() = default;
|
||||
virtual ~TspTestState() override = default;
|
||||
virtual int cost(const TspStateBase* otherp) const override {
|
||||
return cost(dynamic_cast<const TspTestState*>(otherp));
|
||||
}
|
||||
|
@ -689,13 +689,13 @@ private:
|
||||
return dpiproto;
|
||||
}
|
||||
|
||||
AstNode* createDpiTemp(AstVar* portp, const string& suffix) {
|
||||
static AstNode* createDpiTemp(AstVar* portp, const string& suffix) {
|
||||
const string stmt = portp->dpiTmpVarType(portp->name() + suffix) + ";\n";
|
||||
return new AstCStmt(portp->fileline(), stmt);
|
||||
}
|
||||
|
||||
AstNode* createAssignInternalToDpi(AstVar* portp, bool isPtr, const string& frSuffix,
|
||||
const string& toSuffix) {
|
||||
static AstNode* createAssignInternalToDpi(AstVar* portp, bool isPtr, const string& frSuffix,
|
||||
const string& toSuffix) {
|
||||
const string stmt = V3Task::assignInternalToDpi(portp, isPtr, frSuffix, toSuffix);
|
||||
return new AstCStmt(portp->fileline(), stmt);
|
||||
}
|
||||
@ -948,7 +948,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
void makePortList(AstNodeFTask* nodep, AstCFunc* dpip) {
|
||||
static void makePortList(AstNodeFTask* nodep, AstCFunc* dpip) {
|
||||
// Copy nodep's list of function I/O to the new dpip c function
|
||||
for (AstNode* stmtp = nodep->stmtsp(); stmtp; stmtp = stmtp->nextp()) {
|
||||
if (AstVar* portp = VN_CAST(stmtp, Var)) {
|
||||
|
Loading…
Reference in New Issue
Block a user