Changeset 94 for trunk/IPs/systemC/processor
- Timestamp:
- Dec 15, 2008, 12:04:03 PM (16 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo
- Files:
-
- 4 added
- 1 deleted
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Dcache_Access/src/Dcache_Access_genMealy_rsp.cpp
r88 r94 56 56 throw ERRORMORPHEO(FUNCTION,_("invalid load_store_unit_id.\n")); 57 57 58 if (context_id > _param->_nb_context[execute_loop_id] [load_store_unit_id])58 if (context_id > _param->_nb_context[execute_loop_id]) 59 59 throw ERRORMORPHEO(FUNCTION,_("invalid context_id.\n")); 60 60 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/config_mono_context.cfg
r88 r94 2 2 1 1 +1 # nb_context 3 3 4 8 *2 # size_upt_queue [0] [nb_context] 4 1 4 *2# size_ufpt_queue [0] [nb_context]4 1 4 +1 # size_ufpt_queue [0] [nb_context] 5 5 32 32 *2 # size_address 6 6 4 4 *4 # nb_inst_predict -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/SelfTest/src/test.cpp
r88 r94 116 116 // ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_MISS_PREDICTION,"out_BRANCH_EVENT_MISS_PREDICTION",Tcontrol_t ,_param->_nb_context); 117 117 ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_ADDRESS_SRC ,"out_BRANCH_EVENT_ADDRESS_SRC ",Taddress_t ,_param->_nb_context); 118 ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_ADDRESS_DEST_VAL,"out_BRANCH_EVENT_ADDRESS_DEST_VAL",Tcontrol_t ,_param->_nb_context); 118 119 ALLOC1_SC_SIGNAL(out_BRANCH_EVENT_ADDRESS_DEST ,"out_BRANCH_EVENT_ADDRESS_DEST ",Taddress_t ,_param->_nb_context); 119 120 … … 130 131 ALLOC1_SC_SIGNAL(out_UPDATE_DIR_HISTORY ,"out_UPDATE_DIR_HISTORY ",Thistory_t ,_param->_nb_inst_update); 131 132 ALLOC1_SC_SIGNAL(out_UPDATE_RAS_VAL ,"out_UPDATE_RAS_VAL ",Tcontrol_t ,_param->_nb_inst_update); 133 ALLOC1_SC_SIGNAL(out_UPDATE_RAS_FLUSH ,"out_UPDATE_RAS_FLUSH ",Tcontrol_t ,_param->_nb_inst_update); 132 134 ALLOC1_SC_SIGNAL(out_UPDATE_RAS_PUSH ,"out_UPDATE_RAS_PUSH ",Tcontrol_t ,_param->_nb_inst_update); 133 135 ALLOC1_SC_SIGNAL(out_UPDATE_RAS_ADDRESS ,"out_UPDATE_RAS_ADDRESS ",Taddress_t ,_param->_nb_inst_update); … … 201 203 // INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_MISS_PREDICTION,_param->_nb_context); 202 204 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_ADDRESS_SRC ,_param->_nb_context); 205 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_ADDRESS_DEST_VAL,_param->_nb_context); 203 206 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_BRANCH_EVENT_ADDRESS_DEST ,_param->_nb_context); 204 207 … … 217 220 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_DIR_HISTORY ,_param->_nb_inst_update); 218 221 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_VAL ,_param->_nb_inst_update); 222 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_FLUSH ,_param->_nb_inst_update); 219 223 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_PUSH ,_param->_nb_inst_update); 220 224 INSTANCE1_SC_SIGNAL(_Update_Prediction_Table,out_UPDATE_RAS_ADDRESS ,_param->_nb_inst_update); … … 247 251 const int32_t percent_transaction_branch_complete = 75; 248 252 const int32_t percent_transaction_update = 75; 249 250 253 const int32_t percent_transaction_branch_event = 75; 254 255 const bool test1 = false; 256 const bool test2 = false; 257 const bool test3 = false; 258 const bool test4 = true; 251 259 252 260 std::list<request_t> ufpt; 253 261 std::list<request_t> upt; 262 request_t event; 254 263 255 264 SC_START(0); … … 302 311 //--------------------------------------------------------------------- 303 312 //--------------------------------------------------------------------- 304 if ( 1)305 {313 if (test1) 314 { 306 315 uint32_t context = rand() % _param->_nb_context; 307 316 … … 508 517 for (uint32_t i=0; i<upt.size(); i++) 509 518 { 510 LABEL("Address_src (-1): %.8x (%d)",out_UPDATE_BTB_ADDRESS_SRC [i]->read(),upt.size());511 512 519 bool have_transaction = false; 513 520 514 521 do 515 522 { 516 LABEL("Address_src (0) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read());517 518 523 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 519 524 … … 522 527 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 523 528 524 LABEL("Address_src (1) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read());525 529 SC_START(0); 526 LABEL("Address_src (2) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read()); 527 530 528 531 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 529 532 … … 534 537 535 538 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));539 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_upt->context); 540 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),it_upt->miss_commit); 541 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_upt->take_good); 542 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),update_btb(it_upt->condition)); 540 543 if (update_btb(it_upt->condition)) 541 544 { 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 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_upt->address_src); 546 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_upt->address_dest); 547 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_upt->condition); 545 548 } 546 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [ i]->read(),update_dir(it_upt->condition));549 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),update_dir(it_upt->condition) and not (it_upt->miss_ifetch or it_upt->miss_decod)); 547 550 if (update_dir(it_upt->condition)) 548 551 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));552 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_upt->history); 553 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_upt->condition)); 551 554 if (update_ras(it_upt->condition)) 552 555 { 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); 556 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 557 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_upt->condition)); 558 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_upt->ras_address); 559 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_upt->ras_index); 560 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_upt->miss_ifetch); 557 561 } 558 562 ++ it_upt; … … 560 564 561 565 SC_START(1); 562 LABEL("Address_src (3) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read());563 564 566 } while (not have_transaction); 565 567 566 LABEL("Address_src (4) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read());567 568 in_UPDATE_ACK [port]->write(0); 568 LABEL("Address_src (5) : %.8x",out_UPDATE_BTB_ADDRESS_SRC [i]->read());569 569 // if (_param->_have_port_depth) 570 570 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); … … 586 586 } 587 587 588 //--------------------------------------------------------------------- 589 //--------------------------------------------------------------------- 590 // DECOD MISS : no RAS in ifetch 591 //--------------------------------------------------------------------- 592 //--------------------------------------------------------------------- 593 if (test2) 594 { 595 uint32_t context = rand() % _param->_nb_context; 596 597 { 598 LABEL("PREDICT - fill the queue"); 599 uint32_t port = rand() % _param->_nb_inst_predict; 600 601 LABEL(" * context : %d",context); 602 LABEL(" * port : %d",port); 603 604 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 605 { 606 request_t request; 607 request.context = context; 608 request.address_src = 0xdeadbeef+i; 609 request.address_dest = 0x21071981+i; 610 request.address_good = request.address_dest; 611 request.condition = BRANCH_CONDITION_FLAG_SET; 612 request.take = 1; 613 request.take_good = 1; 614 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 615 request.is_accurate = true; 616 request.miss_ifetch = false; 617 request.miss_decod = false; 618 request.miss_commit = false; 619 request.history = i; 620 request.ras_address = 0xdeaddead+i; 621 request.ras_index = (0x12345678+i)%_param->_size_ras_index[context]; 622 request.ufpt_ptr = ufpt_top [context]; 623 // request.upt_ptr; 624 625 bool have_transaction = false; 626 do 627 { 628 in_PREDICT_VAL [port]->write((rand()%100)<percent_transaction_predict); 629 in_PREDICT_CONTEXT_ID [port]->write(request.context ); 630 in_PREDICT_BTB_ADDRESS_SRC [port]->write(request.address_src ); 631 in_PREDICT_BTB_ADDRESS_DEST [port]->write(request.address_dest); 632 in_PREDICT_BTB_CONDITION [port]->write(request.condition ); 633 in_PREDICT_BTB_LAST_TAKE [port]->write(request.take ); 634 in_PREDICT_BTB_IS_ACCURATE [port]->write(request.is_accurate ); 635 in_PREDICT_DIR_HISTORY [port]->write(request.history ); 636 in_PREDICT_RAS_ADDRESS [port]->write(request.ras_address ); 637 in_PREDICT_RAS_INDEX [port]->write(request.ras_index ); 638 639 if (_param->_have_port_depth) 640 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 641 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 642 643 SC_START(0); // fct melay 644 645 LABEL("PREDICT [%d] %d - %d (accurate : %d).", 646 port, 647 in_PREDICT_VAL [port]->read(), 648 out_PREDICT_ACK [port]->read(), 649 in_PREDICT_BTB_IS_ACCURATE [port]->read()); 650 651 if (in_PREDICT_VAL [port]->read() and out_PREDICT_ACK [port]->read()) 652 { 653 LABEL("PREDICT [%d] - Transaction accepted",port); 654 have_transaction = true; 655 656 if (_param->_have_port_depth) 657 TEST(Tprediction_ptr_t,out_PREDICT_UPDATE_PREDICTION_ID [port]->read(),ufpt_top [context]); 658 659 ufpt_top [context] = (ufpt_top [context]+1)%_param->_size_ufpt_queue[context]; 660 } 661 662 SC_START(1); // transition 663 664 } while (not have_transaction); 665 666 // ufpt.push_back(request); 667 668 in_PREDICT_VAL [port]->write(0); 669 670 if (_param->_have_port_depth) 671 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 672 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 673 } 674 } 675 676 { 677 LABEL("DECOD - Miss"); 678 uint32_t port = rand() % _param->_nb_inst_decod; 679 680 LABEL(" * context : %d",context); 681 LABEL(" * port : %d",port); 682 683 request_t request; 684 request.context = context; 685 request.address_src = 0x14011959; 686 request.address_dest = 0x25071959; // after = not take 687 request.address_good = request.address_dest; 688 request.condition = BRANCH_CONDITION_FLAG_SET; 689 request.take = 0; 690 request.take_good = 0; 691 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 692 request.is_accurate = true; 693 request.miss_ifetch = false; 694 request.miss_decod = true ; 695 request.miss_commit = false; 696 request.history = 1; 697 request.ras_address = 0xbabababa; 698 request.ras_index = (0x87654321)%_param->_size_ras_index[context]; 699 request.ufpt_ptr = ufpt_top [context]; 700 701 event = request; 702 703 // for (uint32_t i=0; i<upt.size(); i++) 704 // just one 705 { 706 bool have_transaction = false; 707 do 708 { 709 in_DECOD_VAL [port]->write((rand()%100)<percent_transaction_decod); 710 in_DECOD_CONTEXT_ID [port]->write(request.context ); 711 in_DECOD_BTB_ADDRESS_SRC [port]->write(request.address_src ); 712 in_DECOD_BTB_ADDRESS_DEST [port]->write(request.address_dest); 713 in_DECOD_BTB_CONDITION [port]->write(request.condition ); 714 in_DECOD_BTB_LAST_TAKE [port]->write(request.take ); 715 in_DECOD_RAS_ADDRESS [port]->write(request.ras_address ); 716 in_DECOD_RAS_INDEX [port]->write(request.ras_index ); 717 in_DECOD_UPDATE_PREDICTION_ID [port]->write(request.ufpt_ptr ); 718 in_DECOD_MISS_IFETCH [port]->write(request.miss_ifetch ); 719 in_DECOD_MISS_DECOD [port]->write(request.miss_decod ); 720 in_DECOD_IS_ACCURATE [port]->write(request.is_accurate ); 721 722 SC_START(0); // fct melay 723 724 LABEL("DECOD [%d] %d - %d", 725 port, 726 in_PREDICT_VAL [port]->read(), 727 out_PREDICT_ACK [port]->read()); 728 729 if (in_DECOD_VAL [port]->read() and out_DECOD_ACK [port]->read()) 730 { 731 LABEL("DECOD [%d] - Transaction accepted",port); 732 have_transaction = true; 733 734 request.upt_ptr = upt_top [context]; 735 upt.push_back(request); 736 // ufpt.pop_front(); 737 738 upt_top [context] = (upt_top [context]+1)%_param->_size_upt_queue[context]; 739 } 740 741 SC_START(1); // transition 742 743 } while (not have_transaction); 744 745 in_DECOD_VAL [port]->write(0); 746 747 if (_param->_have_port_depth) 748 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 749 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 750 } 751 } 752 753 { 754 LABEL("BRANCH_COMPLETE - hit ifetch"); 755 756 uint32_t port = rand() % _param->_nb_inst_branch_complete; 757 758 LABEL(" * port : %d",port); 759 760 std::list<request_t>::iterator it_upt = upt.begin(); 761 762 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 763 // for (uint32_t i=0; i<upt.size(); i++) 764 // just one 765 { 766 bool have_transaction = false; 767 768 do 769 { 770 in_BRANCH_COMPLETE_VAL [port]->write((rand()%100)<percent_transaction_branch_complete); 771 in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(it_upt->context ); 772 in_BRANCH_COMPLETE_DEPTH [port]->write(it_upt->upt_ptr ); 773 in_BRANCH_COMPLETE_ADDRESS [port]->write(it_upt->address_good); 774 in_BRANCH_COMPLETE_FLAG [port]->write(it_upt->flag ); 775 776 if (_param->_have_port_depth) 777 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 778 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 779 780 SC_START(0); 781 782 LABEL("BRANCH_COMPLETE [%d] %d - %d.",port,in_BRANCH_COMPLETE_VAL [port]->read(),out_BRANCH_COMPLETE_ACK [port]->read()); 783 784 if (in_BRANCH_COMPLETE_VAL [port]->read() and out_BRANCH_COMPLETE_ACK [port]->read()) 785 { 786 LABEL("BRANCH_COMPLETE [%d] - Transaction accepted",port); 787 have_transaction = true; 788 789 TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit ); 790 TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE [port]->read(),it_upt->take_good ); 791 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC [port]->read(),it_upt->address_src ); 792 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST [port]->read(),it_upt->address_good); 793 794 it_upt ++; 795 } 796 797 SC_START(1); 798 } while (not have_transaction); 799 800 in_BRANCH_COMPLETE_VAL [port]->write(0); 801 802 if (_param->_have_port_depth) 803 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 804 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 805 } 806 } 807 808 { 809 LABEL("UPDATE - hit ifetch"); 810 811 uint32_t port = 0; 812 813 LABEL(" * port : %d",port); 814 std::list<request_t>::iterator it_upt = upt.begin(); 815 816 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 817 // for (uint32_t i=0; i<upt.size(); i++) 818 // just one 819 { 820 bool have_transaction = false; 821 822 do 823 { 824 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 825 826 // if (_param->_have_port_depth) 827 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 828 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 829 830 SC_START(0); 831 832 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 833 834 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 835 { 836 LABEL("UPDATE [%d] - Transaction accepted",port); 837 have_transaction = true; 838 839 if (_param->_have_port_context_id) 840 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_upt->context); 841 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),it_upt->miss_commit); 842 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_upt->take_good); 843 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),update_btb(it_upt->condition)); 844 if (update_btb(it_upt->condition)) 845 { 846 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_upt->address_src); 847 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_upt->address_dest); 848 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_upt->condition); 849 } 850 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),update_dir(it_upt->condition) and not (it_upt->miss_ifetch or it_upt->miss_decod)); 851 852 if (update_dir(it_upt->condition)) 853 if (_param->_have_port_history) 854 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_upt->history); 855 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_upt->condition)); 856 if (update_ras(it_upt->condition)) 857 { 858 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 859 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_upt->condition)); 860 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_upt->ras_address); 861 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_upt->ras_index); 862 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_upt->miss_ifetch); 863 } 864 ++ it_upt; 865 } 866 867 SC_START(1); 868 } while (not have_transaction); 869 870 in_UPDATE_ACK [port]->write(0); 871 // if (_param->_have_port_depth) 872 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 873 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 874 } 875 upt.clear(); 876 } 877 878 { 879 LABEL("BRANCH_EVENT - have miss decod"); 880 881 uint32_t port = context; 882 883 { 884 bool have_transaction = false; 885 886 do 887 { 888 in_BRANCH_EVENT_ACK [port]->write((rand()%100)<percent_transaction_branch_event); 889 890 SC_START(0); 891 892 LABEL("BRANCH_EVENT [%d] %d - %d.",port,out_BRANCH_EVENT_VAL [port]->read(),in_BRANCH_EVENT_ACK [port]->read()); 893 894 if (out_BRANCH_EVENT_VAL [port]->read() and in_BRANCH_EVENT_ACK [port]->read()) 895 { 896 LABEL("BRANCH_EVENT [%d] - Transaction accepted",port); 897 have_transaction = true; 898 899 TEST(Taddress_t,out_BRANCH_EVENT_ADDRESS_SRC [port]->read(),event.address_src); 900 TEST(Tcontrol_t,out_BRANCH_EVENT_ADDRESS_DEST_VAL [port]->read(),event.take); 901 if (event.take) 902 TEST(Taddress_t,out_BRANCH_EVENT_ADDRESS_DEST [port]->read(),event.address_good); 903 904 event.address_src = 0; 905 event.take = 0; 906 event.address_dest = 0; 907 } 908 909 SC_START(1); 910 } while (not have_transaction); 911 912 in_BRANCH_EVENT_ACK [port]->write(0); 913 } 914 } 915 916 917 // Wait Garbage Collector 918 { 919 upt_bottom [context] = (upt_bottom [context]+1)%_param->_size_upt_queue[context]; 920 // upt_top [context] = (upt_top [context]); 921 922 while ((upt_bottom [context] != out_DEPTH_MIN [context]->read()) or 923 (upt_top [context] != out_DEPTH_MAX [context]->read())) 924 SC_START(1); 925 926 } 927 } 928 929 //--------------------------------------------------------------------- 930 //--------------------------------------------------------------------- 931 // DECOD MISS : with RAS in ifetch 932 //--------------------------------------------------------------------- 933 //--------------------------------------------------------------------- 934 if (test3) 935 { 936 uint32_t context = rand() % _param->_nb_context; 937 uint32_t have_ras = false; 938 { 939 LABEL("PREDICT - fill the queue"); 940 uint32_t port = rand() % _param->_nb_inst_predict; 941 942 LABEL(" * context : %d",context); 943 LABEL(" * port : %d",port); 944 945 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 946 { 947 request_t request; 948 request.context = context; 949 request.address_src = 0xdeadbeef+i; 950 request.address_dest = 0x21071981+i; 951 request.address_good = request.address_dest; 952 request.condition = (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:BRANCH_CONDITION_FLAG_SET; 953 954 have_ras |= (update_ras(request.condition)); 955 956 request.take = 1; 957 request.take_good = 1; 958 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 959 request.is_accurate = true; 960 request.miss_ifetch = false; 961 request.miss_decod = true ; 962 request.miss_commit = false; 963 request.history = i; 964 request.ras_address = 0x12344321+i; 965 request.ras_index = (043211234+i)%_param->_size_ras_index[context]; 966 request.ufpt_ptr = ufpt_top [context]; 967 // request.upt_ptr; 968 969 bool have_transaction = false; 970 do 971 { 972 in_PREDICT_VAL [port]->write((rand()%100)<percent_transaction_predict); 973 in_PREDICT_CONTEXT_ID [port]->write(request.context ); 974 in_PREDICT_BTB_ADDRESS_SRC [port]->write(request.address_src ); 975 in_PREDICT_BTB_ADDRESS_DEST [port]->write(request.address_dest); 976 in_PREDICT_BTB_CONDITION [port]->write(request.condition ); 977 in_PREDICT_BTB_LAST_TAKE [port]->write(request.take ); 978 in_PREDICT_BTB_IS_ACCURATE [port]->write(request.is_accurate ); 979 in_PREDICT_DIR_HISTORY [port]->write(request.history ); 980 in_PREDICT_RAS_ADDRESS [port]->write(request.ras_address ); 981 in_PREDICT_RAS_INDEX [port]->write(request.ras_index ); 982 983 if (_param->_have_port_depth) 984 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 985 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 986 987 SC_START(0); // fct melay 988 989 LABEL("PREDICT [%d] %d - %d (accurate : %d).", 990 port, 991 in_PREDICT_VAL [port]->read(), 992 out_PREDICT_ACK [port]->read(), 993 in_PREDICT_BTB_IS_ACCURATE [port]->read()); 994 995 if (in_PREDICT_VAL [port]->read() and out_PREDICT_ACK [port]->read()) 996 { 997 LABEL("PREDICT [%d] - Transaction accepted",port); 998 have_transaction = true; 999 1000 if (_param->_have_port_depth) 1001 TEST(Tprediction_ptr_t,out_PREDICT_UPDATE_PREDICTION_ID [port]->read(),ufpt_top [context]); 1002 1003 ufpt_top [context] = (ufpt_top [context]+1)%_param->_size_ufpt_queue[context]; 1004 } 1005 1006 SC_START(1); // transition 1007 1008 } while (not have_transaction); 1009 1010 ufpt.push_back(request); // to update 1011 1012 in_PREDICT_VAL [port]->write(0); 1013 1014 if (_param->_have_port_depth) 1015 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1016 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1017 } 1018 } 1019 1020 { 1021 LABEL("DECOD - Miss"); 1022 uint32_t port = rand() % _param->_nb_inst_decod; 1023 1024 LABEL(" * context : %d",context); 1025 LABEL(" * port : %d",port); 1026 1027 request_t request; 1028 request.context = context; 1029 request.address_src = 0x14011959; 1030 request.address_dest = 0x25071959; // after = not take 1031 request.address_good = request.address_dest; 1032 request.condition = BRANCH_CONDITION_FLAG_SET; 1033 request.take = 0; 1034 request.take_good = 0; 1035 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 1036 request.is_accurate = true; 1037 request.miss_ifetch = false; 1038 request.miss_decod = true ; 1039 request.miss_commit = false; 1040 request.history = 1; 1041 request.ras_address = 0xbabababa; 1042 request.ras_index = (0x87654321)%_param->_size_ras_index[context]; 1043 request.ufpt_ptr = ufpt_top [context]; 1044 1045 event = request; 1046 1047 // for (uint32_t i=0; i<upt.size(); i++) 1048 // just one 1049 { 1050 bool have_transaction = false; 1051 do 1052 { 1053 in_DECOD_VAL [port]->write((rand()%100)<percent_transaction_decod); 1054 in_DECOD_CONTEXT_ID [port]->write(request.context ); 1055 in_DECOD_BTB_ADDRESS_SRC [port]->write(request.address_src ); 1056 in_DECOD_BTB_ADDRESS_DEST [port]->write(request.address_dest); 1057 in_DECOD_BTB_CONDITION [port]->write(request.condition ); 1058 in_DECOD_BTB_LAST_TAKE [port]->write(request.take ); 1059 in_DECOD_RAS_ADDRESS [port]->write(request.ras_address ); 1060 in_DECOD_RAS_INDEX [port]->write(request.ras_index ); 1061 in_DECOD_UPDATE_PREDICTION_ID [port]->write(request.ufpt_ptr ); 1062 in_DECOD_MISS_IFETCH [port]->write(request.miss_ifetch ); 1063 in_DECOD_MISS_DECOD [port]->write(request.miss_decod ); 1064 in_DECOD_IS_ACCURATE [port]->write(request.is_accurate ); 1065 1066 SC_START(0); // fct melay 1067 1068 LABEL("DECOD [%d] %d - %d", 1069 port, 1070 in_PREDICT_VAL [port]->read(), 1071 out_PREDICT_ACK [port]->read()); 1072 1073 if (in_DECOD_VAL [port]->read() and out_DECOD_ACK [port]->read()) 1074 { 1075 LABEL("DECOD [%d] - Transaction accepted",port); 1076 have_transaction = true; 1077 1078 request.upt_ptr = upt_top [context]; 1079 upt.push_back(request); 1080 // ufpt.pop_front(); 1081 1082 upt_top [context] = (upt_top [context]+1)%_param->_size_upt_queue[context]; 1083 } 1084 1085 SC_START(1); // transition 1086 1087 } while (not have_transaction); 1088 1089 in_DECOD_VAL [port]->write(0); 1090 1091 if (_param->_have_port_depth) 1092 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1093 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1094 } 1095 } 1096 1097 { 1098 LABEL("BRANCH_COMPLETE - hit ifetch"); 1099 1100 uint32_t port = rand() % _param->_nb_inst_branch_complete; 1101 1102 LABEL(" * port : %d",port); 1103 1104 std::list<request_t>::iterator it_upt = upt.begin(); 1105 1106 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1107 // for (uint32_t i=0; i<upt.size(); i++) 1108 // just one 1109 { 1110 bool have_transaction = false; 1111 1112 do 1113 { 1114 in_BRANCH_COMPLETE_VAL [port]->write((rand()%100)<percent_transaction_branch_complete); 1115 in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(it_upt->context ); 1116 in_BRANCH_COMPLETE_DEPTH [port]->write(it_upt->upt_ptr ); 1117 in_BRANCH_COMPLETE_ADDRESS [port]->write(it_upt->address_good); 1118 in_BRANCH_COMPLETE_FLAG [port]->write(it_upt->flag ); 1119 1120 if (_param->_have_port_depth) 1121 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1122 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1123 1124 SC_START(0); 1125 1126 LABEL("BRANCH_COMPLETE [%d] %d - %d.",port,in_BRANCH_COMPLETE_VAL [port]->read(),out_BRANCH_COMPLETE_ACK [port]->read()); 1127 1128 if (in_BRANCH_COMPLETE_VAL [port]->read() and out_BRANCH_COMPLETE_ACK [port]->read()) 1129 { 1130 LABEL("BRANCH_COMPLETE [%d] - Transaction accepted",port); 1131 have_transaction = true; 1132 1133 TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_upt->miss_commit ); 1134 TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE [port]->read(),it_upt->take_good ); 1135 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC [port]->read(),it_upt->address_src ); 1136 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST [port]->read(),it_upt->address_good); 1137 1138 it_upt ++; 1139 } 1140 1141 SC_START(1); 1142 } while (not have_transaction); 1143 1144 in_BRANCH_COMPLETE_VAL [port]->write(0); 1145 1146 if (_param->_have_port_depth) 1147 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1148 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1149 } 1150 } 1151 1152 if (have_ras) 1153 { 1154 LABEL("UPDATE - Update UPFT"); 1155 1156 uint32_t port = 0; 1157 1158 LABEL(" * port : %d",port); 1159 std::list<request_t>::iterator it_ufpt = ufpt.end(); 1160 -- it_ufpt; 1161 1162 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1163 { 1164 bool have_transaction = false; 1165 1166 do 1167 { 1168 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 1169 1170 // if (_param->_have_port_depth) 1171 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), ufpt_bottom [context]); 1172 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), ufpt_top [context]); 1173 1174 SC_START(0); 1175 1176 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 1177 1178 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 1179 { 1180 LABEL("UPDATE [%d] - Transaction accepted",port); 1181 have_transaction = true; 1182 1183 if (_param->_have_port_context_id) 1184 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_ufpt->context); 1185 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),(it_ufpt->miss_ifetch or 1186 it_ufpt->miss_decod or 1187 it_ufpt->miss_commit )); 1188 // if (update_btb(it_ufpt->condition) or 1189 // update_dir(it_ufpt->condition)) 1190 // TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_ufpt->take_good); 1191 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),0); 1192 // if (update_btb(it_ufpt->condition)) 1193 // { 1194 // TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_ufpt->address_src); 1195 // TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_ufpt->address_dest); 1196 // TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_ufpt->condition); 1197 // } 1198 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),0); 1199 1200 // if (update_dir(it_ufpt->condition)) 1201 // if (_param->_have_port_history) 1202 // TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_ufpt->history); 1203 // TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_ufpt->condition)); 1204 if (update_ras(it_ufpt->condition)) 1205 { 1206 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 1207 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_ufpt->condition)); 1208 LABEL("KANE : out_UPDATE_RAS_ADDRESS [port]->read() : %.8x",out_UPDATE_RAS_ADDRESS [port]->read()); 1209 LABEL("KANE : it_ufpt->ras_address : %.8x",it_ufpt->ras_address); 1210 1211 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_ufpt->ras_address); 1212 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_ufpt->ras_index); 1213 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_ufpt->miss_ifetch); 1214 } 1215 } 1216 1217 SC_START(1); 1218 } while (not have_transaction); 1219 1220 -- it_ufpt; 1221 1222 1223 in_UPDATE_ACK [port]->write(0); 1224 // if (_param->_have_port_depth) 1225 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), ufpt_bottom [context]); 1226 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), ufpt_top [context]); 1227 } 1228 } 1229 ufpt.clear(); 1230 1231 { 1232 LABEL("UPDATE - hit ifetch"); 1233 1234 uint32_t port = 0; 1235 1236 LABEL(" * port : %d",port); 1237 std::list<request_t>::iterator it_upt = upt.begin(); 1238 1239 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1240 // for (uint32_t i=0; i<upt.size(); i++) 1241 // just one 1242 { 1243 bool have_transaction = false; 1244 1245 do 1246 { 1247 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 1248 1249 // if (_param->_have_port_depth) 1250 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1251 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1252 1253 SC_START(0); 1254 1255 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 1256 1257 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 1258 { 1259 LABEL("UPDATE [%d] - Transaction accepted",port); 1260 have_transaction = true; 1261 1262 if (_param->_have_port_context_id) 1263 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_upt->context); 1264 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),it_upt->miss_commit); 1265 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_upt->take_good); 1266 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),update_btb(it_upt->condition)); 1267 if (update_btb(it_upt->condition)) 1268 { 1269 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_upt->address_src); 1270 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_upt->address_dest); 1271 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_upt->condition); 1272 } 1273 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),update_dir(it_upt->condition) and not (it_upt->miss_ifetch or it_upt->miss_decod)); 1274 1275 if (update_dir(it_upt->condition)) 1276 if (_param->_have_port_history) 1277 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_upt->history); 1278 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_upt->condition)); 1279 if (update_ras(it_upt->condition)) 1280 { 1281 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 1282 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_upt->condition)); 1283 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_upt->ras_address); 1284 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_upt->ras_index); 1285 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_upt->miss_ifetch); 1286 } 1287 ++ it_upt; 1288 } 1289 1290 SC_START(1); 1291 } while (not have_transaction); 1292 1293 in_UPDATE_ACK [port]->write(0); 1294 // if (_param->_have_port_depth) 1295 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1296 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1297 } 1298 } 1299 upt.clear(); 1300 1301 { 1302 LABEL("BRANCH_EVENT - have miss decod"); 1303 1304 uint32_t port = context; 1305 1306 { 1307 bool have_transaction = false; 1308 1309 do 1310 { 1311 in_BRANCH_EVENT_ACK [port]->write((rand()%100)<percent_transaction_branch_event); 1312 1313 SC_START(0); 1314 1315 LABEL("BRANCH_EVENT [%d] %d - %d.",port,out_BRANCH_EVENT_VAL [port]->read(),in_BRANCH_EVENT_ACK [port]->read()); 1316 1317 if (out_BRANCH_EVENT_VAL [port]->read() and in_BRANCH_EVENT_ACK [port]->read()) 1318 { 1319 LABEL("BRANCH_EVENT [%d] - Transaction accepted",port); 1320 have_transaction = true; 1321 1322 TEST(Taddress_t,out_BRANCH_EVENT_ADDRESS_SRC [port]->read(),event.address_src); 1323 TEST(Tcontrol_t,out_BRANCH_EVENT_ADDRESS_DEST_VAL [port]->read(),event.take); 1324 if (event.take) 1325 TEST(Taddress_t,out_BRANCH_EVENT_ADDRESS_DEST [port]->read(),event.address_good); 1326 1327 event.address_src = 0; 1328 event.take = 0; 1329 event.address_dest = 0; 1330 } 1331 1332 SC_START(1); 1333 } while (not have_transaction); 1334 1335 in_BRANCH_EVENT_ACK [port]->write(0); 1336 } 1337 } 1338 1339 // Wait Garbage Collector 1340 { 1341 upt_bottom [context] = (upt_bottom [context]+1)%_param->_size_upt_queue[context]; 1342 // upt_top [context] = (upt_top [context]); 1343 1344 while ((upt_bottom [context] != out_DEPTH_MIN [context]->read()) or 1345 (upt_top [context] != out_DEPTH_MAX [context]->read())) 1346 SC_START(1); 1347 1348 } 1349 } 1350 1351 //--------------------------------------------------------------------- 1352 //--------------------------------------------------------------------- 1353 // COMMIT MISS : with RAS in UPFT and UPT 1354 //--------------------------------------------------------------------- 1355 //--------------------------------------------------------------------- 1356 if (test4) 1357 { 1358 uint32_t context = rand() % _param->_nb_context; 1359 uint32_t have_ufpt_ras = false; 1360 uint32_t have_upt_ras = false; 1361 { 1362 LABEL("PREDICT - fill the queue"); 1363 uint32_t port = rand() % _param->_nb_inst_predict; 1364 1365 LABEL(" * context : %d",context); 1366 LABEL(" * port : %d",port); 1367 1368 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1369 { 1370 request_t request; 1371 request.context = context; 1372 request.address_src = rand(); 1373 request.address_dest = rand(); 1374 1375 request.condition = (rand()%2)?BRANCH_CONDITION_READ_STACK:BRANCH_CONDITION_FLAG_SET; 1376 1377 request.take = 1; 1378 request.take_good = 1; 1379 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 1380 request.is_accurate = false; 1381 request.miss_ifetch = false; 1382 request.miss_decod = false; 1383 request.miss_commit = false; 1384 request.history = i; 1385 request.ras_address = rand(); 1386 request.ras_index = rand()%_param->_size_ras_index[context]; 1387 request.ufpt_ptr = ufpt_top [context]; 1388 // request.upt_ptr; 1389 1390 bool have_transaction = false; 1391 do 1392 { 1393 in_PREDICT_VAL [port]->write((rand()%100)<percent_transaction_predict); 1394 in_PREDICT_CONTEXT_ID [port]->write(request.context ); 1395 in_PREDICT_BTB_ADDRESS_SRC [port]->write(request.address_src ); 1396 in_PREDICT_BTB_ADDRESS_DEST [port]->write(request.address_dest); 1397 in_PREDICT_BTB_CONDITION [port]->write(request.condition ); 1398 in_PREDICT_BTB_LAST_TAKE [port]->write(request.take ); 1399 in_PREDICT_BTB_IS_ACCURATE [port]->write(request.is_accurate ); 1400 in_PREDICT_DIR_HISTORY [port]->write(request.history ); 1401 in_PREDICT_RAS_ADDRESS [port]->write(request.ras_address ); 1402 in_PREDICT_RAS_INDEX [port]->write(request.ras_index ); 1403 1404 if (_param->_have_port_depth) 1405 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1406 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1407 1408 SC_START(0); // fct melay 1409 1410 LABEL("PREDICT [%d] %d - %d (accurate : %d).", 1411 port, 1412 in_PREDICT_VAL [port]->read(), 1413 out_PREDICT_ACK [port]->read(), 1414 in_PREDICT_BTB_IS_ACCURATE [port]->read()); 1415 1416 if (in_PREDICT_VAL [port]->read() and out_PREDICT_ACK [port]->read()) 1417 { 1418 LABEL("PREDICT [%d] - Transaction accepted",port); 1419 have_transaction = true; 1420 1421 if (_param->_have_port_depth) 1422 TEST(Tprediction_ptr_t,out_PREDICT_UPDATE_PREDICTION_ID [port]->read(),ufpt_top [context]); 1423 1424 ufpt_top [context] = (ufpt_top [context]+1)%_param->_size_ufpt_queue[context]; 1425 } 1426 1427 SC_START(1); // transition 1428 1429 } while (not have_transaction); 1430 1431 ufpt.push_back(request); // to update 1432 1433 in_PREDICT_VAL [port]->write(0); 1434 1435 if (_param->_have_port_depth) 1436 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1437 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1438 } 1439 } 1440 1441 { 1442 LABEL("DECOD"); 1443 uint32_t port = rand() % _param->_nb_inst_decod; 1444 1445 LABEL(" * context : %d",context); 1446 LABEL(" * port : %d",port); 1447 1448 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1449 { 1450 request_t request = ufpt.front(); 1451 1452 bool have_transaction = false; 1453 do 1454 { 1455 in_DECOD_VAL [port]->write((rand()%100)<percent_transaction_decod); 1456 in_DECOD_CONTEXT_ID [port]->write(request.context ); 1457 in_DECOD_BTB_ADDRESS_SRC [port]->write(request.address_src ); 1458 in_DECOD_BTB_ADDRESS_DEST [port]->write(request.address_dest); 1459 in_DECOD_BTB_CONDITION [port]->write(request.condition ); 1460 in_DECOD_BTB_LAST_TAKE [port]->write(request.take ); 1461 in_DECOD_RAS_ADDRESS [port]->write(request.ras_address ); 1462 in_DECOD_RAS_INDEX [port]->write(request.ras_index ); 1463 in_DECOD_UPDATE_PREDICTION_ID [port]->write(request.ufpt_ptr ); 1464 in_DECOD_MISS_IFETCH [port]->write(request.miss_ifetch ); 1465 in_DECOD_MISS_DECOD [port]->write(request.miss_decod ); 1466 in_DECOD_IS_ACCURATE [port]->write(request.is_accurate ); 1467 1468 have_upt_ras |= (update_ras(request.condition)); 1469 1470 SC_START(0); // fct melay 1471 1472 LABEL("DECOD [%d] %d - %d", 1473 port, 1474 in_PREDICT_VAL [port]->read(), 1475 out_PREDICT_ACK [port]->read()); 1476 1477 if (in_DECOD_VAL [port]->read() and out_DECOD_ACK [port]->read()) 1478 { 1479 LABEL("DECOD [%d] - Transaction accepted",port); 1480 have_transaction = true; 1481 1482 request.upt_ptr = upt_top [context]; 1483 upt.push_back(request); 1484 ufpt.pop_front(); 1485 1486 upt_top [context] = (upt_top [context]+1)%_param->_size_upt_queue[context]; 1487 } 1488 1489 SC_START(1); // transition 1490 1491 } while (not have_transaction); 1492 1493 in_DECOD_VAL [port]->write(0); 1494 1495 if (_param->_have_port_depth) 1496 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1497 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1498 } 1499 } 1500 1501 { 1502 LABEL("PREDICT - fill the queue"); 1503 uint32_t port = rand() % _param->_nb_inst_predict; 1504 1505 LABEL(" * context : %d",context); 1506 LABEL(" * port : %d",port); 1507 1508 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1509 { 1510 request_t request; 1511 request.context = context; 1512 request.address_src = rand(); 1513 request.address_dest = rand(); 1514 request.address_good = request.address_dest; 1515 request.condition = (rand()%2)?BRANCH_CONDITION_NONE_WITH_WRITE_STACK:BRANCH_CONDITION_FLAG_SET; 1516 1517 have_ufpt_ras |= (update_ras(request.condition)); 1518 1519 request.take = 1; 1520 request.take_good = 1; 1521 request.flag = (request.condition == BRANCH_CONDITION_FLAG_SET)?request.take_good:(not request.take_good); 1522 request.is_accurate = false; 1523 request.miss_ifetch = false; 1524 request.miss_decod = false; 1525 request.miss_commit = true; 1526 request.history = i; 1527 request.ras_address = rand(); 1528 request.ras_index = rand()%_param->_size_ras_index[context]; 1529 request.ufpt_ptr = ufpt_top [context]; 1530 // request.upt_ptr; 1531 1532 bool have_transaction = false; 1533 do 1534 { 1535 in_PREDICT_VAL [port]->write((rand()%100)<percent_transaction_predict); 1536 in_PREDICT_CONTEXT_ID [port]->write(request.context ); 1537 in_PREDICT_BTB_ADDRESS_SRC [port]->write(request.address_src ); 1538 in_PREDICT_BTB_ADDRESS_DEST [port]->write(request.address_dest); 1539 in_PREDICT_BTB_CONDITION [port]->write(request.condition ); 1540 in_PREDICT_BTB_LAST_TAKE [port]->write(request.take ); 1541 in_PREDICT_BTB_IS_ACCURATE [port]->write(request.is_accurate ); 1542 in_PREDICT_DIR_HISTORY [port]->write(request.history ); 1543 in_PREDICT_RAS_ADDRESS [port]->write(request.ras_address ); 1544 in_PREDICT_RAS_INDEX [port]->write(request.ras_index ); 1545 1546 if (_param->_have_port_depth) 1547 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1548 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1549 1550 SC_START(0); // fct melay 1551 1552 LABEL("PREDICT [%d] %d - %d (accurate : %d).", 1553 port, 1554 in_PREDICT_VAL [port]->read(), 1555 out_PREDICT_ACK [port]->read(), 1556 in_PREDICT_BTB_IS_ACCURATE [port]->read()); 1557 1558 if (in_PREDICT_VAL [port]->read() and out_PREDICT_ACK [port]->read()) 1559 { 1560 LABEL("PREDICT [%d] - Transaction accepted",port); 1561 have_transaction = true; 1562 1563 if (_param->_have_port_depth) 1564 TEST(Tprediction_ptr_t,out_PREDICT_UPDATE_PREDICTION_ID [port]->read(),ufpt_top [context]); 1565 1566 ufpt_top [context] = (ufpt_top [context]+1)%_param->_size_ufpt_queue[context]; 1567 } 1568 1569 SC_START(1); // transition 1570 1571 } while (not have_transaction); 1572 1573 ufpt.push_back(request); // to update 1574 1575 in_PREDICT_VAL [port]->write(0); 1576 1577 if (_param->_have_port_depth) 1578 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1579 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1580 } 1581 } 1582 1583 std::list<request_t>::iterator it_event; 1584 { 1585 LABEL("BRANCH_COMPLETE - hit ifetch"); 1586 1587 uint32_t port = rand() % _param->_nb_inst_branch_complete; 1588 1589 LABEL(" * port : %d",port); 1590 1591 // middle 1592 it_event = upt.begin(); 1593 for (uint32_t i=0; i < (upt.size()>>1); ++i) 1594 it_event ++; 1595 1596 for (std::list<request_t>::iterator it_upt = it_event; 1597 it_upt != upt.end(); 1598 ++it_upt) 1599 it_upt->miss_commit = true; 1600 1601 if (update_ras(it_event->condition)) 1602 it_event->address_good = ~(it_event->address_dest); 1603 else 1604 { 1605 it_event->address_good = it_event->address_dest; 1606 it_event->flag = not it_event->flag; 1607 it_event->take_good = not it_event->take_good; 1608 } 1609 1610 event = *it_event; 1611 1612 1613 // for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1614 // for (uint32_t i=0; i<upt.size(); i++) 1615 // just one 1616 { 1617 bool have_transaction = false; 1618 1619 do 1620 { 1621 in_BRANCH_COMPLETE_VAL [port]->write((rand()%100)<percent_transaction_branch_complete); 1622 in_BRANCH_COMPLETE_CONTEXT_ID [port]->write(it_event->context ); 1623 in_BRANCH_COMPLETE_DEPTH [port]->write(it_event->upt_ptr ); 1624 in_BRANCH_COMPLETE_ADDRESS [port]->write(it_event->address_good); 1625 in_BRANCH_COMPLETE_FLAG [port]->write(it_event->flag ); 1626 1627 if (_param->_have_port_depth) 1628 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1629 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1630 1631 SC_START(0); 1632 1633 LABEL("BRANCH_COMPLETE [%d] %d - %d.",port,in_BRANCH_COMPLETE_VAL [port]->read(),out_BRANCH_COMPLETE_ACK [port]->read()); 1634 1635 if (in_BRANCH_COMPLETE_VAL [port]->read() and out_BRANCH_COMPLETE_ACK [port]->read()) 1636 { 1637 LABEL("BRANCH_COMPLETE [%d] - Transaction accepted",port); 1638 LABEL(" * CONTEXT_ID %d" ,it_event->context ); 1639 LABEL(" * DEPTH %d" ,it_event->upt_ptr ); 1640 LABEL(" * CONDITION %d" ,it_event->condition ); 1641 LABEL(" * ADDRESS %.8x",it_event->address_good); 1642 LABEL(" * FLAG %d" ,it_event->flag ); 1643 1644 have_transaction = true; 1645 1646 TEST(Tcontrol_t,out_BRANCH_COMPLETE_MISS_PREDICTION[port]->read(),it_event->miss_commit ); 1647 TEST(Tcontrol_t,out_BRANCH_COMPLETE_TAKE [port]->read(),it_event->take_good ); 1648 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_SRC [port]->read(),it_event->address_src ); 1649 TEST(Taddress_t,out_BRANCH_COMPLETE_ADDRESS_DEST [port]->read(),it_event->address_good); 1650 1651 upt_top [it_event->context] = it_event->upt_ptr; 1652 } 1653 1654 SC_START(1); 1655 } while (not have_transaction); 1656 1657 in_BRANCH_COMPLETE_VAL [port]->write(0); 1658 1659 if (_param->_have_port_depth) 1660 TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1661 TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1662 } 1663 } 1664 1665 if (have_ufpt_ras) 1666 { 1667 LABEL("UPDATE - Update UPFT"); 1668 1669 uint32_t port = 0; 1670 1671 LABEL(" * port : %d",port); 1672 std::list<request_t>::iterator it_ufpt = ufpt.end(); 1673 -- it_ufpt; 1674 1675 for (uint32_t i=0; i<_param->_size_ufpt_queue[context]; i++) 1676 { 1677 bool have_transaction = false; 1678 1679 do 1680 { 1681 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 1682 1683 // if (_param->_have_port_depth) 1684 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), ufpt_bottom [context]); 1685 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), ufpt_top [context]); 1686 1687 SC_START(0); 1688 1689 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 1690 1691 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 1692 { 1693 LABEL("UPDATE [%d] - Transaction accepted",port); 1694 have_transaction = true; 1695 1696 if (_param->_have_port_context_id) 1697 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_ufpt->context); 1698 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),(it_ufpt->miss_ifetch or 1699 it_ufpt->miss_decod or 1700 it_ufpt->miss_commit )); 1701 // if (update_btb(it_ufpt->condition) or 1702 // update_dir(it_ufpt->condition)) 1703 // TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_ufpt->take_good); 1704 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),0); 1705 // if (update_btb(it_ufpt->condition)) 1706 // { 1707 // TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_ufpt->address_src); 1708 // TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_ufpt->address_dest); 1709 // TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_ufpt->condition); 1710 // } 1711 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),0); 1712 1713 // if (update_dir(it_ufpt->condition)) 1714 // if (_param->_have_port_history) 1715 // TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_ufpt->history); 1716 // TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_ufpt->condition)); 1717 if (update_ras(it_ufpt->condition)) 1718 { 1719 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 1720 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_ufpt->condition)); 1721 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_ufpt->ras_address); 1722 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_ufpt->ras_index); 1723 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_ufpt->miss_ifetch); 1724 } 1725 } 1726 1727 SC_START(1); 1728 } while (not have_transaction); 1729 1730 -- it_ufpt; 1731 1732 1733 in_UPDATE_ACK [port]->write(0); 1734 // if (_param->_have_port_depth) 1735 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), ufpt_bottom [context]); 1736 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), ufpt_top [context]); 1737 } 1738 } 1739 ufpt.clear(); 1740 1741 { 1742 LABEL("UPDATE - upt"); 1743 1744 uint32_t port = 0; 1745 1746 LABEL(" * port : %d",port); 1747 std::list<request_t>::iterator it_upt = upt.end(); 1748 --it_upt; 1749 1750 // for (uint32_t i=0; i<upt.size(); i++) 1751 while (it_upt != it_event) 1752 { 1753 bool have_transaction = false; 1754 1755 do 1756 { 1757 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 1758 1759 // if (_param->_have_port_depth) 1760 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1761 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1762 1763 SC_START(0); 1764 1765 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 1766 1767 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 1768 { 1769 LABEL("UPDATE [%d] - Transaction accepted",port); 1770 have_transaction = true; 1771 1772 if (_param->_have_port_context_id) 1773 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_upt->context); 1774 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),it_upt->miss_commit); 1775 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_upt->take_good); 1776 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),update_btb(it_upt->condition)); 1777 if (update_btb(it_upt->condition)) 1778 { 1779 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_upt->address_src); 1780 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_upt->address_dest); 1781 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_upt->condition); 1782 } 1783 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),update_dir(it_upt->condition) and not (it_upt->miss_ifetch or it_upt->miss_decod)); 1784 1785 if (update_dir(it_upt->condition)) 1786 if (_param->_have_port_history) 1787 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_upt->history); 1788 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_upt->condition)); 1789 if (update_ras(it_upt->condition)) 1790 { 1791 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 1792 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_upt->condition)); 1793 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_upt->ras_address); 1794 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_upt->ras_index); 1795 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_upt->miss_ifetch); 1796 } 1797 1798 -- it_upt; 1799 } 1800 1801 SC_START(1); 1802 } while (not have_transaction); 1803 1804 upt.pop_back(); 1805 in_UPDATE_ACK [port]->write(0); 1806 // if (_param->_have_port_depth) 1807 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1808 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1809 } 1810 } 1811 // upt.clear(); // Not yet 1812 1813 { 1814 LABEL("BRANCH_EVENT - have miss decod"); 1815 1816 uint32_t port = context; 1817 1818 { 1819 bool have_transaction = false; 1820 1821 do 1822 { 1823 in_BRANCH_EVENT_ACK [port]->write((rand()%100)<percent_transaction_branch_event); 1824 1825 SC_START(0); 1826 1827 LABEL("BRANCH_EVENT [%d] %d - %d.",port,out_BRANCH_EVENT_VAL [port]->read(),in_BRANCH_EVENT_ACK [port]->read()); 1828 1829 if (out_BRANCH_EVENT_VAL [port]->read() and in_BRANCH_EVENT_ACK [port]->read()) 1830 { 1831 LABEL("BRANCH_EVENT [%d] - Transaction accepted",port); 1832 have_transaction = true; 1833 1834 LABEL(" * event.address_src : %.8x,",event.address_src ); 1835 LABEL(" * event.address_good : %.8x,",event.address_good); 1836 LABEL(" * event.take : %.8x,",event.take ); 1837 1838 TEST(Taddress_t,out_BRANCH_EVENT_ADDRESS_SRC [port]->read(),event.address_src); 1839 TEST(Tcontrol_t,out_BRANCH_EVENT_ADDRESS_DEST_VAL [port]->read(),event.take_good); 1840 if (event.take_good) 1841 TEST(Taddress_t,out_BRANCH_EVENT_ADDRESS_DEST [port]->read(),event.address_good); 1842 1843 event.address_src = 0; 1844 event.take = 0; 1845 event.address_dest = 0; 1846 } 1847 1848 SC_START(1); 1849 } while (not have_transaction); 1850 1851 in_BRANCH_EVENT_ACK [port]->write(0); 1852 } 1853 } 1854 1855 { 1856 LABEL("UPDATE - upt"); 1857 1858 uint32_t port = 0; 1859 1860 LABEL(" * port : %d",port); 1861 std::list<request_t>::iterator it_upt = upt.begin(); 1862 1863 for (uint32_t i=0; i<upt.size(); i++) 1864 { 1865 bool have_transaction = false; 1866 1867 do 1868 { 1869 in_UPDATE_ACK [port]->write((rand()%100)<percent_transaction_update); 1870 1871 // if (_param->_have_port_depth) 1872 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1873 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1874 1875 SC_START(0); 1876 1877 LABEL("UPDATE [%d] %d - %d.",port,out_UPDATE_VAL [port]->read(),in_UPDATE_ACK [port]->read()); 1878 1879 if (out_UPDATE_VAL [port]->read() and in_UPDATE_ACK [port]->read()) 1880 { 1881 LABEL("UPDATE [%d] - Transaction accepted",port); 1882 have_transaction = true; 1883 1884 if (_param->_have_port_context_id) 1885 TEST(Tcontext_t ,out_UPDATE_CONTEXT_ID [port]->read(),it_upt->context); 1886 TEST(Tcontrol_t ,out_UPDATE_MISS_PREDICTION [port]->read(),it_upt->miss_commit); 1887 TEST(Tcontrol_t ,out_UPDATE_DIRECTION_GOOD [port]->read(),it_upt->take_good); 1888 TEST(Tcontrol_t ,out_UPDATE_BTB_VAL [port]->read(),update_btb(it_upt->condition)); 1889 if (update_btb(it_upt->condition)) 1890 { 1891 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_SRC [port]->read(),it_upt->address_src); 1892 TEST(Taddress_t ,out_UPDATE_BTB_ADDRESS_DEST [port]->read(),it_upt->address_dest); 1893 TEST(Tbranch_condition_t,out_UPDATE_BTB_CONDITION [port]->read(),it_upt->condition); 1894 } 1895 TEST(Tcontrol_t ,out_UPDATE_DIR_VAL [port]->read(),update_dir(it_upt->condition) and not (it_upt->miss_ifetch or it_upt->miss_decod)); 1896 1897 if (update_dir(it_upt->condition)) 1898 if (_param->_have_port_history) 1899 TEST(Thistory_t ,out_UPDATE_DIR_HISTORY [port]->read(),it_upt->history); 1900 TEST(Tcontrol_t ,out_UPDATE_RAS_VAL [port]->read(),update_ras(it_upt->condition)); 1901 if (update_ras(it_upt->condition)) 1902 { 1903 // TEST(Tcontrol_t ,out_UPDATE_RAS_FLUSH [port]->read(),0); 1904 TEST(Tcontrol_t ,out_UPDATE_RAS_PUSH [port]->read(),push_ras (it_upt->condition)); 1905 TEST(Taddress_t ,out_UPDATE_RAS_ADDRESS [port]->read(),it_upt->ras_address); 1906 TEST(Tptr_t ,out_UPDATE_RAS_INDEX [port]->read(),it_upt->ras_index); 1907 TEST(Tcontrol_t ,out_UPDATE_RAS_PREDICTION_IFETCH [port]->read(),not it_upt->miss_ifetch); 1908 } 1909 1910 -- it_upt; 1911 } 1912 1913 SC_START(1); 1914 } while (not have_transaction); 1915 1916 in_UPDATE_ACK [port]->write(0); 1917 // if (_param->_have_port_depth) 1918 // TEST(Tdepth_t,out_DEPTH_MIN [context]->read(), upt_bottom [context]); 1919 // TEST(Tdepth_t,out_DEPTH_MAX [context]->read(), upt_top [context]); 1920 } 1921 } 1922 upt.clear(); // Not yet 1923 1924 // Wait Garbage Collector 1925 { 1926 upt_bottom [context] = (upt_bottom [context]+1)%_param->_size_upt_queue[context]; 1927 // upt_top [context] = (upt_top [context]); 1928 1929 while ((upt_bottom [context] != out_DEPTH_MIN [context]->read()) or 1930 (upt_top [context] != out_DEPTH_MAX [context]->read())) 1931 SC_START(1); 1932 1933 } 1934 } 1935 588 1936 }// ITERATION 589 1937 … … 649 1997 // delete [] out_BRANCH_EVENT_MISS_PREDICTION; 650 1998 delete [] out_BRANCH_EVENT_ADDRESS_SRC ; 1999 delete [] out_BRANCH_EVENT_ADDRESS_DEST_VAL; 651 2000 delete [] out_BRANCH_EVENT_ADDRESS_DEST ; 652 2001 … … 664 2013 delete [] out_UPDATE_DIR_HISTORY ; 665 2014 delete [] out_UPDATE_RAS_VAL ; 2015 delete [] out_UPDATE_RAS_FLUSH ; 666 2016 delete [] out_UPDATE_RAS_PUSH ; 667 2017 delete [] out_UPDATE_RAS_ADDRESS ; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h
r88 r94 120 120 //public : SC_OUT(Tcontrol_t ) ** out_BRANCH_EVENT_MISS_PREDICTION ; //[nb_context] is always miss prediction 121 121 public : SC_OUT(Taddress_t ) ** out_BRANCH_EVENT_ADDRESS_SRC ; //[nb_context] 122 public : SC_OUT(Tcontrol_t ) ** out_BRANCH_EVENT_ADDRESS_DEST_VAL ; //[nb_context] 122 123 public : SC_OUT(Taddress_t ) ** out_BRANCH_EVENT_ADDRESS_DEST ; //[nb_context] 123 124 … … 135 136 public : SC_OUT(Thistory_t ) ** out_UPDATE_DIR_HISTORY ; //[nb_inst_update] 136 137 public : SC_OUT(Tcontrol_t ) ** out_UPDATE_RAS_VAL ; //[nb_inst_update] 138 public : SC_OUT(Tcontrol_t ) ** out_UPDATE_RAS_FLUSH ; //[nb_inst_update] 137 139 public : SC_OUT(Tcontrol_t ) ** out_UPDATE_RAS_PUSH ; //[nb_inst_update] 138 140 public : SC_OUT(Taddress_t ) ** out_UPDATE_RAS_ADDRESS ; //[nb_inst_update] 139 141 public : SC_OUT(Tptr_t ) ** out_UPDATE_RAS_INDEX ; //[nb_inst_update] 140 142 public : SC_OUT(Tcontrol_t ) ** out_UPDATE_RAS_PREDICTION_IFETCH ; //[nb_inst_update] 143 144 // ~~~~~[ Interface : "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 145 public : SC_IN (Tevent_state_t ) ** in_EVENT_STATE ; //[nb_context] 146 public : SC_IN (Tevent_type_t ) ** in_EVENT_TYPE ; //[nb_context] 147 public : SC_IN (Tdepth_t ) ** in_EVENT_DEPTH ; //[nb_context] 141 148 142 149 // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 164 171 private : uint32_t * reg_UPT_TOP ; //[nb_context] 165 172 private : uint32_t * reg_UPT_UPDATE ; //[nb_context] 166 private : uint32_t * reg_UPT_NB_NEED_UPDATE ; //[nb_context]167 173 168 174 private : bool * reg_IS_ACCURATE ; //[nb_context] 169 175 170 176 private : event_state_t * reg_EVENT_STATE ; //[nb_context] 171 private : Tcontrol_t * reg_EVENT_RAS_CORRUPTED ; //[nb_context] // RAS must be flush172 177 private : Taddress_t * reg_EVENT_ADDRESS_SRC ; //[nb_context] // Address branch 173 private : Tcontrol_t * reg_EVENT_ADDRESS_ SRC_VAL; //[nb_context] // if miss ifetch, decod issue branch, dest must be reload178 private : Tcontrol_t * reg_EVENT_ADDRESS_DEST_VAL ; //[nb_context] // if miss ifetch, decod issue branch, dest must be reload 174 179 private : Taddress_t * reg_EVENT_ADDRESS_DEST ; //[nb_context] // Address dest 175 180 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_allocation.cpp
r88 r94 114 114 ALLOC1_INTERFACE("branch_event", IN,SOUTH, "branch_event", _param->_nb_context); 115 115 116 ALLOC1_VALACK_OUT(out_BRANCH_EVENT_VAL ,VAL); 117 ALLOC1_VALACK_IN ( in_BRANCH_EVENT_ACK ,ACK); 118 // ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_CONTEXT_ID ,"context_id" ,Tcontext_t,_param->_size_context_id); 119 // ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_DEPTH ,"depth" ,Tdepth_t ,_param->_size_depth); 120 // ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_MISS_PREDICTION,"miss_prediction",Tcontrol_t,1); 121 ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_SRC ,"address_src" ,Taddress_t,_param->_size_instruction_address); 122 ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_DEST ,"address_dest" ,Taddress_t,_param->_size_instruction_address); 116 ALLOC1_VALACK_OUT(out_BRANCH_EVENT_VAL ,VAL); 117 ALLOC1_VALACK_IN ( in_BRANCH_EVENT_ACK ,ACK); 118 // ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_CONTEXT_ID ,"context_id" ,Tcontext_t,_param->_size_context_id); 119 // ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_DEPTH ,"depth" ,Tdepth_t ,_param->_size_depth); 120 // ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_MISS_PREDICTION ,"miss_prediction" ,Tcontrol_t,1); 121 ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_SRC ,"address_src" ,Taddress_t,_param->_size_instruction_address); 122 ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_DEST_VAL ,"address_dest_val",Tcontrol_t,1); 123 ALLOC1_SIGNAL_OUT(out_BRANCH_EVENT_ADDRESS_DEST ,"address_dest" ,Taddress_t,_param->_size_instruction_address); 123 124 } 124 125 … … 139 140 ALLOC1_SIGNAL_OUT(out_UPDATE_DIR_HISTORY ,"dir_history" ,Thistory_t ,_param->_size_history); 140 141 ALLOC1_SIGNAL_OUT(out_UPDATE_RAS_VAL ,"ras_val" ,Tcontrol_t ,1); 142 ALLOC1_SIGNAL_OUT(out_UPDATE_RAS_FLUSH ,"ras_flush" ,Tcontrol_t ,1); 141 143 ALLOC1_SIGNAL_OUT(out_UPDATE_RAS_PUSH ,"ras_push" ,Tcontrol_t ,1); 142 144 ALLOC1_SIGNAL_OUT(out_UPDATE_RAS_ADDRESS ,"ras_address" ,Taddress_t ,_param->_size_instruction_address); 143 145 ALLOC1_SIGNAL_OUT(out_UPDATE_RAS_INDEX ,"ras_index" ,Tptr_t ,_param->_max_size_ras_index); 144 146 ALLOC1_SIGNAL_OUT(out_UPDATE_RAS_PREDICTION_IFETCH,"ras_prediction_ifetch",Tcontrol_t ,1); 147 } 148 149 // ~~~~~[ Interface : "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 150 { 151 ALLOC1_INTERFACE("event", IN,SOUTH,"event", _param->_nb_context); 152 153 ALLOC1_SIGNAL_IN ( in_EVENT_STATE ,"state",Tevent_state_t,_param->_size_event_state); 154 ALLOC1_SIGNAL_IN ( in_EVENT_TYPE ,"type" ,Tevent_type_t ,_param->_size_event_type ); 155 ALLOC1_SIGNAL_IN ( in_EVENT_DEPTH ,"depth",Tdepth_t ,_param->_size_depth ); 145 156 } 146 157 … … 187 198 ALLOC1(reg_UPT_TOP ,uint32_t ,_param->_nb_context); 188 199 ALLOC1(reg_UPT_UPDATE ,uint32_t ,_param->_nb_context); 189 ALLOC1(reg_UPT_NB_NEED_UPDATE ,uint32_t ,_param->_nb_context);190 200 191 201 ALLOC1(reg_EVENT_STATE ,event_state_t,_param->_nb_context); 192 ALLOC1(reg_EVENT_RAS_CORRUPTED ,Tcontrol_t ,_param->_nb_context);193 202 ALLOC1(reg_EVENT_ADDRESS_SRC ,Taddress_t ,_param->_nb_context); 194 ALLOC1(reg_EVENT_ADDRESS_ SRC_VAL,Tcontrol_t ,_param->_nb_context);203 ALLOC1(reg_EVENT_ADDRESS_DEST_VAL ,Tcontrol_t ,_param->_nb_context); 195 204 ALLOC1(reg_EVENT_ADDRESS_DEST ,Taddress_t ,_param->_nb_context); 196 205 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_deallocation.cpp
r88 r94 88 88 // delete [] out_BRANCH_EVENT_MISS_PREDICTION; 89 89 delete [] out_BRANCH_EVENT_ADDRESS_SRC ; 90 delete [] out_BRANCH_EVENT_ADDRESS_DEST_VAL; 90 91 delete [] out_BRANCH_EVENT_ADDRESS_DEST ; 91 92 … … 105 106 delete [] out_UPDATE_DIR_HISTORY ; 106 107 delete [] out_UPDATE_RAS_VAL ; 108 delete [] out_UPDATE_RAS_FLUSH ; 107 109 delete [] out_UPDATE_RAS_PUSH ; 108 110 delete [] out_UPDATE_RAS_ADDRESS ; 109 111 delete [] out_UPDATE_RAS_INDEX ; 110 112 delete [] out_UPDATE_RAS_PREDICTION_IFETCH; 113 114 // ~~~~~[ Interface : "event" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 DELETE1_SIGNAL( in_EVENT_STATE ,_param->_nb_context,_param->_size_event_state); 116 DELETE1_SIGNAL( in_EVENT_TYPE ,_param->_nb_context,_param->_size_event_type ); 117 DELETE1_SIGNAL( in_EVENT_DEPTH ,_param->_nb_context,_param->_size_depth ); 111 118 112 119 // ~~~~~[ Interface : "depth" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ … … 149 156 DELETE1(reg_UPT_TOP ,_param->_nb_context); 150 157 DELETE1(reg_UPT_UPDATE ,_param->_nb_context); 151 DELETE1(reg_UPT_NB_NEED_UPDATE ,_param->_nb_context);152 158 153 159 DELETE1(reg_EVENT_STATE ,_param->_nb_context); 154 DELETE1(reg_EVENT_RAS_CORRUPTED ,_param->_nb_context);155 160 DELETE1(reg_EVENT_ADDRESS_SRC ,_param->_nb_context); 156 DELETE1(reg_EVENT_ADDRESS_ SRC_VAL,_param->_nb_context);161 DELETE1(reg_EVENT_ADDRESS_DEST_VAL ,_param->_nb_context); 157 162 DELETE1(reg_EVENT_ADDRESS_DEST ,_param->_nb_context); 158 163 } -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMealy_branch_complete.cpp
r88 r94 61 61 //miss : always hit 62 62 //addr_dest : compute in decod stage 63 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK"); 64 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_NONE_WITH_WRITE_STACK "); 63 65 64 66 #ifdef DEBUG_TEST … … 75 77 //addr_dest : compute in decod stage 76 78 //miss if the direction is bad 79 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_FLAG_UNSET"); 80 77 81 Tcontrol_t take_good = not flag; // flag set = not take 78 82 … … 91 95 //addr_dest : compute in decod stage 92 96 //miss if the direction is bad 97 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_FLAG_SET"); 98 93 99 Tcontrol_t take_good = flag; // flag set = take 94 100 … … 107 113 case BRANCH_CONDITION_READ_STACK : // l.jr (rb==r9) 108 114 { 115 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK"); 116 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK "); 117 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_CONDITION_READ_STACK "); 118 109 119 // miss if destination address is bad 110 120 miss = (addr_dest != addr_good); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_genMoore.cpp
r88 r94 24 24 log_begin(Update_Prediction_Table,FUNCTION); 25 25 log_function(Update_Prediction_Table,FUNCTION,_name.c_str()); 26 log_printf(NONE,Update_Prediction_Table,FUNCTION,FUNCTION);27 26 28 27 if (PORT_READ(in_NRESET) == 1) … … 87 86 Thistory_t dir_history ; 88 87 Tcontrol_t ras_val ; 88 Tcontrol_t ras_flush ; 89 89 Tcontrol_t ras_push ; 90 90 Taddress_t ras_address ; … … 110 110 111 111 val = (state == UPDATE_FETCH_PREDICTION_STATE_EVENT); 112 // val_without_ack = not update_ras(condition); 113 112 114 miss_prediction = 1; 113 115 // direction_good = ; … … 119 121 // dir_history = ; 120 122 ras_val = update_ras(condition); // repop/ repush data -> don't corrupt ras 123 ras_flush = 0; 121 124 ras_push = push_ras(condition); 122 125 ras_address = reg_UPDATE_FETCH_PREDICTION_TABLE [context][depth]._address_ras; … … 132 135 ufpt_update [context] = false; 133 136 134 tab_ufpt_depth[context] = ( depth==0)?(_param->_size_ufpt_queue[context]-1):(depth-1);137 tab_ufpt_depth[context] = ((depth==0)?_param->_size_ufpt_queue[context]:depth)-1; 135 138 } 136 139 } … … 177 180 dir_history = reg_UPDATE_PREDICTION_TABLE [context][depth]._history ; 178 181 ras_val = update_ras(condition); // repop/ repush data -> don't corrupt ras 182 ras_flush = (state == UPDATE_PREDICTION_STATE_KO); // miss prediction, RAS is corrupted 179 183 ras_push = push_ras(condition); 180 184 ras_address = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_ras; … … 224 228 PORT_WRITE(out_UPDATE_BTB_VAL [i],btb_val ); 225 229 PORT_WRITE(out_UPDATE_BTB_ADDRESS_SRC [i],btb_address_src ); 226 227 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * address_src : %.8x",btb_address_src);228 229 230 PORT_WRITE(out_UPDATE_BTB_ADDRESS_DEST [i],btb_address_dest ); 230 231 PORT_WRITE(out_UPDATE_BTB_CONDITION [i],btb_condition ); … … 233 234 PORT_WRITE(out_UPDATE_DIR_HISTORY [i],dir_history ); 234 235 PORT_WRITE(out_UPDATE_RAS_VAL [i],ras_val ); 236 PORT_WRITE(out_UPDATE_RAS_FLUSH [i],ras_flush ); 235 237 PORT_WRITE(out_UPDATE_RAS_PUSH [i],ras_push ); 236 238 PORT_WRITE(out_UPDATE_RAS_ADDRESS [i],ras_address ); … … 239 241 } 240 242 } 241 242 // // =================================================================== 243 // // =====[ BRANCH_EVENT ]============================================== 244 // // =================================================================== 245 // for (uint32_t i=0; i<_param->_nb_context; i++) 246 // { 247 // Tdepth_t depth = (reg_BOTTOM [i] + reg_NB_ELT_UPDATE [i])%_param->_size_queue [i]; 248 // state_t state = reg_UPDATE_PREDICTION_TABLE [i][depth]._state; 249 250 // Tcontrol_t val = ((state == UPDATE_PREDICTION_STATE_EVENT) or 251 // (state == UPDATE_PREDICTION_STATE_WAITEND_AND_EVENT)); 252 253 // if (val) 254 // { 255 // // breakpoint ("UPT : have an branch_event (depth %d)",depth); 256 // PORT_WRITE(out_BRANCH_EVENT_ADDRESS_SRC [i], reg_UPDATE_PREDICTION_TABLE [i][depth]._address_src ); 257 // PORT_WRITE(out_BRANCH_EVENT_ADDRESS_DEST [i], reg_UPDATE_PREDICTION_TABLE [i][depth]._address_dest); 258 // internal_BRANCH_EVENT_DEPTH [i] = depth; 259 // } 260 261 // internal_BRANCH_EVENT_VAL [i] = val; 262 // PORT_WRITE(out_BRANCH_EVENT_VAL [i], internal_BRANCH_EVENT_VAL [i]); 263 // } 264 265 } 243 244 // =================================================================== 245 // =====[ BRANCH_EVENT ]============================================== 246 // =================================================================== 247 for (uint32_t i=0; i<_param->_nb_context; i++) 248 { 249 Tcontrol_t val = (reg_EVENT_STATE [i] == EVENT_STATE_UPDATE_CONTEXT); 250 251 PORT_WRITE(out_BRANCH_EVENT_VAL [i],val); 252 PORT_WRITE(out_BRANCH_EVENT_ADDRESS_SRC [i],reg_EVENT_ADDRESS_SRC [i]); 253 PORT_WRITE(out_BRANCH_EVENT_ADDRESS_DEST_VAL [i],reg_EVENT_ADDRESS_DEST_VAL [i]); 254 PORT_WRITE(out_BRANCH_EVENT_ADDRESS_DEST [i],reg_EVENT_ADDRESS_DEST [i]); 255 256 internal_BRANCH_EVENT_VAL [i] = val; 257 } 258 } 259 266 260 log_end(Update_Prediction_Table,FUNCTION); 267 261 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_transition.cpp
r88 r94 45 45 reg_UPT_TOP [i] = 0; 46 46 reg_UPT_UPDATE [i] = 0; 47 reg_UPT_NB_NEED_UPDATE [i] = 0;48 47 49 48 reg_IS_ACCURATE [i] = true; 50 49 51 50 reg_EVENT_STATE [i] = EVENT_STATE_OK; 52 51 } … … 54 53 else 55 54 { 55 bool flush_UFPT [_param->_nb_context]; 56 for (uint32_t i=0; i<_param->_nb_context; i++) 57 flush_UFPT [i] = false; 58 56 59 // =================================================================== 57 60 // =====[ GARBAGE COLLECTOR ]========================================= … … 166 169 Tbranch_condition_t condition ; 167 170 Tcontrol_t is_accurate; 171 Taddress_t address_src = PORT_READ(in_DECOD_BTB_ADDRESS_SRC [i]); 172 Taddress_t address_dest = PORT_READ(in_DECOD_BTB_ADDRESS_DEST [i]); 173 Tcontrol_t last_take = PORT_READ(in_DECOD_BTB_LAST_TAKE [i]); 168 174 169 175 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * DECOD[%d] - Accepted",i); … … 176 182 { 177 183 // Have a miss !!! 184 #ifdef DEBUG_TEST 185 if (reg_EVENT_STATE [context] != EVENT_STATE_OK) 186 throw ERRORMORPHEO(FUNCTION,_("Decod : invalid event state.")); 187 #endif 188 189 if (reg_UFPT_NB_NEED_UPDATE [context] == 0) 190 { 191 // Change state 192 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_UPDATE_CONTEXT (decod - miss - no flush ufpt)",context); 193 reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; 194 } 195 else 196 { 197 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_FLUSH_UFPT (decod - miss - flush ufpt)",context); 198 reg_EVENT_STATE [context] = EVENT_STATE_FLUSH_UFPT; 199 } 178 200 179 201 // Flush UPFT 180 181 // It's to accelerate miss speculation 182 if (reg_UFPT_NB_NEED_UPDATE [context] == 0) 183 { 184 // No entry need prediction, flush all entry -> Reset 185 for (uint32_t j=0; j<_param->_size_ufpt_queue[context]; ++j) 186 reg_UPDATE_FETCH_PREDICTION_TABLE [context][j]._state = UPDATE_FETCH_PREDICTION_STATE_EMPTY; 187 reg_UFPT_BOTTOM [context] = 0; 188 reg_UFPT_TOP [context] = 0; 189 // reg_UFPT_UPDATE [context] = 0; 190 } 191 else 192 { 193 reg_UFPT_UPDATE [context] = reg_UFPT_TOP [context]; 194 195 #ifdef DEBUG_TEST 196 if (reg_EVENT_STATE [context] == EVENT_STATE_OK) 197 throw ERRORMORPHEO(FUNCTION,_("Decod : invalid event state.")); 198 #endif 199 200 // Change state 201 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_FLUSH_UFPT (decod - miss)",context); 202 203 reg_EVENT_STATE [context] = EVENT_STATE_FLUSH_UFPT; 204 } 202 flush_UFPT [context] = true; 203 204 reg_EVENT_ADDRESS_SRC [context] = address_src; // delay_slot is compute in Context_State 205 reg_EVENT_ADDRESS_DEST_VAL[context] = last_take; 206 reg_EVENT_ADDRESS_DEST [context] = address_dest; 205 207 206 208 // Push upt (from decod interface) … … 209 211 210 212 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._condition = condition; 211 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._address_src = PORT_READ(in_DECOD_BTB_ADDRESS_SRC [i]);212 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._address_dest = PORT_READ(in_DECOD_BTB_ADDRESS_DEST [i]);213 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._last_take = PORT_READ(in_DECOD_BTB_LAST_TAKE [i]);213 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._address_src = address_src ; 214 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._address_dest = address_dest; 215 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._last_take = last_take ; 214 216 // reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._good_take; 215 217 reg_UPDATE_PREDICTION_TABLE [context][upt_ptr_write]._is_accurate = is_accurate; … … 277 279 reg_UPT_TOP [context] = (upt_ptr_write+1)%_param->_size_upt_queue [context]; 278 280 // reg_UPT_UPDATE [context] = reg_UPT_TOP [context]; 279 if (need_update(condition))280 {281 reg_UPT_NB_NEED_UPDATE [context] ++;282 }283 281 } 284 282 … … 296 294 Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_BRANCH_COMPLETE_CONTEXT_ID [i]):0; 297 295 Tdepth_t depth = (_param->_have_port_depth )?PORT_READ(in_BRANCH_COMPLETE_DEPTH [i]):0; 296 Tcontrol_t miss = internal_BRANCH_COMPLETE_MISS_PREDICTION [i]; 297 Tcontrol_t good_take = internal_BRANCH_COMPLETE_TAKE [i]; 298 Taddress_t good_addr = internal_BRANCH_COMPLETE_ADDRESS_DEST [i]; 298 299 299 300 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * BRANCH_COMPLETE[%d] - Accepted",i); 300 301 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",context); 301 302 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * depth : %d",depth); 302 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss : %d", internal_BRANCH_COMPLETE_MISS_PREDICTION [i]);303 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * miss : %d",miss); 303 304 304 if (internal_BRANCH_COMPLETE_MISS_PREDICTION [i])305 if (miss) 305 306 { 306 // Miss case 307 // // breakpoint("Branch_complete and miss ..."); 308 309 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state [%d][%d] <- UPDATE_PREDICTION_STATE_EVENT (branch_complete)",context,depth); 310 // reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_EVENT; 311 312 // // Another prediction (prediction with depth higer) 313 // Tdepth_t top = reg_TOP[context];314 // uint32_t nb_elt_miss = ((top> depth)?top:(top+_param->_size_queue[context]))-depth; 315 // uint32_t nb_elt_need_update = 1; 316 // for (uint32_t j=1; j<nb_elt_miss; j++) 317 // { 318 // uint32_t k=(depth+j)%_param->_size_queue[context]; 319 320 // // Ifetch have make a prediction and it's a miss 321 // // When ifetch predict :322 // // * btb is not change -> needn't update 323 // // * direction is not change -> needn't update 324 // // * ras have change -> need update 325 326 // Tbranch_condition_t cond = reg_UPDATE_PREDICTION_TABLE [context][k]._condition;327 // if ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK) or 328 // (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK) or 329 // (cond == BRANCH_CONDITION_READ_STACK)) 330 // { 331 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state [%d][%d] <- UPDATE_PREDICTION_STATE_KO (branch_complete, ifetch miss, update ras)",context,k); 332 333 // nb_elt_need_update ++;334 // reg_UPDATE_PREDICTION_TABLE [context][k]._state = UPDATE_PREDICTION_STATE_KO; 335 // } 336 // else 337 // { 338 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state [%d][%d] <- UPDATE_PREDICTION_STATE_END (branch_complete, ifetch miss, don't update ras)",context,k);339 340 // reg_UPDATE_PREDICTION_TABLE [context][k]._state = UPDATE_PREDICTION_STATE_END; 341 // } 342 // } 343 // reg_NB_ELT_NEED_UPDATE [context] += nb_elt_need_update; 344 345 // // Update pointer : 346 // reg_TOP [context] = depth; 347 // reg_NB_ELT [context] -= nb_elt_miss; 348 // reg_UPDATE_PREDICTION_TABLE [context][depth]._address_dest = internal_BRANCH_COMPLETE_ADDRESS_DEST [i];349 307 // Have a miss !!! 308 // Flush UPFT 309 flush_UFPT [context] = true; 310 311 // Flush UPT 312 uint32_t top = reg_UPT_TOP [context]; 313 uint32_t new_update = ((top==0)?_param->_size_upt_queue[context]:top)-1; 314 for (uint32_t j=(depth+1)%_param->_size_upt_queue[context]; 315 j!=top; 316 j=(j+1)%_param->_size_upt_queue[context]) 317 reg_UPDATE_PREDICTION_TABLE [context][j]._state = UPDATE_PREDICTION_STATE_EVENT; 318 319 // TOP is next write slot : last slot is TOP-1 320 reg_UPT_UPDATE [context] = new_update; 321 322 // reg_UPT_BOTTOM [context]; 323 reg_UPT_TOP [context] = depth; 324 325 #ifdef DEBUG_TEST 326 if (reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_WAIT_END) 327 throw ERRORMORPHEO(FUNCTION,_("Branch complete : invalid upt state.")); 328 #endif 329 330 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * UPT [%d][%d].state <- UPDATE_PREDICTION_STATE_KO (branch_complete, ifetch hit)",context,depth); 331 reg_UPDATE_PREDICTION_TABLE [context][depth]._state = UPDATE_PREDICTION_STATE_KO; 332 333 334 Taddress_t address_src = reg_UPDATE_PREDICTION_TABLE [context][depth]._address_src; 335 336 if (reg_UFPT_NB_NEED_UPDATE [context] > 0) 337 { 338 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_FLUSH_UFPT_AND_UPT (branch_complete - miss)",context); 339 reg_EVENT_STATE [context] = EVENT_STATE_FLUSH_UFPT_AND_UPT; 340 } 341 else 342 { 343 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_FLUSH_UFPT_RAS (branch_complete - miss)",context); 344 // have ras prediction ? 345 reg_EVENT_STATE [context] = (new_update!=depth)?EVENT_STATE_FLUSH_UPT_RAS:EVENT_STATE_UPDATE_CONTEXT; 346 } 347 348 reg_EVENT_ADDRESS_SRC [context] = address_src; // delay_slot is compute in Context_State 349 reg_EVENT_ADDRESS_DEST_VAL[context] = good_take; 350 reg_EVENT_ADDRESS_DEST [context] = good_addr; 350 351 } 351 352 else … … 363 364 364 365 // In all case : update good_take 365 reg_UPDATE_PREDICTION_TABLE [context][depth]._good_take = internal_BRANCH_COMPLETE_TAKE [i];366 reg_UPDATE_PREDICTION_TABLE [context][depth]._good_take = good_take; 366 367 } 367 368 … … 381 382 if (internal_UPDATE_FROM_UFPT [i]) 382 383 { 384 // if free a slot, also all queue is updated 385 // Last slot ? 386 if (reg_UFPT_UPDATE [context] == reg_UFPT_BOTTOM [context]) 387 switch (reg_EVENT_STATE [context]) 388 { 389 case EVENT_STATE_FLUSH_UFPT : reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; break; 390 case EVENT_STATE_FLUSH_UFPT_AND_UPT : reg_EVENT_STATE [context] = (reg_UPT_UPDATE[context]!=reg_UPT_TOP[context])?EVENT_STATE_FLUSH_UPT_RAS:EVENT_STATE_UPDATE_CONTEXT; break; 391 default : break; 392 } 393 383 394 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * Update Fetch Prediction Table"); 384 395 … … 393 404 reg_UPDATE_FETCH_PREDICTION_TABLE [context][depth]._state = UPDATE_FETCH_PREDICTION_STATE_END; 394 405 406 395 407 // Update pointer 396 reg_UFPT_UPDATE [context] = (depth==0)?(_param->_size_ufpt_queue[context]-1):(depth-1); 397 408 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_UPDATE (before) : %d",reg_UFPT_UPDATE [context]); 409 reg_UFPT_UPDATE [context] = ((depth==0)?_param->_size_ufpt_queue[context]:depth)-1; 410 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_UPDATE (after ) : %d",reg_UFPT_UPDATE [context]); 398 411 // Free a register that need update ? 399 412 if (need_update(reg_UPDATE_FETCH_PREDICTION_TABLE [context][depth]._condition)) … … 405 418 406 419 // Change state 407 #ifdef DEBUG_TEST 408 if ((reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_OK ) and 409 (reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_KO ) and 410 (reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_EVENT)) 411 throw ERRORMORPHEO(FUNCTION,_("Update : invalid upt state.")); 420 #ifdef DEBUG_TEST 421 if (internal_UPDATE_RAS [i]) 422 { 423 if (reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_EVENT) 424 throw ERRORMORPHEO(FUNCTION,_("Update : invalid upt state.")); 425 } 426 else 427 { 428 if ((reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_OK ) and 429 (reg_UPDATE_PREDICTION_TABLE [context][depth]._state != UPDATE_PREDICTION_STATE_KO )) 430 throw ERRORMORPHEO(FUNCTION,_("Update : invalid upt state.")); 431 } 412 432 #endif 413 433 … … 417 437 418 438 // Update pointer 439 bool end_event = (reg_UPT_UPDATE [context] == reg_UPT_TOP [context]); 440 419 441 if (internal_UPDATE_RAS [i]) 420 reg_UPT_UPDATE [context] = (depth==0)?(_param->_size_upt_queue[context]-1):(depth-1); 442 { 443 reg_UPT_UPDATE [context] = (end_event)?reg_UPT_BOTTOM[context]:(((depth==0)?_param->_size_upt_queue[context]:depth)-1); 444 } 421 445 else 422 reg_UPT_UPDATE [context] = (depth+1)%_param->_size_upt_queue[context]; 423 424 // Free a register that need update ? 425 if (need_update(reg_UPDATE_PREDICTION_TABLE [context][depth]._condition)) 426 reg_UPT_NB_NEED_UPDATE [context] --; 446 { 447 reg_UPT_UPDATE [context] = (depth+1)%_param->_size_upt_queue[context]; 448 } 449 450 // End and event ? 451 if (end_event and 452 (reg_EVENT_STATE [context] != EVENT_STATE_OK)) 453 { 454 reg_EVENT_STATE [context] = EVENT_STATE_UPDATE_CONTEXT; 455 } 456 427 457 // Free the branch with no accurate ? 428 458 if (reg_UPDATE_PREDICTION_TABLE [context][depth]._is_accurate == false) 429 reg_IS_ACCURATE [ i] = true;459 reg_IS_ACCURATE [context] = true; 430 460 } 431 461 } … … 434 464 reg_UPDATE_PRIORITY = (reg_UPDATE_PRIORITY+1)%_param->_nb_context; 435 465 436 // // =================================================================== 437 // // =====[ BRANCH_EVENT ]============================================== 438 // // =================================================================== 439 // for (uint32_t i=0; i<_param->_nb_context; i++) 440 // if (internal_BRANCH_EVENT_VAL [i] and PORT_READ(in_BRANCH_EVENT_ACK [i])) 441 // { 442 // Tdepth_t depth = internal_BRANCH_EVENT_DEPTH [i]; 443 444 // if (reg_UPDATE_PREDICTION_TABLE [i][depth]._state == UPDATE_PREDICTION_STATE_EVENT) 445 // { 446 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state [%d][%d] <- UPDATE_PREDICTION_STATE_KO (branch_event)",i,depth); 447 448 // reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_KO; 449 // } 450 // else 451 // { 452 // #ifdef DEBUG_TEST 453 // if (reg_UPDATE_PREDICTION_TABLE [i][depth]._state == UPDATE_PREDICTION_STATE_WAITEND_AND_EVENT) 454 // throw ERRORMORPHEO(FUNCTION,_("Branche event : invalid state")); 455 // #endif 456 457 // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state [%d][%d] <- UPDATE_PREDICTION_STATE_WAITEND (branch_event)",i,depth); 458 459 // reg_UPDATE_PREDICTION_TABLE [i][depth]._state = UPDATE_PREDICTION_STATE_WAITEND; 460 // } 461 // } 466 // =================================================================== 467 // =====[ BRANCH_EVENT ]============================================== 468 // =================================================================== 469 for (uint32_t i=0; i<_param->_nb_context; i++) 470 if (internal_BRANCH_EVENT_VAL [i] and PORT_READ(in_BRANCH_EVENT_ACK [i])) 471 { 472 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * UPDATE[%d] - Accepted",i); 473 474 #ifdef DEBUG_TEST 475 if (reg_EVENT_STATE [i] != EVENT_STATE_UPDATE_CONTEXT) 476 throw ERRORMORPHEO(FUNCTION,_("Decod : invalid event state.")); 477 #endif 478 479 // Change state 480 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * EVENT [%d] <- EVENT_STATE_OK (branch_event)",i); 481 482 reg_EVENT_STATE [i] = EVENT_STATE_OK; 483 } 484 485 // =================================================================== 486 // =====[ FLUSH ]===================================================== 487 // =================================================================== 488 489 for (uint32_t i=0; i<_param->_nb_context; ++i) 490 { 491 if (flush_UFPT [i]) 492 { 493 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * Flush Update Fetch Prediction Table"); 494 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",i); 495 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_NB_NEED_UPDATE : %d",reg_UFPT_NB_NEED_UPDATE [i]); 496 497 // It's to accelerate miss speculation 498 if (reg_UFPT_NB_NEED_UPDATE [i] == 0) 499 { 500 501 // No entry need prediction, flush all entry -> Reset 502 for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; ++j) 503 reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._state = UPDATE_FETCH_PREDICTION_STATE_EMPTY; 504 reg_UFPT_BOTTOM [i] = 0; 505 reg_UFPT_TOP [i] = 0; 506 // reg_UFPT_UPDATE [i]; 507 } 508 else 509 { 510 for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; ++j) 511 reg_UPDATE_FETCH_PREDICTION_TABLE [i][j]._state = UPDATE_FETCH_PREDICTION_STATE_EVENT; 512 513 // TOP is next write slot : last slot is TOP-1 514 uint32_t top = reg_UFPT_TOP [i]; 515 reg_UFPT_UPDATE [i] = ((top==0)?_param->_size_ufpt_queue[i]:top)-1; 516 517 // reg_UFPT_BOTTOM [i]; 518 // reg_UFPT_TOP [i]; 519 } 520 521 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_UPDATE (after ) : %d",reg_UFPT_UPDATE [i]); 522 523 } 524 } 525 526 // =================================================================== 527 // =====[ PRINT ]===================================================== 528 // =================================================================== 462 529 463 530 #if (DEBUG >= DEBUG_TRACE) … … 468 535 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_IS_ACCURATE : %d",reg_IS_ACCURATE [i]); 469 536 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_STATE : %s" ,toString(reg_EVENT_STATE [i]).c_str()); 470 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_RAS_CORRUPTED : %d" ,reg_EVENT_RAS_CORRUPTED [i]);471 537 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_ADDRESS_SRC : %.8x",reg_EVENT_ADDRESS_SRC [i]); 472 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_ADDRESS_ SRC_VAL : %d" ,reg_EVENT_ADDRESS_SRC_VAL[i]);538 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_ADDRESS_DEST_VAL: %d" ,reg_EVENT_ADDRESS_DEST_VAL[i]); 473 539 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_EVENT_ADDRESS_DEST : %.8x",reg_EVENT_ADDRESS_DEST [i]); 474 540 … … 476 542 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_BOTTOM : %d",reg_UFPT_BOTTOM [i]); 477 543 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_TOP : %d",reg_UFPT_TOP [i]); 544 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_UPDATE : %d",reg_UFPT_UPDATE [i]); 478 545 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UFPT_NB_NEED_UPDATE : %d",reg_UFPT_NB_NEED_UPDATE [i]); 479 546 for (uint32_t j=0; j<_param->_size_ufpt_queue[i]; j++) … … 495 562 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_TOP : %d",reg_UPT_TOP [i]); 496 563 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_UPDATE : %d",reg_UPT_UPDATE [i]); 497 log_printf(TRACE,Update_Prediction_Table,FUNCTION," * reg_UPT_NB_NEED_UPDATE : %d",reg_UPT_NB_NEED_UPDATE [i]);498 564 for (uint32_t j=0; j<_param->_size_upt_queue[i]; j++) 499 565 log_printf(TRACE,Update_Prediction_Table,FUNCTION," [%d] %.4d, %.8x %.8x, %.1d %.1d %.1d, %.8d %.8x %.4d - %s", -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h
r81 r94 13 13 #include <iostream> 14 14 #include <sys/time.h> 15 15 #include "Common/include/Time.h" 16 16 #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h" 17 17 … … 26 26 morpheo::behavioural::generic::registerfile::registerfile_monolithic::Parameters * param); 27 27 28 class Time29 {30 private : timeval time_begin;31 // private : timeval time_end;32 33 public : Time ()34 {35 gettimeofday(&time_begin ,NULL);36 };37 38 public : ~Time ()39 {40 cout << *this;41 };42 43 public : friend ostream& operator<< (ostream& output_stream,44 const Time & x)45 {46 timeval time_end;47 48 gettimeofday(&time_end ,NULL);49 50 uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());51 52 double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec);53 54 output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << endl;55 56 return output_stream;57 }58 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/src/test.cpp
r88 r94 2 2 * $Id$ 3 3 * 4 * [ 4 * [ Description ] 5 5 * 6 6 * Test 7 7 */ 8 8 9 #define NB_ITERATION 1 610 #define CYCLE_MAX 10 24*NB_ITERATION9 #define NB_ITERATION 1 10 #define CYCLE_MAX 100000*NB_ITERATION 11 11 #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/SelfTest/include/test.h" 12 12 #include "Common/include/Test.h" -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_vhdl_body.cpp
r81 r94 17 17 void RegisterFile_Monolithic::vhdl_body (Vhdl * & vhdl) 18 18 { 19 vhdl->set_body ("");20 vhdl->set_ body ("-----------------------------------------------------------------------------");21 vhdl->set_ body ("--Ackitement");22 vhdl->set_ body ("-----------------------------------------------------------------------------");23 vhdl->set_body ("");19 vhdl->set_body (0,""); 20 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 21 vhdl->set_comment(0," Ackitement"); 22 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 23 vhdl->set_body (0,""); 24 24 25 25 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 26 vhdl->set_body ("out_READ_"+toString(i)+"_ACK <= '1';");26 vhdl->set_body (0,"out_READ_"+toString(i)+"_ACK <= '1';"); 27 27 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 28 vhdl->set_body ("out_WRITE_"+toString(i)+"_ACK <= '1';");28 vhdl->set_body (0,"out_WRITE_"+toString(i)+"_ACK <= '1';"); 29 29 for (uint32_t i = 0; i < _param->_nb_port_read_write; i++) 30 vhdl->set_body ("out_READ_WRITE_"+toString(i)+"_ACK <= '1';");30 vhdl->set_body (0,"out_READ_WRITE_"+toString(i)+"_ACK <= '1';"); 31 31 32 vhdl->set_body ("");33 vhdl->set_ body ("-----------------------------------------------------------------------------");34 vhdl->set_ body ("--Read RegisterFile");35 vhdl->set_ body ("-----------------------------------------------------------------------------");36 vhdl->set_body ("");32 vhdl->set_body (0,""); 33 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 34 vhdl->set_comment(0," Read RegisterFile"); 35 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 36 vhdl->set_body (0,""); 37 37 38 38 for (uint32_t i = 0; i < _param->_nb_port_read; i++) … … 44 44 str_address = "0"; 45 45 46 vhdl->set_body ("out_READ_"+toString(i)+"_DATA <= reg_DATA ("+str_address+") when in_READ_"+toString(i)+"_VAL = '1' else "+std_logic_others(_param->_size_word,0)+";");46 vhdl->set_body (0,"out_READ_"+toString(i)+"_DATA <= reg_DATA ("+str_address+") when in_READ_"+toString(i)+"_VAL = '1' else "+std_logic_others(_param->_size_word,0)+";"); 47 47 } 48 48 for (uint32_t i = 0; i < _param->_nb_port_read_write; i++) … … 53 53 else 54 54 str_address = "0"; 55 vhdl->set_body ("out_READ_WRITE_"+toString(i)+"_RDATA <= reg_DATA ("+str_address+") when in_READ_WRITE_"+toString(i)+"_VAL = '1' and in_READ_WRITE_"+toString(i)+"_RW = '"+toString(RW_READ)+"' else "+std_logic_others(_param->_size_word,0)+";");55 vhdl->set_body (0,"out_READ_WRITE_"+toString(i)+"_RDATA <= reg_DATA ("+str_address+") when in_READ_WRITE_"+toString(i)+"_VAL = '1' and in_READ_WRITE_"+toString(i)+"_RW = '"+toString(RW_READ)+"' else "+std_logic_others(_param->_size_word,0)+";"); 56 56 } 57 57 58 vhdl->set_body ("");59 vhdl->set_ body ("-----------------------------------------------------------------------------");60 vhdl->set_ body ("--Write RegisterFile");61 vhdl->set_ body ("-----------------------------------------------------------------------------");62 vhdl->set_body ("");58 vhdl->set_body (0,""); 59 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 60 vhdl->set_comment(0," Write RegisterFile"); 61 vhdl->set_comment(0,"---------------------------------------------------------------------------"); 62 vhdl->set_body (0,""); 63 63 64 vhdl->set_body ("RegisterFile_write: process (in_CLOCK)");65 vhdl->set_body ("begin -- process RegisterFile_write");66 vhdl->set_body ("\tif in_CLOCK'event and in_CLOCK = '1' then");64 vhdl->set_body (0,"RegisterFile_write: process (in_CLOCK)"); 65 vhdl->set_body (0,"begin -- process RegisterFile_write"); 66 vhdl->set_body (1,"if in_CLOCK'event and in_CLOCK = '1' then"); 67 67 68 68 for (uint32_t i = 0; i < _param->_nb_port_write; i++) … … 74 74 str_address = "0"; 75 75 76 vhdl->set_body ("\t\tif (in_WRITE_"+toString(i)+"_VAL = '1') then");77 vhdl->set_body ("\t\t\treg_DATA("+str_address+") <= in_WRITE_"+toString(i)+"_DATA;");78 vhdl->set_body ("\t\tend if;");76 vhdl->set_body (2,"if (in_WRITE_"+toString(i)+"_VAL = '1') then"); 77 vhdl->set_body (3,"reg_DATA("+str_address+") <= in_WRITE_"+toString(i)+"_DATA;"); 78 vhdl->set_body (2,"end if;"); 79 79 } 80 80 for (uint32_t i = 0; i < _param->_nb_port_read_write; i++) … … 86 86 str_address = "0"; 87 87 88 vhdl->set_body ("\t\tif (in_READ_WRITE_"+toString(i)+"_VAL = '1' and in_READ_WRITE_"+toString(i)+"_RW = '"+toString(RW_WRITE)+"') then");89 vhdl->set_body ("\t\t\treg_DATA("+str_address+") <= in_READ_WRITE_"+toString(i)+"_WDATA;");90 vhdl->set_body ("\t\tend if;");88 vhdl->set_body (2,"if (in_READ_WRITE_"+toString(i)+"_VAL = '1' and in_READ_WRITE_"+toString(i)+"_RW = '"+toString(RW_WRITE)+"') then"); 89 vhdl->set_body (3,"reg_DATA("+str_address+") <= in_READ_WRITE_"+toString(i)+"_WDATA;"); 90 vhdl->set_body (2,"end if;"); 91 91 } 92 92 93 vhdl->set_body ("\tend if;");94 vhdl->set_body ("end process RegisterFile_write;");93 vhdl->set_body (1,"end if;"); 94 vhdl->set_body (0,"end process RegisterFile_write;"); 95 95 }; 96 96 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/src/RegisterFile_Monolithic_vhdl_declaration.cpp
r81 r94 18 18 void RegisterFile_Monolithic::vhdl_declaration (Vhdl * & vhdl) 19 19 { 20 vhdl->set_type ("Tregfile", "array (" + toString(_param->_nb_word-1) + " downto 0)of " + std_logic(_param->_size_word));20 vhdl->set_type ("Tregfile", "array " + std_logic_range(_param->_nb_word,true) + " of " + std_logic(_param->_size_word)); 21 21 22 22 vhdl->set_signal ("reg_DATA", "Tregfile"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Makefile.Selftest
r88 r94 41 41 declare -i all_ok=1; \ 42 42 for i in $(EXEC_LOG); do \ 43 $(GREP) -q "Timing" $$i; \ 44 declare -i test_timing=$$?; \ 43 45 $(GREP) -q "Test OK" $$i; \ 44 46 declare -i test_ok=$$?; \ 45 47 $(GREP) -q "Test KO" $$i; \ 46 48 declare -i test_ko=$$?; \ 47 $(GREP) -q "ERROR" $$i; \ 48 declare -i test_error=$$?; \ 49 if $(TEST) $$test_ko -eq 0 -o $$test_error -eq 0 -o $$test_ok -ne 0; \ 49 if $(TEST) $$test_ko -eq 0 -o $$test_ok -ne 0 -o $$test_timing -ne 0; \ 50 50 then all_ok=0; \ 51 51 fi; \ … … 168 168 export SYSTEMC=$(SYSTEMC_$(SIMULATOR)); $(EXEC_PREFIX) $(DIR_BIN)/$(EXEC).x $(EXEC_PARAMS) $* `$(CAT) $<` &> $@; \ 169 169 declare timing=`$(GREP) -h "Timing" $@`; \ 170 $(GREP) -q "Timing" $@; \ 171 declare -i test_timing=$$?; \ 170 172 $(GREP) -q "Test OK" $@; \ 171 173 declare -i test_ok=$$?; \ 172 174 $(GREP) -q "Test KO" $@; \ 173 175 declare -i test_ko=$$?; \ 174 $(GREP) -q "ERROR" $@; \ 175 declare -i test_error=$$?; \ 176 if $(TEST) $$test_ko -ne 0 -a $$test_error -ne 0 -a $$test_ok -eq 0; \ 176 if $(TEST) $$test_ko -ne 0 -a $$test_ok -eq 0 -a $$test_timing -eq 0; \ 177 177 then echo -e " $* ... OK\t$$timing";\ 178 178 else echo " $* ... KO"; \ … … 184 184 export SYSTEMC=$(SYSTEMC_$(SIMULATOR)); $(EXEC_PREFIX) $(DIR_BIN)/$(EXEC).x $(EXEC_PARAMS) $* `$(CAT) $<` &> $@; \ 185 185 declare timing=`$(GREP) -h "Timing" $@`; \ 186 $(GREP) -q "Timing" $@; \ 187 declare -i test_timing=$$?; \ 186 188 $(GREP) -q "Test OK" $@; \ 187 189 declare -i test_ok=$$?; \ 188 190 $(GREP) -q "Test KO" $@; \ 189 191 declare -i test_ko=$$?; \ 190 $(GREP) -q "ERROR" $@; \ 191 declare -i test_error=$$?; \ 192 if $(TEST) $$test_ko -ne 0 -a $$test_error -ne 0 -a $$test_ok -eq 0; \ 192 if $(TEST) $$test_ko -ne 0 -a $$test_ok -eq 0 -a $$test_timing -eq 0; \ 193 193 then $(ECHO) -e " $* ... OK\t$$timing";\ 194 194 else $(ECHO) " $* ... KO"; \ -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Version.h
r93 r94 10 10 #define MORPHEO_MAJOR_VERSION 0 11 11 #define MORPHEO_MINOR_VERSION 2 12 #define MORPHEO_REVISION "9 3"12 #define MORPHEO_REVISION "94" 13 13 #define MORPHEO_CODENAME "Castor" 14 14 15 #define MORPHEO_DATE_DAY "1 4"15 #define MORPHEO_DATE_DAY "15" 16 16 #define MORPHEO_DATE_MONTH "12" 17 17 #define MORPHEO_DATE_YEAR "2008" -
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Vhdl.h
r93 r94 23 23 namespace behavioural { 24 24 25 std::string std_logic (uint32_t size);26 std::string std_logic_conv (uint32_t size, std::string value);27 std::string std_logic_conv (uint32_t size, uint32_t value);28 std::string std_logic_range (uint32_t size, uint32_t max , uint32_t min);29 std::string std_logic_range (uint32_t max , uint32_t min);30 std::string std_logic_range (uint32_t size);31 std::string std_logic_others (uint32_t size, uint32_t cst);25 std::string std_logic (uint32_t size); 26 std::string std_logic_conv (uint32_t size, std::string value); 27 std::string std_logic_conv (uint32_t size, uint32_t value); 28 std::string std_logic_range (uint32_t size, uint32_t max , uint32_t min , bool force=false); 29 std::string std_logic_range ( uint32_t max , uint32_t min , bool force=false); 30 std::string std_logic_range (uint32_t size, bool force=false); 31 std::string std_logic_others (uint32_t size, bool cst); 32 32 33 33 class Vhdl … … 125 125 private : std::string get_body (uint32_t depth ); 126 126 public : void set_body (std::string text ); 127 128 public : void set_body (Vhdl * vhdl ); 129 127 public : void set_body (uint32_t depth , 128 std::string text ); 129 130 public : void set_body (uint32_t depth , 131 Vhdl * vhdl ); 130 132 public : void set_body_component (std::string name_instance , 131 133 std::string name_component , … … 136 138 std::string name_signal , 137 139 uint32_t size_signal ); 140 141 public : void set_comment (std::string text ); 142 public : void set_comment (uint32_t depth , 143 std::string text ); 138 144 139 145 private : std::string get_library_ieee (uint32_t depth ); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_get_component.cpp
r81 r94 7 7 8 8 #include "Behavioural/include/Component.h" 9 #include "Common/include/Tabulation.h" 9 10 10 11 namespace morpheo { … … 25 26 bool empty = _list_component->empty(); 26 27 27 std::string tab = std::string(depth,'\t'); 28 std::string tab=morpheo::tab(depth); 29 28 30 std::ostringstream text; 29 31 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_test_map.cpp
r88 r94 2 2 * $Id$ 3 3 * 4 * [ 4 * [ Description ] 5 5 * 6 6 */ 7 7 8 8 #include "Behavioural/include/Component.h" 9 #include "Common/include/Tabulation.h" 9 10 10 11 namespace morpheo { … … 23 24 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 24 25 25 std::string tab = std::string(depth,' ');26 std::string tab = morpheo::tab(depth); 26 27 std::string name = _entity->get_name(); 27 28 bool test_ok = true; … … 80 81 // log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 81 82 82 // std::string tab = std::string(depth,'\t');83 // std::string tab = tab(depth); 83 84 // std::string name = _entity->get_name(); 84 85 // bool test_ok = true; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Entity_test_map.cpp
r88 r94 7 7 8 8 #include "Behavioural/include/Entity.h" 9 #include "Common/include/Tabulation.h" 9 10 #include <iostream> 10 11 … … 18 19 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 20 20 std::string tab = std::string(depth,' '); 21 std::string tab=morpheo::tab(depth); 22 21 23 log_printf(INFO,Interface,FUNCTION,"%s* Entity \"%s\"",tab.c_str(),_name.c_str()); 22 24 … … 41 43 // log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 42 44 43 // std::string tab = std::string(depth,'\t');45 // std::string tab = tab(depth); 44 46 // log_printf(INFO,Behavioural,FUNCTION, "%s* Entity \"%s\"",tab.c_str(),_name.c_str()); 45 47 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_fifo_testbench_assert.cpp
r88 r94 39 39 ++i; 40 40 } 41 42 vhdl->set_body("");43 41 } 44 42 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_get_signal.cpp
r81 r94 7 7 8 8 #include "Behavioural/include/Interface.h" 9 9 #include "Common/include/Tabulation.h" 10 10 11 11 namespace morpheo { … … 24 24 bool empty = _list_signal->empty(); 25 25 26 std::string tab = std::string(depth,'\t');26 std::string tab = morpheo::tab(depth); 27 27 std::ostringstream text; 28 28 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interface_test_map.cpp
r88 r94 7 7 8 8 #include "Behavioural/include/Interface.h" 9 9 #include "Common/include/Tabulation.h" 10 10 11 11 namespace morpheo { … … 18 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 19 20 std::string tab = std::string(depth,' ');20 std::string tab = morpheo::tab(depth); 21 21 bool _return = true; 22 22 … … 39 39 // log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 40 40 41 // std::string tab = std::string(depth,'\t');41 // std::string tab = tab(depth); 42 42 // bool _return = true; 43 43 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_get_interface.cpp
r81 r94 7 7 8 8 #include "Behavioural/include/Interfaces.h" 9 9 #include "Common/include/Tabulation.h" 10 10 11 11 namespace morpheo { … … 25 25 bool empty = _list_interface->empty(); 26 26 27 std::string tab = std::string(depth,'\t');27 std::string tab = morpheo::tab(depth); 28 28 std::ostringstream text; 29 29 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_test_map.cpp
r88 r94 7 7 8 8 #include "Behavioural/include/Interfaces.h" 9 9 #include "Common/include/Tabulation.h" 10 10 11 11 namespace morpheo { … … 18 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 19 19 20 std::string tab = std::string(depth,' ');20 std::string tab = morpheo::tab(depth); 21 21 22 22 bool _return = true; … … 40 40 // log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 41 41 42 // std::string tab = std::string(depth,'\t');42 // std::string tab = tab(depth); 43 43 44 44 // bool _return = true; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Interfaces_testbench_generate_file.cpp
r88 r94 99 99 (*it)->testbench_assert (vhdl_assert,counter); 100 100 101 vhdl->set_body( vhdl_assert);101 vhdl->set_body(3,vhdl_assert); 102 102 103 103 delete vhdl_assert; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_test_map.cpp
r88 r94 7 7 8 8 #include "Behavioural/include/Signal.h" 9 9 #include "Common/include/Tabulation.h" 10 10 11 11 namespace morpheo { … … 19 19 20 20 std::string str = ""; 21 std::string tab = std::string(depth,' ');21 std::string tab = morpheo::tab(depth); 22 22 bool _return = true; 23 23 … … 166 166 167 167 // std::string str = ""; 168 // std::string tab = std::string(depth,'\t');168 // std::string tab = tab(depth); 169 169 // bool _return = true; 170 170 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_binary_tree_valid.cpp
r88 r94 29 29 } 30 30 31 void Stat_binary_tree::print (uint32_t depth)32 {33 std::string tab = std::string(depth,'\t');34 std::string sep = " ";35 if (_data_type == NONE)36 {37 std::cout << tab << "<node> NONE (error)" << std::endl;38 39 if (_left != NULL)40 _left ->print(depth+1);41 if (_right != NULL)42 _right->print(depth+1);43 }44 45 if ((_data_type == VARIABLE) or46 (_data_type == CONSTANT))47 {48 std::cout << tab << "<leaf>"49 << " "50 << ((_left == NULL)?"left == NULL ":"left != NULL (error)")51 << " "52 << ((_right == NULL)?"right == NULL ":"right != NULL (error)")53 << std::endl;54 55 if (_left != NULL)56 _left ->print(depth+1);57 if (_right != NULL)58 _right->print(depth+1);59 }60 61 if (_data_type == OPERATOR_UNARY)62 {63 std::cout << tab << "<unary>"64 << " "65 << ((_left == NULL)?"left == NULL (error)":"left != NULL ")66 << " "67 << ((_right == NULL)?"right == NULL ":"right != NULL (error)")68 << std::endl;69 70 if (_left != NULL)71 _left ->print(depth+1);72 if (_right != NULL)73 _right->print(depth+1);74 }75 76 if (_data_type == OPERATOR_BINARY)77 {78 std::cout << tab << "<binary>"79 << " "80 << ((_left == NULL)?"left == NULL (error)":"left != NULL ")81 << " "82 << ((_right == NULL)?"right == NULL (error)":"right != NULL ")83 << std::endl;84 85 if (_left != NULL)86 _left ->print(depth+1);87 if (_right != NULL)88 _right->print(depth+1);89 }90 }91 92 31 }; 93 32 }; -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_architecture.cpp
r81 r94 4 4 * $Id$ 5 5 * 6 * [ 6 * [ Description ] 7 7 * 8 8 */ 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 #include "Common/include/Tabulation.h" 11 12 12 13 #include <sstream> … … 23 24 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 24 25 25 std::string tab = std::string(depth,'\t');26 std::string tab = morpheo::tab(depth); 26 27 std::ostringstream text; 27 28 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_component.cpp
r81 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 #include "Common/include/Tabulation.h" 11 12 12 13 #include <sstream> … … 22 23 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 23 24 24 std::string tab = std::string(depth,'\t');25 std::string tab = morpheo::tab(depth); 25 26 std::ostringstream text; 26 27 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_entity.cpp
r81 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 #include "Common/include/Tabulation.h" 11 12 12 13 #include <sstream> … … 22 23 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 23 24 24 std::string tab = std::string(depth,'\t');25 std::string tab = morpheo::tab(depth); 25 26 std::ostringstream text; 26 27 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_header.cpp
r88 r94 23 23 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 24 24 25 std::string tab = std::string(depth,'\t');26 25 std::string text; 27 26 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_library_ieee.cpp
r81 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 #include "Common/include/Tabulation.h" 11 12 12 13 #include <sstream> … … 21 22 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 22 23 23 std::string tab = std::string(depth,'\t');24 std::string tab = morpheo::tab(depth); 24 25 std::ostringstream text; 25 26 26 text << tab << std::endl27 << tab << "library ieee;" << std::endl28 << tab << " use ieee.numeric_bit.all;"<< std::endl29 << tab << " use ieee.numeric_std.all;"<< std::endl30 << tab << " use ieee.std_logic_1164.all;"<< std::endl31 << tab << " use ieee.std_logic_arith.all;"<< std::endl32 << tab << " use ieee.std_logic_misc.all;"<< std::endl33 << tab << "--use ieee.std_logic_signed.all; " << std::endl34 << tab << " use ieee.std_logic_unsigned.all;" << std::endl35 << tab << "--use ieee.std_logic_textio.all; " << std::endl;27 text << tab << std::endl 28 << tab << "library ieee;" << std::endl 29 << tab << " use ieee.numeric_bit.all; " << std::endl 30 << tab << " use ieee.numeric_std.all; " << std::endl 31 << tab << " use ieee.std_logic_1164.all; " << std::endl 32 << tab << " use ieee.std_logic_arith.all; " << std::endl 33 << tab << " use ieee.std_logic_misc.all; " << std::endl 34 << tab << "--use ieee.std_logic_signed.all; " << std::endl 35 << tab << " use ieee.std_logic_unsigned.all;" << std::endl 36 << tab << "--use ieee.std_logic_textio.all; " << std::endl; 36 37 37 38 log_printf(FUNC,Behavioural,FUNCTION,"End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_library_work.cpp
r81 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 11 #include "Common/include/Tabulation.h" 12 12 #include <sstream> 13 13 … … 22 22 23 23 std::list<std::string>::iterator i = _list_library_work.begin(); 24 std::string tab = std::string(depth,'\t');24 std::string tab = morpheo::tab(depth); 25 25 std::ostringstream text; 26 26 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_model.cpp
r81 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 11 #include "Common/include/Tabulation.h" 12 12 #include <sstream> 13 13 … … 22 22 log_printf(FUNC,Behavioural,"get_model","Begin"); 23 23 24 std::string tab = std::string(depth,'\t');24 std::string tab = morpheo::tab(depth); 25 25 std::ostringstream text; 26 26 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_get_package.cpp
r81 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 11 #include "Common/include/Tabulation.h" 12 12 #include <sstream> 13 13 … … 24 24 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 25 25 26 std::string tab = std::string(depth,'\t');26 std::string tab = morpheo::tab(depth); 27 27 std::ostringstream text; 28 28 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_set_body.cpp
r88 r94 9 9 10 10 #include "Behavioural/include/Vhdl.h" 11 11 #include "Common/include/Tabulation.h" 12 12 #include <sstream> 13 13 … … 20 20 { 21 21 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 22 set_list(_list_body, text); 22 set_body(0, text); 23 log_printf(FUNC,Behavioural,FUNCTION,"End"); 24 }; 25 26 #undef FUNCTION 27 #define FUNCTION "Vhdl::set_body" 28 void Vhdl::set_body (uint32_t depth, 29 std::string text) 30 { 31 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 32 set_list(_list_body, morpheo::tab(depth)+text); 23 33 log_printf(FUNC,Behavioural,FUNCTION,"End"); 24 34 }; … … 26 36 #undef FUNCTION 27 37 #define FUNCTION "Vhdl::set_body" 28 void Vhdl::set_body (Vhdl * vhdl) 38 void Vhdl::set_body (uint32_t depth, 39 Vhdl * vhdl) 29 40 { 30 41 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 31 42 43 std::string tab=morpheo::tab(depth); 44 32 45 for (std::list<std::string>::iterator it=vhdl->_list_body.begin(); 33 46 it!=vhdl->_list_body.end(); 34 47 ++it) 35 set_list(_list_body, 48 set_list(_list_body,tab+*it); 36 49 37 50 log_printf(FUNC,Behavioural,FUNCTION,"End"); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Vhdl_std_logic.cpp
r81 r94 61 61 #undef FUNCTION 62 62 #define FUNCTION "Vhdl::std_logic_range" 63 std::string std_logic_range (uint32_t size, uint32_t max, uint32_t min )63 std::string std_logic_range (uint32_t size, uint32_t max, uint32_t min, bool force) 64 64 { 65 65 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 66 66 std::string type; 67 67 68 if (size < 2) 69 type = ""; 68 if (force) 69 { 70 type = "("+toString(max)+" downto "+toString(min)+")"; 71 } 70 72 else 71 if (max == min) 72 type = "("+toString(max)+")"; 73 else 74 type = "("+toString(max)+" downto "+toString(min)+")"; 73 { 74 if (max == min) 75 { 76 type = "("+toString(max)+")"; 77 } 78 else 79 { 80 if (size < 2) 81 type = ""; 82 else 83 type = "("+toString(max)+" downto "+toString(min)+")"; 84 } 85 } 75 86 76 87 log_printf(FUNC,Behavioural,FUNCTION,"End"); … … 79 90 }; 80 91 81 std::string std_logic_range (uint32_t max, uint32_t min )92 std::string std_logic_range (uint32_t max, uint32_t min, bool force) 82 93 { 83 94 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 84 95 std::string type; 85 96 86 if (max == 0) 87 type = ""; 97 if (force) 98 { 99 type = "("+toString(max)+" downto "+toString(min)+")"; 100 } 88 101 else 89 if (max == min) 90 type = "("+toString(max)+")"; 91 else 92 type = "("+toString(max)+" downto "+toString(min)+")"; 102 { 103 if (max == min) 104 { 105 type = "("+toString(max)+")"; 106 } 107 else 108 { 109 if (max == 0) 110 type = ""; 111 else 112 type = "("+toString(max)+" downto "+toString(min)+")"; 113 } 114 } 93 115 94 116 log_printf(FUNC,Behavioural,FUNCTION,"End"); … … 97 119 }; 98 120 99 std::string std_logic_range (uint32_t size )121 std::string std_logic_range (uint32_t size, bool force) 100 122 { 101 123 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 102 std::string _return = std_logic_range(size-1,0 );124 std::string _return = std_logic_range(size-1,0,force); 103 125 log_printf(FUNC,Behavioural,FUNCTION,"End"); 104 126 … … 108 130 #undef FUNCTION 109 131 #define FUNCTION "Vhdl::std_logic_others" 110 std::string std_logic_others (uint32_t size, uint32_tcst )132 std::string std_logic_others (uint32_t size, bool cst ) 111 133 { 112 134 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); … … 124 146 } 125 147 126 127 128 148 }; // end namespace behavioural 129 149 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_get_body.cpp
r88 r94 7 7 8 8 #include "Behavioural/include/XML.h" 9 #include "Common/include/Tabulation.h" 9 10 10 11 namespace morpheo { -
trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_indent.cpp
r81 r94 7 7 8 8 #include "Behavioural/include/XML.h" 9 #include "Common/include/Tabulation.h" 9 10 10 11 namespace morpheo { … … 16 17 { 17 18 log_printf(FUNC,Behavioural,FUNCTION,"Begin"); 18 std::string _return = std::string(depth,'\t');19 std::string _return = tab(depth); 19 20 log_printf(FUNC,Behavioural,FUNCTION,"End"); 20 21 -
trunk/IPs/systemC/processor/Morpheo/Documentation/doc/document-morpheo-vhdl_generation/tex/document-morpheo-vhdl_generation-fr.tex
r93 r94 9 9 \begin{itemize} 10 10 \item Dans la section \ref{tree}, nous présentons l'arborescence des répertoires. 11 \item Dans la section \ref{files}, nous détailerons les fichiers ainsi que leurs contenus.12 11 \item Dans la section \ref{vhdl_declaration}, nous expliciterons l'API ({\it Application Programming Interface}) pour la déclaration des signaux et des types du VHDL. 13 12 \item Dans la section \ref{vhdl_body}, nous présenterons l'API pour générer le comportement des composants. 14 13 \item Dans la section \ref{vhdl_structural}, nous expliquerons la manière de créer des sous composants. 14 \item Dans la section \ref{example}, nous montrerons quelques exemples. 15 15 \end{itemize} 16 16 … … 19 19 Dans le répertoire contenant le projet, nous avons les répertoires suivant : 20 20 \begin{description} 21 \item[IPs/systemC/processor/Morpheo/Documentation/ :] Contient différent document décrivant certain point du projet, dont ce présent document. 22 \item[IPs/systemC/processor/Morpheo/Behavioural/ :] 21 \item[IPs/systemC/processor/Morpheo/Documentation/ :] Contient différent document décrivant certain point du projet, dont cette documentation. 22 \item[IPs/systemC/processor/Morpheo/Behavioural/ :] 23 \item[IPs/systemC/processor/Morpheo/Behavioural/include/ :] 24 \begin{description} 25 \item [Parameters.h :] Contient la classe {\it Parameters}, cette classe définit les paramètres constants. 26 \item [Vhdl.h :] Contient la classe {\it Vhdl}. 27 \end{description} 28 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component :] Chaque composant est inclue dans un répertoire spécifique. 29 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component/include :] 30 \begin{description} 31 \item [Parameters.h :] Contient la classe {\it Parameters}, elle dérive de la classe contenu dans le fichier le répertoire {\it \dots/Behavioural/include/}. 32 \item [Component.h :] Contient la classe {\it Component}. Il définit l'interface, les registres ainsi que les méthodes du modèle systemC. 33 \item [Types.h :] Contient les types spéciaux. 34 \end{description} 35 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component/src :] 36 \begin{description} 37 \item [Component\_transition.cpp :] 38 \item [Component\_genMoore.cpp :] 39 \item [Component\_genMealy\_XXX.cpp :] 40 41 \item [Component\_vhdl\_declaration.cpp :] 42 \item [Component\_vhdl\_body.cpp :] 43 \end{description} 44 \item[IPs/systemC/processor/Morpheo/Behavioural/\dots/Component/Selftest :] 23 45 \end{description} 24 46 25 \Section{Fichiers}\label{files}26 27 47 \Section{VHDL : déclaration}\label{vhdl_declaration} 28 48 29 Les déclarations ce font dans le fichier {\it COMPONENT\_vhdl\_declaration.cpp}. 49 Les déclarations ce font dans le fichier {\it Component\_vhdl\_declaration.cpp}. 50 51 \subSection{Interfaces} 52 L'interface est définit dans le modèle SystemC. Il n'ont pas nécessaire de la redéfinir pour le modèle VHDL. 53 54 La nomenclature est la suivante : 55 \begin{itemize} 56 \item La direction en minuscule ({\it in}, {\it out}). 57 \item Le nom de l'interface en majuscule ({\it READ}, {\it PUSH}, \dots). 58 \item Le numéro de l'interface (la première interface aura le numéro 0. S'il n'y a qu'une interface, celle ci aura tout de même le numéro 0). 59 \item Le nom du signal en majuscule ({\it VAL}, {\it ADDRESS}, \dots). 60 \end{itemize} 61 62 Par exemple pour la 2 ème interface de lecture d'un banc de registre : 63 \begin{verbatim} 64 in_READ_1_VAL : in std_logic; 65 out_READ_1_ACK : out std_logic; 66 in_READ_1_ADDRESS : in std_logic_vector(8 downto 0); 67 out_READ_1_DATA : out std_logic_vector(31 downto 0); 68 \end{verbatim} 69 70 Chaque composent (aussi bien combinatoire que séquentielle) possède un signal d'horloge et un signal de reset. (Ce dernier est actif à l'état bas). Ils ont tout les deux le même nom quelque soit le composant. 71 \begin{verbatim} 72 in_CLOCK : in std_logic; 73 in_NRESET : in std_logic; 74 \end{verbatim} 30 75 31 76 \subSection{Types} … … 41 86 std::string std_logic_range (uint32_t size, 42 87 uint32_t max , 43 uint32_t min ); 88 uint32_t min , 89 bool force=false); 44 90 std::string std_logic_range (uint32_t max , 45 uint32_t min ); 46 std::string std_logic_range (uint32_t size); 47 \end{verbatim} 48 49 La première fonction fais un test sur la taille que la seconde ne fait pas. L'argument de la troisième définit la taille ce qui implique que la borne minimum est 0. 50 51 \begin{verbatim} 52 std::string std_logic_others (uint32_t size, 53 uint32_t cst ); 54 \end{verbatim} 55 91 uint32_t min , 92 bool force=false); 93 std::string std_logic_range (uint32_t size, 94 bool force=false); 95 \end{verbatim} 96 97 La première fonction fais un test sur la taille que la seconde ne fait pas. 98 L'argument de la troisième définit la taille (ce qui implique que la borne minimum est 0 et la borne maximum est size-1). 99 Toute les surcharges ont le bolléen optionnel {\it force}. S'il est à faux, alors des tests seront effectués sur les bornes et la taille, sinon aucun test n'est effectué. 100 101 Par exemple : 102 \begin{verbatim} 103 std_logic_range(4,false) renvoie "(3 downto 0)". 104 std_logic_range(1,false) renvoie "(0)". 105 std_logic_range(1,true ) renvoie "(0 downto 0)". 106 \end{verbatim} 56 107 57 108 Pour les types plus complexe, la classe {\it Vhdl} possède une méthode générique. Le premier argument est le nom du type le second est le type. … … 89 140 \end{verbatim} 90 141 142 Dans le cas de signaux de type {\it std\_logic}, au lieu de déclarer des constantes, il existe deux fonctions permettant d'utiliser des constantes directement dans le corps du composant. 143 La première est {\it std\_logic\_others}. Elle permet de définir des constantes dont soit les bits sont à pleins un soit à plein zéro. 144 145 \begin{verbatim} 146 std::string std_logic_others (uint32_t size, 147 bool cst ); 148 \end{verbatim} 149 150 Pour toute les autres constantes, la méthode {\it std\_logic\_conv} transforme un entier en {\it std\_logic\_vector}. 151 152 \begin{verbatim} 153 std::string std_logic_conv (uint32_t size, 154 std::string value); 155 std::string std_logic_conv (uint32_t size, 156 uint32_t value); 157 \end{verbatim} 158 159 91 160 \subSection{Signaux internes} 92 161 … … 113 182 \end{verbatim} 114 183 115 116 117 %\begin{verbatim}118 %void set_alias (std::string name1 ,119 %std::string type1 ,120 %std::string name2 ,121 %std::string range2);122 %void set_alias (std::string name1 ,123 %uint32_t size1 ,124 %std::string name2 ,125 %std::string range2);126 %\end{verbatim}184 En vhdl il est possible de renommer une champ d'un signal. Ceci ce fait à l'aide de la fonction {\it set\_alias}. Elle prend 4 arguments. Le premier étant le nom du signal après le renommage. le second est soit le type, soit la taille du {\it std\_logic\_vector} du signal rénommé. Les deux derniers conserné le signal à renommé : le nom de ce dernier ainsi que l'intervalle. Pour le dernier paramètre il est recommandé d'utilisé la fonction {\it std\_logic\_range}. 185 186 \begin{verbatim} 187 void set_alias (std::string name1 , 188 std::string type1 , 189 std::string name2 , 190 std::string range2); 191 void set_alias (std::string name1 , 192 uint32_t size1 , 193 std::string name2 , 194 std::string range2); 195 \end{verbatim} 127 196 128 197 129 198 \Section{VHDL : comportement}\label{vhdl_body} 130 199 200 Le comportement du composant est définit dans le fichier {\it Component\_vhdl\_body.cpp}. 201 202 Il n'y a pas de fonction aidant à l'écriture du Vhdl. 203 La méthode {\it set\_body} permet de définir une ligne de code VHDL. Un retour à la ligne est automatiquement inséré. Le premier argument est pour l'indentation. 204 \begin{verbatim} 205 void set_body (uint32_t depth, 206 std::string text ); 207 void set_body (std::string text ); 208 \end{verbatim} 209 210 Pour les commentaires, il y a la fonction {\it set\_comment}. 211 \begin{verbatim} 212 void set_comment (uint32_t depth, 213 std::string text ); 214 void set_comment (std::string text ); 215 \end{verbatim} 216 217 218 131 219 \Section{VHDL : structurelle}\label{vhdl_structural} 220 221 \Section{Exemples}\label{example} 222 223 \subSection{Banc de Registres Monolithique} 224 225 \subsubSection{Fichier RegisterFile\_Monolithic\_vhdl\_declaration.cpp} 226 \begin{verbatim} 227 void RegisterFile_Monolithic::vhdl_declaration (Vhdl * & vhdl) 228 { 229 vhdl->set_type ("Tregfile", "array " + std_logic_range(_param->_nb_word,true)+ 230 " of "+ 231 std_logic(_param->_size_word)); 232 233 vhdl->set_signal ("reg_DATA", "Tregfile"); 234 }; 235 \end{verbatim} 236 \subsubSection{Fichier RegisterFile\_Monolithic\_vhdl\_body.cpp} 237 \begin{verbatim} 238 void RegisterFile_Monolithic::vhdl_body (Vhdl * & vhdl) 239 { 240 vhdl->set_body (0,""); 241 vhdl->set_comment(0,"---------------------------------------------------"); 242 vhdl->set_comment(0," Ackitement"); 243 vhdl->set_comment(0,"---------------------------------------------------"); 244 vhdl->set_body (0,""); 245 246 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 247 vhdl->set_body (0,"out_READ_"+toString(i)+"_ACK <= '1';"); 248 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 249 vhdl->set_body (0,"out_WRITE_"+toString(i)+"_ACK <= '1';"); 250 251 vhdl->set_body (0,""); 252 vhdl->set_comment(0,"---------------------------------------------------"); 253 vhdl->set_comment(0," Read RegisterFile"); 254 vhdl->set_comment(0,"---------------------------------------------------"); 255 vhdl->set_body (0,""); 256 257 for (uint32_t i = 0; i < _param->_nb_port_read; i++) 258 { 259 std::string str_address; 260 if (_param->_have_port_address) 261 str_address = "conv_integer(in_READ_"+toString(i)+"_ADDRESS)"; 262 else 263 str_address = "0"; 264 265 vhdl->set_body (0,"out_READ_"+toString(i)+"_DATA <= reg_DATA ("+str_address+ 266 ") when in_READ_"+toString(i)+"_VAL = '1' else "+ 267 std_logic_others(_param->_size_word,0)+";"); 268 } 269 270 vhdl->set_body (0,""); 271 vhdl->set_comment(0,"---------------------------------------------------"); 272 vhdl->set_comment(0," Write RegisterFile"); 273 vhdl->set_comment(0,"---------------------------------------------------"); 274 vhdl->set_body (0,""); 275 276 vhdl->set_body (0,"RegisterFile_write: process (in_CLOCK)"); 277 vhdl->set_body (0,"begin -- process RegisterFile_write"); 278 vhdl->set_body (1,"if in_CLOCK'event and in_CLOCK = '1' then"); 279 280 for (uint32_t i = 0; i < _param->_nb_port_write; i++) 281 { 282 std::string str_address; 283 if (_param->_have_port_address) 284 str_address = "conv_integer(in_WRITE_"+toString(i)+"_ADDRESS)"; 285 else 286 str_address = "0"; 287 288 vhdl->set_body (2,"if (in_WRITE_"+toString(i)+"_VAL = '1') then"); 289 vhdl->set_body (3,"reg_DATA("+str_address+") <= in_WRITE_"+toString(i)+"_DATA;"); 290 vhdl->set_body (2,"end if;"); 291 } 292 293 vhdl->set_body (1,"end if;"); 294 vhdl->set_body (0,"end process RegisterFile_write;"); 295 }; 296 \end{verbatim} 297 298 \subsubSection{Fichier RegisterFile\_Monolithic.vhdl} 299 \begin{verbatim} 300 library ieee; 301 use ieee.numeric_bit.all; 302 use ieee.numeric_std.all; 303 use ieee.std_logic_1164.all; 304 use ieee.std_logic_arith.all; 305 use ieee.std_logic_misc.all; 306 --use ieee.std_logic_signed.all; 307 use ieee.std_logic_unsigned.all; 308 --use ieee.std_logic_textio.all; 309 310 311 library work; 312 use work.RegisterFile_Monolithic_Pack.all; 313 314 315 entity RegisterFile_Monolithic is 316 port ( in_CLOCK : in std_logic; 317 in_NRESET : in std_logic; 318 in_READ_0_VAL : in std_logic; 319 out_READ_0_ACK : out std_logic; 320 in_READ_0_ADDRESS : in std_logic_vector(8 downto 0); 321 out_READ_0_DATA : out std_logic_vector(31 downto 0); 322 in_WRITE_0_VAL : in std_logic; 323 out_WRITE_0_ACK : out std_logic; 324 in_WRITE_0_ADDRESS: in std_logic_vector(8 downto 0); 325 in_WRITE_0_DATA : in std_logic_vector(31 downto 0) 326 ); 327 end RegisterFile_Monolithic; 328 329 architecture behavioural of RegisterFile_Monolithic is 330 type Tregfile is array (511 downto 0) of std_logic_vector(31 downto 0); 331 332 signal reg_DATA : Tregfile; 333 334 begin 335 ----------------------------------------------------- 336 -- Ackitement 337 ----------------------------------------------------- 338 339 out_READ_0_ACK <= '1'; 340 out_WRITE_0_ACK <= '1'; 341 342 ----------------------------------------------------- 343 -- Read RegisterFile 344 ----------------------------------------------------- 345 346 out_READ_0_DATA <= reg_DATA (conv_integer(in_READ_0_ADDRESS)) 347 when in_READ_0_VAL = '1' 348 else (others => '0'); 349 350 ----------------------------------------------------- 351 -- Write RegisterFile 352 ----------------------------------------------------- 353 354 RegisterFile_write: process (in_CLOCK) 355 begin -- process RegisterFile_write 356 if in_CLOCK'event and in_CLOCK = '1' then 357 if (in_WRITE_0_VAL = '1') then 358 reg_DATA(conv_integer(in_WRITE_0_ADDRESS)) <= in_WRITE_0_DATA; 359 end if; 360 end if; 361 end process RegisterFile_write; 362 end behavioural; 363 364 \end{verbatim}
Note: See TracChangeset
for help on using the changeset viewer.