summaryrefslogtreecommitdiff
path: root/tests/projects/embed/verilator/hello_vcd/src/sim_main.cpp
blob: f1ee04dddfd0b691b14c7b81660155e468f3b958 (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
#include "hello.h"
#include "verilated.h"
#include "verilated_vcd_c.h"

double sc_time_stamp() {
    return 0;
}

int main(int argc, char** argv) {
    char const* vcdfile = NULL;
    if (argc == 2) {
        vcdfile = argv[1];
    }
    if (!vcdfile) {
        vcdfile = "hello.vcd";
    }
    VerilatedContext* contextp = new VerilatedContext;
    contextp->commandArgs(argc, argv);
    hello* top = new hello{contextp};
    VerilatedVcdC* tfp = new VerilatedVcdC;
    top->trace(tfp, 99);
    Verilated::traceEverOn(true);
    tfp->open(vcdfile);
    while (!contextp->gotFinish()) { top->eval(); }
    tfp->close();
    delete top;
    delete contextp;
    return 0;
}