-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.cpp
69 lines (52 loc) · 1.34 KB
/
main.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
/*
* @ASCK
*/
#include <systemc.h>
#include <System.cpp>
using namespace std;
int sc_main(int argc, char* argv[]){
cout << "starting the complete project" << endl;
sc_trace_file *wf = sc_create_vcd_trace_file("project");
sc_signal <bool> clk;
sc_signal <bool> clk_bus;
sc_signal <sc_int<8>> reg_dump[8];
sc_signal <sc_uint<5>> aluop;
sc_signal <sc_uint<14>> pc;
System sys ("System");
sys (clk, clk_bus, pc, aluop);
for (int i=0; i<8; i++){
sys.reg_dump[i](reg_dump[i]);
}
sc_trace (wf, clk, "clk");
sc_trace (wf, clk_bus, "bus_clk");
sc_trace (wf, pc, "pc");
sc_trace (wf, aluop, "aluop");
for (int i=0; i<8; i++){
char str[3];
sprintf(str, "%d", i);
sc_trace (wf, reg_dump[i], "R" + string(str));
}
for (int i=0; i<40 ;i++){
clk_bus = 0;
clk = 1;
sc_start(1,SC_NS);
clk_bus = 1;
sc_start(1,SC_NS);
clk_bus = 0;
sc_start(1,SC_NS);
clk_bus = 1;
sc_start(1,SC_NS);
clk_bus = 0;
clk = 0;
sc_start(1,SC_NS);
clk_bus = 1;
sc_start(1,SC_NS);
clk_bus = 0;
sc_start(1,SC_NS);
clk_bus = 1;
sc_start(1,SC_NS);
}
sc_close_vcd_trace_file(wf);
cout << "vcd file completed" << endl;
return 0;
}