mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 00:30:34 +02:00
Add +verilator+error+limit to see more assertion errors.
This commit is contained in:
+34
-5
@@ -71,6 +71,8 @@ VerilatedImp VerilatedImp::s_s;
|
||||
|
||||
//===========================================================================
|
||||
// User definable functions
|
||||
// Note a TODO is a future version of the API will pass a structure so that
|
||||
// the calling arguments allow for extension
|
||||
|
||||
#ifndef VL_USER_FINISH ///< Define this to override this function
|
||||
void vl_finish(const char* filename, int linenum, const char* hier) VL_MT_UNSAFE {
|
||||
@@ -109,6 +111,16 @@ void vl_fatal(const char* filename, int linenum, const char* hier, const char* m
|
||||
}
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
// Error handline
|
||||
|
||||
void vl_stop_maybe(const char* filename, int linenum, const char* hier, bool maybe) VL_MT_UNSAFE {
|
||||
Verilated::errorCountInc();
|
||||
if (!maybe || Verilated::errorCount() >= Verilated::errorLimit()) {
|
||||
vl_stop(filename, linenum, hier);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Wrapper to call certain functions via messages when multithreaded
|
||||
|
||||
@@ -122,13 +134,13 @@ void VL_FINISH_MT(const char* filename, int linenum, const char* hier) VL_MT_SAF
|
||||
#endif
|
||||
}
|
||||
|
||||
void VL_STOP_MT(const char* filename, int linenum, const char* hier) VL_MT_SAFE {
|
||||
void VL_STOP_MT(const char* filename, int linenum, const char* hier, bool maybe) VL_MT_SAFE {
|
||||
#ifdef VL_THREADED
|
||||
VerilatedThreadMsgQueue::post(VerilatedMsg([=](){
|
||||
vl_stop(filename, linenum, hier);
|
||||
vl_stop_maybe(filename, linenum, hier, maybe);
|
||||
}));
|
||||
#else
|
||||
vl_stop(filename, linenum, hier);
|
||||
vl_stop_maybe(filename, linenum, hier, maybe);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -215,13 +227,15 @@ void VL_PRINTF_MT(const char* formatp, ...) VL_MT_SAFE {
|
||||
// Overall class init
|
||||
|
||||
Verilated::Serialized::Serialized() {
|
||||
s_randReset = 0;
|
||||
s_randSeed = 0;
|
||||
s_debug = 0;
|
||||
s_calcUnusedSigs = false;
|
||||
s_gotFinish = false;
|
||||
s_assertOn = true;
|
||||
s_fatalOnVpiError = true; // retains old default behaviour
|
||||
s_errorCount = 0;
|
||||
s_errorLimit = 1;
|
||||
s_randReset = 0;
|
||||
s_randSeed = 0;
|
||||
}
|
||||
|
||||
Verilated::NonSerialized::NonSerialized() {
|
||||
@@ -1802,6 +1816,18 @@ void Verilated::calcUnusedSigs(bool flag) VL_MT_SAFE {
|
||||
VerilatedLockGuard lock(m_mutex);
|
||||
s_s.s_calcUnusedSigs = flag;
|
||||
}
|
||||
void Verilated::errorCount(int val) VL_MT_SAFE {
|
||||
VerilatedLockGuard lock(m_mutex);
|
||||
s_s.s_errorCount = val;
|
||||
}
|
||||
void Verilated::errorCountInc() VL_MT_SAFE {
|
||||
VerilatedLockGuard lock(m_mutex);
|
||||
++s_s.s_errorCount;
|
||||
}
|
||||
void Verilated::errorLimit(int val) VL_MT_SAFE {
|
||||
VerilatedLockGuard lock(m_mutex);
|
||||
s_s.s_errorLimit = val;
|
||||
}
|
||||
void Verilated::gotFinish(bool flag) VL_MT_SAFE {
|
||||
VerilatedLockGuard lock(m_mutex);
|
||||
s_s.s_gotFinish = flag;
|
||||
@@ -1991,6 +2017,9 @@ void VerilatedImp::commandArgVl(const std::string& arg) {
|
||||
else if (commandArgVlValue(arg, "+verilator+debugi+", value/*ref*/)) {
|
||||
Verilated::debug(atoi(value.c_str()));
|
||||
}
|
||||
else if (commandArgVlValue(arg, "+verilator+error+limit+", value/*ref*/)) {
|
||||
Verilated::errorLimit(atoi(value.c_str()));
|
||||
}
|
||||
else if (arg == "+verilator+help") {
|
||||
versionDump();
|
||||
VL_PRINTF_MT("For help, please see 'verilator --help'\n");
|
||||
|
||||
Reference in New Issue
Block a user