-
Notifications
You must be signed in to change notification settings - Fork 1
/
tb.cpp
73 lines (60 loc) · 1.76 KB
/
tb.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#define VERILATE_TESTBENCH
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <verilated.h>
#include <sys/stat.h>
#include "Vtimer_thing.h"
#include "Vtimer_thing__Syms.h"
#include <verilated_vcd_c.h>
// must come before higgs_helper
typedef Vtimer_thing top_t;
#include "higgs_helper.hpp"
typedef HiggsHelper<top_t> helper_t;
VerilatedVcdC* tfp = NULL;
// Construct the Verilated model, from Vtop.h generated from Verilating "top.v"
// Or use a const unique_ptr, or the VL_UNIQUE_PTR wrapper
top_t* top = new top_t;
// Current simulation time (64-bit unsigned)
uint64_t main_time = 0;
// Called by $time in Verilog
double sc_time_stamp () {
return main_time; // Note does conversion to real, to match SystemC
}
#include "test_0.cpp"
int main(int argc, char** argv, char** env) {
uint32_t test_select = 0;
if(const char* env_p = std::getenv("TEST_SELECT")) {
unsigned int env_test_select = atoi(env_p);
std::cout << "Environment variable TEST_SELECT was set to: "
<< env_test_select << "\n";
test_select = env_test_select;
}
unsigned int fixed_seed = 0;
setup_random(fixed_seed);
switch(test_select) {
case 0:
test0(argc, argv, env);
break;
// case 1:
// test1(argc, argv, env);
// break;
// case 2:
// test2(argc, argv, env);
// break;
// case 3:
// test3(argc, argv, env);
// break;
// case 4:
// test4(argc, argv, env);
// break;
// case 5:
// test5(argc, argv, env);
// break;
default:
std::cout << "Invalid test selected\n";
exit(1);
break;
}
}