1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id$ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Multi_Banked/include/RegisterFile_Multi_Banked.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace generic { |
---|
14 | namespace registerfile { |
---|
15 | namespace registerfile_multi_banked { |
---|
16 | |
---|
17 | |
---|
18 | void RegisterFile_Multi_Banked::allocation (void) |
---|
19 | { |
---|
20 | string rename; |
---|
21 | |
---|
22 | log_printf(FUNC,RegisterFile_Multi_Banked,"allocation","Begin"); |
---|
23 | |
---|
24 | _component = new Component (); |
---|
25 | |
---|
26 | Entity * entity = _component->set_entity (_name |
---|
27 | ,"RegisterFile_Multi_Banked" |
---|
28 | #ifdef POSITION |
---|
29 | ,Register |
---|
30 | #endif |
---|
31 | ); |
---|
32 | |
---|
33 | _interfaces = entity->set_interfaces(); |
---|
34 | |
---|
35 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
36 | |
---|
37 | Interface * interface = _interfaces->set_interface("" |
---|
38 | #ifdef POSITION |
---|
39 | ,IN |
---|
40 | ,SOUTH, |
---|
41 | "Generalist interface" |
---|
42 | #endif |
---|
43 | ); |
---|
44 | |
---|
45 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
46 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
47 | |
---|
48 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
49 | |
---|
50 | in_READ_VAL = new SC_IN (Tcontrol_t) * [_param->_nb_port_read]; |
---|
51 | out_READ_ACK = new SC_OUT(Tcontrol_t) * [_param->_nb_port_read]; |
---|
52 | if (_param->_have_port_address == true) |
---|
53 | in_READ_ADDRESS = new SC_IN (Taddress_t) * [_param->_nb_port_read]; |
---|
54 | out_READ_DATA = new SC_OUT(Tdata_t ) * [_param->_nb_port_read]; |
---|
55 | |
---|
56 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
57 | { |
---|
58 | Interface_fifo * interface = _interfaces->set_interface("read_"+toString(i) |
---|
59 | #ifdef POSITION |
---|
60 | , IN |
---|
61 | ,WEST |
---|
62 | , "Interface Read" |
---|
63 | #endif |
---|
64 | ); |
---|
65 | |
---|
66 | in_READ_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
67 | out_READ_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
68 | if (_param->_have_port_address == true) |
---|
69 | in_READ_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(log2(_param->_nb_word))); |
---|
70 | out_READ_DATA [i] = interface->set_signal_out <Tdata_t > ("data" , _param->_size_word); |
---|
71 | } |
---|
72 | |
---|
73 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
74 | |
---|
75 | in_WRITE_VAL = new SC_IN (Tcontrol_t) * [_param->_nb_port_write]; |
---|
76 | out_WRITE_ACK = new SC_OUT(Tcontrol_t) * [_param->_nb_port_write]; |
---|
77 | if (_param->_have_port_address == true) |
---|
78 | in_WRITE_ADDRESS = new SC_IN (Taddress_t) * [_param->_nb_port_write]; |
---|
79 | in_WRITE_DATA = new SC_IN (Tdata_t ) * [_param->_nb_port_write]; |
---|
80 | |
---|
81 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
82 | { |
---|
83 | Interface_fifo * interface = _interfaces->set_interface("write_"+toString(i) |
---|
84 | #ifdef POSITION |
---|
85 | , IN |
---|
86 | ,EAST |
---|
87 | , "Interface Write" |
---|
88 | #endif |
---|
89 | ); |
---|
90 | |
---|
91 | in_WRITE_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
92 | out_WRITE_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
93 | if (_param->_have_port_address == true) |
---|
94 | in_WRITE_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(log2(_param->_nb_word))); |
---|
95 | in_WRITE_DATA [i] = interface->set_signal_in <Tdata_t > ("data" , _param->_size_word); |
---|
96 | } |
---|
97 | |
---|
98 | // ~~~~~[ Registers ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
99 | |
---|
100 | reg_DATA = new SC_REGISTER (Tdata_t) ** [_param->_nb_bank]; |
---|
101 | |
---|
102 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
103 | { |
---|
104 | reg_DATA [i] = new SC_REGISTER (Tdata_t) * [_param->_nb_word]; |
---|
105 | |
---|
106 | for (uint32_t j=0; j<_param->_nb_word; j++) |
---|
107 | { |
---|
108 | string rename = "reg_DATA_" + toString(i) + "_" + toString(j); |
---|
109 | reg_DATA [i][j] = new SC_REGISTER (Tdata_t) (rename.c_str()); |
---|
110 | } |
---|
111 | } |
---|
112 | |
---|
113 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
114 | internal_WRITE_VAL = new bool [_param->_nb_port_write]; |
---|
115 | internal_WRITE_BANK = new Taddress_t [_param->_nb_port_write]; |
---|
116 | internal_WRITE_NUM_REG = new Taddress_t [_param->_nb_port_write]; |
---|
117 | |
---|
118 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
119 | |
---|
120 | #ifdef POSITION |
---|
121 | _component->generate_file(); |
---|
122 | #endif |
---|
123 | |
---|
124 | log_printf(FUNC,RegisterFile_Multi_Banked,"allocation","End"); |
---|
125 | }; |
---|
126 | |
---|
127 | }; // end namespace registerfile_multi_banked |
---|
128 | }; // end namespace registerfile |
---|
129 | }; // end namespace generic |
---|
130 | |
---|
131 | }; // end namespace behavioural |
---|
132 | }; // end namespace morpheo |
---|
133 | #endif |
---|