Changeset 112 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp
- Timestamp:
- Mar 18, 2009, 11:36:26 PM (15 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/src/Update_Prediction_Table_transition.cpp
r111 r112 53 53 reg_EVENT_VAL [i] = false; 54 54 reg_EVENT_STATE [i] = EVENT_STATE_OK; 55 reg_EVENT_IS_BRANCH [i] = true; 55 56 } 56 57 } … … 100 101 // Test if state is end 101 102 // if (end_ok or end_ko) 103 104 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state is STATE_END : %d",end); 105 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_BOTTOM (before) : %d",reg_UPT_BOTTOM [i]); 106 102 107 if (end) 103 108 { … … 108 113 branchement_log_file [num_thread] 109 114 << std::hex 110 << "0x" << reg_UPDATE_PREDICTION_TABLE [i][bottom]._address_src << " "111 << "0x" << reg_UPDATE_PREDICTION_TABLE [i][bottom]._address_dest << " "115 << "0x" << reg_UPDATE_PREDICTION_TABLE [i][bottom]._address_src << " " 116 << "0x" << reg_UPDATE_PREDICTION_TABLE [i][bottom]._address_dest << " " 112 117 << std::dec 113 << reg_UPDATE_PREDICTION_TABLE [i][bottom]._good_take << " " 118 << reg_UPDATE_PREDICTION_TABLE [i][bottom]._good_take << " - " 119 << "[" << sc_simulation_time() << "] " << " " 120 << reg_UPDATE_PREDICTION_TABLE [i][bottom]._miss_prediction << " " 121 << reg_UPDATE_PREDICTION_TABLE [i][bottom]._ifetch_prediction << " " 122 << "(" << (uint32_t)reg_UPDATE_PREDICTION_TABLE [i][bottom]._condition << ")" 114 123 << std::endl; 115 124 } … … 128 137 // if (bottom = reg_UPT_UPDATE [i]) 129 138 // reg_UPT_UPDATE [i] = reg_UPT_BOTTOM [i]; 130 131 if (reg_EVENT_VAL [i] and (reg_EVENT_UPT_PTR [i] == bottom)) 139 }// @@@ 140 141 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_BOTTOM (after ) : %d",reg_UPT_BOTTOM [i]); 142 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_VAL : %d",reg_EVENT_VAL [i]); 143 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_UPT_PTR : %d",reg_EVENT_UPT_PTR [i]); 144 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_UPT_FULL : %d",reg_EVENT_UPT_FULL[i]); 145 146 if (reg_EVENT_VAL [i] and (reg_EVENT_UPT_PTR [i] == bottom)) 147 { 148 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * END EVENT"); 149 150 if ((reg_EVENT_IS_BRANCH [i] == false) and (reg_EVENT_UPT_FULL [i] == false)) 151 reg_EVENT_STATE[i] = EVENT_STATE_OK; 152 153 if ((reg_EVENT_IS_BRANCH [i] == true) or (reg_EVENT_UPT_FULL [i] == false)) 132 154 { 133 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * END EVENT"); 134 135 reg_EVENT_VAL [i] = false; 136 reg_UPT_TOP [i] = reg_UPT_TOP_EVENT [i]; 137 reg_UPT_UPDATE [i] = reg_UPT_TOP_EVENT [i]; 138 139 if (reg_UPT_BOTTOM [i] != reg_UPT_TOP [i]) 140 reg_UPT_EMPTY [i] = false; 141 142 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_TOP : %d",reg_UPT_TOP [i]); 143 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_TOP_EVENT : %d",reg_UPT_TOP_EVENT [i]); 144 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_UPDATE : %d",reg_UPT_UPDATE [i]); 145 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_EMPTY : %d",reg_UPT_EMPTY [i]); 155 reg_EVENT_VAL [i] = false; 156 // reg_EVENT_IS_BRANCH [i] = true; 157 reg_UPT_TOP [i] = reg_UPT_TOP_EVENT [i]; 158 reg_UPT_UPDATE [i] = reg_UPT_TOP_EVENT [i]; 159 160 if (reg_UPT_BOTTOM [i] != reg_UPT_TOP [i]) 161 reg_UPT_EMPTY [i] = false; 146 162 } 147 163 164 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_TOP : %d",reg_UPT_TOP [i]); 165 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_TOP_EVENT : %d",reg_UPT_TOP_EVENT [i]); 166 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_UPDATE : %d",reg_UPT_UPDATE [i]); 167 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_EMPTY : %d",reg_UPT_EMPTY [i]); 168 148 169 } 170 171 if (end) 172 reg_EVENT_UPT_FULL [i] = false; 149 173 } 150 174 } … … 245 269 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_UPDATE_CONTEXT (decod - miss - no flush ufpt)",context); 246 270 reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; 271 // reg_EVENT_SOURCE[context] = EVENT_SOURCE_UFPT; 247 272 } 248 273 else … … 251 276 reg_EVENT_STATE [context] = EVENT_STATE_MISS_FLUSH_UFPT; 252 277 } 253 reg_EVENT_SOURCE [context] = EVENT_SOURCE_UFPT;254 278 255 279 // Flush UPFT 256 280 flush_UFPT [context] = true; 257 281 282 reg_EVENT_IS_BRANCH [context] = true; 258 283 reg_EVENT_DEPTH [context] = upt_ptr_write; 259 284 reg_EVENT_ADDRESS_SRC [context] = address_src; // delay_slot is compute in Context_State … … 357 382 (internal_UPDATE_VAL_WITHOUT_ACK [i] and can_continue [context])) 358 383 { 359 Tdepth_t depth = internal_UPDATE_DEPTH 384 Tdepth_t depth = internal_UPDATE_DEPTH [i]; 360 385 361 386 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * UPDATE[%d] - Accepted",i); … … 369 394 // if (reg_UFPT_UPDATE [context] == reg_UFPT_BOTTOM [context]) 370 395 if ((--reg_UFPT_NB_UPDATE [context])==0) 371 switch (reg_EVENT_STATE [context]) 372 { 373 case EVENT_STATE_MISS_FLUSH_UFPT : reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; break; 374 // impossible to have an update on ufpt and reg_upt_update>reg_upt_top 375 case EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT : reg_EVENT_STATE [context] = EVENT_STATE_MISS_FLUSH_UPT ; break; 376 case EVENT_STATE_EVENT_FLUSH_UFPT : reg_EVENT_STATE [context] = EVENT_STATE_OK ; break; 377 case EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT: reg_EVENT_STATE [context] = EVENT_STATE_EVENT_FLUSH_UPT; break; 378 default : break; 379 } 396 { 397 switch (reg_EVENT_STATE [context]) 398 { 399 case EVENT_STATE_MISS_FLUSH_UFPT : 400 { 401 reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; 402 // reg_EVENT_SOURCE[context] = EVENT_SOURCE_UFPT; 403 404 break; 405 } 406 // impossible to have an update on ufpt and reg_upt_update>reg_upt_top 407 case EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT : reg_EVENT_STATE [context] = EVENT_STATE_MISS_FLUSH_UPT ; break; 408 case EVENT_STATE_EVENT_FLUSH_UFPT : reg_EVENT_STATE [context] = EVENT_STATE_OK ; break; 409 case EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT: reg_EVENT_STATE [context] = EVENT_STATE_EVENT_FLUSH_UPT; break; 410 default : break; 411 } 412 } 380 413 381 414 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * Update Fetch Prediction Table"); … … 405 438 { 406 439 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * Update Prediction Table"); 407 440 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_UPDATE (before) : %d",reg_UPT_UPDATE [context]); 441 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_STATE : %s",toString(reg_EVENT_STATE [context]).c_str()); 442 408 443 // Change state 409 444 #ifdef DEBUG_TEST … … 430 465 431 466 if (ok or ko) 432 reg_UPDATE_PREDICTION_TABLE [context][depth]._retire_ok = true; 467 { 468 reg_UPDATE_PREDICTION_TABLE [context][depth]._retire_ok = true; 469 reg_UPDATE_PREDICTION_TABLE [context][depth]._miss_prediction = ko; 470 } 433 471 434 472 // Have an update, test the state to transiste to the good state … … 444 482 reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_END_KO; 445 483 446 reg_EVENT_VAL [context] = true; 447 reg_EVENT_UPT_PTR [context] = depth; 484 reg_EVENT_VAL [context] = true; 485 reg_EVENT_UPT_PTR [context] = depth; 486 // reg_EVENT_UPT_FULL [context] = 0; 487 // reg_EVENT_UPT_FULL [i] = (not reg_UPT_EMPTY [i] and (bottom == reg_UPT_TOP [i])); 488 448 489 449 490 #ifdef STATISTICS … … 473 514 // Update pointer 474 515 // * if update RAS : update pointer is decreaste until it equal at top pointer 516 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * internal_UPDATE_RAS [%d] : %d",i,internal_UPDATE_RAS [i]); 517 475 518 if (internal_UPDATE_RAS [i]) 476 519 { 477 520 // if end_event, restart too bottom, else decrease pointer 478 521 bool end_event = (reg_UPT_UPDATE [context] == reg_UPT_TOP [context]); 522 523 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * end_event : %d",end_event); 524 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * bottom : %d",reg_UPT_BOTTOM[context]); 479 525 480 reg_UPT_UPDATE [context] = (end_event)?reg_UPT_BOTTOM[context]:(((depth==0)?_param->_size_upt_queue[context]:depth)-1);481 526 if (end_event) 482 527 { 483 // reg_UPT_UPDATE [context] = reg_UPT_BOTTOM[context]; 528 reg_UPT_UPDATE [context] = (end_event)?reg_UPT_BOTTOM[context]:(((depth==0)?_param->_size_upt_queue[context]:depth)-1); 529 // reg_UPT_UPDATE [context] = reg_UPT_BOTTOM[context]; 484 530 485 531 if (reg_EVENT_STATE [context] == EVENT_STATE_EVENT_FLUSH_UPT) … … 488 534 } 489 535 else 490 reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; 536 { 537 reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; 538 // reg_EVENT_SOURCE[context] = EVENT_SOURCE_UPT; 539 } 491 540 } 492 541 else … … 497 546 else 498 547 { 548 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * next update"); 549 499 550 // increase pointer 500 551 reg_UPT_UPDATE [context] = (depth+1)%_param->_size_upt_queue[context]; … … 502 553 503 554 // Free the branch with no accurate ? 504 if ( 555 if ((reg_UPDATE_PREDICTION_TABLE [context][depth]._is_accurate == false) and not ko) 505 556 reg_IS_ACCURATE [context] = true; 557 558 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_UPDATE (after ) : %d",reg_UPT_UPDATE[context]); 559 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_STATE : %s",toString(reg_EVENT_STATE [context]).c_str()); 506 560 } 507 561 } … … 513 567 reg_UPDATE_PRIORITY = (reg_UPDATE_PRIORITY+1)%_param->_nb_context; 514 568 } 515 516 569 517 570 // =================================================================== … … 533 586 534 587 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_COMPLETE[%d] - Accepted",i); 535 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",context); 536 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth : %d",depth); 537 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss : %d",miss); 588 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",context); 589 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth : %d",depth); 590 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss : %d",miss); 591 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_STATE : %s",toString(reg_EVENT_STATE [context]).c_str()); 538 592 539 593 if (miss) … … 546 600 event_state_t event_state = reg_EVENT_STATE [context]; 547 601 upt_state_t event_top = reg_UPDATE_PREDICTION_TABLE [context][top]._state; 602 603 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * event_top : %s",toString(event_top).c_str()); 604 548 605 bool previous_ufpt_event = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or 549 606 (event_state == EVENT_STATE_MISS_FLUSH_UFPT ) or … … 551 608 (event_state == EVENT_STATE_EVENT_FLUSH_UFPT )); 552 609 553 bool previous_upt_event = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or 554 (event_state == EVENT_STATE_MISS_FLUSH_UPT ) or 555 (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or 556 (event_state == EVENT_STATE_EVENT_FLUSH_UPT ) or 557 (event_top == UPDATE_PREDICTION_STATE_END_KO ) or 558 (event_top == UPDATE_PREDICTION_STATE_KO ) 559 // (event_state == EVENT_STATE_WAIT_END_EVENT ) or 560 // ((event_state == EVENT_STATE_UPDATE_CONTEXT ) and 561 // (reg_EVENT_SOURCE [context] == EVENT_SOURCE_UPT)) 562 ); 610 bool previous_upt_event = (false 611 or (event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) 612 or (event_state == EVENT_STATE_MISS_FLUSH_UPT ) 613 or (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) 614 or (event_state == EVENT_STATE_EVENT_FLUSH_UPT ) 615 or (event_top == UPDATE_PREDICTION_STATE_END_KO ) 616 or (event_top == UPDATE_PREDICTION_STATE_KO ) 617 // or (event_state == EVENT_STATE_WAIT_END_EVENT ) 618 // or ((event_state == EVENT_STATE_UPDATE_CONTEXT ) 619 // and (reg_EVENT_SOURCE [context] == EVENT_SOURCE_UPT)) 620 ); 563 621 // bool update_ras = (new_update != depth); 564 622 … … 568 626 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * previous_upt_event : %d",previous_upt_event); 569 627 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * previous_ufpt_event : %d",previous_ufpt_event); 570 628 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_UPDATE : %d",reg_UPT_UPDATE [context]); 629 571 630 // Have a miss !!! 572 631 // Flush UPFT 573 flush_UFPT [context] = not previous_ufpt_event;632 flush_UFPT [context] |= not previous_ufpt_event; 574 633 575 634 if (reg_UPDATE_PREDICTION_TABLE [context][depth]._state == UPDATE_PREDICTION_STATE_WAIT_END) … … 587 646 reg_UPT_TOP [context] = depth; 588 647 // reg_UPT_TOP_EVENT [context] = top; 589 648 590 649 if (not previous_upt_event) 591 650 { … … 604 663 // Have already update predictor 605 664 reg_UPDATE_PREDICTION_TABLE [context][top]._state = UPDATE_PREDICTION_STATE_END; 665 reg_UPT_UPDATE [context] = new_update; 606 666 break; 607 667 } … … 649 709 } 650 710 } 651 reg_EVENT_SOURCE [context] = EVENT_SOURCE_UPT;711 // reg_EVENT_SOURCE [context] = EVENT_SOURCE_UPT; 652 712 653 713 // else no update 654 714 715 reg_EVENT_IS_BRANCH [context] = true; 655 716 reg_EVENT_DEPTH [context] = depth; 656 717 reg_EVENT_ADDRESS_SRC [context] = address_src; // delay_slot is compute in Context_State … … 675 736 } 676 737 738 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_STATE : %s",toString(reg_EVENT_STATE [context]).c_str()); 739 677 740 // In all case : update good_take 678 741 reg_UPDATE_PREDICTION_TABLE [context][depth]._good_take = good_take; … … 686 749 reg_UPDATE_PREDICTION_TABLE [context][depth]._address_dest = good_addr; 687 750 } 751 688 752 689 753 // =================================================================== … … 779 843 780 844 // Flush UPT 781 Tdepth_t depth = (_param->_have_port_depth)?PORT_READ(in_EVENT_DEPTH [i]):0; 782 uint32_t top = reg_UPT_TOP [i]; 783 uint32_t bottom = reg_UPT_BOTTOM [i]; 784 uint32_t new_update = ((top==0)?_param->_size_upt_queue[i]:top)-1; 785 // bool empty = reg_UPT_EMPTY [i]; 786 845 uint32_t bottom = reg_UPT_BOTTOM [i]; 846 847 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * bottom : %d",bottom); 848 849 // event_state_t event_state = reg_EVENT_STATE [i]; 850 // bool previous_update_ras = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or 851 // (event_state == EVENT_STATE_MISS_FLUSH_UPT ) or 852 // (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or 853 // (event_state == EVENT_STATE_EVENT_FLUSH_UPT)); 854 855 bool find = false; // have slot to update ??? 856 Tdepth_t top = bottom; 857 Tdepth_t update = bottom; 858 bool empty = reg_UPT_EMPTY [i]; 859 860 // flush all slot, because this event is in head of rob 861 for (uint32_t j=0; j<_param->_size_upt_queue[i]; ++j) 862 { 863 Tdepth_t x = (bottom+j)%_param->_size_upt_queue[i]; 864 865 if ((reg_UPDATE_PREDICTION_TABLE [i][x]._state != UPDATE_PREDICTION_STATE_END) and 866 (reg_UPDATE_PREDICTION_TABLE [i][x]._state != UPDATE_PREDICTION_STATE_EMPTY)) 867 { 868 find = true; // find a not empty slot 869 reg_UPDATE_PREDICTION_TABLE [i][x]._state = UPDATE_PREDICTION_STATE_EVENT; 870 reg_UPDATE_PREDICTION_TABLE [i][x]._retire_ok = false; 871 update = x; 872 } 873 874 if (reg_UPDATE_PREDICTION_TABLE [i][x]._state != UPDATE_PREDICTION_STATE_EMPTY) 875 top = x+1; 876 } 877 878 top = top%_param->_size_upt_queue[i]; 879 880 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * find : %d",find); 787 881 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * top : %d",top); 788 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth : %d",depth);789 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * new_update : %d",new_update);790 791 event_state_t event_state = reg_EVENT_STATE [i];792 bool previous_update_ras = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or793 (event_state == EVENT_STATE_MISS_FLUSH_UPT ) or794 (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or795 (event_state == EVENT_STATE_EVENT_FLUSH_UPT));796 797 bool find = false; // have slot to update ???798 Tdepth_t depth_new = depth;799 800 // flush all slot after the event801 for (uint32_t j=(depth+1)%_param->_size_upt_queue[i];802 j!=top;803 j=(j+1)%_param->_size_upt_queue[i])804 if ((reg_UPDATE_PREDICTION_TABLE [i][j]._state != UPDATE_PREDICTION_STATE_END) and805 (reg_UPDATE_PREDICTION_TABLE [i][j]._state != UPDATE_PREDICTION_STATE_EMPTY))806 {807 find = true;808 reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT;809 reg_UPDATE_PREDICTION_TABLE [i][j]._retire_ok = false;810 }811 else812 if (not find) // while state == end or empty813 depth_new ++;814 815 if ((reg_UPDATE_PREDICTION_TABLE [i][depth]._state != UPDATE_PREDICTION_STATE_END) and816 (reg_UPDATE_PREDICTION_TABLE [i][depth]._state != UPDATE_PREDICTION_STATE_EMPTY))817 {818 find = true;819 reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT;820 reg_UPDATE_PREDICTION_TABLE [i][depth]._retire_ok = false;821 822 }823 else824 // while state == end or empty825 depth = (depth_new+1)%_param->_size_upt_queue[i];826 827 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * find : %d",find);828 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth_new : %d",depth_new);829 882 830 883 // Test if have update slot 831 884 if (find) 832 885 { 833 // // flush all slot after the event834 // for (uint32_t j=(depth+1)%_param->_size_upt_queue[i];835 // j!=top;836 // j=(j+1)%_param->_size_upt_queue[i])837 // reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT;838 839 // reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT;840 841 // reg_UPT_BOTTOM [i];842 886 // TODO : special case : event is an exception on branch, also depth is not valid 843 reg_UPT_TOP [i] = depth; // depth is again valid887 reg_UPT_TOP [i] = top; // depth is again valid 844 888 reg_UPT_TOP_EVENT [i] = top; 845 889 … … 847 891 reg_UPT_EMPTY [i] = true; 848 892 } 849 850 bool full = ((depth == top) and (top == bottom) and not reg_UPT_EMPTY [i]); 851 bool update_ras = find and ((top != depth) or full); 852 853 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * update_ras : %d",update_ras); 854 855 if (not previous_update_ras and update_ras) 856 reg_UPT_UPDATE [i] = new_update; 893 reg_UPT_UPDATE [i] = update; 857 894 858 895 // new state : … … 862 899 // * ok : nothing 863 900 // * ko : flush upt 864 reg_EVENT_VAL [i] = true; 865 reg_EVENT_UPT_PTR [i] = depth; 866 901 reg_EVENT_VAL [i] = find; 902 reg_EVENT_IS_BRANCH [i] = false; 903 reg_EVENT_UPT_PTR [i] = top; 904 reg_EVENT_UPT_FULL [i] = (not empty and (bottom == reg_UPT_TOP [i])); 905 reg_EVENT_DEPTH [i] = top; 906 // reg_EVENT_ADDRESS_SRC [i] = address_src; // delay_slot is compute in I_State 907 // reg_EVENT_ADDRESS_DEST_VAL[i] = good_take; 908 // reg_EVENT_ADDRESS_DEST [i] = good_addr; 909 910 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_BOTTOM : %d",reg_UPT_BOTTOM [i]); 911 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_TOP : %d",reg_UPT_TOP [i]); 912 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_EMPTY : %d",reg_UPT_EMPTY [i]); 913 914 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_VAL : %d",reg_EVENT_VAL [i]); 915 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_UPT_PTR : %d",reg_EVENT_UPT_PTR [i]); 916 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_UPT_FULL : %d",reg_EVENT_UPT_FULL [i]); 867 917 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_NB_NEED_UPDATE : %d",reg_UFPT_NB_NEED_UPDATE [i]); 868 // if (reg_UFPT_NB_NEED_UPDATE [i] > 0) 918 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_NB_UPDATE : %d",reg_UFPT_NB_UPDATE [i]); 919 869 920 if ( (reg_UFPT_NB_NEED_UPDATE [i] > 0) or 870 921 (reg_UFPT_NB_UPDATE [i] > 0)) 871 922 { 872 if ( update_ras)923 if (find) 873 924 { 874 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT ( branch_complete - miss)",i);925 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT (event - find)",i); 875 926 reg_EVENT_STATE [i] = EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT; 876 927 } 877 928 else 878 929 { 879 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UFPT (branch_complete - miss)",i); 930 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UFPT (event - not find)",i); 931 // reg_EVENT_VAL [i] = false; 932 880 933 reg_EVENT_STATE [i] = EVENT_STATE_EVENT_FLUSH_UFPT; 881 934 } … … 883 936 else 884 937 { 885 // if (not previous_update_ras) 886 if (update_ras) 938 if (find) 887 939 { 888 940 // have ras prediction ? 889 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UPT ( branch_complete - miss)",i);941 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UPT (event - find)",i); 890 942 891 943 reg_EVENT_STATE [i] = EVENT_STATE_EVENT_FLUSH_UPT; … … 894 946 { 895 947 // special case : nothing 896 reg_EVENT_VAL [i] = false; 948 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UPT (event - not find)",i); 949 950 // reg_EVENT_VAL [i] = false; 897 951 898 952 reg_EVENT_STATE [i] = EVENT_STATE_OK; … … 902 956 // else no update 903 957 904 reg_EVENT_DEPTH [i] = depth; 905 // reg_EVENT_ADDRESS_SRC [i] = address_src; // delay_slot is compute in I_State 906 // reg_EVENT_ADDRESS_DEST_VAL[i] = good_take; 907 // reg_EVENT_ADDRESS_DEST [i] = good_addr; 958 // Tdepth_t depth = (_param->_have_port_depth)?PORT_READ(in_EVENT_DEPTH [i]):0; 959 // uint32_t top = reg_UPT_TOP [i]; 960 // uint32_t bottom = reg_UPT_BOTTOM [i]; 961 // uint32_t new_update = ((top==0)?_param->_size_upt_queue[i]:top)-1; 962 // // bool empty = reg_UPT_EMPTY [i]; 963 964 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * top : %d",top); 965 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth : %d",depth); 966 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * new_update : %d",new_update); 967 968 // event_state_t event_state = reg_EVENT_STATE [i]; 969 // bool previous_update_ras = ((event_state == EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT ) or 970 // (event_state == EVENT_STATE_MISS_FLUSH_UPT ) or 971 // (event_state == EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT) or 972 // (event_state == EVENT_STATE_EVENT_FLUSH_UPT)); 973 974 // bool find = false; // have slot to update ??? 975 // Tdepth_t depth_new = depth; 976 977 // // flush all slot, because this event is in head of rob 978 // for (uint32_t j=(depth+1)%_param->_size_upt_queue[i]; 979 // //uint32_t j=bottom; 980 // j!=top; 981 // j=(j+1)%_param->_size_upt_queue[i]) 982 // if ((reg_UPDATE_PREDICTION_TABLE [i][j]._state != UPDATE_PREDICTION_STATE_END) and 983 // (reg_UPDATE_PREDICTION_TABLE [i][j]._state != UPDATE_PREDICTION_STATE_EMPTY)) 984 // { 985 // find = true; 986 // reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT; 987 // reg_UPDATE_PREDICTION_TABLE [i][j]._retire_ok = false; 988 // } 989 // else 990 // if (not find) // while state == end or empty 991 // depth_new ++; 992 993 // if ((reg_UPDATE_PREDICTION_TABLE [i][depth]._state != UPDATE_PREDICTION_STATE_END) and 994 // (reg_UPDATE_PREDICTION_TABLE [i][depth]._state != UPDATE_PREDICTION_STATE_EMPTY)) 995 // { 996 // find = true; 997 // reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT; 998 // reg_UPDATE_PREDICTION_TABLE [i][depth]._retire_ok = false; 999 1000 // } 1001 // else 1002 // // while state == end or empty 1003 // depth = (depth_new+1)%_param->_size_upt_queue[i]; 1004 1005 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * find : %d",find); 1006 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth_new : %d",depth_new); 1007 1008 // // Test if have update slot 1009 // if (find) 1010 // { 1011 // // // flush all slot after the event 1012 // // for (uint32_t j=(depth+1)%_param->_size_upt_queue[i]; 1013 // // j!=top; 1014 // // j=(j+1)%_param->_size_upt_queue[i]) 1015 // // reg_UPDATE_PREDICTION_TABLE [i][j]._state = UPDATE_PREDICTION_STATE_EVENT; 1016 1017 // // reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_EVENT; 1018 1019 // // reg_UPT_BOTTOM [i]; 1020 // // TODO : special case : event is an exception on branch, also depth is not valid 1021 // reg_UPT_TOP [i] = depth; // depth is again valid 1022 // reg_UPT_TOP_EVENT [i] = top; 1023 1024 // if (bottom == reg_UPT_TOP [i]) 1025 // reg_UPT_EMPTY [i] = true; 1026 // } 1027 1028 // bool full = ((depth == top) and (top == bottom) and not reg_UPT_EMPTY [i]); 1029 // bool update_ras = find and ((top != depth) or full); 1030 1031 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * update_ras : %d",update_ras); 1032 1033 // if (not previous_update_ras and update_ras) 1034 // reg_UPT_UPDATE [i] = new_update; 1035 1036 // // new state : 1037 // // * test if ufpt is empty 1038 // // * ok : flush upft and upt 1039 // // * ko : test if have previous flush upt 1040 // // * ok : nothing 1041 // // * ko : flush upt 1042 // reg_EVENT_VAL [i] = update_ras; 1043 // reg_EVENT_UPT_PTR [i] = depth; 1044 1045 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_NB_NEED_UPDATE : %d",reg_UFPT_NB_NEED_UPDATE [i]); 1046 // // if (reg_UFPT_NB_NEED_UPDATE [i] > 0) 1047 // if ( (reg_UFPT_NB_NEED_UPDATE [i] > 0) or 1048 // (reg_UFPT_NB_UPDATE [i] > 0)) 1049 // { 1050 // if (update_ras) 1051 // { 1052 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT (branch_complete - miss)",i); 1053 // reg_EVENT_STATE [i] = EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT; 1054 // } 1055 // else 1056 // { 1057 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UFPT (branch_complete - miss)",i); 1058 // // reg_EVENT_VAL [i] = false; 1059 1060 // reg_EVENT_STATE [i] = EVENT_STATE_EVENT_FLUSH_UFPT; 1061 // } 1062 // } 1063 // else 1064 // { 1065 // // if (not previous_update_ras) 1066 // if (update_ras) 1067 // { 1068 // // have ras prediction ? 1069 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_EVENT_FLUSH_UPT (branch_complete - miss)",i); 1070 1071 // reg_EVENT_STATE [i] = EVENT_STATE_EVENT_FLUSH_UPT; 1072 // } 1073 // else 1074 // { 1075 // // special case : nothing 1076 // // reg_EVENT_VAL [i] = false; 1077 1078 // reg_EVENT_STATE [i] = EVENT_STATE_OK; 1079 // } 1080 // } 1081 1082 // // else no update 1083 1084 // reg_EVENT_DEPTH [i] = depth; 1085 // // reg_EVENT_ADDRESS_SRC [i] = address_src; // delay_slot is compute in I_State 1086 // // reg_EVENT_ADDRESS_DEST_VAL[i] = good_take; 1087 // // reg_EVENT_ADDRESS_DEST [i] = good_addr; 908 1088 909 1089 break; … … 994 1174 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_VAL : %d" ,reg_EVENT_VAL [i]); 995 1175 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_UPT_PTR : %d" ,reg_EVENT_UPT_PTR [i]); 1176 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_UPT_FULL : %d" ,reg_EVENT_UPT_FULL [i]); 996 1177 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_STATE : %s" ,toString(reg_EVENT_STATE [i]).c_str()); 997 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_ SOURCE : %s" ,toString(reg_EVENT_SOURCE[i]).c_str());1178 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_IS_BRANCH : %d" ,reg_EVENT_IS_BRANCH [i]); 998 1179 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_DEPTH : %d" ,reg_EVENT_DEPTH [i]); 999 1180 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_ADDRESS_SRC : %.8x (%.8x)",reg_EVENT_ADDRESS_SRC [i],reg_EVENT_ADDRESS_SRC [i]<<2);
Note: See TracChangeset
for help on using the changeset viewer.