diff options
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"); +} |