Changeset 115 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor
- Timestamp:
- Apr 20, 2009, 11:29:17 PM (15 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h
r112 r115 44 44 45 45 public : Thistory_t _bht_history_mask ; 46 public : Thistory_t _bht_history_ rshift;46 public : Thistory_t _bht_history_shift ; 47 47 public : Thistory_t _pht_history_mask ; 48 public : Thistory_t _pht_history_ rshift;48 public : Thistory_t _pht_history_shift ; 49 49 50 50 public : uint32_t _bht_size_address ; … … 55 55 public : uint32_t _pht_size_bank ; 56 56 public : Taddress_t _pht_address_share_mask ; 57 public : Taddress_t _pht_address_share_ lshift;57 public : Taddress_t _pht_address_share_shift ; 58 58 public : Taddress_t _pht_address_bank_mask ; 59 public : Taddress_t _pht_address_bank_ rshift;59 public : Taddress_t _pht_address_bank_shift ; 60 60 61 61 public : Thistory_t _bht_init_take ; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h
r112 r115 88 88 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89 89 private : Thistory_t * reg_BHT ;//[bht_nb_shifter] 90 private : Thistory_t ** reg_PHT ;//[pht_nb_ counter][pht_nb_bank]90 private : Thistory_t ** reg_PHT ;//[pht_nb_bank][pht_size_bank] 91 91 92 92 // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Parameters.cpp
r112 r115 57 57 // MSB : pht_history 58 58 // LSB : bht_history 59 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _have_bht : %d",_have_bht ); 60 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _bht_size_shifter : %d",_bht_size_shifter); 61 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _bht_nb_shifter : %d",_bht_nb_shifter ); 62 63 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _have_pht : %d",_have_pht ); 64 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_size_counter : %d",_pht_size_counter); 65 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_nb_counter : %d",_pht_nb_counter ); 59 66 60 67 _size_history = _bht_size_shifter + _pht_size_counter; 61 68 _bht_history_mask = gen_mask<Thistory_t>(_bht_size_shifter); 62 _bht_history_ rshift= 0;69 _bht_history_shift = 0; 63 70 _pht_history_mask = gen_mask<Thistory_t>(_pht_size_counter); 64 _pht_history_ rshift= _bht_size_shifter;71 _pht_history_shift = _bht_size_shifter; 65 72 66 73 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _size_history : %d",_size_history ); 67 74 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);75 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _bht_history_shift : %d",_bht_history_shift ); 69 76 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);77 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_history_shift : %d",_pht_history_shift ); 71 78 72 _bht_init_take = (Thistory_t)(-1)&_bht_history_mask;79 _bht_init_take = static_cast<Thistory_t>(-1)&_bht_history_mask; 73 80 _bht_init_ntake = 0; 74 81 _pht_init_take = (1<<(_pht_size_counter-1)); // size = 4 : 1000/2 … … 91 98 _pht_counter_max = (1<<_pht_size_counter)-1; 92 99 93 _pht_nb_bank = (_pht_nb_counter - (1<<_bht_size_shifter))+1; 94 _pht_size_bank = _pht_nb_counter / _pht_nb_bank; 100 _pht_size_bank = (_have_bht)?(1<<_bht_size_shifter):1; 101 _pht_nb_bank = _pht_nb_counter / _pht_size_bank; 102 103 // -------->| 104 // +---+ | 105 // | | |---> 106 // ---> --->| 107 // | | | 108 // +---+ 109 // 95 110 96 111 _pht_address_share_mask = gen_mask<Taddress_t>(_pht_size_address_share); 97 _pht_address_share_ lshift= _bht_size_shifter-_pht_size_address_share;112 _pht_address_share_shift = _bht_size_shifter-_pht_size_address_share; 98 113 _pht_address_bank_mask = gen_mask<Taddress_t>(log2(_pht_nb_bank)); 99 _pht_address_bank_ rshift= _pht_size_address_share;114 _pht_address_bank_shift = _pht_size_address_share; 100 115 101 116 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_nb_bank : %d" ,_pht_nb_bank ); 102 117 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_size_bank : %d" ,_pht_size_bank ); 103 118 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);119 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_address_share_shift : %d" ,_pht_address_share_shift ); 105 120 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);121 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_address_bank_shift : %d" ,_pht_address_bank_shift ); 107 122 } 108 123 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_genMealy_predict.cpp
r111 r115 52 52 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_num_reg : %d",bht_num_reg); 53 53 54 history = (bht_history << _param->_bht_history_ rshift)&_param->_bht_history_mask ;54 history = (bht_history << _param->_bht_history_shift )&_param->_bht_history_mask ; 55 55 direction = (bht_history >> (_param->_bht_size_shifter-1))&1; 56 56 … … 61 61 if (_param->_have_pht) 62 62 { 63 Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask; 64 Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift)); 63 Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_shift )&_param->_pht_address_bank_mask; 64 Thistory_t pht_num_reg = (pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_shift)); 65 66 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history : 0x%x",pht_bht_history); 67 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_reg : %d",pht_num_reg); 68 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_bank : %d",pht_num_bank); 69 65 70 Thistory_t pht_history = reg_PHT [pht_num_bank][pht_num_reg]; 66 71 67 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history : 0x%x",pht_bht_history);68 72 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_history : 0x%x",pht_history); 69 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_reg : %d",pht_num_reg);70 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_bank : %d",pht_num_bank);71 73 72 history |= (pht_history << _param->_pht_history_ rshift)&_param->_pht_history_mask;74 history |= (pht_history << _param->_pht_history_shift )&_param->_pht_history_mask; 73 75 direction = (pht_history >> (_param->_pht_size_counter-1))&1; 74 76 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src/Two_Level_Branch_Predictor_transition.cpp
r112 r115 117 117 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht"); 118 118 119 Thistory_t bht_history = (history>>_param->_bht_history_ rshift)&_param->_bht_history_mask;119 Thistory_t bht_history = (history>>_param->_bht_history_shift )&_param->_bht_history_mask; 120 120 Thistory_t bht_num_reg = address & _param->_bht_address_mask; 121 121 … … 125 125 // BHT : shift register 126 126 if (not history_val) 127 bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake; 127 { 128 bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake; 129 } 128 130 else 129 bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ; 131 { 132 bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ; 133 } 130 134 131 135 pht_bht_history = bht_history; … … 138 142 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht"); 139 143 140 Thistory_t pht_history = (history>>_param->_pht_history_ rshift)&_param->_pht_history_mask;141 Thistory_t pht_num_ reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift);142 Thistory_t pht_num_ bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask;144 Thistory_t pht_history = (history>>_param->_pht_history_shift )&_param->_pht_history_mask; 145 Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_shift )&_param->_pht_address_bank_mask; 146 Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_shift); 143 147 144 148 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (old): %x",pht_bht_history); … … 149 153 // PHT : saturation counter 150 154 if (not history_val) 151 pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake; 155 { 156 pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake; 157 } 152 158 else 153 pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history)); 159 { 160 pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history)); 161 } 154 162 155 163 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_history (new): %x",pht_history);
Note: See TracChangeset
for help on using the changeset viewer.