source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/src/Prediction_unit_allocation.cpp @ 111

Last change on this file since 111 was 111, checked in by rosiere, 15 years ago

1) Decod_queue : multi implementation (one_fifo, multi_fifo)
2) Issue_queue : multi implementation (in_order, out_of_order)
3) Direction : Add Meta predictor
4) Context_State : re add Branch_complete, More priority to Load miss (is not speculative)
5) Return_Address_Stack : update reg_PREDICT pointer on decod miss prediction
6) UPT : Fix bug in multi event
7) Prediction_glue : in read_stack case, insert in UPT pc_next
8) Rename select : when rob have an event (need flush), read_r{a,b,c} and write_r{d,e} is set at 0

  • Property svn:keywords set to Id
File size: 43.2 KB
Line 
1/*
2 * $Id: Prediction_unit_allocation.cpp 111 2009-02-27 18:37:40Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/include/Prediction_unit.h"
9#include "Behavioural/include/Allocation.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17
18#undef  FUNCTION
19#define FUNCTION "Prediction_unit::allocation"
20  void Prediction_unit::allocation (
21#ifdef STATISTICS
22                               morpheo::behavioural::Parameters_Statistics * param_statistics
23#else
24                               void
25#endif
26                               )
27  {
28    log_printf(FUNC,Prediction_unit,FUNCTION,"Begin");
29
30    _component   = new Component (_usage);
31
32    Entity * entity = _component->set_entity (_name       
33                                              ,"Prediction_unit"
34#ifdef POSITION
35                                              ,COMBINATORY
36#endif
37                                              );
38
39    _interfaces = entity->set_interfaces();
40   
41    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42    {
43      Interface * interface = _interfaces->set_interface(""
44#ifdef POSITION
45                                                         ,IN
46                                                         ,SOUTH,
47                                                         "Generalist interface"
48#endif
49                                                         );
50     
51      in_CLOCK        = interface->set_signal_clk              ("clock" ,1, CLOCK_VHDL_YES);
52      in_NRESET       = interface->set_signal_in  <Tcontrol_t> ("nreset",1, RESET_VHDL_YES);
53    }
54
55    // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56    {
57      {
58        ALLOC1_INTERFACE("predict",IN,SOUTH,"Interface with ifetch unit",_param->_nb_context);
59       
60        ALLOC1_VALACK_IN ( in_PREDICT_VAL                        ,VAL);
61        ALLOC1_VALACK_OUT(out_PREDICT_ACK                        ,ACK);
62        ALLOC1_SIGNAL_IN ( in_PREDICT_PC_PREVIOUS                ,"pc_previous"                ,Taddress_t         ,_param->_size_address);
63        ALLOC1_SIGNAL_IN ( in_PREDICT_PC_CURRENT                 ,"pc_current"                 ,Taddress_t         ,_param->_size_address);
64        ALLOC1_SIGNAL_IN ( in_PREDICT_PC_CURRENT_IS_DS_TAKE      ,"pc_current_is_ds_take"      ,Tcontrol_t         ,1);
65        ALLOC1_SIGNAL_OUT(out_PREDICT_PC_NEXT                    ,"pc_next"                    ,Taddress_t         ,_param->_size_address);
66        ALLOC1_SIGNAL_OUT(out_PREDICT_PC_NEXT_IS_DS_TAKE         ,"pc_next_is_ds_take"         ,Tcontrol_t         ,1);
67        ALLOC1_SIGNAL_OUT(out_PREDICT_INST_IFETCH_PTR            ,"inst_ifetch_ptr"            ,Tinst_ifetch_ptr_t ,_param->_size_inst_ifetch_ptr);
68        ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t    ,_param->_size_branch_state);
69        ALLOC1_SIGNAL_OUT(out_PREDICT_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t  ,_param->_size_depth);
70      }
71      {
72        ALLOC2_INTERFACE("predict",IN,SOUTH,"Interface with ifetch unit",_param->_nb_context,_param->_nb_instruction[it1]);
73        _ALLOC2_SIGNAL_OUT(out_PREDICT_INSTRUCTION_ENABLE         ,"instruction_enable"         ,Tcontrol_t         ,1,_param->_nb_context,_param->_nb_instruction[it1]);
74      }
75    }
76
77    // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           
78    {
79      {
80        ALLOC2_INTERFACE("decod",IN,SOUTH,"Interface with decod unit",_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
81       
82        _ALLOC2_VALACK_IN ( in_DECOD_VAL                        ,VAL,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
83        _ALLOC2_VALACK_OUT(out_DECOD_ACK                        ,ACK,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
84        _ALLOC2_SIGNAL_IN ( in_DECOD_CONTEXT_ID                 ,"context_id"                 ,Tcontext_t         ,_param->_size_context_id      ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
85        _ALLOC2_SIGNAL_IN ( in_DECOD_MATCH_INST_IFETCH_PTR      ,"match_inst_ifetch_ptr"      ,Tcontrol_t         ,1                             ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
86        _ALLOC2_SIGNAL_IN ( in_DECOD_BRANCH_STATE               ,"branch_state"               ,Tbranch_state_t    ,_param->_size_branch_state    ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
87        _ALLOC2_SIGNAL_IN ( in_DECOD_BRANCH_UPDATE_PREDICTION_ID,"branch_update_prediction_id",Tprediction_ptr_t  ,_param->_size_depth           ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
88        _ALLOC2_SIGNAL_IN ( in_DECOD_BRANCH_CONDITION           ,"branch_condition"           ,Tbranch_condition_t,_param->_size_branch_condition,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
89        _ALLOC2_SIGNAL_IN ( in_DECOD_BRANCH_DIRECTION           ,"branch_direction"           ,Tcontrol_t         ,1                             ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
90        _ALLOC2_SIGNAL_IN ( in_DECOD_ADDRESS_SRC                ,"address_src"                ,Taddress_t         ,_param->_size_address         ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
91        _ALLOC2_SIGNAL_IN ( in_DECOD_ADDRESS_DEST               ,"address_dest"               ,Taddress_t         ,_param->_size_address         ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
92        _ALLOC2_SIGNAL_OUT(out_DECOD_CAN_CONTINUE               ,"can_continue"               ,Tcontrol_t         ,1                             ,_param->_nb_decod_unit,_param->_nb_inst_decod[it1]);
93      }
94    }
95
96    // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97    {
98      ALLOC1_INTERFACE("branch_complete", IN,SOUTH, "branch_complete", _param->_nb_inst_branch_complete);
99     
100      ALLOC1_VALACK_IN ( in_BRANCH_COMPLETE_VAL            ,VAL);
101      ALLOC1_VALACK_OUT(out_BRANCH_COMPLETE_ACK            ,ACK);
102      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_CONTEXT_ID     ,"context_id"     ,Tcontext_t,_param->_size_context_id);
103      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_DEPTH          ,"depth"          ,Tdepth_t  ,_param->_size_depth);
104      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_ADDRESS        ,"address"        ,Taddress_t,_param->_size_address);
105      ALLOC1_SIGNAL_IN ( in_BRANCH_COMPLETE_NO_SEQUENCE    ,"no_sequence"    ,Tcontrol_t,1);
106      ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1);
107//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_TAKE           ,"take"           ,Tcontrol_t,1);
108//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_SRC    ,"address_src"    ,Taddress_t,_param->_size_address);
109//       ALLOC1_SIGNAL_OUT(out_BRANCH_COMPLETE_ADDRESS_DEST   ,"address_dest"   ,Taddress_t,_param->_size_address);
110    }
111
112    // ~~~~~[ Interface : "branch_event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113    {
114      ALLOC1_INTERFACE("branch_event", IN,SOUTH, "branch_event", _param->_nb_context);
115     
116      ALLOC1_VALACK_OUT(out_BRANCH_EVENT_VAL              ,VAL);
117      ALLOC1_VALACK_IN ( in_BRANCH_EVENT_ACK              ,ACK);
118//    ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_CONTEXT_ID       ,"context_id"      ,Tcontext_t,_param->_size_context_id);
119      ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_DEPTH            ,"depth"           ,Tdepth_t  ,_param->_size_depth);
120//    ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_MISS_PREDICTION  ,"miss_prediction" ,Tcontrol_t,1);
121      ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_SRC      ,"address_src"     ,Taddress_t,_param->_size_address);
122      ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_DEST_VAL ,"address_dest_val",Tcontrol_t,1);
123      ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_DEST     ,"address_dest"    ,Taddress_t,_param->_size_address);
124    }
125
126    // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~           
127    {
128      ALLOC1_INTERFACE("depth",OUT,SOUTH,"Interface with depth",_param->_nb_context);
129
130      ALLOC1_SIGNAL_OUT(out_DEPTH_VAL          ,"val"          ,Tcontrol_t,1);
131      ALLOC1_SIGNAL_OUT(out_DEPTH_CURRENT      ,"current"      ,Tdepth_t  ,_param->_size_depth);
132      ALLOC1_SIGNAL_OUT(out_DEPTH_MIN          ,"min"          ,Tdepth_t  ,_param->_size_depth);
133      ALLOC1_SIGNAL_OUT(out_DEPTH_MAX          ,"max"          ,Tdepth_t  ,_param->_size_depth);
134      ALLOC1_SIGNAL_OUT(out_DEPTH_FULL         ,"full"         ,Tcontrol_t,1);
135    }
136
137    // ~~~~~[ Interface : "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
138    {
139      ALLOC1_INTERFACE("event", IN,SOUTH,"event", _param->_nb_context);
140
141      ALLOC1_VALACK_IN ( in_EVENT_VAL    ,VAL);
142      ALLOC1_VALACK_OUT(out_EVENT_ACK    ,ACK);
143      ALLOC1_SIGNAL_IN ( in_EVENT_TYPE   ,"type" ,Tevent_type_t ,_param->_size_event_type );
144      ALLOC1_SIGNAL_IN ( in_EVENT_DEPTH  ,"depth",Tdepth_t      ,_param->_size_depth      );
145    }
146
147    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148    std::string name;
149
150    {
151      name = _name+"_branch_target_buffer";
152      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
153     
154      _component_btb = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::Branch_Target_Buffer
155        (name.c_str()
156#ifdef STATISTICS
157         ,param_statistics
158#endif
159         ,_param->_param_btb
160         ,_usage);
161     
162      _component->set_component (_component_btb->_component
163#ifdef POSITION
164                                 , 50, 50, 10, 10
165#endif
166                                 );
167    }
168
169    {
170      name = _name+"_direction";
171      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
172     
173      _component_dir = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::Direction
174        (name.c_str()
175#ifdef STATISTICS
176         ,param_statistics
177#endif
178         ,_param->_param_dir
179         ,_usage);
180     
181      _component->set_component (_component_dir->_component
182#ifdef POSITION
183                                 , 50, 50, 10, 10
184#endif
185                                 );
186    }
187   
188    {
189      name = _name+"_return_address_stack";
190      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
191     
192      _component_ras = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::return_address_stack::Return_Address_Stack
193        (name.c_str()
194#ifdef STATISTICS
195         ,param_statistics
196#endif
197         ,_param->_param_ras
198         ,_usage);
199     
200      _component->set_component (_component_ras->_component
201#ifdef POSITION
202                                 , 50, 50, 10, 10
203#endif
204                                 );
205    }
206   
207    {
208      name = _name+"_update_prediction_table";
209      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
210     
211      _component_upt = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::Update_Prediction_Table
212        (name.c_str()
213#ifdef STATISTICS
214         ,param_statistics
215#endif
216         ,_param->_param_upt
217         ,_usage);
218     
219      _component->set_component (_component_upt->_component
220#ifdef POSITION
221                                 , 50, 50, 10, 10
222#endif
223                                 );
224    }
225
226    {
227      name = _name+"_prediction_unit_glue";
228      log_printf(INFO,Prediction_unit,FUNCTION,_("Create   : %s"),name.c_str());
229     
230      _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::prediction_unit_glue::Prediction_unit_Glue
231        (name.c_str()
232#ifdef STATISTICS
233         ,param_statistics
234#endif
235         ,_param->_param_glue
236         ,_usage);
237     
238      _component->set_component (_component_glue->_component
239#ifdef POSITION
240                                 , 50, 50, 10, 10
241#endif
242                                 );
243    }
244   
245    // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
246    std::string src,dest;
247
248    // ===================================================================
249    // =====[ branch_target_buffer ]======================================
250    // ===================================================================
251    {
252      src = _name+"_branch_target_buffer";
253      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
254           
255      {
256        dest = _name;
257#ifdef POSITION
258        _component->interface_map (src ,"",
259                                   dest,"");
260#endif
261        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
262        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
263      }
264
265      for (uint32_t i=0; i<_param->_nb_inst_branch_predict; i++)
266        {
267          dest = _name+"_prediction_unit_glue";
268#ifdef POSITION
269          _component->interface_map (src ,"predict_"+toString(i),
270                                     dest,"predict_btb_"+toString(i));
271#endif
272
273          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_VAL"         ,
274                                   dest,"out_PREDICT_BTB_"+toString(i)+"_VAL"         ); 
275          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ACK"         ,
276                                   dest, "in_PREDICT_BTB_"+toString(i)+"_ACK"         ); 
277          if (_param->_have_port_context_id)
278          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_CONTEXT_ID"  ,
279                                   dest,"out_PREDICT_BTB_"+toString(i)+"_CONTEXT_ID"  );
280          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_ADDRESS"     ,
281                                   dest,"out_PREDICT_BTB_"+toString(i)+"_ADDRESS"     );
282          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_HIT"         ,
283                                   dest, "in_PREDICT_BTB_"+toString(i)+"_HIT"         ); 
284          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ADDRESS_SRC" ,
285                                   dest, "in_PREDICT_BTB_"+toString(i)+"_ADDRESS_SRC" ); 
286          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ADDRESS_DEST",
287                                   dest, "in_PREDICT_BTB_"+toString(i)+"_ADDRESS_DEST"); 
288          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_CONDITION"   ,
289                                   dest, "in_PREDICT_BTB_"+toString(i)+"_CONDITION"   ); 
290          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_IS_ACCURATE" ,
291                                   dest, "in_PREDICT_BTB_"+toString(i)+"_IS_ACCURATE" );
292
293          dest = _name+"_direction";
294          COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_LAST_TAKE" ,
295                                   dest, "in_PREDICT_"+toString(i)+"_LAST_TAKE" );
296        }
297
298      for (uint32_t i=0; i<_param->_nb_inst_branch_decod; i++)
299        {
300          dest = _name+"_prediction_unit_glue";
301#ifdef POSITION
302          _component->interface_map (src ,"decod_"+toString(i),
303                                     dest,"decod_btb_"+toString(i));
304#endif
305
306          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_VAL"            ,
307                                   dest,"out_DECOD_BTB_"+toString(i)+"_VAL"            );
308          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_ACK"            ,
309                                   dest, "in_DECOD_BTB_"+toString(i)+"_ACK"            );
310          if (_param->_have_port_context_id)
311          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_CONTEXT_ID"     ,
312                                   dest,"out_DECOD_BTB_"+toString(i)+"_CONTEXT_ID"     );
313          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_ADDRESS_SRC"    ,
314                                   dest,"out_DECOD_BTB_"+toString(i)+"_ADDRESS_SRC"    );
315          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_ADDRESS_DEST"   ,
316                                   dest,"out_DECOD_BTB_"+toString(i)+"_ADDRESS_DEST"   );
317          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_CONDITION"      ,
318                                   dest,"out_DECOD_BTB_"+toString(i)+"_CONDITION"      );
319          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_LAST_TAKE"      ,
320                                   dest,"out_DECOD_BTB_"+toString(i)+"_LAST_TAKE"      );
321          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_MISS_PREDICTION",
322                                   dest,"out_DECOD_BTB_"+toString(i)+"_MISS_PREDICTION");
323          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_IS_ACCURATE"    ,
324                                   dest,"out_DECOD_BTB_"+toString(i)+"_IS_ACCURATE"    );
325        }
326
327      for (uint32_t i=0; i<_param->_nb_inst_branch_update; i++)
328        {
329          dest = _name+"_prediction_unit_glue";
330
331          COMPONENT_MAP(_component,src , "in_UPDATE_"    +toString(i)+"_VAL",
332                                   dest,"out_UPDATE_BTB_"+toString(i)+"_VAL");
333          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_ACK",
334                                   dest, "in_UPDATE_BTB_"+toString(i)+"_ACK");
335
336          dest = _name+"_update_prediction_table";
337#ifdef POSITION
338          _component->interface_map (src ,"update_"+toString(i),
339                                     dest,"update_"+toString(i));
340#endif
341
342          if (_param->_have_port_context_id)
343          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_CONTEXT_ID"     ,
344                                   dest,"out_UPDATE_"+toString(i)+    "_CONTEXT_ID"     );
345          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_ADDRESS_SRC"    ,
346                                   dest,"out_UPDATE_"+toString(i)+"_BTB_ADDRESS_SRC"    );
347          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_ADDRESS_DEST"   ,
348                                   dest,"out_UPDATE_"+toString(i)+"_BTB_ADDRESS_DEST"   );
349          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_CONDITION"      ,
350                                   dest,"out_UPDATE_"+toString(i)+"_BTB_CONDITION"      );
351          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_LAST_TAKE"      ,
352                                   dest,"out_UPDATE_"+toString(i)+    "_DIRECTION_GOOD" );
353          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_MISS_PREDICTION",
354                                   dest,"out_UPDATE_"+toString(i)+    "_MISS_PREDICTION");
355        }
356    }
357
358    // ===================================================================
359    // =====[ direction ]=================================================
360    // ===================================================================
361    {
362      src = _name+"_direction";
363      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
364           
365      {
366        dest = _name;
367#ifdef POSITION
368        _component->interface_map (src ,"",
369                                   dest,"");
370#endif
371        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
372        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
373      }
374
375      for (uint32_t i=0; i<_param->_nb_inst_branch_predict; i++)
376        {
377          dest = _name+"_prediction_unit_glue";
378#ifdef POSITION
379          _component->interface_map (src ,"predict_"+toString(i),
380                                     dest,"predict_dir_"+toString(i));
381#endif
382
383          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_VAL"        ,
384                                   dest,"out_PREDICT_DIR_"+toString(i)+"_VAL"        );
385          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ACK"        ,
386                                   dest, "in_PREDICT_DIR_"+toString(i)+"_ACK"        );
387          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_ADDRESS_SRC",
388                                   dest,"out_PREDICT_DIR_"+toString(i)+"_ADDRESS_SRC");
389          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_STATIC"     ,
390                                   dest,"out_PREDICT_DIR_"+toString(i)+"_STATIC"     );
391          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_DIRECTION"  ,
392                                   dest, "in_PREDICT_DIR_"+toString(i)+"_DIRECTION"  );
393
394          dest = _name+"_update_prediction_table";
395          if (_param->_have_port_history)
396          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_HISTORY"  ,
397                                   dest, "in_PREDICT_"    +toString(i)+"_DIR_HISTORY"  );
398          //out_PREDICT_DIR_LAST_TAKE - component_map branch_target_buffer
399        }
400
401      for (uint32_t i=0; i<_param->_nb_inst_branch_update; i++)
402        {
403          dest = _name+"_prediction_unit_glue";
404
405          COMPONENT_MAP(_component,src , "in_UPDATE_"    +toString(i)+"_VAL",
406                                   dest,"out_UPDATE_DIR_"+toString(i)+"_VAL");
407          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_ACK",
408                                   dest, "in_UPDATE_DIR_"+toString(i)+"_ACK");
409
410          dest = _name+"_update_prediction_table";
411#ifdef POSITION
412          _component->interface_map (src ,"update_"+toString(i),
413                                     dest,"update_"+toString(i));
414#endif
415
416          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_ADDRESS"  ,
417                                   dest,"out_UPDATE_"+toString(i)+"_BTB_ADDRESS_SRC");
418          if (_param->_have_port_history)
419          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_HISTORY"  ,
420                                   dest,"out_UPDATE_"+toString(i)+"_DIR_HISTORY"  );
421          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_DIRECTION",
422                                   dest,"out_UPDATE_"+toString(i)+    "_DIRECTION_GOOD");
423         
424        }
425    }
426
427    // ===================================================================
428    // =====[ return_address_stack ]======================================
429    // ===================================================================
430    {
431      src = _name+"_return_address_stack";
432      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
433
434           
435      {
436        dest = _name;
437#ifdef POSITION
438        _component->interface_map (src ,"",
439                                   dest,"");
440#endif
441        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
442        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
443      }
444
445      for (uint32_t i=0; i<_param->_nb_inst_branch_predict; i++)
446        {
447          dest = _name+"_prediction_unit_glue";
448#ifdef POSITION
449          _component->interface_map (src ,"predict_"+toString(i),
450                                     dest,"predict_dir_"+toString(i));
451#endif
452         
453          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_VAL"         ,
454                                   dest,"out_PREDICT_RAS_"+toString(i)+"_VAL"         );
455          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ACK"         ,
456                                   dest, "in_PREDICT_RAS_"+toString(i)+"_ACK"         );
457          if (_param->_have_port_context_id)
458          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_CONTEXT_ID"  ,
459                                   dest,"out_PREDICT_RAS_"+toString(i)+"_CONTEXT_ID"  );
460          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_HIT"         ,
461                                   dest, "in_PREDICT_RAS_"+toString(i)+"_HIT"         ); 
462          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_PUSH"        ,
463                                   dest,"out_PREDICT_RAS_"+toString(i)+"_PUSH"        );
464          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_ADDRESS_PUSH",
465                                   dest,"out_PREDICT_RAS_"+toString(i)+"_ADDRESS_PUSH");
466          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ADDRESS_POP" ,
467                                   dest, "in_PREDICT_RAS_"+toString(i)+"_ADDRESS_POP" );
468
469          dest = _name+"_update_prediction_table";
470          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_INDEX",
471                                   dest, "in_PREDICT_"    +toString(i)+"_RAS_INDEX");
472        }
473     
474      for (uint32_t i=0; i<_param->_nb_inst_branch_decod; i++)
475        {
476          dest = _name+"_prediction_unit_glue";
477#ifdef POSITION
478          _component->interface_map (src ,"decod_"+toString(i),
479                                     dest,"decod_ras_"+toString(i));
480#endif
481         
482          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_VAL"            ,
483                                   dest,"out_DECOD_RAS_"+toString(i)+"_VAL"            );
484          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_ACK"            ,
485                                   dest, "in_DECOD_RAS_"+toString(i)+"_ACK"            );
486          if (_param->_have_port_context_id)
487          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_CONTEXT_ID"     ,
488                                   dest,"out_DECOD_RAS_"+toString(i)+"_CONTEXT_ID"     ); 
489          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_HIT"            ,
490                                   dest, "in_DECOD_RAS_"+toString(i)+"_HIT"            ); 
491          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_PUSH"           ,
492                                   dest,"out_DECOD_RAS_"+toString(i)+"_PUSH"           );
493          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_ADDRESS_PUSH"   ,
494                                   dest,"out_DECOD_RAS_"+toString(i)+"_ADDRESS_PUSH"   );
495          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_ADDRESS_POP"    ,
496                                   dest, "in_DECOD_RAS_"+toString(i)+"_ADDRESS_POP"    );
497          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_MISS_PREDICTION",
498                                   dest,"out_DECOD_RAS_"+toString(i)+"_MISS_PREDICTION");
499
500          dest = _name+"_update_prediction_table";
501          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_INDEX"          ,
502                                   dest, "in_DECOD_"    +toString(i)+"_RAS_INDEX"      ); 
503        }
504
505      for (uint32_t i=0; i<_param->_nb_inst_branch_update; i++)
506        {
507          dest = _name+"_prediction_unit_glue";
508
509          COMPONENT_MAP(_component,src , "in_UPDATE_"    +toString(i)+"_VAL",
510                                   dest,"out_UPDATE_RAS_"+toString(i)+"_VAL");
511          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_ACK",
512                                   dest, "in_UPDATE_RAS_"+toString(i)+"_ACK");
513
514          dest = _name+"_update_prediction_table";
515#ifdef POSITION
516          _component->interface_map (src ,"update_"+toString(i),
517                                     dest,"update_"+toString(i));
518#endif
519
520          if (_param->_have_port_context_id)
521          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_CONTEXT_ID"       ,
522                                   dest,"out_UPDATE_"+toString(i)+    "_CONTEXT_ID"       );
523          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_PUSH"             ,
524                                   dest,"out_UPDATE_"+toString(i)+"_RAS_PUSH"             );
525          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_FLUSH"            ,
526                                   dest,"out_UPDATE_"+toString(i)+"_RAS_FLUSH"            );
527          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_ADDRESS"          ,
528                                   dest,"out_UPDATE_"+toString(i)+"_RAS_ADDRESS"          );
529          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_INDEX"            ,
530                                   dest,"out_UPDATE_"+toString(i)+"_RAS_INDEX"            );
531          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_MISS_PREDICTION"  ,
532                                   dest,"out_UPDATE_"+toString(i)+    "_MISS_PREDICTION"  );
533          COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+    "_PREDICTION_IFETCH",
534                                   dest,"out_UPDATE_"+toString(i)+"_RAS_PREDICTION_IFETCH");
535        }
536    }
537
538    // ===================================================================
539    // =====[ update_prediction_table ]===================================
540    // ===================================================================
541    {
542      src = _name+"_update_prediction_table";
543      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
544           
545      {
546        dest = _name;
547#ifdef POSITION
548        _component->interface_map (src ,"",
549                                   dest,"");
550#endif
551        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
552        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
553      }
554
555      for (uint32_t i=0; i<_param->_nb_inst_branch_predict; i++)
556        {
557          dest = _name+"_prediction_unit_glue";
558#ifdef POSITION
559          _component->interface_map (src ,"predict_"+toString(i),
560                                     dest,"predict_dir_"+toString(i));
561#endif
562     
563          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_VAL"             ,
564                                   dest,"out_PREDICT_UPT_"+toString(i)+"_VAL"             );
565          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+"_ACK"             ,
566                                   dest, "in_PREDICT_UPT_"+toString(i)+"_ACK"             );
567          if (_param->_have_port_context_id)
568          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_CONTEXT_ID"      ,
569                                   dest,"out_PREDICT_UPT_"+toString(i)+"_CONTEXT_ID"      );
570          if (_param->_have_port_depth)
571          COMPONENT_MAP(_component,src ,"out_PREDICT_"    +toString(i)+       "_UPDATE_PREDICTION_ID",
572                                   dest, "in_PREDICT_UPT_"+toString(i)+"_BRANCH_UPDATE_PREDICTION_ID");
573          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_BTB_ADDRESS_SRC" ,
574                                   dest,"out_PREDICT_UPT_"+toString(i)+"_BTB_ADDRESS_SRC" );
575          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_BTB_ADDRESS_DEST",
576                                   dest,"out_PREDICT_UPT_"+toString(i)+"_BTB_ADDRESS_DEST");
577          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_BTB_CONDITION"   ,
578                                   dest,"out_PREDICT_UPT_"+toString(i)+"_BTB_CONDITION"   );
579          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_BTB_LAST_TAKE"   ,
580                                   dest,"out_PREDICT_UPT_"+toString(i)+"_BTB_LAST_TAKE"   );
581          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_BTB_IS_ACCURATE" ,
582                                   dest,"out_PREDICT_UPT_"+toString(i)+"_BTB_IS_ACCURATE" );
583          COMPONENT_MAP(_component,src , "in_PREDICT_"    +toString(i)+"_RAS_ADDRESS"     ,
584                                   dest,"out_PREDICT_UPT_"+toString(i)+"_RAS_ADDRESS"     );
585
586          //out_PREDICT_HISTORY   - component_map direction
587          // in_PREDICT_RAS_INDEX - component_map return_address_stack
588        }
589
590      for (uint32_t i=0; i<_param->_nb_inst_branch_decod; i++)
591        {
592          dest = _name+"_prediction_unit_glue";
593         
594          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_VAL"                 ,
595                                   dest,"out_DECOD_UPT_"+toString(i)+"_VAL"                 );
596          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_ACK"                 ,
597                                   dest, "in_DECOD_UPT_"+toString(i)+"_ACK"                 );
598          if (_param->_have_port_context_id)
599          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_CONTEXT_ID"          ,
600                                   dest,"out_DECOD_UPT_"+toString(i)+"_CONTEXT_ID"          );
601          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_BTB_ADDRESS_SRC"     ,
602                                   dest,"out_DECOD_UPT_"+toString(i)+"_BTB_ADDRESS_SRC"     );
603          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_BTB_ADDRESS_DEST"    ,
604                                   dest,"out_DECOD_UPT_"+toString(i)+"_BTB_ADDRESS_DEST"    );
605          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_BTB_CONDITION"       ,
606                                   dest,"out_DECOD_UPT_"+toString(i)+"_BTB_CONDITION"       );
607          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_BTB_LAST_TAKE"       ,
608                                   dest,"out_DECOD_UPT_"+toString(i)+"_BTB_LAST_TAKE"       );
609          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_RAS_ADDRESS"         ,
610                                   dest,"out_DECOD_UPT_"+toString(i)+"_RAS_ADDRESS"         );
611          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_MISS_IFETCH"         ,
612                                   dest,"out_DECOD_UPT_"+toString(i)+"_MISS_IFETCH"         ); 
613          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_MISS_DECOD"          ,
614                                   dest,"out_DECOD_UPT_"+toString(i)+"_MISS_DECOD"          ); 
615          if (_param->_have_port_depth)
616          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_UPDATE_PREDICTION_ID",
617                                   dest,"out_DECOD_UPT_"+toString(i)+"_UPDATE_PREDICTION_ID");
618          COMPONENT_MAP(_component,src , "in_DECOD_"    +toString(i)+"_IS_ACCURATE"         ,
619                                   dest,"out_DECOD_UPT_"+toString(i)+"_IS_ACCURATE"         );
620          COMPONENT_MAP(_component,src ,"out_DECOD_"    +toString(i)+"_CAN_CONTINUE"        ,
621                                   dest, "in_DECOD_UPT_"+toString(i)+"_CAN_CONTINUE"        );
622         
623          //out_DECOD_UPT_RAS_INDEX - component_map return_address_stack
624        }
625
626      for (uint32_t i=0; i<_param->_nb_inst_branch_update; i++)
627        {
628          dest = _name+"_prediction_unit_glue";
629
630#ifdef POSITION
631          _component->interface_map (src ,"update_"+toString(i),
632                                     dest,"update_upt_"+toString(i));
633#endif
634
635          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_VAL",
636                                   dest, "in_UPDATE_UPT_"+toString(i)+"_VAL");
637          COMPONENT_MAP(_component,src , "in_UPDATE_"    +toString(i)+"_ACK",
638                                   dest,"out_UPDATE_UPT_"+toString(i)+"_ACK");
639
640          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_BTB_VAL",
641                                   dest, "in_UPDATE_UPT_"+toString(i)+"_BTB_VAL");
642          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_DIR_VAL",
643                                   dest, "in_UPDATE_UPT_"+toString(i)+"_DIR_VAL");
644          COMPONENT_MAP(_component,src ,"out_UPDATE_"    +toString(i)+"_RAS_VAL",
645                                   dest, "in_UPDATE_UPT_"+toString(i)+"_RAS_VAL");
646
647          //in_UPDATE_UPT_CONTEXT_ID            - component_map branch_target_buffer
648          //in_UPDATE_UPT_MISS_PREDICTION       - component_map branch_target_buffer
649          //in_UPDATE_UPT_DIRECTION_GOOD        - component_map branch_target_buffer
650          //in_UPDATE_UPT_BTB_ADDRESS_SRC       - component_map branch_target_buffer
651          //in_UPDATE_UPT_BTB_ADDRESS_DEST      - component_map branch_target_buffer
652          //in_UPDATE_UPT_BTB_CONDITION         - component_map branch_target_buffer
653          //in_UPDATE_UPT_DIR_HISTORY           - component_map direction
654          //in_UPDATE_UPT_RAS_ADDRESS           - component_map return_address_stack
655          //in_UPDATE_UPT_RAS_PUSH              - component_map return_address_stack
656          //in_UPDATE_UPT_RAS_FLUSH             - component_map return_address_stack
657          //in_UPDATE_UPT_RAS_INDEX             - component_map return_address_stack
658          //in_UPDATE_UPT_RAS_PREDICTION_IFETCH - component_map return_address_stack
659        }
660
661      for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++)
662        {
663          dest = _name;
664
665#ifdef POSITION
666          _component->interface_map (src ,"complete_"+toString(i),
667                                     dest,"complete_"+toString(i));
668#endif
669
670          PORT_MAP(_component,src , "in_BRANCH_COMPLETE_"+toString(i)+"_VAL"            ,
671                              dest, "in_BRANCH_COMPLETE_"+toString(i)+"_VAL"            );
672          PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ACK"            ,
673                              dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ACK"            );
674          if (_param->_have_port_context_id)
675          PORT_MAP(_component,src , "in_BRANCH_COMPLETE_"+toString(i)+"_CONTEXT_ID"     ,
676                              dest, "in_BRANCH_COMPLETE_"+toString(i)+"_CONTEXT_ID"     );
677          if (_param->_have_port_depth)
678          PORT_MAP(_component,src , "in_BRANCH_COMPLETE_"+toString(i)+"_DEPTH"          ,
679                              dest, "in_BRANCH_COMPLETE_"+toString(i)+"_DEPTH"          );
680          PORT_MAP(_component,src , "in_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS"        ,
681                              dest, "in_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS"        );
682          PORT_MAP(_component,src , "in_BRANCH_COMPLETE_"+toString(i)+"_NO_SEQUENCE"    ,
683                              dest, "in_BRANCH_COMPLETE_"+toString(i)+"_NO_SEQUENCE"    );
684          PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_MISS_PREDICTION",
685                              dest,"out_BRANCH_COMPLETE_"+toString(i)+"_MISS_PREDICTION");
686//        PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_TAKE"           ,
687//                            dest,"out_BRANCH_COMPLETE_"+toString(i)+"_TAKE"           );
688//        PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_SRC"    ,
689//                            dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_SRC"    );
690//        PORT_MAP(_component,src ,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_DEST"   ,
691//                            dest,"out_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS_DEST"   );
692        }
693
694      for (uint32_t i=0; i<_param->_nb_context; i++)
695        {
696          dest = _name;
697
698#ifdef POSITION
699          _component->interface_map (src ,"branch_event_"+toString(i),
700                                     dest,"branch_event_"+toString(i));
701#endif
702
703          PORT_MAP(_component,src ,"out_BRANCH_EVENT_"+toString(i)+"_VAL"             ,dest,"out_BRANCH_EVENT_"+toString(i)+"_VAL"             );
704          PORT_MAP(_component,src , "in_BRANCH_EVENT_"+toString(i)+"_ACK"             ,dest, "in_BRANCH_EVENT_"+toString(i)+"_ACK"             );
705          if (_param->_have_port_depth)
706          PORT_MAP(_component,src ,"out_BRANCH_EVENT_"+toString(i)+"_DEPTH"           ,dest,"out_BRANCH_EVENT_"+toString(i)+"_DEPTH"           );
707          PORT_MAP(_component,src ,"out_BRANCH_EVENT_"+toString(i)+"_ADDRESS_SRC"     ,dest,"out_BRANCH_EVENT_"+toString(i)+"_ADDRESS_SRC"     );
708          PORT_MAP(_component,src ,"out_BRANCH_EVENT_"+toString(i)+"_ADDRESS_DEST_VAL",dest,"out_BRANCH_EVENT_"+toString(i)+"_ADDRESS_DEST_VAL");
709          PORT_MAP(_component,src ,"out_BRANCH_EVENT_"+toString(i)+"_ADDRESS_DEST"    ,dest,"out_BRANCH_EVENT_"+toString(i)+"_ADDRESS_DEST"    );
710        }
711
712      for (uint32_t i=0; i<_param->_nb_context; i++)
713        {
714          dest = _name;
715
716#ifdef POSITION
717          _component->interface_map (src ,"event_"+toString(i),
718                                     dest,"event_"+toString(i));
719#endif
720
721          PORT_MAP(_component,src , "in_EVENT_"+toString(i)+"_VAL"  ,dest, "in_EVENT_"+toString(i)+"_VAL"  );
722          PORT_MAP(_component,src ,"out_EVENT_"+toString(i)+"_ACK"  ,dest,"out_EVENT_"+toString(i)+"_ACK"  );
723          PORT_MAP(_component,src , "in_EVENT_"+toString(i)+"_TYPE" ,dest, "in_EVENT_"+toString(i)+"_TYPE" );
724          if (_param->_have_port_depth)
725          PORT_MAP(_component,src , "in_EVENT_"+toString(i)+"_DEPTH",dest, "in_EVENT_"+toString(i)+"_DEPTH");
726        }
727
728      for (uint32_t i=0; i<_param->_nb_context; i++)
729        {
730          dest = _name;
731#ifdef POSITION
732          _component->interface_map (src ,"depth_"+toString(i),
733                                     dest,"depth_"+toString(i));
734#endif
735         
736          PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_VAL",
737                              dest,"out_DEPTH_"+toString(i)+"_VAL");
738          PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_FULL",
739                              dest,"out_DEPTH_"+toString(i)+"_FULL");
740          if (_param->_have_port_depth)
741            {
742          PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_CURRENT",
743                              dest,"out_DEPTH_"+toString(i)+"_CURRENT");
744          PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_MIN",
745                              dest,"out_DEPTH_"+toString(i)+"_MIN");
746          PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_MAX",
747                              dest,"out_DEPTH_"+toString(i)+"_MAX");
748            }
749        }
750
751//       for (uint32_t i=0; i<_param->_nb_context; i++)
752//      {
753//        dest = _name+"_prediction_unit_glue";
754         
755// #ifdef POSITION
756//        _component->interface_map (src ,"depth_"+toString(i),
757//                                   dest,"depth_"+toString(i));
758// #endif
759         
760//        COMPONENT_MAP(_component,src ,"out_DEPTH_"+toString(i)+    "_NB_BRANCH",
761//                                 dest, "in_DEPTH_"+toString(i)+"_UPT_NB_BRANCH");
762
763//        if (_param->_have_port_depth)
764//        COMPONENT_MAP(_component,src ,"out_DEPTH_"+toString(i)+    "_TAIL"     ,
765//                                 dest, "in_DEPTH_"+toString(i)+"_UPT_TAIL"     );
766//      }
767    }
768
769    // ===================================================================
770    // =====[ prediction_unit_glue ]======================================
771    // ===================================================================
772    {
773      src = _name+"_prediction_unit_glue";
774      log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str());
775           
776      {
777        dest = _name;
778#ifdef POSITION
779        _component->interface_map (src ,"",
780                                   dest,"");
781#endif
782
783        PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK");
784        PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET");
785      }
786
787      for (uint32_t i=0; i<_param->_nb_context; i++)
788        {
789          dest = _name;
790#ifdef POSITION
791          _component->interface_map (src ,"predict_"+toString(i),
792                                     dest,"predict_"+toString(i));
793#endif
794         
795          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL"                        ,
796                              dest, "in_PREDICT_"+toString(i)+"_VAL"                        );
797          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK"                        ,
798                              dest,"out_PREDICT_"+toString(i)+"_ACK"                        );
799          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PC_PREVIOUS"                ,
800                              dest, "in_PREDICT_"+toString(i)+"_PC_PREVIOUS"                );
801          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PC_CURRENT"                 ,
802                              dest, "in_PREDICT_"+toString(i)+"_PC_CURRENT"                 );
803          PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_PC_CURRENT_IS_DS_TAKE"      ,
804                              dest, "in_PREDICT_"+toString(i)+"_PC_CURRENT_IS_DS_TAKE"      );
805          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PC_NEXT"                    ,
806                              dest,"out_PREDICT_"+toString(i)+"_PC_NEXT"                    );
807          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_PC_NEXT_IS_DS_TAKE"         ,
808                              dest,"out_PREDICT_"+toString(i)+"_PC_NEXT_IS_DS_TAKE"         );
809          if (_param->_have_port_inst_ifetch_ptr)
810          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_INST_IFETCH_PTR"            ,
811                              dest,"out_PREDICT_"+toString(i)+"_INST_IFETCH_PTR"            );
812          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_STATE"               ,
813                              dest,"out_PREDICT_"+toString(i)+"_BRANCH_STATE"               );
814          if (_param->_have_port_depth)
815          PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_BRANCH_UPDATE_PREDICTION_ID",
816                              dest,"out_PREDICT_"+toString(i)+"_BRANCH_UPDATE_PREDICTION_ID");
817         
818          for (uint32_t j=0; j<_param->_nb_instruction[i]; j++)
819            {
820              dest = _name;
821#ifdef POSITION
822              _component->interface_map (src ,"predict_"+toString(i)+"_"+toString(j),
823                                         dest,"predict_"+toString(i)+"_"+toString(j));
824#endif
825             
826              PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_"+toString(j)+"_INSTRUCTION_ENABLE",
827                                  dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+"_INSTRUCTION_ENABLE");
828            }
829        }
830
831      for (uint32_t i=0; i<_param->_nb_decod_unit; i++)
832        for (uint32_t j=0; j<_param->_nb_inst_decod[i]; j++)
833          {
834            dest = _name;
835#ifdef POSITION
836            _component->interface_map (src ,"decod_"+toString(i),
837                                       dest,"decod_"+toString(i));
838#endif
839           
840            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_VAL"                        ,
841                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_VAL"                        );
842            PORT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_"+toString(j)+"_ACK"                        ,
843                                dest,"out_DECOD_"+toString(i)+"_"+toString(j)+"_ACK"                        );
844            if (_param->_have_port_context_id)
845            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_CONTEXT_ID"                 ,
846                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_CONTEXT_ID"                 );
847            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_MATCH_INST_IFETCH_PTR"      ,
848                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_MATCH_INST_IFETCH_PTR"      );
849            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_STATE"               ,
850                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_STATE"               );
851            if (_param->_have_port_depth)
852            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_UPDATE_PREDICTION_ID",
853                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_UPDATE_PREDICTION_ID");
854            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_CONDITION"           ,
855                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_CONDITION"           );
856            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_DIRECTION"           ,
857                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_BRANCH_DIRECTION"           );
858            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_ADDRESS_SRC"                ,
859                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_ADDRESS_SRC"                );
860            PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_"+toString(j)+"_ADDRESS_DEST"               ,
861                                dest, "in_DECOD_"+toString(i)+"_"+toString(j)+"_ADDRESS_DEST"               );
862            PORT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_"+toString(j)+"_CAN_CONTINUE"               ,
863                                dest,"out_DECOD_"+toString(i)+"_"+toString(j)+"_CAN_CONTINUE"               );
864          }
865
866//       for (uint32_t i=0; i<_param->_nb_context; i++)
867//      {
868//        dest = _name;
869// #ifdef POSITION
870//        _component->interface_map (src ,"depth_"+toString(i),
871//                                   dest,"depth_"+toString(i));
872// #endif
873         
874//        PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_NB_BRANCH",dest,"out_DEPTH_"+toString(i)+"_NB_BRANCH");
875//        if (_param->_have_port_depth)
876//        PORT_MAP(_component,src ,"out_DEPTH_"+toString(i)+"_TAIL"     ,dest,"out_DEPTH_"+toString(i)+"_TAIL"     );
877//      }
878    }
879
880    // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
881#if DEBUG_Prediction_unit == true
882    _component->test_map();
883#endif
884
885#ifdef POSITION
886    if (usage_is_set(_usage,USE_POSITION))
887      _component->generate_file();
888#endif
889
890    log_printf(FUNC,Prediction_unit,FUNCTION,"End");
891  };
892
893}; // end namespace prediction_unit
894}; // end namespace front_end
895}; // end namespace multi_front_end
896}; // end namespace core
897
898}; // end namespace behavioural
899}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.