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

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

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

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