source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.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: 6.4 KB
Line 
1/*
2 * $Id: Parameters.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/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h"
9#include "Common/include/BitManipulation.h"
10
11namespace morpheo {
12namespace behavioural {
13namespace core {
14namespace multi_front_end {
15namespace front_end {
16namespace prediction_unit {
17namespace direction {
18namespace meta_predictor {
19namespace two_level_branch_predictor {
20
21
22#undef  FUNCTION
23#define FUNCTION "Two_Level_Branch_Predictor::Parameters"
24  Parameters::Parameters (uint32_t nb_inst_predict       ,
25                          uint32_t nb_inst_update        ,
26                          uint32_t size_address          ,
27                          bool     have_bht              ,
28                          uint32_t bht_size_shifter      ,
29                          uint32_t bht_nb_shifter        ,
30                          bool     have_pht              ,
31                          uint32_t pht_size_counter      ,
32                          uint32_t pht_nb_counter        ,
33                          uint32_t pht_size_address_share,
34                          bool     update_on_prediction  ,
35                          bool is_toplevel)
36  {
37    log_begin(Two_Level_Branch_Predictor,FUNCTION);
38
39    _nb_inst_predict         = nb_inst_predict       ;
40    _nb_inst_update          = nb_inst_update        ;
41    _size_address            = size_address          ;
42    _have_bht                = have_bht              ;
43    _bht_size_shifter        = (have_bht)?(bht_size_shifter):0;
44    _bht_nb_shifter          = (have_bht)?(bht_nb_shifter  ):0;
45    _have_pht                = have_pht              ;
46    _pht_size_counter        = (have_pht)?(pht_size_counter):0;
47    _pht_nb_counter          = (have_pht)?(pht_nb_counter  ):0;
48    _pht_size_address_share  = (have_bht and have_pht)?(pht_size_address_share):0;
49    _update_on_prediction    = update_on_prediction  ;
50                             
51    _bht_size_address        = (_have_bht)?log2(_bht_nb_shifter):0;
52    _pht_size_address        = (_have_pht)?log2(_pht_nb_counter):0;
53                             
54    test();                 
55
56    // history to update_prediction_table :
57    //  MSB : pht_history
58    //  LSB : bht_history
59                       
60    _size_history            = _bht_size_shifter + _pht_size_counter;
61    _bht_history_mask        = gen_mask<Thistory_t>(_bht_size_shifter);
62    _bht_history_rshift      = 0;
63    _pht_history_mask        = gen_mask<Thistory_t>(_pht_size_counter);
64    _pht_history_rshift      = _bht_size_shifter;
65                             
66    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _size_history             : %d",_size_history  );
67    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_mask         : 0x%x",_bht_history_mask  );
68    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_history_rshift       : %d",_bht_history_rshift);
69    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_mask         : 0x%x",_pht_history_mask  );
70    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_history_rshift       : %d",_pht_history_rshift);
71
72    _bht_init_take           = (Thistory_t)(-1)&_bht_history_mask;
73    _bht_init_ntake          = 0;
74    _pht_init_take           = (1<<(_pht_size_counter-1)); // size = 4 : 1000/2
75    _pht_init_ntake          = _pht_init_take-1;           // size = 4 : 0111/2
76
77    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_init_take            : 0x%x",_bht_init_take );
78    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_init_ntake           : 0x%x",_bht_init_ntake);
79    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_init_take            : 0x%x",_pht_init_take );
80    log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_init_ntake           : 0x%x",_pht_init_ntake);
81   
82    if (_have_bht)
83      {
84        _bht_address_mask        = gen_mask<Taddress_t>(_bht_size_address);
85
86        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _bht_address_mask         : 0x%x",_bht_address_mask  );
87      }
88
89    if (_have_pht)
90      {
91        _pht_counter_max         = (1<<_pht_size_counter)-1;
92       
93        _pht_nb_bank             = (_pht_nb_counter - (1<<_bht_size_shifter))+1;
94        _pht_size_bank           = _pht_nb_counter / _pht_nb_bank;
95
96        _pht_address_share_mask  = gen_mask<Taddress_t>(_pht_size_address_share);
97        _pht_address_share_lshift= _bht_size_shifter-_pht_size_address_share;
98        _pht_address_bank_mask   = gen_mask<Taddress_t>(log2(_pht_nb_bank));
99        _pht_address_bank_rshift = _pht_size_address_share;
100
101        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_nb_bank              : %d"  ,_pht_nb_bank   );
102        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_size_bank            : %d"  ,_pht_size_bank );
103        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_mask   : 0x%x",_pht_address_share_mask  );
104        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_share_lshift : %d"  ,_pht_address_share_lshift);
105        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_mask    : 0x%x",_pht_address_bank_mask   );
106        log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION,"  * _pht_address_bank_rshift  : %d"  ,_pht_address_bank_rshift );
107      }
108
109    if (is_toplevel)
110      copy();
111
112    log_end(Two_Level_Branch_Predictor,FUNCTION);
113  };
114 
115// #undef  FUNCTION
116// #define FUNCTION "Two_Level_Branch_Predictor::Parameters (copy)"
117//   Parameters::Parameters (Parameters & param)
118//   {
119//     log_begin(Two_Level_Branch_Predictor,FUNCTION);
120//     test();
121//     log_end(Two_Level_Branch_Predictor,FUNCTION);
122//   };
123
124#undef  FUNCTION
125#define FUNCTION "Two_Level_Branch_Predictor::~Parameters"
126  Parameters::~Parameters (void) 
127  {
128    log_begin(Two_Level_Branch_Predictor,FUNCTION);
129    log_end(Two_Level_Branch_Predictor,FUNCTION);
130  };
131
132#undef  FUNCTION
133#define FUNCTION "Two_Level_Branch_Predictor::copy"
134  void Parameters::copy (void) 
135  {
136    log_begin(Two_Level_Branch_Predictor,FUNCTION);
137    log_end(Two_Level_Branch_Predictor,FUNCTION);
138  };
139
140}; // end namespace two_level_branch_predictor
141}; // end namespace meta_predictor
142}; // end namespace direction
143}; // end namespace prediction_unit
144}; // end namespace front_end
145}; // end namespace multi_front_end
146}; // end namespace core
147
148}; // end namespace behavioural
149}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.