HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
generic_tb.cpp
Go to the documentation of this file.
1 #include "Vcounter.h"
2 #include "testbench.h"
3 #include "verilated.h"
4 #include "verilated_vcd_c.h"
5 
6 #include <ctype.h>
7 #include <fstream>
8 #include <iostream>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string>
12 #include <unistd.h>
13 
15 
16 double sc_time_stamp()
17 {
18  return (double)tb->tb_sc_time_stamp();
19 }
20 
21 int main(int argc, char** argv)
22 {
23  Verilated::commandArgs(argc, argv);
24  tb = new TESTB<Vcounter>();
25 
26  tb->opentrace("trace.vcd");
27 
28  tb->m_core->Reset = 0x1;
29  tb->wait_for_n_clocks(1);
30 
31  tb->m_core->Reset = 0x0;
32  tb->wait_for_n_clocks(1);
33 
34  tb->m_core->Clock_enable_B = 0x1;
35  tb->wait_for_n_clocks(5);
36 
37 
38  tb->m_core->Clock_enable_B = 0x0;
39  tb->wait_for_n_clocks(2);
40 
41 
42  tb->m_core->Reset = 0x1;
43  tb->wait_for_n_clocks(2);
44 
45 
46  tb->m_core->Reset = 0x0;
47  tb->wait_for_n_clocks(1);
48 
49 
50  tb->m_core->Clock_enable_B = 0x1;
51  tb->wait_for_n_clocks(20);
52 
53  printf("simulation done\n");
54 
55  return 0;
56 }
int main(int argc, char **argv)
Definition: generic_tb.cpp:21
TESTB< Vcounter > * tb
Definition: generic_tb.cpp:14
double sc_time_stamp()
Definition: generic_tb.cpp:16