Changeset 115 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit
- 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
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/src/Branch_Target_Buffer_deallocation.cpp
r112 r115 63 63 if (_param->_have_component_victim) 64 64 { 65 delete [] _component_sort; 66 delete _component_victim; 65 for (uint32_t i=0; i<_param->_nb_inst_predict; i++) 66 delete _component_sort [i]; 67 delete [] _component_sort; 68 delete _component_victim; 67 69 } 68 70 delete _component_branch_target_buffer_glue; 69 71 delete _component_branch_target_buffer_register; 70 72 71 73 delete _component; 72 74 -
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); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h
r112 r115 53 53 public : Stat * _stat; 54 54 55 private : counter_t *** _stat_nb_branch_hit ; //[nb_context][MAX_BRANCH_CONDITION] 56 private : counter_t *** _stat_nb_branch_miss ; //[nb_context][MAX_BRANCH_CONDITION] 57 private : counter_t ** _stat_nb_branch_unused ; //[nb_context] 58 private : counter_t ** _stat_ufpt_queue_nb_elt ; //[nb_context] 59 private : counter_t ** _stat_upt_queue_nb_elt ; //[nb_context] 60 55 private : counter_t *** _stat_nb_branch_hit ; //[nb_context][MAX_BRANCH_CONDITION] 56 private : counter_t *** _stat_nb_branch_miss ; //[nb_context][MAX_BRANCH_CONDITION] 57 private : counter_t ** _stat_nb_branch_unused ; //[nb_context] 58 private : counter_t ** _stat_ufpt_queue_nb_elt ; //[nb_context] 59 private : counter_t ** _stat_upt_queue_nb_elt ; //[nb_context] 60 61 private : counter_t ** _stat_nb_branch_ifetch_prediction; //[nb_context] 62 private : counter_t ** _stat_nb_branch_accurate ; //[nb_context] 61 63 #endif 62 64 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp
r97 r115 31 31 32 32 { 33 ALLOC2(_stat_nb_branch_hit ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION); 34 ALLOC2(_stat_nb_branch_miss ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION); 35 ALLOC1(_stat_nb_branch_unused ,counter_t *,_param->_nb_context); 33 ALLOC2(_stat_nb_branch_hit ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION); 34 ALLOC2(_stat_nb_branch_miss ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION); 35 ALLOC1(_stat_nb_branch_unused ,counter_t *,_param->_nb_context); 36 37 ALLOC1(_stat_nb_branch_ifetch_prediction,counter_t *,_param->_nb_context); 38 ALLOC1(_stat_nb_branch_accurate ,counter_t *,_param->_nb_context); 36 39 37 40 for (uint32_t i=0; i<_param->_nb_context; ++i) … … 74 77 toString(_("Percent miss by branchement (context %d)"),i)); 75 78 76 _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i)); 79 _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i)); 80 _stat_nb_branch_ifetch_prediction [i] = _stat->create_counter("nb_branch_ifetch_prediction_"+toString(i),"",toString(_("Branch used and ifetch prediction (context %d)"),i)); 81 _stat_nb_branch_accurate [i] = _stat->create_counter("nb_branch_accurate_" +toString(i),"",toString(_("Branch and is accurate (context %d)"),i)); 82 83 _stat->create_expr("nb_branch_used_"+toString(i),sum_branchement,TYPE_COUNTER,"",_("Branch used")); 77 84 } 78 85 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp
r113 r115 468 468 reg_UPDATE_PREDICTION_TABLE [context][depth]._retire_ok = true; 469 469 reg_UPDATE_PREDICTION_TABLE [context][depth]._miss_prediction = ko; 470 471 #ifdef STATISTICS 472 if (usage_is_set(_usage,USE_STATISTICS)) 473 { 474 if (reg_UPDATE_PREDICTION_TABLE [context][depth]._ifetch_prediction) 475 (*_stat_nb_branch_ifetch_prediction [context])++; 476 if (reg_UPDATE_PREDICTION_TABLE [context][depth]._is_accurate) 477 (*_stat_nb_branch_accurate [context])++; 478 } 479 #endif 470 480 } 471 481
Note: See TracChangeset
for help on using the changeset viewer.