Changeset 112 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/src
- Timestamp:
- Mar 18, 2009, 11:36:26 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/src
- Files:
-
- 4 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/src/Parameters.cpp
r111 r112 44 44 _bht_nb_shifter = (have_bht)?(bht_nb_shifter ):0; 45 45 _have_pht = have_pht ; 46 _pht_size_counter = (have_pht)?(pht_size_counter 47 _pht_nb_counter = (have_pht)?(pht_nb_counter 46 _pht_size_counter = (have_pht)?(pht_size_counter):0; 47 _pht_nb_counter = (have_pht)?(pht_nb_counter ):0; 48 48 _pht_size_address_share = (have_bht and have_pht)?(pht_size_address_share):0; 49 49 _update_on_prediction = update_on_prediction ; … … 54 54 test(); 55 55 56 // history to update_prediction_table : 57 // MSB : pht_history 58 // LSB : bht_history 59 56 60 _size_history = _bht_size_shifter + _pht_size_counter; 57 58 61 _bht_history_mask = gen_mask<Thistory_t>(_bht_size_shifter); 59 62 _bht_history_rshift = 0; … … 67 70 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * _pht_history_rshift : %d",_pht_history_rshift); 68 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 69 82 if (_have_bht) 70 83 { -
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_allocation.cpp
r111 r112 59 59 // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 60 60 { 61 ALLOC1_INTERFACE ("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict);61 ALLOC1_INTERFACE_BEGIN("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict); 62 62 63 63 ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); … … 71 71 ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); 72 72 } 73 74 ALLOC1_INTERFACE_END(_param->_nb_inst_predict); 73 75 } 74 76 75 77 // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 76 78 { 77 ALLOC1_INTERFACE ("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update);79 ALLOC1_INTERFACE_BEGIN("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update); 78 80 79 81 ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); … … 81 83 ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"ADDRESS" ,Taddress_t,_param->_size_address); 82 84 ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY ,"HISTORY" ,Thistory_t,_param->_size_history); 85 ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY_VAL ,"HISTORY_VAL" ,Tcontrol_t,1 ); 83 86 ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); 84 87 if (_param->_update_on_prediction) 85 88 ALLOC1_SIGNAL_IN ( in_UPDATE_MISS ,"MISS" ,Tcontrol_t,1 ); 89 90 ALLOC1_INTERFACE_END(_param->_nb_inst_update); 86 91 } 92 93 // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 87 94 88 95 if (usage_is_set(_usage,USE_SYSTEMC)) -
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_deallocation.cpp
r111 r112 46 46 DELETE1_SIGNAL( in_UPDATE_ADDRESS ,_param->_nb_inst_update,_param->_size_address); 47 47 DELETE1_SIGNAL( in_UPDATE_HISTORY ,_param->_nb_inst_update,_param->_size_history); 48 DELETE1_SIGNAL( in_UPDATE_HISTORY_VAL ,_param->_nb_inst_update,1 ); 48 49 DELETE1_SIGNAL( in_UPDATE_DIRECTION ,_param->_nb_inst_update,1 ); 49 50 if (_param->_update_on_prediction) -
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
r111 r112 90 90 { 91 91 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * UPDATE [%d]",i); 92 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * miss : %d",PORT_READ(in_UPDATE_MISS [i])); 93 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * update_on_predict: %d",_param->_update_on_prediction); 92 94 93 95 // Update if 94 96 // * update_on_prediction and miss 95 97 // * not update_on_prediction 96 if (not _param->_update_on_prediction or (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i]))) 97 { 98 Taddress_t address = PORT_READ(in_UPDATE_ADDRESS [i]); 99 Thistory_t history = PORT_READ(in_UPDATE_HISTORY [i]); 100 Tcontrol_t direction = PORT_READ(in_UPDATE_DIRECTION [i])&1; 98 Tcontrol_t history_val = PORT_READ(in_UPDATE_HISTORY_VAL [i]); 99 100 if (not _param->_update_on_prediction or 101 (_param->_update_on_prediction and PORT_READ(in_UPDATE_MISS [i])) or 102 not history_val // static_prediction 103 ) 104 { 105 Taddress_t address = PORT_READ(in_UPDATE_ADDRESS [i]); 106 Thistory_t history = PORT_READ(in_UPDATE_HISTORY [i]); 107 Tcontrol_t direction = PORT_READ(in_UPDATE_DIRECTION [i])&1; 101 108 102 109 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * address : %.8x",address); 103 110 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * direction : %d",direction); 111 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * history_val : %d",direction); 104 112 105 113 Thistory_t pht_bht_history = 0; … … 107 115 if (_param->_have_bht) 108 116 { 117 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht"); 118 109 119 Thistory_t bht_history = (history>>_param->_bht_history_rshift)&_param->_bht_history_mask; 110 120 Thistory_t bht_num_reg = address & _param->_bht_address_mask; 111 121 122 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (old): %x",bht_history); 123 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_num_reg : %x",bht_num_reg); 124 125 // BHT : shift register 126 if (not history_val) 127 bht_history = (direction)?_param->_bht_init_take:_param->_bht_init_ntake; 128 else 129 bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ; 130 112 131 pht_bht_history = bht_history; 113 114 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (old): %x",bht_history); 115 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_num_reg : %x",bht_num_reg); 116 117 // BHT : shift register 118 119 bht_history = ((bht_history<<1) | direction)&_param->_bht_history_mask ; 120 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (new): %x",bht_history); 132 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (new): %x",bht_history); 121 133 reg_BHT [bht_num_reg] = bht_history; 122 134 } … … 124 136 if (_param->_have_pht) 125 137 { 138 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht"); 139 126 140 Thistory_t pht_history = (history>>_param->_pht_history_rshift)&_param->_pht_history_mask; 127 141 Thistory_t pht_num_reg = pht_bht_history xor ((address&_param->_pht_address_share_mask)<<_param->_pht_address_share_lshift); 128 142 Thistory_t pht_num_bank= (address>>_param->_pht_address_bank_rshift)&_param->_pht_address_bank_mask; 129 143 130 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (old): %x",pht_bht_history);131 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_history (old): %x",pht_history);132 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_reg : %x",pht_num_reg);133 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_bank : %x",pht_num_bank);144 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * bht_history (old): %x",pht_bht_history); 145 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_history (old): %x",pht_history); 146 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_reg : %x",pht_num_reg); 147 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_num_bank : %x",pht_num_bank); 134 148 135 149 // PHT : saturation counter 136 pht_history = (direction==1)?((pht_history<_param->_pht_counter_max)?(pht_history+1):(pht_history)):((pht_history>0)?(pht_history-1):(pht_history)); 137 138 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_history (new): %x",pht_history); 150 if (not history_val) 151 pht_history = (direction)?_param->_pht_init_take:_param->_pht_init_ntake; 152 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)); 154 155 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * pht_history (new): %x",pht_history); 139 156 140 157 reg_PHT [pht_num_bank][pht_num_reg] = pht_history; … … 145 162 146 163 #if defined(DEBUG) and DEBUG_Two_Level_Branch_Predictor and (DEBUG >= DEBUG_TRACE) 147 if ( 0)164 if (1) 148 165 { 149 166 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," * Dump Two_Level_Branch_Predictor"); … … 180 197 for (uint32_t num_bank=0; num_bank <_param->_pht_nb_bank; ++num_bank) 181 198 { 182 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," [%.4d]",num_bank); 183 184 for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit) 185 { 186 std::string str = ""; 199 if (_param->_pht_size_bank == 1) 200 { 201 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," [%.4d][0000] %4x",num_bank,reg_PHT[num_bank][0]); 202 } 203 else 204 { 205 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," [%.4d]",num_bank); 187 206 188 for (uint32_t j=0; j<limit; j++)207 for (uint32_t i=0; i<_param->_pht_size_bank; i+=limit) 189 208 { 190 uint32_t index = i+j; 191 if (index >= _param->_pht_nb_counter) 192 break; 193 else 194 str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]); 209 std::string str = ""; 210 211 for (uint32_t j=0; j<limit; j++) 212 { 213 uint32_t index = i+j; 214 if (index >= _param->_pht_size_bank) 215 break; 216 else 217 str+=toString("[%.4d] %.4x ",index,reg_PHT[num_bank][index]); 218 } 219 220 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," %s",str.c_str()); 195 221 } 196 197 log_printf(TRACE,Two_Level_Branch_Predictor,FUNCTION," %s",str.c_str());198 222 } 199 223 }
Note: See TracChangeset
for help on using the changeset viewer.