Internals: Fix name of some static and thread variables. No functional change.
This commit is contained in:
parent
9513edfdd6
commit
b652009235
|
|
@ -256,8 +256,8 @@ std::string _vl_string_vprintf(const char* formatp, va_list ap) VL_MT_SAFE {
|
|||
}
|
||||
|
||||
uint64_t _vl_dbg_sequence_number() VL_MT_SAFE {
|
||||
static std::atomic<uint64_t> sequence;
|
||||
return ++sequence;
|
||||
static std::atomic<uint64_t> s_sequence;
|
||||
return ++s_sequence;
|
||||
}
|
||||
|
||||
uint32_t VL_THREAD_ID() VL_MT_SAFE {
|
||||
|
|
@ -2503,11 +2503,11 @@ void VL_WRITEMEM_N(bool hex, // Hex format, else binary
|
|||
// Timescale conversion
|
||||
|
||||
static const char* vl_time_str(int scale) VL_PURE {
|
||||
static const char* const names[]
|
||||
static const char* const s_names[]
|
||||
= {"100s", "10s", "1s", "100ms", "10ms", "1ms", "100us", "10us", "1us",
|
||||
"100ns", "10ns", "1ns", "100ps", "10ps", "1ps", "100fs", "10fs", "1fs"};
|
||||
if (VL_UNLIKELY(scale > 2 || scale < -15)) scale = 0;
|
||||
return names[2 - scale];
|
||||
return s_names[2 - scale];
|
||||
}
|
||||
double vl_time_multiplier(int scale) VL_PURE {
|
||||
// Return timescale multiplier -18 to +18
|
||||
|
|
|
|||
|
|
@ -3127,7 +3127,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
|
||||
const VerilatedVar* const varp = vop->varp();
|
||||
|
||||
static thread_local EData out_data[VL_VALUE_STRING_MAX_WORDS * 2];
|
||||
static thread_local EData t_out_data[VL_VALUE_STRING_MAX_WORDS * 2];
|
||||
|
||||
const unsigned size = vop->size();
|
||||
if (VL_UNCOVERABLE(num > size)) {
|
||||
|
|
@ -3147,7 +3147,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_INT16* shortintsp = reinterpret_cast<PLI_INT16*>(out_data);
|
||||
PLI_INT16* shortintsp = reinterpret_cast<PLI_INT16*>(t_out_data);
|
||||
arrayvalue_p->value.shortints = shortintsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3166,7 +3166,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_INT32* integersp = reinterpret_cast<PLI_INT32*>(out_data);
|
||||
PLI_INT32* integersp = reinterpret_cast<PLI_INT32*>(t_out_data);
|
||||
arrayvalue_p->value.integers = integersp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3188,7 +3188,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_INT64* longintsp = reinterpret_cast<PLI_INT64*>(out_data);
|
||||
PLI_INT64* longintsp = reinterpret_cast<PLI_INT64*>(t_out_data);
|
||||
arrayvalue_p->value.longints = longintsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3213,7 +3213,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
p_vpi_vecval vectorsp = reinterpret_cast<p_vpi_vecval>(out_data);
|
||||
p_vpi_vecval vectorsp = reinterpret_cast<p_vpi_vecval>(t_out_data);
|
||||
arrayvalue_p->value.vectors = vectorsp;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3241,7 +3241,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(out_data);
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(t_out_data);
|
||||
arrayvalue_p->value.rawvals = valuep;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
@ -3269,7 +3269,7 @@ void vl_get_value_array(vpiHandle object, p_vpi_arrayvalue arrayvalue_p, const P
|
|||
"increase and recompile");
|
||||
}
|
||||
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(out_data);
|
||||
PLI_BYTE8* valuep = reinterpret_cast<PLI_BYTE8*>(t_out_data);
|
||||
arrayvalue_p->value.rawvals = valuep;
|
||||
|
||||
if (varp->vltype() == VLVT_UINT8) {
|
||||
|
|
|
|||
|
|
@ -341,12 +341,12 @@ public:
|
|||
|
||||
void V3Broken::brokenAll(AstNetlist* nodep) {
|
||||
// UINFO(9, __FUNCTION__ << ": ");
|
||||
static bool inBroken = false;
|
||||
if (VL_UNCOVERABLE(inBroken)) {
|
||||
static bool s_inBroken = false;
|
||||
if (VL_UNCOVERABLE(s_inBroken)) {
|
||||
// A error called by broken can recurse back into broken; avoid this
|
||||
UINFO(1, "Broken called under broken, skipping recursion."); // LCOV_EXCL_LINE
|
||||
} else {
|
||||
inBroken = true;
|
||||
s_inBroken = true;
|
||||
|
||||
V3LockGuard lock{s_allocTable.m_mutex};
|
||||
|
||||
|
|
@ -369,7 +369,7 @@ void V3Broken::brokenAll(AstNetlist* nodep) {
|
|||
s_allocTable.checkForLeaks();
|
||||
s_linkableTable.clear();
|
||||
s_brokenCntGlobal.inc();
|
||||
inBroken = false;
|
||||
s_inBroken = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1299,9 +1299,9 @@ class ConstVisitor final : public VNVisitor {
|
|||
|
||||
string debugPrefix;
|
||||
if (debug() >= 9) { // LCOV_EXCL_START
|
||||
static int c = 0;
|
||||
static int s_c = 0;
|
||||
debugPrefix = "- matchBitOpTree[";
|
||||
debugPrefix += cvtToStr(++c);
|
||||
debugPrefix += cvtToStr(++s_c);
|
||||
debugPrefix += "] ";
|
||||
nodep->dumpTree(debugPrefix + "INPUT: ");
|
||||
} // LCOV_EXCL_STOP
|
||||
|
|
|
|||
|
|
@ -262,10 +262,10 @@ void V3ErrorGuarded::v3errorEndGuts(const std::ostringstream& sstr, const string
|
|||
incWarnings();
|
||||
}
|
||||
if (m_message.code().severityFatal()) {
|
||||
static bool inFatal = false;
|
||||
static bool s_inFatal = false;
|
||||
// cppcheck-suppress duplicateConditionalAssign // Used by VlcMain.cpp
|
||||
if (!inFatal) {
|
||||
inFatal = true;
|
||||
if (!s_inFatal) {
|
||||
s_inFatal = true;
|
||||
#ifndef V3ERROR_NO_GLOBAL_
|
||||
if (dumpTreeLevel() || dumpTreeJsonLevel() || debug()) {
|
||||
V3Broken::allowMidvisitorCheck(true);
|
||||
|
|
|
|||
|
|
@ -729,17 +729,17 @@ void v3errorEndFatal(std::ostringstream& sstr)
|
|||
VL_ATTR_UNUSED static int debug##__VA_ARGS__() VL_MT_SAFE { \
|
||||
/* Don't complain this function is unused */ \
|
||||
(void)&debug##__VA_ARGS__; \
|
||||
static int level = -1; \
|
||||
if (VL_UNLIKELY(level < 0)) { \
|
||||
static int s_level = -1; \
|
||||
if (VL_UNLIKELY(s_level < 0)) { \
|
||||
std::string tag{VL_STRINGIFY(__VA_ARGS__)}; \
|
||||
if (!tag.empty()) tag[0] = std::tolower(tag[0]); \
|
||||
const unsigned debugTag = v3Global.opt.debugLevel(tag); \
|
||||
const unsigned debugSrc = v3Global.opt.debugSrcLevel(__FILE__); \
|
||||
const unsigned debugLevel = debugTag >= debugSrc ? debugTag : debugSrc; \
|
||||
if (!v3Global.opt.available()) return static_cast<int>(debugLevel); \
|
||||
level = static_cast<int>(debugLevel); \
|
||||
s_level = static_cast<int>(debugLevel); \
|
||||
} \
|
||||
return level; \
|
||||
return s_level; \
|
||||
} \
|
||||
static_assert(true, "")
|
||||
|
||||
|
|
@ -748,15 +748,15 @@ void v3errorEndFatal(std::ostringstream& sstr)
|
|||
VL_ATTR_UNUSED static int dump##func() VL_MT_SAFE { \
|
||||
/* Don't complain this function is unused */ \
|
||||
(void)&dump##func; \
|
||||
static int level = -1; \
|
||||
if (VL_UNLIKELY(level < 0)) { \
|
||||
static int s_level = -1; \
|
||||
if (VL_UNLIKELY(s_level < 0)) { \
|
||||
const unsigned dumpTag = v3Global.opt.dumpLevel(tag); \
|
||||
const unsigned dumpSrc = v3Global.opt.dumpSrcLevel(__FILE__); \
|
||||
const unsigned dumpLevel = dumpTag >= dumpSrc ? dumpTag : dumpSrc; \
|
||||
if (!v3Global.opt.available()) return static_cast<int>(dumpLevel); \
|
||||
level = static_cast<int>(dumpLevel); \
|
||||
s_level = static_cast<int>(dumpLevel); \
|
||||
} \
|
||||
return level; \
|
||||
return s_level; \
|
||||
} \
|
||||
static_assert(true, "")
|
||||
|
||||
|
|
|
|||
|
|
@ -82,14 +82,14 @@ public:
|
|||
// MEMBERS
|
||||
// Allocation of sequence of MTasks to threads. Can be considered a map from thread ID to
|
||||
// the sequence of MTasks to be executed by that thread.
|
||||
std::vector<std::vector<const ExecMTask*>> threads;
|
||||
std::vector<std::vector<const ExecMTask*>> m_threads;
|
||||
|
||||
// Global state for each mtask.
|
||||
static std::unordered_map<const ExecMTask*, MTaskState> mtaskState;
|
||||
static std::unordered_map<const ExecMTask*, MTaskState> s_mtaskState;
|
||||
|
||||
explicit ThreadSchedule(uint32_t nThreads)
|
||||
: m_id{s_nextId++}
|
||||
, threads{nThreads} {}
|
||||
, m_threads{nThreads} {}
|
||||
ThreadSchedule(ThreadSchedule&&) = default;
|
||||
ThreadSchedule& operator=(ThreadSchedule&&) = default;
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ private:
|
|||
*logp << "\n // MTasks\n";
|
||||
|
||||
uint32_t maxCost = 0;
|
||||
for (const auto& state : ThreadSchedule::mtaskState) {
|
||||
for (const auto& state : ThreadSchedule::s_mtaskState) {
|
||||
const ExecMTask* const mtaskp = state.first;
|
||||
maxCost = std::max(maxCost, mtaskp->cost());
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ private:
|
|||
// Emit MTask dependency edges
|
||||
*logp << "\n // MTask dependencies\n";
|
||||
|
||||
for (const std::vector<const ExecMTask*>& thread : schedule.threads) {
|
||||
for (const std::vector<const ExecMTask*>& thread : schedule.m_threads) {
|
||||
if (thread.empty()) break; // No more threads
|
||||
|
||||
// Show that schedule ends when all tasks are finished
|
||||
|
|
@ -245,7 +245,7 @@ private:
|
|||
const double width
|
||||
= std::max(s_threadBoxWidth,
|
||||
s_threadBoxWidth * static_cast<double>(mtaskp->cost()) / segmentCost);
|
||||
const uint32_t mtaskThreadId = threadId(mtaskp) + i * schedule.threads.size();
|
||||
const uint32_t mtaskThreadId = threadId(mtaskp) + i * schedule.m_threads.size();
|
||||
const double xPos = width / 2 + offsets[mtaskThreadId];
|
||||
offsets[mtaskThreadId] += width + s_horizontalGap;
|
||||
const double yPos = -s_threadBoxHeight * static_cast<double>(mtaskThreadId);
|
||||
|
|
@ -268,14 +268,14 @@ private:
|
|||
|
||||
public:
|
||||
static uint32_t threadId(const ExecMTask* mtaskp) {
|
||||
const auto& it = mtaskState.find(mtaskp);
|
||||
return it != mtaskState.end() ? it->second.threadId : UNASSIGNED;
|
||||
const auto& it = s_mtaskState.find(mtaskp);
|
||||
return it != s_mtaskState.end() ? it->second.threadId : UNASSIGNED;
|
||||
}
|
||||
static uint32_t startTime(const ExecMTask* mtaskp) {
|
||||
return mtaskState.at(mtaskp).completionTime - mtaskp->cost();
|
||||
return s_mtaskState.at(mtaskp).completionTime - mtaskp->cost();
|
||||
}
|
||||
static uint32_t endTime(const ExecMTask* mtaskp) {
|
||||
return mtaskState.at(mtaskp).completionTime;
|
||||
return s_mtaskState.at(mtaskp).completionTime;
|
||||
}
|
||||
|
||||
// Returns the number of cross-thread dependencies of the given MTask. If > 0, the MTask must
|
||||
|
|
@ -295,12 +295,12 @@ public:
|
|||
mtasks.emplace(mtaskp);
|
||||
const uint32_t bestEndTime = mtaskp->predictStart() + mtaskp->cost();
|
||||
m_endTime = std::max(m_endTime, bestEndTime);
|
||||
mtaskState[mtaskp].completionTime = bestEndTime;
|
||||
mtaskState[mtaskp].threadId = bestThreadId;
|
||||
s_mtaskState[mtaskp].completionTime = bestEndTime;
|
||||
s_mtaskState[mtaskp].threadId = bestThreadId;
|
||||
|
||||
// Reference to thread in schedule we are assigning this MTask to.
|
||||
std::vector<const ExecMTask*>& bestThread = threads[bestThreadId];
|
||||
if (!bestThread.empty()) mtaskState[bestThread.back()].nextp = mtaskp;
|
||||
std::vector<const ExecMTask*>& bestThread = m_threads[bestThreadId];
|
||||
if (!bestThread.empty()) s_mtaskState[bestThread.back()].nextp = mtaskp;
|
||||
|
||||
// Add the MTask to the schedule
|
||||
bestThread.push_back(mtaskp);
|
||||
|
|
@ -311,7 +311,7 @@ public:
|
|||
};
|
||||
|
||||
uint32_t ThreadSchedule::s_nextId = 0;
|
||||
std::unordered_map<const ExecMTask*, ThreadSchedule::MTaskState> ThreadSchedule::mtaskState{};
|
||||
std::unordered_map<const ExecMTask*, ThreadSchedule::MTaskState> ThreadSchedule::s_mtaskState{};
|
||||
constexpr double V3ExecGraph::ThreadSchedule::s_threadBoxWidth;
|
||||
|
||||
//######################################################################
|
||||
|
|
@ -362,7 +362,7 @@ class PackThreads final {
|
|||
uint32_t threadId) {
|
||||
// Ignore tasks that were scheduled on a different schedule
|
||||
if (!schedule.contains(mtaskp)) return 0;
|
||||
const ThreadSchedule::MTaskState& state = schedule.mtaskState.at(mtaskp);
|
||||
const ThreadSchedule::MTaskState& state = schedule.s_mtaskState.at(mtaskp);
|
||||
UASSERT(state.threadId != ThreadSchedule::UNASSIGNED, "Mtask should have assigned thread");
|
||||
if (threadId == state.threadId) {
|
||||
// No overhead on same thread
|
||||
|
|
@ -445,7 +445,7 @@ class PackThreads final {
|
|||
uint32_t bestThreadId = 0;
|
||||
ExecMTask* bestMtaskp = nullptr; // Todo: const ExecMTask*
|
||||
ThreadSchedule& schedule = result.back();
|
||||
for (uint32_t threadId = 0; threadId < schedule.threads.size(); ++threadId) {
|
||||
for (uint32_t threadId = 0; threadId < schedule.m_threads.size(); ++threadId) {
|
||||
for (ExecMTask* const mtaskp : readyMTasks) {
|
||||
if (mode != SchedulingMode::WIDE_TASK_SCHEDULING && mtaskp->threads() > 1) {
|
||||
mode = SchedulingMode::WIDE_TASK_DISCOVERED;
|
||||
|
|
@ -486,7 +486,7 @@ class PackThreads final {
|
|||
const uint32_t size = m_nHierThreads / maxThreadWorkers;
|
||||
UASSERT(size, "Thread pool size should be bigger than 0");
|
||||
// If no tasks were added to the normal thread schedule, clear it.
|
||||
if (schedule.mtaskState.empty()) result.clear();
|
||||
if (schedule.s_mtaskState.empty()) result.clear();
|
||||
result.emplace_back(ThreadSchedule{size});
|
||||
std::fill(busyUntil.begin(), busyUntil.end(), endTime);
|
||||
continue;
|
||||
|
|
@ -494,7 +494,7 @@ class PackThreads final {
|
|||
|
||||
if (!bestMtaskp && mode == SchedulingMode::WIDE_TASK_SCHEDULING) {
|
||||
mode = SchedulingMode::SCHEDULING;
|
||||
UASSERT(!schedule.mtaskState.empty(), "Mtask should be added");
|
||||
UASSERT(!schedule.s_mtaskState.empty(), "Mtask should be added");
|
||||
result.emplace_back(ThreadSchedule{m_nThreads});
|
||||
std::fill(busyUntil.begin(), busyUntil.end(), endTime);
|
||||
continue;
|
||||
|
|
@ -596,24 +596,24 @@ public:
|
|||
|
||||
const std::vector<ThreadSchedule> scheduled = packer.pack(graph);
|
||||
UASSERT_SELFTEST(size_t, scheduled.size(), 3);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].threads.size(), threads);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].threads[0].size(), 2);
|
||||
for (size_t i = 1; i < scheduled[0].threads.size(); ++i)
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].threads[i].size(), 0);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].m_threads.size(), threads);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].m_threads[0].size(), 2);
|
||||
for (size_t i = 1; i < scheduled[0].m_threads.size(); ++i)
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].m_threads[i].size(), 0);
|
||||
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[0].threads[0][0], t0);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[0].threads[0][1], t1);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[0].m_threads[0][0], t0);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[0].m_threads[0][1], t1);
|
||||
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].threads.size(), hierThreads / 3);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].threads[0][0], t2);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].threads[0][1], t3);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].threads[1][0], t4);
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].m_threads.size(), hierThreads / 3);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[0][0], t2);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[0][1], t3);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[1][0], t4);
|
||||
|
||||
UASSERT_SELFTEST(size_t, scheduled[2].threads.size(), threads);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[2].threads[0][0], t5);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[2].threads[1][0], t6);
|
||||
UASSERT_SELFTEST(size_t, scheduled[2].m_threads.size(), threads);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[2].m_threads[0][0], t5);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[2].m_threads[1][0], t6);
|
||||
|
||||
UASSERT_SELFTEST(size_t, ThreadSchedule::mtaskState.size(), 7);
|
||||
UASSERT_SELFTEST(size_t, ThreadSchedule::s_mtaskState.size(), 7);
|
||||
|
||||
UASSERT_SELFTEST(uint32_t, ThreadSchedule::threadId(t0), 0);
|
||||
UASSERT_SELFTEST(uint32_t, ThreadSchedule::threadId(t1), 0);
|
||||
|
|
@ -667,7 +667,7 @@ public:
|
|||
UASSERT_SELFTEST(uint32_t, packer.completionTime(scheduled[1], t4, 5), 1360);
|
||||
|
||||
for (AstNode* const nodep : mTaskBodyps) nodep->deleteTree();
|
||||
ThreadSchedule::mtaskState.clear();
|
||||
ThreadSchedule::s_mtaskState.clear();
|
||||
}
|
||||
static void selfTestHierFirst() {
|
||||
V3Graph graph;
|
||||
|
|
@ -702,20 +702,20 @@ public:
|
|||
|
||||
const std::vector<ThreadSchedule> scheduled = packer.pack(graph);
|
||||
UASSERT_SELFTEST(size_t, scheduled.size(), 2);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].threads.size(), hierThreads / 2);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].threads[0].size(), 1);
|
||||
for (size_t i = 1; i < scheduled[0].threads.size(); ++i)
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].threads[i].size(), 0);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].m_threads.size(), hierThreads / 2);
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].m_threads[0].size(), 1);
|
||||
for (size_t i = 1; i < scheduled[0].m_threads.size(); ++i)
|
||||
UASSERT_SELFTEST(size_t, scheduled[0].m_threads[i].size(), 0);
|
||||
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[0].threads[0][0], t0);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[0].m_threads[0][0], t0);
|
||||
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].threads.size(), threads);
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].threads[0].size(), 1);
|
||||
for (size_t i = 1; i < scheduled[1].threads.size(); ++i)
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].threads[i].size(), 0);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].threads[0][0], t1);
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].m_threads.size(), threads);
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].m_threads[0].size(), 1);
|
||||
for (size_t i = 1; i < scheduled[1].m_threads.size(); ++i)
|
||||
UASSERT_SELFTEST(size_t, scheduled[1].m_threads[i].size(), 0);
|
||||
UASSERT_SELFTEST(const ExecMTask*, scheduled[1].m_threads[0][0], t1);
|
||||
|
||||
UASSERT_SELFTEST(size_t, ThreadSchedule::mtaskState.size(), 2);
|
||||
UASSERT_SELFTEST(size_t, ThreadSchedule::s_mtaskState.size(), 2);
|
||||
|
||||
UASSERT_SELFTEST(uint32_t, ThreadSchedule::threadId(t0), 0);
|
||||
UASSERT_SELFTEST(uint32_t, ThreadSchedule::threadId(t1), 0);
|
||||
|
|
@ -726,7 +726,7 @@ public:
|
|||
UASSERT_SELFTEST(uint32_t, packer.completionTime(scheduled[1], t1, 1), 1130);
|
||||
|
||||
for (AstNode* const nodep : mTaskBodyps) nodep->deleteTree();
|
||||
ThreadSchedule::mtaskState.clear();
|
||||
ThreadSchedule::s_mtaskState.clear();
|
||||
}
|
||||
|
||||
static std::vector<ThreadSchedule> apply(V3Graph& mtaskGraph) {
|
||||
|
|
@ -919,9 +919,9 @@ void addMTaskToFunction(const ThreadSchedule& schedule, const uint32_t threadId,
|
|||
// This mtask has dependencies executed on another thread, so it may block. Create the task
|
||||
// state variable and wait to be notified.
|
||||
const string name = "__Vm_mtaskstate_" + cvtToStr(mtaskp->id());
|
||||
AstBasicDType* const mtaskStateDtypep
|
||||
AstBasicDType* const s_mtaskStateDtypep
|
||||
= v3Global.rootp()->typeTablep()->findBasicDType(fl, VBasicDTypeKwd::MTASKSTATE);
|
||||
AstVar* const varp = new AstVar{fl, VVarType::MODULETEMP, name, mtaskStateDtypep};
|
||||
AstVar* const varp = new AstVar{fl, VVarType::MODULETEMP, name, s_mtaskStateDtypep};
|
||||
varp->valuep(new AstConst{fl, nDependencies});
|
||||
varp->protect(false); // Do not protect as we have references in text
|
||||
modp->addStmtsp(varp);
|
||||
|
|
@ -966,7 +966,7 @@ const std::vector<AstCFunc*> createThreadFunctions(const ThreadSchedule& schedul
|
|||
std::vector<AstCFunc*> funcps;
|
||||
|
||||
// For each thread, create a function representing its entry point
|
||||
for (const std::vector<const ExecMTask*>& thread : schedule.threads) {
|
||||
for (const std::vector<const ExecMTask*>& thread : schedule.m_threads) {
|
||||
if (thread.empty()) continue;
|
||||
const uint32_t threadId = schedule.threadId(thread.front());
|
||||
const string name{"__Vthread__" + tag + "__s" + cvtToStr(schedule.id()) + "__t"
|
||||
|
|
@ -995,11 +995,11 @@ const std::vector<AstCFunc*> createThreadFunctions(const ThreadSchedule& schedul
|
|||
}
|
||||
|
||||
// Create the fake "final" mtask state variable
|
||||
AstBasicDType* const mtaskStateDtypep
|
||||
AstBasicDType* const s_mtaskStateDtypep
|
||||
= v3Global.rootp()->typeTablep()->findBasicDType(fl, VBasicDTypeKwd::MTASKSTATE);
|
||||
AstVar* const varp
|
||||
= new AstVar{fl, VVarType::MODULETEMP,
|
||||
"__Vm_mtaskstate_final__" + cvtToStr(schedule.id()) + tag, mtaskStateDtypep};
|
||||
AstVar* const varp = new AstVar{fl, VVarType::MODULETEMP,
|
||||
"__Vm_mtaskstate_final__" + cvtToStr(schedule.id()) + tag,
|
||||
s_mtaskStateDtypep};
|
||||
varp->valuep(new AstConst(fl, funcps.size()));
|
||||
varp->protect(false); // Do not protect as we have references in text
|
||||
modp->addStmtsp(varp);
|
||||
|
|
|
|||
|
|
@ -92,9 +92,9 @@ class V3FileDependImp final {
|
|||
time_t mstime() const { return m_stat.st_mtime; } // Seconds
|
||||
time_t mnstime() const { return VL_STAT_MTIME_NSEC(m_stat); } // Nanoseconds
|
||||
string hashDigestSymbol() {
|
||||
static VHashSha256 emptyHash;
|
||||
return m_hash.digestSymbol() != emptyHash.digestSymbol() ? m_hash.digestSymbol()
|
||||
: "unhashed";
|
||||
static VHashSha256 s_emptyHash;
|
||||
return m_hash.digestSymbol() != s_emptyHash.digestSymbol() ? m_hash.digestSymbol()
|
||||
: "unhashed";
|
||||
}
|
||||
void loadStats() {
|
||||
if (!m_stat.st_mtime) {
|
||||
|
|
@ -345,9 +345,9 @@ void V3File::createMakeDirFor(const string& filename) {
|
|||
}
|
||||
}
|
||||
void V3File::createMakeDir() {
|
||||
static bool created = false;
|
||||
if (!created) {
|
||||
created = true;
|
||||
static bool s_created = false;
|
||||
if (!s_created) {
|
||||
s_created = true;
|
||||
V3Os::createDir(v3Global.opt.makeDir());
|
||||
if (v3Global.opt.hierTop()) V3Os::createDir(v3Global.opt.hierTopDataDir());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,12 +322,12 @@ FileLine* FileLine::copyOrSameFileLine() {
|
|||
// Return this, or a copy of this
|
||||
// There are often more than one token per line, thus we use the
|
||||
// same pointer as long as we're on the same line, file & warn state.
|
||||
static FileLine* lastNewp = nullptr;
|
||||
if (lastNewp && *lastNewp == *this) { // Compares lineno, filename, etc
|
||||
return lastNewp;
|
||||
static FileLine* s_lastNewp = nullptr;
|
||||
if (s_lastNewp && *s_lastNewp == *this) { // Compares lineno, filename, etc
|
||||
return s_lastNewp;
|
||||
}
|
||||
FileLine* const newp = new FileLine{this};
|
||||
lastNewp = newp;
|
||||
s_lastNewp = newp;
|
||||
return newp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,9 +197,9 @@ public:
|
|||
if (s_errorThisp) s_errorThisp->preErrorDump();
|
||||
}
|
||||
void preErrorDump() {
|
||||
static bool diddump = false;
|
||||
if (!diddump && dumpTreeLevel()) {
|
||||
diddump = true;
|
||||
static bool s_diddump = false;
|
||||
if (!s_diddump && dumpTreeLevel()) {
|
||||
s_diddump = true;
|
||||
dumpSelf("linkdot-preerr", true);
|
||||
v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("linkdot-preerr.tree"));
|
||||
}
|
||||
|
|
@ -1546,8 +1546,8 @@ class LinkDotFindVisitor final : public VNVisitor {
|
|||
if (ansiBad || nansiBad) {
|
||||
bool ansiWarn = ansiBad && !nansiBad;
|
||||
if (ansiWarn) {
|
||||
static int didAnsiWarn = false;
|
||||
if (didAnsiWarn++) ansiWarn = false;
|
||||
static int s_didAnsiWarn = false;
|
||||
if (s_didAnsiWarn++) ansiWarn = false;
|
||||
}
|
||||
nodep->v3error("Duplicate declaration of signal: "
|
||||
<< nodep->prettyNameQ() << '\n'
|
||||
|
|
|
|||
|
|
@ -634,15 +634,15 @@ string V3Options::filePath(FileLine* fl, const string& modname, const string& la
|
|||
}
|
||||
|
||||
string V3Options::filePathLookedMsg(FileLine* fl, const string& modname) {
|
||||
static bool shown_notfound_msg = false;
|
||||
static bool s_shown_notfound_msg = false;
|
||||
std::ostringstream ss;
|
||||
if (modname.find("__Vhsh") != string::npos) {
|
||||
ss << V3Error::warnMore() << "... Note: Name is longer than 127 characters; automatic"
|
||||
<< " file lookup may have failed due to OS filename length limits.\n";
|
||||
ss << V3Error::warnMore() << "... Suggest putting filename with this module/package"
|
||||
<< " onto command line instead.\n";
|
||||
} else if (!shown_notfound_msg) {
|
||||
shown_notfound_msg = true;
|
||||
} else if (!s_shown_notfound_msg) {
|
||||
s_shown_notfound_msg = true;
|
||||
if (m_impp->m_incDirUsers.empty()) {
|
||||
ss << V3Error::warnMore()
|
||||
<< "... This may be because there's no search path specified with -I<dir>.\n";
|
||||
|
|
@ -1044,8 +1044,8 @@ string V3Options::version() VL_PURE {
|
|||
}
|
||||
|
||||
string V3Options::protectKeyDefaulted() VL_MT_SAFE {
|
||||
static V3Mutex mutex;
|
||||
const V3LockGuard lock{mutex};
|
||||
static V3Mutex s_mutex;
|
||||
const V3LockGuard lock{s_mutex};
|
||||
if (m_protectKey.empty()) {
|
||||
// Create a key with a human-readable symbol-like name.
|
||||
// This conversion drops ~2 bits of entropy out of 256, shouldn't matter.
|
||||
|
|
@ -2235,13 +2235,13 @@ unsigned V3Options::dumpSrcLevel(const string& srcfile_path) const VL_MT_SAFE {
|
|||
}
|
||||
|
||||
bool V3Options::dumpTreeAddrids() const VL_MT_SAFE {
|
||||
static int level = -1;
|
||||
if (VL_UNLIKELY(level < 0)) {
|
||||
static int s_level = -1;
|
||||
if (VL_UNLIKELY(s_level < 0)) {
|
||||
const unsigned value = dumpLevel("tree-addrids");
|
||||
if (!available()) return value > 0;
|
||||
level = static_cast<unsigned>(value);
|
||||
s_level = static_cast<unsigned>(value);
|
||||
}
|
||||
return level > 0;
|
||||
return s_level > 0;
|
||||
}
|
||||
|
||||
void V3Options::optimize(int level) {
|
||||
|
|
|
|||
|
|
@ -209,9 +209,9 @@ class MergeCandidate VL_NOT_FINAL : public MergeCandidateScoreboard::Node {
|
|||
|
||||
// CONSTRUCTORS
|
||||
explicit MergeCandidate(bool isSiblingMC) {
|
||||
static uint64_t serial = 0;
|
||||
serial += ID_INCREMENT; // +ID_INCREMENT so doesn't set the special bottom bits
|
||||
m_key.m_id = serial | (isSiblingMC * IS_SIBLING_MASK);
|
||||
static uint64_t s_serial = 0;
|
||||
s_serial += ID_INCREMENT; // +ID_INCREMENT so doesn't set the special bottom bits
|
||||
m_key.m_id = s_serial | (isSiblingMC * IS_SIBLING_MASK);
|
||||
}
|
||||
~MergeCandidate() = default;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ const char* V3ParseImp::tokenName(int token) {
|
|||
if (token >= 255) {
|
||||
return nameTablep[token - 255];
|
||||
} else {
|
||||
static char ch[2];
|
||||
ch[0] = token;
|
||||
ch[1] = '\0';
|
||||
return ch;
|
||||
static char s_ch[2];
|
||||
s_ch[0] = token;
|
||||
s_ch[1] = '\0';
|
||||
return s_ch;
|
||||
}
|
||||
#else
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -357,16 +357,16 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i
|
|||
void V3ParseImp::dumpInputsFile() {
|
||||
// Create output file with joined preprocessor output we buffered up,
|
||||
// Useful for debug to feed back into Verilator
|
||||
static bool append = false;
|
||||
static bool s_append = false;
|
||||
const string vppfilename
|
||||
= v3Global.opt.hierTopDataDir() + "/" + v3Global.opt.prefix() + "__inputs.vpp";
|
||||
std::ofstream* ofp = V3File::new_ofstream(vppfilename, append);
|
||||
std::ofstream* ofp = V3File::new_ofstream(vppfilename, s_append);
|
||||
if (ofp->fail()) {
|
||||
v3error("Can't write file: " + vppfilename);
|
||||
return;
|
||||
}
|
||||
if (!append) {
|
||||
append = true;
|
||||
if (!s_append) {
|
||||
s_append = true;
|
||||
UINFO(1, "Writing all preprocessed output to " << vppfilename);
|
||||
*ofp << "// Dump of all post-preprocessor input\n";
|
||||
*ofp << "// Blank lines and `line directives have been removed\n";
|
||||
|
|
|
|||
|
|
@ -240,14 +240,14 @@ bom [\357\273\277]
|
|||
BEGIN(INITIAL);
|
||||
return VP_TEXT; }
|
||||
<INITIAL,STRIFY>"`__FILE__" { FL_FWDC;
|
||||
static string rtnfile;
|
||||
rtnfile = '"'; rtnfile += LEXP->curFilelinep()->filenameEsc();
|
||||
rtnfile += '"'; yytext = (char*)rtnfile.c_str(); yyleng = rtnfile.length();
|
||||
static string s_rtnfile;
|
||||
s_rtnfile = '"'; s_rtnfile += LEXP->curFilelinep()->filenameEsc();
|
||||
s_rtnfile += '"'; yytext = (char*)s_rtnfile.c_str(); yyleng = s_rtnfile.length();
|
||||
return VP_STRING; }
|
||||
<INITIAL,STRIFY>"`__LINE__" { FL_FWDC;
|
||||
static char buf[25];
|
||||
VL_SNPRINTF(buf, 25, "%d", LEXP->curFilelinep()->lastLineno());
|
||||
yytext = buf; yyleng = std::strlen(yytext);
|
||||
static char s_buf[25];
|
||||
VL_SNPRINTF(s_buf, 25, "%d", LEXP->curFilelinep()->lastLineno());
|
||||
yytext = s_buf; yyleng = std::strlen(yytext);
|
||||
return VP_TEXT; }
|
||||
|
||||
/* Pass-through strings */
|
||||
|
|
|
|||
|
|
@ -961,13 +961,13 @@ int V3PreProcImp::getRawToken() {
|
|||
}
|
||||
if (m_lineCmt != "") {
|
||||
// We have some `line directive or other processed data to return to the user.
|
||||
static string rtncmt; // Keep the c string till next call
|
||||
rtncmt = m_lineCmt;
|
||||
static string s_rtncmt; // Keep the c string till next call
|
||||
s_rtncmt = m_lineCmt;
|
||||
if (m_lineCmtNl) {
|
||||
if (!m_rawAtBol) rtncmt.insert(0, "\n");
|
||||
if (!m_rawAtBol) s_rtncmt.insert(0, "\n");
|
||||
m_lineCmtNl = false;
|
||||
}
|
||||
yyourtext(rtncmt.c_str(), rtncmt.length());
|
||||
yyourtext(s_rtncmt.c_str(), s_rtncmt.length());
|
||||
m_lineCmt = "";
|
||||
if (yyourleng()) m_rawAtBol = (yyourtext()[yyourleng() - 1] == '\n');
|
||||
if (state() == ps_DEFVALUE) {
|
||||
|
|
@ -1298,8 +1298,8 @@ int V3PreProcImp::getStateToken() {
|
|||
}
|
||||
}
|
||||
case ps_DEFVALUE: {
|
||||
static string newlines;
|
||||
newlines = "\n"; // Always start with trailing return
|
||||
static string s_newlines;
|
||||
s_newlines = "\n"; // Always start with trailing return
|
||||
if (tok == VP_DEFVALUE) {
|
||||
if (debug() >= 5) { // LCOV_EXCL_START
|
||||
cout << "DefValue='" << V3PreLex::cleanDbgStrg(m_lexp->m_defValue)
|
||||
|
|
@ -1315,10 +1315,10 @@ int V3PreProcImp::getStateToken() {
|
|||
// This is very difficult in the presence of `", so we
|
||||
// keep the \ before the newline.
|
||||
for (size_t i = 0; i < formals.length(); i++) {
|
||||
if (formals[i] == '\n') newlines += "\n";
|
||||
if (formals[i] == '\n') s_newlines += "\n";
|
||||
}
|
||||
for (size_t i = 0; i < value.length(); i++) {
|
||||
if (value[i] == '\n') newlines += "\n";
|
||||
if (value[i] == '\n') s_newlines += "\n";
|
||||
}
|
||||
if (!m_off) {
|
||||
// Remove leading and trailing whitespace
|
||||
|
|
@ -1334,7 +1334,7 @@ int V3PreProcImp::getStateToken() {
|
|||
statePop();
|
||||
// DEFVALUE is terminated by a return, but lex can't return both tokens.
|
||||
// Thus, we emit a return here.
|
||||
yyourtext(newlines.c_str(), newlines.length());
|
||||
yyourtext(s_newlines.c_str(), s_newlines.length());
|
||||
return (VP_WHITE);
|
||||
}
|
||||
case ps_DEFPAREN: {
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@ AstNodeStmt* profExecSectionPop(FileLine* flp) {
|
|||
}
|
||||
|
||||
static AstCFunc* splitCheckCreateNewSubFunc(AstCFunc* ofuncp) {
|
||||
static std::map<AstCFunc*, uint32_t> funcNums; // What split number to attach to a function
|
||||
const uint32_t funcNum = funcNums[ofuncp]++;
|
||||
static std::map<AstCFunc*, uint32_t> s_funcNums; // What split number to attach to a function
|
||||
const uint32_t funcNum = s_funcNums[ofuncp]++;
|
||||
const std::string name = ofuncp->name() + "__" + cvtToStr(funcNum);
|
||||
AstCFunc* const subFuncp = new AstCFunc{ofuncp->fileline(), name, ofuncp->scopep()};
|
||||
subFuncp->dontCombine(true);
|
||||
|
|
|
|||
|
|
@ -203,15 +203,15 @@ void V3Stats::addStat(const V3Statistic& stat) { StatsReport::addStat(stat); }
|
|||
double V3Stats::getStatSum(const string& name) { return StatsReport::getStatSum(name); }
|
||||
|
||||
void V3Stats::statsStage(const string& name) {
|
||||
static double lastWallTime = -1;
|
||||
static int fileNumber = 0;
|
||||
static double s_lastWallTime = -1;
|
||||
static int s_fileNumber = 0;
|
||||
|
||||
const string digitName = V3Global::digitsFilename(++fileNumber) + "_" + name;
|
||||
const string digitName = V3Global::digitsFilename(++s_fileNumber) + "_" + name;
|
||||
|
||||
const double wallTime = V3Os::timeUsecs() / 1.0e6;
|
||||
if (lastWallTime < 0) lastWallTime = wallTime;
|
||||
const double wallTimeDelta = wallTime - lastWallTime;
|
||||
lastWallTime = wallTime;
|
||||
if (s_lastWallTime < 0) s_lastWallTime = wallTime;
|
||||
const double wallTimeDelta = wallTime - s_lastWallTime;
|
||||
s_lastWallTime = wallTime;
|
||||
V3Stats::addStatPerf("Stage, Elapsed time (sec), " + digitName, wallTimeDelta);
|
||||
V3Stats::addStatPerf("Stage, Elapsed time (sec), TOTAL", wallTimeDelta);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ VL_DEFINE_DEBUG_FUNCTIONS;
|
|||
// Support classes
|
||||
|
||||
namespace V3TSP {
|
||||
static uint32_t edgeIdNext = 0;
|
||||
static uint32_t s_edgeIdNext = 0;
|
||||
|
||||
static void selfTestStates();
|
||||
static void selfTestString();
|
||||
|
|
@ -105,7 +105,7 @@ public:
|
|||
// The only time we may create duplicate edges is when
|
||||
// combining the MST with the perfect-matched pairs,
|
||||
// and in that case, we want to permit duplicate edges.
|
||||
const uint32_t edgeId = ++V3TSP::edgeIdNext;
|
||||
const uint32_t edgeId = ++V3TSP::s_edgeIdNext;
|
||||
|
||||
// We want to be able to compare edges quickly for a total
|
||||
// ordering, so pre-compute a sorting key and store it in
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class UnknownVisitor final : public VNVisitor {
|
|||
// AstNode::user2p() -> AstIf* Inserted if assignment for conditional
|
||||
const VNUser1InUse m_inuser1;
|
||||
const VNUser2InUse m_inuser2;
|
||||
static const std::string m_xrandPrefix;
|
||||
static const std::string s_xrandPrefix;
|
||||
|
||||
// STATE - across all visitors
|
||||
VDouble0 m_statUnkVars; // Statistic tracking
|
||||
|
|
@ -180,7 +180,7 @@ class UnknownVisitor final : public VNVisitor {
|
|||
VL_RESTORER(m_modp);
|
||||
VL_RESTORER(m_constXCvt);
|
||||
VL_RESTORER(m_allowXUnique);
|
||||
auto xrandNames = std::make_unique<V3UniqueNames>(m_xrandPrefix);
|
||||
auto xrandNames = std::make_unique<V3UniqueNames>(s_xrandPrefix);
|
||||
{
|
||||
m_modp = nodep;
|
||||
m_constXCvt = true;
|
||||
|
|
@ -567,7 +567,7 @@ public:
|
|||
// CONSTRUCTORS
|
||||
explicit UnknownVisitor(AstNetlist* nodep)
|
||||
: m_lvboundNames{"__Vlvbound"}
|
||||
, m_xrandNames{std::make_unique<V3UniqueNames>(m_xrandPrefix)} {
|
||||
, m_xrandNames{std::make_unique<V3UniqueNames>(s_xrandPrefix)} {
|
||||
iterate(nodep);
|
||||
}
|
||||
~UnknownVisitor() override { //
|
||||
|
|
@ -575,7 +575,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
const std::string UnknownVisitor::m_xrandPrefix = "__Vxrand";
|
||||
const std::string UnknownVisitor::s_xrandPrefix = "__Vxrand";
|
||||
|
||||
//######################################################################
|
||||
// Unknown class functions
|
||||
|
|
|
|||
|
|
@ -142,14 +142,14 @@ const VBasicDTypeKwd LOGIC_IMPLICIT = VBasicDTypeKwd::LOGIC_IMPLICIT;
|
|||
}
|
||||
|
||||
static void ERRSVKWD(FileLine* fileline, const string& tokname) {
|
||||
static int toldonce = 0;
|
||||
static int s_toldonce = 0;
|
||||
fileline->v3error(
|
||||
"Unexpected '"s + tokname + "': '" + tokname
|
||||
+ "' is a SystemVerilog keyword misused as an identifier."
|
||||
+ (!toldonce++ ? "\n" + fileline->warnMore()
|
||||
+ "... Suggest modify the Verilog-2001 code to avoid SV keywords,"
|
||||
+ " or use `begin_keywords or --language."
|
||||
: ""));
|
||||
+ (!s_toldonce++ ? "\n" + fileline->warnMore()
|
||||
+ "... Suggest modify the Verilog-2001 code to avoid SV keywords,"
|
||||
+ " or use `begin_keywords or --language."
|
||||
: ""));
|
||||
}
|
||||
|
||||
static void ASSIGNEQEXPR(FileLine* fileline) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue