diff options
author | Martin Stensgård <mastensg@mastensg.net> | 2025-04-27 19:32:13 +0200 |
---|---|---|
committer | Martin Stensgård <mastensg@mastensg.net> | 2025-04-27 19:32:13 +0200 |
commit | e4df12dbe2ffdec4b43911ef895372f8cf97972c (patch) | |
tree | 6d56e364ea71d7d9856a7d54128959f1d19d551e /verilator_example_tracing/sim_main.cc | |
parent | 56afef8ec52a3d3644fc8230e0d92004d3727c4b (diff) |
verilator_example_tracing: dump value change
Diffstat (limited to 'verilator_example_tracing/sim_main.cc')
-rw-r--r-- | verilator_example_tracing/sim_main.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/verilator_example_tracing/sim_main.cc b/verilator_example_tracing/sim_main.cc new file mode 100644 index 0000000..bcb5fa7 --- /dev/null +++ b/verilator_example_tracing/sim_main.cc @@ -0,0 +1,25 @@ +#include <cstdio> + +#include "Vhello.h" +#include "verilated.h" + +int +main(int argc, char **argv) +{ + VerilatedContext *cp = new VerilatedContext; + cp->traceEverOn(true); + cp->commandArgs(argc, argv); + + Vhello *top = new Vhello{cp}; + top->clk = 0; + + while (!cp->gotFinish()) { + cp->timeInc(1); + + top->clk = !top->clk; + top->eval(); + } + top->final(); + VL_PRINTF("[%" PRId64 "]\n", cp->time()); + fprintf(stderr, "it finished.\n"); +} |