Changeset 477 for branches/RWT/modules/vci_mem_cache/caba/source
- Timestamp:
- Jul 26, 2013, 5:03:12 PM (11 years ago)
- Location:
- branches/RWT
- Files:
-
- 2 added
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/RWT/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
r449 r477 96 96 97 97 bool valid; // entry valid 98 bool cache_coherent; // WB or WT policy 98 99 bool is_cnt; // directory entry is in counter mode 99 100 bool dirty; // entry dirty … … 107 108 { 108 109 valid = false; 110 cache_coherent= false; 109 111 is_cnt = false; 110 112 dirty = false; … … 123 125 { 124 126 valid = source.valid; 127 cache_coherent= source.cache_coherent; 125 128 is_cnt = source.is_cnt; 126 129 dirty = source.dirty; … … 138 141 { 139 142 valid = false; 143 cache_coherent = false; 140 144 is_cnt = false; 141 145 dirty = false; … … 150 154 { 151 155 valid = source.valid; 156 cache_coherent = source.cache_coherent; 152 157 is_cnt = source.is_cnt; 153 158 dirty = source.dirty; … … 165 170 { 166 171 std::cout << "Valid = " << valid 172 << " ; COHERENCE = " << cache_coherent 167 173 << " ; IS COUNT = " << is_cnt 168 174 << " ; Dirty = " << dirty -
branches/RWT/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r468 r477 131 131 CC_SEND_XRAM_RSP_INVAL_HEADER, 132 132 CC_SEND_XRAM_RSP_INVAL_NLINE, 133 CC_SEND_READ_NCC_INVAL_HEADER, 134 CC_SEND_READ_NCC_INVAL_NLINE, 135 CC_SEND_WRITE_NCC_INVAL_HEADER, 136 CC_SEND_WRITE_NCC_INVAL_NLINE, 133 137 CC_SEND_WRITE_BRDCAST_HEADER, 134 138 CC_SEND_WRITE_BRDCAST_NLINE, … … 178 182 READ_DIR_REQ, 179 183 READ_DIR_LOCK, 184 READ_IVT_LOCK, 185 READ_WAIT, 180 186 READ_DIR_HIT, 181 187 READ_HEAP_REQ, … … 197 203 WRITE_DIR_REQ, 198 204 WRITE_DIR_LOCK, 205 WRITE_IVT_LOCK_HIT_WB, 199 206 WRITE_DIR_READ, 200 207 WRITE_DIR_HIT, … … 205 212 WRITE_UPT_DEC, 206 213 WRITE_RSP, 214 WRITE_MISS_IVT_LOCK, 207 215 WRITE_MISS_TRT_LOCK, 208 216 WRITE_MISS_TRT_DATA, … … 253 261 IXR_CMD_CAS_IDLE, 254 262 IXR_CMD_XRAM_IDLE, 263 IXR_CMD_CLEANUP_IDLE, 255 264 IXR_CMD_READ, 256 265 IXR_CMD_WRITE, 257 266 IXR_CMD_CAS, 258 IXR_CMD_XRAM 267 IXR_CMD_XRAM, 268 IXR_CMD_CLEANUP_DATA 259 269 }; 260 270 … … 290 300 CLEANUP_IDLE, 291 301 CLEANUP_GET_NLINE, 302 CLEANUP_GET_DATA, 292 303 CLEANUP_DIR_REQ, 293 304 CLEANUP_DIR_LOCK, 294 305 CLEANUP_DIR_WRITE, 306 CLEANUP_IVT_LOCK_DATA, 307 CLEANUP_IVT_CLEAR_DATA, 308 CLEANUP_READ_RSP, 295 309 CLEANUP_HEAP_REQ, 296 310 CLEANUP_HEAP_LOCK, … … 302 316 CLEANUP_IVT_CLEAR, 303 317 CLEANUP_WRITE_RSP, 318 CLEANUP_IXR_REQ, 319 CLEANUP_WAIT, 304 320 CLEANUP_CONFIG_ACK, 305 321 CLEANUP_SEND_CLACK … … 325 341 ALLOC_TRT_CAS, 326 342 ALLOC_TRT_XRAM_RSP, 327 ALLOC_TRT_IXR_RSP 343 ALLOC_TRT_IXR_RSP, 344 ALLOC_TRT_CLEANUP 328 345 }; 329 346 … … 340 357 { 341 358 ALLOC_IVT_WRITE, 359 ALLOC_IVT_READ, 342 360 ALLOC_IVT_XRAM_RSP, 343 361 ALLOC_IVT_CLEANUP, … … 434 452 uint32_t m_cpt_sc; // Number of SC transactions 435 453 uint32_t m_cpt_cas; // Number of CAS transactions 454 455 uint32_t m_cpt_read_fsm_dir_lock; // wait DIR LOCK 456 uint32_t m_cpt_read_fsm_n_dir_lock; // NB DIR LOCK 457 uint32_t m_cpt_write_fsm_dir_lock; // wait DIR LOCK 458 uint32_t m_cpt_write_fsm_n_dir_lock; // NB DIR LOCK 459 uint32_t m_cpt_xram_rsp_fsm_dir_lock; // wait DIR LOCK 460 uint32_t m_cpt_xram_rsp_fsm_n_dir_lock; // NB DIR LOCK 461 uint32_t m_cpt_cas_fsm_dir_lock; // wait DIR LOCK 462 uint32_t m_cpt_cas_fsm_n_dir_lock; // NB DIR LOCK 463 uint32_t m_cpt_cleanup_fsm_dir_lock; // wait DIR LOCK 464 uint32_t m_cpt_cleanup_fsm_n_dir_lock; // NB DIR LOCK 465 466 uint32_t m_cpt_dir_unused; // NB cycles DIR LOCK unused 467 uint32_t m_cpt_read_fsm_dir_used; // NB cycles DIR LOCK used 468 uint32_t m_cpt_write_fsm_dir_used; // NB cycles DIR LOCK used 469 uint32_t m_cpt_cas_fsm_dir_used; // NB cycles DIR LOCK used 470 uint32_t m_cpt_xram_rsp_fsm_dir_used; // NB cycles DIR LOCK used 471 uint32_t m_cpt_cleanup_fsm_dir_used; // NB cycles DIR LOCK used 472 473 uint32_t m_cpt_read_fsm_trt_lock; // wait TRT LOCK 474 uint32_t m_cpt_write_fsm_trt_lock; // wait TRT LOCK 475 uint32_t m_cpt_cas_fsm_trt_lock; // wait TRT LOCK 476 uint32_t m_cpt_xram_rsp_fsm_trt_lock; // wait TRT LOCK 477 uint32_t m_cpt_ixr_fsm_trt_lock; // wait TRT LOCK 478 479 uint32_t m_cpt_read_fsm_n_trt_lock; // NB TRT LOCK 480 uint32_t m_cpt_write_fsm_n_trt_lock; // NB TRT LOCK 481 uint32_t m_cpt_cas_fsm_n_trt_lock; // NB TRT LOCK 482 uint32_t m_cpt_xram_rsp_fsm_n_trt_lock; // NB TRT LOCK 483 uint32_t m_cpt_ixr_fsm_n_trt_lock; // NB TRT LOCK 484 485 uint32_t m_cpt_read_fsm_trt_used; // NB cycles TRT LOCK used 486 uint32_t m_cpt_write_fsm_trt_used; // NB cycles TRT LOCK used 487 uint32_t m_cpt_cas_fsm_trt_used; // NB cycles TRT LOCK used 488 uint32_t m_cpt_xram_rsp_fsm_trt_used; // NB cycles TRT LOCK used 489 uint32_t m_cpt_ixr_fsm_trt_used; // NB cycles TRT LOCK used 490 491 uint32_t m_cpt_trt_unused; // NB cycles TRT LOCK unused 492 493 uint32_t m_cpt_write_fsm_upt_lock; // wait UPT LOCK 494 uint32_t m_cpt_xram_rsp_fsm_upt_lock; // wait UPT LOCK 495 uint32_t m_cpt_multi_ack_fsm_upt_lock; // wait UPT LOCK 496 uint32_t m_cpt_cleanup_fsm_ivt_lock; // wait UPT LOCK 497 uint32_t m_cpt_cas_fsm_upt_lock; // wait UPT LOCK 498 499 uint32_t m_cpt_write_fsm_n_upt_lock; // NB UPT LOCK 500 uint32_t m_cpt_xram_rsp_fsm_n_upt_lock; // NB UPT LOCK 501 uint32_t m_cpt_multi_ack_fsm_n_upt_lock; // NB UPT LOCK 502 uint32_t m_cpt_cleanup_fsm_n_upt_lock; // NB UPT LOCK 503 uint32_t m_cpt_cas_fsm_n_upt_lock; // NB UPT LOCK 504 505 uint32_t m_cpt_write_fsm_upt_used; // NB cycles UPT LOCK used 506 uint32_t m_cpt_xram_rsp_fsm_upt_used; // NB cycles UPT LOCK used 507 uint32_t m_cpt_multi_ack_fsm_upt_used; // NB cycles UPT LOCK used 508 uint32_t m_cpt_cleanup_fsm_ivt_used; // NB cycles UPT LOCK used 509 uint32_t m_cpt_cas_fsm_upt_used; // NB cycles UPT LOCK used 510 511 uint32_t m_cpt_ivt_unused; // NB cycles UPT LOCK unused 512 uint32_t m_cpt_upt_unused; // NB cycles UPT LOCK unused 513 514 uint32_t m_cpt_read_fsm_heap_lock; // wait HEAP LOCK 515 uint32_t m_cpt_write_fsm_heap_lock; // wait HEAP LOCK 516 uint32_t m_cpt_cas_fsm_heap_lock; // wait HEAP LOCK 517 uint32_t m_cpt_cleanup_fsm_heap_lock; // wait HEAP LOCK 518 uint32_t m_cpt_xram_rsp_fsm_heap_lock; // wait HEAP LOCK 519 520 uint32_t m_cpt_read_fsm_n_heap_lock; // NB HEAP LOCK 521 uint32_t m_cpt_write_fsm_n_heap_lock; // NB HEAP LOCK 522 uint32_t m_cpt_cas_fsm_n_heap_lock; // NB HEAP LOCK 523 uint32_t m_cpt_cleanup_fsm_n_heap_lock; // NB HEAP LOCK 524 uint32_t m_cpt_xram_rsp_fsm_n_heap_lock; // NB HEAP LOCK 525 526 uint32_t m_cpt_read_fsm_heap_used; // NB cycles HEAP LOCK used 527 uint32_t m_cpt_write_fsm_heap_used; // NB cycles HEAP LOCK used 528 uint32_t m_cpt_cas_fsm_heap_used; // NB cycles HEAP LOCK used 529 uint32_t m_cpt_cleanup_fsm_heap_used; // NB cycles HEAP LOCK used 530 uint32_t m_cpt_xram_rsp_fsm_heap_used; // NB cycles HEAP LOCK used 531 532 uint32_t m_cpt_heap_unused; // NB cycles HEAP LOCK unused 533 534 //RWT 535 uint32_t m_cpt_cleanup_data; 536 uint32_t m_cpt_ncc_to_cc_read; // NB change from NCC to CC caused by a READ 537 uint32_t m_cpt_ncc_to_cc_write; // NB change from NCC to CC caused by a WRITE 538 uint32_t m_cpt_ncc_to_cc; // NB change from NCC to CC 539 540 uint32_t m_cpt_read_data_unc; 541 uint32_t m_cpt_read_data_miss_CC; 542 uint32_t m_cpt_read_ins_unc; 543 uint32_t m_cpt_read_ins_miss; 544 uint32_t m_cpt_read_ll_CC; 545 uint32_t m_cpt_read_data_miss_NCC; 546 uint32_t m_cpt_read_ll_NCC; 547 uint32_t m_cpt_read_WTF; 436 548 437 549 uint32_t m_cpt_cleanup_cost; // Number of (flits * distance) for CLEANUPs … … 481 593 ~VciMemCache(); 482 594 595 void clear_stats(); 483 596 void print_stats(); 484 597 void print_trace(); … … 657 770 sc_signal<addr_t> r_read_to_tgt_rsp_ll_key; // LL key from the llsc_global_table 658 771 772 //RWT: Buffer between READ fsm and CC_SEND fsm (send inval) 773 sc_signal<bool> r_read_to_cc_send_req; 774 sc_signal<size_t> r_read_to_cc_send_dest; 775 sc_signal<addr_t> r_read_to_cc_send_nline; 776 sc_signal<bool> r_read_to_cc_send_inst; 777 778 //RWT: Buffer between READ fsm and CLEANUP fsm (wait for the data coming from L1 cache) 779 sc_signal<bool> r_read_to_cleanup_req; // valid request 780 sc_signal<addr_t> r_read_to_cleanup_nline; // cache line index 781 sc_signal<size_t> r_read_to_cleanup_srcid; 782 sc_signal<size_t> r_read_to_cleanup_length; 783 sc_signal<size_t> r_read_to_cleanup_first_word; 784 sc_signal<bool> r_read_to_cleanup_cached_read; 785 sc_signal<bool> r_read_to_cleanup_is_ll; 786 sc_signal<addr_t> r_read_to_cleanup_addr; 787 sc_signal<addr_t> r_read_to_cleanup_ll_key; 788 789 //RWT: 790 sc_signal<bool> r_read_coherent; // State of the cache slot after transaction 791 sc_signal<bool> r_read_ll_done; 792 659 793 /////////////////////////////////////////////////////////////// 660 794 // Registers controlled by the WRITE fsm … … 721 855 sc_signal<size_t> r_write_to_multi_ack_upt_index; // index in update table 722 856 857 // RWT: Buffer between WRITE fsm and CLEANUP fsm (change slot state) 858 sc_signal<bool> r_write_to_cleanup_req; // valid request 859 sc_signal<addr_t> r_write_to_cleanup_nline; // cache line index 860 861 // RWT 862 sc_signal<bool> r_write_coherent; // cache slot state after transaction 863 864 //Buffer between WRITE fsm and CC_SEND fsm (INVAL for RWT) 865 sc_signal<bool> r_write_to_cc_send_req; 866 sc_signal<size_t> r_write_to_cc_send_dest; 867 868 723 869 ///////////////////////////////////////////////////////// 724 870 // Registers controlled by MULTI_ACK fsm … … 788 934 sc_signal<size_t> r_cleanup_to_tgt_rsp_trdid; // transaction trdid 789 935 sc_signal<size_t> r_cleanup_to_tgt_rsp_pktid; // transaction pktid 936 sc_signal<addr_t> r_cleanup_to_tgt_rsp_ll_key; 937 938 //RWT 939 sc_signal<size_t> r_cleanup_read_srcid; 940 sc_signal<size_t> r_cleanup_read_trdid; 941 sc_signal<size_t> r_cleanup_read_pktid; 942 sc_signal<bool> r_cleanup_read_need_rsp; 943 sc_signal<bool> r_cleanup_to_tgt_rsp_type; 944 sc_signal<data_t> * r_cleanup_to_tgt_rsp_data; 945 sc_signal<size_t> r_cleanup_to_tgt_rsp_length; 946 sc_signal<size_t> r_cleanup_to_tgt_rsp_first_word; 790 947 791 948 /////////////////////////////////////////////////////// … … 813 970 sc_signal<data_t> * r_cas_data; // cache line data 814 971 972 sc_signal<bool> r_cas_coherent; 973 815 974 // Buffer between CAS fsm and IXR_CMD fsm (XRAM write) 816 975 sc_signal<bool> r_cas_to_ixr_cmd_req; // valid request … … 906 1065 sc_signal<size_t> r_xram_rsp_to_ixr_cmd_trdid; // index in transaction table 907 1066 1067 //RWT 1068 sc_signal<bool> r_xram_rsp_victim_coherent; // victim's cache slot state 1069 sc_signal<bool> r_xram_rsp_coherent; // coherence of the read 908 1070 //////////////////////////////////////////////////// 909 1071 // Registers controlled by the IXR_CMD fsm … … 966 1128 sc_signal<int> r_alloc_heap_fsm; 967 1129 sc_signal<unsigned> r_alloc_heap_reset_cpt; 1130 1131 1132 //////////////////////////////////////////////////// 1133 // REGISTERS FOR ODCCP 1134 //////////////////////////////////////////////////// 1135 1136 sc_signal<uint32_t> r_cleanup_data_index; 1137 sc_signal<uint32_t> r_cleanup_trdid; 1138 sc_signal<uint32_t> r_cleanup_pktid; 1139 sc_signal<bool> r_cleanup_coherent; 1140 sc_signal<data_t> *r_cleanup_data; 1141 sc_signal<data_t> *r_cleanup_old_data; 1142 sc_signal<bool> r_cleanup_contains_data; 1143 1144 sc_signal<bool> r_cleanup_ncc; 1145 sc_signal<bool> r_cleanup_to_ixr_cmd_ncc_l1_dirty; 1146 sc_signal<bool> r_xram_rsp_to_ixr_cmd_inval_ncc_pending; 1147 1148 sc_signal<bool> r_cleanup_to_ixr_cmd_req; 1149 sc_signal<data_t> *r_cleanup_to_ixr_cmd_data; 1150 sc_signal<uint32_t> r_cleanup_to_ixr_cmd_srcid; 1151 sc_signal<uint32_t> r_cleanup_to_ixr_cmd_trdid; 1152 sc_signal<uint32_t> r_cleanup_to_ixr_cmd_pktid; 1153 sc_signal<addr_t> r_cleanup_to_ixr_cmd_nline; 968 1154 }; // end class VciMemCache 969 1155 -
branches/RWT/modules/vci_mem_cache/caba/source/include/xram_transaction.h
r422 r477 294 294 } 295 295 296 /////////////////////////////////////////////////////////////////////// 297 // The hit_write() function looks if an XRAM write transaction exists 298 // for a given line. 299 // Arguments : 300 // - index : (return argument) the index of the hit entry, if there is 301 // - nline : the index (zy) of the requested line 302 // The function returns true if a write request has already been sent 303 /////////////////////////////////////////////////////////////////////// 304 bool hit_write(const addr_t nline, size_t* index) 305 { 306 for(size_t i=0; i<size_tab; i++){ 307 if(tab[i].valid && (nline==tab[i].nline) && !(tab[i].xram_read)) { 308 *index = i; 309 return true; 310 } 311 } 312 return false; 313 } 296 314 ///////////////////////////////////////////////////////////////////// 297 315 // The write_data_mask() function writes a vector of data (a line). -
branches/RWT/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
r468 r477 107 107 "CC_SEND_XRAM_RSP_INVAL_HEADER", 108 108 "CC_SEND_XRAM_RSP_INVAL_NLINE", 109 "CC_SEND_READ_NCC_INVAL_HEADER", 110 "CC_SEND_READ_NCC_INVAL_NLINE", 111 "CC_SEND_WRITE_NCC_INVAL_HEADER", 112 "CC_SEND_WRITE_NCC_INVAL_NLINE", 109 113 "CC_SEND_WRITE_BRDCAST_HEADER", 110 114 "CC_SEND_WRITE_BRDCAST_NLINE", … … 148 152 "READ_DIR_REQ", 149 153 "READ_DIR_LOCK", 154 "READ_IVT_LOCK", 155 "READ_WAIT", 150 156 "READ_DIR_HIT", 151 157 "READ_HEAP_REQ", … … 165 171 "WRITE_DIR_REQ", 166 172 "WRITE_DIR_LOCK", 173 "WRITE_IVT_LOCK_HIT_WB", 167 174 "WRITE_DIR_READ", 168 175 "WRITE_DIR_HIT", … … 173 180 "WRITE_UPT_DEC", 174 181 "WRITE_RSP", 182 "WRITE_MISS_IVT_LOCK", 175 183 "WRITE_MISS_TRT_LOCK", 176 184 "WRITE_MISS_TRT_DATA", … … 215 223 "IXR_CMD_CAS_IDLE", 216 224 "IXR_CMD_XRAM_IDLE", 225 "IXR_CMD_CLEANUP_IDLE", 217 226 "IXR_CMD_READ", 218 227 "IXR_CMD_WRITE", 219 228 "IXR_CMD_CAS", 220 "IXR_CMD_XRAM" 229 "IXR_CMD_XRAM", 230 "IXR_CMD_CLEANUP_DATA" 221 231 }; 222 232 const char *cas_fsm_str[] = … … 248 258 "CLEANUP_IDLE", 249 259 "CLEANUP_GET_NLINE", 260 "CLEANUP_GET_DATA", 250 261 "CLEANUP_DIR_REQ", 251 262 "CLEANUP_DIR_LOCK", 252 263 "CLEANUP_DIR_WRITE", 264 "CLEANUP_IVT_LOCK_DATA", 265 "CLEANUP_IVT_CLEAR_DATA", 266 "CLEANUP_READ_RSP", 253 267 "CLEANUP_HEAP_REQ", 254 268 "CLEANUP_HEAP_LOCK", … … 260 274 "CLEANUP_IVT_CLEAR", 261 275 "CLEANUP_WRITE_RSP", 276 "CLEANUP_IXR_REQ", 277 "CLEANUP_WAIT", 262 278 "CLEANUP_CONFIG_ACK", 263 279 "CLEANUP_SEND_CLACK" … … 279 295 "ALLOC_TRT_CAS", 280 296 "ALLOC_TRT_XRAM_RSP", 281 "ALLOC_TRT_IXR_RSP" 297 "ALLOC_TRT_IXR_RSP", 298 "ALLOC_TRT_CLEANUP" 282 299 }; 283 300 const char *alloc_upt_fsm_str[] = … … 290 307 { 291 308 "ALLOC_IVT_WRITE", 309 "ALLOC_IVT_READ", 292 310 "ALLOC_IVT_XRAM_RSP", 293 311 "ALLOC_IVT_CLEANUP", … … 339 357 : soclib::caba::BaseModule(name), 340 358 359 m_monitor_ok(false), 341 360 p_clk( "p_clk" ), 342 361 p_resetn( "p_resetn" ), … … 526 545 r_cas_data = new sc_signal<data_t>[nwords]; 527 546 r_cas_rdata = new sc_signal<data_t>[2]; 547 548 // Allocation for ODCCP 549 r_cleanup_data = new sc_signal<data_t>[nwords]; 550 r_cleanup_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 551 r_cleanup_to_tgt_rsp_data = new sc_signal<data_t>[nwords]; 552 r_cleanup_old_data = new sc_signal<data_t>[nwords]; 528 553 529 554 // Allocation for debug … … 641 666 642 667 ///////////////////////////////////////// 668 tmpl(void) ::clear_stats() 669 ///////////////////////////////////////// 670 { 671 672 m_cpt_cycles = 0; 673 m_cpt_read = 0; 674 m_cpt_read_miss = 0; 675 m_cpt_write = 0; 676 m_cpt_write_miss = 0; 677 m_cpt_write_cells = 0; 678 m_cpt_write_dirty = 0; 679 m_cpt_update = 0; 680 m_cpt_update_mult = 0; 681 m_cpt_inval_brdcast = 0; 682 m_cpt_inval = 0; 683 m_cpt_inval_mult = 0; 684 m_cpt_cleanup = 0; 685 m_cpt_ll = 0; 686 m_cpt_sc = 0; 687 m_cpt_cas = 0; 688 m_cpt_trt_full = 0; 689 m_cpt_trt_rb = 0; 690 m_cpt_dir_unused = 0; 691 m_cpt_ivt_unused = 0; 692 m_cpt_upt_unused = 0; 693 m_cpt_heap_unused = 0; 694 m_cpt_trt_unused = 0; 695 m_cpt_read_fsm_n_dir_lock = 0; 696 m_cpt_read_fsm_dir_lock = 0; 697 m_cpt_read_fsm_dir_used = 0; 698 m_cpt_read_fsm_trt_lock = 0; 699 m_cpt_read_fsm_heap_lock = 0; 700 m_cpt_write_fsm_dir_lock = 0; 701 m_cpt_write_fsm_n_dir_lock = 0; 702 m_cpt_write_fsm_upt_lock = 0; 703 m_cpt_write_fsm_heap_lock = 0; 704 m_cpt_write_fsm_dir_used = 0; 705 m_cpt_write_fsm_trt_lock = 0; 706 m_cpt_cas_fsm_n_dir_lock = 0; 707 m_cpt_cas_fsm_dir_lock = 0; 708 m_cpt_cas_fsm_upt_lock = 0; 709 m_cpt_cas_fsm_heap_lock = 0; 710 m_cpt_cas_fsm_trt_lock = 0; 711 m_cpt_cas_fsm_dir_used = 0; 712 m_cpt_xram_rsp_fsm_n_dir_lock = 0; 713 m_cpt_xram_rsp_fsm_dir_lock = 0; 714 m_cpt_xram_rsp_fsm_trt_lock = 0; 715 m_cpt_xram_rsp_fsm_upt_lock = 0; 716 m_cpt_xram_rsp_fsm_heap_lock = 0; 717 m_cpt_xram_rsp_fsm_dir_used = 0; 718 m_cpt_cleanup_fsm_dir_lock = 0; 719 m_cpt_cleanup_fsm_n_dir_lock = 0; 720 m_cpt_cleanup_fsm_heap_lock = 0; 721 m_cpt_cleanup_fsm_ivt_lock = 0; 722 m_cpt_cleanup_fsm_dir_used = 0; 723 m_cpt_ixr_fsm_trt_lock = 0; 724 m_cpt_multi_ack_fsm_upt_lock = 0; 725 m_cpt_read_data_unc = 0; 726 m_cpt_read_data_miss_CC = 0; 727 m_cpt_read_ins_unc = 0; 728 m_cpt_read_ins_miss = 0; 729 m_cpt_read_ll_CC = 0; 730 m_cpt_read_data_miss_NCC = 0; 731 m_cpt_read_ll_NCC = 0; 732 m_cpt_read_WTF = 0; 733 m_cpt_cleanup_data = 0; 734 m_cpt_ncc_to_cc_read = 0; 735 m_cpt_ncc_to_cc_write = 0; 736 m_cpt_ncc_to_cc = 0; 737 } 738 739 ///////////////////////////////////////// 643 740 tmpl(void) ::print_stats() 644 741 ///////////////////////////////////////// … … 647 744 std::cout 648 745 << "MEM_CACHE " << name() << " / Time = " << m_cpt_cycles << std::endl 649 << "- READ RATE = " << (double) m_cpt_read/m_cpt_cycles << std::endl 650 << "- READ TOTAL = " << m_cpt_read << std::endl 651 << "- READ MISS RATE = " << (double) m_cpt_read_miss/m_cpt_read << std::endl 652 << "- WRITE RATE = " << (double) m_cpt_write/m_cpt_cycles << std::endl 653 << "- WRITE TOTAL = " << m_cpt_write << std::endl 654 << "- WRITE MISS RATE = " << (double) m_cpt_write_miss/m_cpt_write << std::endl 655 << "- WRITE BURST LENGTH = " << (double) m_cpt_write_cells/m_cpt_write << std::endl 656 << "- WRITE BURST TOTAL = " << m_cpt_write_cells << std::endl 657 << "- REQUESTS TRT FULL = " << m_cpt_trt_full << std::endl 658 << "- READ TRT BLOKED HIT = " << m_cpt_trt_rb << std::endl 659 << "- UPDATE RATE = " << (double) m_cpt_update/m_cpt_cycles << std::endl 660 << "- UPDATE ARITY = " << (double) m_cpt_update_mult/m_cpt_update << std::endl 661 << "- INVAL MULTICAST RATE = " << (double)(m_cpt_inval-m_cpt_inval_brdcast) /m_cpt_cycles << std::endl 662 << "- INVAL MULTICAST ARITY= " << (double) m_cpt_inval_mult/ (m_cpt_inval-m_cpt_inval_brdcast) << std::endl 663 << "- INVAL BROADCAST RATE = " << (double) m_cpt_inval_brdcast/m_cpt_cycles << std::endl 664 << "- SAVE DIRTY RATE = " << (double) m_cpt_write_dirty/m_cpt_cycles << std::endl 665 << "- CLEANUP RATE = " << (double) m_cpt_cleanup/m_cpt_cycles << std::endl 666 << "- LL RATE = " << (double) m_cpt_ll/m_cpt_cycles << std::endl 667 << "- SC RATE = " << (double) m_cpt_sc/m_cpt_cycles << std::endl 668 << "- CAS RATE = " << (double) m_cpt_cas/m_cpt_cycles << std::endl; 746 << "- READ RATE = " << (double) m_cpt_read/m_cpt_cycles << std::endl 747 << "- READ TOTAL = " << m_cpt_read << std::endl 748 << "- READ MISS RATE = " << (double) m_cpt_read_miss/m_cpt_read << std::endl 749 << "- WRITE RATE = " << (double) m_cpt_write/m_cpt_cycles << std::endl 750 << "- WRITE TOTAL = " << m_cpt_write << std::endl 751 << "- WRITE MISS RATE = " << (double) m_cpt_write_miss/m_cpt_write << std::endl 752 << "- WRITE BURST LENGTH = " << (double) m_cpt_write_cells/m_cpt_write << std::endl 753 << "- WRITE BURST TOTAL = " << m_cpt_write_cells << std::endl 754 << "- REQUESTS TRT FULL = " << m_cpt_trt_full << std::endl 755 << "- READ TRT BLOKED HIT = " << m_cpt_trt_rb << std::endl 756 << "- UPDATE RATE = " << (double) m_cpt_update/m_cpt_cycles << std::endl 757 << "- UPDATE ARITY = " << (double) m_cpt_update_mult/m_cpt_update << std::endl 758 << "- INVAL MULTICAST RATE = " << (double)(m_cpt_inval-m_cpt_inval_brdcast) /m_cpt_cycles << std::endl 759 << "- INVAL MULTICAST ARITY = " << (double) m_cpt_inval_mult/ (m_cpt_inval-m_cpt_inval_brdcast) << std::endl 760 << "- INVAL BROADCAST RATE = " << (double) m_cpt_inval_brdcast/m_cpt_cycles << std::endl 761 << "- SAVE DIRTY RATE = " << (double) m_cpt_write_dirty/m_cpt_cycles << std::endl 762 << "- CLEANUP RATE = " << (double) m_cpt_cleanup/m_cpt_cycles << std::endl 763 << "- LL RATE = " << (double) m_cpt_ll/m_cpt_cycles << std::endl 764 << "- SC RATE = " << (double) m_cpt_sc/m_cpt_cycles << std::endl 765 << "- CAS RATE = " << (double) m_cpt_cas/m_cpt_cycles << std::endl << std::endl 766 767 << "- WAIT DIR LOCK in READ_FSM = " << (double) m_cpt_read_fsm_dir_lock/m_cpt_read_fsm_n_dir_lock << std::endl 768 << "- NB CYCLES IN DIR LOCK in READ_FSM = " << (double) m_cpt_read_fsm_dir_used/m_cpt_read_fsm_n_dir_lock << std::endl 769 << "- WAIT DIR LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_dir_lock/m_cpt_write_fsm_n_dir_lock << std::endl 770 << "- NB CYCLES IN DIR LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_dir_used/m_cpt_write_fsm_n_dir_lock << std::endl 771 << "- WAIT DIR LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_dir_lock/m_cpt_xram_rsp_fsm_n_dir_lock << std::endl 772 << "- NB CYCLES IN DIR LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_dir_used/m_cpt_xram_rsp_fsm_n_dir_lock << std::endl 773 << "- WAIT DIR LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_dir_lock/m_cpt_cleanup_fsm_n_dir_lock << std::endl 774 << "- NB CYCLES IN DIR LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_dir_used/m_cpt_cleanup_fsm_n_dir_lock << std::endl 775 << "- WAIT DIR LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_dir_lock/m_cpt_cas_fsm_n_dir_lock << std::endl 776 << "- NB CYCLES IN LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_dir_used/m_cpt_cas_fsm_n_dir_lock << std::endl 777 << "- DIR UNUSED RATE = " << (double) m_cpt_dir_unused/m_cpt_cycles << std::endl << std::endl 778 779 << "- WAIT TRT LOCK in READ_FSM = " << (double) m_cpt_read_fsm_trt_lock/m_cpt_read_fsm_n_trt_lock << std::endl 780 << "- NB CYCLES IN TRT LOCK in READ_FSM = " << (double) m_cpt_read_fsm_trt_used/m_cpt_read_fsm_n_trt_lock << std::endl 781 << "- WAIT TRT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_trt_lock/m_cpt_write_fsm_n_trt_lock << std::endl 782 << "- NB CYCLES IN TRT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_trt_used/m_cpt_write_fsm_n_trt_lock << std::endl 783 << "- WAIT TRT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_trt_lock/m_cpt_cas_fsm_n_trt_lock << std::endl 784 << "- NB CYCLES IN TRT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_trt_used/m_cpt_cas_fsm_n_trt_lock << std::endl 785 << "- WAIT TRT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_trt_lock/m_cpt_xram_rsp_fsm_n_trt_lock << std::endl 786 << "- NB CYCLES IN TRT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_trt_used/m_cpt_xram_rsp_fsm_n_trt_lock << std::endl 787 << "- WAIT TRT LOCK in IXR_FSM = " << (double) m_cpt_ixr_fsm_trt_lock/m_cpt_ixr_fsm_n_trt_lock << std::endl 788 << "- NB CYCLES IN TRT LOCK in IXR_FSM = " << (double) m_cpt_ixr_fsm_trt_used/m_cpt_ixr_fsm_n_trt_lock << std::endl 789 << "- TRT UNUSED RATE = " << (double) m_cpt_trt_unused/m_cpt_cycles << std::endl << std::endl 790 791 << "- WAIT UPT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_upt_lock/m_cpt_write_fsm_n_upt_lock << std::endl 792 << "- NB CYCLES IN UPT LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_upt_used/m_cpt_write_fsm_n_upt_lock << std::endl 793 << "- WAIT UPT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_upt_lock/m_cpt_xram_rsp_fsm_n_upt_lock << std::endl 794 << "- NB CYCLES IN UPT LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_upt_used/m_cpt_xram_rsp_fsm_n_upt_lock << std::endl 795 << "- WAIT UPT LOCK in MULTIACK_FSM = " << (double) m_cpt_multi_ack_fsm_upt_lock/m_cpt_multi_ack_fsm_n_upt_lock << std::endl 796 << "- NB CYCLES IN UPT LOCK in MULTIACK_FSM = " << (double) m_cpt_multi_ack_fsm_upt_used/m_cpt_multi_ack_fsm_n_upt_lock << std::endl 797 << "- WAIT UPT LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_ivt_lock/m_cpt_cleanup_fsm_n_upt_lock << std::endl 798 << "- NB CYCLES IN UPT LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_ivt_used/m_cpt_cleanup_fsm_n_upt_lock << std::endl 799 << "- WAIT UPT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_upt_lock/m_cpt_cas_fsm_n_upt_lock << std::endl 800 << "- NB CYCLES IN UPT LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_upt_used/m_cpt_cas_fsm_n_upt_lock << std::endl 801 << "- UPT UNUSED RATE = " << (double) m_cpt_upt_unused/m_cpt_cycles << std::endl << std::endl 802 << "- IVT UNUSED RATE = " << (double) m_cpt_ivt_unused/m_cpt_cycles << std::endl << std::endl 803 804 << "- WAIT HEAP LOCK in READ_FSM = " << (double) m_cpt_read_fsm_heap_lock/m_cpt_read_fsm_n_heap_lock << std::endl 805 << "- NB CYCLES IN HEAP LOCK in READ_FSM = " << (double) m_cpt_read_fsm_heap_used/m_cpt_read_fsm_n_heap_lock << std::endl 806 << "- WAIT HEAP LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_heap_lock/m_cpt_write_fsm_n_heap_lock << std::endl 807 << "- NB CYCLES IN HEAP LOCK in WRITE_FSM = " << (double) m_cpt_write_fsm_heap_used/m_cpt_write_fsm_n_heap_lock << std::endl 808 << "- WAIT HEAP LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_heap_lock/m_cpt_xram_rsp_fsm_n_heap_lock << std::endl 809 << "- NB CYCLES IN HEAP LOCK in XRAM_FSM = " << (double) m_cpt_xram_rsp_fsm_heap_used/m_cpt_xram_rsp_fsm_n_heap_lock << std::endl 810 << "- WAIT HEAP LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_heap_lock/m_cpt_cleanup_fsm_n_heap_lock << std::endl 811 << "- NB CYCLES IN HEAP LOCK in CLEANUP_FSM = " << (double) m_cpt_cleanup_fsm_heap_used/m_cpt_cleanup_fsm_n_heap_lock << std::endl 812 << "- WAIT HEAP LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_heap_lock/m_cpt_cas_fsm_n_heap_lock << std::endl 813 << "- NB CYCLES IN HEAP LOCK in CAS_FSM = " << (double) m_cpt_cas_fsm_heap_used/m_cpt_cas_fsm_n_heap_lock << std::endl 814 << "- HEAP UNUSED RATE = " << (double) m_cpt_heap_unused/m_cpt_cycles << std::endl 815 816 << "- READ DATA UNC = " << (double) m_cpt_read_data_unc << std::endl 817 << "- READ DATA MISS CC = " << (double) m_cpt_read_data_miss_CC << std::endl 818 << "- READ INS UNC = " << (double) m_cpt_read_ins_unc << std::endl 819 << "- READ INS MISS = " << (double) m_cpt_read_ins_miss << std::endl 820 << "- READ LL CC = " << (double) m_cpt_read_ll_CC << std::endl 821 << "- READ DATA MISS NCC = " << (double) m_cpt_read_data_miss_NCC << std::endl 822 << "- READ LL NCC = " << (double) m_cpt_read_ll_NCC << std::endl 823 << "- READ OTHER = " << (double) m_cpt_read_WTF << std::endl 824 << "- CLEANUP + DATA = " << (double) m_cpt_cleanup_data << std::endl 825 << "- NCC TO CC READ = " << (double) m_cpt_ncc_to_cc_read << std::endl 826 << "- NCC TO CC WRITE = " << (double) m_cpt_ncc_to_cc_write << std::endl 827 << "- NCC TO CC = " << (double) m_cpt_ncc_to_cc << std::endl; 669 828 } 670 829 … … 685 844 delete [] r_write_be; 686 845 delete [] r_write_to_cc_send_data; 846 847 delete [] r_cleanup_data; 848 delete [] r_cleanup_to_ixr_cmd_data; 849 delete [] r_cleanup_to_tgt_rsp_data; 850 delete [] r_cleanup_old_data; 687 851 } 688 852 … … 763 927 r_read_to_tgt_rsp_req = false; 764 928 r_read_to_ixr_cmd_req = false; 929 r_read_to_cc_send_req = false; 930 r_read_to_cleanup_req = false; 765 931 766 932 r_write_to_tgt_rsp_req = false; … … 820 986 r_tgt_rsp_key_sent = false; 821 987 988 // ODCCP 989 r_cleanup_data_index = 0; 990 r_cleanup_trdid = 0; 991 r_cleanup_pktid = 0; 992 r_cleanup_contains_data = false; 993 r_cleanup_ncc = false; 994 r_cleanup_to_ixr_cmd_ncc_l1_dirty = false; 995 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false; 996 r_cleanup_to_ixr_cmd_req = false; 997 r_cleanup_to_ixr_cmd_srcid = 0; 998 r_cleanup_to_ixr_cmd_trdid = 0; 999 r_cleanup_to_ixr_cmd_pktid = 0; 1000 r_cleanup_to_ixr_cmd_nline = 0; 1001 for (size_t word = 0; word < m_words; word ++) 1002 { 1003 r_cleanup_to_ixr_cmd_data[word] = 0; 1004 r_cleanup_data[word] = 0; 1005 } 1006 1007 822 1008 // Activity counters 823 m_cpt_cycles = 0; 824 m_cpt_read = 0; 825 m_cpt_read_miss = 0; 826 m_cpt_write = 0; 827 m_cpt_write_miss = 0; 828 m_cpt_write_cells = 0; 829 m_cpt_write_dirty = 0; 830 m_cpt_update = 0; 831 m_cpt_update_mult = 0; 832 m_cpt_inval_brdcast = 0; 833 m_cpt_inval = 0; 834 m_cpt_inval_mult = 0; 835 m_cpt_cleanup = 0; 836 m_cpt_ll = 0; 837 m_cpt_sc = 0; 838 m_cpt_cas = 0; 839 m_cpt_trt_full = 0; 840 m_cpt_trt_rb = 0; 841 1009 m_cpt_cycles = 0; 1010 m_cpt_read = 0; 1011 m_cpt_read_miss = 0; 1012 m_cpt_write = 0; 1013 m_cpt_write_miss = 0; 1014 m_cpt_write_cells = 0; 1015 m_cpt_write_dirty = 0; 1016 m_cpt_update = 0; 1017 m_cpt_update_mult = 0; 1018 m_cpt_inval_brdcast = 0; 1019 m_cpt_inval = 0; 1020 m_cpt_inval_mult = 0; 1021 m_cpt_cleanup = 0; 1022 m_cpt_ll = 0; 1023 m_cpt_sc = 0; 1024 m_cpt_cas = 0; 1025 m_cpt_trt_full = 0; 1026 m_cpt_trt_rb = 0; 1027 m_cpt_dir_unused = 0; 1028 m_cpt_upt_unused = 0; 1029 m_cpt_ivt_unused = 0; 1030 m_cpt_heap_unused = 0; 1031 m_cpt_trt_unused = 0; 1032 m_cpt_read_fsm_n_dir_lock = 0; 1033 m_cpt_read_fsm_dir_lock = 0; 1034 m_cpt_read_fsm_dir_used = 0; 1035 m_cpt_read_fsm_trt_lock = 0; 1036 m_cpt_read_fsm_heap_lock = 0; 1037 m_cpt_write_fsm_dir_lock = 0; 1038 m_cpt_write_fsm_n_dir_lock = 0; 1039 m_cpt_write_fsm_upt_lock = 0; 1040 m_cpt_write_fsm_heap_lock = 0; 1041 m_cpt_write_fsm_dir_used = 0; 1042 m_cpt_write_fsm_trt_lock = 0; 1043 m_cpt_cas_fsm_n_dir_lock = 0; 1044 m_cpt_cas_fsm_dir_lock = 0; 1045 m_cpt_cas_fsm_upt_lock = 0; 1046 m_cpt_cas_fsm_heap_lock = 0; 1047 m_cpt_cas_fsm_trt_lock = 0; 1048 m_cpt_cas_fsm_dir_used = 0; 1049 m_cpt_xram_rsp_fsm_n_dir_lock = 0; 1050 m_cpt_xram_rsp_fsm_dir_lock = 0; 1051 m_cpt_xram_rsp_fsm_trt_lock = 0; 1052 m_cpt_xram_rsp_fsm_upt_lock = 0; 1053 m_cpt_xram_rsp_fsm_heap_lock = 0; 1054 m_cpt_xram_rsp_fsm_dir_used = 0; 1055 m_cpt_cleanup_fsm_dir_lock = 0; 1056 m_cpt_cleanup_fsm_n_dir_lock = 0; 1057 m_cpt_cleanup_fsm_heap_lock = 0; 1058 m_cpt_cleanup_fsm_ivt_lock = 0; 1059 m_cpt_cleanup_fsm_dir_used = 0; 1060 m_cpt_ixr_fsm_trt_lock = 0; 1061 m_cpt_multi_ack_fsm_upt_lock = 0; 1062 m_cpt_read_data_unc = 0; 1063 m_cpt_read_data_miss_CC = 0; 1064 m_cpt_read_ins_unc = 0; 1065 m_cpt_read_ins_miss = 0; 1066 m_cpt_read_ll_CC = 0; 1067 m_cpt_read_data_miss_NCC = 0; 1068 m_cpt_read_ll_NCC = 0; 1069 m_cpt_read_WTF = 0; 1070 m_cpt_cleanup_data = 0; 1071 m_cpt_ncc_to_cc_read = 0; 1072 m_cpt_ncc_to_cc_write = 0; 1073 m_cpt_ncc_to_cc = 0; 842 1074 return; 843 1075 } … … 946 1178 if(p_vci_tgt.cmdval) 947 1179 { 1180 948 1181 949 1182 #if DEBUG_MEMC_TGT_CMD … … 1106 1339 error = 0; 1107 1340 r_config_address = (r_config_address.read() & 0x00000000FFFFFFFFLL) | 1108 (( addr_t)p_vci_tgt.wdata.read())<<32;1341 ((uint64_t)p_vci_tgt.wdata.read())<<32; 1109 1342 } 1110 1343 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set buf_lines … … 1331 1564 case MULTI_ACK_UPT_LOCK: 1332 1565 { 1566 m_cpt_multi_ack_fsm_upt_lock++; 1333 1567 // get lock to the UPDATE table 1334 if(r_alloc_upt_fsm.read() != ALLOC_UPT_MULTI_ACK) break;1568 if(r_alloc_upt_fsm.read() != ALLOC_UPT_MULTI_ACK) break; 1335 1569 1336 1570 // decrement the number of expected responses 1337 1571 size_t count = 0; 1338 1572 bool valid = m_upt.decrement(r_multi_ack_upt_index.read(), count); 1573 1574 /*ODCCP*/ //m_upt.print(); 1339 1575 1340 1576 if(not valid) … … 1361 1597 << " entry = " << r_multi_ack_upt_index.read() 1362 1598 << " / rsp_count = " << std::dec << count << std::endl; 1599 m_cpt_multi_ack_fsm_n_upt_lock++; 1363 1600 #endif 1364 1601 break; … … 1875 2112 << " / nwords = " << std::dec << m_cmd_read_length_fifo.read() << std::endl; 1876 2113 #endif 2114 r_read_coherent = false; //WB by default 2115 r_read_ll_done = false; 1877 2116 r_read_fsm = READ_DIR_REQ; 1878 2117 } … … 1886 2125 { 1887 2126 r_read_fsm = READ_DIR_LOCK; 2127 m_cpt_read_fsm_n_dir_lock++; 1888 2128 } 1889 2129 … … 1892 2132 std::cout << " <MEMC " << name() << " READ_DIR_REQ> Requesting DIR lock " << std::endl; 1893 2133 #endif 2134 2135 m_cpt_read_fsm_dir_lock++; 2136 1894 2137 break; 1895 2138 } … … 1903 2146 DirectoryEntry entry = 1904 2147 m_cache_directory.read(m_cmd_read_addr_fifo.read(), way); 1905 // access the global table ONLY when we have an LL cmd 1906 if((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL) 1907 { 1908 r_read_ll_key = m_llsc_table.ll(m_cmd_read_addr_fifo.read()); 2148 if(((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL) and not r_read_ll_done.read()) // access the global table ONLY when we have an LL cmd 2149 { 2150 addr_t nline = m_nline[(addr_t)(m_cmd_read_addr_fifo.read())]; 2151 r_read_ll_key = m_llsc_table.ll(nline); 2152 //r_read_ll_key = m_llsc_table.ll(m_cmd_read_addr_fifo.read()); 2153 /**//*std::cout << "MEMCACHE : from proc " << m_cmd_read_srcid_fifo.read() 2154 << " | @ " << std::hex << m_cmd_read_addr_fifo.read() 2155 << " | LL" << std::endl;*/ 2156 r_read_ll_done = true; 1909 2157 } 1910 2158 r_read_is_cnt = entry.is_cnt; … … 1926 2174 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 1927 2175 bool cached_read = (m_cmd_read_pktid_fifo.read() & 0x1); 2176 2177 1928 2178 if(entry.valid) // hit 1929 2179 { 1930 // test if we need to register a new copy in the heap1931 if (entry.is_cnt or (entry.count == 0) or !cached_read)2180 r_read_coherent = entry.cache_coherent; 2181 if (entry.cache_coherent or (entry.count == 0))// or (entry.owner.srcid == m_cmd_read_srcid_fifo.read())) //hit on a WT line or the owner has no more copy (if LL, the owner must be invalidated even if he made the request) 1932 2182 { 1933 r_read_fsm = READ_DIR_HIT; 2183 // test if we need to register a new copy in the heap 2184 if(entry.is_cnt || (entry.count == 0) || !cached_read) 2185 { 2186 r_read_fsm = READ_DIR_HIT; 2187 } 2188 else 2189 { 2190 //std::cout << "is LL = " << ((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL) << std::endl; 2191 //std::cout << "coherent = " << entry.cache_coherent << " | count = " << std::dec << entry.count << " | cached = " << cached_read << std::endl; 2192 r_read_fsm = READ_HEAP_REQ; 2193 } 1934 2194 } 1935 else 2195 else //hit on a WB line owned by an other proc 1936 2196 { 1937 r_read_fsm = READ_ HEAP_REQ;2197 r_read_fsm = READ_IVT_LOCK; 1938 2198 } 1939 2199 } … … 1950 2210 << " / hit = " << std::dec << entry.valid 1951 2211 << " / count = " <<std::dec << entry.count 1952 << " / is_cnt = " << entry.is_cnt; 2212 << " / is_cnt = " << entry.is_cnt 2213 << " / is_coherent = " << entry.cache_coherent; 1953 2214 if((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL) std::cout << " / LL access" << std::endl; 1954 2215 else std::cout << std::endl; … … 1965 2226 } 1966 2227 2228 /////////////////// 2229 case READ_IVT_LOCK: 2230 { 2231 if (r_alloc_ivt_fsm.read() == ALLOC_IVT_READ) 2232 { 2233 size_t index; 2234 addr_t nline = m_nline[(addr_t)(m_cmd_read_addr_fifo.read())]; 2235 /*std::cout << "nline = " << std::dec << nline << std::endl 2236 << "inval en cours sur la ligne = " << m_upt.search_inval(nline, index) << std::endl 2237 << "UPT full = " << m_upt.is_full() << std::endl 2238 << "CC_SEND req = " << r_read_to_cc_send_req.read() << std::endl 2239 << "CLENAUP req = " <<r_read_to_cleanup_req.read() << std::endl;*/ 2240 if(m_upt.search_inval(nline, index) or m_upt.is_full() or r_read_to_cc_send_req.read() or r_read_to_cleanup_req.read()) //Check pending inval 2241 { 2242 r_read_fsm = READ_WAIT; 2243 #if DEBUG_MEMC_READ 2244 if(m_debug) 2245 { 2246 std::cout 2247 << " <MEMC " << name() << " READ_IVT_LOCK>" 2248 << " Wait cleanup completion" 2249 << std::endl; 2250 } 2251 #endif 2252 } 2253 else 2254 { 2255 r_read_to_cc_send_req = true; 2256 r_read_to_cc_send_dest = r_read_copy.read(); 2257 r_read_to_cc_send_nline = nline; 2258 r_read_to_cc_send_inst = ((m_cmd_read_pktid_fifo.read() & 0x2) != 0); 2259 r_read_to_cleanup_req = true; 2260 r_read_to_cleanup_nline = nline; 2261 r_read_to_cleanup_srcid = m_cmd_read_srcid_fifo.read(); 2262 r_read_to_cleanup_length = m_cmd_read_length_fifo.read(); 2263 r_read_to_cleanup_first_word = m_x[(addr_t) m_cmd_read_addr_fifo.read()]; 2264 r_read_to_cleanup_cached_read = (m_cmd_read_pktid_fifo.read() & 0x1); 2265 r_read_to_cleanup_addr = m_cmd_read_addr_fifo.read(); 2266 r_read_to_cleanup_is_ll= ((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL); 2267 r_read_to_cleanup_ll_key = r_read_ll_key.read(); 2268 //std::cout << "cleanup req (read) on line " << nline << " /on proc " << r_read_copy.read() << std::endl; 2269 2270 m_upt.set(false, // it's an inval transaction 2271 false, // it's not a broadcast 2272 false, // it needs a read response 2273 false, // no acknowledge required 2274 m_cmd_read_srcid_fifo.read(), 2275 m_cmd_read_trdid_fifo.read(), 2276 m_cmd_read_pktid_fifo.read(), 2277 nline, 2278 0x1, //Expect only one answer 2279 index); 2280 2281 cmd_read_fifo_get = true; 2282 r_read_fsm = READ_IDLE; 2283 #if DEBUG_MEMC_READ 2284 if(m_debug) 2285 { 2286 std::cout 2287 << " <MEMC " << name() << " READ_IVT_LOCK>" 2288 << " Inval req on an NCC line" 2289 << std::endl; 2290 } 2291 #endif 2292 } 2293 } 2294 2295 2296 break; 2297 } 2298 1967 2299 ////////////////// 2300 case READ_WAIT://Release the locks 2301 { 2302 r_read_fsm = READ_DIR_REQ; 2303 #if DEBUG_MEMC_READ 2304 if(m_debug) 2305 { 2306 std::cout 2307 << " <MEMC " << name() << " READ_WAIT>" << std::endl; 2308 } 2309 #endif 2310 break; 2311 } 2312 /////////////////// 1968 2313 case READ_DIR_HIT: // read data in cache & update the directory 1969 2314 // we enter this state in 3 cases: … … 1996 2341 DirectoryEntry entry; 1997 2342 entry.valid = true; 2343 entry.cache_coherent = r_read_coherent.read() or inst_read or (!(cached_read)) or (r_read_copy.read() != m_cmd_read_srcid_fifo.read()); 2344 r_read_coherent = r_read_coherent.read() or inst_read or (!(cached_read)) or (r_read_copy.read() != m_cmd_read_srcid_fifo.read()); 1998 2345 entry.is_cnt = is_cnt; 1999 2346 entry.dirty = r_read_dirty.read(); … … 2001 2348 entry.lock = r_read_lock.read(); 2002 2349 entry.ptr = r_read_ptr.read(); 2003 2004 2350 if(cached_read) // Cached read => we must update the copies 2005 2351 { … … 2034 2380 2035 2381 #if DEBUG_MEMC_READ 2036 if(m_debug) 2037 std::cout << " <MEMC " << name() << " READ_DIR_HIT> Update directory entry:" 2038 << " addr = " << std::hex << m_cmd_read_addr_fifo.read() 2039 << " / set = " << std::dec << set 2040 << " / way = " << way 2041 << " / owner_id = " << std::hex << entry.owner.srcid 2042 << " / owner_ins = " << std::dec << entry.owner.inst 2043 << " / count = " << entry.count 2044 << " / is_cnt = " << entry.is_cnt << std::endl; 2382 if(m_debug) 2383 std::cout << " <MEMC " << name() << " READ_DIR_HIT> Update directory entry:" 2384 << " addr = " << std::hex << m_cmd_read_addr_fifo.read() 2385 << " / set = " << std::dec << set 2386 << " / way = " << way 2387 << " / owner_id = " << std::hex << entry.owner.srcid 2388 << " / owner_ins = " << std::dec << entry.owner.inst 2389 << " / coherent = " << entry.cache_coherent 2390 << " / count = " << entry.count 2391 << " / is_cnt = " << entry.is_cnt << std::endl; 2045 2392 #endif 2046 2393 … … 2056 2403 { 2057 2404 r_read_fsm = READ_HEAP_LOCK; 2405 m_cpt_read_fsm_n_heap_lock++; 2058 2406 } 2059 2407 … … 2063 2411 << " Requesting HEAP lock " << std::endl; 2064 2412 #endif 2413 2414 m_cpt_read_fsm_heap_lock++; 2415 2065 2416 break; 2066 2417 } … … 2075 2426 bool go_cnt = (r_read_count.read() >= m_max_copies) or m_heap.is_full(); 2076 2427 2428 if (!r_read_coherent.read()) 2429 { 2430 std::cout << "Address = " << std::hex << (m_cmd_read_addr_fifo.read()) << std::dec << " |count = " << r_read_count.read() << std::endl; 2431 } 2432 assert (r_read_coherent.read() && "accÚs au heap sur ncc"); 2077 2433 // read data in the cache 2078 2434 size_t set = m_y[(addr_t)(m_cmd_read_addr_fifo.read())]; … … 2086 2442 DirectoryEntry entry; 2087 2443 entry.valid = true; 2444 entry.cache_coherent = r_read_coherent.read(); 2088 2445 entry.is_cnt = go_cnt; 2089 2446 entry.dirty = r_read_dirty.read(); … … 2272 2629 r_read_to_tgt_rsp_length = m_cmd_read_length_fifo.read(); 2273 2630 r_read_to_tgt_rsp_srcid = m_cmd_read_srcid_fifo.read(); 2631 /*RWT*/ 2632 //BUG pktid 2633 if (r_read_coherent.read()) 2634 { 2635 r_read_to_tgt_rsp_pktid = 0x0 + m_cmd_read_pktid_fifo.read(); 2636 //std::cout << "READ RSP COHERENT on word" << std::hex << m_x[(addr_t) m_cmd_read_addr_fifo.read()] << std::dec << std::endl; 2637 } 2638 else 2639 { 2640 r_read_to_tgt_rsp_pktid = 0x8 + m_cmd_read_pktid_fifo.read(); 2641 } 2274 2642 r_read_to_tgt_rsp_trdid = m_cmd_read_trdid_fifo.read(); 2275 r_read_to_tgt_rsp_pktid = m_cmd_read_pktid_fifo.read();2276 2643 r_read_to_tgt_rsp_ll_key = r_read_ll_key.read(); 2277 2644 cmd_read_fifo_get = true; … … 2302 2669 if(hit_read or !wok or hit_write) // missing line already requested or no space 2303 2670 { 2304 if(!wok) m_cpt_trt_full++; 2671 if(!wok) 2672 { 2673 m_cpt_trt_full++; 2674 } 2305 2675 if(hit_read or hit_write) m_cpt_trt_rb++; 2306 2676 r_read_fsm = READ_IDLE; … … 2319 2689 << " / hit_write = " << hit_write 2320 2690 << " / full = " << !wok << std::endl; 2321 #endif 2322 } 2691 m_cpt_read_fsm_n_trt_lock++; 2692 #endif 2693 } 2694 2695 m_cpt_read_fsm_trt_lock++; 2696 2323 2697 break; 2324 2698 } … … 2341 2715 std::vector<data_t> (m_words,0), 2342 2716 r_read_ll_key.read()); 2717 2343 2718 #if DEBUG_MEMC_READ 2344 2719 if(m_debug) … … 2507 2882 { 2508 2883 /////////////////////////////////////////////////////////////////////// 2509 // SC command treatment2884 // SC command handling 2510 2885 // We test the r_write_pending_sc register to know if we are returning 2511 2886 // from the WAIT state. … … 2513 2888 // another time from the FIFO. Also, we don't have to test another 2514 2889 // time if the SC has succeed 2890 2891 addr_t nline = m_nline[(addr_t)(r_write_address.read())]; 2515 2892 if(((r_write_pktid.read() & 0x7) == TYPE_SC) and not r_write_pending_sc.read()) 2516 2893 { 2517 2894 if(not m_cmd_write_addr_fifo.rok()) break; 2518 2895 2519 2896 assert(m_cmd_write_eop_fifo.read() and 2520 2897 "Error in VCI_MEM_CACHE : " 2521 2898 "invalid packet format for SC command"); 2522 2899 //BUG LLSC 2523 2900 size_t index = r_write_word_index.read(); 2524 bool sc_success = m_llsc_table.sc( r_write_address.read(),2901 bool sc_success = m_llsc_table.sc(nline , 2525 2902 r_write_data[index].read()); 2526 2903 2904 //bool sc_success = m_llsc_table.sc(r_write_address.read() , 2905 // r_write_data[index].read()); 2527 2906 // consume a word in the FIFO & write it in the local buffer 2528 2907 cmd_write_fifo_get = true; 2529 2908 r_write_data[index] = m_cmd_write_data_fifo.read(); 2530 2909 r_write_sc_fail = not sc_success; 2910 //WARNING: if the SC is a success, it might still fail at next cycle if the line is NCC 2531 2911 r_write_pending_sc = true; 2532 2912 2533 2913 if(not sc_success) r_write_fsm = WRITE_RSP; 2534 2914 else r_write_fsm = WRITE_DIR_LOCK; 2535 2915 2536 2916 break; 2537 2917 } 2538 2918 2539 2919 /////////////////////////////////////////////////////////////////////// 2540 2920 // WRITE command treatment or SC command returning from the WAIT state … … 2542 2922 // erase any possible new reservation when we release the lock on the 2543 2923 // directory 2544 m_llsc_table.sw(r_write_address.read()); 2924 m_llsc_table.sw(nline); 2925 2926 //m_llsc_table.sw(r_write_address.read()); 2545 2927 2546 2928 r_write_fsm = WRITE_DIR_LOCK; 2929 m_cpt_write_fsm_n_dir_lock++; 2547 2930 } 2548 2931 … … 2552 2935 << std::endl; 2553 2936 #endif 2937 2938 m_cpt_write_fsm_dir_lock++; 2554 2939 2555 2940 break; … … 2578 2963 r_write_ptr = entry.ptr; 2579 2964 r_write_way = way; 2580 2581 if(entry.is_cnt and entry.count) 2965 2966 r_write_coherent = entry.cache_coherent; 2967 2968 if (entry.cache_coherent or (entry.owner.srcid == r_write_srcid.read()) or (entry.count == 0)) // hit WT 2582 2969 { 2583 r_write_fsm = WRITE_DIR_READ; 2970 if(entry.is_cnt && entry.count) 2971 { 2972 r_write_fsm = WRITE_DIR_READ; 2973 } 2974 else 2975 { 2976 r_write_fsm = WRITE_DIR_HIT; 2977 } 2584 2978 } 2585 2979 else 2586 2980 { 2587 r_write_fsm = WRITE_DIR_HIT; 2981 if (r_write_to_cleanup_req.read())//inval already sent 2982 { 2983 r_write_fsm = WRITE_WAIT; 2984 } 2985 else // hit on a NCC line with a different owner 2986 { 2987 r_write_fsm = WRITE_IVT_LOCK_HIT_WB; 2988 if(r_write_pktid.read() == TYPE_SC) 2989 { 2990 r_write_sc_fail = true; 2991 } 2992 } 2588 2993 } 2589 2994 } 2590 2995 else // miss 2591 2996 { 2592 r_write_fsm = WRITE_MISS_ TRT_LOCK;2997 r_write_fsm = WRITE_MISS_IVT_LOCK; 2593 2998 } 2594 2999 … … 2619 3024 } 2620 3025 //////////////////// 3026 case WRITE_IVT_LOCK_HIT_WB: 3027 { 3028 if(r_alloc_ivt_fsm.read() == ALLOC_IVT_WRITE) 3029 { 3030 3031 size_t index = 0; 3032 bool match_inval; 3033 addr_t nline = m_nline[(addr_t)(r_write_address.read())]; 3034 3035 //std::cout << "WRITE on NCC on line" << std::hex << nline << std::dec << std::endl; 3036 3037 match_inval = m_upt.search_inval(nline, index); 3038 assert ((r_write_count.read() == 1) and "NCC to CC req without copy"); 3039 if(!match_inval and !r_write_to_cc_send_req.read()) 3040 { 3041 r_write_to_cc_send_req = true; 3042 r_write_to_cc_send_dest = r_write_copy; 3043 r_write_to_cc_send_nline = nline; 3044 r_write_to_cleanup_req = true; 3045 r_write_to_cleanup_nline = nline; 3046 3047 m_upt.set(false, // it's an inval transaction 3048 false, // it's not a broadcast 3049 true, // it needs no read response 3050 false, // no acknowledge required 3051 m_cmd_write_srcid_fifo.read(), //never read, used for debug 3052 m_cmd_write_trdid_fifo.read(), //never read, used for debug 3053 m_cmd_write_pktid_fifo.read(), //never read, used for debug 3054 nline, 3055 0x1, //Expect only one answer 3056 index); 3057 } 3058 r_write_fsm = WRITE_WAIT; 3059 #if DEBUG_MEMC_WRITE 3060 if(m_debug) 3061 { 3062 std::cout << " <MEMC " << name() << " WRITE_IVT_LOCK_HIT_WB> get access to the UPT: " 3063 << " Inval requested = " << (!match_inval and !r_write_to_cc_send_req.read()) 3064 << std::endl; 3065 } 3066 #endif 3067 } 3068 #if DEBUG_MEMC_WRITE 3069 if(m_debug) 3070 { 3071 std::cout << " <MEMC " << name() << " WRITE_IVT_LOCK_HIT_WB> failed to access to the UPT: " 3072 << std::endl; 3073 } 3074 #endif 3075 break; 3076 } 3077 3078 3079 //////////////////// 2621 3080 case WRITE_DIR_READ: // read the cache and complete the buffer when be!=0xF 2622 3081 { … … 2656 3115 DirectoryEntry entry; 2657 3116 entry.valid = true; 3117 entry.cache_coherent = r_write_coherent.read(); 2658 3118 entry.dirty = true; 2659 3119 entry.tag = r_write_tag.read(); … … 2683 3143 // no_update is true when there is no need for coherence transaction 2684 3144 // (tests for sc requests) 2685 bool no_update = ( (r_write_count.read() == 0) or2686 (owner and (r_write_count.read() ==1) and2687 (r_write_pktid.read() != TYPE_SC)));3145 bool no_update = ((r_write_count.read() ==0) || //no need for coherency 3146 (owner && (r_write_count.read() ==1) && (r_write_pktid.read() != TYPE_SC)) || //writer is owner 3147 ((r_write_pktid.read() == TYPE_SC) && r_write_sc_fail.read())); //SC failed: no data update 2688 3148 2689 3149 // write data in the cache if no coherence transaction 2690 if(no_update )3150 if(no_update and ((r_write_pktid.read() != TYPE_SC) or !r_write_sc_fail.read())) 2691 3151 { 2692 3152 for(size_t word=0 ; word<m_words ; word++) … … 2760 3220 size_t set = m_y[(addr_t)(r_write_address.read())]; 2761 3221 size_t way = r_write_way.read(); 3222 2762 3223 2763 3224 wok = m_upt.set(true, // it's an update transaction … … 2804 3265 if(wok) r_write_fsm = WRITE_UPT_HEAP_LOCK; 2805 3266 else r_write_fsm = WRITE_WAIT; 2806 } 3267 m_cpt_write_fsm_n_upt_lock++; 3268 } 3269 3270 m_cpt_write_fsm_upt_lock++; 3271 2807 3272 break; 2808 3273 } … … 2820 3285 #endif 2821 3286 r_write_fsm = WRITE_UPT_REQ; 2822 } 3287 m_cpt_write_fsm_n_heap_lock++; 3288 } 3289 3290 m_cpt_write_fsm_heap_lock++; 3291 2823 3292 break; 2824 3293 } … … 2834 3303 "transaction in WRITE_UPT_REQ state" 2835 3304 ); 3305 2836 3306 2837 3307 r_write_to_cc_send_brdcast_req = false; … … 3070 3540 break; 3071 3541 } 3542 ///////////////////////// RWT 3543 case WRITE_MISS_IVT_LOCK: // Miss : check UPT 3544 { 3545 if (r_alloc_ivt_fsm.read() == ALLOC_IVT_WRITE) 3546 { 3547 size_t index; 3548 if(m_upt.search_inval(m_nline[(addr_t)(r_write_address.read())], index)) 3549 { 3550 r_write_fsm = WRITE_WAIT; 3551 } 3552 else 3553 { 3554 r_write_fsm = WRITE_MISS_TRT_LOCK; 3555 } 3556 } 3557 break; 3558 } 3072 3559 3073 3560 ///////////////////////// … … 3087 3574 bool hit_write = m_trt.hit_write(m_nline[addr]); 3088 3575 bool wok = !m_trt.full(wok_index); 3089 3576 //std::cout << "MEMCACHE : WRITE MISS at " << std::hex << (uint32_t)addr << std::dec << std::endl; 3090 3577 if(hit_read) // register the modified data in TRT 3091 3578 { … … 3105 3592 m_cpt_trt_full++; 3106 3593 } 3107 } 3594 m_cpt_write_fsm_n_trt_lock++; 3595 } 3596 3597 m_cpt_write_fsm_trt_lock++; 3598 3108 3599 break; 3109 3600 } … … 3224 3715 << " : wok = " << wok << " / index = " << wok_index << std::endl; 3225 3716 #endif 3226 } 3717 m_cpt_write_fsm_n_trt_lock++; 3718 } 3719 3720 m_cpt_write_fsm_trt_lock++; 3721 3227 3722 break; 3228 3723 } … … 3251 3746 nb_copies, 3252 3747 index); 3253 3748 /*ODCCP*/ //m_upt.print(); 3254 3749 #if DEBUG_MEMC_WRITE 3255 3750 if( m_debug and wok ) … … 3261 3756 if(wok) r_write_fsm = WRITE_BC_DIR_INVAL; 3262 3757 else r_write_fsm = WRITE_WAIT; 3263 } 3758 m_cpt_write_fsm_n_upt_lock++; 3759 } 3760 3761 m_cpt_write_fsm_upt_lock++; 3762 3264 3763 break; 3265 3764 } … … 3295 3794 DirectoryEntry entry; 3296 3795 entry.valid = false; 3796 entry.cache_coherent= false; 3297 3797 entry.dirty = false; 3298 3798 entry.tag = 0; … … 3394 3894 //////////////////////// 3395 3895 case IXR_CMD_READ_IDLE: 3396 {3397 3896 if (r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3398 3897 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3399 3898 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3899 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3400 3900 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3401 3901 break; 3402 }3403 3902 //////////////////////// 3404 3903 case IXR_CMD_WRITE_IDLE: 3405 { 3406 if (r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3904 if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3407 3905 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3906 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3408 3907 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3409 3908 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3410 3909 break; 3411 }3412 3910 //////////////////////// 3413 3911 case IXR_CMD_CAS_IDLE: 3414 {3415 if (r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM;3912 if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3913 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3416 3914 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3417 3915 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3418 3916 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3419 3917 break; 3420 }3421 3918 //////////////////////// 3422 3919 case IXR_CMD_XRAM_IDLE: 3423 {3424 if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ;3425 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE;3920 if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3921 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3922 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3426 3923 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3427 3924 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3428 3925 break; 3429 } 3926 //////////////////////// 3927 case IXR_CMD_CLEANUP_IDLE: 3928 /*ODCCP*///std::cout << "IXR_CMD_CLEANUP_IDLE" << std::endl; 3929 if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3930 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3931 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3932 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3933 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3934 break; 3430 3935 ////////////////// // send a get from READ FSM 3431 3936 case IXR_CMD_READ: … … 3553 4058 break; 3554 4059 } 4060 4061 //////////////////////// 4062 case IXR_CMD_CLEANUP_DATA: // send a put command to XRAM 4063 /*ODCCP*///std::cout << "IXR_CMD_CLEANUP_DATA" << std::endl; 4064 if(p_vci_ixr.cmdack) 4065 { 4066 if(r_ixr_cmd_cpt.read() == (m_words - 2)) 4067 { 4068 r_ixr_cmd_cpt = 0; 4069 r_ixr_cmd_fsm = IXR_CMD_CLEANUP_IDLE; 4070 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false; 4071 r_cleanup_to_ixr_cmd_req = false; 4072 } 4073 else 4074 { 4075 r_ixr_cmd_cpt = r_ixr_cmd_cpt.read() + 2; 4076 } 4077 4078 #if DEBUG_MEMC_IXR_CMD 4079 if(m_debug) 4080 { 4081 std::cout << " <MEMC " << name() << ".IXR_CMD_CLEANUP_DATA> Send a put request to xram" << std::endl; 4082 } 4083 #endif 4084 } 4085 break; 3555 4086 3556 4087 } // end switch r_ixr_cmd_fsm … … 3631 4162 << r_ixr_rsp_trt_index.read() << std::endl; 3632 4163 #endif 3633 } 4164 m_cpt_ixr_fsm_n_trt_lock++; 4165 } 4166 4167 m_cpt_ixr_fsm_trt_lock++; 4168 3634 4169 break; 3635 4170 } … … 3667 4202 << " / data = " << std::hex << data << std::endl; 3668 4203 #endif 3669 } 4204 m_cpt_ixr_fsm_n_trt_lock++; 4205 } 4206 m_cpt_ixr_fsm_trt_lock++; 3670 4207 break; 3671 4208 } … … 3740 4277 << " Get access to DIR and TRT" << std::endl; 3741 4278 #endif 3742 } 4279 m_cpt_xram_rsp_fsm_n_dir_lock++; 4280 m_cpt_xram_rsp_fsm_n_trt_lock++; 4281 } 4282 m_cpt_xram_rsp_fsm_dir_lock++; 4283 m_cpt_xram_rsp_fsm_trt_lock++; 3743 4284 break; 3744 4285 } … … 3756 4297 DirectoryEntry victim(m_cache_directory.select(set, way)); 3757 4298 3758 bool inval = (victim.count and victim.valid) ; 4299 bool inval = (victim.count && victim.valid) or (!victim.cache_coherent and (victim.count == 1)) ; 4300 3759 4301 3760 4302 // copy the victim line in a local buffer … … 3766 4308 r_xram_rsp_victim_copy_cache= victim.owner.cache_id; 3767 4309 #endif 4310 r_xram_rsp_victim_coherent = victim.cache_coherent; 3768 4311 r_xram_rsp_victim_copy_inst = victim.owner.inst; 3769 4312 r_xram_rsp_victim_count = victim.count; … … 3774 4317 r_xram_rsp_victim_is_cnt = victim.is_cnt; 3775 4318 r_xram_rsp_victim_inval = inval ; 3776 r_xram_rsp_victim_dirty = victim.dirty; 4319 r_xram_rsp_victim_dirty = victim.dirty or (!victim.cache_coherent && (victim.count == 1)); //a NCC line is by default considered as dirty in the L1: we must take a reservation on a TRT entry 4320 3777 4321 3778 4322 if(!r_xram_rsp_trt_buf.rerror) 3779 4323 { 3780 r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK; 4324 if (!victim.cache_coherent and r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read()) //there can not be two L2 invalidation on NCC line at the same time 4325 { 4326 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4327 } 4328 else 4329 { 4330 r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK; 4331 } 3781 4332 } 3782 4333 else … … 3808 4359 { 3809 4360 size_t index = 0; 3810 if(m_ivt.search_inval(r_xram_rsp_trt_buf.nline, index)) // pending inval 4361 size_t index_victim = 0; 4362 if(m_ivt.search_inval(r_xram_rsp_trt_buf.nline, index) or 4363 m_ivt.search_inval(r_xram_rsp_victim_nline.read(), index_victim)) 3811 4364 { 3812 4365 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; … … 3824 4377 { 3825 4378 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4379 m_upt.print(); 3826 4380 3827 4381 #if DEBUG_MEMC_XRAM_RSP … … 3841 4395 #endif 3842 4396 } 3843 } 4397 m_cpt_xram_rsp_fsm_n_upt_lock++; 4398 } 4399 4400 m_cpt_xram_rsp_fsm_upt_lock++; 4401 3844 4402 break; 3845 4403 } … … 3891 4449 DirectoryEntry entry; 3892 4450 entry.valid = true; 4451 entry.cache_coherent = (inst_read or (not(cached_read))) and (r_xram_rsp_trt_buf.proc_read); 3893 4452 entry.is_cnt = false; 3894 4453 entry.lock = false; … … 3907 4466 else 3908 4467 { 3909 entry.owner.srcid = 0;4468 entry.owner.srcid = r_xram_rsp_trt_buf.srcid; 3910 4469 #if L1_MULTI_CACHE 3911 4470 entry.owner.cache_id = 0; … … 3915 4474 } 3916 4475 m_cache_directory.write(set, way, entry); 3917 4476 //RWT: keep the coherence information in order to send it to the read_rsp 4477 r_xram_rsp_coherent = inst_read or (not(cached_read)); 3918 4478 // request an invalidattion request in IVT for victim line 3919 4479 if(r_xram_rsp_victim_inval.read()) … … 3922 4482 size_t index = 0; 3923 4483 size_t count_copies = r_xram_rsp_victim_count.read(); 3924 4484 3925 4485 bool wok = m_ivt.set(false, // it's an inval transaction 3926 4486 broadcast, // set broadcast bit … … 3935 4495 3936 4496 r_xram_rsp_ivt_index = index; 3937 3938 4497 if(!wok) 3939 4498 { … … 3943 4502 } 3944 4503 } 3945 4504 if (!r_xram_rsp_victim_coherent.read()) 4505 { 4506 //m_llsc_table.sw(r_xram_rsp_victim_nline.read()*m_words*4); 4507 m_llsc_table.sw(r_xram_rsp_victim_nline.read()); 4508 } 3946 4509 #if DEBUG_MEMC_XRAM_RSP 3947 4510 if(m_debug) … … 3962 4525 #endif 3963 4526 3964 // If the victim is not dirty , we don't need another XRAMput transaction,4527 // If the victim is not dirty (RWT: if it is not coherent, we can not know wether it is dirty or not), we don't need another XRAM put transaction, 3965 4528 // and we can erase the TRT entry 3966 if(!r_xram_rsp_victim_dirty.read() ) m_trt.erase(r_xram_rsp_trt_index.read());4529 if(!r_xram_rsp_victim_dirty.read() and (r_xram_rsp_victim_coherent.read() or (r_xram_rsp_victim_count.read() == 0))) m_trt.erase(r_xram_rsp_trt_index.read()); 3967 4530 3968 4531 // Next state 3969 if(r_xram_rsp_victim_dirty.read() ) r_xram_rsp_fsm = XRAM_RSP_TRT_DIRTY;4532 if(r_xram_rsp_victim_dirty.read() or (!r_xram_rsp_victim_coherent.read() and (r_xram_rsp_victim_count.read() == 1))) r_xram_rsp_fsm = XRAM_RSP_TRT_DIRTY; 3970 4533 else if(r_xram_rsp_trt_buf.proc_read) r_xram_rsp_fsm = XRAM_RSP_DIR_RSP; 3971 4534 else if(r_xram_rsp_victim_inval.read()) r_xram_rsp_fsm = XRAM_RSP_INVAL; … … 3974 4537 } 3975 4538 //////////////////////// 3976 case XRAM_RSP_TRT_DIRTY: // set the TRT entry ( PUT to XRAM) if the victim is dirty4539 case XRAM_RSP_TRT_DIRTY: // set the TRT entry (write to XRAM) if the victim is dirty or not coherent (RWT) 3977 4540 { 3978 4541 if(r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) 3979 4542 { 4543 3980 4544 m_trt.set(r_xram_rsp_trt_index.read(), 3981 4545 false, // write to XRAM … … 3999 4563 else if(r_xram_rsp_victim_inval.read()) r_xram_rsp_fsm = XRAM_RSP_INVAL; 4000 4564 else r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY; 4001 } 4565 m_cpt_xram_rsp_fsm_n_trt_lock++; 4566 } 4567 4568 m_cpt_xram_rsp_fsm_trt_lock++; 4569 4002 4570 break; 4003 4571 } … … 4009 4577 r_xram_rsp_to_tgt_rsp_srcid = r_xram_rsp_trt_buf.srcid; 4010 4578 r_xram_rsp_to_tgt_rsp_trdid = r_xram_rsp_trt_buf.trdid; 4011 r_xram_rsp_to_tgt_rsp_pktid = r_xram_rsp_trt_buf.pktid; 4579 if (r_xram_rsp_coherent.read()) 4580 { 4581 r_xram_rsp_to_tgt_rsp_pktid = 0x0 + r_xram_rsp_trt_buf.pktid;//RWT CC 4582 } 4583 else 4584 { 4585 r_xram_rsp_to_tgt_rsp_pktid = 0x8 + r_xram_rsp_trt_buf.pktid;//RWT NCC 4586 } 4012 4587 for(size_t i=0; i < m_words; i++) 4013 4588 { … … 4019 4594 r_xram_rsp_to_tgt_rsp_rerror = false; 4020 4595 r_xram_rsp_to_tgt_rsp_req = true; 4596 4021 4597 4022 4598 if(r_xram_rsp_victim_inval) r_xram_rsp_fsm = XRAM_RSP_INVAL; … … 4073 4649 case XRAM_RSP_WRITE_DIRTY: // send a write request to IXR_CMD FSM 4074 4650 { 4075 if(!r_xram_rsp_to_ixr_cmd_req.read() )4651 if(!r_xram_rsp_to_ixr_cmd_req.read() and !r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read()) 4076 4652 { 4077 4653 r_xram_rsp_to_ixr_cmd_req = true; … … 4081 4657 { 4082 4658 r_xram_rsp_to_ixr_cmd_data[i] = r_xram_rsp_victim_data[i]; 4659 std::cout << "data L2 = " << std::hex << r_xram_rsp_victim_data[i] << std::dec << std::endl; 4083 4660 } 4084 4661 m_cpt_write_dirty++; 4662 4663 if ((!r_xram_rsp_victim_coherent.read()) and (r_xram_rsp_victim_count.read() == 1)) //if NCC, we save the data in case of not dirty L1 4664 { 4665 r_xram_rsp_to_ixr_cmd_req = false; 4666 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = true; 4667 r_xram_rsp_fsm = XRAM_RSP_IDLE; 4668 break; 4669 } 4085 4670 4086 4671 bool multi_req = !r_xram_rsp_victim_is_cnt.read() and r_xram_rsp_victim_inval.read(); … … 4105 4690 { 4106 4691 r_xram_rsp_fsm = XRAM_RSP_HEAP_ERASE; 4692 m_cpt_xram_rsp_fsm_n_heap_lock++; 4107 4693 } 4108 4694 … … 4112 4698 << " Requesting HEAP lock" << std::endl; 4113 4699 #endif 4700 4701 m_cpt_xram_rsp_fsm_heap_lock++; 4702 4114 4703 break; 4115 4704 } … … 4278 4867 r_cleanup_inst = (type == DspinDhccpParam::TYPE_CLEANUP_INST); 4279 4868 r_cleanup_srcid = srcid; 4869 r_cleanup_ncc = 4870 DspinDhccpParam::dspin_get( 4871 flit, 4872 DspinDhccpParam::CLEANUP_NCC); 4873 r_cleanup_contains_data = false; 4280 4874 4281 4875 if(srcid >= m_initiators) … … 4294 4888 4295 4889 #if DEBUG_MEMC_CLEANUP 4296 if(m_debug) 4297 std::cout << " <MEMC " << name() 4298 << " CLEANUP_IDLE> Cleanup request:" << std::hex 4299 << " / owner_id = " << srcid 4300 << " / owner_ins = " << (type == DspinDhccpParam::TYPE_CLEANUP_INST) << std::endl; 4890 if(m_debug) 4891 { 4892 std::cout 4893 << " <MEMC " << name() 4894 << " CLEANUP_IDLE> Cleanup request:" << std::hex 4895 << " / owner_id = " << srcid 4896 << " / owner_ins = " << (type == DspinDhccpParam::TYPE_CLEANUP_INST) 4897 << " / ncc = " << DspinDhccpParam::dspin_get( 4898 flit, 4899 DspinDhccpParam::CLEANUP_NCC) 4900 << std::endl; 4901 } 4301 4902 #endif 4302 4903 break; … … 4312 4913 addr_t nline = r_cleanup_nline.read() | 4313 4914 DspinDhccpParam::dspin_get(flit, DspinDhccpParam::CLEANUP_NLINE_LSB); 4314 4915 4916 //A MODIFIER POUR DIRTY // 4917 bool eop = 4918 DspinDhccpParam::dspin_get(flit, DspinDhccpParam::P2M_EOP) == 0x1; 4919 if (! eop) 4920 { 4921 r_cleanup_fsm = CLEANUP_GET_DATA; 4922 r_cleanup_data_index = 0; 4923 r_cleanup_contains_data = true; 4924 } 4925 else 4926 { 4927 r_cleanup_fsm = CLEANUP_DIR_REQ; 4928 } 4315 4929 cc_receive_to_cleanup_fifo_get = true; 4316 r_cleanup_nline = nline; 4317 r_cleanup_fsm = CLEANUP_DIR_REQ; 4930 r_cleanup_nline = nline; 4318 4931 4319 4932 #if DEBUG_MEMC_CLEANUP 4320 if(m_debug) 4321 std::cout << " <MEMC " << name() 4322 << " CLEANUP_GET_NLINE> Cleanup request:" 4323 << " / address = " << std::hex << nline * m_words * 4 << std::endl; 4324 #endif 4325 break; 4326 } 4327 4933 if(m_debug) 4934 { 4935 std::cout 4936 << " <MEMC " << name() 4937 << " CLEANUP_GET_NLINE> Cleanup request:" 4938 << std::hex 4939 << " / address = " << nline * m_words * 4 4940 << " / contains data = " << (!eop) 4941 << std::endl; 4942 } 4943 #endif 4944 break; 4945 } 4946 ///////////////////// 4947 case CLEANUP_GET_DATA : 4948 { 4949 if (m_cc_receive_to_cleanup_fifo.rok()) 4950 { 4951 uint64_t flit = m_cc_receive_to_cleanup_fifo.read(); 4952 4953 uint32_t data = 4954 DspinDhccpParam::dspin_get (flit, DspinDhccpParam::CLEANUP_DATA_UPDT); 4955 4956 r_cleanup_data[r_cleanup_data_index] = data; 4957 r_cleanup_data_index = r_cleanup_data_index.read() + 1; 4958 assert (r_cleanup_data_index.read() < m_words and "MEM_CACHE in CLEANUP_GET_DATA : too much flits in cleanup data updt"); 4959 cc_receive_to_cleanup_fifo_get = true; 4960 if (r_cleanup_data_index.read() == m_words - 1) 4961 { 4962 r_cleanup_contains_data = true; 4963 m_cpt_cleanup_data ++; 4964 r_cleanup_fsm = CLEANUP_DIR_REQ; 4965 } 4966 #if DEBUG_MEMC_CLEANUP 4967 if(m_debug) 4968 { 4969 std::cout 4970 << " <MEMC " << name() 4971 << " CLEANUP_GET_DATA> " 4972 << " / word = " << std::dec << r_cleanup_data_index.read() 4973 << " / data = " << std::hex << data 4974 << std::endl; 4975 } 4976 #endif 4977 } 4978 break; 4979 } 4328 4980 ///////////////////// 4329 4981 case CLEANUP_DIR_REQ: // Get the lock to the directory 4330 4982 { 4983 m_cpt_cleanup_fsm_dir_lock++; 4331 4984 if(r_alloc_dir_fsm.read() != ALLOC_DIR_CLEANUP) break; 4332 4985 4333 4986 r_cleanup_fsm = CLEANUP_DIR_LOCK; 4987 //std::cout << " MEM_CACHE : CLEANUP_DIR_REQ" << std::endl; 4334 4988 4335 4989 #if DEBUG_MEMC_CLEANUP … … 4337 4991 std::cout << " <MEMC " << name() << " CLEANUP_DIR_REQ> Requesting DIR lock" << std::endl; 4338 4992 #endif 4993 4994 m_cpt_cleanup_fsm_n_dir_lock++; 4995 4339 4996 break; 4340 4997 } … … 4353 5010 exit(0); 4354 5011 } 5012 //std::cout << " MEM_CACHE : CLEANUP_DIR_LOCK" << std::endl; 4355 5013 4356 5014 // Read the directory … … 4371 5029 r_cleanup_copy_cache = entry.owner.cache_id; 4372 5030 #endif 5031 5032 //RWT 5033 size_t set = m_y[(addr_t)(cleanup_address)]; 5034 m_cache_data.read_line(way, set, r_cleanup_old_data); 5035 r_cleanup_coherent = entry.cache_coherent; 5036 5037 4373 5038 4374 5039 if(entry.valid) // hit : the copy must be cleared … … 4420 5085 case CLEANUP_DIR_WRITE: 4421 5086 { 5087 /*ODCCP*///std::cout << "CLEANUP_DIR_WRITE" << std::endl; 4422 5088 // Update the directory entry without heap access 4423 5089 if(r_alloc_dir_fsm.read() != ALLOC_DIR_CLEANUP) … … 4453 5119 } 4454 5120 5121 /*RWT*/ 5122 bool inval_request = (r_read_to_cleanup_req.read() and (r_cleanup_nline.read() == r_read_to_cleanup_nline.read())) // NCC to CC initiated by a read transaction 5123 or (r_write_to_cleanup_req.read() and (r_cleanup_nline.read() == r_write_to_cleanup_nline.read())); //NCC to CC initiated by a wrtie transaction 5124 5125 5126 if (inval_request) m_cpt_ncc_to_cc ++; 5127 5128 if (r_write_to_cleanup_req.read() and (r_cleanup_nline.read() == r_write_to_cleanup_nline.read())) 5129 { 5130 r_write_to_cleanup_req = false; 5131 m_cpt_ncc_to_cc_write ++; 5132 } 5133 5134 4455 5135 // update the cache directory (for the copies) 4456 5136 DirectoryEntry entry; 4457 entry.valid = true; 4458 entry.is_cnt = r_cleanup_is_cnt.read(); 4459 entry.dirty = r_cleanup_dirty.read(); 4460 entry.tag = r_cleanup_tag.read(); 4461 entry.lock = r_cleanup_lock.read(); 4462 entry.ptr = r_cleanup_ptr.read(); 4463 entry.count = r_cleanup_count.read() - 1; 4464 entry.owner.srcid = 0; 4465 entry.owner.inst = 0; 4466 5137 entry.valid = true; 5138 entry.cache_coherent = inval_request or r_cleanup_coherent.read(); 5139 entry.is_cnt = r_cleanup_is_cnt.read(); 5140 entry.dirty = r_cleanup_dirty.read() or r_cleanup_contains_data.read(); 5141 entry.tag = r_cleanup_tag.read(); 5142 entry.lock = r_cleanup_lock.read(); 5143 entry.ptr = r_cleanup_ptr.read(); 5144 if (r_read_to_cleanup_req.read() and (r_cleanup_nline.read() == r_read_to_cleanup_nline.read())) //pending READ 5145 { 5146 if (r_read_to_cleanup_cached_read.read()) 5147 { 5148 entry.count = r_cleanup_count.read(); 5149 entry.owner.srcid = r_read_to_cleanup_srcid.read(); 5150 entry.owner.inst = 0; 4467 5151 #if L1_MULTI_CACHE 4468 entry.owner.cache_id = 0; 4469 #endif 5152 entry.owner.cache_id = r_cleanup_copy_cache.read(); 5153 #endif 5154 } 5155 else 5156 { 5157 entry.count = r_cleanup_count.read() - 1; 5158 entry.owner.srcid = r_cleanup_copy.read(); 5159 entry.owner.inst = r_cleanup_copy_inst.read(); 5160 #if L1_MULTI_CACHE 5161 entry.owner.cache_id = r_cleanup_copy_cache.read(); 5162 #endif 5163 } 5164 if (r_read_to_cleanup_is_ll.read()) 5165 { 5166 r_cleanup_to_tgt_rsp_ll_key = r_read_to_cleanup_ll_key.read(); 5167 } 5168 } 5169 else 5170 { 5171 entry.count = r_cleanup_count.read() - 1; 5172 entry.owner.srcid = 0; 5173 entry.owner.inst = 0; 5174 #if L1_MULTI_CACHE 5175 entry.owner.cache_id = 0; 5176 #endif 5177 } 5178 5179 5180 if (r_cleanup_contains_data.read()) 5181 { 5182 for (size_t word = 0; word < m_words; word ++) 5183 { 5184 m_cache_data.write(way, set, word, r_cleanup_data[word].read(), 0xF); 5185 } 5186 m_llsc_table.sw(r_cleanup_nline.read()); 5187 //m_llsc_table.sw(r_cleanup_nline.read()*m_words*4); 5188 } 5189 4470 5190 4471 5191 m_cache_directory.write(set, way, entry); 4472 5192 4473 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5193 5194 /*RWT*/ 5195 if (inval_request) 5196 { 5197 r_cleanup_fsm = CLEANUP_IVT_LOCK_DATA; 5198 } 5199 else 5200 { 5201 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5202 } 4474 5203 4475 5204 #if DEBUG_MEMC_CLEANUP … … 4485 5214 << " / count = " << entry.count 4486 5215 << " / is_cnt = " << entry.is_cnt 5216 << " / match_inval = " << inval_request 4487 5217 << std::endl; 4488 5218 } … … 4491 5221 break; 4492 5222 } 4493 5223 ///////////////////// 5224 case CLEANUP_IVT_LOCK_DATA://RWT 5225 { 5226 //Search for a matching inval in the UPT (there must be one) and check if there is a pending read. 5227 if(r_alloc_ivt_fsm.read() == ALLOC_IVT_CLEANUP) 5228 { 5229 size_t index = 0; 5230 bool match_inval; 5231 5232 match_inval = m_upt.search_inval(r_cleanup_nline.read(), index); 5233 assert (match_inval && "VCI MEM CACHE ERROR: In CLEANUP_IVT_LOCK_DATA, NO CORRESPONDING INVAL"); 5234 r_cleanup_read_srcid = m_upt.srcid(index); 5235 r_cleanup_read_trdid = m_upt.trdid(index); 5236 r_cleanup_read_pktid = 0x0 + m_upt.pktid(index); 5237 r_cleanup_read_need_rsp = !m_upt.need_rsp(index); 5238 r_cleanup_index = index; 5239 5240 r_cleanup_fsm = CLEANUP_IVT_CLEAR_DATA; 5241 } 5242 #if DEBUG_MC_CLEANUP 5243 if (m_debug) 5244 { 5245 std::cout 5246 << " <MEMC " << name() 5247 << " CLEANUP_IVT_LOCK_DATA> fetch pending inval" 5248 << std::endl; 5249 } 5250 #endif 5251 break; 5252 } 5253 5254 ////////////////////////// 5255 case CLEANUP_IVT_CLEAR_DATA://RWT 5256 { 5257 m_upt.clear(r_cleanup_index.read()); 5258 assert ((r_cleanup_read_need_rsp.read() == (r_read_to_cleanup_req.read() && (r_cleanup_nline.read() == r_read_to_cleanup_nline.read()))) && "condition pending read"); 5259 if (r_cleanup_read_need_rsp.read()) 5260 { 5261 r_cleanup_fsm = CLEANUP_READ_RSP; 5262 } 5263 else 5264 { 5265 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5266 } 5267 #if DEBUG_MC_CLEANUP 5268 if (m_debug) 5269 { 5270 std::cout 5271 << " <MEMC " << name() 5272 << " CLEANUP_IVT_CLEAR_DATA> clear UPT entry" 5273 << std::endl; 5274 } 5275 #endif 5276 break; 5277 } 5278 5279 //////////////////////// 5280 case CLEANUP_READ_RSP://RWT 5281 { 5282 if(r_cleanup_to_tgt_rsp_req.read()) break; 5283 5284 r_cleanup_to_tgt_rsp_req = true; 5285 r_cleanup_to_tgt_rsp_srcid = r_cleanup_read_srcid.read(); 5286 r_cleanup_to_tgt_rsp_trdid = r_cleanup_read_trdid.read(); 5287 r_cleanup_to_tgt_rsp_pktid = 0x0 + r_cleanup_read_pktid.read();//WT 5288 r_cleanup_to_tgt_rsp_type = 0; //Read instruction 5289 r_cleanup_to_tgt_rsp_length = r_read_to_cleanup_length.read(); 5290 r_cleanup_to_tgt_rsp_first_word = r_read_to_cleanup_first_word.read(); 5291 r_read_to_cleanup_req = false; 5292 m_cpt_ncc_to_cc_read ++; 5293 if (r_cleanup_contains_data.read()) //L1 was dirty 5294 { 5295 for(size_t i = 0; i<m_words; i++) 5296 { 5297 r_cleanup_to_tgt_rsp_data[i] = r_cleanup_data[i].read(); 5298 } 5299 } 5300 else //the L2 data are up to date 5301 { 5302 for(size_t i = 0; i<m_words; i++) 5303 { 5304 r_cleanup_to_tgt_rsp_data[i] = r_cleanup_old_data[i].read(); 5305 } 5306 } 5307 5308 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5309 5310 #if DEBUG_MC_CLEANUP 5311 if (m_debug) 5312 { 5313 std::cout 5314 << " <MEMC " << name() 5315 << " CLEANUP_READ_RSP> answer READ" 5316 << std::endl; 5317 } 5318 #endif 5319 break; 5320 } 4494 5321 ////////////////////// 4495 5322 case CLEANUP_HEAP_REQ: … … 4497 5324 // get the lock to the HEAP directory 4498 5325 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) break; 4499 5326 4500 5327 r_cleanup_fsm = CLEANUP_HEAP_LOCK; 4501 5328 … … 4509 5336 } 4510 5337 #endif 5338 m_cpt_cleanup_fsm_n_heap_lock++; 4511 5339 break; 4512 5340 } … … 4568 5396 << " / r_cleanup_copy_inst = " << r_cleanup_copy_inst.read() << std::endl 4569 5397 << "heap_entry.owner.srcid = " << heap_entry.owner.srcid 4570 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl ;5398 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl 4571 5399 /**/ 5400 << "nline = " << r_cleanup_nline << std::endl; 4572 5401 exit(0); 4573 5402 } … … 4587 5416 << " / r_cleanup_copy_inst = " << r_cleanup_copy_inst.read() << std::endl 4588 5417 << "heap_entry.owner.srcid = " << heap_entry.owner.srcid 4589 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl ;5418 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl 4590 5419 /**/ 4591 5420 << "nline = " << r_cleanup_nline << std::endl; 4592 5421 exit(0); 4593 5422 } … … 4595 5424 DirectoryEntry dir_entry; 4596 5425 dir_entry.valid = true; 5426 dir_entry.cache_coherent = true; 4597 5427 dir_entry.is_cnt = r_cleanup_is_cnt.read(); 4598 5428 dir_entry.dirty = r_cleanup_dirty.read(); … … 4652 5482 4653 5483 m_cache_directory.write(set,way,dir_entry); 5484 4654 5485 4655 5486 #if DEBUG_MEMC_CLEANUP … … 4854 5685 // invalidate transaction matching the cleanup 4855 5686 { 5687 m_cpt_cleanup_fsm_ivt_lock++; 4856 5688 if(r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP) break; 4857 5689 … … 4860 5692 4861 5693 match_inval = m_ivt.search_inval(r_cleanup_nline.read(), index); 4862 4863 5694 if ( not match_inval ) // no pending inval 4864 5695 { … … 4874 5705 << std::endl; 4875 5706 #endif 4876 break; 5707 m_cpt_cleanup_fsm_n_upt_lock++; 5708 break; 4877 5709 } 4878 5710 … … 4914 5746 m_ivt.decrement(r_cleanup_index.read(), count); 4915 5747 5748 4916 5749 if(count == 0) // multi inval transaction completed 4917 5750 { … … 4920 5753 else // multi inval transaction not completed 4921 5754 { 4922 r_cleanup_fsm = CLEANUP_SEND_CLACK ; 5755 if (r_cleanup_ncc.read()) //need to put data to the XRAM 5756 { 5757 r_cleanup_fsm = CLEANUP_IXR_REQ; 5758 } 5759 else 5760 { 5761 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5762 } 4923 5763 } 4924 5764 … … 4950 5790 if ( r_cleanup_need_rsp.read() ) r_cleanup_fsm = CLEANUP_WRITE_RSP; 4951 5791 else if ( r_cleanup_need_ack.read() ) r_cleanup_fsm = CLEANUP_CONFIG_ACK; 5792 else if ( r_cleanup_ncc.read() ) r_cleanup_fsm = CLEANUP_IXR_REQ; 4952 5793 else r_cleanup_fsm = CLEANUP_SEND_CLACK; 4953 5794 … … 4971 5812 r_cleanup_to_tgt_rsp_trdid = r_cleanup_write_trdid.read(); 4972 5813 r_cleanup_to_tgt_rsp_pktid = r_cleanup_write_pktid.read(); 4973 4974 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5814 r_cleanup_to_tgt_rsp_type = true; 5815 5816 if (r_cleanup_ncc.read()) 5817 { 5818 r_cleanup_fsm = CLEANUP_IXR_REQ;//need to put data to the XRAM 5819 } 5820 else 5821 { 5822 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5823 } 4975 5824 4976 5825 #if DEBUG_MEMC_CLEANUP … … 5000 5849 break; 5001 5850 } 5851 5852 ///////////////////////// 5853 case CLEANUP_IXR_REQ: 5854 { 5855 5856 //Send a request to the ixr to write the data in the XRAM using the prereserved TRT entry 5857 if (r_alloc_trt_fsm.read() == ALLOC_TRT_CLEANUP) 5858 { 5859 if(!r_cleanup_to_ixr_cmd_req.read()) 5860 { 5861 size_t index = 0; 5862 bool hit = m_trt.hit_write(r_cleanup_nline.read(), &index); 5863 5864 assert (hit and "CLEANUP_IXR_REQ found no matching entry in TRT"); 5865 5866 r_cleanup_to_ixr_cmd_req = true; 5867 5868 for(size_t i = 0; i < m_words; i++){ 5869 r_cleanup_to_ixr_cmd_data[i] = r_cleanup_data[i]; 5870 } 5871 5872 r_cleanup_to_ixr_cmd_srcid = r_cleanup_srcid.read(); 5873 r_cleanup_to_ixr_cmd_trdid = index; 5874 r_cleanup_to_ixr_cmd_pktid = r_cleanup_pktid.read(); 5875 r_cleanup_to_ixr_cmd_nline = r_cleanup_nline.read(); 5876 r_cleanup_to_ixr_cmd_ncc_l1_dirty = r_cleanup_contains_data.read(); 5877 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5878 #if DEBUG_MEMC_CLEANUP 5879 if(m_debug) 5880 { 5881 std::cout 5882 << " <MEMC " << name() 5883 << " CLEANUP_IXR_REQ>" 5884 << " request send to IXR_CMD" 5885 << std::endl; 5886 } 5887 #endif 5888 } 5889 else 5890 { 5891 r_cleanup_fsm = CLEANUP_WAIT; 5892 #if DEBUG_MEMC_CLEANUP 5893 if(m_debug) 5894 { 5895 std::cout 5896 << " <MEMC " << name() 5897 << " CLEANUP_IXR_REQ>" 5898 << " waiting completion of previous request" 5899 << std::endl; 5900 } 5901 #endif 5902 } 5903 } 5904 break; 5905 } 5906 5907 ///////////////////// 5908 case CLEANUP_WAIT : 5909 { 5910 r_cleanup_fsm = CLEANUP_IXR_REQ; 5911 break; 5912 } 5913 5002 5914 //////////////////////// 5003 5915 case CLEANUP_SEND_CLACK: // acknowledgement to a cleanup command … … 5102 6014 { 5103 6015 r_cas_fsm = CAS_DIR_LOCK; 6016 m_cpt_cas_fsm_n_dir_lock++; 5104 6017 } 5105 6018 … … 5112 6025 } 5113 6026 #endif 6027 6028 m_cpt_cas_fsm_dir_lock++; 6029 5114 6030 break; 5115 6031 } … … 5124 6040 5125 6041 r_cas_is_cnt = entry.is_cnt; 6042 r_cas_coherent = entry.cache_coherent; 5126 6043 r_cas_dirty = entry.dirty; 5127 6044 r_cas_tag = entry.tag; … … 5171 6088 DirectoryEntry entry; 5172 6089 entry.valid = true; 6090 entry.cache_coherent = r_cas_coherent.read(); 5173 6091 entry.is_cnt = r_cas_is_cnt.read(); 5174 6092 entry.dirty = true; … … 5238 6156 { 5239 6157 // The CAS is a success => sw access to the llsc_global_table 5240 m_llsc_table.sw(m_cmd_cas_addr_fifo.read()); 6158 // BUG LLSC 6159 addr_t nline = m_nline[(addr_t)(m_cmd_cas_addr_fifo.read())]; 6160 m_llsc_table.sw(nline); 6161 //m_llsc_table.sw(m_cmd_cas_addr_fifo.read()); 6162 /**//*std::cout << "MEMCACHE : from proc " << m_cmd_cas_srcid_fifo.read() 6163 << " | @ " << std::hex << m_cmd_cas_addr_fifo.read() 6164 << " | WRITE (cas triggered)" << std::endl;*/ 5241 6165 5242 6166 // test coherence request … … 5355 6279 << " / count = " << nb_copies << std::endl; 5356 6280 #endif 5357 } 6281 m_cpt_cas_fsm_n_upt_lock++; 6282 } 6283 6284 m_cpt_cas_fsm_upt_lock++; 6285 5358 6286 break; 5359 6287 } … … 5386 6314 #endif 5387 6315 r_cas_fsm = CAS_UPT_REQ; 5388 } 6316 m_cpt_cas_fsm_n_heap_lock++; 6317 } 6318 6319 m_cpt_cas_fsm_heap_lock++; 6320 5389 6321 break; 5390 6322 } … … 5526 6458 r_cas_fsm = CAS_WAIT; 5527 6459 } 5528 } 6460 m_cpt_cas_fsm_n_trt_lock++; 6461 } 6462 6463 m_cpt_cas_fsm_trt_lock++; 6464 5529 6465 break; 5530 6466 } … … 5591 6527 r_cas_fsm = CAS_WAIT; 5592 6528 } 5593 } 6529 m_cpt_cas_fsm_n_upt_lock++; 6530 } 6531 6532 m_cpt_cas_fsm_upt_lock++; 6533 5594 6534 break; 5595 6535 } … … 5769 6709 r_cas_fsm = CAS_MISS_TRT_SET; 5770 6710 } 5771 } 6711 m_cpt_cas_fsm_n_trt_lock++; 6712 } 6713 6714 m_cpt_cas_fsm_trt_lock++; 6715 5772 6716 break; 5773 6717 } … … 5897 6841 break; 5898 6842 } 6843 6844 if(r_read_to_cc_send_req.read()) 6845 { 6846 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_HEADER; 6847 break; 6848 } 6849 6850 if(r_write_to_cc_send_req.read()) 6851 { 6852 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_HEADER; 6853 break; 6854 } 6855 6856 5899 6857 // WRITE 6858 if(r_read_to_cc_send_req.read()) 6859 { 6860 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_HEADER; 6861 break; 6862 } 6863 6864 if(r_write_to_cc_send_req.read()) 6865 { 6866 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_HEADER; 6867 break; 6868 } 5900 6869 if(m_write_to_cc_send_inst_fifo.rok() or 5901 6870 r_write_to_cc_send_multi_req.read()) … … 5971 6940 } 5972 6941 // WRITE 6942 if(r_read_to_cc_send_req.read()) 6943 { 6944 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_HEADER; 6945 break; 6946 } 6947 6948 if(r_write_to_cc_send_req.read()) 6949 { 6950 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_HEADER; 6951 break; 6952 } 5973 6953 if(m_write_to_cc_send_inst_fifo.rok() or 5974 6954 r_write_to_cc_send_multi_req.read()) … … 6003 6983 break; 6004 6984 } 6985 6986 if(r_read_to_cc_send_req.read()) 6987 { 6988 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_HEADER; 6989 break; 6990 } 6991 6992 if(r_write_to_cc_send_req.read()) 6993 { 6994 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_HEADER; 6995 break; 6996 } 6997 6998 6005 6999 // WRITE 7000 if(r_read_to_cc_send_req.read()) 7001 { 7002 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_HEADER; 7003 break; 7004 } 7005 7006 if(r_write_to_cc_send_req.read()) 7007 { 7008 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_HEADER; 7009 break; 7010 } 6006 7011 if(m_write_to_cc_send_inst_fifo.rok() or 6007 7012 r_write_to_cc_send_multi_req.read()) … … 6050 7055 case CC_SEND_CAS_IDLE: // CLEANUP FSM has highest priority 6051 7056 { 7057 7058 if(r_read_to_cc_send_req.read()) 7059 { 7060 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_HEADER; 7061 break; 7062 } 7063 7064 if(r_write_to_cc_send_req.read()) 7065 { 7066 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_HEADER; 7067 break; 7068 } 7069 7070 6052 7071 if(m_write_to_cc_send_inst_fifo.rok() or 6053 7072 r_write_to_cc_send_multi_req.read()) … … 6208 7227 break; 6209 7228 } 7229 7230 case CC_SEND_READ_NCC_INVAL_HEADER: 7231 { 7232 if(not p_dspin_m2p.read) break; 7233 7234 r_cc_send_fsm = CC_SEND_READ_NCC_INVAL_NLINE; 7235 break; 7236 } 7237 7238 case CC_SEND_READ_NCC_INVAL_NLINE: 7239 { 7240 if(not p_dspin_m2p.read) break; 7241 7242 r_read_to_cc_send_req = false; 7243 r_cc_send_fsm = CC_SEND_WRITE_IDLE; 7244 7245 #if DEBUG_MEMC_CC_SEND 7246 if(m_debug) 7247 { 7248 std::cout 7249 << " <MEMC " << name() 7250 << " CC_SEND_READ_NCC_INVAL_HEADER> Inval for line " 7251 << r_read_to_cc_send_nline.read() 7252 << std::endl; 7253 } 7254 #endif 7255 break; 7256 } 7257 7258 7259 case CC_SEND_WRITE_NCC_INVAL_HEADER: 7260 { 7261 if(not p_dspin_m2p.read) break; 7262 7263 r_cc_send_fsm = CC_SEND_WRITE_NCC_INVAL_NLINE; 7264 break; 7265 } 7266 7267 case CC_SEND_WRITE_NCC_INVAL_NLINE: 7268 { 7269 if(not p_dspin_m2p.read) break; 7270 7271 r_write_to_cc_send_req = false; 7272 r_cc_send_fsm = CC_SEND_WRITE_IDLE; 7273 7274 #if DEBUG_MEMC_CC_SEND 7275 if(m_debug) 7276 { 7277 std::cout 7278 << " <MEMC " << name() 7279 << " CC_SEND_WRITE_NCC_INVAL_HEADER> Inval for line " 7280 << r_write_to_cc_send_nline.read() 7281 << std::endl; 7282 } 7283 #endif 7284 break; 7285 } 7286 7287 6210 7288 ////////////////////////////////// 6211 7289 case CC_SEND_WRITE_BRDCAST_HEADER: // send first flit broadcast-inval (from WRITE FSM) … … 6417 7495 break; 6418 7496 6419 assert(not p_dspin_p2m.eop.read() and6420 "VCI_MEM_CACHE ERROR in CC_RECEIVE : "6421 "CLEANUP command must have two flits");6422 6423 7497 cc_receive_to_cleanup_fifo_put = true; 6424 r_cc_receive_fsm = CC_RECEIVE_CLEANUP_EOP; 7498 if(p_dspin_p2m.eop.read()) 7499 r_cc_receive_fsm = CC_RECEIVE_IDLE; 6425 7500 6426 7501 break; … … 6439 7514 6440 7515 cc_receive_to_cleanup_fifo_put = true; 6441 r_cc_receive_fsm = CC_RECEIVE_IDLE;6442 7516 if(p_dspin_p2m.eop.read()) 7517 r_cc_receive_fsm = CC_RECEIVE_IDLE; 6443 7518 break; 6444 7519 } … … 6519 7594 } 6520 7595 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 6521 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7596 else if(r_cleanup_to_tgt_rsp_req) 7597 { 7598 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7599 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7600 } 6522 7601 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 6523 7602 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; … … 6535 7614 } 6536 7615 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 7616 else if(r_cleanup_to_tgt_rsp_req) 7617 { 7618 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7619 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7620 } 7621 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 7622 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 7623 else if(r_read_to_tgt_rsp_req) 7624 { 7625 r_tgt_rsp_fsm = TGT_RSP_READ; 7626 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 7627 } 7628 break; 7629 } 7630 //////////////////////// 7631 case TGT_RSP_WRITE_IDLE: // cas requests have the highest priority 7632 { 7633 if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS; 7634 else if(r_xram_rsp_to_tgt_rsp_req) 7635 { 7636 r_tgt_rsp_fsm = TGT_RSP_XRAM; 7637 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 7638 } 7639 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 7640 else if(r_cleanup_to_tgt_rsp_req) 7641 { 7642 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7643 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7644 } 7645 7646 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 7647 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 7648 else if(r_read_to_tgt_rsp_req) 7649 { 7650 r_tgt_rsp_fsm = TGT_RSP_READ; 7651 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 7652 } 7653 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE; 7654 break; 7655 } 7656 /////////////////////// 7657 case TGT_RSP_CAS_IDLE: // xram_rsp requests have the highest priority 7658 { 7659 if(r_xram_rsp_to_tgt_rsp_req) 7660 { 7661 r_tgt_rsp_fsm = TGT_RSP_XRAM; 7662 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 7663 } 7664 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK ; 7665 else if(r_cleanup_to_tgt_rsp_req) 7666 { 7667 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7668 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7669 } 7670 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 7671 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 7672 else if(r_read_to_tgt_rsp_req) 7673 { 7674 r_tgt_rsp_fsm = TGT_RSP_READ; 7675 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 7676 } 7677 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE; 7678 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ; 7679 break; 7680 } 7681 /////////////////////// 7682 case TGT_RSP_XRAM_IDLE: // multi ack requests have the highest priority 7683 { 7684 7685 if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK ; 7686 else if(r_cleanup_to_tgt_rsp_req) 7687 { 7688 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7689 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7690 } 6537 7691 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 6538 7692 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; … … 6543 7697 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 6544 7698 } 6545 break; 6546 } 6547 //////////////////////// 6548 case TGT_RSP_WRITE_IDLE: // cas requests have the highest priority 6549 { 6550 if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS; 7699 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE; 7700 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ; 6551 7701 else if(r_xram_rsp_to_tgt_rsp_req) 6552 7702 { … … 6554 7704 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 6555 7705 } 6556 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 6557 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7706 break; 7707 } 7708 //////////////////////////// 7709 case TGT_RSP_MULTI_ACK_IDLE: // cleanup requests have the highest priority 7710 { 7711 if(r_cleanup_to_tgt_rsp_req) 7712 { 7713 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7714 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7715 } 6558 7716 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 6559 7717 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; … … 6564 7722 } 6565 7723 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE; 6566 break; 6567 } 6568 /////////////////////// 6569 case TGT_RSP_CAS_IDLE: // xram_rsp requests have the highest priority 6570 { 6571 if(r_xram_rsp_to_tgt_rsp_req) 7724 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ; 7725 else if(r_xram_rsp_to_tgt_rsp_req) 6572 7726 { 6573 7727 r_tgt_rsp_fsm = TGT_RSP_XRAM; 6574 7728 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 6575 7729 } 6576 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK ; 6577 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 6578 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 6579 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 6580 else if(r_read_to_tgt_rsp_req) 6581 { 6582 r_tgt_rsp_fsm = TGT_RSP_READ; 6583 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read(); 6584 } 6585 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE; 6586 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ; 6587 break; 6588 } 6589 /////////////////////// 6590 case TGT_RSP_XRAM_IDLE: // multi ack requests have the highest priority 6591 { 6592 6593 if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK ; 6594 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 6595 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 7730 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK; 7731 break; 7732 } 7733 ////////////////////////// 7734 case TGT_RSP_CLEANUP_IDLE: // tgt cmd requests have the highest priority 7735 { 7736 if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 6596 7737 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; 6597 7738 else if(r_read_to_tgt_rsp_req) … … 6607 7748 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read(); 6608 7749 } 6609 break;6610 }6611 ////////////////////////////6612 case TGT_RSP_MULTI_ACK_IDLE: // cleanup requests have the highest priority6613 {6614 if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP;6615 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG;6616 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD;6617 else if(r_read_to_tgt_rsp_req)6618 {6619 r_tgt_rsp_fsm = TGT_RSP_READ;6620 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read();6621 }6622 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE;6623 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ;6624 else if(r_xram_rsp_to_tgt_rsp_req)6625 {6626 r_tgt_rsp_fsm = TGT_RSP_XRAM;6627 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read();6628 }6629 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK;6630 break;6631 }6632 //////////////////////////6633 case TGT_RSP_CLEANUP_IDLE: // tgt cmd requests have the highest priority6634 {6635 if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG;6636 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD;6637 else if(r_read_to_tgt_rsp_req)6638 {6639 r_tgt_rsp_fsm = TGT_RSP_READ;6640 r_tgt_rsp_cpt = r_read_to_tgt_rsp_word.read();6641 }6642 else if(r_write_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_WRITE;6643 else if(r_cas_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CAS ;6644 else if(r_xram_rsp_to_tgt_rsp_req)6645 {6646 r_tgt_rsp_fsm = TGT_RSP_XRAM;6647 r_tgt_rsp_cpt = r_xram_rsp_to_tgt_rsp_word.read();6648 }6649 7750 else if(r_multi_ack_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_MULTI_ACK ; 6650 else if(r_cleanup_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7751 else if(r_cleanup_to_tgt_rsp_req) 7752 { 7753 r_tgt_rsp_fsm = TGT_RSP_CLEANUP; 7754 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7755 } 6651 7756 break; 6652 7757 } … … 6716 7821 #endif 6717 7822 7823 6718 7824 uint32_t last_word_idx = r_read_to_tgt_rsp_word.read() + 6719 7825 r_read_to_tgt_rsp_length.read() - 1; … … 6728 7834 r_read_to_tgt_rsp_req = false; 6729 7835 r_tgt_rsp_fsm = TGT_RSP_READ_IDLE; 7836 if (r_read_to_tgt_rsp_pktid.read() == 0x0) 7837 { 7838 m_cpt_read_data_unc ++; 7839 } 7840 else if (r_read_to_tgt_rsp_pktid.read() == 0x1) 7841 { 7842 m_cpt_read_data_miss_CC ++; 7843 } 7844 else if (r_read_to_tgt_rsp_pktid.read() == 0x2) 7845 { 7846 m_cpt_read_ins_unc ++; 7847 } 7848 else if (r_read_to_tgt_rsp_pktid.read() == 0x3) 7849 { 7850 m_cpt_read_ins_miss ++; 7851 } 7852 else if (r_read_to_tgt_rsp_pktid.read() == 0x6) 7853 { 7854 m_cpt_read_ll_CC ++; 7855 } 7856 else if (r_read_to_tgt_rsp_pktid.read() == 0x9) 7857 { 7858 m_cpt_read_data_miss_NCC ++; 7859 } 7860 else if (r_read_to_tgt_rsp_pktid.read() == 0x14) 7861 { 7862 m_cpt_read_ll_NCC ++; 7863 } 7864 else 7865 { 7866 m_cpt_read_WTF ++; 7867 } 6730 7868 } 6731 7869 else … … 6768 7906 6769 7907 #if DEBUG_MEMC_TGT_RSP 6770 if(m_debug) 6771 std::cout << " <MEMC " << name() << " TGT_RSP_CLEANUP> Cleanup response" 6772 << " / rsrcid = " << std::hex << r_cleanup_to_tgt_rsp_srcid.read() 6773 << " / rtrdid = " << r_cleanup_to_tgt_rsp_trdid.read() 6774 << " / rpktid = " << r_cleanup_to_tgt_rsp_pktid.read() << std::endl; 6775 #endif 6776 r_tgt_rsp_fsm = TGT_RSP_CLEANUP_IDLE; 6777 r_cleanup_to_tgt_rsp_req = false; 7908 if(m_debug) 7909 { 7910 std::cout << " <MEMC " << name() << " TGT_RSP_CLEANUP> Cleanup response" 7911 << " / rsrcid = " << std::dec << r_cleanup_to_tgt_rsp_srcid.read() 7912 << " / rtrdid = " << r_cleanup_to_tgt_rsp_trdid.read() 7913 << " / rpktid = " << r_cleanup_to_tgt_rsp_pktid.read() << std::endl 7914 << " / data = " << std::hex << r_cleanup_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read() << std::dec << std::endl; 7915 } 7916 #endif 7917 7918 7919 uint32_t last_word_idx = r_cleanup_to_tgt_rsp_first_word.read() + r_cleanup_to_tgt_rsp_length.read() - 1; 7920 bool is_ll = ((r_cleanup_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL); 7921 7922 if (r_cleanup_to_tgt_rsp_type.read() or ((r_tgt_rsp_cpt.read() == last_word_idx) and not is_ll) or (r_tgt_rsp_key_sent.read() and is_ll) ) 7923 { 7924 r_tgt_rsp_fsm = TGT_RSP_CLEANUP_IDLE; 7925 r_cleanup_to_tgt_rsp_req = false; 7926 r_tgt_rsp_key_sent = false; 7927 7928 7929 if (r_cleanup_to_tgt_rsp_pktid.read() == 0x0) 7930 { 7931 m_cpt_read_data_unc ++; 7932 } 7933 else if (r_cleanup_to_tgt_rsp_pktid.read() == 0x1) 7934 { 7935 m_cpt_read_data_miss_CC ++; 7936 } 7937 else if (r_cleanup_to_tgt_rsp_pktid.read() == 0x2) 7938 { 7939 m_cpt_read_ins_unc ++; 7940 } 7941 else if (r_cleanup_to_tgt_rsp_pktid.read() == 0x3) 7942 { 7943 m_cpt_read_ins_miss ++; 7944 } 7945 else if (r_cleanup_to_tgt_rsp_pktid.read() == 0x6) 7946 { 7947 m_cpt_read_ll_CC ++; 7948 } 7949 else if (r_cleanup_to_tgt_rsp_pktid.read() == 0x9) 7950 { 7951 m_cpt_read_data_miss_NCC ++; 7952 } 7953 else if (r_cleanup_to_tgt_rsp_pktid.read() == 0x14) 7954 { 7955 m_cpt_read_ll_NCC ++; 7956 } 7957 else if (!r_cleanup_to_tgt_rsp_type.read()) 7958 { 7959 m_cpt_read_WTF ++; 7960 } 7961 7962 } 7963 else 7964 { 7965 if (is_ll) 7966 { 7967 r_tgt_rsp_key_sent = true; 7968 } 7969 else 7970 { 7971 r_tgt_rsp_cpt = r_tgt_rsp_cpt.read() + 1; 7972 } 7973 } 7974 6778 7975 } 6779 7976 break; … … 6825 8022 r_xram_rsp_to_tgt_rsp_req = false; 6826 8023 r_tgt_rsp_fsm = TGT_RSP_XRAM_IDLE; 8024 8025 8026 if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x0) 8027 { 8028 m_cpt_read_data_unc ++; 8029 } 8030 else if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x1) 8031 { 8032 m_cpt_read_data_miss_CC ++; 8033 } 8034 else if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x2) 8035 { 8036 m_cpt_read_ins_unc ++; 8037 } 8038 else if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x3) 8039 { 8040 m_cpt_read_ins_miss ++; 8041 } 8042 else if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x6) 8043 { 8044 m_cpt_read_ll_CC ++; 8045 } 8046 else if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x9) 8047 { 8048 m_cpt_read_data_miss_NCC ++; 8049 } 8050 else if (r_xram_rsp_to_tgt_rsp_pktid.read() == 0x14) 8051 { 8052 m_cpt_read_ll_NCC ++; 8053 } 8054 else 8055 { 8056 m_cpt_read_WTF ++; 8057 } 8058 6827 8059 } 6828 8060 else … … 6882 8114 else if (r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 6883 8115 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 8116 8117 else 8118 m_cpt_upt_unused++; 6884 8119 } 6885 8120 break; … … 6894 8129 else if (r_write_fsm.read() == WRITE_UPT_LOCK) 6895 8130 r_alloc_upt_fsm = ALLOC_UPT_WRITE; 8131 8132 else 8133 m_cpt_upt_unused++; 6896 8134 } 6897 8135 break; … … 6907 8145 else if (r_cas_fsm.read() == CAS_UPT_LOCK) 6908 8146 r_alloc_upt_fsm = ALLOC_UPT_CAS; 8147 8148 else 8149 m_cpt_upt_unused++; 6909 8150 } 6910 8151 break; … … 6930 8171 ////////////////////////// 6931 8172 case ALLOC_IVT_WRITE: // allocated to WRITE FSM 6932 if (r_write_fsm.read() != WRITE_BC_IVT_LOCK) 8173 if ((r_write_fsm.read() != WRITE_BC_IVT_LOCK) and 8174 (r_write_fsm.read() != WRITE_IVT_LOCK_HIT_WB) and 8175 (r_write_fsm.read() != WRITE_MISS_IVT_LOCK)) 6933 8176 { 6934 if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 6935 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 6936 6937 else if (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) 6938 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 6939 6940 else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 8177 if(r_read_fsm.read() == READ_IVT_LOCK) 8178 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8179 8180 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 8181 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8182 8183 else if ((r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) or 8184 (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK_DATA)) 8185 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 8186 8187 else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 6941 8188 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 6942 6943 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 6944 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8189 8190 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 8191 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8192 8193 else 8194 m_cpt_ivt_unused++; 8195 } 8196 break; 8197 8198 ////////////////////////// 8199 case ALLOC_IVT_READ: // allocated to READ FSM 8200 if (r_read_fsm.read() != READ_IVT_LOCK) 8201 { 8202 if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 8203 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8204 8205 else if ((r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) or 8206 (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK_DATA)) 8207 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 8208 8209 else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 8210 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8211 8212 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 8213 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8214 8215 else if ((r_write_fsm.read() == WRITE_BC_IVT_LOCK) or 8216 (r_write_fsm.read() == WRITE_IVT_LOCK_HIT_WB) or 8217 (r_write_fsm.read() == WRITE_MISS_IVT_LOCK)) 8218 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8219 8220 else 8221 m_cpt_ivt_unused++; 6945 8222 } 6946 8223 break; … … 6950 8227 if(r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK) 6951 8228 { 6952 if(r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) 6953 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 6954 6955 else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 6956 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 6957 6958 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 6959 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 6960 6961 else if (r_write_fsm.read() == WRITE_BC_IVT_LOCK) 6962 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8229 if ((r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) or 8230 (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK_DATA)) 8231 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 8232 8233 else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 8234 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8235 8236 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 8237 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8238 8239 else if ((r_write_fsm.read() == WRITE_BC_IVT_LOCK) or 8240 (r_write_fsm.read() == WRITE_IVT_LOCK_HIT_WB) or 8241 (r_write_fsm.read() == WRITE_MISS_IVT_LOCK)) 8242 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8243 8244 else if(r_read_fsm.read() == READ_IVT_LOCK) 8245 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8246 8247 else 8248 m_cpt_ivt_unused++; 6963 8249 } 6964 8250 break; … … 6967 8253 case ALLOC_IVT_CLEANUP: // allocated to CLEANUP FSM 6968 8254 if ((r_cleanup_fsm.read() != CLEANUP_IVT_LOCK ) and 6969 (r_cleanup_fsm.read() != CLEANUP_IVT_DECREMENT)) 8255 (r_cleanup_fsm.read() != CLEANUP_IVT_DECREMENT) and 8256 (r_cleanup_fsm.read() != CLEANUP_IVT_LOCK_DATA)) 6970 8257 { 6971 if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 6972 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 6973 6974 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 6975 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 6976 6977 else if (r_write_fsm.read() == WRITE_BC_IVT_LOCK) 6978 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 6979 6980 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 6981 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8258 if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 8259 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8260 8261 else if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 8262 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8263 8264 else if ((r_write_fsm.read() == WRITE_BC_IVT_LOCK) or 8265 (r_write_fsm.read() == WRITE_IVT_LOCK_HIT_WB) or 8266 (r_write_fsm.read() == WRITE_MISS_IVT_LOCK)) 8267 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8268 8269 else if(r_read_fsm.read() == READ_IVT_LOCK) 8270 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8271 8272 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 8273 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8274 8275 else 8276 m_cpt_ivt_unused++; 6982 8277 } 6983 8278 break; … … 6987 8282 if (r_cas_fsm.read() != CAS_BC_IVT_LOCK) 6988 8283 { 6989 if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 6990 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 6991 6992 else if (r_write_fsm.read() == WRITE_BC_IVT_LOCK) 6993 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 6994 6995 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 6996 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 6997 6998 else if (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) 6999 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 8284 if (r_config_fsm.read() == CONFIG_DIR_IVT_LOCK) 8285 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8286 8287 else if ((r_write_fsm.read() == WRITE_BC_IVT_LOCK) or 8288 (r_write_fsm.read() == WRITE_IVT_LOCK_HIT_WB) or 8289 (r_write_fsm.read() == WRITE_MISS_IVT_LOCK)) 8290 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8291 8292 else if(r_read_fsm.read() == READ_IVT_LOCK) 8293 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8294 8295 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 8296 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8297 8298 else if ((r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) or 8299 (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK_DATA)) 8300 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 8301 8302 else 8303 m_cpt_ivt_unused++; 7000 8304 } 7001 8305 break; … … 7005 8309 if (r_config_fsm.read() != CONFIG_DIR_IVT_LOCK) 7006 8310 { 7007 if (r_write_fsm.read() == WRITE_BC_IVT_LOCK) 7008 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 7009 7010 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 7011 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 7012 7013 else if (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) 7014 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 7015 7016 else if (r_cas_fsm.read() == CAS_BC_IVT_LOCK) 7017 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8311 if ((r_write_fsm.read() == WRITE_BC_IVT_LOCK) or 8312 (r_write_fsm.read() == WRITE_IVT_LOCK_HIT_WB) or 8313 (r_write_fsm.read() == WRITE_MISS_IVT_LOCK)) 8314 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8315 8316 else if(r_read_fsm.read() == READ_IVT_LOCK) 8317 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8318 8319 else if (r_xram_rsp_fsm.read() == XRAM_RSP_INVAL_LOCK) 8320 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8321 8322 else if ((r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) or 8323 (r_cleanup_fsm.read() == CLEANUP_IVT_LOCK_DATA)) 8324 r_alloc_ivt_fsm = ALLOC_IVT_CLEANUP; 8325 8326 else if(r_cas_fsm.read() == CAS_BC_IVT_LOCK) 8327 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8328 8329 else 8330 m_cpt_ivt_unused++; 7018 8331 } 7019 8332 break; 7020 7021 8333 } // end switch r_alloc_ivt_fsm 7022 8334 7023 8335 //////////////////////////////////////////////////////////////////////////////////// 7024 8336 // ALLOC_DIR FSM … … 7073 8385 (r_read_fsm.read() != READ_DIR_LOCK) and 7074 8386 (r_read_fsm.read() != READ_TRT_LOCK) and 7075 (r_read_fsm.read() != READ_HEAP_REQ)) 8387 (r_read_fsm.read() != READ_HEAP_REQ) and 8388 (r_read_fsm.read() != READ_IVT_LOCK)) 7076 8389 or 7077 8390 ((r_read_fsm.read() == READ_TRT_LOCK) and … … 7089 8402 else if(r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) 7090 8403 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; 7091 8404 7092 8405 else if(r_config_fsm.read() == CONFIG_DIR_REQ) 7093 8406 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; 7094 } 7095 break; 7096 7097 ///////////////////// 7098 case ALLOC_DIR_WRITE: // allocated to WRITE FSM 7099 if(((r_write_fsm.read() != WRITE_DIR_REQ) and 7100 (r_write_fsm.read() != WRITE_DIR_LOCK) and 7101 (r_write_fsm.read() != WRITE_DIR_READ) and 7102 (r_write_fsm.read() != WRITE_DIR_HIT) and 7103 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) and 7104 (r_write_fsm.read() != WRITE_BC_IVT_LOCK) and 7105 (r_write_fsm.read() != WRITE_MISS_TRT_LOCK) and 7106 (r_write_fsm.read() != WRITE_UPT_LOCK) and 7107 (r_write_fsm.read() != WRITE_UPT_HEAP_LOCK)) 7108 or 7109 ((r_write_fsm.read() == WRITE_UPT_HEAP_LOCK) and 7110 (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE)) 7111 or 7112 ((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) and 7113 (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE))) 7114 { 8407 8408 else 8409 m_cpt_dir_unused++; 8410 } 8411 else 8412 m_cpt_read_fsm_dir_used++; 8413 break; 8414 8415 ///////////////////// 8416 case ALLOC_DIR_WRITE: 8417 if(((r_write_fsm.read() != WRITE_DIR_REQ) and 8418 (r_write_fsm.read() != WRITE_DIR_LOCK) and 8419 (r_write_fsm.read() != WRITE_DIR_READ) and 8420 (r_write_fsm.read() != WRITE_DIR_HIT) and 8421 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) and 8422 (r_write_fsm.read() != WRITE_BC_IVT_LOCK) and 8423 (r_write_fsm.read() != WRITE_MISS_IVT_LOCK) and 8424 (r_write_fsm.read() != WRITE_MISS_TRT_LOCK) and 8425 (r_write_fsm.read() != WRITE_UPT_LOCK) and 8426 (r_write_fsm.read() != WRITE_UPT_HEAP_LOCK) and 8427 (r_write_fsm.read() != WRITE_IVT_LOCK_HIT_WB)) 8428 or 8429 ((r_write_fsm.read() == WRITE_UPT_HEAP_LOCK) and 8430 (r_alloc_heap_fsm.read() == ALLOC_HEAP_WRITE)) 8431 or 8432 ((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) and 8433 (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE))) 8434 { 7115 8435 if(r_cas_fsm.read() == CAS_DIR_REQ) 7116 8436 r_alloc_dir_fsm = ALLOC_DIR_CAS; … … 7127 8447 else if(r_read_fsm.read() == READ_DIR_REQ) 7128 8448 r_alloc_dir_fsm = ALLOC_DIR_READ; 7129 } 7130 break; 8449 8450 else 8451 m_cpt_dir_unused++; 8452 } 8453 else 8454 m_cpt_write_fsm_dir_used++; 8455 break; 7131 8456 7132 8457 /////////////////// 7133 8458 case ALLOC_DIR_CAS: // allocated to CAS FSM 7134 if(((r_cas_fsm.read() != CAS_DIR_REQ) and8459 if(((r_cas_fsm.read() != CAS_DIR_REQ) and 7135 8460 (r_cas_fsm.read() != CAS_DIR_LOCK) and 7136 8461 (r_cas_fsm.read() != CAS_DIR_HIT_READ) and … … 7148 8473 ((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) and 7149 8474 (r_alloc_trt_fsm.read() == ALLOC_TRT_CAS))) 7150 {8475 { 7151 8476 if(r_cleanup_fsm.read() == CLEANUP_DIR_REQ) 7152 8477 r_alloc_dir_fsm = ALLOC_DIR_CLEANUP; … … 7163 8488 else if(r_write_fsm.read() == WRITE_DIR_REQ) 7164 8489 r_alloc_dir_fsm = ALLOC_DIR_WRITE; 7165 } 7166 break; 7167 8490 8491 else 8492 m_cpt_dir_unused++; 8493 } 8494 else 8495 m_cpt_cas_fsm_dir_used++; 8496 break; 8497 7168 8498 /////////////////////// 7169 8499 case ALLOC_DIR_CLEANUP: // allocated to CLEANUP FSM 7170 if((r_cleanup_fsm.read() != CLEANUP_DIR_REQ) and8500 if((r_cleanup_fsm.read() != CLEANUP_DIR_REQ) and 7171 8501 (r_cleanup_fsm.read() != CLEANUP_DIR_LOCK) and 7172 8502 (r_cleanup_fsm.read() != CLEANUP_HEAP_REQ) and 7173 (r_cleanup_fsm.read() != CLEANUP_HEAP_LOCK)) 7174 { 8503 (r_cleanup_fsm.read() != CLEANUP_HEAP_LOCK) and 8504 (r_cleanup_fsm.read() != CLEANUP_IVT_LOCK_DATA)) 8505 { 7175 8506 if(r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) 7176 8507 r_alloc_dir_fsm = ALLOC_DIR_XRAM_RSP; … … 7187 8518 else if(r_cas_fsm.read() == CAS_DIR_REQ) 7188 8519 r_alloc_dir_fsm = ALLOC_DIR_CAS; 7189 } 7190 break; 8520 8521 else 8522 m_cpt_dir_unused++; 8523 } 8524 else 8525 m_cpt_cleanup_fsm_dir_used++; 8526 break; 7191 8527 7192 8528 //////////////////////// 7193 8529 case ALLOC_DIR_XRAM_RSP: // allocated to XRAM_RSP FSM 7194 if( (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) and8530 if( (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) and 7195 8531 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) and 7196 8532 (r_xram_rsp_fsm.read() != XRAM_RSP_INVAL_LOCK)) 7197 {8533 { 7198 8534 if(r_config_fsm.read() == CONFIG_DIR_REQ) 7199 8535 r_alloc_dir_fsm = ALLOC_DIR_CONFIG; … … 7210 8546 else if(r_cleanup_fsm.read() == CLEANUP_DIR_REQ) 7211 8547 r_alloc_dir_fsm = ALLOC_DIR_CLEANUP; 7212 } 7213 break; 8548 8549 else 8550 m_cpt_dir_unused++; 8551 } 8552 else 8553 m_cpt_xram_rsp_fsm_dir_used++; 8554 break; 7214 8555 7215 8556 } // end switch alloc_dir_fsm … … 7245 8586 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7246 8587 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7247 } 8588 8589 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8590 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8591 8592 else 8593 m_cpt_trt_unused++; 8594 } 8595 else 8596 m_cpt_read_fsm_trt_used++; 7248 8597 break; 7249 8598 … … 7265 8614 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7266 8615 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8616 8617 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8618 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7267 8619 7268 8620 else if(r_read_fsm.read() == READ_TRT_LOCK) 7269 8621 r_alloc_trt_fsm = ALLOC_TRT_READ; 7270 } 8622 8623 else 8624 m_cpt_trt_unused++; 8625 } 8626 else 8627 m_cpt_write_fsm_trt_used++; 7271 8628 break; 7272 8629 … … 7284 8641 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7285 8642 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8643 8644 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8645 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7286 8646 7287 8647 else if(r_read_fsm.read() == READ_TRT_LOCK) … … 7291 8651 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 7292 8652 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 7293 } 8653 8654 else 8655 m_cpt_trt_unused++; 8656 } 8657 else 8658 m_cpt_cas_fsm_trt_used++; 7294 8659 break; 7295 8660 … … 7305 8670 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 7306 8671 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8672 8673 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8674 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 7307 8675 7308 8676 else if(r_read_fsm.read() == READ_TRT_LOCK) … … 7316 8684 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 7317 8685 r_alloc_trt_fsm = ALLOC_TRT_CAS; 7318 } 8686 8687 else 8688 m_cpt_trt_unused++; 8689 } 8690 else 8691 m_cpt_xram_rsp_fsm_trt_used++; 7319 8692 break; 7320 8693 … … 7324 8697 (r_ixr_rsp_fsm.read() != IXR_RSP_TRT_READ)) 7325 8698 { 8699 8700 if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8701 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8702 8703 else if(r_read_fsm.read() == READ_TRT_LOCK) 8704 r_alloc_trt_fsm = ALLOC_TRT_READ; 8705 8706 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) || 8707 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 8708 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 8709 8710 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) || 8711 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 8712 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8713 8714 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) && 8715 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 8716 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8717 8718 else 8719 m_cpt_trt_unused++; 8720 } 8721 else 8722 m_cpt_ixr_fsm_trt_used++; 8723 break; 8724 8725 //////////////////////// 8726 case ALLOC_TRT_CLEANUP: 8727 /*ODCCP*///std::cout << "TRT ALLOCATED TO CLEANUP" << std::endl; 8728 if(r_cleanup_fsm.read() != CLEANUP_IXR_REQ) 8729 { 7326 8730 if(r_read_fsm.read() == READ_TRT_LOCK) 7327 8731 r_alloc_trt_fsm = ALLOC_TRT_READ; … … 7338 8742 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 7339 8743 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8744 8745 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) || 8746 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 8747 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 7340 8748 } 7341 8749 break; … … 7388 8796 else if(r_config_fsm.read() == CONFIG_HEAP_REQ) 7389 8797 r_alloc_heap_fsm = ALLOC_HEAP_CONFIG; 7390 } 8798 8799 else 8800 m_cpt_heap_unused++; 8801 } 8802 else 8803 m_cpt_read_fsm_heap_used++; 7391 8804 break; 7392 8805 … … 7411 8824 else if(r_read_fsm.read() == READ_HEAP_REQ) 7412 8825 r_alloc_heap_fsm = ALLOC_HEAP_READ; 7413 } 8826 8827 else 8828 m_cpt_heap_unused++; 8829 } 8830 else 8831 m_cpt_write_fsm_heap_used++; 7414 8832 break; 7415 8833 … … 7434 8852 else if(r_write_fsm.read() == WRITE_UPT_HEAP_LOCK) 7435 8853 r_alloc_heap_fsm = ALLOC_HEAP_WRITE; 7436 } 8854 8855 else 8856 m_cpt_heap_unused++; 8857 } 8858 else 8859 m_cpt_cas_fsm_heap_used++; 7437 8860 break; 7438 8861 … … 7458 8881 else if(r_cas_fsm.read() == CAS_UPT_HEAP_LOCK) 7459 8882 r_alloc_heap_fsm = ALLOC_HEAP_CAS; 7460 } 8883 8884 else 8885 m_cpt_heap_unused++; 8886 } 8887 else 8888 m_cpt_cleanup_fsm_heap_used++; 7461 8889 break; 7462 8890 … … 7503 8931 if(r_xram_rsp_fsm.read() == XRAM_RSP_HEAP_REQ) 7504 8932 r_alloc_heap_fsm = ALLOC_HEAP_XRAM_RSP; 7505 } 8933 8934 else 8935 m_cpt_heap_unused++; 8936 } 8937 else 8938 m_cpt_xram_rsp_fsm_heap_used++; 7506 8939 break; 7507 8940 … … 7563 8996 //////////////////////////////////////////////////////////////////////////////////// 7564 8997 7565 m_cc_receive_to_cleanup_fifo.update( cc_receive_to_cleanup_fifo_get, 7566 cc_receive_to_cleanup_fifo_put, 7567 p_dspin_p2m.data.read() ); 8998 if(cc_receive_to_cleanup_fifo_put) 8999 { 9000 if(cc_receive_to_cleanup_fifo_get) 9001 { 9002 m_cc_receive_to_cleanup_fifo.put_and_get( ((uint64_t)(p_dspin_p2m.eop.read()&0x1) << 32) | p_dspin_p2m.data.read() ); 9003 } 9004 else 9005 { 9006 m_cc_receive_to_cleanup_fifo.simple_put( ((uint64_t)(p_dspin_p2m.eop.read()&0x1) << 32) | p_dspin_p2m.data.read() ); 9007 } 9008 } 9009 else 9010 { 9011 if(cc_receive_to_cleanup_fifo_get) 9012 { 9013 m_cc_receive_to_cleanup_fifo.simple_get(); 9014 } 9015 } 9016 //m_cc_receive_to_cleanup_fifo.update( cc_receive_to_cleanup_fifo_get, 9017 // cc_receive_to_cleanup_fifo_put, 9018 // p_dspin_p2m.data.read() ); 7568 9019 7569 9020 //////////////////////////////////////////////////////////////////////////////////// … … 7714 9165 p_vci_ixr.trdid = r_xram_rsp_to_ixr_cmd_trdid.read(); 7715 9166 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words-2)); 9167 } 9168 else if (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_DATA) 9169 { 9170 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 9171 p_vci_ixr.cmdval = true; 9172 p_vci_ixr.address = (addr_t)((r_cleanup_to_ixr_cmd_nline.read() * m_words + r_ixr_cmd_cpt.read()) * 4); 9173 if (r_cleanup_to_ixr_cmd_ncc_l1_dirty.read()) //if L1 was dirty, the correct data is in the cleanup 9174 { 9175 p_vci_ixr.wdata = ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 9176 ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read()+1].read()) << 32)); 9177 if(r_cleanup_to_ixr_cmd_nline.read() == 0x12bb) 9178 std::cout << "IXR data dirty = " << std::hex << p_vci_ixr.wdata << std::dec << std::endl; 9179 } 9180 else //if L1 was not dirty, the data is in the L2 9181 { 9182 p_vci_ixr.wdata = ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 9183 ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()+1].read()) << 32)); 9184 if(r_cleanup_to_ixr_cmd_nline.read() == 0x12bb) 9185 std::cout << "IXR data not dirty = " << std::hex << p_vci_ixr.wdata << std::dec << std::endl; 9186 } 9187 p_vci_ixr.trdid = r_cleanup_to_ixr_cmd_trdid.read(); 9188 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words - 2)); 7716 9189 } 7717 9190 else … … 7857 9330 7858 9331 case TGT_RSP_CLEANUP: 9332 { 9333 uint32_t last_word_idx = r_cleanup_to_tgt_rsp_first_word.read() + r_cleanup_to_tgt_rsp_length - 1; 9334 bool is_last_word = (r_tgt_rsp_cpt.read() == last_word_idx); 9335 bool is_ll = ((r_cleanup_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL); 9336 7859 9337 p_vci_tgt.rspval = true; 7860 p_vci_tgt.rdata = 0; 9338 if (is_ll and not r_tgt_rsp_key_sent.read()) 9339 { 9340 p_vci_tgt.rdata = r_cleanup_to_tgt_rsp_ll_key.read(); 9341 } 9342 else if (!r_cleanup_to_tgt_rsp_type.read()) 9343 { 9344 p_vci_tgt.rdata = r_cleanup_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read(); 9345 } 9346 else //if the CLEANUP fsm sends a SC_RSP, then it is a success (and it caused an inval) 9347 { 9348 p_vci_tgt.rdata = 0; 9349 } 7861 9350 p_vci_tgt.rsrcid = r_cleanup_to_tgt_rsp_srcid.read(); 7862 9351 p_vci_tgt.rtrdid = r_cleanup_to_tgt_rsp_trdid.read(); 7863 9352 p_vci_tgt.rpktid = r_cleanup_to_tgt_rsp_pktid.read(); 7864 9353 p_vci_tgt.rerror = 0; // Can be a CAS rsp 7865 p_vci_tgt.reop = true; 7866 break; 9354 p_vci_tgt.reop = r_cleanup_to_tgt_rsp_type.read() or (is_last_word and not is_ll) or (r_tgt_rsp_key_sent.read() and is_ll); 9355 break; 9356 } 7867 9357 7868 9358 case TGT_RSP_CAS: … … 7885 9375 p_vci_tgt.rspval = true; 7886 9376 7887 if( is_ll and not r_tgt_rsp_key_sent.read() ) { 9377 if( is_ll and not r_tgt_rsp_key_sent.read() ) 9378 { 7888 9379 // LL response first flit 7889 9380 p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_ll_key.read(); 7890 9381 } 7891 else { 9382 else 9383 { 7892 9384 // LL response second flit or READ response 7893 9385 p_vci_tgt.rdata = r_xram_rsp_to_tgt_rsp_data[r_tgt_rsp_cpt.read()].read(); … … 7900 9392 p_vci_tgt.reop = (((is_last_word or is_error) and not is_ll) or 7901 9393 (r_tgt_rsp_key_sent.read() and is_ll)); 9394 7902 9395 break; 7903 9396 } … … 8081 9574 } 8082 9575 ///////////////////////////////// 9576 9577 case CC_SEND_READ_NCC_INVAL_HEADER: 9578 { 9579 uint64_t flit = 0; 9580 9581 uint8_t multi_inval_type; 9582 if (r_read_to_cc_send_inst.read()) 9583 { 9584 multi_inval_type = DspinDhccpParam::TYPE_MULTI_INVAL_INST; 9585 } 9586 else 9587 { 9588 multi_inval_type = DspinDhccpParam::TYPE_MULTI_INVAL_DATA; 9589 } 9590 9591 DspinDhccpParam::dspin_set( 9592 flit, 9593 r_read_to_cc_send_dest.read(), 9594 DspinDhccpParam::MULTI_INVAL_DEST); 9595 9596 DspinDhccpParam::dspin_set( 9597 flit, 9598 m_cc_global_id, 9599 DspinDhccpParam::MULTI_INVAL_SRCID); 9600 9601 DspinDhccpParam::dspin_set( 9602 flit, 9603 DspinDhccpParam::TYPE_MULTI_INVAL_DATA, 9604 DspinDhccpParam::M2P_TYPE); 9605 9606 p_dspin_m2p.write = true; 9607 p_dspin_m2p.data = flit; 9608 9609 break; 9610 9611 } 9612 9613 9614 case CC_SEND_READ_NCC_INVAL_NLINE: 9615 { 9616 uint64_t flit = 0; 9617 9618 DspinDhccpParam::dspin_set( 9619 flit, 9620 r_read_to_cc_send_nline.read(), 9621 DspinDhccpParam::MULTI_INVAL_NLINE); 9622 9623 9624 p_dspin_m2p.write = true; 9625 p_dspin_m2p.data = flit; 9626 p_dspin_m2p.eop = true; 9627 9628 break; 9629 9630 } 9631 9632 case CC_SEND_WRITE_NCC_INVAL_HEADER: 9633 { 9634 uint64_t flit = 0; 9635 9636 DspinDhccpParam::dspin_set( 9637 flit, 9638 r_write_to_cc_send_dest.read(), 9639 DspinDhccpParam::MULTI_INVAL_DEST); 9640 9641 DspinDhccpParam::dspin_set( 9642 flit, 9643 m_cc_global_id, 9644 DspinDhccpParam::MULTI_INVAL_SRCID); 9645 9646 DspinDhccpParam::dspin_set( 9647 flit, 9648 DspinDhccpParam::TYPE_MULTI_INVAL_DATA, 9649 DspinDhccpParam::M2P_TYPE); 9650 9651 p_dspin_m2p.write = true; 9652 p_dspin_m2p.data = flit; 9653 9654 break; 9655 9656 } 9657 9658 case CC_SEND_WRITE_NCC_INVAL_NLINE: 9659 { 9660 uint64_t flit = 0; 9661 9662 DspinDhccpParam::dspin_set( 9663 flit, 9664 r_write_to_cc_send_nline.read(), 9665 DspinDhccpParam::MULTI_INVAL_NLINE); 9666 9667 9668 p_dspin_m2p.write = true; 9669 p_dspin_m2p.data = flit; 9670 p_dspin_m2p.eop = true; 9671 9672 break; 9673 9674 } 9675 9676 8083 9677 case CC_SEND_WRITE_BRDCAST_NLINE: 8084 9678 {
Note: See TracChangeset
for help on using the changeset viewer.