[Libre-soc-bugs] [Bug 1073] Microwatt verilator sim - setting up chroot and documentation

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon May 8 20:55:58 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1073

--- Comment #15 from Andrey Miroshnikov <andrey at technepisteme.xyz> ---
After getting the sim to run last week, I forgot that the vcd trace file was
empty.

Luke helped out on IRC:
https://libre-soc.org/irclog/%23libre-soc.2023-05-07.log.html#t2023-05-07T14:42:12

I discovered the reason: the tick() function has a boolean 'dump' argument
which, if set to true, will dump the trace data for the current clock cycle.
The reason it was dumping the first time 0, is because during reset condition,
tick() dump argument is hard-coded to true:
https://git.libre-soc.org/?p=microwatt.git;a=blob;f=verilator/microwatt-verilator.cpp;h=a226393f6ba74d5e3e1ffdb729d731d2311d53ad;hb=f106b4a3ab6859c2ab54e8377609e643a4eef1e6#l261

The reason there was no further dumping, is because the TRIGGER_ENABLE define
was causing the 'traceme' dump flag to be set to false:
https://git.libre-soc.org/?p=microwatt.git;a=blob;f=verilator/microwatt-verilator.cpp;h=a226393f6ba74d5e3e1ffdb729d731d2311d53ad;hb=f106b4a3ab6859c2ab54e8377609e643a4eef1e6#l131
https://git.libre-soc.org/?p=microwatt.git;a=blob;f=verilator/microwatt-verilator.cpp;h=a226393f6ba74d5e3e1ffdb729d731d2311d53ad;hb=f106b4a3ab6859c2ab54e8377609e643a4eef1e6#l274

Looking at the comment on line #130, I saw that you (Luke) suggested they
should be runtime commandline args.


I temporarily commented out TRIGGER_ENABLE, while also adding a new flag -d to
pass to microwatt-verilator.
https://git.libre-soc.org/?p=microwatt.git;a=commitdiff;h=066a2da5a68d11fb3d40086b2dcc98fd08a5bd92
https://git.libre-soc.org/?p=microwatt.git;a=commitdiff;h=cb54a3d858186076ee6b55a5777a63dd76df323d
https://git.libre-soc.org/?p=microwatt.git;a=commitdiff;h=515738527e751b977a9e6aeb7cc74c967837b94b
https://git.libre-soc.org/?p=microwatt.git;a=commitdiff;h=59ceebf385cfa2de80ed2b56e8f14a08c28c8d4b

Calling the executable like this will allow trace data to be dumped:
./microwatt-verilator hello_world/hello_world.bin -d


After seeing how big the .vcd file got (about 6GB), I realised that enabling
trace dumping by default is a *bad idea*. Thus leaving it behind a flag is
probably better. Oh, and do let me know if '-d' is acceptable, can change it to
something else.

For the purposes of the tutorial I now have all the features working, so won't
proceed with further modification. If you want me to implement some of those
other defines as commandline args (TRIGGER_OCCURANCE, TRIGGER_COUNTDOWN, etc.,
let me know).

Also, I added a -h help flag with a basic help string. It's not much, but at
least don't need to reverse engineer the code everytime to know the args.

You can call it like this:
./microwatt-verilator -h

I'll proceed with merging my wiki page into the original, as well as making a
tutorial tomorrow.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list