-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix timestamps on verilator waveform (#616)
* Add MAX_SIM_TIME parameter to simulation Added parameter MAX_SIM_TIME to `make run-app-verilator`, which sets the maximum simulation run length in clock cycles via the `+max_sim_time=` command line argument. This allows terminating the simulation prematurely in case something goes wrong and the program stalls, and still get a VCD waveform. This parameter has been added through a generic `SIM_ARGS` variable so that further parameters can easily be added in the future. Example: `make run-app-verilator MAX_SIM_TIME=1000000` Additionally, modified tb_top.cpp so that setting a `+max_sim_time=` argument still terminates the simulation on program termination, rather than continuing to run until the time has elapsed (after all, it's a *max* simulation time). If the simulation terminates before the program finishes, it exits with the special return code `2` to distinguish it from an error. * Verilator sim: fix timing; add time suffixes The waveform.vcd file Verilator generates does not dump the correct timestamps, and just increases the simulation timer by 1 (ps) on every clock edge, resulting in a clock period of 2ps (500GHz). Fix that by defining a clock frequency in XHEEP_CmdLineOptions.hh and incrementing by an amount based on that frequency. The resulting waveform file has the correct timing. Also, runCycles(n) was running for n clock edges (i.e. n/2 cycles) rather than n cycles. Fixed. Additionally, add the possibility of adding suffixes to +max_sim_time to specify time rather than clock cycles: s, ms, us, ns, ps. With no suffix, use clock cycles. * Docs: Describe +firmware, +max_sim_time Added "Simulation parameters" section to Simulate.md describing the `+firmware` and `+max_sim_time` plusargs, and also mention the `MAX_SIM_TIME` Makefile variable for Verilator simulation. --------- Co-authored-by: Javier Mora <[email protected]>
- Loading branch information
1 parent
c0567bd
commit d32a0cb
Showing
6 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters