1 | #ifdef SYSTEMC |
---|
2 | /* |
---|
3 | * $Id: RegisterFile_allocation.cpp 146 2011-02-01 20:57:54Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/RegisterFile/include/RegisterFile.h" |
---|
10 | #include "Behavioural/include/Allocation.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace generic { |
---|
15 | namespace registerfile { |
---|
16 | |
---|
17 | void RegisterFile::allocation |
---|
18 | ( |
---|
19 | #ifdef STATISTICS |
---|
20 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
21 | #else |
---|
22 | void |
---|
23 | #endif |
---|
24 | ) |
---|
25 | { |
---|
26 | std::string rename; |
---|
27 | |
---|
28 | log_printf(FUNC,RegisterFile,"allocation","Begin"); |
---|
29 | |
---|
30 | #ifdef SYSTEMCASS_SPECIFIC |
---|
31 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
32 | { |
---|
33 | __ALLOC0_SIGNAL(in_CLOCK ,"in_CLOCK" ,SC_CLOCK ); |
---|
34 | __ALLOC0_SIGNAL(in_NRESET,"in_NRESET",SC_IN (Tcontrol_t)); |
---|
35 | } |
---|
36 | // ~~~~~[ Interface : "read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
37 | { |
---|
38 | __ALLOC1_INTERFACE_BEGIN("READ",_param->_nb_port_read); |
---|
39 | |
---|
40 | __ALLOC1_SIGNAL_IN ( in_READ_VAL ,"VAL" ,Tcontrol_t); |
---|
41 | __ALLOC1_SIGNAL_OUT(out_READ_ACK ,"ACK" ,Tcontrol_t); |
---|
42 | if (_param->_have_port_address) |
---|
43 | __ALLOC1_SIGNAL_IN ( in_READ_ADDRESS,"ADDRESS",Taddress_t); |
---|
44 | __ALLOC1_SIGNAL_OUT(out_READ_DATA ,"DATA" ,Tdata_t ); |
---|
45 | |
---|
46 | __ALLOC1_INTERFACE_END(_param->_nb_port_read); |
---|
47 | } |
---|
48 | |
---|
49 | // ~~~~~[ Interface : "write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
50 | { |
---|
51 | __ALLOC1_INTERFACE_BEGIN("WRITE",_param->_nb_port_write); |
---|
52 | |
---|
53 | __ALLOC1_SIGNAL_IN ( in_WRITE_VAL ,"VAL" ,Tcontrol_t); |
---|
54 | __ALLOC1_SIGNAL_OUT(out_WRITE_ACK ,"ACK" ,Tcontrol_t); |
---|
55 | if (_param->_have_port_address) |
---|
56 | __ALLOC1_SIGNAL_IN ( in_WRITE_ADDRESS,"ADDRESS",Taddress_t); |
---|
57 | __ALLOC1_SIGNAL_IN ( in_WRITE_DATA ,"DATA" ,Tdata_t ); |
---|
58 | |
---|
59 | __ALLOC1_INTERFACE_END(_param->_nb_port_write); |
---|
60 | } |
---|
61 | #endif |
---|
62 | |
---|
63 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
64 | |
---|
65 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
66 | // =====[ component_RegisterFile_Monolithic ]========================= |
---|
67 | { |
---|
68 | component_RegisterFile_Monolithic = new morpheo::behavioural::generic::registerfile::registerfile_monolithic ::RegisterFile_Monolithic ::RegisterFile_Monolithic |
---|
69 | (_name.c_str() |
---|
70 | #ifdef STATISTICS |
---|
71 | ,param_statistics |
---|
72 | #endif |
---|
73 | ,_param->_param_registerfile_monolithic |
---|
74 | ,_usage); |
---|
75 | } |
---|
76 | else |
---|
77 | { |
---|
78 | if (_param->_instance == instance_RegisterFile_Internal_Banked) |
---|
79 | // =====[ component_RegisterFile_Internal_Banked ]========================= |
---|
80 | { |
---|
81 | component_RegisterFile_Internal_Banked = new morpheo::behavioural::generic::registerfile::registerfile_internal_banked ::RegisterFile_Internal_Banked ::RegisterFile_Internal_Banked |
---|
82 | (_name.c_str() |
---|
83 | #ifdef STATISTICS |
---|
84 | ,param_statistics |
---|
85 | #endif |
---|
86 | ,_param->_param_registerfile_internal_banked |
---|
87 | ,_usage); |
---|
88 | } |
---|
89 | else |
---|
90 | { |
---|
91 | // =====[ component_RegisterFile_Multi_Banked ]======================= |
---|
92 | component_RegisterFile_Multi_Banked = new morpheo::behavioural::generic::registerfile::registerfile_multi_banked::RegisterFile_Multi_Banked::RegisterFile_Multi_Banked |
---|
93 | (_name.c_str() |
---|
94 | #ifdef STATISTICS |
---|
95 | ,param_statistics |
---|
96 | #endif |
---|
97 | ,_param->_param_registerfile_multi_banked |
---|
98 | ,_usage); |
---|
99 | } |
---|
100 | } |
---|
101 | // ~~~~~[ Component - Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
102 | |
---|
103 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
104 | // =====[ Component_RegisterFile_Monolithic - Instanciation ]========= |
---|
105 | { |
---|
106 | #ifdef SYSTEMCASS_SPECIFIC |
---|
107 | (*(component_RegisterFile_Monolithic ->in_CLOCK )) (*(in_CLOCK )); |
---|
108 | (*(component_RegisterFile_Monolithic ->in_NRESET)) (*(in_NRESET)); |
---|
109 | |
---|
110 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
111 | { |
---|
112 | (*(component_RegisterFile_Monolithic -> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
113 | (*(component_RegisterFile_Monolithic ->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
114 | if (_param->_have_port_address == true) |
---|
115 | (*(component_RegisterFile_Monolithic -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
116 | (*(component_RegisterFile_Monolithic ->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
117 | } |
---|
118 | |
---|
119 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
120 | { |
---|
121 | (*(component_RegisterFile_Monolithic -> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
122 | (*(component_RegisterFile_Monolithic ->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
123 | if (_param->_have_port_address == true) |
---|
124 | (*(component_RegisterFile_Monolithic -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
125 | (*(component_RegisterFile_Monolithic -> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
126 | } |
---|
127 | #else |
---|
128 | in_CLOCK = component_RegisterFile_Monolithic-> in_CLOCK ; |
---|
129 | in_NRESET = component_RegisterFile_Monolithic-> in_NRESET ; |
---|
130 | |
---|
131 | in_READ_VAL = component_RegisterFile_Monolithic-> in_READ_VAL ; |
---|
132 | out_READ_ACK = component_RegisterFile_Monolithic->out_READ_ACK ; |
---|
133 | in_READ_ADDRESS = component_RegisterFile_Monolithic-> in_READ_ADDRESS ; |
---|
134 | out_READ_DATA = component_RegisterFile_Monolithic->out_READ_DATA ; |
---|
135 | |
---|
136 | in_WRITE_VAL = component_RegisterFile_Monolithic-> in_WRITE_VAL ; |
---|
137 | out_WRITE_ACK = component_RegisterFile_Monolithic->out_WRITE_ACK ; |
---|
138 | in_WRITE_ADDRESS = component_RegisterFile_Monolithic-> in_WRITE_ADDRESS; |
---|
139 | in_WRITE_DATA = component_RegisterFile_Monolithic-> in_WRITE_DATA ; |
---|
140 | #endif |
---|
141 | } |
---|
142 | else |
---|
143 | { |
---|
144 | if (_param->_instance == instance_RegisterFile_Internal_Banked) |
---|
145 | // =====[ Component_RegisterFile_Internal_Banked - Instanciation ]========= |
---|
146 | { |
---|
147 | #ifdef SYSTEMCASS_SPECIFIC |
---|
148 | (*(component_RegisterFile_Internal_Banked ->in_CLOCK )) (*(in_CLOCK )); |
---|
149 | (*(component_RegisterFile_Internal_Banked ->in_NRESET)) (*(in_NRESET)); |
---|
150 | |
---|
151 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
152 | { |
---|
153 | (*(component_RegisterFile_Internal_Banked -> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
154 | (*(component_RegisterFile_Internal_Banked ->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
155 | if (_param->_have_port_address == true) |
---|
156 | (*(component_RegisterFile_Internal_Banked -> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
157 | (*(component_RegisterFile_Internal_Banked ->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
158 | } |
---|
159 | |
---|
160 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
161 | { |
---|
162 | (*(component_RegisterFile_Internal_Banked -> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
163 | (*(component_RegisterFile_Internal_Banked ->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
164 | if (_param->_have_port_address == true) |
---|
165 | (*(component_RegisterFile_Internal_Banked -> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
166 | (*(component_RegisterFile_Internal_Banked -> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
167 | } |
---|
168 | #else |
---|
169 | in_CLOCK = component_RegisterFile_Internal_Banked-> in_CLOCK ; |
---|
170 | in_NRESET = component_RegisterFile_Internal_Banked-> in_NRESET ; |
---|
171 | |
---|
172 | in_READ_VAL = component_RegisterFile_Internal_Banked-> in_READ_VAL ; |
---|
173 | out_READ_ACK = component_RegisterFile_Internal_Banked->out_READ_ACK ; |
---|
174 | in_READ_ADDRESS = component_RegisterFile_Internal_Banked-> in_READ_ADDRESS ; |
---|
175 | out_READ_DATA = component_RegisterFile_Internal_Banked->out_READ_DATA ; |
---|
176 | |
---|
177 | in_WRITE_VAL = component_RegisterFile_Internal_Banked-> in_WRITE_VAL ; |
---|
178 | out_WRITE_ACK = component_RegisterFile_Internal_Banked->out_WRITE_ACK ; |
---|
179 | in_WRITE_ADDRESS = component_RegisterFile_Internal_Banked-> in_WRITE_ADDRESS; |
---|
180 | in_WRITE_DATA = component_RegisterFile_Internal_Banked-> in_WRITE_DATA ; |
---|
181 | #endif |
---|
182 | } |
---|
183 | else |
---|
184 | // =====[ Component_RegisterFile_Multi_Banked - Instanciation ]======= |
---|
185 | { |
---|
186 | #ifdef SYSTEMCASS_SPECIFIC |
---|
187 | (*(component_RegisterFile_Multi_Banked->in_CLOCK )) (*(in_CLOCK )); |
---|
188 | (*(component_RegisterFile_Multi_Banked->in_NRESET)) (*(in_NRESET)); |
---|
189 | |
---|
190 | for (uint32_t i=0; i<_param->_nb_port_read; i++) |
---|
191 | { |
---|
192 | (*(component_RegisterFile_Multi_Banked-> in_READ_VAL [i])) (*( in_READ_VAL [i])); |
---|
193 | (*(component_RegisterFile_Multi_Banked->out_READ_ACK [i])) (*(out_READ_ACK [i])); |
---|
194 | if (_param->_have_port_address == true) |
---|
195 | (*(component_RegisterFile_Multi_Banked-> in_READ_ADDRESS [i])) (*( in_READ_ADDRESS [i])); |
---|
196 | (*(component_RegisterFile_Multi_Banked->out_READ_DATA [i])) (*(out_READ_DATA [i])); |
---|
197 | } |
---|
198 | |
---|
199 | for (uint32_t i=0; i<_param->_nb_port_write; i++) |
---|
200 | { |
---|
201 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_VAL [i])) (*( in_WRITE_VAL [i])); |
---|
202 | (*(component_RegisterFile_Multi_Banked->out_WRITE_ACK [i])) (*(out_WRITE_ACK [i])); |
---|
203 | if (_param->_have_port_address == true) |
---|
204 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS [i])) (*( in_WRITE_ADDRESS [i])); |
---|
205 | (*(component_RegisterFile_Multi_Banked-> in_WRITE_DATA [i])) (*( in_WRITE_DATA [i])); |
---|
206 | } |
---|
207 | #else |
---|
208 | in_CLOCK = component_RegisterFile_Multi_Banked-> in_CLOCK ; |
---|
209 | in_NRESET = component_RegisterFile_Multi_Banked-> in_NRESET ; |
---|
210 | |
---|
211 | in_READ_VAL = component_RegisterFile_Multi_Banked-> in_READ_VAL ; |
---|
212 | out_READ_ACK = component_RegisterFile_Multi_Banked->out_READ_ACK ; |
---|
213 | in_READ_ADDRESS = component_RegisterFile_Multi_Banked-> in_READ_ADDRESS ; |
---|
214 | out_READ_DATA = component_RegisterFile_Multi_Banked->out_READ_DATA ; |
---|
215 | |
---|
216 | in_WRITE_VAL = component_RegisterFile_Multi_Banked-> in_WRITE_VAL ; |
---|
217 | out_WRITE_ACK = component_RegisterFile_Multi_Banked->out_WRITE_ACK ; |
---|
218 | in_WRITE_ADDRESS = component_RegisterFile_Multi_Banked-> in_WRITE_ADDRESS; |
---|
219 | in_WRITE_DATA = component_RegisterFile_Multi_Banked-> in_WRITE_DATA ; |
---|
220 | #endif |
---|
221 | } |
---|
222 | } |
---|
223 | |
---|
224 | if (_param->_instance == instance_RegisterFile_Monolithic) |
---|
225 | _component = component_RegisterFile_Monolithic->_component; |
---|
226 | else |
---|
227 | { |
---|
228 | if (_param->_instance == instance_RegisterFile_Internal_Banked) |
---|
229 | _component = component_RegisterFile_Internal_Banked->_component; |
---|
230 | else |
---|
231 | _component = component_RegisterFile_Multi_Banked->_component; |
---|
232 | } |
---|
233 | log_printf(FUNC,RegisterFile,"allocation","End"); |
---|
234 | }; |
---|
235 | |
---|
236 | }; // end namespace registerfile |
---|
237 | }; // end namespace generic |
---|
238 | |
---|
239 | }; // end namespace behavioural |
---|
240 | }; // end namespace morpheo |
---|
241 | #endif |
---|