Improve format of runtime errors, especially DIDNOTCONVERGE
This commit is contained in:
parent
da14e7c4bb
commit
c75fb4cdae
|
|
@ -2,4 +2,4 @@
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] a)
|
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] a)
|
||||||
%Error: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.. comment: generated by t_lint_didnotconverge_nodbg_bad
|
.. comment: generated by t_lint_didnotconverge_nodbg_bad
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
%Error: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,36 @@ VerilatedContext* Verilated::s_lastContextp = nullptr;
|
||||||
// Internal note: Globals may multi-construct, see verilated.cpp top.
|
// Internal note: Globals may multi-construct, see verilated.cpp top.
|
||||||
thread_local Verilated::ThreadLocal Verilated::t_s;
|
thread_local Verilated::ThreadLocal Verilated::t_s;
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
// Warning print helper
|
||||||
|
|
||||||
|
void vl_print_warn_error(const char* prefix, const char* filename, int linenum,
|
||||||
|
const char* msg) VL_MT_UNSAFE {
|
||||||
|
// A msg of "ERRORCODE: ..." is a code that changes to a prefix, e.g. "%Error-ERRORCODE: ..."
|
||||||
|
// This avoids changing public API of the vl_stop and related functions.
|
||||||
|
const char* msgNoCp = msg;
|
||||||
|
for (; isupper(*msgNoCp); ++msgNoCp);
|
||||||
|
if (msgNoCp[0] == ':' && msgNoCp[1] == ' ') {
|
||||||
|
const int codeWidth = static_cast<int>(msgNoCp - msg);
|
||||||
|
msgNoCp += 2;
|
||||||
|
if (filename && filename[0]) {
|
||||||
|
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
||||||
|
"%s-%.*s: %s:%d: %s\n", prefix, codeWidth, msg, filename, linenum, msgNoCp);
|
||||||
|
} else {
|
||||||
|
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
||||||
|
"%s-%.*s: %s\n", prefix, codeWidth, msg, msgNoCp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (filename && filename[0]) {
|
||||||
|
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
||||||
|
"%s: %s:%d: %s\n", prefix, filename, linenum, msg);
|
||||||
|
} else {
|
||||||
|
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
||||||
|
"%s: %s\n", prefix, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// User definable functions
|
// User definable functions
|
||||||
// Note a TODO is a future version of the API will pass a structure so that
|
// Note a TODO is a future version of the API will pass a structure so that
|
||||||
|
|
@ -119,8 +149,7 @@ thread_local Verilated::ThreadLocal Verilated::t_s;
|
||||||
|
|
||||||
#ifndef VL_USER_FINISH ///< Define this to override the vl_finish function
|
#ifndef VL_USER_FINISH ///< Define this to override the vl_finish function
|
||||||
void vl_finish(const char* filename, int linenum, const char* hier) VL_MT_UNSAFE {
|
void vl_finish(const char* filename, int linenum, const char* hier) VL_MT_UNSAFE {
|
||||||
// hier is unused in the default implementation.
|
(void)hier; // hier is unused in the default implementation.
|
||||||
(void)hier;
|
|
||||||
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
||||||
"- %s:%d: Verilog $finish\n", filename, linenum);
|
"- %s:%d: Verilog $finish\n", filename, linenum);
|
||||||
Verilated::threadContextp()->gotFinish(true);
|
Verilated::threadContextp()->gotFinish(true);
|
||||||
|
|
@ -136,12 +165,7 @@ void vl_stop(const char* filename, int linenum, const char* hier) VL_MT_UNSAFE {
|
||||||
if (Verilated::threadContextp()->fatalOnError()) {
|
if (Verilated::threadContextp()->fatalOnError()) {
|
||||||
vl_fatal(filename, linenum, hier, msg);
|
vl_fatal(filename, linenum, hier, msg);
|
||||||
} else {
|
} else {
|
||||||
if (filename && filename[0]) {
|
vl_print_warn_error("%Error", filename, linenum, msg);
|
||||||
// Not VL_PRINTF_MT, already on main thread
|
|
||||||
VL_PRINTF("%%Error: %s:%d: %s\n", filename, linenum, msg);
|
|
||||||
} else {
|
|
||||||
VL_PRINTF("%%Error: %s\n", msg);
|
|
||||||
}
|
|
||||||
Verilated::runFlushCallbacks();
|
Verilated::runFlushCallbacks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,16 +173,10 @@ void vl_stop(const char* filename, int linenum, const char* hier) VL_MT_UNSAFE {
|
||||||
|
|
||||||
#ifndef VL_USER_FATAL ///< Define this to override the vl_fatal function
|
#ifndef VL_USER_FATAL ///< Define this to override the vl_fatal function
|
||||||
void vl_fatal(const char* filename, int linenum, const char* hier, const char* msg) VL_MT_UNSAFE {
|
void vl_fatal(const char* filename, int linenum, const char* hier, const char* msg) VL_MT_UNSAFE {
|
||||||
// hier is unused in the default implementation.
|
(void)hier; // hier is unused in the default implementation.
|
||||||
(void)hier;
|
|
||||||
Verilated::threadContextp()->gotError(true);
|
Verilated::threadContextp()->gotError(true);
|
||||||
Verilated::threadContextp()->gotFinish(true);
|
Verilated::threadContextp()->gotFinish(true);
|
||||||
if (filename && filename[0]) {
|
vl_print_warn_error("%Error", filename, linenum, msg);
|
||||||
// Not VL_PRINTF_MT, already on main thread
|
|
||||||
VL_PRINTF("%%Error: %s:%d: %s\n", filename, linenum, msg);
|
|
||||||
} else {
|
|
||||||
VL_PRINTF("%%Error: %s\n", msg);
|
|
||||||
}
|
|
||||||
Verilated::runFlushCallbacks();
|
Verilated::runFlushCallbacks();
|
||||||
|
|
||||||
VL_PRINTF("Aborting...\n"); // Not VL_PRINTF_MT, already on main thread
|
VL_PRINTF("Aborting...\n"); // Not VL_PRINTF_MT, already on main thread
|
||||||
|
|
@ -185,9 +203,8 @@ void vl_stop_maybe(const char* filename, int linenum, const char* hier, bool may
|
||||||
&& Verilated::threadContextp()->errorCount() < Verilated::threadContextp()->errorLimit()) {
|
&& Verilated::threadContextp()->errorCount() < Verilated::threadContextp()->errorLimit()) {
|
||||||
// Do just once when cross error limit
|
// Do just once when cross error limit
|
||||||
if (Verilated::threadContextp()->errorCount() == 1) {
|
if (Verilated::threadContextp()->errorCount() == 1) {
|
||||||
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
|
vl_print_warn_error("-Info", filename, linenum,
|
||||||
"-Info: %s:%d: %s\n", filename, linenum,
|
"Verilog $stop, ignored due to +verilator+error+limit");
|
||||||
"Verilog $stop, ignored due to +verilator+error+limit");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vl_stop(filename, linenum, hier);
|
vl_stop(filename, linenum, hier);
|
||||||
|
|
@ -197,14 +214,8 @@ void vl_stop_maybe(const char* filename, int linenum, const char* hier, bool may
|
||||||
|
|
||||||
#ifndef VL_USER_WARN ///< Define this to override the vl_warn function
|
#ifndef VL_USER_WARN ///< Define this to override the vl_warn function
|
||||||
void vl_warn(const char* filename, int linenum, const char* hier, const char* msg) VL_MT_UNSAFE {
|
void vl_warn(const char* filename, int linenum, const char* hier, const char* msg) VL_MT_UNSAFE {
|
||||||
// hier is unused in the default implementation.
|
(void)hier; // hier is unused in the default implementation.
|
||||||
(void)hier;
|
vl_print_warn_error("%Warning", filename, linenum, msg);
|
||||||
if (filename && filename[0]) {
|
|
||||||
// Not VL_PRINTF_MT, already on main thread
|
|
||||||
VL_PRINTF("%%Warning: %s:%d: %s\n", filename, linenum, msg);
|
|
||||||
} else {
|
|
||||||
VL_PRINTF("%%Warning: %s\n", msg);
|
|
||||||
}
|
|
||||||
Verilated::runFlushCallbacks();
|
Verilated::runFlushCallbacks();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,8 @@ AstNodeStmt* checkIterationLimit(AstNetlist* netlistp, const string& name, AstVa
|
||||||
const std::string& file = VIdProtect::protect(locp->filename());
|
const std::string& file = VIdProtect::protect(locp->filename());
|
||||||
const std::string& line = std::to_string(locp->lineno());
|
const std::string& line = std::to_string(locp->lineno());
|
||||||
stmtp->add("VL_FATAL_MT(\"" + V3OutFormatter::quoteNameControls(file) + "\", " + line
|
stmtp->add("VL_FATAL_MT(\"" + V3OutFormatter::quoteNameControls(file) + "\", " + line
|
||||||
+ ", \"\", \"" + name + " region did not converge after " + std::to_string(limit)
|
+ ", \"\", \"DIDNOTCONVERGE: " + name + " region did not converge after "
|
||||||
+ " tries\");");
|
+ std::to_string(limit) + " tries\");");
|
||||||
return ifp;
|
return ifp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2707,7 +2707,7 @@
|
||||||
]},
|
]},
|
||||||
{"type":"CSTMT","name":"","addr":"(ONB)","loc":"a,0:0,0:0",
|
{"type":"CSTMT","name":"","addr":"(ONB)","loc":"a,0:0,0:0",
|
||||||
"nodesp": [
|
"nodesp": [
|
||||||
{"type":"TEXT","name":"","addr":"(PNB)","loc":"a,0:0,0:0","text":"VL_FATAL_MT(\"t/t_enum_type_methods.v\", 11, \"\", \"NBA region did not converge after 100 tries\");"}
|
{"type":"TEXT","name":"","addr":"(PNB)","loc":"a,0:0,0:0","text":"VL_FATAL_MT(\"t/t_enum_type_methods.v\", 11, \"\", \"DIDNOTCONVERGE: NBA region did not converge after 100 tries\");"}
|
||||||
]}
|
]}
|
||||||
],"elsesp": []},
|
],"elsesp": []},
|
||||||
{"type":"ASSIGN","name":"","addr":"(QNB)","loc":"d,11:8,11:9","dtypep":"(R)",
|
{"type":"ASSIGN","name":"","addr":"(QNB)","loc":"d,11:8,11:9","dtypep":"(R)",
|
||||||
|
|
@ -2761,7 +2761,7 @@
|
||||||
]},
|
]},
|
||||||
{"type":"CSTMT","name":"","addr":"(LOB)","loc":"a,0:0,0:0",
|
{"type":"CSTMT","name":"","addr":"(LOB)","loc":"a,0:0,0:0",
|
||||||
"nodesp": [
|
"nodesp": [
|
||||||
{"type":"TEXT","name":"","addr":"(MOB)","loc":"a,0:0,0:0","text":"VL_FATAL_MT(\"t/t_enum_type_methods.v\", 11, \"\", \"Active region did not converge after 100 tries\");"}
|
{"type":"TEXT","name":"","addr":"(MOB)","loc":"a,0:0,0:0","text":"VL_FATAL_MT(\"t/t_enum_type_methods.v\", 11, \"\", \"DIDNOTCONVERGE: Active region did not converge after 100 tries\");"}
|
||||||
]}
|
]}
|
||||||
],"elsesp": []},
|
],"elsesp": []},
|
||||||
{"type":"ASSIGN","name":"","addr":"(NOB)","loc":"d,11:8,11:9","dtypep":"(R)",
|
{"type":"ASSIGN","name":"","addr":"(NOB)","loc":"d,11:8,11:9","dtypep":"(R)",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] a)
|
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] a)
|
||||||
%Error: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
||||||
Aborting...
|
Aborting...
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
%Error: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_lint_didnotconverge_bad.v:7: Settle region did not converge after 100 tries
|
||||||
Aborting...
|
Aborting...
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] x)
|
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] x)
|
||||||
%Error: t/t_unopt_converge_initial.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_unopt_converge_initial.v:7: Settle region did not converge after 100 tries
|
||||||
Aborting...
|
Aborting...
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
%Error: t/t_unopt_converge.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_unopt_converge.v:7: Settle region did not converge after 100 tries
|
||||||
Aborting...
|
Aborting...
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] x)
|
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] x)
|
||||||
%Error: t/t_unopt_converge.v:7: Settle region did not converge after 100 tries
|
%Error-DIDNOTCONVERGE: t/t_unopt_converge.v:7: Settle region did not converge after 100 tries
|
||||||
Aborting...
|
Aborting...
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] x)
|
-V{t#,#} 'stl' region trigger index 0 is active: @([hybrid] x)
|
||||||
%Error: t/t_unopt_converge.v:7: Settle region did not converge after 5 tries
|
%Error-DIDNOTCONVERGE: t/t_unopt_converge.v:7: Settle region did not converge after 5 tries
|
||||||
Aborting...
|
Aborting...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue