mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47:34 +00:00
Fix some MSVC warnings
This commit is contained in:
parent
a84be1844f
commit
ce174743bb
@ -19,14 +19,14 @@ int main(int argc, char** argv) {
|
||||
// e.g. examples/c_tracing.
|
||||
|
||||
// Construct a VerilatedContext to hold simulation time, etc.
|
||||
VerilatedContext* contextp = new VerilatedContext;
|
||||
VerilatedContext* const contextp = new VerilatedContext;
|
||||
|
||||
// Pass arguments so Verilated code can see them, e.g. $value$plusargs
|
||||
// This needs to be called before you create any model
|
||||
contextp->commandArgs(argc, argv);
|
||||
|
||||
// Construct the Verilated model, from Vtop.h generated from Verilating "top.v"
|
||||
Vtop* top = new Vtop{contextp};
|
||||
Vtop* const top = new Vtop{contextp};
|
||||
|
||||
// Simulate until $finish
|
||||
while (!contextp->gotFinish()) {
|
||||
|
@ -25,7 +25,7 @@ int sc_main(int argc, char* argv[]) {
|
||||
// e.g. examples/c_tracing.
|
||||
|
||||
// Construct the Verilated model, from Vtop.h generated from Verilating "top.v"
|
||||
Vtop* top = new Vtop{"top"};
|
||||
Vtop* const top = new Vtop{"top"};
|
||||
|
||||
// Pass arguments so Verilated code can see them, e.g. $value$plusargs
|
||||
// This needs to be called before you create any model
|
||||
|
@ -20,13 +20,13 @@ int main(int argc, char** argv) {
|
||||
if (false && argc && argv) {}
|
||||
|
||||
// Construct context to hold simulation time, etc
|
||||
VerilatedContext* contextp = new VerilatedContext;
|
||||
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
|
||||
contextp->debug(0);
|
||||
contextp->randReset(2);
|
||||
contextp->commandArgs(argc, argv);
|
||||
|
||||
// Construct the Verilated model, including the secret module
|
||||
Vtop* top = new Vtop{contextp};
|
||||
const std::unique_ptr<Vtop> top{new Vtop{contextp.get(), "TOP"}};
|
||||
|
||||
#if VM_TRACE
|
||||
// When tracing, the contents of the secret module will not be seen
|
||||
@ -65,12 +65,6 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Destroy model
|
||||
delete top;
|
||||
top = nullptr;
|
||||
delete contextp;
|
||||
contextp = nullptr;
|
||||
|
||||
// Return good completion status
|
||||
// Don't use exit() or destructor won't get called
|
||||
return 0;
|
||||
|
@ -791,7 +791,7 @@ std::string _vl_vsformat_time(char* tmp, T ld, int timeunit, bool left, size_t w
|
||||
}
|
||||
}
|
||||
|
||||
const int needmore = width - digits;
|
||||
const int needmore = static_cast<int>(width) - digits;
|
||||
std::string padding;
|
||||
if (needmore > 0) padding.append(needmore, ' '); // Pad with spaces
|
||||
return left ? (tmp + padding) : (padding + tmp);
|
||||
@ -947,9 +947,9 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
|
||||
} else {
|
||||
append = VL_DECIMAL_NW(lbits, lwp);
|
||||
}
|
||||
digits = append.length();
|
||||
digits = static_cast<int>(append.length());
|
||||
}
|
||||
const int needmore = width - digits;
|
||||
const int needmore = static_cast<int>(width) - digits;
|
||||
if (needmore > 0) {
|
||||
std::string padding;
|
||||
if (left) {
|
||||
@ -976,9 +976,9 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
|
||||
append = t_tmp;
|
||||
} else {
|
||||
append = VL_DECIMAL_NW(lbits, lwp);
|
||||
digits = append.length();
|
||||
digits = static_cast<int>(append.length());
|
||||
}
|
||||
const int needmore = width - digits;
|
||||
const int needmore = static_cast<int>(width) - digits;
|
||||
if (needmore > 0) {
|
||||
std::string padding;
|
||||
if (left) {
|
||||
@ -1044,7 +1044,7 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
|
||||
}
|
||||
} // switch
|
||||
|
||||
const int needmore = width - digits;
|
||||
const int needmore = static_cast<int>(width) - digits;
|
||||
if (needmore > 0) {
|
||||
std::string padding;
|
||||
if (left) {
|
||||
|
@ -294,7 +294,7 @@ public: // But only for verilated*.cpp
|
||||
std::fill(m_fdps.begin() + start, m_fdps.end(), static_cast<FILE*>(nullptr));
|
||||
m_fdFree.resize(excess);
|
||||
for (std::size_t i = 0, id = start; i < m_fdFree.size(); ++i, ++id) {
|
||||
m_fdFree[i] = id;
|
||||
m_fdFree[i] = static_cast<IData>(id);
|
||||
}
|
||||
}
|
||||
const IData idx = m_fdFree.back();
|
||||
|
@ -214,10 +214,10 @@ public:
|
||||
~VlThreadPool() override;
|
||||
|
||||
// METHODS
|
||||
int numThreads() const { return m_workers.size(); }
|
||||
int numThreads() const { return static_cast<int>(m_workers.size()); }
|
||||
VlWorkerThread* workerp(int index) {
|
||||
assert(index >= 0);
|
||||
assert(static_cast<size_t>(index) < m_workers.size());
|
||||
assert(index < static_cast<int>(m_workers.size()));
|
||||
return m_workers[index];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user