-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
61 lines (51 loc) · 1.3 KB
/
main.cc
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
#include <systemc.h>
#include "fir.h"
#include "tb.h"
SC_MODULE( SYSTEM ){
//Module declarations
tb *tb0;
fir *fir0;
//Local signal declarations
sc_signal < sc_int<16> > inp_sig;
sc_signal < bool > inp_sig_vld;
sc_signal < bool > inp_sig_rdy;
sc_signal < sc_int<16> > outp_sig;
sc_signal < bool > outp_sig_vld;
sc_signal < bool > outp_sig_rdy;
sc_signal < bool > rst_sig;
sc_clock clk_sig;
SC_CTOR( SYSTEM )
: clk_sig ("clk_sig", 10, SC_NS) //copy constructor that defines clock signal instance
{
//Module instance signal connections
tb0 = new tb("tb0");
tb0->clk(clk_sig);
tb0->rst(rst_sig);
tb0->inp(inp_sig);
tb0->inp_vld(inp_sig_vld);
tb0->inp_rdy(inp_sig_rdy);
tb0->outp(outp_sig);
tb0->outp_vld(outp_sig_vld);
tb0->outp_rdy(outp_sig_rdy);
fir0 = new fir("fir0");
fir0->clk(clk_sig);
fir0->rst(rst_sig);
fir0->inp(inp_sig);
fir0->outp(outp_sig);
fir0->inp_vld(inp_sig_vld);
fir0->inp_rdy(inp_sig_rdy);
fir0->outp_vld(outp_sig_vld);
fir0->outp_rdy(outp_sig_rdy);
}
~SYSTEM(){
//Destructor
delete tb0;
delete fir0;
}
};
SYSTEM *top = NULL;
int sc_main(int argc, char* argv[]){
top = new SYSTEM("top");
sc_start();
return 0;
}