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