Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  IPC::Locker
  Parallel::Forker
  Voneline
General Info
  Papers

sim_test.cpp

Krzysztof Marcinek, 09/21/2015 04:42 PM

Download (864 Bytes)

 
1
#include "Vtest.h"
2

    
3
#include "verilated.h"
4
#include "verilated_vcd_c.h"
5

    
6
#define trace_dump
7

    
8
int main(int argc, char **argv, char **env){
9

    
10
    Verilated::commandArgs(argc, argv);
11
    Vtest* top = new Vtest;
12

    
13
    vluint64_t main_time = 0;
14

    
15
    #ifdef trace_dump
16
        Verilated::traceEverOn(true);
17
        VerilatedVcdC* tfp = new VerilatedVcdC;
18
        top->trace(tfp, 99);
19
        tfp->open("sim_vcd.vcd");
20
    #endif
21

    
22
    top->rst = 0;
23
    top->clk = 0;
24

    
25
    while (main_time < 600){
26

    
27
        if (main_time > 500){
28
            top->rst = 1;
29
        }
30

    
31
        top->clk = !top->clk;
32
        top->eval();
33

    
34
        #ifdef trace_dump
35
            tfp->dump(main_time);
36
        #endif
37

    
38
        main_time++;
39

    
40
    }
41

    
42
        #ifdef trace_dump
43
            tfp->close();
44
        #endif
45

    
46
    delete top;
47

    
48
    //VL_PRINTF("\n main time %d\n\n",main_time);
49

    
50
    exit(0);
51
}