Changeset 100 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/SelfTest/src/test.cpp
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
Makefile.flags
Makefile.tools
Makefile.tools_path
-
Property
svn:ignore
set to
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/SelfTest/src/test.cpp
r88 r100 362 362 363 363 // Initialisation 364 const bool test1 = false; 365 const bool test2 = true ; 366 const bool test3 = false; 367 const bool test4 = false; 364 368 365 369 const uint32_t seed = 0; … … 402 406 LABEL("Iteration %d",iteration); 403 407 408 if (test1) 404 409 { 405 410 LABEL("Test sequential"); … … 481 486 } 482 487 488 if (test2) 483 489 { 484 490 LABEL("Test no sequential - L.J"); … … 489 495 for (uint32_t i=0; i<_param->_nb_instruction [context]; i++) 490 496 { 491 Taddress_t addr = (1<<(_param->_nb_instruction[context]+4)); 492 Taddress_t addr_src = addr+i; 497 Taddress_t pc_current = (1<<(_param->_nb_instruction[context]+3)); 498 Taddress_t pc_previous = pc_current-1; 499 Taddress_t addr_src = pc_current+i; 493 500 Taddress_t addr_dest = 0xdeadbeef; 494 495 in_PREDICT_PC_PREVIOUS [context]->write(0); 496 in_PREDICT_PC_CURRENT [context]->write(addr); 497 in_PREDICT_PC_CURRENT_IS_DS_TAKE [context]->write(0); 501 Tcontrol_t is_ds_take= rand()%2; 502 503 in_PREDICT_PC_PREVIOUS [context]->write(pc_previous); 504 in_PREDICT_PC_CURRENT [context]->write(pc_current); 505 in_PREDICT_PC_CURRENT_IS_DS_TAKE [context]->write(is_ds_take); 498 506 499 507 bool find = false; … … 515 523 LABEL(" * BTB address : 0x%x",out_PREDICT_BTB_ADDRESS [port]->read()); 516 524 if ((out_PREDICT_BTB_CONTEXT_ID [port]->read() == context) and 517 (out_PREDICT_BTB_ADDRESS [port]->read() == addr))525 (out_PREDICT_BTB_ADDRESS [port]->read() == (is_ds_take)?pc_previous:pc_current )) 518 526 { 519 527 in_PREDICT_BTB_ACK [port]->write((rand()%100)<percent_transaction_predict); … … 531 539 SC_START(0); 532 540 541 LABEL ("PREDICT_VAL : %d", in_PREDICT_VAL[context]->read()); 542 LABEL ("PREDICT_ACK : %d",out_PREDICT_ACK[context]->read()); 543 533 544 if (in_PREDICT_VAL[context]->read() and out_PREDICT_ACK[context]->read()) 534 545 { 535 546 LABEL ("PREDICT [%d] - Transaction accepted",context); 547 LABEL (" * pc_previous: 0x%x",pc_previous ); 548 LABEL (" * pc_current : 0x%x",pc_current ); 549 LABEL (" * addr_src : 0x%x",addr_src ); 550 LABEL (" * addr_dest : 0x%x",addr_dest ); 551 LABEL (" * is_ds_take : %d" ,is_ds_take); 552 536 553 find = true; 537 538 TEST(Taddress_t ,out_PREDICT_PC_NEXT [context]->read(),addr_dest); 539 TEST(Tcontrol_t ,out_PREDICT_PC_NEXT_IS_DS_TAKE [context]->read(),i==(_param->_nb_instruction [context]-1)); 554 555 Tcontrol_t next_is_ds_take = (not is_ds_take and (i==(_param->_nb_instruction [context]-1))); 556 557 TEST(Tcontrol_t ,out_PREDICT_PC_NEXT_IS_DS_TAKE [context]->read(), next_is_ds_take); 558 TEST(Taddress_t ,out_PREDICT_PC_NEXT [context]->read(),(next_is_ds_take)?(addr_src+1):addr_dest); 540 559 TEST(Tinst_ifetch_ptr_t,out_PREDICT_INST_IFETCH_PTR [context]->read(),i); 541 TEST(Tbranch_state_t ,out_PREDICT_BRANCH_STATE [context]->read(),BRANCH_STATE_NSPEC_TAKE);560 TEST(Tbranch_state_t ,out_PREDICT_BRANCH_STATE [context]->read(),(next_is_ds_take)?BRANCH_STATE_NONE:BRANCH_STATE_NSPEC_TAKE); 542 561 // TEST(Tprediction_ptr_t ,out_PREDICT_BRANCH_UPDATE_PREDICTION_ID [context]->read(),0); 543 562 544 uint32_t k=((addr_src%_param->_nb_instruction[context])==_param->_nb_instruction[context]-1)?_param->_nb_instruction[context]:((addr_src%_param->_nb_instruction[context])+2); 563 uint32_t k=((is_ds_take)?1:((next_is_ds_take)?_param->_nb_instruction[context]:((addr_src%_param->_nb_instruction [context])+2))); 564 565 566 // ((addr_src%_param->_nb_instruction[context])==_param->_nb_instruction[context]-1)?_param->_nb_instruction[context]:((addr_src%_param->_nb_instruction[context])+2); 567 545 568 LABEL("instruction enable : "); 546 569 LABEL(" [0:%d[ = 1",k); 547 LABEL(" [%d:%d[ = 1",k,_param->_nb_instruction[context]);570 LABEL(" [%d:%d[ = 0",k,_param->_nb_instruction[context]); 548 571 for (uint32_t j=0; j<k; j++) 549 572 TEST(Tcontrol_t ,out_PREDICT_INSTRUCTION_ENABLE [context][j]->read(),1); 550 573 for (uint32_t j=k; j<_param->_nb_instruction[context]; j++) 551 574 TEST(Tcontrol_t ,out_PREDICT_INSTRUCTION_ENABLE [context][j]->read(),0); 552 575 553 576 TEST(Tcontrol_t ,out_PREDICT_BTB_VAL [port]->read(),1); 554 577 TEST(Tcontext_t ,out_PREDICT_BTB_CONTEXT_ID [port]->read(),context); 555 TEST(Taddress_t ,out_PREDICT_BTB_ADDRESS [port]->read(), addr);578 TEST(Taddress_t ,out_PREDICT_BTB_ADDRESS [port]->read(),(is_ds_take)?pc_previous:pc_current); 556 579 } 557 580 … … 571 594 } 572 595 } 573 596 597 if (test3) 574 598 { 575 599 LABEL("Decod - Ok"); … … 618 642 } 619 643 644 if (test4) 620 645 { 621 646 LABEL("Decod - Ko");
Note: See TracChangeset
for help on using the changeset viewer.