aboutsummaryrefslogtreecommitdiffstats
path: root/testbench.cc
blob: cd835df41a494bd430d6deb7266501a3aedb6711 (plain)
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
26
27
28
29
30
#include "Vpicorv32_wrapper.h"
#include "verilated_vcd_c.h"

int main(int argc, char **argv, char **env)
{
	printf("Built with %s %s.\n", Verilated::productName(), Verilated::productVersion());
	printf("Recommended: Verilator 4.0 or later.\n");

	Verilated::commandArgs(argc, argv);
	Verilated::traceEverOn(true);
	Vpicorv32_wrapper* top = new Vpicorv32_wrapper;

	VerilatedVcdC* tfp = new VerilatedVcdC;
	top->trace (tfp, 99);
        tfp->open ("testbench.vcd");
	top->clk = 0;
	int t = 0;
	while (!Verilated::gotFinish()) {
		if (t > 200)
			top->resetn = 1;
		top->clk = !top->clk;
		top->eval();
		tfp->dump (t);
		t += 5;
	}
	tfp->close();
	delete top;
	exit(0);
}