diff --git a/litex/build/sim/core/veril.cpp b/litex/build/sim/core/veril.cpp index 1e79b6d9d3..cda7bf6896 100644 --- a/litex/build/sim/core/veril.cpp +++ b/litex/build/sim/core/veril.cpp @@ -78,7 +78,11 @@ extern "C" void litex_sim_tracer_dump() extern "C" int litex_sim_got_finish() { + int finished; tfp->flush(); + if(finished = Verilated::gotFinish()) { + tfp->close(); + } return Verilated::gotFinish(); }