[78] | 1 | /* |
---|
| 2 | * $Id: Branch_Target_Buffer_allocation.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/include/Branch_Target_Buffer.h" |
---|
| 9 | #include "Behavioural/include/Allocation.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace prediction_unit { |
---|
| 17 | namespace branch_target_buffer { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Branch_Target_Buffer::allocation" |
---|
| 23 | void Branch_Target_Buffer::allocation |
---|
| 24 | ( |
---|
| 25 | #ifdef STATISTICS |
---|
| 26 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
| 27 | #else |
---|
| 28 | void |
---|
| 29 | #endif |
---|
| 30 | ) |
---|
| 31 | { |
---|
| 32 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"Begin"); |
---|
| 33 | |
---|
| 34 | _component = new Component (_usage); |
---|
| 35 | |
---|
| 36 | Entity * entity = _component->set_entity (_name |
---|
| 37 | ,"Branch_Target_Buffer" |
---|
| 38 | #ifdef POSITION |
---|
| 39 | ,COMBINATORY |
---|
| 40 | #endif |
---|
| 41 | ); |
---|
| 42 | |
---|
| 43 | _interfaces = entity->set_interfaces(); |
---|
| 44 | |
---|
| 45 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 46 | { |
---|
| 47 | Interface * interface = _interfaces->set_interface("" |
---|
| 48 | #ifdef POSITION |
---|
| 49 | ,IN |
---|
| 50 | ,SOUTH, |
---|
| 51 | "Generalist interface" |
---|
| 52 | #endif |
---|
| 53 | ); |
---|
| 54 | |
---|
| 55 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
| 56 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 60 | { |
---|
| 61 | ALLOC1_INTERFACE("predict", IN, SOUTH, "Predict (next pc) interface", _param->_nb_inst_predict); |
---|
| 62 | |
---|
| 63 | ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); |
---|
| 64 | ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); |
---|
| 65 | ALLOC1_SIGNAL_IN ( in_PREDICT_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id); |
---|
[88] | 66 | ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS ,"address" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
[78] | 67 | ALLOC1_SIGNAL_OUT(out_PREDICT_HIT ,"hit" ,Tcontrol_t ,1); |
---|
[88] | 68 | ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_SRC ,"address_src" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
| 69 | ALLOC1_SIGNAL_OUT(out_PREDICT_ADDRESS_DEST,"address_dest",Tgeneral_data_t ,_param->_size_instruction_address); |
---|
[78] | 70 | ALLOC1_SIGNAL_OUT(out_PREDICT_CONDITION ,"condition" ,Tbranch_condition_t,_param->_size_branch_condition); |
---|
| 71 | ALLOC1_SIGNAL_OUT(out_PREDICT_LAST_TAKE ,"last_take" ,Tcontrol_t ,1); |
---|
| 72 | ALLOC1_SIGNAL_OUT(out_PREDICT_IS_ACCURATE ,"is_accurate" ,Tcontrol_t ,1); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 76 | { |
---|
| 77 | ALLOC1_INTERFACE("decod", IN, SOUTH, "Decod Interface", _param->_nb_inst_decod); |
---|
| 78 | |
---|
| 79 | ALLOC1_VALACK_IN ( in_DECOD_VAL ,VAL); |
---|
| 80 | ALLOC1_VALACK_OUT(out_DECOD_ACK ,ACK); |
---|
| 81 | ALLOC1_SIGNAL_IN ( in_DECOD_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id); |
---|
[88] | 82 | ALLOC1_SIGNAL_IN ( in_DECOD_ADDRESS_SRC ,"address_src" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
| 83 | ALLOC1_SIGNAL_IN ( in_DECOD_ADDRESS_DEST ,"address_dest" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
[78] | 84 | ALLOC1_SIGNAL_IN ( in_DECOD_CONDITION ,"condition" ,Tbranch_condition_t,_param->_size_branch_condition); |
---|
| 85 | ALLOC1_SIGNAL_IN ( in_DECOD_LAST_TAKE ,"last_take" ,Tcontrol_t ,1); |
---|
| 86 | ALLOC1_SIGNAL_IN ( in_DECOD_MISS_PREDICTION,"miss_prediction",Tcontrol_t ,1); |
---|
[82] | 87 | ALLOC1_SIGNAL_IN ( in_DECOD_IS_ACCURATE ,"is_accurate" ,Tcontrol_t ,1); |
---|
[78] | 88 | } |
---|
| 89 | |
---|
| 90 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 91 | { |
---|
| 92 | ALLOC1_INTERFACE("update", IN, SOUTH, "Update interface", _param->_nb_inst_update); |
---|
| 93 | |
---|
| 94 | ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); |
---|
| 95 | ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); |
---|
| 96 | ALLOC1_SIGNAL_IN ( in_UPDATE_CONTEXT_ID ,"context_id" ,Tcontext_t ,_param->_size_context_id); |
---|
[88] | 97 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS_SRC ,"address_src" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
| 98 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS_DEST ,"address_dest" ,Tgeneral_data_t ,_param->_size_instruction_address); |
---|
[78] | 99 | ALLOC1_SIGNAL_IN ( in_UPDATE_CONDITION ,"condition" ,Tbranch_condition_t,_param->_size_branch_condition); |
---|
| 100 | ALLOC1_SIGNAL_IN ( in_UPDATE_LAST_TAKE ,"last_take" ,Tcontrol_t ,1); |
---|
| 101 | ALLOC1_SIGNAL_IN ( in_UPDATE_MISS_PREDICTION,"miss_prediction",Tcontrol_t ,1); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 105 | std::string name; |
---|
| 106 | |
---|
| 107 | if (_param->_have_component_victim) |
---|
| 108 | { |
---|
| 109 | _component_sort = new morpheo::behavioural::generic::sort::Sort * [_param->_nb_inst_predict]; |
---|
| 110 | |
---|
| 111 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 112 | { |
---|
| 113 | name = _name+"_sort_"+toString(i); |
---|
[82] | 114 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
[78] | 115 | |
---|
| 116 | _component_sort [i] = new morpheo::behavioural::generic::sort::Sort |
---|
| 117 | (name.c_str() |
---|
| 118 | #ifdef STATISTICS |
---|
| 119 | ,param_statistics |
---|
| 120 | #endif |
---|
[82] | 121 | ,_param->_param_sort |
---|
| 122 | ,_usage); |
---|
[78] | 123 | |
---|
| 124 | _component->set_component (_component_sort [i] ->_component |
---|
| 125 | #ifdef POSITION |
---|
| 126 | , 50, 50, 10, 10 |
---|
| 127 | #endif |
---|
| 128 | ); |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | { |
---|
| 132 | name = _name+"_victim"; |
---|
[82] | 133 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
[78] | 134 | |
---|
| 135 | _component_victim = new morpheo::behavioural::generic::victim::Victim |
---|
| 136 | (name.c_str() |
---|
| 137 | #ifdef STATISTICS |
---|
| 138 | ,param_statistics |
---|
| 139 | #endif |
---|
[82] | 140 | ,_param->_param_victim |
---|
| 141 | ,_usage); |
---|
[78] | 142 | |
---|
| 143 | _component->set_component (_component_victim->_component |
---|
| 144 | #ifdef POSITION |
---|
| 145 | , 50, 50, 10, 10 |
---|
| 146 | #endif |
---|
| 147 | ); |
---|
| 148 | } |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | { |
---|
| 152 | name = _name+"_glue"; |
---|
[82] | 153 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
[78] | 154 | |
---|
| 155 | _component_branch_target_buffer_glue = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_glue::Branch_Target_Buffer_Glue |
---|
| 156 | (name.c_str() |
---|
| 157 | #ifdef STATISTICS |
---|
| 158 | ,param_statistics |
---|
| 159 | #endif |
---|
[82] | 160 | ,_param->_param_branch_target_buffer_glue |
---|
| 161 | ,_usage); |
---|
[78] | 162 | |
---|
| 163 | _component->set_component (_component_branch_target_buffer_glue->_component |
---|
| 164 | #ifdef POSITION |
---|
| 165 | , 50, 50, 10, 10 |
---|
| 166 | #endif |
---|
| 167 | ); |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | { |
---|
| 171 | name = _name+"_register"; |
---|
[82] | 172 | log_printf(INFO,Prediction_unit,FUNCTION,_("Create : %s"),name.c_str()); |
---|
[78] | 173 | |
---|
| 174 | _component_branch_target_buffer_register = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_register::Branch_Target_Buffer_Register |
---|
| 175 | (name.c_str() |
---|
| 176 | #ifdef STATISTICS |
---|
| 177 | ,param_statistics |
---|
| 178 | #endif |
---|
[82] | 179 | ,_param->_param_branch_target_buffer_register |
---|
| 180 | ,_usage); |
---|
[78] | 181 | |
---|
| 182 | _component->set_component (_component_branch_target_buffer_register->_component |
---|
| 183 | #ifdef POSITION |
---|
| 184 | , 50, 50, 10, 10 |
---|
| 185 | #endif |
---|
| 186 | ); |
---|
| 187 | } |
---|
| 188 | |
---|
| 189 | // ~~~~~[ Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 190 | std::string src,dest; |
---|
| 191 | |
---|
| 192 | if (_param->_have_component_victim) |
---|
| 193 | { |
---|
| 194 | //================================================================ |
---|
| 195 | //=====[ Sort ]=================================================== |
---|
| 196 | //================================================================ |
---|
| 197 | |
---|
| 198 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 199 | { |
---|
| 200 | src = _name+"_sort_"+toString(i); |
---|
[82] | 201 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
[78] | 202 | |
---|
| 203 | { |
---|
| 204 | dest = _name; |
---|
| 205 | #ifdef POSITION |
---|
| 206 | _component->interface_map (src ,"", |
---|
| 207 | dest,""); |
---|
| 208 | #endif |
---|
| 209 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
| 210 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
| 211 | } |
---|
| 212 | |
---|
| 213 | for (uint32_t j=0; j<_param->_associativity; j++) |
---|
| 214 | { |
---|
| 215 | dest = _name+"_register"; |
---|
| 216 | #ifdef POSITION |
---|
| 217 | _component->interface_map (src ,"input_" +toString(i), |
---|
| 218 | dest,"predict_"+toString(i)); |
---|
| 219 | #endif |
---|
| 220 | |
---|
| 221 | COMPONENT_MAP(_component,src , "in_INPUT_"+toString(j)+"_VAL" , |
---|
| 222 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+"_HIT" ); |
---|
| 223 | COMPONENT_MAP(_component,src , "in_INPUT_"+toString(j)+"_DATA", |
---|
| 224 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+"_ADDRESS_SRC"); |
---|
| 225 | |
---|
| 226 | // out_OUTPUT_VAL -> glue |
---|
| 227 | // out_OUTPUT_INDEX -> glue |
---|
| 228 | // out_OUTPUT_ADDRESS -> no exist |
---|
| 229 | } |
---|
| 230 | } |
---|
| 231 | |
---|
| 232 | //================================================================ |
---|
| 233 | //=====[ Victim ]================================================= |
---|
| 234 | //================================================================ |
---|
| 235 | { |
---|
| 236 | src = _name+"_victim"; |
---|
[82] | 237 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
[78] | 238 | |
---|
| 239 | { |
---|
| 240 | dest = _name; |
---|
| 241 | #ifdef POSITION |
---|
| 242 | _component->interface_map (src ,"", |
---|
| 243 | dest,""); |
---|
| 244 | #endif |
---|
| 245 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
| 246 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
| 247 | |
---|
| 248 | // in_ACCESS_VAL -> glue, register |
---|
| 249 | //out_ACCESS_ACK -> glue, register |
---|
| 250 | // in_ACCESS_ADDRESS -> glue, register |
---|
| 251 | // in_ACCESS_HIT -> glue, register |
---|
| 252 | // in_ACCESS_ENTITY -> glue, register |
---|
| 253 | //out_ACCESS_VICTIM -> glue, register |
---|
| 254 | } |
---|
| 255 | } |
---|
| 256 | } |
---|
| 257 | |
---|
| 258 | //==================================================================== |
---|
| 259 | //=====[ Glue ]======================================================= |
---|
| 260 | //==================================================================== |
---|
| 261 | { |
---|
| 262 | src = _name+"_glue"; |
---|
[82] | 263 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
[78] | 264 | |
---|
| 265 | { |
---|
| 266 | dest = _name; |
---|
| 267 | #ifdef POSITION |
---|
| 268 | _component->interface_map (src ,"", |
---|
| 269 | dest,""); |
---|
| 270 | #endif |
---|
| 271 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
| 272 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 276 | { |
---|
| 277 | dest = _name; |
---|
| 278 | #ifdef POSITION |
---|
| 279 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 280 | dest,"predict_"+toString(i)); |
---|
| 281 | #endif |
---|
| 282 | |
---|
| 283 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VAL" , |
---|
| 284 | dest, "in_PREDICT_"+toString(i)+"_VAL" ); |
---|
| 285 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ACK" , |
---|
| 286 | dest,"out_PREDICT_"+toString(i)+"_ACK" ); |
---|
| 287 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_HIT" , |
---|
| 288 | dest,"out_PREDICT_"+toString(i)+"_HIT" ); |
---|
| 289 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ADDRESS_SRC" , |
---|
| 290 | dest,"out_PREDICT_"+toString(i)+"_ADDRESS_SRC" ); |
---|
| 291 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_ADDRESS_DEST", |
---|
| 292 | dest,"out_PREDICT_"+toString(i)+"_ADDRESS_DEST"); |
---|
| 293 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_CONDITION" , |
---|
| 294 | dest,"out_PREDICT_"+toString(i)+"_CONDITION" ); |
---|
| 295 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_LAST_TAKE" , |
---|
| 296 | dest,"out_PREDICT_"+toString(i)+"_LAST_TAKE" ); |
---|
| 297 | PORT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_IS_ACCURATE" , |
---|
| 298 | dest,"out_PREDICT_"+toString(i)+"_IS_ACCURATE" ); |
---|
| 299 | |
---|
| 300 | dest = _name+"_register"; |
---|
| 301 | #ifdef POSITION |
---|
| 302 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 303 | dest,"predict_"+toString(i)); |
---|
| 304 | #endif |
---|
| 305 | |
---|
| 306 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_REGISTER_VAL", |
---|
| 307 | dest, "in_PREDICT_"+toString(i)+"_VAL"); |
---|
| 308 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_REGISTER_ACK", |
---|
| 309 | dest,"out_PREDICT_"+toString(i)+"_ACK"); |
---|
| 310 | |
---|
| 311 | for (uint32_t j=0; j<_param->_associativity; j++) |
---|
| 312 | { |
---|
| 313 | #ifdef POSITION |
---|
| 314 | _component->interface_map (src ,"predict_"+toString(i)+"_"+toString(j), |
---|
| 315 | dest,"predict_"+toString(i)+"_"+toString(j)); |
---|
| 316 | #endif |
---|
| 317 | |
---|
| 318 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_HIT" , |
---|
[82] | 319 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_HIT" ); |
---|
[78] | 320 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_ADDRESS_SRC" , |
---|
[82] | 321 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_ADDRESS_SRC" ); |
---|
[78] | 322 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_ADDRESS_DEST", |
---|
[82] | 323 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_ADDRESS_DEST"); |
---|
[78] | 324 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_CONDITION" , |
---|
[82] | 325 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_CONDITION" ); |
---|
[78] | 326 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_LAST_TAKE" , |
---|
[82] | 327 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_LAST_TAKE" ); |
---|
[78] | 328 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_"+toString(j)+"_REGISTER_IS_ACCURATE" , |
---|
[82] | 329 | dest,"out_PREDICT_"+toString(i)+"_"+toString(j)+ "_IS_ACCURATE" ); |
---|
[78] | 330 | } |
---|
| 331 | |
---|
| 332 | if (_param->_have_component_victim) |
---|
| 333 | { |
---|
| 334 | dest = _name+"_sort_"+toString(i); |
---|
| 335 | #ifdef POSITION |
---|
| 336 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 337 | dest,"output_0"); |
---|
| 338 | #endif |
---|
| 339 | |
---|
| 340 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_SORT_VAL" , |
---|
| 341 | dest,"out_OUTPUT_0_VAL" ); |
---|
| 342 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_SORT_INDEX", |
---|
| 343 | dest,"out_OUTPUT_0_INDEX"); |
---|
| 344 | |
---|
| 345 | dest = _name+"_victim"; |
---|
| 346 | #ifdef POSITION |
---|
| 347 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 348 | dest,"access_"+toString(i)); |
---|
| 349 | #endif |
---|
| 350 | |
---|
| 351 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_VAL" , |
---|
| 352 | dest, "in_ACCESS_"+toString(i)+"_VAL" ); |
---|
| 353 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VICTIM_ACK" , |
---|
| 354 | dest,"out_ACCESS_"+toString(i)+"_ACK" ); |
---|
| 355 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_HIT" , |
---|
| 356 | dest, "in_ACCESS_"+toString(i)+"_HIT" ); |
---|
| 357 | if (not _param->_is_full_associative) |
---|
| 358 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_ADDRESS", |
---|
| 359 | dest, "in_ACCESS_"+toString(i)+"_ADDRESS"); |
---|
| 360 | COMPONENT_MAP(_component,src ,"out_PREDICT_"+toString(i)+"_VICTIM_INDEX" , |
---|
| 361 | dest, "in_ACCESS_"+toString(i)+"_ENTITY" ); |
---|
| 362 | COMPONENT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_VICTIM_VICTIM" , |
---|
| 363 | dest,"out_ACCESS_"+toString(i)+"_VICTIM" ); |
---|
| 364 | } |
---|
| 365 | } |
---|
| 366 | |
---|
| 367 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 368 | { |
---|
| 369 | dest = _name; |
---|
| 370 | #ifdef POSITION |
---|
| 371 | _component->interface_map (src ,"decod_"+toString(i), |
---|
| 372 | dest,"decod_"+toString(i)); |
---|
| 373 | #endif |
---|
| 374 | |
---|
| 375 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_VAL" , |
---|
| 376 | dest, "in_DECOD_"+toString(i)+"_VAL" ); |
---|
| 377 | PORT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_ACK" , |
---|
| 378 | dest,"out_DECOD_"+toString(i)+"_ACK" ); |
---|
| 379 | if (not _param->_is_full_associative) |
---|
| 380 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_ADDRESS_SRC", |
---|
| 381 | dest, "in_DECOD_"+toString(i)+"_ADDRESS_SRC"); |
---|
| 382 | |
---|
| 383 | dest = _name+"_register"; |
---|
| 384 | #ifdef POSITION |
---|
| 385 | _component->interface_map (src ,"decod_"+toString(i), |
---|
| 386 | dest,"decod_"+toString(i)); |
---|
| 387 | #endif |
---|
| 388 | |
---|
| 389 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_REGISTER_VAL", |
---|
| 390 | dest, "in_DECOD_"+toString(i)+"_VAL"); |
---|
| 391 | COMPONENT_MAP(_component,src , "in_DECOD_"+toString(i)+"_REGISTER_ACK", |
---|
| 392 | dest,"out_DECOD_"+toString(i)+"_ACK"); |
---|
| 393 | |
---|
| 394 | if (_param->_have_component_victim) |
---|
| 395 | { |
---|
| 396 | uint32_t j = _param->_nb_inst_predict+i; |
---|
| 397 | |
---|
| 398 | dest = _name+"_victim"; |
---|
| 399 | #ifdef POSITION |
---|
| 400 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 401 | dest,"access_"+toString(j)); |
---|
| 402 | #endif |
---|
| 403 | |
---|
| 404 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_VICTIM_VAL" , |
---|
| 405 | dest, "in_ACCESS_"+toString(j)+"_VAL" ); |
---|
| 406 | COMPONENT_MAP(_component,src , "in_DECOD_"+toString(i)+"_VICTIM_ACK" , |
---|
| 407 | dest,"out_ACCESS_"+toString(j)+"_ACK" ); |
---|
| 408 | if (not _param->_is_full_associative) |
---|
| 409 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_VICTIM_ADDRESS", |
---|
| 410 | dest, "in_ACCESS_"+toString(j)+"_ADDRESS"); |
---|
| 411 | } |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | for (uint32_t i=0; i<_param->_nb_inst_update; i++) |
---|
| 415 | { |
---|
| 416 | dest = _name; |
---|
| 417 | #ifdef POSITION |
---|
| 418 | _component->interface_map (src ,"update_"+toString(i), |
---|
| 419 | dest,"update_"+toString(i)); |
---|
| 420 | #endif |
---|
| 421 | |
---|
| 422 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VAL" , |
---|
| 423 | dest, "in_UPDATE_"+toString(i)+"_VAL" ); |
---|
| 424 | PORT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_ACK" , |
---|
| 425 | dest,"out_UPDATE_"+toString(i)+"_ACK" ); |
---|
| 426 | if (not _param->_is_full_associative) |
---|
| 427 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS_SRC", |
---|
| 428 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS_SRC"); |
---|
| 429 | |
---|
| 430 | dest = _name+"_register"; |
---|
| 431 | #ifdef POSITION |
---|
| 432 | _component->interface_map (src ,"update_"+toString(i), |
---|
| 433 | dest,"update_"+toString(i)); |
---|
| 434 | #endif |
---|
| 435 | |
---|
| 436 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_REGISTER_VAL", |
---|
| 437 | dest, "in_UPDATE_"+toString(i)+"_VAL"); |
---|
| 438 | COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_REGISTER_ACK", |
---|
| 439 | dest,"out_UPDATE_"+toString(i)+"_ACK"); |
---|
| 440 | |
---|
| 441 | if (_param->_have_component_victim) |
---|
| 442 | { |
---|
| 443 | uint32_t j = _param->_nb_inst_predict+_param->_nb_inst_decod+i; |
---|
| 444 | |
---|
| 445 | dest = _name+"_victim"; |
---|
| 446 | #ifdef POSITION |
---|
| 447 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 448 | dest,"access_"+toString(j)); |
---|
| 449 | #endif |
---|
| 450 | |
---|
| 451 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_VICTIM_VAL" , |
---|
| 452 | dest, "in_ACCESS_"+toString(j)+"_VAL" ); |
---|
| 453 | COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VICTIM_ACK" , |
---|
| 454 | dest,"out_ACCESS_"+toString(j)+"_ACK" ); |
---|
| 455 | if (not _param->_is_full_associative) |
---|
| 456 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_VICTIM_ADDRESS", |
---|
| 457 | dest, "in_ACCESS_"+toString(j)+"_ADDRESS"); |
---|
| 458 | } |
---|
| 459 | } |
---|
| 460 | } |
---|
| 461 | |
---|
| 462 | //==================================================================== |
---|
| 463 | //=====[ Register ]=================================================== |
---|
| 464 | //==================================================================== |
---|
| 465 | { |
---|
| 466 | src = _name+"_register"; |
---|
[82] | 467 | log_printf(INFO,Prediction_unit,FUNCTION,_("Instance : %s"),src.c_str()); |
---|
[78] | 468 | |
---|
| 469 | { |
---|
| 470 | dest = _name; |
---|
| 471 | #ifdef POSITION |
---|
| 472 | _component->interface_map (src ,"", |
---|
| 473 | dest,""); |
---|
| 474 | #endif |
---|
| 475 | PORT_MAP(_component,src , "in_CLOCK" ,dest, "in_CLOCK"); |
---|
| 476 | PORT_MAP(_component,src , "in_NRESET",dest, "in_NRESET"); |
---|
| 477 | } |
---|
| 478 | |
---|
| 479 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 480 | { |
---|
| 481 | dest = _name; |
---|
| 482 | #ifdef POSITION |
---|
| 483 | _component->interface_map (src ,"predict_"+toString(i), |
---|
| 484 | dest,"predict_"+toString(i)); |
---|
| 485 | #endif |
---|
| 486 | |
---|
| 487 | if (_param->_have_port_context_id) |
---|
| 488 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_CONTEXT_ID", |
---|
| 489 | dest, "in_PREDICT_"+toString(i)+"_CONTEXT_ID"); |
---|
| 490 | PORT_MAP(_component,src , "in_PREDICT_"+toString(i)+"_ADDRESS" , |
---|
| 491 | dest, "in_PREDICT_"+toString(i)+"_ADDRESS" ); |
---|
| 492 | |
---|
| 493 | // in_PREDICT_VAL -> glue |
---|
| 494 | //out_PREDICT_ACK -> glue |
---|
| 495 | //out_PREDICT_HIT -> glue, sort |
---|
| 496 | //out_PREDICT_ADDRESS_SRC -> glue, sort |
---|
| 497 | //out_PREDICT_ADDRESS_DEST -> glue |
---|
| 498 | //out_PREDICT_CONDITION -> glue |
---|
| 499 | //out_PREDICT_LAST_TAKE -> glue |
---|
| 500 | //out_PREDICT_IS_ACCURATE -> glue |
---|
| 501 | } |
---|
| 502 | |
---|
| 503 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 504 | { |
---|
| 505 | dest = _name; |
---|
| 506 | #ifdef POSITION |
---|
| 507 | _component->interface_map (src ,"decod_"+toString(i), |
---|
| 508 | dest,"decod_"+toString(i)); |
---|
| 509 | #endif |
---|
| 510 | |
---|
| 511 | // in_DECOD_VAL -> glue |
---|
| 512 | //out_DECOD_ACK -> glue |
---|
| 513 | if (_param->_have_port_context_id) |
---|
| 514 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_CONTEXT_ID" , |
---|
| 515 | dest, "in_DECOD_"+toString(i)+"_CONTEXT_ID" ); |
---|
| 516 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_ADDRESS_SRC" , |
---|
| 517 | dest, "in_DECOD_"+toString(i)+"_ADDRESS_SRC" ); |
---|
| 518 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_ADDRESS_DEST" , |
---|
| 519 | dest, "in_DECOD_"+toString(i)+"_ADDRESS_DEST" ); |
---|
| 520 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_CONDITION" , |
---|
| 521 | dest, "in_DECOD_"+toString(i)+"_CONDITION" ); |
---|
| 522 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_LAST_TAKE" , |
---|
| 523 | dest, "in_DECOD_"+toString(i)+"_LAST_TAKE" ); |
---|
| 524 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_MISS_PREDICTION", |
---|
| 525 | dest, "in_DECOD_"+toString(i)+"_MISS_PREDICTION"); |
---|
[82] | 526 | PORT_MAP(_component,src , "in_DECOD_"+toString(i)+"_IS_ACCURATE", |
---|
| 527 | dest, "in_DECOD_"+toString(i)+"_IS_ACCURATE"); |
---|
[78] | 528 | |
---|
| 529 | if (_param->_have_component_victim) |
---|
| 530 | { |
---|
| 531 | uint32_t j = _param->_nb_inst_predict+i; |
---|
| 532 | |
---|
| 533 | dest = _name+"_victim"; |
---|
| 534 | #ifdef POSITION |
---|
| 535 | _component->interface_map (src ,"decod_"+toString(i), |
---|
| 536 | dest,"access_"+toString(j)); |
---|
| 537 | #endif |
---|
| 538 | |
---|
| 539 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_HIT" , |
---|
| 540 | dest, "in_ACCESS_"+toString(j)+"_HIT" ); |
---|
| 541 | COMPONENT_MAP(_component,src ,"out_DECOD_"+toString(i)+"_HIT_INDEX", |
---|
| 542 | dest, "in_ACCESS_"+toString(j)+"_ENTITY"); |
---|
| 543 | COMPONENT_MAP(_component,src , "in_DECOD_"+toString(i)+"_VICTIM" , |
---|
| 544 | dest,"out_ACCESS_"+toString(j)+"_VICTIM"); |
---|
| 545 | } |
---|
| 546 | } |
---|
| 547 | |
---|
| 548 | for (uint32_t i=0; i<_param->_nb_inst_update; i++) |
---|
| 549 | { |
---|
| 550 | dest = _name; |
---|
| 551 | #ifdef POSITION |
---|
| 552 | _component->interface_map (src ,"update_"+toString(i), |
---|
| 553 | dest,"update_"+toString(i)); |
---|
| 554 | #endif |
---|
| 555 | |
---|
| 556 | // in_UPDATE_VAL -> glue |
---|
| 557 | //out_UPDATE_ACK -> glue |
---|
| 558 | if (_param->_have_port_context_id) |
---|
| 559 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_CONTEXT_ID" , |
---|
| 560 | dest, "in_UPDATE_"+toString(i)+"_CONTEXT_ID" ); |
---|
| 561 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS_SRC" , |
---|
| 562 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS_SRC" ); |
---|
| 563 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_ADDRESS_DEST" , |
---|
| 564 | dest, "in_UPDATE_"+toString(i)+"_ADDRESS_DEST" ); |
---|
| 565 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_CONDITION" , |
---|
| 566 | dest, "in_UPDATE_"+toString(i)+"_CONDITION" ); |
---|
| 567 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_LAST_TAKE" , |
---|
| 568 | dest, "in_UPDATE_"+toString(i)+"_LAST_TAKE" ); |
---|
| 569 | PORT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_MISS_PREDICTION", |
---|
| 570 | dest, "in_UPDATE_"+toString(i)+"_MISS_PREDICTION"); |
---|
| 571 | |
---|
| 572 | if (_param->_have_component_victim) |
---|
| 573 | { |
---|
| 574 | uint32_t j = _param->_nb_inst_predict+_param->_nb_inst_decod+i; |
---|
| 575 | |
---|
| 576 | dest = _name+"_victim"; |
---|
| 577 | #ifdef POSITION |
---|
| 578 | _component->interface_map (src ,"update_"+toString(i), |
---|
| 579 | dest,"access_"+toString(j)); |
---|
| 580 | #endif |
---|
| 581 | |
---|
| 582 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_HIT" , |
---|
| 583 | dest, "in_ACCESS_"+toString(j)+"_HIT" ); |
---|
| 584 | COMPONENT_MAP(_component,src ,"out_UPDATE_"+toString(i)+"_HIT_INDEX", |
---|
| 585 | dest, "in_ACCESS_"+toString(j)+"_ENTITY"); |
---|
| 586 | COMPONENT_MAP(_component,src , "in_UPDATE_"+toString(i)+"_VICTIM" , |
---|
| 587 | dest,"out_ACCESS_"+toString(j)+"_VICTIM"); |
---|
| 588 | } |
---|
| 589 | } |
---|
| 590 | } |
---|
| 591 | // ~~~~~[ Others ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 592 | |
---|
[88] | 593 | #if DEBUG_Branch_Target_Buffer == true |
---|
| 594 | _component->test_map(); |
---|
| 595 | #endif |
---|
| 596 | |
---|
[78] | 597 | #ifdef POSITION |
---|
[88] | 598 | if (usage_is_set(_usage,USE_POSITION)) |
---|
| 599 | _component->generate_file(); |
---|
[78] | 600 | #endif |
---|
| 601 | |
---|
| 602 | log_printf(FUNC,Branch_Target_Buffer,FUNCTION,"End"); |
---|
| 603 | }; |
---|
| 604 | |
---|
| 605 | }; // end namespace branch_target_buffer |
---|
| 606 | }; // end namespace prediction_unit |
---|
| 607 | }; // end namespace front_end |
---|
| 608 | }; // end namespace multi_front_end |
---|
| 609 | }; // end namespace core |
---|
| 610 | |
---|
| 611 | }; // end namespace behavioural |
---|
| 612 | }; // end namespace morpheo |
---|