Fix $finish twice to no longer exit (#4757).

This commit is contained in:
Wilson Snyder 2023-12-24 11:02:52 -05:00
parent 9882c4c761
commit 1a43afe6f7
3 changed files with 4 additions and 14 deletions

View File

@ -50,6 +50,7 @@ Verilator 5.019 devel
* Fix power operator with wide numbers and constants (#4721) (#4763). [Flavien Solt]
* Fix parameter passing to ports (#4723). [Ryszard Rozak, Antmicro Ltd.]
* Fix block names of nested do..while loops (#4728). [Ryszard Rozak, Antmicro Ltd.]
* Fix $finish twice to no longer exit (#4757). [Tim Hutt]
Verilator 5.018 2023-10-30

View File

@ -107,16 +107,9 @@ thread_local Verilated::ThreadLocal Verilated::t_s;
#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 {
if (false && hier) {}
if (false && hier) {} // Unused argument
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
"- %s:%d: Verilog $finish\n", filename, linenum);
if (Verilated::threadContextp()->gotFinish()) {
VL_PRINTF( // Not VL_PRINTF_MT, already on main thread
"- %s:%d: Second verilog $finish, exiting\n", filename, linenum);
Verilated::runFlushCallbacks();
Verilated::runExitCallbacks();
std::exit(0);
}
Verilated::threadContextp()->gotFinish(true);
}
#endif

View File

@ -26,12 +26,8 @@ module t (/*AUTOARG*/);
end
if (times != 10) $stop;
//
// verilator lint_off INFINITELOOP
forever begin
// verilator lint_on INFINITELOOP
$write("*-* All Finished *-*\n");
$finish;
end
$write("*-* All Finished *-*\n");
$finish;
end
endmodule