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