Changeset 111 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src
- Timestamp:
- Feb 27, 2009, 7:37:40 PM (15 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_allocation.cpp
r110 r111 18 18 namespace meta_predictor { 19 19 20 21 22 20 #undef FUNCTION 23 21 #define FUNCTION "Meta_Predictor::allocation" … … 57 55 in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); 58 56 } 57 58 // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 59 { 60 ALLOC1_INTERFACE("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict); 61 62 ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); 63 ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); 64 ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS ,"ADDRESS" ,Taddress_t,_param->_size_address); 65 ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); 66 ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY ,"HISTORY" ,Thistory_t,_param->_size_history); 67 } 68 69 // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 70 { 71 ALLOC1_INTERFACE("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update); 72 73 ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); 74 ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); 75 ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"ADDRESS" ,Taddress_t,_param->_size_address); 76 ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY ,"HISTORY" ,Thistory_t,_param->_size_history); 77 ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); 78 } 59 79 60 80 // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 82 std::string name; 83 84 85 { 86 _component_two_level_branch_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Two_Level_Branch_Predictor * [_param->_nb_predictor]; 87 88 for (uint32_t i=0; i<_param->_nb_predictor; ++i) 89 { 90 name = _name+"_two_level_branch_predictor_"+toString(i); 91 log_printf(INFO,Meta_Predictor,FUNCTION,_("Create : %s"),name.c_str()); 92 93 _component_two_level_branch_predictor [i] = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Two_Level_Branch_Predictor 94 (name.c_str() 95 #ifdef STATISTICS 96 ,param_statistics 97 #endif 98 ,_param->_param_two_level_branch_predictor[i] 99 ,_usage); 100 101 _component->set_component (_component_two_level_branch_predictor[i]->_component 102 #ifdef POSITION 103 , 50, 50, 10, 10 104 #endif 105 ); 106 } 107 } 108 109 { 110 name = _name+"_glue"; 111 log_printf(INFO,Meta_Predictor,FUNCTION,_("Create : %s"),name.c_str()); 112 113 _component_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Meta_Predictor_Glue 114 (name.c_str() 115 #ifdef STATISTICS 116 ,param_statistics 117 #endif 118 ,_param->_param_glue 119 ,_usage); 120 121 _component->set_component (_component_glue->_component 122 #ifdef POSITION 123 , 50, 50, 10, 10 124 #endif 125 ); 126 } 61 127 62 128 // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 63 129 std::string src,dest; 130 131 // =================================================================== 132 // =====[ Two_Level_Branch_Predictor ]================================ 133 // =================================================================== 134 135 for (uint32_t i=0; i<_param->_nb_predictor; ++i) 136 { 137 src = _name+"_two_level_branch_predictor_"+toString(i); 138 log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); 139 140 { 141 dest = _name; 142 #ifdef POSITION 143 _component->interface_map (src ,"", 144 dest,""); 145 #endif 146 147 PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); 148 PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); 149 } 150 151 // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 152 for (uint32_t j=0; j<_param->_nb_inst_predict; ++j) 153 { 154 dest = _name; 155 156 #ifdef POSITION 157 _component->interface_map (src ,"predict_"+toString(j), 158 dest,"predict_"+toString(j)); 159 #endif 160 161 PORT_MAP(_component,src , "in_PREDICT_"+toString(j)+"_ADDRESS" , 162 dest, "in_PREDICT_"+toString(j)+"_ADDRESS" ); 163 164 dest = _name+"_glue"; 165 166 #ifdef POSITION 167 _component->interface_map (src ,"predict_"+toString(j), 168 dest,"predict_predictor_"+toString(i)+"_"+toString(j)); 169 #endif 170 171 COMPONENT_MAP(_component,src , "in_PREDICT_" +toString(j)+"_VAL" , 172 dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_VAL" ); 173 COMPONENT_MAP(_component,src ,"out_PREDICT_" +toString(j)+"_ACK" , 174 dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ACK" ); 175 // COMPONENT_MAP(_component,src , "in_PREDICT_" +toString(j)+"_ADDRESS" , 176 // dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ADDRESS" ); 177 COMPONENT_MAP(_component,src ,"out_PREDICT_" +toString(j)+"_DIRECTION" , 178 dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION" ); 179 COMPONENT_MAP(_component,src ,"out_PREDICT_" +toString(j)+"_HISTORY" , 180 dest, "in_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_HISTORY" ); 181 if (_param->_predictor_update_on_prediction [i]) 182 { 183 COMPONENT_MAP(_component,src , "in_PREDICT_" +toString(j)+"_DIRECTION_VAL", 184 dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION_VAL"); 185 COMPONENT_MAP(_component,src , "in_PREDICT_" +toString(j)+"_DIRECTION" , 186 dest,"out_PREDICT_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION" ); 187 } 188 } 189 190 // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 191 for (uint32_t j=0; j<_param->_nb_inst_update; ++j) 192 { 193 dest = _name; 194 195 #ifdef POSITION 196 _component->interface_map (src ,"update_"+toString(j), 197 dest,"update_"+toString(j)); 198 #endif 199 200 PORT_MAP(_component,src , "in_UPDATE_"+toString(j)+"_ADDRESS" , 201 dest, "in_UPDATE_"+toString(j)+"_ADDRESS" ); 202 203 dest = _name+"_glue"; 204 205 #ifdef POSITION 206 _component->interface_map (src ,"update_"+toString(j), 207 dest,"update_predictor_"+toString(i)+"_"+toString(j)); 208 #endif 209 210 COMPONENT_MAP(_component,src , "in_UPDATE_" +toString(j)+"_VAL" , 211 dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_VAL" ); 212 COMPONENT_MAP(_component,src ,"out_UPDATE_" +toString(j)+"_ACK" , 213 dest, "in_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ACK" ); 214 // COMPONENT_MAP(_component,src , "in_UPDATE_" +toString(j)+"_ADDRESS" , 215 // dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_ADDRESS" ); 216 COMPONENT_MAP(_component,src , "in_UPDATE_" +toString(j)+"_DIRECTION" , 217 dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_DIRECTION" ); 218 COMPONENT_MAP(_component,src , "in_UPDATE_" +toString(j)+"_HISTORY" , 219 dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_HISTORY" ); 220 if (_param->_predictor_update_on_prediction [i]) 221 COMPONENT_MAP(_component,src , "in_UPDATE_" +toString(j)+"_MISS" , 222 dest,"out_UPDATE_PREDICTOR_"+toString(i)+"_"+toString(j)+"_MISS" ); 223 } 224 // // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 225 // public : SC_IN (Tcontrol_t) ** in_UPDATE_VAL ;//[nb_inst_update] 226 // public : SC_OUT(Tcontrol_t) ** out_UPDATE_ACK ;//[nb_inst_update] 227 // public : SC_IN (Taddress_t) ** in_UPDATE_ADDRESS ;//[nb_inst_update] 228 // public : SC_IN (Thistory_t) ** in_UPDATE_HISTORY ;//[nb_inst_update] 229 // public : SC_IN (Tcontrol_t) ** in_UPDATE_DIRECTION ;//[nb_inst_update] 230 // public : SC_IN (Tcontrol_t) ** in_UPDATE_MISS ;//[nb_inst_update] // if update_on_prediction 231 232 } 233 234 // =================================================================== 235 // =====[ Glue ]====================================================== 236 // =================================================================== 237 238 { 239 src = _name+"_glue"; 240 log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); 241 242 { 243 dest = _name; 244 #ifdef POSITION 245 _component->interface_map (src ,"", 246 dest,""); 247 #endif 248 249 PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); 250 PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); 251 } 252 253 // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 254 for (uint32_t i=0; i<_param->_nb_inst_predict; ++i) 255 { 256 dest = _name; 257 #ifdef POSITION 258 _component->interface_map (src ,"predict_"+toString(i), 259 dest,"predict_"+toString(i)); 260 #endif 261 262 PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL" , 263 dest, "in_PREDICT_"+toString(i)+"_VAL" ); 264 PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK" , 265 dest,"out_PREDICT_"+toString(i)+"_ACK" ); 266 PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HISTORY" , 267 dest,"out_PREDICT_"+toString(i)+"_HISTORY" ); 268 PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_DIRECTION", 269 dest,"out_PREDICT_"+toString(i)+"_DIRECTION"); 270 } 271 272 // out_PREDICT_PREDICTOR_VAL -> two_level_branch_predictor. in_PREDICT_PREDICTOR_VAL 273 // in_PREDICT_PREDICTOR_ACK -> two_level_branch_predictor.out_PREDICT_PREDICTOR_ACK 274 // in_PREDICT_PREDICTOR_HISTORY -> two_level_branch_predictor.out_PREDICT_PREDICTOR_HISTORY 275 // in_PREDICT_PREDICTOR_DIRECTION -> two_level_branch_predictor.out_PREDICT_PREDICTOR_DIRECTION 276 // out_PREDICT_PREDICTOR_DIRECTION_VAL -> two_level_branch_predictor. in_PREDICT_PREDICTOR_DIRECTION_VAL 277 // out_PREDICT_PREDICTOR_DIRECTION -> two_level_branch_predictor. in_PREDICT_PREDICTOR_DIRECTION 278 279 // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 280 for (uint32_t i=0; i<_param->_nb_inst_update; ++i) 281 { 282 dest = _name; 283 #ifdef POSITION 284 _component->interface_map (src ,"update_"+toString(i), 285 dest,"update_"+toString(i)); 286 #endif 287 288 PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL" , 289 dest, "in_UPDATE_"+toString(i)+"_VAL" ); 290 PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK" , 291 dest,"out_UPDATE_"+toString(i)+"_ACK" ); 292 PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_HISTORY" , 293 dest, "in_UPDATE_"+toString(i)+"_HISTORY" ); 294 PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_DIRECTION", 295 dest, "in_UPDATE_"+toString(i)+"_DIRECTION"); 296 } 297 298 // out_UPDATE_PREDICTOR_VAL -> two_level_branch_predictor. in_UPDATE_PREDICTOR_VAL 299 // in_UPDATE_PREDICTOR_ACK -> two_level_branch_predictor.out_UPDATE_PREDICTOR_ACK 300 // out_UPDATE_PREDICTOR_HISTORY -> two_level_branch_predictor. in_UPDATE_PREDICTOR_HISTORY 301 // out_UPDATE_PREDICTOR_DIRECTION -> two_level_branch_predictor. in_UPDATE_PREDICTOR_DIRECTION 302 // out_UPDATE_PREDICTOR_MISS -> two_level_branch_predictor. in_UPDATE_PREDICTOR_MISS 303 304 } 64 305 65 306 // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Meta_Predictor_deallocation.cpp
r110 r111 29 29 delete in_CLOCK ; 30 30 delete in_NRESET; 31 32 DELETE1_SIGNAL( in_PREDICT_VAL ,_param->_nb_inst_predict,1 ); 33 DELETE1_SIGNAL(out_PREDICT_ACK ,_param->_nb_inst_predict,1 ); 34 DELETE1_SIGNAL( in_PREDICT_ADDRESS ,_param->_nb_inst_predict,_param->_size_address); 35 DELETE1_SIGNAL(out_PREDICT_DIRECTION ,_param->_nb_inst_predict,1 ); 36 DELETE1_SIGNAL(out_PREDICT_HISTORY ,_param->_nb_inst_predict,_param->_size_history); 37 38 DELETE1_SIGNAL( in_UPDATE_VAL ,_param->_nb_inst_update,1 ); 39 DELETE1_SIGNAL(out_UPDATE_ACK ,_param->_nb_inst_update,1 ); 40 DELETE1_SIGNAL( in_UPDATE_ADDRESS ,_param->_nb_inst_update,_param->_size_address); 41 DELETE1_SIGNAL( in_UPDATE_HISTORY ,_param->_nb_inst_update,_param->_size_history); 42 DELETE1_SIGNAL( in_UPDATE_DIRECTION ,_param->_nb_inst_update,1 ); 31 43 } 32 44 // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 33 45 46 DELETE0(_component_glue); 47 DELETE1(_component_two_level_branch_predictor,_param->_nb_predictor); 48 34 49 delete _component; 50 35 51 36 52 log_end(Meta_Predictor,FUNCTION); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/src/Parameters.cpp
r110 r111 7 7 8 8 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/include/Parameters.h" 9 #include "Behavioural/include/Allocation.h" 9 10 10 11 namespace morpheo { … … 20 21 #undef FUNCTION 21 22 #define FUNCTION "Meta_Predictor::Parameters" 22 Parameters::Parameters (bool is_toplevel) 23 Parameters::Parameters (uint32_t nb_inst_predict , 24 uint32_t nb_inst_update , 25 uint32_t size_address , 26 bool have_bht [3], 27 uint32_t bht_size_shifter [3], 28 uint32_t bht_nb_shifter [3], 29 bool have_pht [3], 30 uint32_t pht_size_counter [3], 31 uint32_t pht_nb_counter [3], 32 uint32_t pht_size_address_share [3], 33 bool is_toplevel) 23 34 { 24 35 log_begin(Meta_Predictor,FUNCTION); 25 36 37 _nb_inst_predict = nb_inst_predict ; 38 _nb_inst_update = nb_inst_update ; 39 _size_address = size_address ; 40 for (uint32_t i=0; i<3; ++i) 41 { 42 _have_bht [i] = have_bht [i]; 43 _bht_size_shifter [i] = (_have_bht [i])?bht_size_shifter [i]:0; 44 _bht_nb_shifter [i] = (_have_bht [i])?bht_nb_shifter [i]:0; 45 _have_pht [i] = have_pht [i]; 46 _pht_size_counter [i] = (_have_pht [i])?pht_size_counter [i]:0; 47 _pht_nb_counter [i] = (_have_pht [i])?pht_nb_counter [i]:0; 48 _pht_size_address_share [i] = (_have_bht[i] and _have_pht [i])?pht_size_address_share [i]:0; 49 } 50 26 51 test(); 27 52 53 _have_meta_predictor = (_have_bht [2] or _have_pht [2]); 54 _nb_predictor = (_have_meta_predictor)?3:1; 55 56 ALLOC1(_predictor_update_on_prediction,bool , _nb_predictor); 57 ALLOC1(_predictor_size_history ,uint32_t, _nb_predictor); 58 59 // All predictor can update on prediction .... 60 for (uint32_t i=0; i<_nb_predictor; ++i) 61 _predictor_update_on_prediction [i] = true; 62 63 // ... But the selector prediction can't 64 if (_have_meta_predictor) 65 _predictor_update_on_prediction [_nb_predictor-1] = false; 66 67 _param_two_level_branch_predictor = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters * [_nb_predictor]; 68 for (uint32_t i=0; i<_nb_predictor; ++i) 69 { 70 _param_two_level_branch_predictor [i] = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters 71 (_nb_inst_predict , 72 _nb_inst_update , 73 _size_address , 74 _have_bht [i], 75 _bht_size_shifter [i], 76 _bht_nb_shifter [i], 77 _have_pht [i], 78 _pht_size_counter [i], 79 _pht_nb_counter [i], 80 _pht_size_address_share [i], 81 _predictor_update_on_prediction [i] 82 ); 83 84 _predictor_size_history [i] = _param_two_level_branch_predictor [i]->_size_history; 85 } 86 87 _param_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::meta_predictor_glue::Parameters 88 ( 89 _nb_inst_predict , 90 _nb_inst_update , 91 _nb_predictor , 92 _predictor_size_history , 93 _predictor_update_on_prediction 94 ); 95 _size_history = _param_glue->_size_history; 96 28 97 if (is_toplevel) 29 98 { … … 48 117 { 49 118 log_begin(Meta_Predictor,FUNCTION); 119 120 DELETE1(_param_two_level_branch_predictor, _nb_predictor); 121 122 DELETE1(_predictor_size_history , _nb_predictor); 123 DELETE1(_predictor_update_on_prediction , _nb_predictor); 124 50 125 log_end(Meta_Predictor,FUNCTION); 51 126 }; … … 56 131 { 57 132 log_begin(Meta_Predictor,FUNCTION); 133 134 COPY(_param_glue); 135 for (uint32_t i=0; i<_nb_predictor; ++i) 136 COPY(_param_two_level_branch_predictor [i]); 137 58 138 log_end(Meta_Predictor,FUNCTION); 59 139 };
Note: See TracChangeset
for help on using the changeset viewer.