Changeset 88 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp
- Timestamp:
- Dec 10, 2008, 7:31:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp
r82 r88 1 1 /* 2 * $ Id$2 * $id: test.cpp 82 2008-05-01 16:48:45Z rosiere $ 3 3 * 4 4 * [ Description ] … … 13 13 #include "Common/include/Test.h" 14 14 #include "Behavioural/include/Allocation.h" 15 16 typedef struct 17 { 18 uint32_t ufpt_ptr ; 19 uint32_t upt_ptr ; 20 21 Tcontext_t context ; 22 Taddress_t address_src ; 23 Taddress_t address_dest; 24 Taddress_t address_good; 25 Tbranch_condition_t condition ; 26 Tcontrol_t take ; 27 Tcontrol_t take_good ; 28 Tcontrol_t flag ; 29 Tcontrol_t is_accurate ; 30 Thistory_t history ; 31 Taddress_t ras_address ; 32 Tptr_t ras_index ; 33 Tcontrol_t miss_ifetch ; 34 Tcontrol_t miss_decod ; 35 Tcontrol_t miss_commit ; 36 } request_t; 15 37 16 38 void test (string name, … … 61 83 ALLOC1_SC_SIGNAL( in_PREDICT_RAS_ADDRESS ," in_PREDICT_RAS_ADDRESS ",Taddress_t ,_param->_nb_inst_predict); 62 84 ALLOC1_SC_SIGNAL( in_PREDICT_RAS_INDEX ," in_PREDICT_RAS_INDEX ",Tptr_t ,_param->_nb_inst_predict); 63 //ALLOC1_SC_SIGNAL(out_PREDICT_UPDATE_PREDICTION_ID ,"out_PREDICT_UPDATE_PREDICTION_ID ",Tprediction_ptr_t ,_param->_nb_inst_predict);85 ALLOC1_SC_SIGNAL(out_PREDICT_UPDATE_PREDICTION_ID ,"out_PREDICT_UPDATE_PREDICTION_ID ",Tprediction_ptr_t ,_param->_nb_inst_predict); 64 86 ALLOC1_SC_SIGNAL( in_DECOD_VAL ," in_DECOD_VAL ",Tcontrol_t ,_param->_nb_inst_decod); 65 87 ALLOC1_SC_SIGNAL(out_DECOD_ACK ,"out_DECOD_ACK ",Tcontrol_t ,_param->_nb_inst_decod); … … 75 97 ALLOC1_SC_SIGNAL( in_DECOD_UPDATE_PREDICTION_ID ," in_DECOD_UPDATE_PREDICTION_ID ",Tprediction_ptr_t ,_param->_nb_inst_decod); 76 98 //ALLOC1_SC_SIGNAL(out_DECOD_DEPTH ,"out_DECOD_DEPTH ",Tdepth_t ,_param->_nb_inst_decod); 99 ALLOC1_SC_SIGNAL( in_DECOD_IS_ACCURATE ," in_DECOD_IS_ACCURATE ",Tcontrol_t ,_param->_nb_inst_decod); 77 100 78 101 ALLOC1_SC_SIGNAL( in_BRANCH_COMPLETE_VAL ," in_BRANCH_COMPLETE_VAL ",Tcontrol_t ,_param->_nb_inst_branch_complete); … … 111 134 ALLOC1_SC_SIGNAL(out_UPDATE_RAS_INDEX ,"out_UPDATE_RAS_INDEX ",Tptr_t ,_param->_nb_inst_update); 112 135 ALLOC1_SC_SIGNAL(out_UPDATE_RAS_PREDICTION_IFETCH ,"out_UPDATE_RAS_PREDICTION_IFETCH ",Tcontrol_t ,_param->_nb_inst_update); 113 ALLOC1_SC_SIGNAL(out_DEPTH_NB_BRANCH ,"out_DEPTH_NB_BRANCH ",Tdepth_t ,_param->_nb_context); 114 ALLOC1_SC_SIGNAL(out_DEPTH_TAIL ,"out_DEPTH_TAIL ",Tdepth_t ,_param->_nb_context); 136 ALLOC1_SC_SIGNAL(out_DEPTH_CURRENT ,"out_DEPTH_CURRENT ",Tdepth_t ,_param->_nb_context); 137 ALLOC1_SC_SIGNAL(out_DEPTH_MIN ,"out_DEPTH_MIN ",Tdepth_t ,_param->_nb_context); 138 ALLOC1_SC_SIGNAL(out_DEPTH_MAX ,"out_DEPTH_MAX ",Tdepth_t ,_param->_nb_context); 115 139 116 140 /******************************************************** … … 136 160 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_PREDICT_RAS_ADDRESS ,_param->_nb_inst_predict); 137 161 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_PREDICT_RAS_INDEX ,_param->_nb_inst_predict); 138 //if (_param->_have_port_depth)139 //INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_PREDICT_UPDATE_PREDICTION_ID ,_param->_nb_inst_predict);162 if (_param->_have_port_depth) 163 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_PREDICT_UPDATE_PREDICTION_ID ,_param->_nb_inst_predict); 140 164 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_VAL ,_param->_nb_inst_decod); 141 165 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DECOD_ACK ,_param->_nb_inst_decod); … … 150 174 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_MISS_IFETCH ,_param->_nb_inst_decod); 151 175 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_MISS_DECOD ,_param->_nb_inst_decod); 152 if (_param->_have_port_ max_depth)176 if (_param->_have_port_depth) 153 177 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_UPDATE_PREDICTION_ID ,_param->_nb_inst_decod); 154 178 //if (_param->_have_port_depth) 155 179 //INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DECOD_DEPTH ,_param->_nb_inst_decod); 180 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_DECOD_IS_ACCURATE ,_param->_nb_inst_decod); 156 181 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_VAL ,_param->_nb_inst_branch_complete); 157 182 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_COMPLETE_ACK ,_param->_nb_inst_branch_complete); 158 183 if (_param->_have_port_context_id) 159 184 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_CONTEXT_ID ,_param->_nb_inst_branch_complete); 160 if (_param->_have_port_ max_depth)185 if (_param->_have_port_depth) 161 186 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_DEPTH ,_param->_nb_inst_branch_complete); 162 187 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_COMPLETE_ADDRESS ,_param->_nb_inst_branch_complete); … … 171 196 // if (_param->_have_port_context_id) 172 197 // INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_CONTEXT_ID ,_param->_nb_context); 173 // if (_param->_have_port_ max_depth)198 // if (_param->_have_port_depth) 174 199 // INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_DEPTH ,_param->_nb_context); 175 200 // INSTANCE1_SC_SIGNAL(_Update_Prediction_Table, in_BRANCH_EVENT_ADDRESS ,_param->_nb_context); … … 196 221 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_INDEX ,_param->_nb_inst_update); 197 222 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_PREDICTION_IFETCH ,_param->_nb_inst_update); 198 for (uint32_t i=0; i<_param->_nb_context; i++)223 if (_param->_have_port_depth) 199 224 { 200 if (_param->_have_port_depth[i]) 201 { 202 INSTANCE_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_TAIL [i]); 203 } 204 INSTANCE_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_NB_BRANCH [i]); 225 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_CURRENT ,_param->_nb_context); 226 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_MIN ,_param->_nb_context); 205 227 } 228 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_DEPTH_MAX ,_param->_nb_context); 206 229 207 230 msg(_("<%s> : Start Simulation ............\n"),name.c_str()); … … 225 248 const int32_t percent_transaction_update = 75; 226 249 250 251 252 std::list<request_t> ufpt; 253 std::list<request_t> upt; 254 227 255 SC_START(0); 228 256 LABEL("Initialisation"); … … 233 261 in_NRESET->write(1); 234 262 235 for (uint32_t i=0; i<_param->_nb_context; i++) 263 Tdepth_t ufpt_bottom [_param->_nb_context]; 264 Tdepth_t ufpt_top [_param->_nb_context]; 265 266 Tdepth_t upt_bottom [_param->_nb_context]; 267 Tdepth_t upt_top [_param->_nb_context]; 268 269 for (uint32_t i=0; i<_param->_nb_context; ++i) 236 270 { 237 PORT_WRITE(in_BRANCH_EVENT_ACK [i],1); 271 ufpt_bottom [i] = 0; 272 ufpt_top [i] = 0; 273 upt_bottom [i] = 0; 274 upt_top [i] = 0; 238 275 } 239 276 240 LABEL("Loop of Test"); 277 for (uint32_t i=0; i<_param->_nb_context; ++i) 278 { 279 TEST(Tdepth_t,out_DEPTH_CURRENT [i]->read(),upt_top [i]); 280 TEST(Tdepth_t,out_DEPTH_MIN [i]->read(),upt_bottom [i]); 281 TEST(Tdepth_t,out_DEPTH_MAX [i]->read(),upt_top [i]); 282 } 241 283 242 284 for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) 243 285 { 244 286 LABEL("Iteration %d",iteration); 245 287 288 for (uint32_t i=0; i<_param->_nb_inst_predict; ++i) 289 in_PREDICT_VAL [i]->write(0); 290 for (uint32_t i=0; i<_param->_nb_inst_decod; ++i) 291 in_DECOD_VAL [i]->write(0); 292 for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i) 293 in_BRANCH_COMPLETE_VAL [i]->write(0); 294 for (uint32_t i=0; i<_param->_nb_context; ++i) 295 in_BRANCH_EVENT_ACK [i]->write(0); 296 for (uint32_t i=0; i<_param->_nb_inst_update; ++i) 297 in_UPDATE_ACK [i]->write(0); 298 299 //--------------------------------------------------------------------- 300 //--------------------------------------------------------------------- 301 // COMMON CASE 302 //--------------------------------------------------------------------- 303 //--------------------------------------------------------------------- 304 if (1) 246 305 { 247 306 uint32_t context = rand() % _param->_nb_context; 248 249 // LABEL("KANE : %d",context); 250 251 LABEL("PREDICT - fill the queue"); 252 307 253 308 { 309 LABEL("PREDICT - fill the queue"); 254 310 uint32_t port = rand() % _param->_nb_inst_predict; 311 312 LABEL(" * context : %d",context); 313 LABEL(" * port : %d",port); 255 314 256 for (uint32_t i=0; i<_param->_size_ queue[context]; i++)315 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 257 316 { 258 259 bool find = false; 317 request_t request; 318 request.context = context; 319 request.address_src = 0xdeadbeef+i; 320 request.address_dest = 0x21071981+i; 321 request.address_good = request.address_dest; 322 request.condition = BRANCH_CONDITION_FLAG_SET; 323 request.take = 1; 324 request.take_good = 1; 325 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 326 request.is_accurate = true; 327 request.miss_ifetch = false; 328 request.miss_decod = false; 329 request.miss_commit = false; 330 request.history = i; 331 request.ras_address = 0xdeaddead+i; 332 request.ras_index = (0x12345678+i)%_param->_size_ras_index[context]; 333 request.ufpt_ptr = ufpt_top [context]; 334 // request.upt_ptr; 335 336 bool have_transaction = false; 260 337 do 261 338 { 262 339 in_PREDICT_VAL [port]->write((rand()%100)<percent_transaction_predict); 263 in_PREDICT_CONTEXT_ID [port]->write(context); 264 in_PREDICT_BTB_ADDRESS_SRC [port]->write(0xdeadbeef+i); 265 in_PREDICT_BTB_ADDRESS_DEST [port]->write(0x21071981+i); 266 in_PREDICT_BTB_CONDITION [port]->write(BRANCH_CONDITION_FLAG_SET); 267 in_PREDICT_BTB_LAST_TAKE [port]->write(1); 268 in_PREDICT_BTB_IS_ACCURATE [port]->write((rand()%100)<percent_transaction_predict); 269 in_PREDICT_DIR_HISTORY [port]->write(i); 270 in_PREDICT_RAS_ADDRESS [port]->write(0xdeaddead+i); 271 in_PREDICT_RAS_INDEX [port]->write((0x12345678+i)%_param->_size_ras_index[context]); 272 273 if (_param->_have_port_depth[context]) 274 { 275 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 276 } 277 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i); 340 in_PREDICT_CONTEXT_ID [port]->write(request.context ); 341 in_PREDICT_BTB_ADDRESS_SRC [port]->write(request.address_src ); 342 in_PREDICT_BTB_ADDRESS_DEST [port]->write(request.address_dest); 343 in_PREDICT_BTB_CONDITION [port]->write(request.condition ); 344 in_PREDICT_BTB_LAST_TAKE [port]->write(request.take ); 345 in_PREDICT_BTB_IS_ACCURATE [port]->write(request.is_accurate ); 346 in_PREDICT_DIR_HISTORY [port]->write(request.history ); 347 in_PREDICT_RAS_ADDRESS [port]->write(request.ras_address ); 348 in_PREDICT_RAS_INDEX [port]->write(request.ras_index ); 349 350 if (_param->_have_port_depth) 351 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 352 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 278 353 279 SC_START(0); 280 281 LABEL("PREDICT [%d] %d - %d (accurate : %d).",port,in_PREDICT_VAL [port]->read(),out_PREDICT_ACK [port]->read(), in_PREDICT_BTB_IS_ACCURATE [port]->read()); 354 SC_START(0); // fct melay 355 356 LABEL("PREDICT [%d] %d - %d (accurate : %d).", 357 port, 358 in_PREDICT_VAL [port]->read(), 359 out_PREDICT_ACK [port]->read(), 360 in_PREDICT_BTB_IS_ACCURATE [port]->read()); 282 361 283 362 if (in_PREDICT_VAL [port]->read() and out_PREDICT_ACK [port]->read()) 284 363 { 285 364 LABEL("PREDICT [%d] - Transaction accepted",port); 286 find = true; 365 have_transaction = true; 366 367 if (_param->_have_port_depth) 368 TEST(Tprediction_ptr_t,out_PREDICT_UPDATE_PREDICTION_ID [port]->read(),ufpt_top [context]); 369 370 ufpt_top [context] = (ufpt_top [context]+1)%_param->_size_ufpt_queue[context]; 287 371 } 288 372 289 SC_START(1); 290 291 } while (not find);292 in_PREDICT_VAL [port]->write(0); 293 294 if (_param->_have_port_depth[context]) 295 {296 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0);297 } 298 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i+1);299 373 SC_START(1); // transition 374 375 } while (not have_transaction); 376 377 ufpt.push_back(request); 378 379 in_PREDICT_VAL [port]->write(0); 380 381 if (_param->_have_port_depth) 382 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 383 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 300 384 } 301 385 } 302 386 303 LABEL("DECOD - hit ifetch"); 304 305 { 387 { 388 LABEL("DECOD"); 306 389 uint32_t port = rand() % _param->_nb_inst_decod; 307 308 for (uint32_t i=0; i<_param->_size_queue[context]; i++) 390 391 LABEL(" * context : %d",context); 392 LABEL(" * port : %d",port); 393 394 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 309 395 { 310 311 bool find = false; 396 request_t request = ufpt.front(); 397 398 bool have_transaction = false; 312 399 do 313 400 { 314 401 in_DECOD_VAL [port]->write((rand()%100)<percent_transaction_decod); 315 in_DECOD_CONTEXT_ID [port]->write(context); 316 in_DECOD_BTB_ADDRESS_SRC [port]->write(0xdeadbeef+i); 317 in_DECOD_BTB_ADDRESS_DEST [port]->write(0x21071981+i); 318 in_DECOD_BTB_CONDITION [port]->write(BRANCH_CONDITION_FLAG_SET); 319 in_DECOD_BTB_LAST_TAKE [port]->write(1); 320 in_DECOD_RAS_ADDRESS [port]->write(0xdeaddead+i); 321 in_DECOD_RAS_INDEX [port]->write((0x12345678+i)%_param->_size_ras_index[context]); 322 in_DECOD_MISS_IFETCH [port]->write(false); 323 in_DECOD_MISS_DECOD [port]->write(false); 324 in_DECOD_UPDATE_PREDICTION_ID [port]->write(i); 325 326 if (_param->_have_port_depth[context]) 327 { 328 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 329 } 330 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 331 332 SC_START(0); 333 334 LABEL("DECOD [%d] %d - %d.",port,in_DECOD_VAL [port]->read(),out_DECOD_ACK [port]->read()); 402 in_DECOD_CONTEXT_ID [port]->write(request.context ); 403 in_DECOD_BTB_ADDRESS_SRC [port]->write(request.address_src ); 404 in_DECOD_BTB_ADDRESS_DEST [port]->write(request.address_dest); 405 in_DECOD_BTB_CONDITION [port]->write(request.condition ); 406 in_DECOD_BTB_LAST_TAKE [port]->write(request.take ); 407 in_DECOD_RAS_ADDRESS [port]->write(request.ras_address ); 408 in_DECOD_RAS_INDEX [port]->write(request.ras_index ); 409 in_DECOD_UPDATE_PREDICTION_ID [port]->write(request.ufpt_ptr ); 410 in_DECOD_MISS_IFETCH [port]->write(request.miss_ifetch ); 411 in_DECOD_MISS_DECOD [port]->write(request.miss_decod ); 412 in_DECOD_IS_ACCURATE [port]->write(request.is_accurate ); 413 414 SC_START(0); // fct melay 415 416 LABEL("DECOD [%d] %d - %d", 417 port, 418 in_PREDICT_VAL [port]->read(), 419 out_PREDICT_ACK [port]->read()); 335 420 336 421 if (in_DECOD_VAL [port]->read() and out_DECOD_ACK [port]->read()) 337 422 { 338 LABEL("DECOD [%d] - Transaction accepted",port); 339 find = true; 423 LABEL("DECOD [%d] - Transaction accepted",port); 424 have_transaction = true; 425 426 request.upt_ptr = upt_top [context]; 427 upt.push_back(request); 428 ufpt.pop_front(); 429 430 upt_top [context] = (upt_top [context]+1)%_param->_size_upt_queue[context]; 340 431 } 341 342 SC_START(1); 343 344 } while (not find); 432 433 SC_START(1); // transition 434 435 } while (not have_transaction); 436 345 437 in_DECOD_VAL [port]->write(0); 346 438 347 if (_param->_have_port_depth[context]) 348 { 349 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 350 } 351 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 352 } 353 } 439 if (_param->_have_port_depth) 440 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 441 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 442 } 443 } 444 445 { 446 LABEL("BRANCH_COMPLETE - hit ifetch"); 354 447 355 LABEL("BRANCH_COMPLETE - hit ifetch");448 uint32_t port = rand() % _param->_nb_inst_branch_complete; 356 449 357 { 358 uint32_t port = rand() % _param->_nb_inst_branch_complete; 359 360 for (uint32_t i=0; i<_param->_size_queue[context]; i++) 450 LABEL(" * port : %d",port); 451 452 std::list<request_t>::iterator it_upt = upt.begin(); 453 454 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 455 for (uint32_t i=0; i<upt.size(); i++) 361 456 { 362 bool find = false; 457 bool have_transaction = false; 458 363 459 do 364 460 { 365 in_BRANCH_COMPLETE_VAL [port]->write((rand()%100)<percent_transaction_branch_complete); 366 in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(context); 367 in_BRANCH_COMPLETE_DEPTH [port]->write(i); 368 in_BRANCH_COMPLETE_ADDRESS [port]->write(0xcacacaca+i); 369 in_BRANCH_COMPLETE_FLAG [port]->write(1); 370 371 if (_param->_have_port_depth[context]) 372 { 373 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 374 } 375 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 461 in_BRANCH_COMPLETE_VAL [port]->write((rand()%100)<percent_transaction_branch_complete); 462 in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(it_upt->context ); 463 in_BRANCH_COMPLETE_DEPTH [port]->write(it_upt->upt_ptr ); 464 in_BRANCH_COMPLETE_ADDRESS [port]->write(it_upt->address_good); 465 in_BRANCH_COMPLETE_FLAG [port]->write(it_upt->flag ); 466 467 if (_param->_have_port_depth) 468 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 469 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 376 470 377 471 SC_START(0); … … 382 476 { 383 477 LABEL("BRANCH_COMPLETE [%d] - Transaction accepted",port); 384 find= true;478 have_transaction = true; 385 479 386 TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),0); 387 TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE [port]->read(),1); 388 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC [port]->read(),0xdeadbeef+i); 389 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST [port]->read(),0x21071981+i); 480 TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit ); 481 TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE [port]->read(),it_upt->take_good ); 482 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC [port]->read(),it_upt->address_src ); 483 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST [port]->read(),it_upt->address_good); 484 485 it_upt ++; 390 486 } 391 487 392 488 SC_START(1); 393 394 } while (not find); 395 in_BRANCH_COMPLETE_VAL 489 } while (not have_transaction); 490 491 in_BRANCH_COMPLETE_VAL [port]->write(0); 396 492 397 if (_param->_have_port_depth[context]) 398 { 399 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 400 } 401 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 493 if (_param->_have_port_depth) 494 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 495 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 402 496 } 403 497 } 498 499 { 500 LABEL("UPDATE - hit ifetch"); 404 501 405 LABEL("UPDATE - hit ifetch");502 uint32_t port = 0; 406 503 407 { 408 uint32_t port = 0; //rand() % _param->_nb_inst_update; 409 410 for (uint32_t i=0; i<_param->_size_queue[context]; i++) 504 LABEL(" * port : %d",port); 505 std::list<request_t>::iterator it_upt = upt.begin(); 506 507 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 508 for (uint32_t i=0; i<upt.size(); i++) 411 509 { 412 bool find = false; 510 LABEL("Address_src (-1): %.8x (%d)",out_UPDATE_BTB_ADDRESS_SRC [i]->read(),upt.size()); 511 512 bool have_transaction = false; 513 413 514 do 414 515 { 516 LABEL("Address_src (0) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 517 415 518 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 416 519 520 // if (_param->_have_port_depth) 521 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 522 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 523 524 LABEL("Address_src (1) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 417 525 SC_START(0); 526 LABEL("Address_src (2) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 527 528 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 418 529 419 530 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 420 531 { 421 532 LABEL("UPDATE [%d] - Transaction accepted",port); 422 423 find = true; 424 425 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(), context); 426 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(), 0); 427 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(), 1); 428 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(), 1); 429 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(), 0xdeadbeef+i); 430 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(), 0x21071981+i); 431 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(), BRANCH_CONDITION_FLAG_SET); 432 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(), 1); 433 if (_param->_have_port_history) 434 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(), i); 435 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(), 0); 436 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(), 0); 437 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(), 0xdeaddead+i); 438 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(), (0x12345678+i)%_param->_size_ras_index[context]); 439 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(), 1); 533 have_transaction = true; 534 535 if (_param->_have_port_context_id) 536 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [i]->read(),it_upt->context); 537 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [i]->read(),it_upt->miss_commit); 538 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [i]->read(),it_upt->flag); 539 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [i]->read(),update_btb(it_upt->condition)); 540 if (update_btb(it_upt->condition)) 541 { 542 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [i]->read(),it_upt->address_src); 543 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [i]->read(),it_upt->address_dest); 544 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [i]->read(),it_upt->condition); 545 } 546 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [i]->read(),update_dir(it_upt->condition)); 547 if (update_dir(it_upt->condition)) 548 if (_param->_have_port_history) 549 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [i]->read(),it_upt->history); 550 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [i]->read(),update_ras(it_upt->condition)); 551 if (update_ras(it_upt->condition)) 552 { 553 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [i]->read(),push_ras (it_upt->condition)); 554 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [i]->read(),it_upt->ras_address); 555 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [i]->read(),it_upt->ras_index); 556 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [i]->read(),not it_upt->miss_ifetch); 557 } 558 ++ it_upt; 440 559 } 441 560 442 561 SC_START(1); 443 444 } while (not find); 445 in_UPDATE_ACK [port]->write(0); 562 LABEL("Address_src (3) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 563 564 } while (not have_transaction); 565 566 LABEL("Address_src (4) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 567 in_UPDATE_ACK [port]->write(0); 568 LABEL("Address_src (5) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 569 // if (_param->_have_port_depth) 570 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 571 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 446 572 } 447 448 LABEL("Wait a moment"); 449 SC_START(2*_param->_size_queue[context]); 450 451 // wait the garbage collector 452 while ((not (_param->_have_port_depth[context]) or (out_DEPTH_TAIL [context]->read() != 0)) and 453 (out_DEPTH_NB_BRANCH[context]->read() != 0)) 454 { 455 LABEL("DEPTH [%d] nb_branch : %d - tail : %d",context,out_DEPTH_NB_BRANCH[context]->read(), out_DEPTH_TAIL [context]->read()); 456 SC_START(1); 457 } 573 upt.clear(); 458 574 } 575 576 // Wait Garbage Collector 577 { 578 upt_bottom [context] = (upt_bottom [context]+_param->_size_ufpt_queue[context])%_param->_size_upt_queue[context]; 579 // upt_top [context] = (upt_top [context]); 580 581 while ((upt_bottom [context] != out_DEPTH_MIN [context]->read()) or 582 (upt_top [context] != out_DEPTH_MAX [context]->read())) 583 SC_START(1); 584 585 } 459 586 } 460 587 461 { 462 uint32_t context = rand() % _param->_nb_context; 463 464 // LABEL("KANE : %d",context); 465 466 LABEL("PREDICT - fill the queue"); 467 468 { 469 uint32_t port = rand() % _param->_nb_inst_predict; 470 471 for (uint32_t i=0; i<_param->_size_queue[context]; i++) 472 { 473 474 bool find = false; 475 do 476 { 477 in_PREDICT_VAL [port]->write((rand()%100)<percent_transaction_predict); 478 in_PREDICT_CONTEXT_ID [port]->write(context); 479 in_PREDICT_BTB_ADDRESS_SRC [port]->write(0xdeadbeef+i); 480 in_PREDICT_BTB_ADDRESS_DEST [port]->write(0x21071981+i); 481 in_PREDICT_BTB_CONDITION [port]->write(BRANCH_CONDITION_FLAG_SET); 482 in_PREDICT_BTB_LAST_TAKE [port]->write(1); 483 in_PREDICT_BTB_IS_ACCURATE [port]->write((rand()%100)<percent_transaction_predict); 484 in_PREDICT_DIR_HISTORY [port]->write(i); 485 in_PREDICT_RAS_ADDRESS [port]->write(0xdeaddead+i); 486 in_PREDICT_RAS_INDEX [port]->write((0x12345678+i)%_param->_size_ras_index[context]); 487 488 if (_param->_have_port_depth[context]) 489 { 490 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 491 } 492 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i); 493 494 SC_START(0); 495 496 LABEL("PREDICT [%d] %d - %d (accurate : %d).",port,in_PREDICT_VAL [port]->read(),out_PREDICT_ACK [port]->read(), in_PREDICT_BTB_IS_ACCURATE [port]->read()); 497 498 if (in_PREDICT_VAL [port]->read() and out_PREDICT_ACK [port]->read()) 499 { 500 LABEL("PREDICT [%d] - Transaction accepted",port); 501 find = true; 502 } 503 504 SC_START(1); 505 506 } while (not find); 507 in_PREDICT_VAL [port]->write(0); 508 509 if (_param->_have_port_depth[context]) 510 { 511 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 512 } 513 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), i+1); 514 } 515 } 516 517 LABEL("DECOD - hit ifetch"); 518 519 { 520 uint32_t port = rand() % _param->_nb_inst_decod; 521 522 for (uint32_t i=0; i<_param->_size_queue[context]; i++) 523 { 524 525 bool find = false; 526 do 527 { 528 in_DECOD_VAL [port]->write((rand()%100)<percent_transaction_decod); 529 in_DECOD_CONTEXT_ID [port]->write(context); 530 in_DECOD_BTB_ADDRESS_SRC [port]->write(0xdeadbeef+i); 531 in_DECOD_BTB_ADDRESS_DEST [port]->write(0x21071981+i); 532 in_DECOD_BTB_CONDITION [port]->write(BRANCH_CONDITION_FLAG_SET); 533 in_DECOD_BTB_LAST_TAKE [port]->write(1); 534 in_DECOD_RAS_ADDRESS [port]->write(0xdeaddead+i); 535 in_DECOD_RAS_INDEX [port]->write((0x12345678+i)%_param->_size_ras_index[context]); 536 in_DECOD_MISS_IFETCH [port]->write(false); 537 in_DECOD_MISS_DECOD [port]->write(false); 538 in_DECOD_UPDATE_PREDICTION_ID [port]->write(i); 539 540 if (_param->_have_port_depth[context]) 541 { 542 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 543 } 544 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 545 546 SC_START(0); 547 548 LABEL("DECOD [%d] %d - %d.",port,in_DECOD_VAL [port]->read(),out_DECOD_ACK [port]->read()); 549 550 if (in_DECOD_VAL [port]->read() and out_DECOD_ACK [port]->read()) 551 { 552 LABEL("DECOD [%d] - Transaction accepted",port); 553 find = true; 554 } 555 556 SC_START(1); 557 558 } while (not find); 559 in_DECOD_VAL [port]->write(0); 560 561 if (_param->_have_port_depth[context]) 562 { 563 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 564 } 565 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 566 } 567 } 568 569 LABEL("BRANCH_COMPLETE - hit ifetch"); 570 571 { 572 uint32_t port = rand() % _param->_nb_inst_branch_complete; 573 574 { 575 uint32_t i=0; 576 bool find = false; 577 do 578 { 579 in_BRANCH_COMPLETE_VAL [port]->write((rand()%100)<percent_transaction_branch_complete); 580 in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(context); 581 in_BRANCH_COMPLETE_DEPTH [port]->write(i); 582 in_BRANCH_COMPLETE_ADDRESS [port]->write(0xcacacaca+i); 583 in_BRANCH_COMPLETE_FLAG [port]->write(0); 584 585 if (_param->_have_port_depth[context]) 586 { 587 TEST(Tdepth_t,out_DEPTH_TAIL [context]->read(), 0); 588 } 589 TEST(Tdepth_t,out_DEPTH_NB_BRANCH[context]->read(), _param->_size_queue[context]); 590 591 SC_START(0); 592 593 LABEL("BRANCH_COMPLETE [%d] %d - %d.",port,in_BRANCH_COMPLETE_VAL [port]->read(),out_BRANCH_COMPLETE_ACK [port]->read()); 594 595 if (in_BRANCH_COMPLETE_VAL [port]->read() and out_BRANCH_COMPLETE_ACK [port]->read()) 596 { 597 LABEL("BRANCH_COMPLETE [%d] - Transaction accepted",port); 598 find = true; 599 600 TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),1); 601 TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE [port]->read(),0); 602 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC [port]->read(),0xdeadbeef+i); 603 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST [port]->read(),0x21071981+i); 604 } 605 606 SC_START(1); 607 608 } while (not find); 609 in_BRANCH_COMPLETE_VAL [port]->write(0); 610 } 611 } 612 613 LABEL("UPDATE - miss ifetch"); 614 615 { 616 uint32_t port = 0; //rand() % _param->_nb_inst_update; 617 618 // for (uint32_t i=0; i<_param->_size_queue[context]; i++) 619 { 620 uint32_t i=0; 621 622 bool find = false; 623 do 624 { 625 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 626 627 SC_START(0); 628 629 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 630 { 631 LABEL("UPDATE [%d] - Transaction accepted",port); 632 633 find = true; 634 635 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(), context); 636 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(), 1); 637 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(), 0); 638 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(), 1); 639 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(), 0xdeadbeef+i); 640 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(), 0x21071981+i); 641 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(), BRANCH_CONDITION_FLAG_SET); 642 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(), 1); 643 if (_param->_have_port_history) 644 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(), i); 645 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(), 0); 646 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(), 0); 647 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(), 0xdeaddead+i); 648 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(), (0x12345678+i)%_param->_size_ras_index[context]); 649 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(), 1); 650 } 651 652 SC_START(1); 653 654 } while (not find); 655 in_UPDATE_ACK [port]->write(0); 656 } 657 658 LABEL("Wait a moment"); 659 SC_START(_param->_size_queue[context]); 660 661 // wait the garbage collector 662 while (((not (_param->_have_port_depth[context])) or (out_DEPTH_TAIL [context]->read() != 0)) and 663 (out_DEPTH_NB_BRANCH[context]->read() != 0)) 664 { 665 LABEL("DEPTH [%d] nb_branch : %d - tail : %d",context,out_DEPTH_NB_BRANCH[context]->read(), out_DEPTH_TAIL [context]->read()); 666 SC_START(1); 667 } 668 } 669 } 670 671 LABEL ("Yo1"); 672 SC_START(1); 673 LABEL ("Yo2"); 674 675 } 588 }// ITERATION 676 589 677 590 /******************************************************** … … 699 612 delete [] in_PREDICT_RAS_ADDRESS ; 700 613 delete [] in_PREDICT_RAS_INDEX ; 701 //delete [] out_PREDICT_UPDATE_PREDICTION_ID;614 delete [] out_PREDICT_UPDATE_PREDICTION_ID; 702 615 703 616 // ~~~~~[ Interface : "decod" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 715 628 delete [] in_DECOD_UPDATE_PREDICTION_ID ; 716 629 //delete [] out_DECOD_DEPTH ; 630 delete [] in_DECOD_IS_ACCURATE ; 717 631 718 632 // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 756 670 757 671 // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 758 delete [] out_DEPTH_NB_BRANCH; 759 delete [] out_DEPTH_TAIL; 672 delete [] out_DEPTH_CURRENT; 673 delete [] out_DEPTH_MIN; 674 delete [] out_DEPTH_MAX; 760 675 761 676 #endif
Note: See TracChangeset
for help on using the changeset viewer.