-
Notifications
You must be signed in to change notification settings - Fork 0
/
tb_top.cpp
47 lines (35 loc) · 855 Bytes
/
tb_top.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "verilated.h"
#include "verilated_vcd_c.h"
#include "Vtb_top.h"
#include "Vtb_top__Dpi.h"
#include <ctime>
#if VM_TRACE
#include "verilated_vcd_c.h"
#endif
vluint64_t main_time = 0;
double sc_time_stamp() {
return main_time;
}
int main(int argc, char **argv, char **env){
Vtb_top* top = new Vtb_top;
#if VM_TRACE
Verilated::traceEverOn(true);
VerilatedVcdC* tfp = new VerilatedVcdC;
top->trace(tfp, 99); // Trace 99 levels of hierarchy
tfp->open("dump.vcd");
#endif
// Simulation loop
while (!Verilated::gotFinish()){
top->v_clk = !top->v_clk;
top->eval();
main_time++;
#if VM_TRACE
if (tfp) tfp->dump(main_time);
#endif
}
top->final();
#if VM_TRACE
if (tfp) tfp->close();
#endif
exit(0);
}