source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/src/Branch_Target_Buffer_allocation.cpp @ 108

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

1) decod_queue : add reg_LAST_SLOT.
2) Commit : insert on event -> to pop decod_queue. Head test : add information (speculative or not)
3) Context State / UPT : Branch miss and Load miss in same cycle.
4) Free List : Bank is on LSB not MSB.
5) Platforms : move data

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