litex icon indicating copy to clipboard operation
litex copied to clipboard

Verilator trace is never written to disk properly

Open techninja1008 opened this issue 3 years ago • 5 comments

I've been trying to get my design to simulate properly with Verilator using SimPlatform. I've discovered, however, that the outputted VCD file is at best malformed (with GTKWave refusing to open it) and often completely empty.

Browsing through the harness code shows that neither of tfp->close() or tfp->flush() are present, meaning that the trace file isn't written even when the simulation finishes naturally. I've found that adding VerilatedVcd::flush_all(); at the end of litex_sim_dump() in sim_init.cpp and manually building and running the simulation results in a working trace file.

techninja1008 avatar Feb 25 '21 17:02 techninja1008

@techninja1008 Could this be, maybe tangentially, related to https://github.com/enjoy-digital/litex/issues/712 ?

nickoe avatar Feb 26 '21 20:02 nickoe

As far as I can tell, that issue does not seem to be related to this one. In this case, dump() is called correctly and successfully however the file is never flushed to disk.

techninja1008 avatar Mar 03 '21 18:03 techninja1008

@techninja1008 Can you reproduce this with litex_sim.py? If so, what commandline args do you use? I think we need an easy way to reproduce your steps to make progress on this.

nickoe avatar Apr 30 '21 22:04 nickoe

I also encountered this issue a few times (seems to be flaky). After applying vcd2fst I could view the malformed VCD files. Next time it occurs I will share the arguments.

troibe avatar Jun 10 '21 23:06 troibe

I have the same issue as the OP. To reproduce, simply run litex_sim.py using upstream LiteX. In my case, the contents of the VCD file just stops abruptly, indicating the non-existence of a flush or something similar.

GuzTech avatar Sep 14 '21 12:09 GuzTech

I have the same issue. I try running litex_simualtion and running the SDRAM test but nothing is happening in the VCD file,I run it in GTKwave but it only has variables and no simulations.

I use (New_Litex_venv) $ verilator --version Verilator 4.028 2020-02-06 rev v4.026-92-g890cecc1 (New_Litex_venv)$ litex_sim --cpu-type=vexriscv --with-sdram --gtkwave-savefile Is there are arguments I am not using or there is a bug in LITEX that produces VCD files with no simulations? is there any solution for this issue?

FATHY174 avatar Mar 08 '23 17:03 FATHY174

I'm facing the same issue, the VCD is void of any updates, only the signal definitions. Is there any fix or known work around?

krabo0om avatar Apr 07 '23 11:04 krabo0om