1 | /* |
---|
2 | * $Id: Branch_Target_Buffer_allocation.cpp 112 2009-03-18 22:36:26Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/include/Branch_Target_Buffer.h" |
---|
9 | #include "Behavioural/include/Allocation.h" |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | namespace behavioural { |
---|
13 | namespace core { |
---|
14 | namespace multi_front_end { |
---|
15 | namespace front_end { |
---|
16 | namespace prediction_unit { |
---|
17 | namespace branch_target_buffer { |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | #undef FUNCTION |
---|
22 | #define FUNCTION "Branch_Target_Buffer::allocation" |
---|
23 | void Branch_Target_Buffer::allocation |
---|
24 | ( |
---|
25 | #ifdef STATISTICS |
---|
26 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
27 | #else |
---|
28 | void |
---|
29 | #endif |
---|
30 | ) |
---|
31 | { |
---|
32 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
33 | |
---|
34 | _component = new Component (_usage); |
---|
35 | |
---|
36 | Entity * entity = _component->set_entity (_name |
---|
37 | ,"Branch_Target_Buffer" |
---|
38 | #ifdef POSITION |
---|
39 | ,COMBINATORY |
---|
40 | #endif |
---|
41 | ); |
---|
42 | |
---|
43 | _interfaces = entity->set_interfaces(); |
---|
44 | |
---|
45 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
46 | { |
---|
47 | Interface * interface = _interfaces->set_interface("" |
---|
48 | #ifdef POSITION |
---|
49 | ,IN |
---|
50 | ,SOUTH, |
---|
51 | _("Generalist interface") |
---|
52 | #endif |
---|
53 | ); |
---|
54 | |
---|
55 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
56 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
57 | } |
---|
58 | |
---|
59 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
60 | { |
---|
61 | ALLOC1_INTERFACE_BEGIN("predict", IN, SOUTH, _("Predict (next pc) interface"), _param->_nb_inst_predict); |
---|
62 | |
---|
63 | ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); |
---|
64 | ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); |
---|
65 | ALLOC1_SIGNAL_IN ( in_PREDICT_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id); |
---|
66 | ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS ,"address" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
67 | ALLOC1_SIGNAL_OUT(out_PREDICT_HIT ,"hit" ,Tcontrol_t ,1); |
---|
68 | ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_SRC ,"address_src" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
69 | ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_DEST,"address_dest",Tgeneral_data_t ,_param->_size_instruction_address); |
---|
70 | ALLOC1_SIGNAL_OUT(out_PREDICT_CONDITION ,"condition" ,Tbranch_condition_t,_param->_size_branch_condition); |
---|
71 | ALLOC1_SIGNAL_OUT(out_PREDICT_LAST_TAKE ,"last_take" ,Tcontrol_t ,1); |
---|
72 | ALLOC1_SIGNAL_OUT(out_PREDICT_IS_ACCURATE ,"is_accurate" ,Tcontrol_t ,1); |
---|
73 | |
---|
74 | ALLOC1_INTERFACE_END(param->_nb_inst_predict); |
---|
75 | } |
---|
76 | |
---|
77 | // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
78 | { |
---|
79 | ALLOC1_INTERFACE_BEGIN("decod", IN, SOUTH, _("Decod Interface"), _param->_nb_inst_decod); |
---|
80 | |
---|
81 | ALLOC1_VALACK_IN ( in_DECOD_VAL ,VAL); |
---|
82 | ALLOC1_VALACK_OUT(out_DECOD_ACK ,ACK); |
---|
83 | ALLOC1_SIGNAL_IN ( in_DECOD_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id); |
---|
84 | ALLOC1_SIGNAL_IN ( in_DECOD_ADDRESS_SRC ,"address_src" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
85 | ALLOC1_SIGNAL_IN ( in_DECOD_ADDRESS_DEST ,"address_dest" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
86 | ALLOC1_SIGNAL_IN ( in_DECOD_CONDITION ,"condition" ,Tbranch_condition_t,_param->_size_branch_condition); |
---|
87 | ALLOC1_SIGNAL_IN ( in_DECOD_LAST_TAKE ,"last_take" ,Tcontrol_t ,1); |
---|
88 | ALLOC1_SIGNAL_IN ( in_DECOD_MISS_PREDICTION,"miss_prediction",Tcontrol_t ,1); |
---|
89 | ALLOC1_SIGNAL_IN ( in_DECOD_IS_ACCURATE ,"is_accurate" ,Tcontrol_t ,1); |
---|
90 | |
---|
91 | ALLOC1_INTERFACE_END(_param->_nb_inst_decod); |
---|
92 | } |
---|
93 | |
---|
94 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
95 | { |
---|
96 | ALLOC1_INTERFACE_BEGIN("update", IN, SOUTH, _("Update interface"), _param->_nb_inst_update); |
---|
97 | |
---|
98 | ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); |
---|
99 | ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); |
---|
100 | ALLOC1_SIGNAL_IN ( in_UPDATE_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id); |
---|
101 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS_SRC ,"address_src" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
102 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS_DEST ,"address_dest" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
103 | ALLOC1_SIGNAL_IN ( in_UPDATE_CONDITION ,"condition" ,Tbranch_condition_t,_param->_size_branch_condition); |
---|
104 | ALLOC1_SIGNAL_IN ( in_UPDATE_LAST_TAKE ,"last_take" ,Tcontrol_t ,1); |
---|
105 | ALLOC1_SIGNAL_IN ( in_UPDATE_MISS_PREDICTION,"miss_prediction",Tcontrol_t ,1); |
---|
106 | |
---|
107 | ALLOC1_INTERFACE_END(_param->_nb_inst_update); |
---|
108 | } |
---|
109 | |
---|
110 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
111 | std::string name; |
---|
112 | |
---|
113 | if (_param->_have_component_victim) |
---|
114 | { |
---|
115 | _component_sort = new morpheo::behavioural::generic::sort::Sort * [_param->_nb_inst_predict]; |
---|
116 | |
---|
117 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
118 | { |
---|
119 | name = _name+"_sort_"+toString(i); |
---|
120 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
121 | |
---|
122 | _component_sort [i] = new morpheo::behavioural::generic::sort::Sort |
---|
123 | (name.c_str() |
---|
124 | #ifdef STATISTICS |
---|
125 | ,param_statistics |
---|
126 | #endif |
---|
127 | ,_param->_param_sort |
---|
128 | ,_usage); |
---|
129 | |
---|
130 | _component->set_component (_component_sort [i] ->_component |
---|
131 | #ifdef POSITION |
---|
132 | , 50, 50, 10, 10 |
---|
133 | #endif |
---|
134 | ); |
---|
135 | } |
---|
136 | |
---|
137 | { |
---|
138 | name = _name+"_victim"; |
---|
139 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
140 | |
---|
141 | _component_victim = new morpheo::behavioural::generic::victim::Victim |
---|
142 | (name.c_str() |
---|
143 | #ifdef STATISTICS |
---|
144 | ,param_statistics |
---|
145 | #endif |
---|
146 | ,_param->_param_victim |
---|
147 | ,_usage); |
---|
148 | |
---|
149 | _component->set_component (_component_victim->_component |
---|
150 | #ifdef POSITION |
---|
151 | , 50, 50, 10, 10 |
---|
152 | #endif |
---|
153 | ); |
---|
154 | } |
---|
155 | } |
---|
156 | |
---|
157 | { |
---|
158 | name = _name+"_glue"; |
---|
159 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
160 | |
---|
161 | _component_branch_target_buffer_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_glue::Branch_Target_Buffer_Glue |
---|
162 | (name.c_str() |
---|
163 | #ifdef STATISTICS |
---|
164 | ,param_statistics |
---|
165 | #endif |
---|
166 | ,_param->_param_branch_target_buffer_glue |
---|
167 | ,_usage); |
---|
168 | |
---|
169 | _component->set_component (_component_branch_target_buffer_glue->_component |
---|
170 | #ifdef POSITION |
---|
171 | , 50, 50, 10, 10 |
---|
172 | #endif |
---|
173 | ); |
---|
174 | } |
---|
175 | |
---|
176 | { |
---|
177 | name = _name+"_register"; |
---|
178 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
179 | |
---|
180 | _component_branch_target_buffer_register = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_register::Branch_Target_Buffer_Register |
---|
181 | (name.c_str() |
---|
182 | #ifdef STATISTICS |
---|
183 | ,param_statistics |
---|
184 | #endif |
---|
185 | ,_param->_param_branch_target_buffer_register |
---|
186 | ,_usage); |
---|
187 | |
---|
188 | _component->set_component (_component_branch_target_buffer_register->_component |
---|
189 | #ifdef POSITION |
---|
190 | , 50, 50, 10, 10 |
---|
191 | #endif |
---|
192 | ); |
---|
193 | } |
---|
194 | |
---|
195 | // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
196 | std::string src,dest; |
---|
197 | |
---|
198 | if (_param->_have_component_victim) |
---|
199 | { |
---|
200 | //================================================================ |
---|
201 | //=====[ Sort ]=================================================== |
---|
202 | //================================================================ |
---|
203 | |
---|
204 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
205 | { |
---|
206 | src = _name+"_sort_"+toString(i); |
---|
207 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
208 | |
---|
209 | { |
---|
210 | dest = _name; |
---|
211 | #ifdef POSITION |
---|
212 | _component->interface_map (src ,"", |
---|
213 | dest,""); |
---|
214 | #endif |
---|
215 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
216 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
217 | } |
---|
218 | |
---|
219 | for (uint32_t j=0; j<_param->_associativity; j++) |
---|
220 | { |
---|
221 | dest = _name+"_register"; |
---|
222 | #ifdef POSITION |
---|
223 | _component->interface_map (src ,"input_" +toString(i), |
---|
224 | dest,"predict_"+toString(i)); |
---|
225 | #endif |
---|
226 | |
---|
227 | COMPONENT_MAP(_component,src , "in_INPUT_"+toString(j)+"_VAL" , |
---|
228 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+"_HIT" ); |
---|
229 | COMPONENT_MAP(_component,src , "in_INPUT_"+toString(j)+"_DATA", |
---|
230 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+"_ADDRESS_SRC"); |
---|
231 | |
---|
232 | } |
---|
233 | |
---|
234 | // 1 output |
---|
235 | // out_OUTPUT_VAL -> glue |
---|
236 | // out_OUTPUT_INDEX -> glue |
---|
237 | // out_OUTPUT_ADDRESS -> no exist |
---|
238 | } |
---|
239 | |
---|
240 | //================================================================ |
---|
241 | //=====[ Victim ]================================================= |
---|
242 | //================================================================ |
---|
243 | { |
---|
244 | src = _name+"_victim"; |
---|
245 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
246 | |
---|
247 | { |
---|
248 | dest = _name; |
---|
249 | #ifdef POSITION |
---|
250 | _component->interface_map (src ,"", |
---|
251 | dest,""); |
---|
252 | #endif |
---|
253 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
254 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
255 | |
---|
256 | // in_ACCESS_VAL -> glue, register |
---|
257 | //out_ACCESS_ACK -> glue, register |
---|
258 | // in_ACCESS_ADDRESS -> glue, register |
---|
259 | // in_ACCESS_HIT -> glue, register |
---|
260 | // in_ACCESS_ENTITY -> glue, register |
---|
261 | //out_ACCESS_VICTIM -> glue, register |
---|
262 | } |
---|
263 | } |
---|
264 | } |
---|
265 | |
---|
266 | //==================================================================== |
---|
267 | //=====[ Glue ]======================================================= |
---|
268 | //==================================================================== |
---|
269 | { |
---|
270 | src = _name+"_glue"; |
---|
271 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
272 | |
---|
273 | { |
---|
274 | dest = _name; |
---|
275 | #ifdef POSITION |
---|
276 | _component->interface_map (src ,"", |
---|
277 | dest,""); |
---|
278 | #endif |
---|
279 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
280 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
281 | } |
---|
282 | |
---|
283 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
284 | { |
---|
285 | dest = _name; |
---|
286 | #ifdef POSITION |
---|
287 | _component->interface_map (src ,"predict_"+toString(i), |
---|
288 | dest,"predict_"+toString(i)); |
---|
289 | #endif |
---|
290 | |
---|
291 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL" , |
---|
292 | dest, "in_PREDICT_"+toString(i)+"_VAL" ); |
---|
293 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK" , |
---|
294 | dest,"out_PREDICT_"+toString(i)+"_ACK" ); |
---|
295 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HIT" , |
---|
296 | dest,"out_PREDICT_"+toString(i)+"_HIT" ); |
---|
297 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ADDRESS_SRC" , |
---|
298 | dest,"out_PREDICT_"+toString(i)+"_ADDRESS_SRC" ); |
---|
299 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ADDRESS_DEST", |
---|
300 | dest,"out_PREDICT_"+toString(i)+"_ADDRESS_DEST"); |
---|
301 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_CONDITION" , |
---|
302 | dest,"out_PREDICT_"+toString(i)+"_CONDITION" ); |
---|
303 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_LAST_TAKE" , |
---|
304 | dest,"out_PREDICT_"+toString(i)+"_LAST_TAKE" ); |
---|
305 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_IS_ACCURATE" , |
---|
306 | dest,"out_PREDICT_"+toString(i)+"_IS_ACCURATE" ); |
---|
307 | |
---|
308 | dest = _name+"_register"; |
---|
309 | #ifdef POSITION |
---|
310 | _component->interface_map (src ,"predict_"+toString(i), |
---|
311 | dest,"predict_"+toString(i)); |
---|
312 | #endif |
---|
313 | |
---|
314 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_REGISTER_VAL", |
---|
315 | dest, "in_PREDICT_"+toString(i)+"_VAL"); |
---|
316 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_REGISTER_ACK", |
---|
317 | dest,"out_PREDICT_"+toString(i)+"_ACK"); |
---|
318 | |
---|
319 | for (uint32_t j=0; j<_param->_associativity; j++) |
---|
320 | { |
---|
321 | #ifdef POSITION |
---|
322 | _component->interface_map (src ,"predict_"+toString(i)+"_"+toString(j), |
---|
323 | dest,"predict_"+toString(i)+"_"+toString(j)); |
---|
324 | #endif |
---|
325 | |
---|
326 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_HIT" , |
---|
327 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_HIT" ); |
---|
328 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_ADDRESS_SRC" , |
---|
329 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_ADDRESS_SRC" ); |
---|
330 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_ADDRESS_DEST", |
---|
331 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_ADDRESS_DEST"); |
---|
332 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_CONDITION" , |
---|
333 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_CONDITION" ); |
---|
334 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_LAST_TAKE" , |
---|
335 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_LAST_TAKE" ); |
---|
336 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_IS_ACCURATE" , |
---|
337 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_IS_ACCURATE" ); |
---|
338 | } |
---|
339 | |
---|
340 | if (_param->_have_component_victim) |
---|
341 | { |
---|
342 | dest = _name+"_sort_"+toString(i); |
---|
343 | #ifdef POSITION |
---|
344 | _component->interface_map (src ,"predict_"+toString(i), |
---|
345 | dest,"output_0"); |
---|
346 | #endif |
---|
347 | |
---|
348 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_SORT_VAL" , |
---|
349 | dest,"out_OUTPUT_0_VAL" ); |
---|
350 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_SORT_INDEX", |
---|
351 | dest,"out_OUTPUT_0_INDEX"); |
---|
352 | |
---|
353 | dest = _name+"_victim"; |
---|
354 | #ifdef POSITION |
---|
355 | _component->interface_map (src ,"predict_"+toString(i), |
---|
356 | dest,"access_"+toString(i)); |
---|
357 | #endif |
---|
358 | |
---|
359 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_VAL" , |
---|
360 | dest, "in_ACCESS_"+toString(i)+"_VAL" ); |
---|
361 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VICTIM_ACK" , |
---|
362 | dest,"out_ACCESS_"+toString(i)+"_ACK" ); |
---|
363 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_HIT" , |
---|
364 | dest, "in_ACCESS_"+toString(i)+"_HIT" ); |
---|
365 | if (not _param->_is_full_associative) |
---|
366 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_ADDRESS", |
---|
367 | dest, "in_ACCESS_"+toString(i)+"_ADDRESS"); |
---|
368 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_INDEX" , |
---|
369 | dest, "in_ACCESS_"+toString(i)+"_ENTITY" ); |
---|
370 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VICTIM_VICTIM" , |
---|
371 | dest,"out_ACCESS_"+toString(i)+"_VICTIM" ); |
---|
372 | } |
---|
373 | } |
---|
374 | |
---|
375 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
376 | { |
---|
377 | dest = _name; |
---|
378 | #ifdef POSITION |
---|
379 | _component->interface_map (src ,"decod_"+toString(i), |
---|
380 | dest,"decod_"+toString(i)); |
---|
381 | #endif |
---|
382 | |
---|
383 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_VAL" , |
---|
384 | dest, "in_DECOD_"+toString(i)+"_VAL" ); |
---|
385 | PORT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_ACK" , |
---|
386 | dest,"out_DECOD_"+toString(i)+"_ACK" ); |
---|
387 | if (not _param->_is_full_associative) |
---|
388 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_ADDRESS_SRC", |
---|
389 | dest, "in_DECOD_"+toString(i)+"_ADDRESS_SRC"); |
---|
390 | |
---|
391 | dest = _name+"_register"; |
---|
392 | #ifdef POSITION |
---|
393 | _component->interface_map (src ,"decod_"+toString(i), |
---|
394 | dest,"decod_"+toString(i)); |
---|
395 | #endif |
---|
396 | |
---|
397 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_REGISTER_VAL", |
---|
398 | dest, "in_DECOD_"+toString(i)+"_VAL"); |
---|
399 | COMPONENT_MAP(_component,src , "in_DECOD_"+toString(i)+"_REGISTER_ACK", |
---|
400 | dest,"out_DECOD_"+toString(i)+"_ACK"); |
---|
401 | |
---|
402 | if (_param->_have_component_victim) |
---|
403 | { |
---|
404 | uint32_t j = _param->_nb_inst_predict+i; |
---|
405 | |
---|
406 | dest = _name+"_victim"; |
---|
407 | #ifdef POSITION |
---|
408 | _component->interface_map (src ,"predict_"+toString(i), |
---|
409 | dest,"access_"+toString(j)); |
---|
410 | #endif |
---|
411 | |
---|
412 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_VICTIM_VAL" , |
---|
413 | dest, "in_ACCESS_"+toString(j)+"_VAL" ); |
---|
414 | COMPONENT_MAP(_component,src , "in_DECOD_"+toString(i)+"_VICTIM_ACK" , |
---|
415 | dest,"out_ACCESS_"+toString(j)+"_ACK" ); |
---|
416 | if (not _param->_is_full_associative) |
---|
417 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_VICTIM_ADDRESS", |
---|
418 | dest, "in_ACCESS_"+toString(j)+"_ADDRESS"); |
---|
419 | } |
---|
420 | } |
---|
421 | |
---|
422 | for (uint32_t i=0; i<_param->_nb_inst_update; i++) |
---|
423 | { |
---|
424 | dest = _name; |
---|
425 | #ifdef POSITION |
---|
426 | _component->interface_map (src ,"update_"+toString(i), |
---|
427 | dest,"update_"+toString(i)); |
---|
428 | #endif |
---|
429 | |
---|
430 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL" , |
---|
431 | dest, "in_UPDATE_"+toString(i)+"_VAL" ); |
---|
432 | PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK" , |
---|
433 | dest,"out_UPDATE_"+toString(i)+"_ACK" ); |
---|
434 | if (not _param->_is_full_associative) |
---|
435 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS_SRC", |
---|
436 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS_SRC"); |
---|
437 | |
---|
438 | dest = _name+"_register"; |
---|
439 | #ifdef POSITION |
---|
440 | _component->interface_map (src ,"update_"+toString(i), |
---|
441 | dest,"update_"+toString(i)); |
---|
442 | #endif |
---|
443 | |
---|
444 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_REGISTER_VAL", |
---|
445 | dest, "in_UPDATE_"+toString(i)+"_VAL"); |
---|
446 | COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_REGISTER_ACK", |
---|
447 | dest,"out_UPDATE_"+toString(i)+"_ACK"); |
---|
448 | |
---|
449 | if (_param->_have_component_victim) |
---|
450 | { |
---|
451 | uint32_t j = _param->_nb_inst_predict+_param->_nb_inst_decod+i; |
---|
452 | |
---|
453 | dest = _name+"_victim"; |
---|
454 | #ifdef POSITION |
---|
455 | _component->interface_map (src ,"predict_"+toString(i), |
---|
456 | dest,"access_"+toString(j)); |
---|
457 | #endif |
---|
458 | |
---|
459 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_VICTIM_VAL" , |
---|
460 | dest, "in_ACCESS_"+toString(j)+"_VAL" ); |
---|
461 | COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VICTIM_ACK" , |
---|
462 | dest,"out_ACCESS_"+toString(j)+"_ACK" ); |
---|
463 | if (not _param->_is_full_associative) |
---|
464 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_VICTIM_ADDRESS", |
---|
465 | dest, "in_ACCESS_"+toString(j)+"_ADDRESS"); |
---|
466 | } |
---|
467 | } |
---|
468 | } |
---|
469 | |
---|
470 | //==================================================================== |
---|
471 | //=====[ Register ]=================================================== |
---|
472 | //==================================================================== |
---|
473 | { |
---|
474 | src = _name+"_register"; |
---|
475 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
476 | |
---|
477 | { |
---|
478 | dest = _name; |
---|
479 | #ifdef POSITION |
---|
480 | _component->interface_map (src ,"", |
---|
481 | dest,""); |
---|
482 | #endif |
---|
483 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
484 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
485 | } |
---|
486 | |
---|
487 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
488 | { |
---|
489 | dest = _name; |
---|
490 | #ifdef POSITION |
---|
491 | _component->interface_map (src ,"predict_"+toString(i), |
---|
492 | dest,"predict_"+toString(i)); |
---|
493 | #endif |
---|
494 | |
---|
495 | if (_param->_have_port_context_id) |
---|
496 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_CONTEXT_ID", |
---|
497 | dest, "in_PREDICT_"+toString(i)+"_CONTEXT_ID"); |
---|
498 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ADDRESS" , |
---|
499 | dest, "in_PREDICT_"+toString(i)+"_ADDRESS" ); |
---|
500 | |
---|
501 | // in_PREDICT_VAL -> glue |
---|
502 | //out_PREDICT_ACK -> glue |
---|
503 | //out_PREDICT_HIT -> glue, sort |
---|
504 | //out_PREDICT_ADDRESS_SRC -> glue, sort |
---|
505 | //out_PREDICT_ADDRESS_DEST -> glue |
---|
506 | //out_PREDICT_CONDITION -> glue |
---|
507 | //out_PREDICT_LAST_TAKE -> glue |
---|
508 | //out_PREDICT_IS_ACCURATE -> glue |
---|
509 | } |
---|
510 | |
---|
511 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
512 | { |
---|
513 | dest = _name; |
---|
514 | #ifdef POSITION |
---|
515 | _component->interface_map (src ,"decod_"+toString(i), |
---|
516 | dest,"decod_"+toString(i)); |
---|
517 | #endif |
---|
518 | |
---|
519 | // in_DECOD_VAL -> glue |
---|
520 | //out_DECOD_ACK -> glue |
---|
521 | if (_param->_have_port_context_id) |
---|
522 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_CONTEXT_ID" , |
---|
523 | dest, "in_DECOD_"+toString(i)+"_CONTEXT_ID" ); |
---|
524 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_ADDRESS_SRC" , |
---|
525 | dest, "in_DECOD_"+toString(i)+"_ADDRESS_SRC" ); |
---|
526 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_ADDRESS_DEST" , |
---|
527 | dest, "in_DECOD_"+toString(i)+"_ADDRESS_DEST" ); |
---|
528 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_CONDITION" , |
---|
529 | dest, "in_DECOD_"+toString(i)+"_CONDITION" ); |
---|
530 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_LAST_TAKE" , |
---|
531 | dest, "in_DECOD_"+toString(i)+"_LAST_TAKE" ); |
---|
532 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_MISS_PREDICTION", |
---|
533 | dest, "in_DECOD_"+toString(i)+"_MISS_PREDICTION"); |
---|
534 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_IS_ACCURATE", |
---|
535 | dest, "in_DECOD_"+toString(i)+"_IS_ACCURATE"); |
---|
536 | |
---|
537 | if (_param->_have_component_victim) |
---|
538 | { |
---|
539 | uint32_t j = _param->_nb_inst_predict+i; |
---|
540 | |
---|
541 | dest = _name+"_victim"; |
---|
542 | #ifdef POSITION |
---|
543 | _component->interface_map (src ,"decod_"+toString(i), |
---|
544 | dest,"access_"+toString(j)); |
---|
545 | #endif |
---|
546 | |
---|
547 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_HIT" , |
---|
548 | dest, "in_ACCESS_"+toString(j)+"_HIT" ); |
---|
549 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_HIT_INDEX", |
---|
550 | dest, "in_ACCESS_"+toString(j)+"_ENTITY"); |
---|
551 | COMPONENT_MAP(_component,src , "in_DECOD_"+toString(i)+"_VICTIM" , |
---|
552 | dest,"out_ACCESS_"+toString(j)+"_VICTIM"); |
---|
553 | } |
---|
554 | } |
---|
555 | |
---|
556 | for (uint32_t i=0; i<_param->_nb_inst_update; i++) |
---|
557 | { |
---|
558 | dest = _name; |
---|
559 | #ifdef POSITION |
---|
560 | _component->interface_map (src ,"update_"+toString(i), |
---|
561 | dest,"update_"+toString(i)); |
---|
562 | #endif |
---|
563 | |
---|
564 | // in_UPDATE_VAL -> glue |
---|
565 | //out_UPDATE_ACK -> glue |
---|
566 | if (_param->_have_port_context_id) |
---|
567 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_CONTEXT_ID" , |
---|
568 | dest, "in_UPDATE_"+toString(i)+"_CONTEXT_ID" ); |
---|
569 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS_SRC" , |
---|
570 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS_SRC" ); |
---|
571 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS_DEST" , |
---|
572 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS_DEST" ); |
---|
573 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_CONDITION" , |
---|
574 | dest, "in_UPDATE_"+toString(i)+"_CONDITION" ); |
---|
575 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_LAST_TAKE" , |
---|
576 | dest, "in_UPDATE_"+toString(i)+"_LAST_TAKE" ); |
---|
577 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_MISS_PREDICTION", |
---|
578 | dest, "in_UPDATE_"+toString(i)+"_MISS_PREDICTION"); |
---|
579 | |
---|
580 | if (_param->_have_component_victim) |
---|
581 | { |
---|
582 | uint32_t j = _param->_nb_inst_predict+_param->_nb_inst_decod+i; |
---|
583 | |
---|
584 | dest = _name+"_victim"; |
---|
585 | #ifdef POSITION |
---|
586 | _component->interface_map (src ,"update_"+toString(i), |
---|
587 | dest,"access_"+toString(j)); |
---|
588 | #endif |
---|
589 | |
---|
590 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_HIT" , |
---|
591 | dest, "in_ACCESS_"+toString(j)+"_HIT" ); |
---|
592 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_HIT_INDEX", |
---|
593 | dest, "in_ACCESS_"+toString(j)+"_ENTITY"); |
---|
594 | COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VICTIM" , |
---|
595 | dest,"out_ACCESS_"+toString(j)+"_VICTIM"); |
---|
596 | } |
---|
597 | } |
---|
598 | } |
---|
599 | // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
600 | |
---|
601 | #if DEBUG_Branch_Target_Buffer == true |
---|
602 | _component->test_map(); |
---|
603 | #endif |
---|
604 | |
---|
605 | #ifdef POSITION |
---|
606 | if (usage_is_set(_usage,USE_POSITION)) |
---|
607 | _component->generate_file(); |
---|
608 | #endif |
---|
609 | |
---|
610 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
611 | }; |
---|
612 | |
---|
613 | }; // end namespace branch_target_buffer |
---|
614 | }; // end namespace prediction_unit |
---|
615 | }; // end namespace front_end |
---|
616 | }; // end namespace multi_front_end |
---|
617 | }; // end namespace core |
---|
618 | |
---|
619 | }; // end namespace behavioural |
---|
620 | }; // end namespace morpheo |
---|