Project

General

Profile

[logo] 
 
Home
News
Activity
About/Contact
Major Tools
  Dinotrace
  Verilator
  Verilog-mode
  Verilog-Perl
Other Tools
  BugVise
  CovVise
  Force-Gate-Sim
  Gspice
  IPC::Locker
  Rsvn
  SVN::S4
  Voneline
  WFH
General Info
  Papers

BUG.cpp

Testbench - Julien Margetts, 05/16/2019 03:30 PM

Download (579 Bytes)

 
1
#include <verilated.h>
2
#include "VBUG.h"
3

    
4
VBUG *BUG;
5

    
6
vluint64_t sim_time_ns = 0; // Current simulation time
7

    
8
double sc_time_stamp () 
9
{
10
    return sim_time_ns;
11
}
12

    
13
int main(int argc, const char *argv[])
14
{    
15
    Verilated::commandArgs(argc, argv);
16
    
17
    BUG = new(VBUG);
18
        
19
    BUG->a = 0;
20
    BUG->b = 0;
21

    
22
    while (!Verilated::gotFinish()) 
23
    {
24
        if (sim_time_ns == 5)
25
            BUG->b = 1;
26
            
27
            BUG->clk = 1;
28
            BUG->eval();
29
            BUG->clk = 0;
30
            BUG->eval();
31
            
32
            sim_time_ns += 1;
33
    }
34
    
35
    delete BUG;
36
    
37
    return 0;
38
}
39