summaryrefslogtreecommitdiff
path: root/verilator_example_tracing/sim_main.cc
blob: bcb5fa7b0e46dac21060a6012e5e42b1f81771ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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");
}