Changeset 284 for trunk/modules/vci_mem_cache_v4/caba/source/src
- Timestamp:
- Dec 11, 2012, 6:19:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp
r283 r284 27 27 * Maintainers: alain eric.guthmuller@polytechnique.edu 28 28 * cesar.fuguet-tortolero@lip6.fr 29 * alexandre.joannou@lip6.fr 29 30 */ 30 31 … … 41 42 #define DEBUG_MEMC_READ 1 // detailed trace of READ FSM 42 43 #define DEBUG_MEMC_WRITE 1 // detailed trace of WRITE FSM 43 #define DEBUG_MEMC_ SC 1 // detailed trace of SCFSM44 #define DEBUG_MEMC_CAS 1 // detailed trace of CAS FSM 44 45 #define DEBUG_MEMC_IXR_CMD 1 // detailed trace of IXR_RSP FSM 45 46 #define DEBUG_MEMC_IXR_RSP 1 // detailed trace of IXR_RSP FSM … … 51 52 #define DEBUG_MEMC_CLEANUP 1 // detailed trace of CLEANUP FSM 52 53 53 #define RANDOMIZE_ SC154 #define RANDOMIZE_CAS 1 54 55 55 56 namespace soclib { namespace caba { … … 59 60 "TGT_CMD_READ", 60 61 "TGT_CMD_WRITE", 61 "TGT_CMD_ ATOMIC"62 "TGT_CMD_CAS" 62 63 }; 63 64 const char *tgt_rsp_fsm_str[] = { 64 65 "TGT_RSP_READ_IDLE", 65 66 "TGT_RSP_WRITE_IDLE", 66 "TGT_RSP_ SC_IDLE",67 "TGT_RSP_CAS_IDLE", 67 68 "TGT_RSP_XRAM_IDLE", 68 69 "TGT_RSP_INIT_IDLE", … … 70 71 "TGT_RSP_READ", 71 72 "TGT_RSP_WRITE", 72 "TGT_RSP_ SC",73 "TGT_RSP_CAS", 73 74 "TGT_RSP_XRAM", 74 75 "TGT_RSP_INIT", … … 84 85 "INIT_CMD_UPDT_INDEX", 85 86 "INIT_CMD_UPDT_DATA", 86 "INIT_CMD_ SC_UPDT_IDLE",87 "INIT_CMD_ SC_BRDCAST",88 "INIT_CMD_ SC_UPDT_NLINE",89 "INIT_CMD_ SC_UPDT_INDEX",90 "INIT_CMD_ SC_UPDT_DATA",91 "INIT_CMD_ SC_UPDT_DATA_HIGH"87 "INIT_CMD_CAS_UPDT_IDLE", 88 "INIT_CMD_CAS_BRDCAST", 89 "INIT_CMD_CAS_UPDT_NLINE", 90 "INIT_CMD_CAS_UPDT_INDEX", 91 "INIT_CMD_CAS_UPDT_DATA", 92 "INIT_CMD_CAS_UPDT_DATA_HIGH" 92 93 }; 93 94 const char *init_rsp_fsm_str[] = { … … 162 163 "IXR_CMD_READ_IDLE", 163 164 "IXR_CMD_WRITE_IDLE", 164 "IXR_CMD_ SC_IDLE",165 "IXR_CMD_CAS_IDLE", 165 166 "IXR_CMD_XRAM_IDLE", 166 167 "IXR_CMD_READ_NLINE", 167 168 "IXR_CMD_WRITE_NLINE", 168 "IXR_CMD_ SC_NLINE",169 "IXR_CMD_CAS_NLINE", 169 170 "IXR_CMD_XRAM_DATA" 170 171 }; 171 const char * sc_fsm_str[] = {172 " SC_IDLE",173 " SC_DIR_REQ",174 " SC_DIR_LOCK",175 " SC_DIR_HIT_READ",176 " SC_DIR_HIT_WRITE",177 " SC_UPT_LOCK",178 " SC_UPT_HEAP_LOCK",179 " SC_UPT_REQ",180 " SC_UPT_NEXT",181 " SC_BC_TRT_LOCK",182 " SC_BC_UPT_LOCK",183 " SC_BC_DIR_INVAL",184 " SC_BC_CC_SEND",185 " SC_BC_XRAM_REQ",186 " SC_RSP_FAIL",187 " SC_RSP_SUCCESS",188 " SC_MISS_TRT_LOCK",189 " SC_MISS_TRT_SET",190 " SC_MISS_XRAM_REQ",191 " SC_WAIT"172 const char *cas_fsm_str[] = { 173 "CAS_IDLE", 174 "CAS_DIR_REQ", 175 "CAS_DIR_LOCK", 176 "CAS_DIR_HIT_READ", 177 "CAS_DIR_HIT_WRITE", 178 "CAS_UPT_LOCK", 179 "CAS_UPT_HEAP_LOCK", 180 "CAS_UPT_REQ", 181 "CAS_UPT_NEXT", 182 "CAS_BC_TRT_LOCK", 183 "CAS_BC_UPT_LOCK", 184 "CAS_BC_DIR_INVAL", 185 "CAS_BC_CC_SEND", 186 "CAS_BC_XRAM_REQ", 187 "CAS_RSP_FAIL", 188 "CAS_RSP_SUCCESS", 189 "CAS_MISS_TRT_LOCK", 190 "CAS_MISS_TRT_SET", 191 "CAS_MISS_XRAM_REQ", 192 "CAS_WAIT" 192 193 }; 193 194 const char *cleanup_fsm_str[] = { … … 210 211 "ALLOC_DIR_READ", 211 212 "ALLOC_DIR_WRITE", 212 "ALLOC_DIR_ SC",213 "ALLOC_DIR_CAS", 213 214 "ALLOC_DIR_CLEANUP", 214 215 "ALLOC_DIR_XRAM_RSP" … … 217 218 "ALLOC_TRT_READ", 218 219 "ALLOC_TRT_WRITE", 219 "ALLOC_TRT_ SC",220 "ALLOC_TRT_CAS", 220 221 "ALLOC_TRT_XRAM_RSP", 221 222 "ALLOC_TRT_IXR_RSP" … … 226 227 "ALLOC_UPT_INIT_RSP", 227 228 "ALLOC_UPT_CLEANUP", 228 "ALLOC_UPT_ SC"229 "ALLOC_UPT_CAS" 229 230 }; 230 231 const char *alloc_heap_fsm_str[] = { … … 232 233 "ALLOC_HEAP_READ", 233 234 "ALLOC_HEAP_WRITE", 234 "ALLOC_HEAP_ SC",235 "ALLOC_HEAP_CAS", 235 236 "ALLOC_HEAP_CLEANUP", 236 237 "ALLOC_HEAP_XRAM_RSP" … … 314 315 m_cmd_write_be_fifo("m_cmd_write_be_fifo",8), 315 316 316 m_cmd_ sc_addr_fifo("m_cmd_sc_addr_fifo",4),317 m_cmd_ sc_eop_fifo("m_cmd_sc_eop_fifo",4),318 m_cmd_ sc_srcid_fifo("m_cmd_sc_srcid_fifo",4),319 m_cmd_ sc_trdid_fifo("m_cmd_sc_trdid_fifo",4),320 m_cmd_ sc_pktid_fifo("m_cmd_sc_pktid_fifo",4),321 m_cmd_ sc_wdata_fifo("m_cmd_sc_wdata_fifo",4),317 m_cmd_cas_addr_fifo("m_cmd_cas_addr_fifo",4), 318 m_cmd_cas_eop_fifo("m_cmd_cas_eop_fifo",4), 319 m_cmd_cas_srcid_fifo("m_cmd_cas_srcid_fifo",4), 320 m_cmd_cas_trdid_fifo("m_cmd_cas_trdid_fifo",4), 321 m_cmd_cas_pktid_fifo("m_cmd_cas_pktid_fifo",4), 322 m_cmd_cas_wdata_fifo("m_cmd_cas_wdata_fifo",4), 322 323 323 324 r_tgt_cmd_fsm("r_tgt_cmd_fsm"), … … 339 340 r_cleanup_fsm("r_cleanup_fsm"), 340 341 341 r_ sc_fsm("r_sc_fsm"),342 343 m_ sc_to_init_cmd_inst_fifo("m_sc_to_init_cmd_inst_fifo",8),344 m_ sc_to_init_cmd_srcid_fifo("m_sc_to_init_cmd_srcid_fifo",8),342 r_cas_fsm("r_cas_fsm"), 343 344 m_cas_to_init_cmd_inst_fifo("m_cas_to_init_cmd_inst_fifo",8), 345 m_cas_to_init_cmd_srcid_fifo("m_cas_to_init_cmd_srcid_fifo",8), 345 346 #if L1_MULTI_CACHE 346 m_ sc_to_init_cmd_cache_id_fifo("m_sc_to_init_cmd_cache_id_fifo",8),347 m_cas_to_init_cmd_cache_id_fifo("m_cas_to_init_cmd_cache_id_fifo",8), 347 348 #endif 348 349 … … 443 444 r_write_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 444 445 445 // Allocation for SCFSM446 r_ sc_to_ixr_cmd_data = new sc_signal<data_t>[nwords];447 r_ sc_rdata = new sc_signal<data_t>[2];446 // Allocation for CAS FSM 447 r_cas_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 448 r_cas_rdata = new sc_signal<data_t>[2]; 448 449 449 450 … … 515 516 << " | " << read_fsm_str[r_read_fsm] 516 517 << " | " << write_fsm_str[r_write_fsm] 517 << " | " << sc_fsm_str[r_sc_fsm]518 << " | " << cas_fsm_str[r_cas_fsm] 518 519 << " | " << cleanup_fsm_str[r_cleanup_fsm] << std::endl; 519 520 std::cout << " " << init_cmd_fsm_str[r_init_cmd_fsm] … … 549 550 << "- CLEANUP RATE = " << (double) m_cpt_cleanup/m_cpt_cycles << std::endl 550 551 << "- LL RATE = " << (double) m_cpt_ll/m_cpt_cycles << std::endl 551 << "- SC RATE = " << (double) m_cpt_sc/m_cpt_cycles << std::endl; 552 << "- SC RATE = " << (double) m_cpt_sc/m_cpt_cycles << std::endl 553 << "- CAS RATE = " << (double) m_cpt_cas/m_cpt_cycles << std::endl; 552 554 } 553 555 … … 596 598 r_read_fsm = READ_IDLE; 597 599 r_write_fsm = WRITE_IDLE; 598 r_ sc_fsm = SC_IDLE;600 r_cas_fsm = CAS_IDLE; 599 601 r_cleanup_fsm = CLEANUP_IDLE; 600 602 r_alloc_dir_fsm = ALLOC_DIR_RESET; … … 613 615 m_debug_read_fsm = false; 614 616 m_debug_write_fsm = false; 615 m_debug_ sc_fsm= false;617 m_debug_cas_fsm = false; 616 618 m_debug_cleanup_fsm = false; 617 619 m_debug_ixr_cmd_fsm = false; … … 640 642 m_cmd_write_data_fifo.init(); 641 643 642 m_cmd_ sc_addr_fifo.init();643 m_cmd_ sc_srcid_fifo.init();644 m_cmd_ sc_trdid_fifo.init();645 m_cmd_ sc_pktid_fifo.init();646 m_cmd_ sc_wdata_fifo.init();647 m_cmd_ sc_eop_fifo.init();644 m_cmd_cas_addr_fifo.init() ; 645 m_cmd_cas_srcid_fifo.init() ; 646 m_cmd_cas_trdid_fifo.init() ; 647 m_cmd_cas_pktid_fifo.init() ; 648 m_cmd_cas_wdata_fifo.init() ; 649 m_cmd_cas_eop_fifo.init() ; 648 650 649 651 r_read_to_tgt_rsp_req = false; … … 662 664 #endif 663 665 664 r_cleanup_to_tgt_rsp_req = false;665 666 r_init_rsp_to_tgt_rsp_req = false;667 668 r_ sc_to_tgt_rsp_req = false;669 r_ sc_cpt = 0;670 r_ sc_lfsr = -1;671 r_ sc_to_ixr_cmd_req = false;672 r_ sc_to_init_cmd_multi_req = false;673 r_ sc_to_init_cmd_brdcast_req = false;674 675 m_ sc_to_init_cmd_inst_fifo.init();676 m_ sc_to_init_cmd_srcid_fifo.init();666 r_cleanup_to_tgt_rsp_req = false; 667 668 r_init_rsp_to_tgt_rsp_req = false; 669 670 r_cas_to_tgt_rsp_req = false; 671 r_cas_cpt = 0 ; 672 r_cas_lfsr = -1 ; 673 r_cas_to_ixr_cmd_req = false; 674 r_cas_to_init_cmd_multi_req = false; 675 r_cas_to_init_cmd_brdcast_req = false; 676 677 m_cas_to_init_cmd_inst_fifo.init(); 678 m_cas_to_init_cmd_srcid_fifo.init(); 677 679 #if L1_MULTI_CACHE 678 m_ sc_to_init_cmd_cache_id_fifo.init();680 m_cas_to_init_cmd_cache_id_fifo.init(); 679 681 #endif 680 682 … … 717 719 m_cpt_ll = 0; 718 720 m_cpt_sc = 0; 721 m_cpt_cas = 0; 719 722 m_cpt_trt_full = 0; 720 723 m_cpt_trt_rb = 0; … … 729 732 bool cmd_write_fifo_get = false; 730 733 731 bool cmd_ sc_fifo_put = false;732 bool cmd_ sc_fifo_get = false;734 bool cmd_cas_fifo_put = false; 735 bool cmd_cas_fifo_get = false; 733 736 734 737 bool write_to_init_cmd_fifo_put = false; … … 750 753 #endif 751 754 752 bool sc_to_init_cmd_fifo_put = false;753 bool sc_to_init_cmd_fifo_get = false;754 bool sc_to_init_cmd_fifo_inst = false;755 size_t sc_to_init_cmd_fifo_srcid = 0;755 bool cas_to_init_cmd_fifo_put = false; 756 bool cas_to_init_cmd_fifo_get = false; 757 bool cas_to_init_cmd_fifo_inst = false; 758 size_t cas_to_init_cmd_fifo_srcid = 0; 756 759 757 760 #if L1_MULTI_CACHE 758 size_t sc_to_init_cmd_fifo_cache_id = 0;761 size_t cas_to_init_cmd_fifo_cache_id = 0; 759 762 #endif 760 763 … … 766 769 m_debug_read_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 767 770 m_debug_write_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 768 m_debug_ sc_fsm= (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok;771 m_debug_cas_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 769 772 m_debug_cleanup_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; 770 773 m_debug_ixr_cmd_fsm = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; … … 784 787 << " - READ FSM = " << read_fsm_str[r_read_fsm] << std::endl 785 788 << " - WRITE FSM = " << write_fsm_str[r_write_fsm] << std::endl 786 << " - SC FSM = " << sc_fsm_str[r_sc_fsm] << std::endl789 << " - CAS FSM = " << cas_fsm_str[r_cas_fsm] << std::endl 787 790 << " - CLEANUP FSM = " << cleanup_fsm_str[r_cleanup_fsm] << std::endl 788 791 << " - IXR_CMD FSM = " << ixr_cmd_fsm_str[r_ixr_cmd_fsm] << std::endl … … 801 804 // The TGT_CMD_FSM controls the incoming VCI command pakets from the processors 802 805 // 803 // There is 3 types of accepted commands : 804 // - READ : a READ request has a length of 1 VCI cell. It can be a single word 805 // or an entire cache line, depending on the PLEN value. 806 // - WRITE : a WRITE request has a maximum length of 16 cells, and can only 807 // concern words in a same line. 808 // - SC : The SC request has a length of 2 cells or 4 cells. 806 // There are 5 types of accepted commands : 807 // - READ : A READ request has a length of 1 VCI cell. It can be a single word 808 // or an entire cache line, depending on the PLEN value. 809 // - WRITE : A WRITE request has a maximum length of 16 cells, and can only 810 // concern words in a same line. 811 // - CAS : A CAS request has a length of 2 cells or 4 cells. 812 // - LL : An LL request has a length of 1 cell. 813 // - SC : An SC request has a length of 2 cells. First cell contains the 814 // acces key, second cell the data to write in case of success. 809 815 //////////////////////////////////////////////////////////////////////////////////// 810 816 … … 849 855 if ( p_vci_tgt.cmd.read() == vci_param::CMD_READ ) 850 856 { 857 // check that the pktid is either : 858 // TYPE_READ_DATA_UNC 859 // TYPE_READ_DATA_MISS 860 // TYPE_READ_INS_UNC 861 // TYPE_READ_INS_MISS 862 // ==> bit2 must be zero with the TSAR encoding 863 // ==> mask = 0b0100 = 0x4 864 assert(((p_vci_tgt.pktid.read() & 0x4) == 0x0) && 865 "The type specified in the pktid field is incompatible with the READ CMD"); 851 866 r_tgt_cmd_fsm = TGT_CMD_READ; 852 867 } 853 868 else if ( p_vci_tgt.cmd.read() == vci_param::CMD_WRITE ) 854 869 { 870 // check that the pktid is TYPE_WRITE 871 // ==> TYPE_WRITE = X100 with the TSAR encoding 872 // ==> mask = 0b0111 = 0x7 873 assert(((p_vci_tgt.pktid.read() & 0x7) == 0x4) && 874 "The type specified in the pktid field is incompatible with the WRITE CMD"); 855 875 r_tgt_cmd_fsm = TGT_CMD_WRITE; 856 876 } 857 else if ( p_vci_tgt.cmd.read() == vci_param::CMD_STORE_COND ) 858 { 859 r_tgt_cmd_fsm = TGT_CMD_ATOMIC; 877 else if ( p_vci_tgt.cmd.read() == vci_param::CMD_LOCKED_READ ) 878 { 879 // check that the pktid is TYPE_LL 880 // ==> TYPE_LL = X110 with the TSAR encoding 881 // ==> mask = 0b0111 = 0x7 882 assert(((p_vci_tgt.pktid.read() & 0x7) == 0x6) && 883 "The type specified in the pktid field is incompatible with the LL CMD"); 884 assert(false && "TODO : LL not implemented"); //TODO 885 //r_tgt_cmd_fsm = TGT_CMD_READ; 886 } 887 else if ( p_vci_tgt.cmd.read() == vci_param::CMD_NOP ) 888 { 889 // check that the pktid is either : 890 // TYPE_CAS 891 // TYPE_SC 892 // ==> TYPE_CAS = X101 with the TSAR encoding 893 // ==> TYPE_SC = X111 with the TSAR encoding 894 // ==> mask = 0b0101 = 0x5 895 assert(((p_vci_tgt.pktid.read() & 0x5) == 0x5 ) && 896 "The type specified in the pktid field is incompatible with the NOP CMD"); 897 898 if(p_vci_tgt.pktid.read() == TYPE_CAS) 899 r_tgt_cmd_fsm = TGT_CMD_CAS; 900 else // TYPE_SC 901 assert(false && "TODO : SC not implemented"); //TODO 902 //r_tgt_cmd_fsm = TGT_CMD_WRITE; 860 903 } 861 904 else … … 901 944 << " srcid = " << std::dec << p_vci_tgt.srcid.read() 902 945 << " trdid = " << p_vci_tgt.trdid.read() 946 << " pktid = " << p_vci_tgt.pktid.read() 903 947 << " plen = " << std::dec << p_vci_tgt.plen.read() << std::endl; 904 948 } … … 922 966 << " srcid = " << std::dec << p_vci_tgt.srcid.read() 923 967 << " trdid = " << p_vci_tgt.trdid.read() 968 << " pktid = " << p_vci_tgt.pktid.read() 924 969 << " wdata = " << std::hex << p_vci_tgt.wdata.read() 925 970 << " be = " << p_vci_tgt.be.read() … … 933 978 934 979 //////////////////// 935 case TGT_CMD_ ATOMIC:980 case TGT_CMD_CAS: 936 981 if ( (p_vci_tgt.plen.read() != 8) && (p_vci_tgt.plen.read() != 16) ) 937 982 { 938 983 std::cout 939 << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_ ATOMICstate"984 << "VCI_MEM_CACHE ERROR " << name() << " TGT_CMD_CAS state" 940 985 << std::endl 941 << "illegal format for sccommand " << std::endl;986 << "illegal format for CAS command " << std::endl; 942 987 943 988 exit(0); 944 989 } 945 990 946 if ( p_vci_tgt.cmdval && m_cmd_ sc_addr_fifo.wok() )991 if ( p_vci_tgt.cmdval && m_cmd_cas_addr_fifo.wok() ) 947 992 { 948 993 … … 950 995 if( m_debug_tgt_cmd_fsm ) 951 996 { 952 std::cout << " <MEMC " << name() << ".TGT_CMD_ ATOMIC> Pushing command into cmd_sc_fifo:"997 std::cout << " <MEMC " << name() << ".TGT_CMD_CAS> Pushing command into cmd_cas_fifo:" 953 998 << " address = " << std::hex << p_vci_tgt.address.read() 954 999 << " srcid = " << std::dec << p_vci_tgt.srcid.read() 955 1000 << " trdid = " << p_vci_tgt.trdid.read() 1001 << " pktid = " << p_vci_tgt.pktid.read() 956 1002 << " wdata = " << std::hex << p_vci_tgt.wdata.read() 957 1003 << " be = " << p_vci_tgt.be.read() … … 959 1005 } 960 1006 #endif 961 cmd_ sc_fifo_put = true;1007 cmd_cas_fifo_put = true; 962 1008 if( p_vci_tgt.eop ) r_tgt_cmd_fsm = TGT_CMD_IDLE; 963 1009 } … … 1202 1248 r_read_ptr = entry.ptr; // pointer to the heap 1203 1249 1204 bool cached_read = (m_cmd_read_trdid_fifo.read() & 0x1); 1250 // check if this is a cached read, this means pktid is either 1251 // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding 1252 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 1253 bool cached_read = (m_cmd_read_pktid_fifo.read() & 0x1); 1205 1254 if( entry.valid ) // hit 1206 1255 { … … 1256 1305 { 1257 1306 // signals generation 1258 bool inst_read = (m_cmd_read_trdid_fifo.read() & 0x2); 1259 bool cached_read = (m_cmd_read_trdid_fifo.read() & 0x1); 1307 // check if this is an instruction read, this means pktid is either 1308 // TYPE_READ_INS_UNC 0bX010 with TSAR encoding 1309 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 1310 bool inst_read = (m_cmd_read_pktid_fifo.read() & 0x2); 1311 // check if this is a cached read, this means pktid is either 1312 // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding 1313 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 1314 bool cached_read = (m_cmd_read_pktid_fifo.read() & 0x1); 1260 1315 bool is_cnt = r_read_is_cnt.read(); 1261 1316 … … 1458 1513 heap_entry.owner.cache_id = m_cmd_read_pktid_fifo.read(); 1459 1514 #endif 1460 heap_entry.owner.inst = (m_cmd_read_ trdid_fifo.read() & 0x2);1515 heap_entry.owner.inst = (m_cmd_read_pktid_fifo.read() & 0x2); 1461 1516 1462 1517 if(r_read_count.read() == 1) // creation of a new linked list … … 2687 2742 // The IXR_CMD fsm controls the command packets to the XRAM : 2688 2743 // - It sends a single cell VCI read request to the XRAM in case of MISS 2689 // posted by the READ, WRITE or SCFSMs : the TRDID field contains2744 // posted by the READ, WRITE or CAS FSMs : the TRDID field contains 2690 2745 // the Transaction Tab index. 2691 2746 // The VCI response is a multi-cell packet : the N cells contain 2692 2747 // the N data words. 2693 2748 // - It sends a multi-cell VCI write when the XRAM_RSP FSM, WRITE FSM 2694 // or SCFSM request to save a dirty line to the XRAM.2749 // or CAS FSM request to save a dirty line to the XRAM. 2695 2750 // The VCI response is a single cell packet. 2696 // This FSM handles requests from the READ, WRITE, SC& XRAM_RSP FSMs2751 // This FSM handles requests from the READ, WRITE, CAS & XRAM_RSP FSMs 2697 2752 // with a round-robin priority. 2698 2753 //////////////////////////////////////////////////////////////////////// … … 2703 2758 case IXR_CMD_READ_IDLE: 2704 2759 if ( r_write_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE; 2705 else if ( r_ sc_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;2760 else if ( r_cas_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE; 2706 2761 else if ( r_xram_rsp_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA; 2707 2762 else if ( r_read_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_READ_NLINE; … … 2709 2764 //////////////////////// 2710 2765 case IXR_CMD_WRITE_IDLE: 2711 if ( r_ sc_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;2766 if ( r_cas_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE; 2712 2767 else if ( r_xram_rsp_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA; 2713 2768 else if ( r_read_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_READ_NLINE; … … 2715 2770 break; 2716 2771 //////////////////////// 2717 case IXR_CMD_ SC_IDLE:2772 case IXR_CMD_CAS_IDLE: 2718 2773 if ( r_xram_rsp_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA; 2719 2774 else if ( r_read_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_READ_NLINE; 2720 2775 else if ( r_write_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE; 2721 else if ( r_ sc_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;2776 else if ( r_cas_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE; 2722 2777 break; 2723 2778 //////////////////////// … … 2725 2780 if ( r_read_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_READ_NLINE; 2726 2781 else if ( r_write_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_WRITE_NLINE; 2727 else if ( r_ sc_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_SC_NLINE;2782 else if ( r_cas_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_CAS_NLINE; 2728 2783 else if ( r_xram_rsp_to_ixr_cmd_req ) r_ixr_cmd_fsm = IXR_CMD_XRAM_DATA; 2729 2784 break; … … 2782 2837 break; 2783 2838 ////////////////////// 2784 case IXR_CMD_ SC_NLINE: // send a put or get command to XRAM2839 case IXR_CMD_CAS_NLINE: // send a put or get command to XRAM 2785 2840 if ( p_vci_ixr.cmdack ) 2786 2841 { 2787 if( r_ sc_to_ixr_cmd_write.read())2842 if( r_cas_to_ixr_cmd_write.read()) 2788 2843 { 2789 2844 if ( r_ixr_cmd_cpt.read() == (m_words - 1) ) 2790 2845 { 2791 2846 r_ixr_cmd_cpt = 0; 2792 r_ixr_cmd_fsm = IXR_CMD_ SC_IDLE;2793 r_ sc_to_ixr_cmd_req = false;2847 r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE; 2848 r_cas_to_ixr_cmd_req = false; 2794 2849 } 2795 2850 else … … 2801 2856 if( m_debug_ixr_cmd_fsm ) 2802 2857 { 2803 std::cout << " <MEMC " << name() << ".IXR_CMD_ SC_NLINE> Send a put request to xram" << std::endl;2858 std::cout << " <MEMC " << name() << ".IXR_CMD_CAS_NLINE> Send a put request to xram" << std::endl; 2804 2859 } 2805 2860 #endif … … 2807 2862 else 2808 2863 { 2809 r_ixr_cmd_fsm = IXR_CMD_ SC_IDLE;2810 r_ sc_to_ixr_cmd_req = false;2864 r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE; 2865 r_cas_to_ixr_cmd_req = false; 2811 2866 2812 2867 #if DEBUG_MEMC_IXR_CMD 2813 2868 if( m_debug_ixr_cmd_fsm ) 2814 2869 { 2815 std::cout << " <MEMC " << name() << ".IXR_CMD_ SC_NLINE> Send a get request to xram" << std::endl;2870 std::cout << " <MEMC " << name() << ".IXR_CMD_CAS_NLINE> Send a get request to xram" << std::endl; 2816 2871 } 2817 2872 #endif … … 3161 3216 { 3162 3217 // signals generation 3163 bool inst_read = (r_xram_rsp_trt_buf.trdid & 0x2) && r_xram_rsp_trt_buf.proc_read; 3164 bool cached_read = (r_xram_rsp_trt_buf.trdid & 0x1) && r_xram_rsp_trt_buf.proc_read; 3218 // check if this is an instruction read, this means pktid is either 3219 // TYPE_READ_INS_UNC 0bX010 with TSAR encoding 3220 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 3221 bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) && r_xram_rsp_trt_buf.proc_read; 3222 // check if this is a cached read, this means pktid is either 3223 // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding 3224 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 3225 bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) && r_xram_rsp_trt_buf.proc_read; 3226 3165 3227 // update data 3166 3228 size_t set = r_xram_rsp_victim_set.read(); … … 4186 4248 4187 4249 //////////////////////////////////////////////////////////////////////////////////// 4188 // SCFSM4250 // CAS FSM 4189 4251 //////////////////////////////////////////////////////////////////////////////////// 4190 // The SC FSM handles the SC(Store Conditionnal) atomic commands,4252 // The CAS FSM handles the CAS (Store Conditionnal) atomic commands, 4191 4253 // that are handled as "compare-and-swap instructions. 4192 4254 // … … 4201 4263 // 4202 4264 // It access the directory to check hit / miss. 4203 // - In case of miss, the SCFSM must register a GET transaction in TRT.4265 // - In case of miss, the CAS FSM must register a GET transaction in TRT. 4204 4266 // If a read transaction to the XRAM for this line already exists, 4205 4267 // or if the transaction table is full, it goes to the WAIT state 4206 4268 // to release the locks and try again. When the GET transaction has been 4207 4269 // launched, it goes to the WAIT state and try again. 4208 // The SCrequest is not consumed in the FIFO until a HIT is obtained.4270 // The CAS request is not consumed in the FIFO until a HIT is obtained. 4209 4271 // - In case of hit... 4210 4272 /////////////////////////////////////////////////////////////////////////////////// 4211 4273 4212 switch ( r_ sc_fsm.read() )4274 switch ( r_cas_fsm.read() ) 4213 4275 { 4214 4276 ///////////// 4215 case SC_IDLE: // fill the local rdata buffers4216 { 4217 if( m_cmd_ sc_addr_fifo.rok() )4218 { 4219 4220 #if DEBUG_MEMC_ SC4221 if( m_debug_ sc_fsm )4277 case CAS_IDLE: // fill the local rdata buffers 4278 { 4279 if( m_cmd_cas_addr_fifo.rok() ) 4280 { 4281 4282 #if DEBUG_MEMC_CAS 4283 if( m_debug_cas_fsm ) 4222 4284 { 4223 std::cout << " <MEMC " << name() << ". SC_IDLE> SCcommand: " << std::hex4224 << " srcid = " << std::dec << m_cmd_ sc_srcid_fifo.read()4225 << " addr = " << std::hex << m_cmd_ sc_addr_fifo.read()4226 << " wdata = " << m_cmd_ sc_wdata_fifo.read()4227 << " eop = " << std::dec << m_cmd_ sc_eop_fifo.read()4228 << " cpt = " << std::dec << r_ sc_cpt.read() << std::endl;4285 std::cout << " <MEMC " << name() << ".CAS_IDLE> CAS command: " << std::hex 4286 << " srcid = " << std::dec << m_cmd_cas_srcid_fifo.read() 4287 << " addr = " << std::hex << m_cmd_cas_addr_fifo.read() 4288 << " wdata = " << m_cmd_cas_wdata_fifo.read() 4289 << " eop = " << std::dec << m_cmd_cas_eop_fifo.read() 4290 << " cpt = " << std::dec << r_cas_cpt.read() << std::endl; 4229 4291 } 4230 4292 #endif 4231 if( m_cmd_ sc_eop_fifo.read() )4293 if( m_cmd_cas_eop_fifo.read() ) 4232 4294 { 4233 m_cpt_ sc++;4234 r_ sc_fsm = SC_DIR_REQ;4295 m_cpt_cas++; 4296 r_cas_fsm = CAS_DIR_REQ; 4235 4297 } 4236 4298 else // we keep the last word in the FIFO 4237 4299 { 4238 cmd_ sc_fifo_get = true;4300 cmd_cas_fifo_get = true; 4239 4301 } 4240 4302 // We fill the two buffers 4241 if ( r_ sc_cpt.read() < 2 ) // 32 bits access4242 r_ sc_rdata[r_sc_cpt.read()] = m_cmd_sc_wdata_fifo.read();4243 4244 if((r_ sc_cpt.read() == 1) && m_cmd_sc_eop_fifo.read())4245 r_ sc_wdata = m_cmd_sc_wdata_fifo.read();4246 4247 if( r_ sc_cpt.read()>3 ) // more than 4 flits...4303 if ( r_cas_cpt.read() < 2 ) // 32 bits access 4304 r_cas_rdata[r_cas_cpt.read()] = m_cmd_cas_wdata_fifo.read(); 4305 4306 if((r_cas_cpt.read() == 1) && m_cmd_cas_eop_fifo.read()) 4307 r_cas_wdata = m_cmd_cas_wdata_fifo.read(); 4308 4309 if( r_cas_cpt.read()>3 ) // more than 4 flits... 4248 4310 { 4249 std::cout << "VCI_MEM_CACHE ERROR in SC_IDLE state : illegal SCcommand"4311 std::cout << "VCI_MEM_CACHE ERROR in CAS_IDLE state : illegal CAS command" 4250 4312 << std::endl; 4251 4313 exit(0); 4252 4314 } 4253 4315 4254 if ( r_ sc_cpt.read()==2 )4255 r_ sc_wdata = m_cmd_sc_wdata_fifo.read();4256 4257 r_ sc_cpt = r_sc_cpt.read()+1;4316 if ( r_cas_cpt.read()==2 ) 4317 r_cas_wdata = m_cmd_cas_wdata_fifo.read(); 4318 4319 r_cas_cpt = r_cas_cpt.read()+1; 4258 4320 } 4259 4321 break; … … 4261 4323 4262 4324 ///////////////// 4263 case SC_DIR_REQ:4264 { 4265 if( r_alloc_dir_fsm.read() == ALLOC_DIR_ SC)4266 { 4267 r_ sc_fsm = SC_DIR_LOCK;4268 } 4269 4270 #if DEBUG_MEMC_ SC4271 if( m_debug_ sc_fsm )4325 case CAS_DIR_REQ: 4326 { 4327 if( r_alloc_dir_fsm.read() == ALLOC_DIR_CAS ) 4328 { 4329 r_cas_fsm = CAS_DIR_LOCK; 4330 } 4331 4332 #if DEBUG_MEMC_CAS 4333 if( m_debug_cas_fsm ) 4272 4334 { 4273 4335 std::cout 4274 << " <MEMC " << name() << ". SC_DIR_REQ> Requesting DIR lock "4336 << " <MEMC " << name() << ".CAS_DIR_REQ> Requesting DIR lock " 4275 4337 << std::endl; 4276 4338 } … … 4280 4342 4281 4343 ///////////////// 4282 case SC_DIR_LOCK: // Read the directory4283 { 4284 if( r_alloc_dir_fsm.read() == ALLOC_DIR_ SC)4344 case CAS_DIR_LOCK: // Read the directory 4345 { 4346 if( r_alloc_dir_fsm.read() == ALLOC_DIR_CAS ) 4285 4347 { 4286 4348 size_t way = 0; 4287 DirectoryEntry entry(m_cache_directory.read(m_cmd_ sc_addr_fifo.read(), way));4288 4289 r_ sc_is_cnt = entry.is_cnt;4290 r_ sc_dirty = entry.dirty;4291 r_ sc_tag = entry.tag;4292 r_ sc_way = way;4293 r_ sc_copy = entry.owner.srcid;4349 DirectoryEntry entry(m_cache_directory.read(m_cmd_cas_addr_fifo.read(), way)); 4350 4351 r_cas_is_cnt = entry.is_cnt; 4352 r_cas_dirty = entry.dirty; 4353 r_cas_tag = entry.tag; 4354 r_cas_way = way; 4355 r_cas_copy = entry.owner.srcid; 4294 4356 #if L1_MULTI_CACHE 4295 r_ sc_copy_cache = entry.owner.cache_id;4296 #endif 4297 r_ sc_copy_inst = entry.owner.inst;4298 r_ sc_ptr = entry.ptr;4299 r_ sc_count = entry.count;4300 4301 if ( entry.valid ) r_ sc_fsm = SC_DIR_HIT_READ;4302 else r_ sc_fsm = SC_MISS_TRT_LOCK;4303 4304 #if DEBUG_MEMC_ SC4305 if( m_debug_ sc_fsm )4357 r_cas_copy_cache = entry.owner.cache_id; 4358 #endif 4359 r_cas_copy_inst = entry.owner.inst; 4360 r_cas_ptr = entry.ptr; 4361 r_cas_count = entry.count; 4362 4363 if ( entry.valid ) r_cas_fsm = CAS_DIR_HIT_READ; 4364 else r_cas_fsm = CAS_MISS_TRT_LOCK; 4365 4366 #if DEBUG_MEMC_CAS 4367 if( m_debug_cas_fsm ) 4306 4368 { 4307 std::cout << " <MEMC " << name() << ". SC_DIR_LOCK> Directory acces"4308 << " / address = " << std::hex << m_cmd_ sc_addr_fifo.read()4369 std::cout << " <MEMC " << name() << ".CAS_DIR_LOCK> Directory acces" 4370 << " / address = " << std::hex << m_cmd_cas_addr_fifo.read() 4309 4371 << " / hit = " << std::dec << entry.valid 4310 4372 << " / count = " << entry.count … … 4317 4379 std::cout 4318 4380 << "VCI_MEM_CACHE ERROR " << name() 4319 << " SC_DIR_LOCK state" << std::endl4381 << " CAS_DIR_LOCK state" << std::endl 4320 4382 << "Bad DIR allocation" << std::endl; 4321 4383 … … 4326 4388 } 4327 4389 ///////////////////// 4328 case SC_DIR_HIT_READ: // update directory for lock and dirty bit4390 case CAS_DIR_HIT_READ: // update directory for lock and dirty bit 4329 4391 // and check data change in cache 4330 4392 { 4331 size_t way = r_ sc_way.read();4332 size_t set = m_y[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4333 size_t word = m_x[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4393 size_t way = r_cas_way.read(); 4394 size_t set = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4395 size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4334 4396 4335 4397 // update directory (lock & dirty bits) 4336 4398 DirectoryEntry entry; 4337 4399 entry.valid = true; 4338 entry.is_cnt = r_ sc_is_cnt.read();4400 entry.is_cnt = r_cas_is_cnt.read(); 4339 4401 entry.dirty = true; 4340 4402 entry.lock = true; 4341 entry.tag = r_ sc_tag.read();4342 entry.owner.srcid = r_ sc_copy.read();4403 entry.tag = r_cas_tag.read(); 4404 entry.owner.srcid = r_cas_copy.read(); 4343 4405 #if L1_MULTI_CACHE 4344 entry.owner.cache_id = r_ sc_copy_cache.read();4345 #endif 4346 entry.owner.inst = r_ sc_copy_inst.read();4347 entry.count = r_ sc_count.read();4348 entry.ptr = r_ sc_ptr.read();4406 entry.owner.cache_id = r_cas_copy_cache.read(); 4407 #endif 4408 entry.owner.inst = r_cas_copy_inst.read(); 4409 entry.count = r_cas_count.read(); 4410 entry.ptr = r_cas_ptr.read(); 4349 4411 4350 4412 m_cache_directory.write(set, way, entry); 4351 4413 4352 4414 // read data in cache & check data change 4353 bool ok = ( r_ sc_rdata[0].read() == m_cache_data[way][set][word] );4354 if ( r_ sc_cpt.read()==4 ) // 64 bits SC4355 ok &= ( r_ sc_rdata[1] == m_cache_data[way][set][word+1] );4415 bool ok = ( r_cas_rdata[0].read() == m_cache_data[way][set][word] ); 4416 if ( r_cas_cpt.read()==4 ) // 64 bits CAS 4417 ok &= ( r_cas_rdata[1] == m_cache_data[way][set][word+1] ); 4356 4418 4357 4419 // to avoid livelock, force the atomic access to fail pseudo-randomly 4358 bool forced_fail = ( (r_ sc_lfsr % (64) == 0) && RANDOMIZE_SC);4359 r_ sc_lfsr = (r_sc_lfsr >> 1) ^ ((-(r_sc_lfsr & 1)) & 0xd0000001);4420 bool forced_fail = ( (r_cas_lfsr % (64) == 0) && RANDOMIZE_CAS ); 4421 r_cas_lfsr = (r_cas_lfsr >> 1) ^ ((-(r_cas_lfsr & 1)) & 0xd0000001); 4360 4422 4361 4423 if( ok and not forced_fail ) // no data change 4362 4424 { 4363 r_ sc_fsm = SC_DIR_HIT_WRITE;4425 r_cas_fsm = CAS_DIR_HIT_WRITE; 4364 4426 } 4365 4427 else // return failure 4366 4428 { 4367 r_ sc_fsm = SC_RSP_FAIL;4368 } 4369 4370 #if DEBUG_MEMC_ SC4371 if( m_debug_ sc_fsm )4429 r_cas_fsm = CAS_RSP_FAIL; 4430 } 4431 4432 #if DEBUG_MEMC_CAS 4433 if( m_debug_cas_fsm ) 4372 4434 { 4373 std::cout << " <MEMC " << name() << ". SC_DIR_HIT_READ> Test if SCsuccess:"4374 << " / expected value = " << r_ sc_rdata[0].read()4435 std::cout << " <MEMC " << name() << ".CAS_DIR_HIT_READ> Test if CAS success:" 4436 << " / expected value = " << r_cas_rdata[0].read() 4375 4437 << " / actual value = " << m_cache_data[way][set][word] 4376 4438 << " / forced_fail = " << forced_fail << std::endl; … … 4380 4442 } 4381 4443 ////////////////////// 4382 case SC_DIR_HIT_WRITE: // test if a CC transaction is required4444 case CAS_DIR_HIT_WRITE: // test if a CC transaction is required 4383 4445 // write data in cache if no CC request 4384 4446 { 4385 4447 // test coherence request 4386 if(r_ sc_count.read()) // replicated line4387 { 4388 if ( r_ sc_is_cnt.read() )4448 if(r_cas_count.read()) // replicated line 4449 { 4450 if ( r_cas_is_cnt.read() ) 4389 4451 { 4390 r_ sc_fsm = SC_BC_TRT_LOCK; // broadcast invalidate required4452 r_cas_fsm = CAS_BC_TRT_LOCK; // broadcast invalidate required 4391 4453 } 4392 else if( !r_ sc_to_init_cmd_multi_req.read() &&4393 !r_ sc_to_init_cmd_brdcast_req.read() )4454 else if( !r_cas_to_init_cmd_multi_req.read() && 4455 !r_cas_to_init_cmd_brdcast_req.read() ) 4394 4456 { 4395 r_ sc_fsm = SC_UPT_LOCK; // multi update required4457 r_cas_fsm = CAS_UPT_LOCK; // multi update required 4396 4458 } 4397 4459 else 4398 4460 { 4399 r_ sc_fsm = SC_WAIT;4461 r_cas_fsm = CAS_WAIT; 4400 4462 } 4401 4463 } 4402 4464 else // no copies 4403 4465 { 4404 size_t way = r_ sc_way.read();4405 size_t set = m_y[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4406 size_t word = m_x[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4466 size_t way = r_cas_way.read(); 4467 size_t set = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4468 size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4407 4469 4408 4470 // cache update 4409 m_cache_data[way][set][word] = r_ sc_wdata.read();4410 if(r_ sc_cpt.read()==4)4411 m_cache_data[way][set][word+1] = m_cmd_ sc_wdata_fifo.read();4471 m_cache_data[way][set][word] = r_cas_wdata.read(); 4472 if(r_cas_cpt.read()==4) 4473 m_cache_data[way][set][word+1] = m_cmd_cas_wdata_fifo.read(); 4412 4474 4413 4475 // monitor 4414 4476 if ( m_monitor_ok ) 4415 4477 { 4416 vci_addr_t address = m_cmd_ sc_addr_fifo.read();4478 vci_addr_t address = m_cmd_cas_addr_fifo.read(); 4417 4479 char buf[80]; 4418 snprintf(buf, 80, " SC_DIR_HIT_WRITE srcid %d", m_cmd_sc_srcid_fifo.read());4419 check_monitor( buf, address, r_ sc_wdata.read() );4420 if ( r_ sc_cpt.read()==4 )4421 check_monitor( buf, address+4, m_cmd_ sc_wdata_fifo.read() );4480 snprintf(buf, 80, "CAS_DIR_HIT_WRITE srcid %d", m_cmd_cas_srcid_fifo.read()); 4481 check_monitor( buf, address, r_cas_wdata.read() ); 4482 if ( r_cas_cpt.read()==4 ) 4483 check_monitor( buf, address+4, m_cmd_cas_wdata_fifo.read() ); 4422 4484 } 4423 r_ sc_fsm = SC_RSP_SUCCESS;4424 4425 #if DEBUG_MEMC_ SC4426 if( m_debug_ sc_fsm )4485 r_cas_fsm = CAS_RSP_SUCCESS; 4486 4487 #if DEBUG_MEMC_CAS 4488 if( m_debug_cas_fsm ) 4427 4489 { 4428 std::cout << " <MEMC " << name() << ". SC_DIR_HIT_WRITE> Update cache:"4490 std::cout << " <MEMC " << name() << ".CAS_DIR_HIT_WRITE> Update cache:" 4429 4491 << " way = " << std::dec << way 4430 4492 << " / set = " << set 4431 4493 << " / word = " << word 4432 << " / value = " << r_ sc_wdata.read()4433 << " / count = " << r_ sc_count.read() << std::endl;4494 << " / value = " << r_cas_wdata.read() 4495 << " / count = " << r_cas_count.read() << std::endl; 4434 4496 } 4435 4497 #endif … … 4438 4500 } 4439 4501 ///////////////// 4440 case SC_UPT_LOCK: // try to register the transaction in UPT4502 case CAS_UPT_LOCK: // try to register the transaction in UPT 4441 4503 // and write data in cache if successful registration 4442 4504 // releases locks to retry later if UPT full 4443 4505 { 4444 if ( r_alloc_upt_fsm.read() == ALLOC_UPT_ SC)4506 if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CAS ) 4445 4507 { 4446 4508 bool wok = false; 4447 4509 size_t index = 0; 4448 size_t srcid = m_cmd_ sc_srcid_fifo.read();4449 size_t trdid = m_cmd_ sc_trdid_fifo.read();4450 size_t pktid = m_cmd_ sc_pktid_fifo.read();4451 addr_t nline = m_nline[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4452 size_t nb_copies = r_ sc_count.read();4510 size_t srcid = m_cmd_cas_srcid_fifo.read(); 4511 size_t trdid = m_cmd_cas_trdid_fifo.read(); 4512 size_t pktid = m_cmd_cas_pktid_fifo.read(); 4513 addr_t nline = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4514 size_t nb_copies = r_cas_count.read(); 4453 4515 4454 4516 wok = m_update_tab.set(true, // it's an update transaction … … 4464 4526 { 4465 4527 // cache update 4466 size_t way = r_ sc_way.read();4467 size_t set = m_y[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4468 size_t word = m_x[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4469 4470 m_cache_data[way][set][word] = r_ sc_wdata.read();4471 if(r_ sc_cpt.read()==4)4472 m_cache_data[way][set][word+1] = m_cmd_ sc_wdata_fifo.read();4528 size_t way = r_cas_way.read(); 4529 size_t set = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4530 size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4531 4532 m_cache_data[way][set][word] = r_cas_wdata.read(); 4533 if(r_cas_cpt.read()==4) 4534 m_cache_data[way][set][word+1] = m_cmd_cas_wdata_fifo.read(); 4473 4535 4474 4536 // monitor 4475 4537 if ( m_monitor_ok ) 4476 4538 { 4477 vci_addr_t address = m_cmd_ sc_addr_fifo.read();4539 vci_addr_t address = m_cmd_cas_addr_fifo.read(); 4478 4540 char buf[80]; 4479 snprintf(buf, 80, " SC_DIR_HIT_WRITE srcid %d", m_cmd_sc_srcid_fifo.read());4480 check_monitor( buf, address, r_ sc_wdata.read() );4481 if ( r_ sc_cpt.read()==4 )4482 check_monitor( buf, address+4, m_cmd_ sc_wdata_fifo.read() );4541 snprintf(buf, 80, "CAS_DIR_HIT_WRITE srcid %d", m_cmd_cas_srcid_fifo.read()); 4542 check_monitor( buf, address, r_cas_wdata.read() ); 4543 if ( r_cas_cpt.read()==4 ) 4544 check_monitor( buf, address+4, m_cmd_cas_wdata_fifo.read() ); 4483 4545 } 4484 4546 4485 r_ sc_upt_index = index;4486 r_ sc_fsm = SC_UPT_HEAP_LOCK;4547 r_cas_upt_index = index; 4548 r_cas_fsm = CAS_UPT_HEAP_LOCK; 4487 4549 } 4488 4550 else // releases the locks protecting UPT and DIR UPT full 4489 4551 { 4490 r_ sc_fsm = SC_WAIT;4552 r_cas_fsm = CAS_WAIT; 4491 4553 } 4492 4554 4493 #if DEBUG_MEMC_ SC4494 if( m_debug_ sc_fsm )4555 #if DEBUG_MEMC_CAS 4556 if( m_debug_cas_fsm ) 4495 4557 { 4496 std::cout << " <MEMC " << name() << ". SC_UPT_LOCK> Register multi-update transaction in UPT"4558 std::cout << " <MEMC " << name() << ".CAS_UPT_LOCK> Register multi-update transaction in UPT" 4497 4559 << " / wok = " << wok 4498 4560 << " / nline = " << std::hex << nline … … 4504 4566 } 4505 4567 ///////////// 4506 case SC_WAIT: // release all locks and retry from beginning4507 { 4508 4509 #if DEBUG_MEMC_ SC4510 if( m_debug_ sc_fsm )4568 case CAS_WAIT: // release all locks and retry from beginning 4569 { 4570 4571 #if DEBUG_MEMC_CAS 4572 if( m_debug_cas_fsm ) 4511 4573 { 4512 std::cout << " <MEMC " << name() << ". SC_WAIT> Release all locks" << std::endl;4574 std::cout << " <MEMC " << name() << ".CAS_WAIT> Release all locks" << std::endl; 4513 4575 } 4514 4576 #endif 4515 r_ sc_fsm = SC_DIR_REQ;4577 r_cas_fsm = CAS_DIR_REQ; 4516 4578 break; 4517 4579 } 4518 4580 ////////////////// 4519 case SC_UPT_HEAP_LOCK: // lock the heap4520 { 4521 if( r_alloc_heap_fsm.read() == ALLOC_HEAP_ SC)4522 { 4523 4524 #if DEBUG_MEMC_ SC4525 if( m_debug_ sc_fsm )4581 case CAS_UPT_HEAP_LOCK: // lock the heap 4582 { 4583 if( r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS ) 4584 { 4585 4586 #if DEBUG_MEMC_CAS 4587 if( m_debug_cas_fsm ) 4526 4588 { 4527 std::cout << " <MEMC " << name() << ". SC_UPT_HEAP_LOCK> Get access to the heap" << std::endl;4589 std::cout << " <MEMC " << name() << ".CAS_UPT_HEAP_LOCK> Get access to the heap" << std::endl; 4528 4590 } 4529 4591 #endif 4530 r_ sc_fsm = SC_UPT_REQ;4592 r_cas_fsm = CAS_UPT_REQ; 4531 4593 } 4532 4594 break; 4533 4595 } 4534 4596 //////////////// 4535 case SC_UPT_REQ: // send a first update request to INIT_CMD FSM4536 { 4537 assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_ SC) and4597 case CAS_UPT_REQ: // send a first update request to INIT_CMD FSM 4598 { 4599 assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS) and 4538 4600 "VCI_MEM_CACHE ERROR : bad HEAP allocation"); 4539 4601 4540 if( !r_ sc_to_init_cmd_multi_req.read() && !r_sc_to_init_cmd_brdcast_req.read() )4541 { 4542 r_ sc_to_init_cmd_brdcast_req = false;4543 r_ sc_to_init_cmd_trdid = r_sc_upt_index.read();4544 r_ sc_to_init_cmd_nline = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];4545 r_ sc_to_init_cmd_index = m_x[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];4546 r_ sc_to_init_cmd_wdata = r_sc_wdata.read();4547 4548 if(r_ sc_cpt.read() == 4)4602 if( !r_cas_to_init_cmd_multi_req.read() && !r_cas_to_init_cmd_brdcast_req.read() ) 4603 { 4604 r_cas_to_init_cmd_brdcast_req = false; 4605 r_cas_to_init_cmd_trdid = r_cas_upt_index.read(); 4606 r_cas_to_init_cmd_nline = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4607 r_cas_to_init_cmd_index = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4608 r_cas_to_init_cmd_wdata = r_cas_wdata.read(); 4609 4610 if(r_cas_cpt.read() == 4) 4549 4611 { 4550 r_ sc_to_init_cmd_is_long = true;4551 r_ sc_to_init_cmd_wdata_high = m_cmd_sc_wdata_fifo.read();4612 r_cas_to_init_cmd_is_long = true; 4613 r_cas_to_init_cmd_wdata_high = m_cmd_cas_wdata_fifo.read(); 4552 4614 } 4553 4615 else 4554 4616 { 4555 r_ sc_to_init_cmd_is_long = false;4556 r_ sc_to_init_cmd_wdata_high = 0;4617 r_cas_to_init_cmd_is_long = false; 4618 r_cas_to_init_cmd_wdata_high = 0; 4557 4619 } 4558 4620 4559 4621 // We put the first copy in the fifo 4560 sc_to_init_cmd_fifo_put = true;4561 sc_to_init_cmd_fifo_inst = r_sc_copy_inst.read();4562 sc_to_init_cmd_fifo_srcid = r_sc_copy.read();4622 cas_to_init_cmd_fifo_put = true; 4623 cas_to_init_cmd_fifo_inst = r_cas_copy_inst.read(); 4624 cas_to_init_cmd_fifo_srcid = r_cas_copy.read(); 4563 4625 #if L1_MULTI_CACHE 4564 sc_to_init_cmd_fifo_cache_id= r_sc_copy_cache.read();4565 #endif 4566 if(r_ sc_count.read() == 1) // one single copy4626 cas_to_init_cmd_fifo_cache_id= r_cas_copy_cache.read(); 4627 #endif 4628 if(r_cas_count.read() == 1) // one single copy 4567 4629 { 4568 r_ sc_fsm = SC_IDLE; // Response will be sent after receiving4630 r_cas_fsm = CAS_IDLE; // Response will be sent after receiving 4569 4631 // update responses 4570 cmd_ sc_fifo_get = true;4571 r_ sc_to_init_cmd_multi_req = true;4572 r_ sc_cpt = 0;4632 cmd_cas_fifo_get = true; 4633 r_cas_to_init_cmd_multi_req = true; 4634 r_cas_cpt = 0; 4573 4635 } 4574 4636 else // several copies 4575 4637 { 4576 r_ sc_fsm = SC_UPT_NEXT;4638 r_cas_fsm = CAS_UPT_NEXT; 4577 4639 } 4578 4640 4579 #if DEBUG_MEMC_ SC4580 if( m_debug_ sc_fsm )4641 #if DEBUG_MEMC_CAS 4642 if( m_debug_cas_fsm ) 4581 4643 { 4582 std::cout << " <MEMC " << name() << ". SC_UPT_REQ> Send the first update request to INIT_CMD FSM "4583 << " / address = " << std::hex << m_cmd_ sc_addr_fifo.read()4584 << " / wdata = " << std::hex << r_ sc_wdata.read()4585 << " / srcid = " << std::dec << r_ sc_copy.read()4586 << " / inst = " << std::dec << r_ sc_copy_inst.read() << std::endl;4644 std::cout << " <MEMC " << name() << ".CAS_UPT_REQ> Send the first update request to INIT_CMD FSM " 4645 << " / address = " << std::hex << m_cmd_cas_addr_fifo.read() 4646 << " / wdata = " << std::hex << r_cas_wdata.read() 4647 << " / srcid = " << std::dec << r_cas_copy.read() 4648 << " / inst = " << std::dec << r_cas_copy_inst.read() << std::endl; 4587 4649 } 4588 4650 #endif … … 4591 4653 } 4592 4654 ///////////////// 4593 case SC_UPT_NEXT: // send a multi-update request to INIT_CMD FSM4594 { 4595 assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_ SC)4655 case CAS_UPT_NEXT: // send a multi-update request to INIT_CMD FSM 4656 { 4657 assert((r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS) 4596 4658 and "VCI_MEM_CACHE ERROR : bad HEAP allocation"); 4597 4659 4598 HeapEntry entry = m_heap.read(r_ sc_ptr.read());4599 sc_to_init_cmd_fifo_srcid = entry.owner.srcid;4660 HeapEntry entry = m_heap.read(r_cas_ptr.read()); 4661 cas_to_init_cmd_fifo_srcid = entry.owner.srcid; 4600 4662 #if L1_MULTI_CACHE 4601 sc_to_init_cmd_fifo_cache_id = entry.owner.cache_id;4602 #endif 4603 sc_to_init_cmd_fifo_inst = entry.owner.inst;4604 sc_to_init_cmd_fifo_put = true;4605 4606 if( m_ sc_to_init_cmd_inst_fifo.wok() ) // request accepted by INIT_CMD FSM4607 { 4608 r_ sc_ptr = entry.next;4609 if( entry.next == r_ sc_ptr.read() ) // last copy4663 cas_to_init_cmd_fifo_cache_id = entry.owner.cache_id; 4664 #endif 4665 cas_to_init_cmd_fifo_inst = entry.owner.inst; 4666 cas_to_init_cmd_fifo_put = true; 4667 4668 if( m_cas_to_init_cmd_inst_fifo.wok() ) // request accepted by INIT_CMD FSM 4669 { 4670 r_cas_ptr = entry.next; 4671 if( entry.next == r_cas_ptr.read() ) // last copy 4610 4672 { 4611 r_ sc_to_init_cmd_multi_req = true;4612 r_ sc_fsm = SC_IDLE; // Response will be sent after receiving4673 r_cas_to_init_cmd_multi_req = true; 4674 r_cas_fsm = CAS_IDLE; // Response will be sent after receiving 4613 4675 // all update responses 4614 cmd_ sc_fifo_get = true;4615 r_ sc_cpt = 0;4676 cmd_cas_fifo_get = true; 4677 r_cas_cpt = 0; 4616 4678 } 4617 4679 } 4618 4680 4619 #if DEBUG_MEMC_ SC4620 if( m_debug_ sc_fsm )4681 #if DEBUG_MEMC_CAS 4682 if( m_debug_cas_fsm ) 4621 4683 { 4622 std::cout << " <MEMC " << name() << ". SC_UPT_NEXT> Send the next update request to INIT_CMD FSM "4623 << " / address = " << std::hex << m_cmd_ sc_addr_fifo.read()4624 << " / wdata = " << std::hex << r_ sc_wdata.read()4684 std::cout << " <MEMC " << name() << ".CAS_UPT_NEXT> Send the next update request to INIT_CMD FSM " 4685 << " / address = " << std::hex << m_cmd_cas_addr_fifo.read() 4686 << " / wdata = " << std::hex << r_cas_wdata.read() 4625 4687 << " / srcid = " << std::dec << entry.owner.srcid 4626 4688 << " / inst = " << std::dec << entry.owner.inst << std::endl; … … 4630 4692 } 4631 4693 ///////////////////// 4632 case SC_BC_TRT_LOCK: // check the TRT to register a PUT transaction4633 { 4634 if( r_alloc_trt_fsm.read() == ALLOC_TRT_ SC)4635 { 4636 if( !r_ sc_to_ixr_cmd_req ) // we can transfer the request to IXR_CMD FSM4694 case CAS_BC_TRT_LOCK: // check the TRT to register a PUT transaction 4695 { 4696 if( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS ) 4697 { 4698 if( !r_cas_to_ixr_cmd_req ) // we can transfer the request to IXR_CMD FSM 4637 4699 { 4638 4700 // fill the data buffer 4639 size_t way = r_ sc_way.read();4640 size_t set = m_y[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4641 size_t word = m_x[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4701 size_t way = r_cas_way.read(); 4702 size_t set = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4703 size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4642 4704 for(size_t i = 0; i<m_words; i++) 4643 4705 { 4644 4706 if (i == word) 4645 4707 { 4646 r_ sc_to_ixr_cmd_data[i] = r_sc_wdata.read();4708 r_cas_to_ixr_cmd_data[i] = r_cas_wdata.read(); 4647 4709 } 4648 else if ( (i == word+1) && (r_ sc_cpt.read()==4) ) // 64 bit SC4710 else if ( (i == word+1) && (r_cas_cpt.read()==4) ) // 64 bit CAS 4649 4711 { 4650 r_ sc_to_ixr_cmd_data[i] = m_cmd_sc_wdata_fifo.read();4712 r_cas_to_ixr_cmd_data[i] = m_cmd_cas_wdata_fifo.read(); 4651 4713 } 4652 4714 else 4653 4715 { 4654 r_ sc_to_ixr_cmd_data[i] = m_cache_data[way][set][i];4716 r_cas_to_ixr_cmd_data[i] = m_cache_data[way][set][i]; 4655 4717 } 4656 4718 } … … 4659 4721 if ( wok ) 4660 4722 { 4661 r_ sc_trt_index = wok_index;4662 r_ sc_fsm = SC_BC_UPT_LOCK;4723 r_cas_trt_index = wok_index; 4724 r_cas_fsm = CAS_BC_UPT_LOCK; 4663 4725 } 4664 4726 else 4665 4727 { 4666 r_ sc_fsm = SC_WAIT;4728 r_cas_fsm = CAS_WAIT; 4667 4729 } 4668 4730 } 4669 4731 else 4670 4732 { 4671 r_ sc_fsm = SC_WAIT;4733 r_cas_fsm = CAS_WAIT; 4672 4734 } 4673 4735 } … … 4675 4737 } 4676 4738 /////////////////// 4677 case SC_BC_UPT_LOCK: // register a broadcast inval transaction in UPT4739 case CAS_BC_UPT_LOCK: // register a broadcast inval transaction in UPT 4678 4740 // write data in cache in case of successful registration 4679 4741 { 4680 if ( r_alloc_upt_fsm.read() == ALLOC_UPT_ SC)4742 if ( r_alloc_upt_fsm.read() == ALLOC_UPT_CAS ) 4681 4743 { 4682 4744 bool wok = false; 4683 4745 size_t index = 0; 4684 size_t srcid = m_cmd_ sc_srcid_fifo.read();4685 size_t trdid = m_cmd_ sc_trdid_fifo.read();4686 size_t pktid = m_cmd_ sc_pktid_fifo.read();4687 addr_t nline = m_nline[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4688 size_t nb_copies = r_ sc_count.read();4746 size_t srcid = m_cmd_cas_srcid_fifo.read(); 4747 size_t trdid = m_cmd_cas_trdid_fifo.read(); 4748 size_t pktid = m_cmd_cas_pktid_fifo.read(); 4749 addr_t nline = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4750 size_t nb_copies = r_cas_count.read(); 4689 4751 4690 4752 // register a broadcast inval transaction in UPT … … 4702 4764 { 4703 4765 // cache update 4704 size_t way = r_ sc_way.read();4705 size_t set = m_y[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4706 size_t word = m_x[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4707 4708 m_cache_data[way][set][word] = r_ sc_wdata.read();4709 if(r_ sc_cpt.read()==4)4710 m_cache_data[way][set][word+1] = m_cmd_ sc_wdata_fifo.read();4766 size_t way = r_cas_way.read(); 4767 size_t set = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4768 size_t word = m_x[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4769 4770 m_cache_data[way][set][word] = r_cas_wdata.read(); 4771 if(r_cas_cpt.read()==4) 4772 m_cache_data[way][set][word+1] = m_cmd_cas_wdata_fifo.read(); 4711 4773 4712 4774 // monitor 4713 4775 if ( m_monitor_ok ) 4714 4776 { 4715 vci_addr_t address = m_cmd_ sc_addr_fifo.read();4777 vci_addr_t address = m_cmd_cas_addr_fifo.read(); 4716 4778 char buf[80]; 4717 snprintf(buf, 80, " SC_DIR_HIT_WRITE srcid %d", m_cmd_sc_srcid_fifo.read());4718 check_monitor( buf, address, r_ sc_wdata.read() );4719 if ( r_ sc_cpt.read()==4 )4720 check_monitor( buf, address+4, m_cmd_ sc_wdata_fifo.read() );4779 snprintf(buf, 80, "CAS_DIR_HIT_WRITE srcid %d", m_cmd_cas_srcid_fifo.read()); 4780 check_monitor( buf, address, r_cas_wdata.read() ); 4781 if ( r_cas_cpt.read()==4 ) 4782 check_monitor( buf, address+4, m_cmd_cas_wdata_fifo.read() ); 4721 4783 } 4722 r_ sc_upt_index = index;4723 r_ sc_fsm = SC_BC_DIR_INVAL;4724 #if DEBUG_MEMC_ SC4725 if( m_debug_ sc_fsm )4784 r_cas_upt_index = index; 4785 r_cas_fsm = CAS_BC_DIR_INVAL; 4786 #if DEBUG_MEMC_CAS 4787 if( m_debug_cas_fsm ) 4726 4788 { 4727 std::cout << " <MEMC " << name() << ". SC_BC_UPT_LOCK> Register a broadcast inval transaction in UPT"4789 std::cout << " <MEMC " << name() << ".CAS_BC_UPT_LOCK> Register a broadcast inval transaction in UPT" 4728 4790 << " / nline = " << nline 4729 4791 << " / count = " << nb_copies … … 4734 4796 else // releases the lock protecting UPT 4735 4797 { 4736 r_ sc_fsm = SC_WAIT;4798 r_cas_fsm = CAS_WAIT; 4737 4799 } 4738 4800 } … … 4740 4802 } 4741 4803 ////////////////// 4742 case SC_BC_DIR_INVAL: // Register the PUT transaction in TRT, and inval the DIR entry4743 { 4744 if ( (r_alloc_trt_fsm.read() == ALLOC_TRT_ SC) &&4745 (r_alloc_upt_fsm.read() == ALLOC_UPT_ SC) &&4746 (r_alloc_dir_fsm.read() == ALLOC_DIR_ SC))4804 case CAS_BC_DIR_INVAL: // Register the PUT transaction in TRT, and inval the DIR entry 4805 { 4806 if ( (r_alloc_trt_fsm.read() == ALLOC_TRT_CAS ) && 4807 (r_alloc_upt_fsm.read() == ALLOC_UPT_CAS ) && 4808 (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS )) 4747 4809 { 4748 4810 // set TRT 4749 m_transaction_tab.set(r_ sc_trt_index.read(),4811 m_transaction_tab.set(r_cas_trt_index.read(), 4750 4812 false, // PUT request to XRAM 4751 m_nline[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())],4813 m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())], 4752 4814 0, 4753 4815 0, … … 4773 4835 entry.owner.inst = false; 4774 4836 entry.ptr = 0; 4775 size_t set = m_y[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())];4776 size_t way = r_ sc_way.read();4837 size_t set = m_y[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4838 size_t way = r_cas_way.read(); 4777 4839 m_cache_directory.write(set, way, entry); 4778 4840 4779 r_ sc_fsm = SC_BC_CC_SEND;4780 4781 #if DEBUG_MEMC_ SC4782 if( m_debug_ sc_fsm )4841 r_cas_fsm = CAS_BC_CC_SEND; 4842 4843 #if DEBUG_MEMC_CAS 4844 if( m_debug_cas_fsm ) 4783 4845 { 4784 std::cout << " <MEMC " << name() << ". SC_BC_DIR_INVAL> Register the PUT in TRT and invalidate DIR entry"4785 << " / nline = " << std::hex << m_nline[(vci_addr_t)(m_cmd_ sc_addr_fifo.read())]4846 std::cout << " <MEMC " << name() << ".CAS_BC_DIR_INVAL> Register the PUT in TRT and invalidate DIR entry" 4847 << " / nline = " << std::hex << m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())] 4786 4848 << " / set = " << std::dec << set << " / way = " << way << std::endl; 4787 4849 } … … 4790 4852 else 4791 4853 { 4792 assert(false and "LOCK ERROR in SC_FSM, STATE = SC_BC_DIR_INVAL");4854 assert(false and "LOCK ERROR in CAS_FSM, STATE = CAS_BC_DIR_INVAL"); 4793 4855 } 4794 4856 break; 4795 4857 } 4796 4858 /////////////////// 4797 case SC_BC_CC_SEND: // Request the broadcast inval to INIT_CMD FSM4798 { 4799 if ( !r_ sc_to_init_cmd_multi_req.read() &&4800 !r_ sc_to_init_cmd_brdcast_req.read())4801 { 4802 r_ sc_to_init_cmd_multi_req = false;4803 r_ sc_to_init_cmd_brdcast_req = true;4804 r_ sc_to_init_cmd_trdid = r_sc_upt_index.read();4805 r_ sc_to_init_cmd_nline = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];4806 r_ sc_to_init_cmd_index = 0;4807 r_ sc_to_init_cmd_wdata = 0;4808 4809 r_ sc_fsm = SC_BC_XRAM_REQ;4859 case CAS_BC_CC_SEND: // Request the broadcast inval to INIT_CMD FSM 4860 { 4861 if ( !r_cas_to_init_cmd_multi_req.read() && 4862 !r_cas_to_init_cmd_brdcast_req.read()) 4863 { 4864 r_cas_to_init_cmd_multi_req = false; 4865 r_cas_to_init_cmd_brdcast_req = true; 4866 r_cas_to_init_cmd_trdid = r_cas_upt_index.read(); 4867 r_cas_to_init_cmd_nline = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4868 r_cas_to_init_cmd_index = 0; 4869 r_cas_to_init_cmd_wdata = 0; 4870 4871 r_cas_fsm = CAS_BC_XRAM_REQ; 4810 4872 } 4811 4873 break; 4812 4874 } 4813 4875 //////////////////// 4814 case SC_BC_XRAM_REQ: // request the IXR FSM to start a put transaction4815 { 4816 if ( !r_ sc_to_ixr_cmd_req )4817 { 4818 r_ sc_to_ixr_cmd_req = true;4819 r_ sc_to_ixr_cmd_write = true;4820 r_ sc_to_ixr_cmd_nline = m_nline[(vci_addr_t)(m_cmd_sc_addr_fifo.read())];4821 r_ sc_to_ixr_cmd_trdid = r_sc_trt_index.read();4822 r_ sc_fsm = SC_IDLE;4823 cmd_ sc_fifo_get = true;4824 r_ sc_cpt = 0;4825 4826 #if DEBUG_MEMC_ SC4827 if( m_debug_ sc_fsm )4876 case CAS_BC_XRAM_REQ: // request the IXR FSM to start a put transaction 4877 { 4878 if ( !r_cas_to_ixr_cmd_req ) 4879 { 4880 r_cas_to_ixr_cmd_req = true; 4881 r_cas_to_ixr_cmd_write = true; 4882 r_cas_to_ixr_cmd_nline = m_nline[(vci_addr_t)(m_cmd_cas_addr_fifo.read())]; 4883 r_cas_to_ixr_cmd_trdid = r_cas_trt_index.read(); 4884 r_cas_fsm = CAS_IDLE; 4885 cmd_cas_fifo_get = true; 4886 r_cas_cpt = 0; 4887 4888 #if DEBUG_MEMC_CAS 4889 if( m_debug_cas_fsm ) 4828 4890 { 4829 std::cout << " <MEMC " << name() << ". SC_BC_XRAM_REQ> Request a PUT transaction to IXR_CMD FSM" << std::hex4830 << " / nline = " << m_nline[(vci_addr_t)m_cmd_ sc_addr_fifo.read()]4831 << " / trt_index = " << r_ sc_trt_index.read() << std::endl;4891 std::cout << " <MEMC " << name() << ".CAS_BC_XRAM_REQ> Request a PUT transaction to IXR_CMD FSM" << std::hex 4892 << " / nline = " << m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()] 4893 << " / trt_index = " << r_cas_trt_index.read() << std::endl; 4832 4894 } 4833 4895 #endif … … 4835 4897 else 4836 4898 { 4837 std::cout << "MEM_CACHE, SC_BC_XRAM_REQ state : request should not have been previously set"4899 std::cout << "MEM_CACHE, CAS_BC_XRAM_REQ state : request should not have been previously set" 4838 4900 << std::endl; 4839 4901 } … … 4841 4903 } 4842 4904 ///////////////// 4843 case SC_RSP_FAIL: // request TGT_RSP FSM to send a failure response4844 { 4845 if( !r_ sc_to_tgt_rsp_req )4846 { 4847 cmd_ sc_fifo_get = true;4848 r_ sc_cpt = 0;4849 r_ sc_to_tgt_rsp_req = true;4850 r_ sc_to_tgt_rsp_data = 1;4851 r_ sc_to_tgt_rsp_srcid = m_cmd_sc_srcid_fifo.read();4852 r_ sc_to_tgt_rsp_trdid = m_cmd_sc_trdid_fifo.read();4853 r_ sc_to_tgt_rsp_pktid = m_cmd_sc_pktid_fifo.read();4854 r_ sc_fsm = SC_IDLE;4855 4856 #if DEBUG_MEMC_ SC4857 if( m_debug_ sc_fsm )4905 case CAS_RSP_FAIL: // request TGT_RSP FSM to send a failure response 4906 { 4907 if( !r_cas_to_tgt_rsp_req ) 4908 { 4909 cmd_cas_fifo_get = true; 4910 r_cas_cpt = 0; 4911 r_cas_to_tgt_rsp_req = true; 4912 r_cas_to_tgt_rsp_data = 1; 4913 r_cas_to_tgt_rsp_srcid = m_cmd_cas_srcid_fifo.read(); 4914 r_cas_to_tgt_rsp_trdid = m_cmd_cas_trdid_fifo.read(); 4915 r_cas_to_tgt_rsp_pktid = m_cmd_cas_pktid_fifo.read(); 4916 r_cas_fsm = CAS_IDLE; 4917 4918 #if DEBUG_MEMC_CAS 4919 if( m_debug_cas_fsm ) 4858 4920 { 4859 std::cout << " <MEMC " << name() << ". SC_RSP_FAIL> Request TGT_RSP to send a failure response" << std::endl;4921 std::cout << " <MEMC " << name() << ".CAS_RSP_FAIL> Request TGT_RSP to send a failure response" << std::endl; 4860 4922 } 4861 4923 #endif … … 4864 4926 } 4865 4927 //////////////////// 4866 case SC_RSP_SUCCESS: // request TGT_RSP FSM to send a success response4867 { 4868 if( !r_ sc_to_tgt_rsp_req )4869 { 4870 cmd_ sc_fifo_get = true;4871 r_ sc_cpt = 0;4872 r_ sc_to_tgt_rsp_req = true;4873 r_ sc_to_tgt_rsp_data = 0;4874 r_ sc_to_tgt_rsp_srcid = m_cmd_sc_srcid_fifo.read();4875 r_ sc_to_tgt_rsp_trdid = m_cmd_sc_trdid_fifo.read();4876 r_ sc_to_tgt_rsp_pktid = m_cmd_sc_pktid_fifo.read();4877 r_ sc_fsm = SC_IDLE;4878 4879 #if DEBUG_MEMC_ SC4880 if( m_debug_ sc_fsm )4928 case CAS_RSP_SUCCESS: // request TGT_RSP FSM to send a success response 4929 { 4930 if( !r_cas_to_tgt_rsp_req ) 4931 { 4932 cmd_cas_fifo_get = true; 4933 r_cas_cpt = 0; 4934 r_cas_to_tgt_rsp_req = true; 4935 r_cas_to_tgt_rsp_data = 0; 4936 r_cas_to_tgt_rsp_srcid = m_cmd_cas_srcid_fifo.read(); 4937 r_cas_to_tgt_rsp_trdid = m_cmd_cas_trdid_fifo.read(); 4938 r_cas_to_tgt_rsp_pktid = m_cmd_cas_pktid_fifo.read(); 4939 r_cas_fsm = CAS_IDLE; 4940 4941 #if DEBUG_MEMC_CAS 4942 if( m_debug_cas_fsm ) 4881 4943 { 4882 std::cout << " <MEMC " << name() << ". SC_RSP_SUCCESS> Request TGT_RSP to send a success response" << std::endl;4944 std::cout << " <MEMC " << name() << ".CAS_RSP_SUCCESS> Request TGT_RSP to send a success response" << std::endl; 4883 4945 } 4884 4946 #endif … … 4887 4949 } 4888 4950 ///////////////////// 4889 case SC_MISS_TRT_LOCK: // cache miss : request access to transaction Table4890 { 4891 if( r_alloc_trt_fsm.read() == ALLOC_TRT_ SC)4951 case CAS_MISS_TRT_LOCK: // cache miss : request access to transaction Table 4952 { 4953 if( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS ) 4892 4954 { 4893 4955 size_t index = 0; 4894 4956 bool hit_read = m_transaction_tab.hit_read( 4895 m_nline[(vci_addr_t)m_cmd_ sc_addr_fifo.read()],index);4957 m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()],index); 4896 4958 bool hit_write = m_transaction_tab.hit_write( 4897 m_nline[(vci_addr_t)m_cmd_ sc_addr_fifo.read()]);4959 m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()]); 4898 4960 bool wok = !m_transaction_tab.full(index); 4899 4961 4900 #if DEBUG_MEMC_ SC4901 if( m_debug_ sc_fsm )4962 #if DEBUG_MEMC_CAS 4963 if( m_debug_cas_fsm ) 4902 4964 { 4903 std::cout << " <MEMC " << name() << ". SC_MISS_TRT_LOCK> Check TRT state"4965 std::cout << " <MEMC " << name() << ".CAS_MISS_TRT_LOCK> Check TRT state" 4904 4966 << " / hit_read = " << hit_read 4905 4967 << " / hit_write = " << hit_write … … 4911 4973 if ( hit_read || !wok || hit_write ) // missing line already requested or no space in TRT 4912 4974 { 4913 r_ sc_fsm = SC_WAIT;4975 r_cas_fsm = CAS_WAIT; 4914 4976 } 4915 4977 else 4916 4978 { 4917 r_ sc_trt_index = index;4918 r_ sc_fsm = SC_MISS_TRT_SET;4979 r_cas_trt_index = index; 4980 r_cas_fsm = CAS_MISS_TRT_SET; 4919 4981 } 4920 4982 } … … 4922 4984 } 4923 4985 //////////////////// 4924 case SC_MISS_TRT_SET: // register the GET transaction in TRT4925 { 4926 if( r_alloc_trt_fsm.read() == ALLOC_TRT_ SC)4986 case CAS_MISS_TRT_SET: // register the GET transaction in TRT 4987 { 4988 if( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS ) 4927 4989 { 4928 4990 std::vector<be_t> be_vector; … … 4936 4998 } 4937 4999 4938 m_transaction_tab.set(r_ sc_trt_index.read(),5000 m_transaction_tab.set(r_cas_trt_index.read(), 4939 5001 true, // read request 4940 m_nline[(vci_addr_t)m_cmd_ sc_addr_fifo.read()],4941 m_cmd_ sc_srcid_fifo.read(),4942 m_cmd_ sc_trdid_fifo.read(),4943 m_cmd_ sc_pktid_fifo.read(),5002 m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()], 5003 m_cmd_cas_srcid_fifo.read(), 5004 m_cmd_cas_trdid_fifo.read(), 5005 m_cmd_cas_pktid_fifo.read(), 4944 5006 false, // write request from processor 4945 5007 0, … … 4947 5009 be_vector, 4948 5010 data_vector); 4949 r_ sc_fsm = SC_MISS_XRAM_REQ;4950 4951 #if DEBUG_MEMC_ SC4952 if( m_debug_ sc_fsm )5011 r_cas_fsm = CAS_MISS_XRAM_REQ; 5012 5013 #if DEBUG_MEMC_CAS 5014 if( m_debug_cas_fsm ) 4953 5015 { 4954 std::cout << " <MEMC " << name() << ". SC_MISS_TRT_SET> Register a GET transaction in TRT" << std::hex4955 << " / nline = " << m_nline[(vci_addr_t)m_cmd_ sc_addr_fifo.read()]4956 << " / trt_index = " << r_ sc_trt_index.read() << std::endl;5016 std::cout << " <MEMC " << name() << ".CAS_MISS_TRT_SET> Register a GET transaction in TRT" << std::hex 5017 << " / nline = " << m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()] 5018 << " / trt_index = " << r_cas_trt_index.read() << std::endl; 4957 5019 } 4958 5020 #endif … … 4961 5023 } 4962 5024 ////////////////////// 4963 case SC_MISS_XRAM_REQ: // request the IXR_CMD FSM to fetch the missing line4964 { 4965 if ( !r_ sc_to_ixr_cmd_req )4966 { 4967 r_ sc_to_ixr_cmd_req = true;4968 r_ sc_to_ixr_cmd_write = false;4969 r_ sc_to_ixr_cmd_trdid = r_sc_trt_index.read();4970 r_ sc_to_ixr_cmd_nline = m_nline[(vci_addr_t)m_cmd_sc_addr_fifo.read()];4971 r_ sc_fsm = SC_WAIT;4972 4973 #if DEBUG_MEMC_ SC4974 if( m_debug_ sc_fsm )5025 case CAS_MISS_XRAM_REQ: // request the IXR_CMD FSM to fetch the missing line 5026 { 5027 if ( !r_cas_to_ixr_cmd_req ) 5028 { 5029 r_cas_to_ixr_cmd_req = true; 5030 r_cas_to_ixr_cmd_write = false; 5031 r_cas_to_ixr_cmd_trdid = r_cas_trt_index.read(); 5032 r_cas_to_ixr_cmd_nline = m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()]; 5033 r_cas_fsm = CAS_WAIT; 5034 5035 #if DEBUG_MEMC_CAS 5036 if( m_debug_cas_fsm ) 4975 5037 { 4976 std::cout << " <MEMC " << name() << ". SC_MISS_XRAM_REQ> Request a GET transaction to IXR_CMD FSM" << std::hex4977 << " / nline = " << m_nline[(vci_addr_t)m_cmd_ sc_addr_fifo.read()]4978 << " / trt_index = " << r_ sc_trt_index.read() << std::endl;5038 std::cout << " <MEMC " << name() << ".CAS_MISS_XRAM_REQ> Request a GET transaction to IXR_CMD FSM" << std::hex 5039 << " / nline = " << m_nline[(vci_addr_t)m_cmd_cas_addr_fifo.read()] 5040 << " / trt_index = " << r_cas_trt_index.read() << std::endl; 4979 5041 } 4980 5042 #endif … … 4982 5044 break; 4983 5045 } 4984 } // end switch r_ sc_fsm5046 } // end switch r_cas_fsm 4985 5047 4986 5048 … … 4992 5054 // 4993 5055 // It implements a round-robin priority between the three possible client FSMs 4994 // XRAM_RSP, WRITE and SC. Each FSM can request two types of services:5056 // XRAM_RSP, WRITE and CAS. Each FSM can request two types of services: 4995 5057 // - r_xram_rsp_to_init_cmd_multi_req : multi-inval 4996 5058 // r_xram_rsp_to_init_cmd_brdcast_req : broadcast-inval 4997 5059 // - r_write_to_init_cmd_multi_req : multi-update 4998 5060 // r_write_to_init_cmd_brdcast_req : broadcast-inval 4999 // - r_ sc_to_init_cmd_multi_req : multi-update5000 // r_ sc_to_init_cmd_brdcast_req : broadcast-inval5061 // - r_cas_to_init_cmd_multi_req : multi-update 5062 // r_cas_to_init_cmd_brdcast_req : broadcast-inval 5001 5063 // 5002 5064 // An inval request is a single cell VCI write command containing the … … 5035 5097 m_cpt_inval++; 5036 5098 } 5037 else if ( m_ sc_to_init_cmd_inst_fifo.rok() ||5038 r_ sc_to_init_cmd_multi_req.read() )5039 { 5040 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_NLINE;5099 else if ( m_cas_to_init_cmd_inst_fifo.rok() || 5100 r_cas_to_init_cmd_multi_req.read() ) 5101 { 5102 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE; 5041 5103 m_cpt_update++; 5042 5104 } 5043 else if( r_ sc_to_init_cmd_brdcast_req.read() )5044 { 5045 r_init_cmd_fsm = INIT_CMD_ SC_BRDCAST;5105 else if( r_cas_to_init_cmd_brdcast_req.read() ) 5106 { 5107 r_init_cmd_fsm = INIT_CMD_CAS_BRDCAST; 5046 5108 m_cpt_inval++; 5047 5109 } … … 5062 5124 m_cpt_inval++; 5063 5125 } 5064 else if ( m_ sc_to_init_cmd_inst_fifo.rok() ||5065 r_ sc_to_init_cmd_multi_req.read() )5066 { 5067 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_NLINE;5126 else if ( m_cas_to_init_cmd_inst_fifo.rok() || 5127 r_cas_to_init_cmd_multi_req.read() ) 5128 { 5129 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE; 5068 5130 m_cpt_update++; 5069 5131 } 5070 else if( r_ sc_to_init_cmd_brdcast_req.read() )5071 { 5072 r_init_cmd_fsm = INIT_CMD_ SC_BRDCAST;5132 else if( r_cas_to_init_cmd_brdcast_req.read() ) 5133 { 5134 r_init_cmd_fsm = INIT_CMD_CAS_BRDCAST; 5073 5135 m_cpt_inval++; 5074 5136 } … … 5087 5149 } 5088 5150 ////////////////////////// 5089 case INIT_CMD_ SC_UPDT_IDLE: // SCFSM has highest priority5090 { 5091 if ( m_ sc_to_init_cmd_inst_fifo.rok() ||5092 r_ sc_to_init_cmd_multi_req.read() )5093 { 5094 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_NLINE;5151 case INIT_CMD_CAS_UPDT_IDLE: // CAS FSM has highest priority 5152 { 5153 if ( m_cas_to_init_cmd_inst_fifo.rok() || 5154 r_cas_to_init_cmd_multi_req.read() ) 5155 { 5156 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE; 5095 5157 m_cpt_update++; 5096 5158 } 5097 else if( r_ sc_to_init_cmd_brdcast_req.read() )5098 { 5099 r_init_cmd_fsm = INIT_CMD_ SC_BRDCAST;5159 else if( r_cas_to_init_cmd_brdcast_req.read() ) 5160 { 5161 r_init_cmd_fsm = INIT_CMD_CAS_BRDCAST; 5100 5162 m_cpt_inval++; 5101 5163 } … … 5217 5279 } 5218 5280 ///////////////////////// 5219 case INIT_CMD_ SC_BRDCAST: // send a broadcast-inval (from SCFSM)5281 case INIT_CMD_CAS_BRDCAST: // send a broadcast-inval (from CAS FSM) 5220 5282 { 5221 5283 if( p_vci_ini.cmdack ) 5222 5284 { 5223 5285 m_cpt_inval_brdcast++; 5224 r_ sc_to_init_cmd_brdcast_req = false;5225 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_IDLE;5286 r_cas_to_init_cmd_brdcast_req = false; 5287 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_IDLE; 5226 5288 } 5227 5289 break; 5228 5290 } 5229 5291 //////////////////////////// 5230 case INIT_CMD_ SC_UPDT_NLINE: // send nline for a multi-update (from SCFSM)5231 { 5232 if ( m_ sc_to_init_cmd_inst_fifo.rok() )5292 case INIT_CMD_CAS_UPDT_NLINE: // send nline for a multi-update (from CAS FSM) 5293 { 5294 if ( m_cas_to_init_cmd_inst_fifo.rok() ) 5233 5295 { 5234 5296 if ( p_vci_ini.cmdack ) 5235 5297 { 5236 5298 m_cpt_update_mult++; 5237 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_INDEX;5299 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_INDEX; 5238 5300 } 5239 5301 } 5240 5302 else 5241 5303 { 5242 if( r_ sc_to_init_cmd_multi_req.read() ) r_sc_to_init_cmd_multi_req = false;5243 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_IDLE;5304 if( r_cas_to_init_cmd_multi_req.read() ) r_cas_to_init_cmd_multi_req = false; 5305 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_IDLE; 5244 5306 } 5245 5307 break; 5246 5308 } 5247 5309 //////////////////////////// 5248 case INIT_CMD_ SC_UPDT_INDEX: // send word index for a multi-update (from SCFSM)5249 { 5250 if ( p_vci_ini.cmdack ) r_init_cmd_fsm = INIT_CMD_ SC_UPDT_DATA;5310 case INIT_CMD_CAS_UPDT_INDEX: // send word index for a multi-update (from CAS FSM) 5311 { 5312 if ( p_vci_ini.cmdack ) r_init_cmd_fsm = INIT_CMD_CAS_UPDT_DATA; 5251 5313 break; 5252 5314 } 5253 5315 /////////////////////////// 5254 case INIT_CMD_ SC_UPDT_DATA: // send first data for a multi-update (from SCFSM)5316 case INIT_CMD_CAS_UPDT_DATA: // send first data for a multi-update (from CAS FSM) 5255 5317 { 5256 5318 if ( p_vci_ini.cmdack ) 5257 5319 { 5258 if ( r_ sc_to_init_cmd_is_long.read() )5320 if ( r_cas_to_init_cmd_is_long.read() ) 5259 5321 { 5260 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_DATA_HIGH;5322 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_DATA_HIGH; 5261 5323 } 5262 5324 else 5263 5325 { 5264 sc_to_init_cmd_fifo_get = true;5265 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_NLINE;5326 cas_to_init_cmd_fifo_get = true; 5327 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE; 5266 5328 } 5267 5329 } … … 5269 5331 } 5270 5332 //////////////////////// 5271 case INIT_CMD_ SC_UPDT_DATA_HIGH: // send second data for a multi-update (from SCFSM)5333 case INIT_CMD_CAS_UPDT_DATA_HIGH: // send second data for a multi-update (from CAS FSM) 5272 5334 { 5273 5335 if ( p_vci_ini.cmdack ) 5274 5336 { 5275 sc_to_init_cmd_fifo_get = true;5276 r_init_cmd_fsm = INIT_CMD_ SC_UPDT_NLINE;5337 cas_to_init_cmd_fifo_get = true; 5338 r_init_cmd_fsm = INIT_CMD_CAS_UPDT_NLINE; 5277 5339 } 5278 5340 break; … … 5287 5349 // - r_read_to_tgt_rsp_req 5288 5350 // - r_write_to_tgt_rsp_req 5289 // - r_ sc_to_tgt_rsp_req5351 // - r_cas_to_tgt_rsp_req 5290 5352 // - r_cleanup_to_tgt_rsp_req 5291 5353 // - r_xram_rsp_to_tgt_rsp_req 5292 5354 // - r_init_rsp_to_tgt_rsp_req 5293 // The ordering is : read > write > sc> xram > init > cleanup5355 // The ordering is : read > write > cas > xram > init > cleanup 5294 5356 ///////////////////////////////////////////////////////////////////// 5295 5357 … … 5300 5362 { 5301 5363 if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE; 5302 else if ( r_ sc_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_SC;5364 else if ( r_cas_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CAS ; 5303 5365 else if ( r_xram_rsp_to_tgt_rsp_req ) 5304 5366 { … … 5306 5368 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 5307 5369 } 5308 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ;5370 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ; 5309 5371 else if ( r_cleanup_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 5310 5372 else if ( r_read_to_tgt_rsp_req ) … … 5316 5378 } 5317 5379 //////////////////////// 5318 case TGT_RSP_WRITE_IDLE: // screquests have the highest priority5319 { 5320 if ( r_ sc_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_SC;5380 case TGT_RSP_WRITE_IDLE: // cas requests have the highest priority 5381 { 5382 if ( r_cas_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CAS; 5321 5383 else if ( r_xram_rsp_to_tgt_rsp_req ) 5322 5384 { … … 5324 5386 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 5325 5387 } 5326 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ;5388 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ; 5327 5389 else if ( r_cleanup_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 5328 5390 else if ( r_read_to_tgt_rsp_req ) … … 5336 5398 } 5337 5399 /////////////////////// 5338 case TGT_RSP_ SC_IDLE: // xram_rsp requests have the highest priority5400 case TGT_RSP_CAS_IDLE: // xram_rsp requests have the highest priority 5339 5401 { 5340 5402 if ( r_xram_rsp_to_tgt_rsp_req ) … … 5343 5405 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 5344 5406 } 5345 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT; 5407 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ; 5408 else if ( r_cleanup_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 5409 else if ( r_read_to_tgt_rsp_req ) 5410 { 5411 r_tgt_rsp_fsm = TGT_RSP_READ; 5412 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 5413 } 5414 else if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE; 5415 else if ( r_cas_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CAS ; 5416 break; 5417 } 5418 /////////////////////// 5419 case TGT_RSP_XRAM_IDLE: // init requests have the highest priority 5420 { 5421 5422 if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ; 5346 5423 else if ( r_cleanup_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 5347 5424 else if ( r_read_to_tgt_rsp_req ) … … 5351 5428 } 5352 5429 else if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE; 5353 else if ( r_sc_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_SC; 5354 break; 5355 } 5356 /////////////////////// 5357 case TGT_RSP_XRAM_IDLE: // init requests have the highest priority 5358 { 5359 5360 if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT; 5361 else if ( r_cleanup_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 5362 else if ( r_read_to_tgt_rsp_req ) 5363 { 5364 r_tgt_rsp_fsm = TGT_RSP_READ; 5365 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 5366 } 5367 else if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE; 5368 else if ( r_sc_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_SC; 5430 else if ( r_cas_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CAS ; 5369 5431 else if ( r_xram_rsp_to_tgt_rsp_req ) 5370 5432 { … … 5384 5446 } 5385 5447 else if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE; 5386 else if ( r_ sc_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_SC;5448 else if ( r_cas_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CAS ; 5387 5449 else if ( r_xram_rsp_to_tgt_rsp_req ) 5388 5450 { … … 5402 5464 } 5403 5465 else if ( r_write_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_WRITE; 5404 else if ( r_ sc_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_SC;5466 else if ( r_cas_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CAS ; 5405 5467 else if ( r_xram_rsp_to_tgt_rsp_req ) 5406 5468 { … … 5408 5470 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 5409 5471 } 5410 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ;5472 else if ( r_init_rsp_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_INIT ; 5411 5473 else if ( r_cleanup_to_tgt_rsp_req ) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 5412 5474 break; … … 5424 5486 << " / rsrcid = " << std::dec << r_read_to_tgt_rsp_srcid.read() 5425 5487 << " / rtrdid = " << r_read_to_tgt_rsp_trdid.read() 5488 << " / rpktid = " << r_read_to_tgt_rsp_pktid.read() 5426 5489 << " / rdata = " << std::hex << r_read_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read() 5427 5490 << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl; … … 5451 5514 std::cout << " <MEMC " << name() << ".TGT_RSP_WRITE> Write response" 5452 5515 << " / rsrcid = " << std::dec << r_write_to_tgt_rsp_srcid.read() 5453 << " / rtrdid = " << r_write_to_tgt_rsp_trdid.read() << std::endl; 5516 << " / rtrdid = " << r_write_to_tgt_rsp_trdid.read() 5517 << " / rpktid = " << r_write_to_tgt_rsp_pktid.read() << std::endl; 5454 5518 } 5455 5519 #endif … … 5470 5534 std::cout << " <MEMC " << name() << ".TGT_RSP_CLEANUP> Cleanup response" 5471 5535 << " / rsrcid = " << std::dec << r_cleanup_to_tgt_rsp_srcid.read() 5472 << " / rtrdid = " << r_cleanup_to_tgt_rsp_trdid.read() << std::endl; 5536 << " / rtrdid = " << r_cleanup_to_tgt_rsp_trdid.read() 5537 << " / rpktid = " << r_cleanup_to_tgt_rsp_pktid.read() << std::endl; 5473 5538 } 5474 5539 #endif … … 5479 5544 } 5480 5545 ////////////////// 5481 case TGT_RSP_ SC: // send one atomic word response5546 case TGT_RSP_CAS: // send one atomic word response 5482 5547 { 5483 5548 if ( p_vci_tgt.rspack ) … … 5487 5552 if( m_debug_tgt_rsp_fsm ) 5488 5553 { 5489 std::cout << " <MEMC " << name() << ".TGT_RSP_SC> SC response" 5490 << " / rsrcid = " << std::dec << r_sc_to_tgt_rsp_srcid.read() 5491 << " / rtrdid = " << r_sc_to_tgt_rsp_trdid.read() << std::endl; 5554 std::cout << " <MEMC " << name() << ".TGT_RSP_CAS> CAS response" 5555 << " / rsrcid = " << std::dec << r_cas_to_tgt_rsp_srcid.read() 5556 << " / rtrdid = " << r_cas_to_tgt_rsp_trdid.read() 5557 << " / rpktid = " << r_cas_to_tgt_rsp_pktid.read() << std::endl; 5492 5558 } 5493 5559 #endif 5494 r_tgt_rsp_fsm = TGT_RSP_ SC_IDLE;5495 r_ sc_to_tgt_rsp_req = false;5560 r_tgt_rsp_fsm = TGT_RSP_CAS_IDLE; 5561 r_cas_to_tgt_rsp_req = false; 5496 5562 } 5497 5563 break; … … 5510 5576 << " / rsrcid = " << std::dec << r_xram_rsp_to_tgt_rsp_srcid.read() 5511 5577 << " / rtrdid = " << r_xram_rsp_to_tgt_rsp_trdid.read() 5578 << " / rpktid = " << r_xram_rsp_to_tgt_rsp_pktid.read() 5512 5579 << " / rdata = " << std::hex << r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read() 5513 5580 << " / cpt = " << std::dec << r_tgt_rsp_cpt.read() << std::endl; … … 5539 5606 std::cout << " <MEMC " << name() << ".TGT_RSP_INIT> Write response after coherence transaction" 5540 5607 << " / rsrcid = " << std::dec << r_init_rsp_to_tgt_rsp_srcid.read() 5541 << " / rtrdid = " << r_init_rsp_to_tgt_rsp_trdid.read() << std::endl; 5608 << " / rtrdid = " << r_init_rsp_to_tgt_rsp_trdid.read() 5609 << " / rpktid = " << r_init_rsp_to_tgt_rsp_pktid.read() << std::endl; 5542 5610 } 5543 5611 #endif … … 5579 5647 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 5580 5648 5581 else if (( r_ sc_fsm.read() == SC_UPT_LOCK ) ||5582 ( r_ sc_fsm.read() == SC_BC_UPT_LOCK ))5583 r_alloc_upt_fsm = ALLOC_UPT_ SC;5649 else if (( r_cas_fsm.read() == CAS_UPT_LOCK ) || 5650 ( r_cas_fsm.read() == CAS_BC_UPT_LOCK )) 5651 r_alloc_upt_fsm = ALLOC_UPT_CAS; 5584 5652 } 5585 5653 break; … … 5596 5664 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 5597 5665 5598 else if (( r_ sc_fsm.read() == SC_UPT_LOCK ) ||5599 ( r_ sc_fsm.read() == SC_BC_UPT_LOCK ))5600 r_alloc_upt_fsm = ALLOC_UPT_ SC;5666 else if (( r_cas_fsm.read() == CAS_UPT_LOCK ) || 5667 ( r_cas_fsm.read() == CAS_BC_UPT_LOCK )) 5668 r_alloc_upt_fsm = ALLOC_UPT_CAS; 5601 5669 5602 5670 else if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK ) … … 5612 5680 r_alloc_upt_fsm = ALLOC_UPT_CLEANUP; 5613 5681 5614 else if (( r_ sc_fsm.read() == SC_UPT_LOCK ) ||5615 ( r_ sc_fsm.read() == SC_BC_UPT_LOCK ))5616 r_alloc_upt_fsm = ALLOC_UPT_ SC;5682 else if (( r_cas_fsm.read() == CAS_UPT_LOCK ) || 5683 ( r_cas_fsm.read() == CAS_BC_UPT_LOCK )) 5684 r_alloc_upt_fsm = ALLOC_UPT_CAS; 5617 5685 5618 5686 else if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK ) … … 5629 5697 if(r_cleanup_fsm.read() != CLEANUP_UPT_LOCK ) 5630 5698 { 5631 if (( r_ sc_fsm.read() == SC_UPT_LOCK ) ||5632 ( r_ sc_fsm.read() == SC_BC_UPT_LOCK ))5633 r_alloc_upt_fsm = ALLOC_UPT_ SC;5699 if (( r_cas_fsm.read() == CAS_UPT_LOCK ) || 5700 ( r_cas_fsm.read() == CAS_BC_UPT_LOCK )) 5701 r_alloc_upt_fsm = ALLOC_UPT_CAS; 5634 5702 5635 5703 else if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK ) … … 5646 5714 5647 5715 ////////////////////////// 5648 case ALLOC_UPT_ SC:5649 if (( r_ sc_fsm.read() != SC_UPT_LOCK ) &&5650 ( r_ sc_fsm.read() != SC_BC_UPT_LOCK ))5716 case ALLOC_UPT_CAS: 5717 if (( r_cas_fsm.read() != CAS_UPT_LOCK ) && 5718 ( r_cas_fsm.read() != CAS_BC_UPT_LOCK )) 5651 5719 { 5652 5720 if ( r_init_rsp_fsm.read() == INIT_RSP_UPT_LOCK ) … … 5672 5740 // The ALLOC_DIR FSM allocates the access to the directory and 5673 5741 // the data cache with a round robin priority between 5 user FSMs : 5674 // The cyclic ordering is READ > WRITE > SC> CLEANUP > XRAM_RSP5742 // The cyclic ordering is READ > WRITE > CAS > CLEANUP > XRAM_RSP 5675 5743 // The ressource is always allocated. 5676 5744 ///////////////////////////////////////////////////////////////////////////////////// … … 5704 5772 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 5705 5773 5706 else if (r_ sc_fsm.read() == SC_DIR_REQ)5707 r_alloc_dir_fsm = ALLOC_DIR_ SC;5774 else if (r_cas_fsm.read() == CAS_DIR_REQ) 5775 r_alloc_dir_fsm = ALLOC_DIR_CAS; 5708 5776 5709 5777 else if (r_cleanup_fsm.read() == CLEANUP_DIR_REQ ) … … 5733 5801 ( r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE ))) 5734 5802 { 5735 if ( r_ sc_fsm.read() == SC_DIR_REQ )5736 r_alloc_dir_fsm = ALLOC_DIR_ SC;5803 if ( r_cas_fsm.read() == CAS_DIR_REQ ) 5804 r_alloc_dir_fsm = ALLOC_DIR_CAS; 5737 5805 5738 5806 else if ( r_cleanup_fsm.read() == CLEANUP_DIR_REQ ) … … 5748 5816 5749 5817 //////////////////// 5750 case ALLOC_DIR_ SC:5751 if ((( r_ sc_fsm.read() != SC_DIR_REQ ) &&5752 ( r_ sc_fsm.read() != SC_DIR_LOCK ) &&5753 ( r_ sc_fsm.read() != SC_DIR_HIT_READ ) &&5754 ( r_ sc_fsm.read() != SC_DIR_HIT_WRITE ) &&5755 ( r_ sc_fsm.read() != SC_BC_TRT_LOCK ) &&5756 ( r_ sc_fsm.read() != SC_BC_UPT_LOCK ) &&5757 ( r_ sc_fsm.read() != SC_MISS_TRT_LOCK ) &&5758 ( r_ sc_fsm.read() != SC_UPT_LOCK ) &&5759 ( r_ sc_fsm.read() != SC_UPT_HEAP_LOCK ))5818 case ALLOC_DIR_CAS: 5819 if ((( r_cas_fsm.read() != CAS_DIR_REQ ) && 5820 ( r_cas_fsm.read() != CAS_DIR_LOCK ) && 5821 ( r_cas_fsm.read() != CAS_DIR_HIT_READ ) && 5822 ( r_cas_fsm.read() != CAS_DIR_HIT_WRITE ) && 5823 ( r_cas_fsm.read() != CAS_BC_TRT_LOCK ) && 5824 ( r_cas_fsm.read() != CAS_BC_UPT_LOCK ) && 5825 ( r_cas_fsm.read() != CAS_MISS_TRT_LOCK ) && 5826 ( r_cas_fsm.read() != CAS_UPT_LOCK ) && 5827 ( r_cas_fsm.read() != CAS_UPT_HEAP_LOCK )) 5760 5828 || 5761 (( r_ sc_fsm.read() == SC_UPT_HEAP_LOCK ) &&5762 ( r_alloc_heap_fsm.read() == ALLOC_HEAP_ SC))5829 (( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK ) && 5830 ( r_alloc_heap_fsm.read() == ALLOC_HEAP_CAS )) 5763 5831 || 5764 (( r_ sc_fsm.read() == SC_MISS_TRT_LOCK ) &&5765 ( r_alloc_trt_fsm.read() == ALLOC_TRT_ SC)))5832 (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) && 5833 ( r_alloc_trt_fsm.read() == ALLOC_TRT_CAS ))) 5766 5834 { 5767 5835 if ( r_cleanup_fsm.read() == CLEANUP_DIR_REQ ) … … 5795 5863 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 5796 5864 5797 else if ( r_ sc_fsm.read() == SC_DIR_REQ )5798 r_alloc_dir_fsm = ALLOC_DIR_ SC;5865 else if ( r_cas_fsm.read() == CAS_DIR_REQ ) 5866 r_alloc_dir_fsm = ALLOC_DIR_CAS; 5799 5867 } 5800 5868 break; … … 5812 5880 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 5813 5881 5814 else if ( r_ sc_fsm.read() == SC_DIR_REQ )5815 r_alloc_dir_fsm = ALLOC_DIR_ SC;5882 else if ( r_cas_fsm.read() == CAS_DIR_REQ ) 5883 r_alloc_dir_fsm = ALLOC_DIR_CAS; 5816 5884 5817 5885 else if ( r_cleanup_fsm.read() == CLEANUP_DIR_REQ ) … … 5827 5895 // The ALLOC_TRT fsm allocates the access to the Transaction Table (write buffer) 5828 5896 // with a round robin priority between 4 user FSMs : 5829 // The cyclic priority is READ > WRITE > SC> XRAM_RSP5897 // The cyclic priority is READ > WRITE > CAS > XRAM_RSP 5830 5898 // The ressource is always allocated. 5831 5899 /////////////////////////////////////////////////////////////////////////////////// … … 5841 5909 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 5842 5910 5843 else if (( r_ sc_fsm.read() == SC_MISS_TRT_LOCK ) ||5844 ( r_ sc_fsm.read() == SC_BC_TRT_LOCK ))5845 r_alloc_trt_fsm = ALLOC_TRT_ SC;5911 else if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) || 5912 ( r_cas_fsm.read() == CAS_BC_TRT_LOCK )) 5913 r_alloc_trt_fsm = ALLOC_TRT_CAS; 5846 5914 5847 5915 else if (( r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK ) && … … 5861 5929 ( r_write_fsm.read() != WRITE_BC_UPT_LOCK )) 5862 5930 { 5863 if (( r_ sc_fsm.read() == SC_MISS_TRT_LOCK ) ||5864 ( r_ sc_fsm.read() == SC_BC_TRT_LOCK ))5865 r_alloc_trt_fsm = ALLOC_TRT_ SC;5931 if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) || 5932 ( r_cas_fsm.read() == CAS_BC_TRT_LOCK )) 5933 r_alloc_trt_fsm = ALLOC_TRT_CAS; 5866 5934 5867 5935 else if (( r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK ) && … … 5879 5947 5880 5948 //////////////////// 5881 case ALLOC_TRT_ SC:5882 if (( r_ sc_fsm.read() != SC_MISS_TRT_LOCK ) &&5883 ( r_ sc_fsm.read() != SC_BC_TRT_LOCK ) &&5884 ( r_ sc_fsm.read() != SC_BC_UPT_LOCK ))5949 case ALLOC_TRT_CAS: 5950 if (( r_cas_fsm.read() != CAS_MISS_TRT_LOCK ) && 5951 ( r_cas_fsm.read() != CAS_BC_TRT_LOCK ) && 5952 ( r_cas_fsm.read() != CAS_BC_UPT_LOCK )) 5885 5953 { 5886 5954 if (( r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK ) && … … 5920 5988 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 5921 5989 5922 else if (( r_ sc_fsm.read() == SC_MISS_TRT_LOCK ) ||5923 ( r_ sc_fsm.read() == SC_BC_TRT_LOCK ))5924 r_alloc_trt_fsm = ALLOC_TRT_ SC;5990 else if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) || 5991 ( r_cas_fsm.read() == CAS_BC_TRT_LOCK )) 5992 r_alloc_trt_fsm = ALLOC_TRT_CAS; 5925 5993 } 5926 5994 break; … … 5938 6006 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 5939 6007 5940 else if (( r_ sc_fsm.read() == SC_MISS_TRT_LOCK ) ||5941 ( r_ sc_fsm.read() == SC_BC_TRT_LOCK ))5942 r_alloc_trt_fsm = ALLOC_TRT_ SC;6008 else if (( r_cas_fsm.read() == CAS_MISS_TRT_LOCK ) || 6009 ( r_cas_fsm.read() == CAS_BC_TRT_LOCK )) 6010 r_alloc_trt_fsm = ALLOC_TRT_CAS; 5943 6011 5944 6012 else if (( r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK ) && … … 5955 6023 // The ALLOC_HEAP FSM allocates the access to the heap 5956 6024 // with a round robin priority between 5 user FSMs : 5957 // The cyclic ordering is READ > WRITE > SC> CLEANUP > XRAM_RSP6025 // The cyclic ordering is READ > WRITE > CAS > CLEANUP > XRAM_RSP 5958 6026 // The ressource is always allocated. 5959 6027 ///////////////////////////////////////////////////////////////////////////////////// … … 5983 6051 r_alloc_heap_fsm = ALLOC_HEAP_WRITE; 5984 6052 5985 else if ( r_ sc_fsm.read() == SC_UPT_HEAP_LOCK )5986 r_alloc_heap_fsm = ALLOC_HEAP_ SC;6053 else if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK ) 6054 r_alloc_heap_fsm = ALLOC_HEAP_CAS; 5987 6055 5988 6056 else if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ ) … … 6000 6068 ( r_write_fsm.read() != WRITE_UPT_NEXT )) 6001 6069 { 6002 if ( r_ sc_fsm.read() == SC_UPT_HEAP_LOCK )6003 r_alloc_heap_fsm = ALLOC_HEAP_ SC;6070 if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK ) 6071 r_alloc_heap_fsm = ALLOC_HEAP_CAS; 6004 6072 6005 6073 else if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ ) … … 6015 6083 6016 6084 //////////////////// 6017 case ALLOC_HEAP_ SC:6018 if (( r_ sc_fsm.read() != SC_UPT_HEAP_LOCK ) &&6019 ( r_ sc_fsm.read() != SC_UPT_REQ ) &&6020 ( r_ sc_fsm.read() != SC_UPT_NEXT ))6085 case ALLOC_HEAP_CAS: 6086 if (( r_cas_fsm.read() != CAS_UPT_HEAP_LOCK ) && 6087 ( r_cas_fsm.read() != CAS_UPT_REQ ) && 6088 ( r_cas_fsm.read() != CAS_UPT_NEXT )) 6021 6089 { 6022 6090 if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ ) … … 6050 6118 r_alloc_heap_fsm = ALLOC_HEAP_WRITE; 6051 6119 6052 else if ( r_ sc_fsm.read() == SC_UPT_HEAP_LOCK )6053 r_alloc_heap_fsm = ALLOC_HEAP_ SC;6120 else if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK ) 6121 r_alloc_heap_fsm = ALLOC_HEAP_CAS; 6054 6122 } 6055 6123 break; … … 6066 6134 r_alloc_heap_fsm = ALLOC_HEAP_WRITE; 6067 6135 6068 else if ( r_ sc_fsm.read() == SC_UPT_HEAP_LOCK )6069 r_alloc_heap_fsm = ALLOC_HEAP_ SC;6136 else if ( r_cas_fsm.read() == CAS_UPT_HEAP_LOCK ) 6137 r_alloc_heap_fsm = ALLOC_HEAP_CAS; 6070 6138 6071 6139 else if ( r_cleanup_fsm.read() == CLEANUP_HEAP_REQ ) … … 6139 6207 } 6140 6208 //////////////////////////////////////////////////////////////////////////////////// 6141 // TGT_CMD to SCFIFO6209 // TGT_CMD to CAS FIFO 6142 6210 //////////////////////////////////////////////////////////////////////////////////// 6143 6211 6144 if ( cmd_ sc_fifo_put ) {6145 if ( cmd_ sc_fifo_get ) {6146 m_cmd_ sc_addr_fifo.put_and_get((addr_t)(p_vci_tgt.address.read()));6147 m_cmd_ sc_eop_fifo.put_and_get(p_vci_tgt.eop.read());6148 m_cmd_ sc_srcid_fifo.put_and_get(p_vci_tgt.srcid.read());6149 m_cmd_ sc_trdid_fifo.put_and_get(p_vci_tgt.trdid.read());6150 m_cmd_ sc_pktid_fifo.put_and_get(p_vci_tgt.pktid.read());6151 m_cmd_ sc_wdata_fifo.put_and_get(p_vci_tgt.wdata.read());6212 if ( cmd_cas_fifo_put ) { 6213 if ( cmd_cas_fifo_get ) { 6214 m_cmd_cas_addr_fifo.put_and_get((addr_t)(p_vci_tgt.address.read())); 6215 m_cmd_cas_eop_fifo.put_and_get(p_vci_tgt.eop.read()); 6216 m_cmd_cas_srcid_fifo.put_and_get(p_vci_tgt.srcid.read()); 6217 m_cmd_cas_trdid_fifo.put_and_get(p_vci_tgt.trdid.read()); 6218 m_cmd_cas_pktid_fifo.put_and_get(p_vci_tgt.pktid.read()); 6219 m_cmd_cas_wdata_fifo.put_and_get(p_vci_tgt.wdata.read()); 6152 6220 } else { 6153 m_cmd_ sc_addr_fifo.simple_put((addr_t)(p_vci_tgt.address.read()));6154 m_cmd_ sc_eop_fifo.simple_put(p_vci_tgt.eop.read());6155 m_cmd_ sc_srcid_fifo.simple_put(p_vci_tgt.srcid.read());6156 m_cmd_ sc_trdid_fifo.simple_put(p_vci_tgt.trdid.read());6157 m_cmd_ sc_pktid_fifo.simple_put(p_vci_tgt.pktid.read());6158 m_cmd_ sc_wdata_fifo.simple_put(p_vci_tgt.wdata.read());6221 m_cmd_cas_addr_fifo.simple_put((addr_t)(p_vci_tgt.address.read())); 6222 m_cmd_cas_eop_fifo.simple_put(p_vci_tgt.eop.read()); 6223 m_cmd_cas_srcid_fifo.simple_put(p_vci_tgt.srcid.read()); 6224 m_cmd_cas_trdid_fifo.simple_put(p_vci_tgt.trdid.read()); 6225 m_cmd_cas_pktid_fifo.simple_put(p_vci_tgt.pktid.read()); 6226 m_cmd_cas_wdata_fifo.simple_put(p_vci_tgt.wdata.read()); 6159 6227 } 6160 6228 } else { 6161 if ( cmd_ sc_fifo_get ) {6162 m_cmd_ sc_addr_fifo.simple_get();6163 m_cmd_ sc_eop_fifo.simple_get();6164 m_cmd_ sc_srcid_fifo.simple_get();6165 m_cmd_ sc_trdid_fifo.simple_get();6166 m_cmd_ sc_pktid_fifo.simple_get();6167 m_cmd_ sc_wdata_fifo.simple_get();6229 if ( cmd_cas_fifo_get ) { 6230 m_cmd_cas_addr_fifo.simple_get(); 6231 m_cmd_cas_eop_fifo.simple_get(); 6232 m_cmd_cas_srcid_fifo.simple_get(); 6233 m_cmd_cas_trdid_fifo.simple_get(); 6234 m_cmd_cas_pktid_fifo.simple_get(); 6235 m_cmd_cas_wdata_fifo.simple_get(); 6168 6236 } 6169 6237 } … … 6223 6291 } 6224 6292 //////////////////////////////////////////////////////////////////////////////////// 6225 // SCto INIT_CMD FIFO6293 // CAS to INIT_CMD FIFO 6226 6294 //////////////////////////////////////////////////////////////////////////////////// 6227 6295 6228 if ( sc_to_init_cmd_fifo_put ) {6229 if ( sc_to_init_cmd_fifo_get ) {6230 m_ sc_to_init_cmd_inst_fifo.put_and_get(sc_to_init_cmd_fifo_inst);6231 m_ sc_to_init_cmd_srcid_fifo.put_and_get(sc_to_init_cmd_fifo_srcid);6296 if ( cas_to_init_cmd_fifo_put ) { 6297 if ( cas_to_init_cmd_fifo_get ) { 6298 m_cas_to_init_cmd_inst_fifo.put_and_get(cas_to_init_cmd_fifo_inst); 6299 m_cas_to_init_cmd_srcid_fifo.put_and_get(cas_to_init_cmd_fifo_srcid); 6232 6300 #if L1_MULTI_CACHE 6233 m_ sc_to_init_cmd_cache_id_fifo.put_and_get(sc_to_init_cmd_fifo_cache_id);6301 m_cas_to_init_cmd_cache_id_fifo.put_and_get(cas_to_init_cmd_fifo_cache_id); 6234 6302 #endif 6235 6303 } else { 6236 m_ sc_to_init_cmd_inst_fifo.simple_put(sc_to_init_cmd_fifo_inst);6237 m_ sc_to_init_cmd_srcid_fifo.simple_put(sc_to_init_cmd_fifo_srcid);6304 m_cas_to_init_cmd_inst_fifo.simple_put(cas_to_init_cmd_fifo_inst); 6305 m_cas_to_init_cmd_srcid_fifo.simple_put(cas_to_init_cmd_fifo_srcid); 6238 6306 #if L1_MULTI_CACHE 6239 m_ sc_to_init_cmd_cache_id_fifo.simple_put(sc_to_init_cmd_fifo_cache_id);6307 m_cas_to_init_cmd_cache_id_fifo.simple_put(cas_to_init_cmd_fifo_cache_id); 6240 6308 #endif 6241 6309 } 6242 6310 } else { 6243 if ( sc_to_init_cmd_fifo_get ) {6244 m_ sc_to_init_cmd_inst_fifo.simple_get();6245 m_ sc_to_init_cmd_srcid_fifo.simple_get();6311 if ( cas_to_init_cmd_fifo_get ) { 6312 m_cas_to_init_cmd_inst_fifo.simple_get(); 6313 m_cas_to_init_cmd_srcid_fifo.simple_get(); 6246 6314 #if L1_MULTI_CACHE 6247 m_ sc_to_init_cmd_cache_id_fifo.simple_get();6315 m_cas_to_init_cmd_cache_id_fifo.simple_get(); 6248 6316 #endif 6249 6317 } … … 6280 6348 p_vci_ixr.eop = true; 6281 6349 } 6282 else if ( r_ixr_cmd_fsm.read() == IXR_CMD_ SC_NLINE ) {6283 if(r_ sc_to_ixr_cmd_write.read()){6350 else if ( r_ixr_cmd_fsm.read() == IXR_CMD_CAS_NLINE ) { 6351 if(r_cas_to_ixr_cmd_write.read()){ 6284 6352 p_vci_ixr.cmd = vci_param::CMD_WRITE; 6285 6353 p_vci_ixr.cmdval = true; 6286 p_vci_ixr.address = (addr_t)((r_ sc_to_ixr_cmd_nline.read()*m_words+r_ixr_cmd_cpt.read())*4);6354 p_vci_ixr.address = (addr_t)((r_cas_to_ixr_cmd_nline.read()*m_words+r_ixr_cmd_cpt.read())*4); 6287 6355 p_vci_ixr.plen = m_words*4; 6288 p_vci_ixr.wdata = r_ sc_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read();6289 p_vci_ixr.trdid = r_ sc_to_ixr_cmd_trdid.read();6356 p_vci_ixr.wdata = r_cas_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read(); 6357 p_vci_ixr.trdid = r_cas_to_ixr_cmd_trdid.read(); 6290 6358 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words-1)); 6291 6359 } else { 6292 6360 p_vci_ixr.cmd = vci_param::CMD_READ; 6293 6361 p_vci_ixr.cmdval = true; 6294 p_vci_ixr.address = (addr_t)(r_ sc_to_ixr_cmd_nline.read()*m_words*4);6362 p_vci_ixr.address = (addr_t)(r_cas_to_ixr_cmd_nline.read()*m_words*4); 6295 6363 p_vci_ixr.plen = m_words*4; 6296 6364 p_vci_ixr.wdata = 0x00000000; 6297 p_vci_ixr.trdid = r_ sc_to_ixr_cmd_trdid.read();6365 p_vci_ixr.trdid = r_cas_to_ixr_cmd_trdid.read(); 6298 6366 p_vci_ixr.eop = true; 6299 6367 } … … 6358 6426 p_vci_tgt.cmdack = m_cmd_write_addr_fifo.wok(); 6359 6427 break; 6360 case TGT_CMD_ ATOMIC:6361 p_vci_tgt.cmdack = m_cmd_ sc_addr_fifo.wok();6428 case TGT_CMD_CAS: 6429 p_vci_tgt.cmdack = m_cmd_cas_addr_fifo.wok(); 6362 6430 break; 6363 6431 default: 6364 p_vci_tgt.cmdack = false;6432 p_vci_tgt.cmdack = false; 6365 6433 break; 6366 6434 } … … 6373 6441 case TGT_RSP_READ_IDLE: 6374 6442 case TGT_RSP_WRITE_IDLE: 6375 case TGT_RSP_ SC_IDLE:6443 case TGT_RSP_CAS_IDLE: 6376 6444 case TGT_RSP_XRAM_IDLE: 6377 6445 case TGT_RSP_INIT_IDLE: … … 6409 6477 p_vci_tgt.rtrdid = r_cleanup_to_tgt_rsp_trdid.read(); 6410 6478 p_vci_tgt.rpktid = r_cleanup_to_tgt_rsp_pktid.read(); 6411 p_vci_tgt.rerror = 0; // Can be a SCrsp6479 p_vci_tgt.rerror = 0; // Can be a CAS rsp 6412 6480 p_vci_tgt.reop = true; 6413 6481 break; 6414 case TGT_RSP_ SC:6482 case TGT_RSP_CAS: 6415 6483 p_vci_tgt.rspval = true; 6416 p_vci_tgt.rdata = r_ sc_to_tgt_rsp_data.read();6417 p_vci_tgt.rsrcid = r_ sc_to_tgt_rsp_srcid.read();6418 p_vci_tgt.rtrdid = r_ sc_to_tgt_rsp_trdid.read();6419 p_vci_tgt.rpktid = r_ sc_to_tgt_rsp_pktid.read();6484 p_vci_tgt.rdata = r_cas_to_tgt_rsp_data.read(); 6485 p_vci_tgt.rsrcid = r_cas_to_tgt_rsp_srcid.read(); 6486 p_vci_tgt.rtrdid = r_cas_to_tgt_rsp_trdid.read(); 6487 p_vci_tgt.rpktid = r_cas_to_tgt_rsp_pktid.read(); 6420 6488 p_vci_tgt.rerror = 0; 6421 6489 p_vci_tgt.reop = true; … … 6438 6506 p_vci_tgt.rtrdid = r_init_rsp_to_tgt_rsp_trdid.read(); 6439 6507 p_vci_tgt.rpktid = r_init_rsp_to_tgt_rsp_pktid.read(); 6440 p_vci_tgt.rerror = 0; // Can be a SCrsp6508 p_vci_tgt.rerror = 0; // Can be a CAS rsp 6441 6509 p_vci_tgt.reop = true; 6442 6510 break; … … 6460 6528 case INIT_CMD_UPDT_IDLE: 6461 6529 case INIT_CMD_INVAL_IDLE: 6462 case INIT_CMD_ SC_UPDT_IDLE:6530 case INIT_CMD_CAS_UPDT_IDLE: 6463 6531 p_vci_ini.cmdval = false; 6464 6532 p_vci_ini.address = 0; … … 6578 6646 break; 6579 6647 6580 case INIT_CMD_ SC_BRDCAST:6648 case INIT_CMD_CAS_BRDCAST: 6581 6649 p_vci_ini.cmdval = true; 6582 6650 p_vci_ini.address = m_broadcast_address; 6583 p_vci_ini.wdata = (addr_t)r_ sc_to_init_cmd_nline.read();6584 p_vci_ini.be = ((r_ sc_to_init_cmd_nline.read() >> 32) & 0x3);6651 p_vci_ini.wdata = (addr_t)r_cas_to_init_cmd_nline.read(); 6652 p_vci_ini.be = ((r_cas_to_init_cmd_nline.read() >> 32) & 0x3); 6585 6653 p_vci_ini.plen = 4 ; 6586 6654 p_vci_ini.eop = true; 6587 p_vci_ini.trdid = r_ sc_to_init_cmd_trdid.read();6655 p_vci_ini.trdid = r_cas_to_init_cmd_trdid.read(); 6588 6656 p_vci_ini.pktid = 0; 6589 6657 break; 6590 case INIT_CMD_ SC_UPDT_NLINE:6658 case INIT_CMD_CAS_UPDT_NLINE: 6591 6659 vci_ini_address = (vci_addr_t) 6592 m_ sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);6593 6594 p_vci_ini.cmdval = m_ sc_to_init_cmd_inst_fifo.rok();6595 if(m_ sc_to_init_cmd_inst_fifo.rok()){6596 if( m_ sc_to_init_cmd_inst_fifo.read() ) {6660 m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S); 6661 6662 p_vci_ini.cmdval = m_cas_to_init_cmd_inst_fifo.rok(); 6663 if(m_cas_to_init_cmd_inst_fifo.rok()){ 6664 if( m_cas_to_init_cmd_inst_fifo.read() ) { 6597 6665 p_vci_ini.address = (addr_t)(vci_ini_address + 12); 6598 6666 } else { … … 6602 6670 p_vci_ini.address = 0; 6603 6671 } 6604 p_vci_ini.wdata = (uint32_t)r_ sc_to_init_cmd_nline.read();6605 p_vci_ini.be = ((r_ sc_to_init_cmd_nline.read() >> 32 ) & 0x3);6606 if(r_ sc_to_init_cmd_is_long.read()){6672 p_vci_ini.wdata = (uint32_t)r_cas_to_init_cmd_nline.read(); 6673 p_vci_ini.be = ((r_cas_to_init_cmd_nline.read() >> 32 ) & 0x3); 6674 if(r_cas_to_init_cmd_is_long.read()){ 6607 6675 p_vci_ini.plen = 4 * 4; 6608 6676 } else { … … 6610 6678 } 6611 6679 p_vci_ini.eop = false; 6612 p_vci_ini.trdid = r_ sc_to_init_cmd_trdid.read();6680 p_vci_ini.trdid = r_cas_to_init_cmd_trdid.read(); 6613 6681 #if L1_MULTI_CACHE 6614 p_vci_ini.pktid = m_ sc_to_init_cmd_cache_id_fifo.read();6682 p_vci_ini.pktid = m_cas_to_init_cmd_cache_id_fifo.read(); 6615 6683 #endif 6616 6684 break; 6617 case INIT_CMD_ SC_UPDT_INDEX:6685 case INIT_CMD_CAS_UPDT_INDEX: 6618 6686 vci_ini_address = (vci_addr_t) 6619 m_ sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);6687 m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S); 6620 6688 6621 6689 p_vci_ini.cmdval = true; 6622 if( m_ sc_to_init_cmd_inst_fifo.read() ) {6690 if( m_cas_to_init_cmd_inst_fifo.read() ) { 6623 6691 p_vci_ini.address = (addr_t)(vci_ini_address + 12); 6624 6692 } else { 6625 6693 p_vci_ini.address = (addr_t)(vci_ini_address + 8); 6626 6694 } 6627 p_vci_ini.wdata = r_ sc_to_init_cmd_index.read();6695 p_vci_ini.wdata = r_cas_to_init_cmd_index.read(); 6628 6696 p_vci_ini.be = 0xF; 6629 if(r_ sc_to_init_cmd_is_long.read()){6697 if(r_cas_to_init_cmd_is_long.read()){ 6630 6698 p_vci_ini.plen = 4 * 4; 6631 6699 } else { 6632 6700 p_vci_ini.plen = 4 * 3; 6633 6701 } 6634 p_vci_ini.trdid = r_ sc_to_init_cmd_trdid.read();6702 p_vci_ini.trdid = r_cas_to_init_cmd_trdid.read(); 6635 6703 #if L1_MULTI_CACHE 6636 p_vci_ini.pktid = m_ sc_to_init_cmd_cache_id_fifo.read();6704 p_vci_ini.pktid = m_cas_to_init_cmd_cache_id_fifo.read(); 6637 6705 #endif 6638 6706 p_vci_ini.eop = false; 6639 6707 break; 6640 case INIT_CMD_ SC_UPDT_DATA:6708 case INIT_CMD_CAS_UPDT_DATA: 6641 6709 vci_ini_address = (vci_addr_t) 6642 m_ sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);6710 m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S); 6643 6711 6644 6712 p_vci_ini.cmdval = true; 6645 if( m_ sc_to_init_cmd_inst_fifo.read() ) {6713 if( m_cas_to_init_cmd_inst_fifo.read() ) { 6646 6714 p_vci_ini.address = (addr_t)(vci_ini_address + 12); 6647 6715 } else { 6648 6716 p_vci_ini.address = (addr_t)(vci_ini_address + 8); 6649 6717 } 6650 p_vci_ini.wdata = r_ sc_to_init_cmd_wdata.read();6718 p_vci_ini.wdata = r_cas_to_init_cmd_wdata.read(); 6651 6719 p_vci_ini.be = 0xF; 6652 p_vci_ini.trdid = r_ sc_to_init_cmd_trdid.read();6720 p_vci_ini.trdid = r_cas_to_init_cmd_trdid.read(); 6653 6721 #if L1_MULTI_CACHE 6654 p_vci_ini.pktid = m_ sc_to_init_cmd_cache_id_fifo.read();6655 #endif 6656 if(r_ sc_to_init_cmd_is_long.read()){6722 p_vci_ini.pktid = m_cas_to_init_cmd_cache_id_fifo.read(); 6723 #endif 6724 if(r_cas_to_init_cmd_is_long.read()){ 6657 6725 p_vci_ini.plen = 4 * 4; 6658 6726 p_vci_ini.eop = false; … … 6662 6730 } 6663 6731 break; 6664 case INIT_CMD_ SC_UPDT_DATA_HIGH:6732 case INIT_CMD_CAS_UPDT_DATA_HIGH: 6665 6733 vci_ini_address = (vci_addr_t) 6666 m_ sc_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S);6734 m_cas_to_init_cmd_srcid_fifo.read() << (vci_param::N - vci_param::S); 6667 6735 6668 6736 p_vci_ini.cmdval = true; 6669 if( m_ sc_to_init_cmd_inst_fifo.read() ) {6737 if( m_cas_to_init_cmd_inst_fifo.read() ) { 6670 6738 p_vci_ini.address = (addr_t)(vci_ini_address + 12); 6671 6739 } else { 6672 6740 p_vci_ini.address = (addr_t)(vci_ini_address + 8); 6673 6741 } 6674 p_vci_ini.wdata = r_ sc_to_init_cmd_wdata_high.read();6742 p_vci_ini.wdata = r_cas_to_init_cmd_wdata_high.read(); 6675 6743 p_vci_ini.be = 0xF; 6676 6744 p_vci_ini.plen = 4 * 4; 6677 p_vci_ini.trdid = r_ sc_to_init_cmd_trdid.read();6745 p_vci_ini.trdid = r_cas_to_init_cmd_trdid.read(); 6678 6746 #if L1_MULTI_CACHE 6679 p_vci_ini.pktid = m_ sc_to_init_cmd_cache_id_fifo.read();6747 p_vci_ini.pktid = m_cas_to_init_cmd_cache_id_fifo.read(); 6680 6748 #endif 6681 6749 p_vci_ini.eop = true;
Note: See TracChangeset
for help on using the changeset viewer.