Changeset 495 for branches/RWT/modules/vci_mem_cache/caba/source/src
- Timestamp:
- Aug 22, 2013, 6:45:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RWT/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp merged eligible /branches/v5/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp 441-467
r477 r495 45 45 #define DEBUG_MEMC_WRITE 1 // detailed trace of WRITE FSM 46 46 #define DEBUG_MEMC_CAS 1 // detailed trace of CAS FSM 47 #define DEBUG_MEMC_IXR_CMD 1 // detailed trace of IXR_ RSPFSM47 #define DEBUG_MEMC_IXR_CMD 1 // detailed trace of IXR_CMD FSM 48 48 #define DEBUG_MEMC_IXR_RSP 1 // detailed trace of IXR_RSP FSM 49 49 #define DEBUG_MEMC_XRAM_RSP 1 // detailed trace of XRAM_RSP FSM … … 129 129 "MULTI_ACK_UPT_CLEAR", 130 130 "MULTI_ACK_WRITE_RSP", 131 "MULTI_ACK_CONFIG_ACK"132 131 }; 133 132 const char *config_fsm_str[] = … … 135 134 "CONFIG_IDLE", 136 135 "CONFIG_LOOP", 136 "CONFIG_WAIT" 137 137 "CONFIG_RSP", 138 138 "CONFIG_DIR_REQ", 139 139 "CONFIG_DIR_ACCESS", 140 "CONFIG_ DIR_IVT_LOCK",140 "CONFIG_IVT_LOCK", 141 141 "CONFIG_BC_SEND", 142 "CONFIG_BC_WAIT", 143 "CONFIG_INV_SEND", 142 "CONFIG_INVAL_SEND" 144 143 "CONFIG_HEAP_REQ", 145 144 "CONFIG_HEAP_SCAN", 146 145 "CONFIG_HEAP_LAST", 147 "CONFIG_INV_WAIT" 146 "CONFIG_TRT_LOCK", 147 "CONFIG_TRT_SET", 148 "CONFIG_PUT_REQ" 148 149 }; 149 150 const char *read_fsm_str[] = … … 172 173 "WRITE_DIR_LOCK", 173 174 "WRITE_IVT_LOCK_HIT_WB", 174 "WRITE_DIR_READ",175 175 "WRITE_DIR_HIT", 176 176 "WRITE_UPT_LOCK", … … 185 185 "WRITE_MISS_TRT_SET", 186 186 "WRITE_MISS_XRAM_REQ", 187 "WRITE_BC_DIR_READ", 187 188 "WRITE_BC_TRT_LOCK", 188 189 "WRITE_BC_IVT_LOCK", … … 207 208 "XRAM_RSP_DIR_UPDT", 208 209 "XRAM_RSP_DIR_RSP", 209 "XRAM_RSP_I NVAL_LOCK",210 "XRAM_RSP_IVT_LOCK", 210 211 "XRAM_RSP_INVAL_WAIT", 211 212 "XRAM_RSP_INVAL", … … 224 225 "IXR_CMD_XRAM_IDLE", 225 226 "IXR_CMD_CLEANUP_IDLE", 226 "IXR_CMD_READ", 227 "IXR_CMD_WRITE", 228 "IXR_CMD_CAS", 229 "IXR_CMD_XRAM", 230 "IXR_CMD_CLEANUP_DATA" 227 "IXR_CMD_CONFIG_IDLE", 228 "IXR_CMD_READ_TRT", 229 "IXR_CMD_WRITE_TRT", 230 "IXR_CMD_CAS_TRT", 231 "IXR_CMD_XRAM_TRT", 232 "IXR_CMD_CLEANUP_TRT", 233 "IXR_CMD_CONFIG_TRT", 234 "IXR_CMD_READ_SEND", 235 "IXR_CMD_WRITE_SEND", 236 "IXR_CMD_CAS_SEND", 237 "IXR_CMD_XRAM_SEND", 238 "IXR_CMD_CLEANUP_DATA_SEND", 239 "IXR_CMD_CONFIG_SEND" 231 240 }; 232 241 const char *cas_fsm_str[] = … … 276 285 "CLEANUP_IXR_REQ", 277 286 "CLEANUP_WAIT", 278 "CLEANUP_CONFIG_ACK",279 287 "CLEANUP_SEND_CLACK" 280 288 }; … … 297 305 "ALLOC_TRT_IXR_RSP", 298 306 "ALLOC_TRT_CLEANUP" 307 "ALLOC_TRT_IXR_CMD", 308 "ALLOC_TRT_CONFIG" 299 309 }; 300 310 const char *alloc_upt_fsm_str[] = … … 357 367 : soclib::caba::BaseModule(name), 358 368 359 m_monitor_ok(false),360 369 p_clk( "p_clk" ), 361 370 p_resetn( "p_resetn" ), … … 437 446 m_write_to_cc_send_inst_fifo("m_write_to_cc_send_inst_fifo",8), 438 447 m_write_to_cc_send_srcid_fifo("m_write_to_cc_send_srcid_fifo",8), 439 #if L1_MULTI_CACHE440 m_write_to_cc_send_cache_id_fifo("m_write_to_cc_send_cache_id_fifo",8),441 #endif442 448 443 449 r_multi_ack_fsm("r_multi_ack_fsm"), … … 449 455 m_cas_to_cc_send_inst_fifo("m_cas_to_cc_send_inst_fifo",8), 450 456 m_cas_to_cc_send_srcid_fifo("m_cas_to_cc_send_srcid_fifo",8), 451 #if L1_MULTI_CACHE452 m_cas_to_cc_send_cache_id_fifo("m_cas_to_cc_send_cache_id_fifo",8),453 #endif454 457 455 458 r_ixr_rsp_fsm("r_ixr_rsp_fsm"), … … 458 461 m_xram_rsp_to_cc_send_inst_fifo("m_xram_rsp_to_cc_send_inst_fifo",8), 459 462 m_xram_rsp_to_cc_send_srcid_fifo("m_xram_rsp_to_cc_send_srcid_fifo",8), 460 #if L1_MULTI_CACHE461 m_xram_rsp_to_cc_send_cache_id_fifo("m_xram_rsp_to_cc_send_cache_id_fifo",8),462 #endif463 463 464 464 r_ixr_cmd_fsm("r_ixr_cmd_fsm"), … … 528 528 r_xram_rsp_victim_data = new sc_signal<data_t>[nwords]; 529 529 r_xram_rsp_to_tgt_rsp_data = new sc_signal<data_t>[nwords]; 530 r_xram_rsp_to_ixr_cmd_data = new sc_signal<data_t>[nwords];530 //r_xram_rsp_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 531 531 532 532 // Allocation for READ FSM … … 539 539 r_write_to_cc_send_data = new sc_signal<data_t>[nwords]; 540 540 r_write_to_cc_send_be = new sc_signal<be_t>[nwords]; 541 r_write_to_ixr_cmd_data = new sc_signal<data_t>[nwords];541 //r_write_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 542 542 543 543 // Allocation for CAS FSM 544 r_cas_to_ixr_cmd_data = new sc_signal<data_t>[nwords];544 //r_cas_to_ixr_cmd_data = new sc_signal<data_t>[nwords]; 545 545 r_cas_data = new sc_signal<data_t>[nwords]; 546 546 r_cas_rdata = new sc_signal<data_t>[2]; 547 548 // Allocation for IXR_CMD FSM 549 r_ixr_cmd_wdata = new sc_signal<data_t>[nwords]; 547 550 548 551 // Allocation for ODCCP … … 553 556 554 557 // Allocation for debug 555 m_debug_previous_data = new sc_signal<data_t>[nwords];556 m_debug_data = new sc_signal<data_t>[nwords];558 m_debug_previous_data = new data_t[nwords]; 559 m_debug_data = new data_t[nwords]; 557 560 558 561 SC_METHOD(transition); … … 564 567 sensitive << p_clk.neg(); 565 568 } // end constructor 566 567 ///////////////////////////////////////////////////////////////////////568 tmpl(void) ::start_monitor(addr_t addr, addr_t length)569 ///////////////////////////////////////////////////////////////////////570 {571 m_monitor_ok = true;572 m_monitor_base = addr;573 m_monitor_length = length;574 }575 576 ///////////////////////////////////////////////////////////////////////577 tmpl(void) ::stop_monitor()578 ///////////////////////////////////////////////////////////////////////579 {580 m_monitor_ok = false;581 }582 583 ////////////////////////////////////////////////584 tmpl(void) ::check_monitor( addr_t addr,585 data_t data,586 bool read )587 ////////////////////////////////////////////////588 {589 if((addr >= m_monitor_base) and590 (addr < m_monitor_base + m_monitor_length))591 {592 if ( read ) std::cout << " Monitor MEMC Read ";593 else std::cout << " Monitor MEMC Write";594 std::cout << " / Address = " << std::hex << addr595 << " / Data = " << data596 << " at cycle " << std::dec << m_cpt_cycles << std::endl;597 }598 }599 569 600 570 ///////////////////////////////////////////////////// … … 609 579 610 580 if ( entry.valid ) 611 { 612 m_cache_data.read_line( way, set, m_debug_data ); 613 614 for ( size_t i = 0 ; i<m_words ; i++ ) 615 { 616 if ( m_debug_previous_valid and 617 (m_debug_data[i].read() != m_debug_previous_data[i].read()) ) 618 data_change = true; 619 m_debug_previous_data[i] = m_debug_data[i].read(); 620 } 621 } 622 581 { 582 for ( size_t word = 0 ; word<m_words ; word++ ) 583 { 584 m_debug_data[word] = m_cache_data.read(way, set, word); 585 if ( m_debug_previous_valid and 586 (m_debug_data[word] != m_debug_previous_data[word]) ) 587 { 588 data_change = true; 589 } 590 } 591 } 592 593 // print values if any change 623 594 if ( (entry.valid != m_debug_previous_valid) or 624 595 (entry.valid and (entry.count != m_debug_previous_count)) or 625 596 (entry.valid and (entry.dirty != m_debug_previous_dirty)) or data_change ) 626 597 { 627 std::cout << "Monitor MEMC " << name() 628 << " at cycle " << std::dec << m_cpt_cycles 629 << " for address " << std::hex << addr 630 << " / HIT = " << std::dec << entry.valid 631 << " / WAY = " << way 632 << " / COUNT = " << entry.count 633 << " / DIRTY = " << entry.dirty 634 << " / DATA_CHANGE = " << entry.count 635 << std::endl; 598 std::cout << "Monitor MEMC " << name() 599 << " at cycle " << std::dec << m_cpt_cycles 600 << " for address " << std::hex << addr 601 << " / VAL = " << std::dec << entry.valid 602 << " / WAY = " << way 603 << " / COUNT = " << entry.count 604 << " / DIRTY = " << entry.dirty 605 << " / DATA_CHANGE = " << data_change 606 << std::endl; 607 std::cout << std::hex << " /0:" << m_debug_data[0] 608 << "/1:" << m_debug_data[1] 609 << "/2:" << m_debug_data[2] 610 << "/3:" << m_debug_data[3] 611 << "/4:" << m_debug_data[4] 612 << "/5:" << m_debug_data[5] 613 << "/6:" << m_debug_data[6] 614 << "/7:" << m_debug_data[7] 615 << "/8:" << m_debug_data[8] 616 << "/9:" << m_debug_data[9] 617 << "/A:" << m_debug_data[10] 618 << "/B:" << m_debug_data[11] 619 << "/C:" << m_debug_data[12] 620 << "/D:" << m_debug_data[13] 621 << "/E:" << m_debug_data[14] 622 << "/F:" << m_debug_data[15] 623 << std::endl; 636 624 } 637 625 m_debug_previous_count = entry.count; 638 626 m_debug_previous_valid = entry.valid; 639 627 m_debug_previous_dirty = entry.dirty; 628 for( size_t word=0 ; word<m_words ; word++ ) 629 m_debug_previous_data[word] = m_debug_data[word]; 640 630 } 641 631 … … 836 826 delete [] r_xram_rsp_victim_data; 837 827 delete [] r_xram_rsp_to_tgt_rsp_data; 838 delete [] r_xram_rsp_to_ixr_cmd_data;839 828 840 829 delete [] r_read_data; … … 919 908 m_config_to_cc_send_inst_fifo.init(); 920 909 m_config_to_cc_send_srcid_fifo.init(); 921 #if L1_MULTI_CACHE922 m_config_to_cc_send_cache_id_fifo.init();923 #endif924 910 925 911 r_tgt_cmd_to_tgt_rsp_req = false; … … 938 924 m_write_to_cc_send_inst_fifo.init(); 939 925 m_write_to_cc_send_srcid_fifo.init(); 940 #if L1_MULTI_CACHE941 m_write_to_cc_send_cache_id_fifo.init();942 #endif943 926 944 927 r_cleanup_to_tgt_rsp_req = false; … … 954 937 r_cas_lfsr = -1 ; 955 938 r_cas_to_ixr_cmd_req = false; 956 r_cas_to_cc_send_multi_req = false;957 r_cas_to_cc_send_brdcast_req = false;939 r_cas_to_cc_send_multi_req = false; 940 r_cas_to_cc_send_brdcast_req = false; 958 941 959 942 m_cas_to_cc_send_inst_fifo.init(); … … 969 952 970 953 r_xram_rsp_to_tgt_rsp_req = false; 971 r_xram_rsp_to_cc_send_multi_req = false;972 r_xram_rsp_to_cc_send_brdcast_req = false;954 r_xram_rsp_to_cc_send_multi_req = false; 955 r_xram_rsp_to_cc_send_brdcast_req = false; 973 956 r_xram_rsp_to_ixr_cmd_req = false; 974 957 r_xram_rsp_trt_index = 0; … … 976 959 m_xram_rsp_to_cc_send_inst_fifo.init(); 977 960 m_xram_rsp_to_cc_send_srcid_fifo.init(); 978 #if L1_MULTI_CACHE 979 m_xram_rsp_to_cc_send_cache_id_fifo.init(); 980 #endif 981 982 r_ixr_cmd_cpt = 0; 961 983 962 r_alloc_dir_reset_cpt = 0; 984 963 r_alloc_heap_reset_cpt = 0; … … 996 975 r_cleanup_to_ixr_cmd_req = false; 997 976 r_cleanup_to_ixr_cmd_srcid = 0; 998 r_cleanup_to_ixr_cmd_trdid = 0;999 977 r_cleanup_to_ixr_cmd_pktid = 0; 1000 978 r_cleanup_to_ixr_cmd_nline = 0; … … 1095 1073 size_t write_to_cc_send_fifo_srcid = 0; 1096 1074 1097 #if L1_MULTI_CACHE1098 size_t write_to_cc_send_fifo_cache_id = 0;1099 #endif1100 1101 1075 bool xram_rsp_to_cc_send_fifo_put = false; 1102 1076 bool xram_rsp_to_cc_send_fifo_get = false; … … 1104 1078 size_t xram_rsp_to_cc_send_fifo_srcid = 0; 1105 1079 1106 #if L1_MULTI_CACHE1107 size_t xram_rsp_to_cc_send_fifo_cache_id = 0;1108 #endif1109 1110 1080 bool config_to_cc_send_fifo_put = false; 1111 1081 bool config_to_cc_send_fifo_get = false; … … 1117 1087 bool cas_to_cc_send_fifo_inst = false; 1118 1088 size_t cas_to_cc_send_fifo_srcid = 0; 1119 1120 #if L1_MULTI_CACHE1121 size_t cas_to_cc_send_fifo_cache_id = 0;1122 #endif1123 1089 1124 1090 m_debug = (m_cpt_cycles > m_debug_start_cycle) and m_debug_ok; … … 1275 1241 case TGT_CMD_ERROR: // response error must be sent 1276 1242 1277 // wait if pending TGT_CMD request to TGT_RSP FSM1243 // wait if pending request 1278 1244 if(r_tgt_cmd_to_tgt_rsp_req.read()) break; 1279 1245 … … 1309 1275 size_t error; 1310 1276 uint32_t rdata = 0; // default value 1277 uint32_t wdata = p_vci_tgt.wdata.read(); 1311 1278 1312 1279 if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) // get lock … … 1317 1284 error = 0; 1318 1285 r_config_lock = true; 1286 if ( rdata == 0 ) 1287 { 1288 r_tgt_cmd_srcid = p_vci_tgt.srcid.read(); 1289 r_tgt_cmd_trdid = p_vci_tgt.trdid.read(); 1290 r_tgt_cmd_pktid = p_vci_tgt.pktid.read(); 1291 } 1292 1319 1293 } 1320 1294 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // release lock 1321 and (cell == MEMC_LOCK) ) 1295 and (cell == MEMC_LOCK) 1296 and (p_vci_tgt.srcid.read() == r_tgt_cmd_srcid.read()) ) 1322 1297 { 1323 1298 need_rsp = true; … … 1326 1301 } 1327 1302 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set addr_lo 1328 and (cell == MEMC_ADDR_LO) ) 1329 { 1303 and (cell == MEMC_ADDR_LO) 1304 and (p_vci_tgt.srcid.read() == r_tgt_cmd_srcid.read()) ) 1305 { 1306 assert( ((wdata % (m_words*vci_param_int::B)) == 0) and 1307 "VCI_MEM_CACHE CONFIG ERROR: The buffer must be aligned on a cache line"); 1308 1330 1309 need_rsp = true; 1331 1310 error = 0; … … 1334 1313 } 1335 1314 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set addr_hi 1336 and (cell == MEMC_ADDR_HI) ) 1315 and (cell == MEMC_ADDR_HI) 1316 and (p_vci_tgt.srcid.read() == r_tgt_cmd_srcid.read()) ) 1337 1317 { 1338 1318 need_rsp = true; … … 1342 1322 } 1343 1323 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set buf_lines 1344 and (cell == MEMC_BUF_LENGTH) ) 1324 and (cell == MEMC_BUF_LENGTH) 1325 and (p_vci_tgt.srcid.read() == r_tgt_cmd_srcid.read()) ) 1345 1326 { 1346 1327 need_rsp = true; 1347 1328 error = 0; 1348 1329 size_t lines = (size_t)(p_vci_tgt.wdata.read()/(m_words<<2)); 1349 if ( r_config_address.read()/(m_words*vci_param_int::B) ) lines++; 1350 r_config_nlines = lines; 1330 if ( r_config_address.read()%(m_words*4) ) lines++; 1331 r_config_cmd_lines = lines; 1332 r_config_rsp_lines = lines; 1351 1333 } 1352 1334 else if ( (p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set cmd type 1353 and (cell == MEMC_CMD_TYPE) ) 1335 and (cell == MEMC_CMD_TYPE) 1336 and (p_vci_tgt.srcid.read() == r_tgt_cmd_srcid.read()) ) 1354 1337 { 1355 1338 need_rsp = false; … … 1386 1369 << " address = " << std::hex << p_vci_tgt.address.read() 1387 1370 << " / wdata = " << p_vci_tgt.wdata.read() 1371 << " / need_rsp = " << need_rsp 1388 1372 << " / error = " << error << std::endl; 1389 1373 #endif … … 1489 1473 // MULTI_ACK FSM 1490 1474 ///////////////////////////////////////////////////////////////////////// 1491 // This FSM controls the response to the multicast update or multicast 1492 // inval coherence requests sent by the memory cache to the L1 caches and 1493 // update the UPT. 1475 // This FSM controls the response to the multicast update requests sent 1476 // by the memory cache to the L1 caches and update the UPT. 1494 1477 // 1495 1478 // - The FSM decrements the proper entry in UPT, … … 1497 1480 // - If required, it sends a request to the TGT_RSP FSM to complete 1498 1481 // a pending write transaction. 1499 // - If required, it sends an acknowledge to the CONFIG FSM to signal1500 // completion of a line inval.1501 1482 // 1502 1483 // All those multi-ack packets are one flit packet. 1503 // The index in the UPT is defined in the UPDTID field.1484 // The index in the UPT is defined in the TRDID field. 1504 1485 //////////////////////////////////////////////////////////////////////// 1505 1486 … … 1618 1599 r_multi_ack_nline = m_upt.nline(r_multi_ack_upt_index.read()); 1619 1600 bool need_rsp = m_upt.need_rsp(r_multi_ack_upt_index.read()); 1620 bool need_ack = m_upt.need_ack(r_multi_ack_upt_index.read());1621 1601 1622 1602 // clear the UPT entry … … 1624 1604 1625 1605 if ( need_rsp ) r_multi_ack_fsm = MULTI_ACK_WRITE_RSP; 1626 else if ( need_ack ) r_multi_ack_fsm = MULTI_ACK_CONFIG_ACK;1627 1606 else r_multi_ack_fsm = MULTI_ACK_IDLE; 1628 1607 … … 1655 1634 break; 1656 1635 } 1657 //////////////////////////1658 case MULTI_ACK_CONFIG_ACK: // Signals multi-inval completion to CONFIG FSM1659 // Wait if pending request1660 {1661 if ( r_multi_ack_to_config_ack.read() ) break;1662 1663 r_multi_ack_to_config_ack = true;1664 r_multi_ack_fsm = MULTI_ACK_IDLE;1665 1666 #if DEBUG_MEMC_MULTI_ACK1667 if(m_debug)1668 std::cout << " <MEMC " << name() << " MULTI_ACK_CONFIG_ACK>"1669 << " Signals inval completion to CONFIG FSM" << std::endl;1670 #endif1671 break;1672 }1673 1636 } // end switch r_multi_ack_fsm 1674 1637 … … 1678 1641 // The CONFIG FSM handles the VCI configuration requests (INVAL & SYNC). 1679 1642 // The target buffer can have any size, and there is one single command for 1680 // all cache lines covered by the target buffer. 1681 // An INVAL or SYNC configuration request is defined by the followinf registers: 1682 // - bool r_config_cmd : INVAL / SYNC / NOP) 1643 // all cache lines covered by the target buffer. 1644 // 1645 // An INVAL or SYNC configuration operation is defined by the following registers: 1646 // - bool r_config_cmd : INVAL / SYNC / NOP 1647 1683 1648 // - uint64_t r_config_address : buffer base address 1684 // - uint32_t r_config_nlines : number of lines covering buffer 1649 // - uint32_t r_config_cmd_lines : number of lines to be handled 1650 // - uint32_t r_config_rsp_lines : number of lines not completed 1651 1685 1652 // 1686 1653 // For both INVAL and SYNC commands, the CONFIG FSM contains the loop handling 1687 // all cache lines covered by the target buffer.1688 1654 // 1655 // all cache lines covered by the buffer. The various lines of a given buffer 1656 // can be pipelined: the CONFIG FSM does not wait the response for line (n) to send 1657 // the command for line (n+1). It decrements the r_config_cmd_lines counter until 1658 // the last request has been registered in TRT (for a SYNC), or in IVT (for an INVAL). 1659 // 1689 1660 // - INVAL request: 1690 // For each line, it access to the DIR array.1661 // For each line, it access to the DIR. 1691 1662 // In case of miss, it does nothing, and a response is requested to TGT_RSP FSM. 1692 1663 // In case of hit, with no copies in L1 caches, the line is invalidated and 1693 1664 // a response is requested to TGT_RSP FSM. 1694 1665 // If there is copies, a multi-inval, or a broadcast-inval coherence transaction 1695 // is launched and registered in UPT. The multi-inval transaction is signaled1696 // by the r_multi_ack_to config_ack or r_cleanup_to_config_ack flip-flops.1697 // The config inval response is sent only when the last line has been invalidated.1698 1666 // 1667 // is launched and registered in UPT. The multi-inval transaction completion 1668 // is signaled by the CLEANUP FSM by decrementing the r_config_rsp_lines counter. 1669 // The CONFIG INVAL response is sent only when the last line has been invalidated. 1670 // TODO : The target buffer address must be aligned on a cache line boundary. 1671 // This constraint can be released, but it requires to make 2 PUT transactions 1672 // for the first and the last line... 1673 // 1699 1674 // - SYNC request: 1700 // 1701 // ... Not implemented yet ... 1675 // For each line, it access to the DIR. 1676 // In case of miss, it does nothing, and a response is requested to TGT_RSP FSM. 1677 // In case of hit, a PUT transaction is registered in TRT and a request is sent 1678 // to IXR_CMD FSM. The IXR_RSP FSM decrements the r_config_rsp_lines counter 1679 // when a PUT response is received. 1680 // The CONFIG SYNC response is sent only when the last PUT response is received. 1702 1681 // 1703 1682 // From the software point of view, a configuration request is a sequence 1704 // of 6 atomic accesses in an uncached segment: 1683 // of 6 atomic accesses in an uncached segment. A dedicated lock is used 1684 // to handle only one configuration command at a given time: 1705 1685 // - Read MEMC_LOCK : Get the lock 1706 1686 // - Write MEMC_ADDR_LO : Set the buffer address LSB … … 1724 1704 std::cout << " <MEMC " << name() << " CONFIG_IDLE> Config Request received" 1725 1705 << " address = " << std::hex << r_config_address.read() 1726 << " / nlines = " << std::dec << r_config_ nlines.read()1706 << " / nlines = " << std::dec << r_config_cmd_lines.read() 1727 1707 << " / type = " << r_config_cmd.read() << std::endl; 1728 1708 #endif … … 1731 1711 } 1732 1712 ///////////////// 1733 case CONFIG_LOOP: // test last line 1734 { 1735 if ( r_config_ nlines.read() == 0 )1713 case CONFIG_LOOP: // test last line to be handled 1714 { 1715 if ( r_config_cmd_lines.read() == 0 ) 1736 1716 { 1737 1717 r_config_cmd = MEMC_CMD_NOP; 1738 r_config_fsm = CONFIG_ RSP;1718 r_config_fsm = CONFIG_WAIT; 1739 1719 } 1740 1720 else … … 1747 1727 std::cout << " <MEMC " << name() << " CONFIG_LOOP>" 1748 1728 << " address = " << std::hex << r_config_address.read() 1749 << " / nlines = " << std::dec << r_config_ nlines.read()1729 << " / nlines = " << std::dec << r_config_cmd_lines.read() 1750 1730 << " / command = " << r_config_cmd.read() << std::endl; 1751 1731 #endif 1752 1732 break; 1753 1733 } 1734 ///////////////// 1735 case CONFIG_WAIT: // wait completion (last response) 1736 { 1737 if ( r_config_rsp_lines.read() == 0 ) // last response received 1738 { 1739 r_config_fsm = CONFIG_RSP; 1740 } 1741 1742 #if DEBUG_MEMC_CONFIG 1743 if(m_debug) 1744 std::cout << " <MEMC " << name() << " CONFIG_WAIT>" 1745 << " / lines to do = " << std::dec << r_config_rsp_lines.read() << std::endl; 1746 #endif 1747 break; 1748 } 1749 //////////////// 1750 case CONFIG_RSP: // request TGT_RSP FSM to return response 1751 { 1752 if ( not r_config_to_tgt_rsp_req.read() ) 1753 { 1754 r_config_to_tgt_rsp_srcid = r_config_srcid.read(); 1755 r_config_to_tgt_rsp_trdid = r_config_trdid.read(); 1756 r_config_to_tgt_rsp_pktid = r_config_pktid.read(); 1757 r_config_to_tgt_rsp_error = false; 1758 r_config_to_tgt_rsp_req = true; 1759 r_config_fsm = CONFIG_IDLE; 1760 1761 #if DEBUG_MEMC_CONFIG 1762 if(m_debug) 1763 std::cout << " <MEMC " << name() << " CONFIG_RSP> Request TGT_RSP FSM to return response:" 1764 << " error = " << r_config_to_tgt_rsp_error.read() 1765 << " / rsrcid = " << std::hex << r_config_srcid.read() 1766 << " / rtrdid = " << std::hex << r_config_trdid.read() 1767 << " / rpktid = " << std::hex << r_config_pktid.read() << std::endl; 1768 #endif 1769 } 1770 break; 1771 1772 } 1773 1754 1774 //////////////////// 1755 1775 case CONFIG_DIR_REQ: // Request directory lock … … 1770 1790 case CONFIG_DIR_ACCESS: // Access directory and decode config command 1771 1791 { 1792 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG) and 1793 "MEMC ERROR in CONFIG_DIR_ACCESS state: bad DIR allocation"); 1794 1772 1795 size_t way = 0; 1773 1796 DirectoryEntry entry = m_cache_directory.read(r_config_address.read(), way); … … 1781 1804 r_config_dir_is_cnt = entry.is_cnt; 1782 1805 r_config_dir_count = entry.count; 1783 r_config_dir_next_ptr = entry.ptr; 1784 1785 r_config_fsm = CONFIG_DIR_IVT_LOCK; 1806 r_config_dir_lock = entry.lock; 1807 r_config_dir_ptr = entry.ptr; 1808 1809 r_config_fsm = CONFIG_IVT_LOCK; 1786 1810 } 1787 1811 else if ( entry.valid and // hit & sync command … … 1789 1813 (r_config_cmd.read() == MEMC_CMD_SYNC) ) 1790 1814 { 1791 std::cout << "VCI_MEM_CACHE ERROR: " 1792 << "SYNC config request not implemented yet" << std::endl; 1793 exit(0); 1815 r_config_fsm = CONFIG_TRT_LOCK; 1794 1816 } 1795 1817 else // return to LOOP 1796 1818 { 1797 r_config_nlines = r_config_nlines.read() - 1; 1798 r_config_address = r_config_address.read() + (m_words<<2); 1799 r_config_fsm = CONFIG_LOOP; 1819 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 1820 r_config_rsp_lines = r_config_rsp_lines.read() - 1; 1821 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 1822 r_config_address = r_config_address.read() + (m_words<<2); 1823 r_config_fsm = CONFIG_LOOP; 1800 1824 } 1801 1825 … … 1811 1835 break; 1812 1836 } 1813 ///////////////////////// 1814 case CONFIG_DIR_IVT_LOCK: // enter this state in case of INVAL command 1815 // Try to get both DIR & IVT locks, and return 1816 // to LOOP state if IVT full. 1817 // Register inval in IVT, and invalidate the 1818 // directory if IVT not full. 1819 { 1837 ///////////////////// 1838 case CONFIG_TRT_LOCK: // enter this state in case of SYNC command 1839 // to a dirty cache line 1840 // keep DIR lock, and try to get TRT lock 1841 // return to LOOP state if TRT full 1842 // reset dirty bit in DIR and register a PUT 1843 // trabsaction in TRT if not full. 1844 { 1845 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG) and 1846 "MEMC ERROR in CONFIG_TRT_LOCK state: bad DIR allocation"); 1847 1848 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_CONFIG ) 1849 { 1850 size_t index = 0; 1851 bool wok = not m_trt.full(index); 1852 1853 if ( not wok ) 1854 { 1855 r_config_fsm = CONFIG_LOOP; 1856 } 1857 else 1858 { 1859 size_t way = r_config_dir_way.read(); 1860 size_t set = m_y[r_config_address.read()]; 1861 1862 // reset dirty bit in DIR 1863 DirectoryEntry entry; 1864 entry.valid = true; 1865 entry.dirty = false; 1866 entry.tag = m_z[r_config_address.read()]; 1867 entry.is_cnt = r_config_dir_is_cnt.read(); 1868 entry.lock = r_config_dir_lock.read(); 1869 entry.ptr = r_config_dir_ptr.read(); 1870 entry.count = r_config_dir_count.read(); 1871 entry.owner.inst = r_config_dir_copy_inst.read(); 1872 entry.owner.srcid = r_config_dir_copy_srcid.read(); 1873 m_cache_directory.write( set, 1874 way, 1875 entry ); 1876 1877 r_config_trt_index = index; 1878 r_config_fsm = CONFIG_TRT_SET; 1879 } 1880 1881 #if DEBUG_MEMC_CONFIG 1882 if(m_debug) 1883 std::cout << " <MEMC " << name() << " CONFIG_TRT_LOCK> Access TRT: " 1884 << " wok = " << std::dec << wok 1885 << " index = " << index << std::endl; 1886 #endif 1887 } 1888 break; 1889 } 1890 //////////////////// 1891 case CONFIG_TRT_SET: // read data in cache 1892 // and post a PUT request in TRT 1893 { 1894 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG) and 1895 "MEMC ERROR in CONFIG_TRT_SET state: bad DIR allocation"); 1896 1897 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_CONFIG) and 1898 "MEMC ERROR in CONFIG_TRT_SET state: bad TRT allocation"); 1899 1900 // read data into cache 1901 size_t way = r_config_dir_way.read(); 1902 size_t set = m_y[r_config_address.read()]; 1903 1904 sc_signal<data_t> config_data[16]; 1905 m_cache_data.read_line( way, 1906 set, 1907 config_data ); 1908 1909 // post a PUT request in TRT 1910 std::vector<data_t> data_vector; 1911 data_vector.clear(); 1912 for(size_t i=0; i<m_words; i++) data_vector.push_back(config_data[i].read()); 1913 m_trt.set( r_config_trt_index.read(), 1914 false, // PUT 1915 m_nline[r_config_address.read()], // nline 1916 0, // srcid: unused 1917 0, // trdid: unused 1918 0, // pktid: unused 1919 false, // not proc_read 1920 0, // read_length: unused 1921 0, // word_index: unused 1922 std::vector<be_t>(m_words,0xF), 1923 data_vector); 1924 1925 #if DEBUG_MEMC_CONFIG 1926 if(m_debug) 1927 m_trt.print(0); 1928 std::cout << " <MEMC " << name() << " CONFIG_TRT_SET> PUT request in TRT:" 1929 << " address = " << std::hex << r_config_address.read() 1930 << " index = " << std::dec << r_config_trt_index.read() << std::endl; 1931 #endif 1932 break; 1933 } 1934 //////////////////// 1935 case CONFIG_PUT_REQ: // PUT request to IXR_CMD_FSM 1936 { 1937 if ( not r_config_to_ixr_cmd_req.read() ) 1938 { 1939 r_config_to_ixr_cmd_req = true; 1940 r_config_to_ixr_cmd_index = r_config_trt_index.read(); 1941 1942 // prepare next iteration 1943 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 1944 r_config_address = r_config_address.read() + (m_words<<2); 1945 r_config_fsm = CONFIG_LOOP; 1946 1947 #if DEBUG_MEMC_CONFIG 1948 if(m_debug) 1949 std::cout << " <MEMC " << name() << " CONFIG_PUT_REQ> PUT request to IXR_CMD_FSM" 1950 << " / address = " << std::hex << r_config_address.read() << std::endl; 1951 #endif 1952 } 1953 break; 1954 } 1955 ///////////////////// 1956 case CONFIG_IVT_LOCK: // enter this state in case of INVAL command 1957 // Keep DIR lock and Try to get IVT lock. 1958 // Return to LOOP state if IVT full. 1959 // Register inval in IVT, and invalidate the 1960 // directory if IVT not full. 1961 { 1962 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CONFIG) and 1963 "MEMC ERROR in CONFIG_IVT_LOCK state: bad DIR allocation"); 1964 1820 1965 if ( r_alloc_ivt_fsm.read() == ALLOC_IVT_CONFIG ) 1821 1966 { … … 1826 1971 { 1827 1972 m_cache_directory.inval( way, set ); 1828 r_config_nlines = r_config_nlines.read() - 1; 1829 r_config_address = r_config_address.read() + (m_words<<2); 1830 r_config_fsm = CONFIG_LOOP; 1831 1832 #if DEBUG_MEMC_CONFIG 1833 if(m_debug) 1834 std::cout << " <MEMC " << name() << " CONFIG_DIR_IVT_LOCK>" 1973 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 1974 r_config_rsp_lines = r_config_rsp_lines.read() - 1; 1975 r_config_address = r_config_address.read() + (m_words<<2); 1976 r_config_fsm = CONFIG_LOOP; 1977 1978 #if DEBUG_MEMC_CONFIG 1979 if(m_debug) 1980 std::cout << " <MEMC " << name() << " CONFIG_IVT_LOCK>" 1835 1981 << " No copies in L1 : inval DIR entry" << std::endl; 1836 1982 #endif … … 1863 2009 r_config_ivt_index = index; 1864 2010 if ( broadcast ) r_config_fsm = CONFIG_BC_SEND; 1865 else r_config_fsm = CONFIG_INV _SEND;2011 else r_config_fsm = CONFIG_INVAL_SEND; 1866 2012 1867 2013 #if DEBUG_MEMC_CONFIG 1868 2014 if(m_debug) 1869 std::cout << " <MEMC " << name() << " CONFIG_ DIR_IVT_LOCK>"2015 std::cout << " <MEMC " << name() << " CONFIG_IVT_LOCK>" 1870 2016 << " Inval DIR entry and register inval in IVT" 1871 2017 << " : index = " << std::dec << index … … 1879 2025 #if DEBUG_MEMC_CONFIG 1880 2026 if(m_debug) 1881 std::cout << " <MEMC " << name() << " CONFIG_ DIR_IVT_LOCK>"2027 std::cout << " <MEMC " << name() << " CONFIG_IVT_LOCK>" 1882 2028 << " IVT full : release DIR & IVT locks and retry" << std::endl; 1883 2029 #endif … … 1893 2039 not r_config_to_cc_send_brdcast_req.read() ) 1894 2040 { 2041 // post bc inval request 1895 2042 r_config_to_cc_send_multi_req = false; 1896 2043 r_config_to_cc_send_brdcast_req = true; 1897 2044 r_config_to_cc_send_trdid = r_config_ivt_index.read(); 1898 2045 r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())]; 1899 r_cleanup_to_config_ack = false; 1900 r_config_fsm = CONFIG_BC_WAIT; 2046 2047 // prepare next iteration 2048 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 2049 r_config_address = r_config_address.read() + (m_words<<2); 2050 r_config_fsm = CONFIG_LOOP; 1901 2051 1902 2052 #if DEBUG_MEMC_CONFIG … … 1909 2059 break; 1910 2060 } 1911 //////////////////// 1912 case CONFIG_BC_WAIT: // wait broadcast completion to return to LOOP 1913 { 1914 if ( r_cleanup_to_config_ack.read() ) 1915 { 1916 r_config_fsm = CONFIG_LOOP; 1917 r_config_nlines = r_config_nlines.read() - 1; 1918 r_config_address = r_config_address.read() + (m_words<<2); 1919 } 1920 1921 #if DEBUG_MEMC_CONFIG 1922 if(m_debug) 1923 std::cout << " <MEMC " << name() << " CONFIG_BC_WAIT> Waiting BC completion " 1924 << " done = " << r_cleanup_to_config_ack.read() 1925 << std::endl; 1926 #endif 1927 break; 1928 } 1929 ///////////////////// 1930 case CONFIG_INV_SEND: // Post a multi inval request to CC_SEND FSM 2061 /////////////////////// 2062 case CONFIG_INVAL_SEND: // Post a multi inval request to CC_SEND FSM 1931 2063 { 1932 2064 if( not r_config_to_cc_send_multi_req.read() and … … 1937 2069 r_config_to_cc_send_trdid = r_config_ivt_index.read(); 1938 2070 r_config_to_cc_send_nline = m_nline[(addr_t)(r_config_address.read())]; 1939 r_multi_ack_to_config_ack = false; 1940 2071 2072 // post data into FIFO 1941 2073 config_to_cc_send_fifo_srcid = r_config_dir_copy_srcid.read(); 1942 2074 config_to_cc_send_fifo_inst = r_config_dir_copy_inst.read(); 1943 2075 config_to_cc_send_fifo_put = true; 1944 2076 1945 if ( r_config_dir_count.read() == 1 ) r_config_fsm = CONFIG_INV_WAIT; 1946 else r_config_fsm = CONFIG_HEAP_REQ; 1947 2077 if ( r_config_dir_count.read() == 1 ) // one copy 2078 { 2079 // prepare next iteration 2080 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 2081 r_config_address = r_config_address.read() + (m_words<<2); 2082 r_config_fsm = CONFIG_LOOP; 2083 } 2084 else // several copies 2085 { 2086 r_config_fsm = CONFIG_HEAP_REQ; 2087 } 2088 1948 2089 #if DEBUG_MEMC_CONFIG 1949 2090 if(m_debug) 1950 std::cout << " <MEMC " << name() << " CONFIG_INV _SEND>"2091 std::cout << " <MEMC " << name() << " CONFIG_INVAL_SEND>" 1951 2092 << " Post multi inval request to CC_SEND FSM" 1952 2093 << " / address = " << std::hex << r_config_address.read() … … 1963 2104 { 1964 2105 r_config_fsm = CONFIG_HEAP_SCAN; 1965 r_config_heap_next = r_config_dir_ next_ptr.read();2106 r_config_heap_next = r_config_dir_ptr.read(); 1966 2107 } 1967 2108 … … 2010 2151 if ( m_heap.is_full() ) 2011 2152 { 2012 last_entry.next = r_config_dir_ next_ptr.read();2153 last_entry.next = r_config_dir_ptr.read(); 2013 2154 m_heap.unset_full(); 2014 2155 } … … 2018 2159 } 2019 2160 2020 m_heap.write_free_ptr( r_config_dir_ next_ptr.read() );2161 m_heap.write_free_ptr( r_config_dir_ptr.read() ); 2021 2162 m_heap.write( r_config_heap_next.read(), last_entry ); 2022 r_config_fsm = CONFIG_INV_WAIT; 2163 2164 // prepare next iteration 2165 r_config_cmd_lines = r_config_cmd_lines.read() - 1; 2166 r_config_address = r_config_address.read() + (m_words<<2); 2167 r_config_fsm = CONFIG_LOOP; 2023 2168 2024 2169 #if DEBUG_MEMC_CONFIG … … 2028 2173 #endif 2029 2174 break; 2030 }2031 /////////////////////2032 case CONFIG_INV_WAIT: // wait inval completion to return to LOOP2033 {2034 if ( r_multi_ack_to_config_ack.read() )2035 {2036 r_config_fsm = CONFIG_LOOP;2037 r_config_nlines = r_config_nlines.read() - 1;2038 r_config_address = r_config_address.read() + (m_words<<2);2039 }2040 2041 #if DEBUG_MEMC_CONFIG2042 if(m_debug)2043 std::cout << " <MEMC " << name() << " CONFIG_INV_WAIT> Waiting inval completion "2044 << " done = " << r_multi_ack_to_config_ack.read()2045 << std::endl;2046 #endif2047 break;2048 }2049 2050 ////////////////2051 case CONFIG_RSP: // request TGT_RSP FSM to return response2052 {2053 if ( not r_config_to_tgt_rsp_req.read() )2054 {2055 r_config_to_tgt_rsp_srcid = r_config_srcid.read();2056 r_config_to_tgt_rsp_trdid = r_config_trdid.read();2057 r_config_to_tgt_rsp_pktid = r_config_pktid.read();2058 r_config_to_tgt_rsp_error = false;2059 r_config_to_tgt_rsp_req = true;2060 r_config_fsm = CONFIG_IDLE;2061 2062 #if DEBUG_MEMC_CONFIG2063 if(m_debug)2064 std::cout << " <MEMC " << name() << " CONFIG_RSP> Request TGT_RSP FSM to return response:"2065 << " error = " << r_config_to_tgt_rsp_error.read()2066 << " / rsrcid = " << std::hex << r_config_srcid.read() << std::endl;2067 #endif2068 }2069 break;2070 2071 2175 } 2072 2176 } // end switch r_config_fsm … … 2122 2226 case READ_DIR_REQ: // Get the lock to the directory 2123 2227 { 2124 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ)2125 {2126 r_read_fsm = READ_DIR_LOCK;2127 m_cpt_read_fsm_n_dir_lock++;2128 2228 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ) 2229 { 2230 r_read_fsm = READ_DIR_LOCK; 2231 m_cpt_read_fsm_n_dir_lock++; 2232 } 2129 2233 2130 2234 #if DEBUG_MEMC_READ … … 2141 2245 case READ_DIR_LOCK: // check directory for hit / miss 2142 2246 { 2143 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ) 2144 { 2247 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_READ) and 2248 "MEMC ERROR in READ_DIR_LOCK state: Bad DIR allocation"); 2249 2145 2250 size_t way = 0; 2146 2251 DirectoryEntry entry = 2147 2252 m_cache_directory.read(m_cmd_read_addr_fifo.read(), way); 2148 2253 if(((m_cmd_read_pktid_fifo.read() & 0x7) == TYPE_LL) and not r_read_ll_done.read()) // access the global table ONLY when we have an LL cmd 2149 2254 { … … 2164 2269 r_read_copy = entry.owner.srcid; 2165 2270 2166 #if L1_MULTI_CACHE2167 r_read_copy_cache = entry.owner.cache_id;2168 #endif2169 2271 r_read_copy_inst = entry.owner.inst; 2170 2272 r_read_ptr = entry.ptr; // pointer to the heap … … 2216 2318 } 2217 2319 #endif 2218 }2219 else2220 {2221 std::cout << "VCI_MEM_CACHE ERROR " << name() << " READ_DIR_LOCK state"2222 << "Bad DIR allocation" << std::endl;2223 exit(0);2224 }2225 2320 break; 2226 2321 } … … 2318 2413 2319 2414 { 2320 if(r_alloc_dir_fsm.read() == ALLOC_DIR_READ)2321 {2415 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_READ) and 2416 "MEMC ERROR in READ_DIR_HIT state: Bad DIR allocation"); 2322 2417 // check if this is an instruction read, this means pktid is either 2323 2418 // TYPE_READ_INS_UNC 0bX010 with TSAR encoding … … 2335 2430 2336 2431 m_cache_data.read_line(way, set, r_read_data); 2337 2338 if(m_monitor_ok) check_monitor( m_cmd_read_addr_fifo.read(), r_read_data[0], true);2339 2432 2340 2433 // update the cache directory … … 2353 2446 { 2354 2447 entry.owner.srcid = m_cmd_read_srcid_fifo.read(); 2355 #if L1_MULTI_CACHE2356 entry.owner.cache_id = m_cmd_read_pktid_fifo.read();2357 #endif2358 2448 entry.owner.inst = inst_read; 2359 2449 entry.count = r_read_count.read() + 1; … … 2362 2452 { 2363 2453 entry.owner.srcid = 0; 2364 #if L1_MULTI_CACHE2365 entry.owner.cache_id = 0;2366 #endif2367 2454 entry.owner.inst = false; 2368 2455 entry.count = r_read_count.read() + 1; … … 2372 2459 { 2373 2460 entry.owner.srcid = r_read_copy.read(); 2374 #if L1_MULTI_CACHE2375 entry.owner.cache_id = r_read_copy_cache.read();2376 #endif2377 2461 entry.owner.inst = r_read_copy_inst.read(); 2378 2462 entry.count = r_read_count.read(); … … 2394 2478 m_cache_directory.write(set, way, entry); 2395 2479 r_read_fsm = READ_RSP; 2396 } 2397 break; 2480 break; 2398 2481 } 2399 2482 /////////////////// … … 2436 2519 2437 2520 m_cache_data.read_line(way, set, r_read_data); 2438 2439 if(m_monitor_ok) check_monitor( m_cmd_read_addr_fifo.read(), r_read_data[0], true);2440 2521 2441 2522 // update the cache directory … … 2452 2533 { 2453 2534 entry.owner.srcid = r_read_copy.read(); 2454 #if L1_MULTI_CACHE2455 entry.owner.cache_id = r_read_copy_cache.read();2456 #endif2457 2535 entry.owner.inst = r_read_copy_inst.read(); 2458 2536 entry.ptr = m_heap.next_free_ptr(); // set pointer on the heap … … 2461 2539 { 2462 2540 entry.owner.srcid = 0; 2463 #if L1_MULTI_CACHE2464 entry.owner.cache_id = 0;2465 #endif2466 2541 entry.owner.inst = false; 2467 2542 entry.ptr = 0; … … 2529 2604 HeapEntry heap_entry; 2530 2605 heap_entry.owner.srcid = m_cmd_read_srcid_fifo.read(); 2531 #if L1_MULTI_CACHE2532 heap_entry.owner.cache_id = m_cmd_read_pktid_fifo.read();2533 #endif2534 2606 heap_entry.owner.inst = ((m_cmd_read_pktid_fifo.read() & 0x2) != 0); 2535 2607 … … 2595 2667 HeapEntry last_entry; 2596 2668 last_entry.owner.srcid = 0; 2597 #if L1_MULTI_CACHE2598 last_entry.owner.cache_id = 0;2599 #endif2600 2669 last_entry.owner.inst = false; 2601 2670 … … 2718 2787 #if DEBUG_MEMC_READ 2719 2788 if(m_debug) 2720 std::cout << " <MEMC " << name() << " READ_TRT_SET> Write in Transaction Table:" 2789 m_trt.print(0); 2790 std::cout << " <MEMC " << name() << " READ_TRT_SET> Set a GET in TGT:" 2721 2791 << " address = " << std::hex << m_cmd_read_addr_fifo.read() 2722 2792 << " / srcid = " << std::hex << m_cmd_read_srcid_fifo.read() << std::endl; … … 2734 2804 cmd_read_fifo_get = true; 2735 2805 r_read_to_ixr_cmd_req = true; 2736 r_read_to_ixr_cmd_nline = m_nline[(addr_t)(m_cmd_read_addr_fifo.read())];2737 r_read_to_ixr_cmd_ trdid= r_read_trt_index.read();2806 //r_read_to_ixr_cmd_nline = m_nline[(addr_t)(m_cmd_read_addr_fifo.read())]; 2807 r_read_to_ixr_cmd_index = r_read_trt_index.read(); 2738 2808 r_read_fsm = READ_IDLE; 2739 2809 … … 2762 2832 // If the data is cached by other processors, a coherence transaction must 2763 2833 // be launched (sc requests always require a coherence transaction): 2764 // It is a multicast update if the line is not in counter mode , andthe processor2834 // It is a multicast update if the line is not in counter mode: the processor 2765 2835 // takes the lock protecting the Update Table (UPT) to register this transaction. 2766 // It is a broadcast invalidate if the line is in counter mode.2767 2836 // If the UPT is full, it releases the lock(s) and retry. Then, it sends 2768 2837 // a multi-update request to all owners of the line (but the writer), … … 2770 2839 // does not respond to the writing processor, as this response will be sent by 2771 2840 // the MULTI_ACK FSM when all update responses have been received. 2841 // It is a broadcast invalidate if the line is in counter mode: The line 2842 // should be erased in memory cache, and written in XRAM with a PUT transaction, 2843 // after registration in TRT. 2772 2844 // 2773 2845 // - In case of MISS, the WRITE FSM takes the lock protecting the transaction 2774 2846 // table (TRT). If a read transaction to the XRAM for this line already exists, 2775 2847 // it writes in the TRT (write buffer). Otherwise, if a TRT entry is free, 2776 // the WRITE FSM register a new transaction in TRT, and sends a read linerequest2848 // the WRITE FSM register a new transaction in TRT, and sends a GET request 2777 2849 // to the XRAM. If the TRT is full, it releases the lock, and waits. 2778 2850 // Finally, the WRITE FSM returns an aknowledge response to the writing processor. … … 2849 2921 2850 2922 // check that the next word is in the same cache line 2851 if((m_nline[(addr_t)(r_write_address.read())] != 2852 m_nline[(addr_t)(m_cmd_write_addr_fifo.read())])) 2853 { 2854 std::cout << "VCI_MEM_CACHE ERROR " << name() << " WRITE_NEXT state" << std::endl 2855 << "all words in a write burst must be in same cache line" << std::endl; 2856 2857 exit(0); 2858 } 2923 assert( (m_nline[(addr_t)(r_write_address.read())] == 2924 m_nline[(addr_t)(m_cmd_write_addr_fifo.read())]) and 2925 "MEMC ERROR in WRITE_NEXT state: Illegal write burst"); 2859 2926 2860 2927 // consume a word in the FIFO & write it in the local buffer … … 2922 2989 // erase any possible new reservation when we release the lock on the 2923 2990 // directory 2924 m_llsc_table.sw( nline);2991 m_llsc_table.sw(m_nline[(addr_t)r_write_address.read()],r_write_word_index.read(),r_write_word_index.read()+r_write_word_count.read()); 2925 2992 2926 2993 //m_llsc_table.sw(r_write_address.read()); … … 2944 3011 case WRITE_DIR_LOCK: // access directory to check hit/miss 2945 3012 { 2946 if(r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE)2947 {3013 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and 3014 "MEMC ERROR in ALLOC_DIR_LOCK state: Bad DIR allocation"); 2948 3015 size_t way = 0; 2949 3016 DirectoryEntry entry(m_cache_directory.read(r_write_address.read(), way)); … … 2956 3023 r_write_tag = entry.tag; 2957 3024 r_write_copy = entry.owner.srcid; 2958 #if L1_MULTI_CACHE2959 r_write_copy_cache = entry.owner.cache_id;2960 #endif2961 3025 r_write_copy_inst = entry.owner.inst; 2962 3026 r_write_count = entry.count; … … 2970 3034 if(entry.is_cnt && entry.count) 2971 3035 { 2972 r_write_fsm = WRITE_ DIR_READ;3036 r_write_fsm = WRITE_BC_DIR_READ; 2973 3037 } 2974 3038 else … … 3012 3076 } 3013 3077 #endif 3014 }3015 else3016 {3017 std::cout << "VCI_MEM_CACHE ERROR " << name()3018 << " WRITE_DIR_LOCK state" << std::endl3019 << "bad DIR allocation" << std::endl;3020 3021 exit(0);3022 }3023 3078 break; 3024 3079 } … … 3076 3131 } 3077 3132 3078 3079 ////////////////////3080 case WRITE_DIR_READ: // read the cache and complete the buffer when be!=0xF3081 {3082 // update local buffer3083 size_t set = m_y[(addr_t)(r_write_address.read())];3084 size_t way = r_write_way.read();3085 for(size_t word=0 ; word<m_words ; word++)3086 {3087 data_t mask = 0;3088 if(r_write_be[word].read() & 0x1) mask = mask | 0x000000FF;3089 if(r_write_be[word].read() & 0x2) mask = mask | 0x0000FF00;3090 if(r_write_be[word].read() & 0x4) mask = mask | 0x00FF0000;3091 if(r_write_be[word].read() & 0x8) mask = mask | 0xFF000000;3092 3093 // complete only if mask is not null (for energy consumption)3094 r_write_data[word] = (r_write_data[word].read() & mask) |3095 (m_cache_data.read(way, set, word) & ~mask);3096 3097 } // end for3098 3099 // test if a coherence broadcast is required3100 r_write_fsm = WRITE_BC_TRT_LOCK;3101 3102 #if DEBUG_MEMC_WRITE3103 if(m_debug)3104 std::cout << " <MEMC " << name() << " WRITE_DIR_READ>"3105 << " Read the cache to complete local buffer" << std::endl;3106 #endif3107 break;3108 }3109 3110 3133 /////////////////// 3111 3134 case WRITE_DIR_HIT: 3112 3135 { 3136 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and 3137 "MEMC ERROR in ALLOC_DIR_HIT state: Bad DIR allocation"); 3138 3113 3139 // update the cache directory 3114 3140 // update directory with Dirty bit … … 3121 3147 entry.lock = r_write_lock.read(); 3122 3148 entry.owner.srcid = r_write_copy.read(); 3123 #if L1_MULTI_CACHE3124 entry.owner.cache_id = r_write_copy_cache.read();3125 #endif3126 3149 entry.owner.inst = r_write_copy_inst.read(); 3127 3150 entry.count = r_write_count.read(); … … 3154 3177 m_cache_data.write(way, set, word, r_write_data[word].read(), r_write_be[word].read()); 3155 3178 3156 if(m_monitor_ok)3157 {3158 addr_t address = (r_write_address.read() & ~(addr_t) 0x3F) | word<<2;3159 check_monitor( address, r_write_data[word].read(), false);3160 }3161 3179 } 3162 3180 } … … 3242 3260 r_write_be[word].read()); 3243 3261 3244 if(m_monitor_ok)3245 {3246 addr_t address = (r_write_address.read() & ~(addr_t) 0x3F) | word<<2;3247 check_monitor( address, r_write_data[word].read(), false);3248 }3249 3262 } 3250 3263 } 3251 3264 3252 3265 #if DEBUG_MEMC_WRITE 3253 if(m_debug )3266 if(m_debug and wok) 3254 3267 { 3255 3268 if(wok) … … 3317 3330 for(size_t i=min ; i<max ; i++) r_write_to_cc_send_data[i] = r_write_data[i]; 3318 3331 3319 if((r_write_copy.read() != r_write_srcid.read()) or(r_write_pktid.read() == TYPE_SC) or 3320 #if L1_MULTI_CACHE 3321 (r_write_copy_cache.read() != r_write_pktid.read()) or 3322 #endif 3323 r_write_copy_inst.read()) 3332 if((r_write_copy.read() != r_write_srcid.read()) or(r_write_pktid.read() == TYPE_SC) or r_write_copy_inst.read()) 3324 3333 { 3325 3334 // put the first srcid in the fifo … … 3327 3336 write_to_cc_send_fifo_inst = r_write_copy_inst.read(); 3328 3337 write_to_cc_send_fifo_srcid = r_write_copy.read(); 3329 #if L1_MULTI_CACHE3330 write_to_cc_send_fifo_cache_id= r_write_copy_cache.read();3331 #endif3332 3338 if(r_write_count.read() == 1) 3333 3339 { … … 3380 3386 bool dec_upt_counter; 3381 3387 3382 if(((entry.owner.srcid != r_write_srcid.read()) or (r_write_pktid.read() == TYPE_SC)) or 3383 #if L1_MULTI_CACHE 3384 (entry.owner.cache_id != r_write_pktid.read()) or 3385 #endif 3386 entry.owner.inst) // put the next srcid in the fifo 3388 if(((entry.owner.srcid != r_write_srcid.read()) or (r_write_pktid.read() == TYPE_SC)) or entry.owner.inst) // put the next srcid in the fifo 3387 3389 { 3388 3390 dec_upt_counter = false; … … 3390 3392 write_to_cc_send_fifo_inst = entry.owner.inst; 3391 3393 write_to_cc_send_fifo_srcid = entry.owner.srcid; 3392 #if L1_MULTI_CACHE3393 write_to_cc_send_fifo_cache_id = entry.owner.cache_id;3394 #endif3395 3394 3396 3395 #if DEBUG_MEMC_WRITE … … 3573 3572 bool hit_read = m_trt.hit_read(m_nline[addr], hit_index); 3574 3573 bool hit_write = m_trt.hit_write(m_nline[addr]); 3575 bool wok = !m_trt.full(wok_index);3574 bool wok = not m_trt.full(wok_index); 3576 3575 //std::cout << "MEMCACHE : WRITE MISS at " << std::hex << (uint32_t)addr << std::dec << std::endl; 3577 3576 if(hit_read) // register the modified data in TRT … … 3641 3640 #if DEBUG_MEMC_WRITE 3642 3641 if(m_debug) 3642 m_trt.print(0); 3643 3643 std::cout << " <MEMC " << name() << " WRITE_MISS_TRT_SET> Set a new entry in TRT" << std::endl; 3644 3644 #endif … … 3662 3662 } 3663 3663 m_trt.write_data_mask(r_write_trt_index.read(), 3664 3665 3664 be_vector, 3665 data_vector); 3666 3666 r_write_fsm = WRITE_RSP; 3667 3667 … … 3677 3677 case WRITE_MISS_XRAM_REQ: // send a GET request to IXR_CMD FSM 3678 3678 { 3679 if( !r_write_to_ixr_cmd_req)3679 if(not r_write_to_ixr_cmd_req.read()) 3680 3680 { 3681 3681 r_write_to_ixr_cmd_req = true; 3682 r_write_to_ixr_cmd_write = false; 3683 r_write_to_ixr_cmd_nline = m_nline[(addr_t)(r_write_address.read())]; 3684 r_write_to_ixr_cmd_trdid = r_write_trt_index.read(); 3682 r_write_to_ixr_cmd_put = false; 3683 r_write_to_ixr_cmd_index = r_write_trt_index.read(); 3685 3684 r_write_fsm = WRITE_RSP; 3686 3685 … … 3694 3693 3695 3694 /////////////////////// 3696 case WRITE_BC_TRT_LOCK: // Check TRT not full 3697 { 3695 case WRITE_BC_DIR_READ: // enter this state if a broadcast-inval is required 3696 // the cache line must be erased in mem-cache, and written 3697 // into XRAM. we read the cache and complete the buffer 3698 { 3699 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and 3700 "MEMC ERROR in WRITE_BC_DIR_READ state: Bad DIR allocation"); 3701 3702 // update local buffer 3703 size_t set = m_y[(addr_t)(r_write_address.read())]; 3704 size_t way = r_write_way.read(); 3705 for(size_t word=0 ; word<m_words ; word++) 3706 { 3707 data_t mask = 0; 3708 if(r_write_be[word].read() & 0x1) mask = mask | 0x000000FF; 3709 if(r_write_be[word].read() & 0x2) mask = mask | 0x0000FF00; 3710 if(r_write_be[word].read() & 0x4) mask = mask | 0x00FF0000; 3711 if(r_write_be[word].read() & 0x8) mask = mask | 0xFF000000; 3712 3713 // complete only if mask is not null (for energy consumption) 3714 r_write_data[word] = (r_write_data[word].read() & mask) | 3715 (m_cache_data.read(way, set, word) & ~mask); 3716 } // end for 3717 3718 r_write_fsm = WRITE_BC_TRT_LOCK; 3719 3720 #if DEBUG_MEMC_WRITE 3721 if(m_debug) 3722 std::cout << " <MEMC " << name() << " WRITE_BC_DIR_READ>" 3723 << " Read the cache to complete local buffer" << std::endl; 3724 #endif 3725 break; 3726 } 3727 3728 /////////////////////// 3729 case WRITE_BC_TRT_LOCK: // get TRT lock to check TRT not full 3730 { 3731 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and 3732 "MEMC ERROR in WRITE_BC_TRT_LOCK state: Bad DIR allocation"); 3733 3698 3734 if(r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE) 3699 3735 { 3700 3736 size_t wok_index = 0; 3701 bool wok = !m_trt.full(wok_index);3737 bool wok = not m_trt.full(wok_index); 3702 3738 if(wok) // set a new entry in TRT 3703 3739 { … … 3726 3762 case WRITE_BC_IVT_LOCK: // register BC transaction in IVT 3727 3763 { 3764 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and 3765 "MEMC ERROR in WRITE_BC_IVT_LOCK state: Bad DIR allocation"); 3766 3767 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE) and 3768 "MEMC ERROR in WRITE_BC_IVT_LOCK state: Bad TRT allocation"); 3769 3728 3770 if(r_alloc_ivt_fsm.read() == ALLOC_IVT_WRITE) 3729 3771 { … … 3767 3809 case WRITE_BC_DIR_INVAL: 3768 3810 { 3769 // Register a put transaction to XRAM in TRT 3770 // and invalidate the line in directory 3771 if((r_alloc_trt_fsm.read() != ALLOC_TRT_WRITE) or 3772 (r_alloc_ivt_fsm.read() != ALLOC_IVT_WRITE) or 3773 (r_alloc_dir_fsm.read() != ALLOC_DIR_WRITE)) 3774 { 3775 std::cout << "VCI_MEM_CACHE ERROR " << name() << " WRITE_BC_DIR_INVAL state" << std::endl; 3776 std::cout << "bad TRT, DIR, or IVT allocation" << std::endl; 3777 exit(0); 3778 } 3779 3780 // register a write request to XRAM in TRT 3781 m_trt.set(r_write_trt_index.read(), 3782 false, // write request to XRAM 3783 m_nline[(addr_t)(r_write_address.read())], 3784 0, 3785 0, 3786 0, 3787 false, // not a processor read 3788 0, // not a single word 3789 0, // word index 3790 std::vector<be_t> (m_words,0), 3791 std::vector<data_t> (m_words,0)); 3811 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_WRITE) and 3812 "MEMC ERROR in WRITE_BC_DIR_INVAL state: Bad DIR allocation"); 3813 3814 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_WRITE) and 3815 "MEMC ERROR in WRITE_BC_DIR_INVAL state: Bad TRT allocation"); 3816 3817 assert( (r_alloc_ivt_fsm.read() == ALLOC_IVT_WRITE) and 3818 "MEMC ERROR in WRITE_BC_DIR_INVAL state: Bad IVT allocation"); 3819 3820 // register PUT request in TRT 3821 std::vector<data_t> data_vector; 3822 data_vector.clear(); 3823 for(size_t i=0; i<m_words; i++) data_vector.push_back(r_write_data[i].read()); 3824 m_trt.set( r_write_trt_index.read(), 3825 false, // PUT request 3826 m_nline[(addr_t)(r_write_address.read())], 3827 0, // unused 3828 0, // unused 3829 0, // unused 3830 false, // not a processor read 3831 0, // unused 3832 0, // unused 3833 std::vector<be_t> (m_words,0), 3834 data_vector ); 3792 3835 3793 3836 // invalidate directory entry … … 3796 3839 entry.cache_coherent= false; 3797 3840 entry.dirty = false; 3798 entry.tag = 0;3841 entry.tag = 0; 3799 3842 entry.is_cnt = false; 3800 3843 entry.lock = false; 3801 3844 entry.owner.srcid = 0; 3802 #if L1_MULTI_CACHE3803 entry.owner.cache_id= 0;3804 #endif3805 3845 entry.owner.inst = false; 3806 3846 entry.ptr = 0; … … 3813 3853 #if DEBUG_MEMC_WRITE 3814 3854 if(m_debug) 3855 m_trt.print(0); 3815 3856 std::cout << " <MEMC " << name() << " WRITE_BC_DIR_INVAL> Invalidate the directory entry: @ = " 3816 3857 << r_write_address.read() << " / register the put transaction in TRT:" << std::endl; … … 3851 3892 case WRITE_BC_XRAM_REQ: // Post a put request to IXR_CMD FSM 3852 3893 { 3853 if( !r_write_to_ixr_cmd_req)3894 if( not r_write_to_ixr_cmd_req.read() ) 3854 3895 { 3855 3896 r_write_to_ixr_cmd_req = true; 3856 r_write_to_ixr_cmd_write = true; 3857 r_write_to_ixr_cmd_nline = m_nline[(addr_t)(r_write_address.read())]; 3858 r_write_to_ixr_cmd_trdid = r_write_trt_index.read(); 3859 3860 for(size_t i=0; i<m_words; i++) r_write_to_ixr_cmd_data[i] = r_write_data[i]; 3861 3897 r_write_to_ixr_cmd_put = true; 3898 r_write_to_ixr_cmd_index = r_write_trt_index.read(); 3862 3899 r_write_fsm = WRITE_IDLE; 3863 3900 … … 3876 3913 /////////////////////////////////////////////////////////////////////// 3877 3914 // The IXR_CMD fsm controls the command packets to the XRAM : 3878 // It handles requests from the READ, WRITE, CAS, XRAM_RSP FSMs3879 // with a round-robin priority.3915 // It handles requests from 5 FSMs with a round-robin priority: 3916 // READ > WRITE > CAS > XRAM_RSP > CONFIG 3880 3917 // 3881 // - It sends a single flit VCI read request to the XRAM in case of MISS 3882 // posted by the READ, WRITE or CAS FSMs : the TRDID field contains 3883 // the Transaction Tab index. 3884 // The VCI response is a multi-flit packet : the N cells contain 3885 // the N data words. 3918 // - It sends a single flit VCI read to the XRAM in case of 3919 // GET request posted by the READ, WRITE or CAS FSMs. 3920 // - It sends a multi-flit VCI write in case of PUT request posted by 3921 // the XRAM_RSP, WRITE, CAS, or CONFIG FSMs. 3886 3922 // 3887 // - It sends a multi-flit VCI write when the XRAM_RSP FSM, WRITE FSM 3888 // or CAS FSM request to save a dirty line to the XRAM. 3889 // The VCI response is a single flit packet. 3923 // For each client, there is three steps: 3924 // - IXR_CMD_*_IDLE : round-robin allocation to a client 3925 // - IXR_CMD_*_TRT : access to TRT for address and data 3926 // - IXR_CMD_*_SEND : send the PUT or GET VCI command 3927 // 3928 // The address and data to be written (for a PUT) are stored in TRT. 3929 // The trdid field contains always the TRT entry index. 3890 3930 //////////////////////////////////////////////////////////////////////// 3891 3931 … … 3894 3934 //////////////////////// 3895 3935 case IXR_CMD_READ_IDLE: 3896 if (r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3897 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3898 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3899 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3900 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3936 if (r_write_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_WRITE_TRT; 3937 else if(r_cas_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CAS_TRT; 3938 else if(r_cleanup_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_TRT; 3939 else if(r_xram_rsp_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_XRAM_TRT; 3940 else if(r_config_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CONFIG_TRT; 3941 else if(r_read_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_READ_TRT; 3901 3942 break; 3902 3943 //////////////////////// 3903 3944 case IXR_CMD_WRITE_IDLE: 3904 if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3905 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3906 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3907 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3908 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3945 if (r_cas_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CAS_TRT; 3946 else if(r_cleanup_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_TRT; 3947 else if(r_xram_rsp_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_XRAM_TRT; 3948 else if(r_config_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CONFIG_TRT; 3949 else if(r_read_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_READ_TRT; 3950 else if(r_write_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_WRITE_TRT; 3909 3951 break; 3910 3952 //////////////////////// 3911 3953 case IXR_CMD_CAS_IDLE: 3912 if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3913 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3914 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3915 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3916 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3954 if (r_cleanup_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_TRT; 3955 else if(r_xram_rsp_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_XRAM_TRT; 3956 else if(r_config_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CONFIG_TRT; 3957 else if(r_read_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_READ_TRT; 3958 else if(r_write_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_WRITE_TRT; 3959 else if(r_cas_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CAS_TRT; 3917 3960 break; 3918 3961 //////////////////////// 3919 3962 case IXR_CMD_XRAM_IDLE: 3920 if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3921 else if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3922 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3923 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3924 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3963 if (r_config_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CONFIG_TRT; 3964 else if(r_read_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_READ_TRT; 3965 else if(r_write_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_WRITE_TRT; 3966 else if(r_cas_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CAS_TRT; 3967 else if(r_cleanup_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_TRT; 3968 else if(r_xram_rsp_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_XRAM_TRT; 3925 3969 break; 3926 3970 //////////////////////// 3927 3971 case IXR_CMD_CLEANUP_IDLE: 3928 3972 /*ODCCP*///std::cout << "IXR_CMD_CLEANUP_IDLE" << std::endl; 3929 if(r_read_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_READ; 3930 else if(r_write_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_WRITE; 3931 else if(r_cas_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CAS; 3932 else if(r_xram_rsp_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_XRAM; 3933 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA; 3973 if (r_read_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_READ_TRT; 3974 else if(r_write_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_WRITE_TRT; 3975 else if(r_cas_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CAS_TRT; 3976 else if(r_xram_rsp_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_XRAM_TRT; 3977 else if(r_config_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CONFIG_TRT; 3978 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_TRT; 3934 3979 break; 3935 ////////////////// // send a get from READ FSM 3936 case IXR_CMD_READ: 3937 { 3938 if(p_vci_ixr.cmdack) 3939 { 3940 r_ixr_cmd_fsm = IXR_CMD_READ_IDLE; 3941 r_read_to_ixr_cmd_req = false; 3980 ///////////////////////// 3981 case IXR_CMD_CONFIG_IDLE: 3982 { 3983 if (r_read_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_READ_TRT; 3984 else if(r_write_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_WRITE_TRT; 3985 else if(r_cas_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CAS_TRT; 3986 else if(r_cleanup_to_ixr_cmd_req) r_ixr_cmd_fsm = IXR_CMD_CLEANUP_TRT; 3987 else if(r_xram_rsp_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_XRAM_TRT; 3988 else if(r_config_to_ixr_cmd_req.read()) r_ixr_cmd_fsm = IXR_CMD_CONFIG_TRT; 3989 break; 3990 } 3991 3992 ////////////////////// 3993 case IXR_CMD_READ_TRT: // access TRT for a GET 3994 { 3995 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_CMD ) 3996 { 3997 TransactionTabEntry entry = m_trt.read( r_read_to_ixr_cmd_index.read() ); 3998 r_ixr_cmd_address = entry.nline * (m_words<<2); 3999 r_ixr_cmd_trdid = r_read_to_ixr_cmd_index.read(); 4000 r_ixr_cmd_get = true; 4001 r_ixr_cmd_word = 0; 4002 r_ixr_cmd_fsm = IXR_CMD_READ_SEND; 4003 for( size_t i=0 ; i<m_words ; i++ ) r_ixr_cmd_wdata[i] = entry.wdata[i]; 3942 4004 3943 4005 #if DEBUG_MEMC_IXR_CMD 3944 4006 if(m_debug) 3945 std::cout << " <MEMC " << name() << " IXR_CMD_READ>" 3946 << " Send a get request to xram / address = " << std::hex 3947 << (addr_t)(r_read_to_ixr_cmd_nline.read()*m_words*4) << std::endl; 3948 #endif 3949 } 3950 break; 3951 } 3952 /////////////////// 3953 case IXR_CMD_WRITE: // send a put or get from WRITE FSM 3954 { 3955 if(p_vci_ixr.cmdack) 3956 { 3957 if(r_write_to_ixr_cmd_write.read()) // PUT 3958 { 3959 if(r_ixr_cmd_cpt.read() == (m_words - 2)) 3960 { 3961 r_ixr_cmd_cpt = 0; 3962 r_ixr_cmd_fsm = IXR_CMD_WRITE_IDLE; 3963 r_write_to_ixr_cmd_req = false; 3964 } 3965 else 3966 { 3967 r_ixr_cmd_cpt = r_ixr_cmd_cpt + 2; 3968 } 4007 std::cout << " <MEMC " << name() << " IXR_CMD_READ_TRT> TRT access" 4008 << " index = " << std::dec << r_read_to_ixr_cmd_index.read() 4009 << " / address = " << std::hex << (entry.nline*(m_words<<2)) << std::endl; 4010 #endif 4011 } 4012 break; 4013 } 4014 /////////////////////// 4015 case IXR_CMD_WRITE_TRT: // access TRT for a PUT or a GET 4016 { 4017 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_CMD ) 4018 { 4019 TransactionTabEntry entry = m_trt.read( r_write_to_ixr_cmd_index.read() ); 4020 r_ixr_cmd_address = entry.nline * (m_words<<2); 4021 r_ixr_cmd_trdid = r_write_to_ixr_cmd_index.read(); 4022 r_ixr_cmd_get = entry.xram_read; 4023 r_ixr_cmd_word = 0; 4024 r_ixr_cmd_fsm = IXR_CMD_WRITE_SEND; 4025 for( size_t i=0 ; i<m_words ; i++ ) r_ixr_cmd_wdata[i] = entry.wdata[i]; 3969 4026 3970 4027 #if DEBUG_MEMC_IXR_CMD 3971 4028 if(m_debug) 3972 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE>" 3973 << " Send a put request to xram / address = " << std::hex 3974 << (addr_t)((r_write_to_ixr_cmd_nline.read() * m_words + 3975 r_ixr_cmd_cpt.read()) * 4 ) << std::endl; 3976 #endif 3977 } 3978 else // GET 3979 { 3980 r_ixr_cmd_fsm = IXR_CMD_WRITE_IDLE; 3981 r_write_to_ixr_cmd_req = false; 4029 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE_TRT> TRT access" 4030 << " index = " << std::dec << r_write_to_ixr_cmd_index.read() 4031 << " / address = " << std::hex << (entry.nline*(m_words<<2)) << std::endl; 4032 #endif 4033 } 4034 break; 4035 } 4036 ///////////////////// 4037 case IXR_CMD_CAS_TRT: // access TRT for a PUT or a GET 4038 { 4039 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_CMD ) 4040 { 4041 TransactionTabEntry entry = m_trt.read( r_cas_to_ixr_cmd_index.read() ); 4042 r_ixr_cmd_address = entry.nline * (m_words<<2); 4043 r_ixr_cmd_trdid = r_cas_to_ixr_cmd_index.read(); 4044 r_ixr_cmd_get = entry.xram_read; 4045 r_ixr_cmd_word = 0; 4046 r_ixr_cmd_fsm = IXR_CMD_CAS_SEND; 4047 for( size_t i=0 ; i<m_words ; i++ ) r_ixr_cmd_wdata[i] = entry.wdata[i]; 3982 4048 3983 4049 #if DEBUG_MEMC_IXR_CMD 3984 4050 if(m_debug) 3985 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE>" 3986 << " Send a get request to xram / address = " << std::hex 3987 << (addr_t)(r_write_to_ixr_cmd_nline.read()*m_words*4) << std::endl; 3988 #endif 3989 } 3990 } 3991 break; 3992 } 3993 ///////////////// 3994 case IXR_CMD_CAS: // send a put or get command from CAS FSM 3995 { 3996 if(p_vci_ixr.cmdack) 3997 { 3998 if(r_cas_to_ixr_cmd_write.read()) // PUT 3999 { 4000 if(r_ixr_cmd_cpt.read() == (m_words - 2)) 4001 { 4002 r_ixr_cmd_cpt = 0; 4003 r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE; 4004 r_cas_to_ixr_cmd_req = false; 4005 } 4006 else 4007 { 4008 r_ixr_cmd_cpt = r_ixr_cmd_cpt + 2; 4009 } 4051 std::cout << " <MEMC " << name() << " IXR_CMD_CAS_TRT> TRT access" 4052 << " index = " << std::dec << r_cas_to_ixr_cmd_index.read() 4053 << " / address = " << std::hex << (entry.nline*(m_words<<2)) << std::endl; 4054 #endif 4055 } 4056 break; 4057 } 4058 ////////////////////// 4059 case IXR_CMD_XRAM_TRT: // access TRT for a PUT 4060 { 4061 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_CMD ) 4062 { 4063 TransactionTabEntry entry = m_trt.read( r_xram_rsp_to_ixr_cmd_index.read() ); 4064 r_ixr_cmd_address = entry.nline * (m_words<<2); 4065 r_ixr_cmd_trdid = r_xram_rsp_to_ixr_cmd_index.read(); 4066 r_ixr_cmd_get = false; 4067 r_ixr_cmd_word = 0; 4068 r_ixr_cmd_fsm = IXR_CMD_XRAM_SEND; 4069 for( size_t i=0 ; i<m_words ; i++ ) r_ixr_cmd_wdata[i] = entry.wdata[i]; 4010 4070 4011 4071 #if DEBUG_MEMC_IXR_CMD 4012 4072 if(m_debug) 4013 std::cout << " <MEMC " << name() << " IXR_CMD_CAS>" 4014 << " Send a put request to xram / address = " << std::hex 4015 << (addr_t)( (r_cas_to_ixr_cmd_nline.read() * m_words + 4016 r_ixr_cmd_cpt.read()) * 4 ) << std::endl; 4017 #endif 4018 } 4019 else // GET 4020 { 4021 r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE; 4022 r_cas_to_ixr_cmd_req = false; 4073 std::cout << " <MEMC " << name() << " IXR_CMD_XRAM_TRT> TRT access" 4074 << " index = " << std::dec << r_xram_rsp_to_ixr_cmd_index.read() 4075 << " / address = " << std::hex << (entry.nline*(m_words<<2)) << std::endl; 4076 #endif 4077 } 4078 break; 4079 } 4080 ////////////////////// 4081 case IXR_CMD_CLEANUP_TRT: // access TRT for a PUT 4082 { 4083 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_CMD ) 4084 { 4085 4086 TransactionTabEntry entry = m_trt.read( r_cleanup_to_ixr_cmd_index.read() ); 4087 r_ixr_cmd_address = entry.nline * (m_words<<2); 4088 r_ixr_cmd_trdid = r_cleanup_to_ixr_cmd_index.read(); 4089 r_ixr_cmd_get = false; 4090 r_ixr_cmd_word = 0; 4091 r_ixr_cmd_fsm = IXR_CMD_CLEANUP_DATA_SEND; 4092 for( size_t i=0 ; i<m_words ; i++ ) r_ixr_cmd_wdata[i] = entry.wdata[i]; 4023 4093 4024 4094 #if DEBUG_MEMC_IXR_CMD 4025 4095 if(m_debug) 4026 std::cout << " <MEMC " << name() << " IXR_CMD_CAS>" 4027 << " Send a get request to xram / address = " << std::hex 4028 << (addr_t)(r_cas_to_ixr_cmd_nline.read()*m_words*4) << std::endl; 4029 #endif 4030 } 4031 } 4032 break; 4033 } 4034 ////////////////// 4035 case IXR_CMD_XRAM: // send a put from XRAM_RSP FSM 4036 { 4037 if(p_vci_ixr.cmdack) 4038 { 4039 if(r_ixr_cmd_cpt.read() == (m_words - 2)) 4040 { 4041 r_ixr_cmd_cpt = 0; 4042 r_ixr_cmd_fsm = IXR_CMD_XRAM_IDLE; 4043 r_xram_rsp_to_ixr_cmd_req = false; 4096 std::cout << " <MEMC " << name() << " IXR_CMD_CLEANUP_TRT> TRT access" 4097 << " index = " << std::dec << r_cleanup_to_ixr_cmd_index.read() 4098 << " / address = " << std::hex << (entry.nline*(m_words<<2)) << std::endl; 4099 #endif 4100 } 4101 break; 4102 } 4103 //////////////////////// 4104 case IXR_CMD_CONFIG_TRT: // access TRT for a PUT 4105 { 4106 if ( r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_CMD ) 4107 { 4108 TransactionTabEntry entry = m_trt.read( r_config_to_ixr_cmd_index.read() ); 4109 r_ixr_cmd_address = entry.nline * (m_words<<2); 4110 r_ixr_cmd_trdid = r_config_to_ixr_cmd_index.read(); 4111 r_ixr_cmd_get = false; 4112 r_ixr_cmd_word = 0; 4113 r_ixr_cmd_fsm = IXR_CMD_CONFIG_SEND; 4114 for( size_t i=0 ; i<m_words ; i++ ) r_ixr_cmd_wdata[i] = entry.wdata[i]; 4115 4116 #if DEBUG_MEMC_IXR_CMD 4117 if(m_debug) 4118 std::cout << " <MEMC " << name() << " IXR_CMD_CONFIG_TRT> TRT access" 4119 << " index = " << std::dec << r_config_to_ixr_cmd_index.read() 4120 << " / address = " << std::hex << (entry.nline*(m_words<<2)) << std::endl; 4121 #endif 4122 } 4123 break; 4124 } 4125 4126 /////////////////////// 4127 case IXR_CMD_READ_SEND: // send a get from READ FSM 4128 { 4129 if(p_vci_ixr.cmdack) 4130 { 4131 r_ixr_cmd_fsm = IXR_CMD_READ_IDLE; 4132 r_read_to_ixr_cmd_req = false; 4133 4134 #if DEBUG_MEMC_IXR_CMD 4135 if(m_debug) 4136 std::cout << " <MEMC " << name() << " IXR_CMD_READ_SEND> GET request:" << std::hex 4137 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4138 #endif 4139 } 4140 break; 4141 } 4142 //////////////////////// 4143 case IXR_CMD_WRITE_SEND: // send a put or get from WRITE FSM 4144 { 4145 if(p_vci_ixr.cmdack) 4146 { 4147 if(r_write_to_ixr_cmd_put.read()) // PUT 4148 { 4149 if(r_ixr_cmd_word.read() == (m_words - 2)) 4150 { 4151 r_ixr_cmd_fsm = IXR_CMD_WRITE_IDLE; 4152 r_write_to_ixr_cmd_req = false; 4153 } 4154 else 4155 { 4156 r_ixr_cmd_word = r_ixr_cmd_word.read() + 2; 4157 } 4158 4159 #if DEBUG_MEMC_IXR_CMD 4160 if(m_debug) 4161 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE_SEND> PUT request:" << std::hex 4162 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4163 #endif 4164 } 4165 else // GET 4166 { 4167 r_ixr_cmd_fsm = IXR_CMD_WRITE_IDLE; 4168 r_write_to_ixr_cmd_req = false; 4169 4170 #if DEBUG_MEMC_IXR_CMD 4171 if(m_debug) 4172 std::cout << " <MEMC " << name() << " IXR_CMD_WRITE_SEND> GET request:" << std::hex 4173 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4174 #endif 4175 } 4176 } 4177 break; 4178 } 4179 ////////////////////// 4180 case IXR_CMD_CAS_SEND: // send a put or get command from CAS FSM 4181 { 4182 if(p_vci_ixr.cmdack) 4183 { 4184 if(r_cas_to_ixr_cmd_put.read()) // PUT 4185 { 4186 if(r_ixr_cmd_word.read() == (m_words - 2)) 4187 { 4188 r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE; 4189 r_cas_to_ixr_cmd_req = false; 4190 } 4191 else 4192 { 4193 r_ixr_cmd_word = r_ixr_cmd_word.read() + 2; 4194 } 4195 4196 #if DEBUG_MEMC_IXR_CMD 4197 if(m_debug) 4198 std::cout << " <MEMC " << name() << " IXR_CMD_CAS_SEND> PUT request:" << std::hex 4199 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4200 #endif 4201 } 4202 else // GET 4203 { 4204 r_ixr_cmd_fsm = IXR_CMD_CAS_IDLE; 4205 r_cas_to_ixr_cmd_req = false; 4206 4207 #if DEBUG_MEMC_IXR_CMD 4208 if(m_debug) 4209 std::cout << " <MEMC " << name() << " IXR_CMD_CAS_SEND> GET request:" << std::hex 4210 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4211 #endif 4212 } 4213 } 4214 break; 4215 } 4216 /////////////////////// 4217 case IXR_CMD_XRAM_SEND: // send a put from XRAM_RSP FSM 4218 { 4219 if(p_vci_ixr.cmdack.read()) 4220 { 4221 if(r_ixr_cmd_word.read() == (m_words - 2)) 4222 { 4223 r_ixr_cmd_fsm = IXR_CMD_XRAM_IDLE; 4224 r_xram_rsp_to_ixr_cmd_req = false; 4225 } 4226 else 4227 { 4228 r_ixr_cmd_word = r_ixr_cmd_word.read() + 2; 4229 } 4230 #if DEBUG_MEMC_IXR_CMD 4231 if(m_debug) 4232 std::cout << " <MEMC " << name() << " IXR_CMD_XRAM_SEND> PUT request:" << std::hex 4233 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4234 #endif 4235 } 4236 break; 4237 } 4238 4239 //////////////////////// 4240 case IXR_CMD_CLEANUP_DATA_SEND: // send a put command to XRAM 4241 { 4242 if(p_vci_ixr.cmdack.read()) 4243 { 4244 /*ODCCP*/ //std::cout << "IXR_CMD_CLEANUP_DATA_SEND STATE at cycle : " << std::dec << m_cpt_cycles << std::endl; 4245 if(r_ixr_cmd_word.read() == (m_words - 2)) 4246 { 4247 /*ODCCP*/ //std::cout << "IXR_CMD_CLEANUP_DATA_SEND GO TO IXR_CMD_CLEANUP_IDLE" << std::endl; 4248 r_ixr_cmd_fsm = IXR_CMD_CLEANUP_IDLE; 4249 r_cleanup_to_ixr_cmd_req = false; 4250 //r_ixr_cmd_word = 0; 4251 //r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false; 4044 4252 } 4045 4253 else 4046 4254 { 4047 r_ixr_cmd_cpt = r_ixr_cmd_cpt + 2; 4048 } 4049 4050 #if DEBUG_MEMC_IXR_CMD 4051 if(m_debug) 4052 std::cout << " <MEMC " << name() << " IXR_CMD_XRAM>" 4053 << " Send a put request to xram / address = " << std::hex 4054 << (addr_t)( (r_xram_rsp_to_ixr_cmd_nline.read() * m_words + 4055 r_ixr_cmd_cpt.read()) * 4 ) << std::endl; 4056 #endif 4057 } 4058 break; 4059 } 4060 4061 //////////////////////// 4062 case IXR_CMD_CLEANUP_DATA: // send a put command to XRAM 4063 /*ODCCP*///std::cout << "IXR_CMD_CLEANUP_DATA" << std::endl; 4064 if(p_vci_ixr.cmdack) 4065 { 4066 if(r_ixr_cmd_cpt.read() == (m_words - 2)) 4067 { 4068 r_ixr_cmd_cpt = 0; 4069 r_ixr_cmd_fsm = IXR_CMD_CLEANUP_IDLE; 4070 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = false; 4071 r_cleanup_to_ixr_cmd_req = false; 4072 } 4073 else 4074 { 4075 r_ixr_cmd_cpt = r_ixr_cmd_cpt.read() + 2; 4255 r_ixr_cmd_word = r_ixr_cmd_word.read() + 2; 4076 4256 } 4077 4257 … … 4079 4259 if(m_debug) 4080 4260 { 4081 std::cout << " <MEMC " << name() << ".IXR_CMD_CLEANUP_DATA> Send a put request to xram" << std::endl; 4082 } 4083 #endif 4084 } 4085 break; 4086 4261 std::cout << " <MEMC " << name() << ".IXR_CMD_CLEANUP_DATA_SEND> Send a put request to xram" << std::endl; 4262 } 4263 #endif 4264 } 4265 break; 4266 } 4267 4268 ///////////////////////// 4269 case IXR_CMD_CONFIG_SEND: // send a put from CONFIG FSM 4270 { 4271 if(p_vci_ixr.cmdack.read()) 4272 { 4273 if(r_ixr_cmd_word.read() == (m_words - 2)) 4274 { 4275 r_ixr_cmd_fsm = IXR_CMD_CONFIG_IDLE; 4276 r_config_to_ixr_cmd_req = false; 4277 } 4278 else 4279 { 4280 r_ixr_cmd_word = r_ixr_cmd_word.read() + 2; 4281 } 4282 4283 #if DEBUG_MEMC_IXR_CMD 4284 if(m_debug) 4285 std::cout << " <MEMC " << name() << " IXR_CMD_CONFIG_SEND> PUT request:" << std::hex 4286 << " address = " << r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2) << std::endl; 4287 #endif 4288 } 4289 break; 4290 } 4087 4291 } // end switch r_ixr_cmd_fsm 4088 4292 … … 4091 4295 //////////////////////////////////////////////////////////////////////////// 4092 4296 // The IXR_RSP FSM receives the response packets from the XRAM, 4093 // for both put transaction, and gettransaction.4297 // for both PUT transaction, and GET transaction. 4094 4298 // 4095 // - A response to a putrequest is a single-cell VCI packet.4096 // The T ransaction Tabindex is contained in the RTRDID field.4299 // - A response to a PUT request is a single-cell VCI packet. 4300 // The TRT index is contained in the RTRDID field. 4097 4301 // The FSM takes the lock protecting the TRT, and the corresponding 4098 // entry is erased. 4302 // entry is erased. If an acknowledge was required (in case of software SYNC) 4303 // the r_config_rsp_lines counter is decremented. 4099 4304 // 4100 // - A response to a getrequest is a multi-cell VCI packet.4101 // The T ransaction Tabindex is contained in the RTRDID field.4305 // - A response to a GET request is a multi-cell VCI packet. 4306 // The TRT index is contained in the RTRDID field. 4102 4307 // The N cells contain the N words of the cache line in the RDATA field. 4103 4308 // The FSM takes the lock protecting the TRT to store the line in the TRT 4104 4309 // (taking into account the write requests already stored in the TRT). 4105 // When the line is completely written, the corresponding rok signal is set. 4310 // When the line is completely written, the r_ixr_rsp_to_xram_rsp_rok[index] 4311 // signal is set to inform the XRAM_RSP FSM. 4106 4312 /////////////////////////////////////////////////////////////////////////////// 4107 4313 … … 4111 4317 case IXR_RSP_IDLE: // test transaction type: PUT/GET 4112 4318 { 4113 if(p_vci_ixr.rspval.read()) 4114 { 4115 r_ixr_rsp_cpt = 0; 4116 r_ixr_rsp_trt_index = p_vci_ixr.rtrdid.read(); 4117 if(p_vci_ixr.reop.read() and !(p_vci_ixr.rerror.read() &0x1)) // PUT transaction 4118 { 4119 r_ixr_rsp_fsm = IXR_RSP_ACK; 4120 4121 #if DEBUG_MEMC_IXR_RSP 4122 if(m_debug) 4123 std::cout << " <MEMC " << name() 4124 << " IXR_RSP_IDLE> Response from XRAM to a put transaction" << std::endl; 4125 #endif 4126 } 4127 else // GET transaction 4128 { 4129 r_ixr_rsp_fsm = IXR_RSP_TRT_READ; 4319 if(p_vci_ixr.rspval.read()) 4320 { 4321 r_ixr_rsp_cpt = 0; 4322 r_ixr_rsp_trt_index = p_vci_ixr.rtrdid.read(); 4323 4324 assert( ((p_vci_ixr.rerror.read() & 0x1) == 0) and 4325 "MEMC ERROR in IXR_RSP state: XRAM response error !"); 4326 4327 if(p_vci_ixr.reop.read()) // PUT 4328 { 4329 r_ixr_rsp_fsm = IXR_RSP_TRT_ERASE; 4330 } 4331 4332 else // GET transaction 4333 { 4334 r_ixr_rsp_fsm = IXR_RSP_TRT_READ; 4130 4335 4131 4336 #if DEBUG_MEMC_IXR_RSP … … 4134 4339 << " IXR_RSP_IDLE> Response from XRAM to a get transaction" << std::endl; 4135 4340 #endif 4136 } 4137 } 4138 break; 4139 } 4140 ///////////////// 4141 case IXR_RSP_ACK: // Aknowledge the VCI response for a PUT 4142 { 4143 if(p_vci_ixr.rspval.read()) r_ixr_rsp_fsm = IXR_RSP_TRT_ERASE; 4144 4145 #if DEBUG_MEMC_IXR_RSP 4146 if(m_debug) 4147 std::cout << " <MEMC " << name() << " IXR_RSP_ACK>" << std::endl; 4148 #endif 4341 } 4342 } 4149 4343 break; 4150 4344 } 4151 4345 //////////////////////// 4346 case IXR_RSP_ACK: // Acknowledge PUT transaction 4347 { 4348 r_ixr_rsp_fsm = IXR_RSP_IDLE; 4349 break; 4350 } 4351 4352 //////////////////////// 4152 4353 case IXR_RSP_TRT_ERASE: // erase the entry in the TRT 4153 { 4154 if(r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) 4155 { 4156 m_trt.erase(r_ixr_rsp_trt_index.read()); 4157 r_ixr_rsp_fsm = IXR_RSP_IDLE; 4158 4354 // decrease the line counter if config request 4355 { 4356 if(r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) 4357 { 4358 size_t index = r_ixr_rsp_trt_index.read(); 4359 if (m_trt.is_config(index) ) r_config_rsp_lines = r_config_rsp_lines.read() - 1; 4360 m_trt.erase(index); 4361 r_ixr_rsp_fsm = IXR_RSP_IDLE; 4362 4363 // std::cout << "remove a valid slot in trt index = " << r_ixr_rsp_trt_index.read()<< std::endl; 4159 4364 #if DEBUG_MEMC_IXR_RSP 4160 4365 if(m_debug) … … 4162 4367 << r_ixr_rsp_trt_index.read() << std::endl; 4163 4368 #endif 4164 m_cpt_ixr_fsm_n_trt_lock++; 4165 } 4166 4167 m_cpt_ixr_fsm_trt_lock++; 4168 4169 break; 4369 } 4370 break; 4170 4371 } 4171 4372 ////////////////////// 4172 4373 case IXR_RSP_TRT_READ: // write a 64 bits data in the TRT 4173 4374 { 4174 if((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) and p_vci_ixr.rspval)4175 {4176 size_t index = r_ixr_rsp_trt_index.read();4177 bool eop = p_vci_ixr.reop.read();4178 wide_data_t data = p_vci_ixr.rdata.read();4179 bool error = ((p_vci_ixr.rerror.read() & 0x1) == 1);4180 4181 assert(((eop == (r_ixr_rsp_cpt.read() == (m_words-2))) or p_vci_ixr.rerror.read()) 4182 and "Error in VCI_MEM_CACHE : invalid length for a response from XRAM");4183 4184 m_trt.write_rsp( index,4185 r_ixr_rsp_cpt.read(),4186 data,4187 error);4188 4189 r_ixr_rsp_cpt = r_ixr_rsp_cpt.read()+ 2;4190 4191 if(eop)4192 {4193 r_ixr_rsp_to_xram_rsp_rok[r_ixr_rsp_trt_index.read()]=true;4194 r_ixr_rsp_fsm = IXR_RSP_IDLE;4195 }4375 if((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) and p_vci_ixr.rspval) 4376 { 4377 size_t index = r_ixr_rsp_trt_index.read(); 4378 size_t word = r_ixr_rsp_cpt.read(); 4379 bool eop = p_vci_ixr.reop.read(); 4380 wide_data_t data = p_vci_ixr.rdata.read(); 4381 bool error = ((p_vci_ixr.rerror.read() & 0x1) == 1); 4382 4383 assert(((eop == (word == (m_words-2))) or error) and 4384 "MEMC ERROR in IXR_RSP_TRT_READ state : invalid response from XRAM"); 4385 4386 m_trt.write_rsp( index, 4387 word, 4388 data ); 4389 4390 r_ixr_rsp_cpt = word + 2; 4391 4392 if(eop) 4393 { 4394 r_ixr_rsp_to_xram_rsp_rok[r_ixr_rsp_trt_index.read()]=true; 4395 r_ixr_rsp_fsm = IXR_RSP_IDLE; 4396 } 4196 4397 4197 4398 #if DEBUG_MEMC_IXR_RSP … … 4199 4400 std::cout << " <MEMC " << name() << " IXR_RSP_TRT_READ> Writing a word in TRT : " 4200 4401 << " index = " << std::dec << index 4201 << " / word = " << r_ixr_rsp_cpt.read()4402 << " / word = " << word 4202 4403 << " / data = " << std::hex << data << std::endl; 4203 4404 #endif … … 4212 4413 // XRAM_RSP FSM 4213 4414 //////////////////////////////////////////////////////////////////////////// 4214 // The XRAM_RSP FSM handles the incoming cache lines from the XRAM.4415 // The XRAM_RSP FSM handles the incoming cache lines after an XRAM GET. 4215 4416 // The cache line has been written in the TRT by the IXR_CMD_FSM. 4216 4417 // As the IXR_RSP FSM and the XRAM_RSP FSM are running in parallel, 4217 // there is as many flip-flops r_ixr_rsp_to_xram_rsp_rok[i] 4218 // as the number of entries in the TRT, that are handled with 4219 // a round-robin priority... 4418 // there is as many flip-flops r_ixr_rsp_to_xram_rsp_rok[i] as the number 4419 // of entries in the TRT, that are handled with a round-robin priority... 4220 4420 // 4221 // When a response is available, the corresponding TRT entry 4222 // is copied in a local buffer to be written in the cache. 4223 // The FSM takes the lock protecting the TRT, and the lock protecting the DIR. 4224 // It selects a cache slot and writes the line in the cache. 4421 // The FSM takes the lock protecting TRT, and the lock protecting DIR. 4422 // The selected TRT entry is copied in the local buffer r_xram_rsp_trt_buf. 4423 // It selects a cache slot and save the victim line in another local buffer 4424 // r_xram_rsp_victim_***. 4425 // It writes the line extracted from TRT in the cache. 4225 4426 // If it was a read MISS, the XRAM_RSP FSM send a request to the TGT_RSP 4226 4427 // FSM to return the cache line to the registered processor. … … 4237 4438 case XRAM_RSP_IDLE: // scan the XRAM responses / select a TRT index (round robin) 4238 4439 { 4239 size_t ptr= r_xram_rsp_trt_index.read();4240 size_t lines = m_trt_lines;4241 for(size_t i=0 ; i<lines ; i++)4242 {4243 size_t index = (i+ptr+1) %lines;4244 if(r_ixr_rsp_to_xram_rsp_rok[index])4245 {4246 r_xram_rsp_trt_index = index;4247 r_ixr_rsp_to_xram_rsp_rok[index] = false;4248 r_xram_rsp_fsm = XRAM_RSP_DIR_LOCK;4440 size_t old = r_xram_rsp_trt_index.read(); 4441 size_t lines = m_trt_lines; 4442 for(size_t i=0 ; i<lines ; i++) 4443 { 4444 size_t index = (i+old+1) %lines; 4445 if(r_ixr_rsp_to_xram_rsp_rok[index]) 4446 { 4447 r_xram_rsp_trt_index = index; 4448 r_ixr_rsp_to_xram_rsp_rok[index] = false; 4449 r_xram_rsp_fsm = XRAM_RSP_DIR_LOCK; 4249 4450 4250 4451 #if DEBUG_MEMC_XRAM_RSP … … 4254 4455 << " index = " << std::dec << index << std::endl; 4255 4456 #endif 4256 break;4257 }4258 }4457 break; 4458 } 4459 } 4259 4460 break; 4260 4461 } … … 4269 4470 size_t index = r_xram_rsp_trt_index.read(); 4270 4471 r_xram_rsp_trt_buf.copy( m_trt.read(index) ); 4271 4272 4472 r_xram_rsp_fsm = XRAM_RSP_TRT_COPY; 4273 4473 … … 4288 4488 // and copy it in a local buffer 4289 4489 { 4290 if ( (r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) and 4291 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) ) 4292 { 4490 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) and 4491 "MEMC ERROR in XRAM_RSP_TRT_COPY state: Bad DIR allocation"); 4492 4493 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) and 4494 "MEMC ERROR in XRAM_RSP_TRT_COPY state: Bad TRT allocation"); 4495 4293 4496 // selects & extracts a victim line from cache 4294 4497 size_t way = 0; … … 4319 4522 r_xram_rsp_victim_dirty = victim.dirty or (!victim.cache_coherent && (victim.count == 1)); //a NCC line is by default considered as dirty in the L1: we must take a reservation on a TRT entry 4320 4523 4321 4322 if(!r_xram_rsp_trt_buf.rerror) 4323 { 4324 if (!victim.cache_coherent and r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read()) //there can not be two L2 invalidation on NCC line at the same time 4325 { 4326 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4327 } 4328 else 4329 { 4330 r_xram_rsp_fsm = XRAM_RSP_INVAL_LOCK; 4331 } 4332 } 4333 else 4334 { 4335 r_xram_rsp_fsm = XRAM_RSP_ERROR_ERASE; 4336 } 4337 4338 #if DEBUG_MEMC_XRAM_RSP 4524 if( not r_xram_rsp_trt_buf.rerror ) r_xram_rsp_fsm = XRAM_RSP_IVT_LOCK; 4525 else r_xram_rsp_fsm = XRAM_RSP_ERROR_ERASE; 4526 4527 #if DEBUG_MEMC_XRAM_RSP 4339 4528 if(m_debug) 4340 4529 std::cout << " <MEMC " << name() << " XRAM_RSP_TRT_COPY>" 4341 << " Select a slot: "4530 << " Select a victim slot: " 4342 4531 << " way = " << std::dec << way 4343 4532 << " / set = " << set 4344 4533 << " / inval_required = " << inval << std::endl; 4345 4534 #endif 4346 } 4347 else 4348 { 4349 std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_TRT_COPY" 4350 << " bad TRT or DIR allocation" << std::endl; 4351 exit(0); 4352 } 4353 break; 4354 } 4355 ///////////////////////// 4356 case XRAM_RSP_INVAL_LOCK: // Take the IVT lock to check a possible pending inval 4357 { 4358 if(r_alloc_ivt_fsm == ALLOC_IVT_XRAM_RSP) 4359 { 4360 size_t index = 0; 4361 size_t index_victim = 0; 4362 if(m_ivt.search_inval(r_xram_rsp_trt_buf.nline, index) or 4363 m_ivt.search_inval(r_xram_rsp_victim_nline.read(), index_victim)) 4364 { 4365 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4535 break; 4536 } 4537 /////////////////////// 4538 case XRAM_RSP_IVT_LOCK: // Keep DIR and TRT locks and take the IVT lock 4539 // to check a possible pending inval 4540 { 4541 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) and 4542 "MEMC ERROR in XRAM_RSP_IVT_LOCK state: Bad DIR allocation"); 4543 4544 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) and 4545 "MEMC ERROR in XRAM_RSP_IVT_LOCK state: Bad TRT allocation"); 4546 4547 if(r_alloc_ivt_fsm == ALLOC_IVT_XRAM_RSP) 4548 { 4549 size_t index = 0; 4550 if(m_ivt.search_inval(r_xram_rsp_trt_buf.nline, index)) // pending inval 4551 { 4552 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4366 4553 4367 4554 #if DEBUG_MEMC_XRAM_RSP 4368 4555 if(m_debug) 4369 std::cout << " <MEMC " << name() << " XRAM_RSP_I NVAL_LOCK>"4556 std::cout << " <MEMC " << name() << " XRAM_RSP_IVT_LOCK>" 4370 4557 << " Get acces to IVT, but line invalidation registered" 4371 << " / nline = " << std::hex << r_xram_rsp_trt_buf.nline4558 << " / address = " << std::hex << r_xram_rsp_trt_buf.nline*m_words*4 4372 4559 << " / index = " << std::dec << index << std::endl; 4373 4560 #endif 4374 4561 4375 } 4376 else if(m_ivt.is_full() and r_xram_rsp_victim_inval.read()) // IVT full 4377 { 4378 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4379 m_upt.print(); 4562 } 4563 else if(m_ivt.is_full() and r_xram_rsp_victim_inval.read()) // IVT full 4564 { 4565 r_xram_rsp_fsm = XRAM_RSP_INVAL_WAIT; 4380 4566 4381 4567 #if DEBUG_MEMC_XRAM_RSP 4382 4568 if(m_debug) 4383 std::cout << " <MEMC " << name() << " XRAM_RSP_I NVAL_LOCK>"4569 std::cout << " <MEMC " << name() << " XRAM_RSP_IVT_LOCK>" 4384 4570 << " Get acces to IVT, but inval required and IVT full" << std::endl; 4385 4571 #endif 4386 }4387 else4388 {4389 r_xram_rsp_fsm = XRAM_RSP_DIR_UPDT;4572 } 4573 else 4574 { 4575 r_xram_rsp_fsm = XRAM_RSP_DIR_UPDT; 4390 4576 4391 4577 #if DEBUG_MEMC_XRAM_RSP 4392 4578 if(m_debug) 4393 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL_LOCK>" 4394 << " Get acces to IVT" << std::endl; 4395 #endif 4396 } 4397 m_cpt_xram_rsp_fsm_n_upt_lock++; 4398 } 4399 4400 m_cpt_xram_rsp_fsm_upt_lock++; 4401 4402 break; 4579 std::cout << " <MEMC " << name() << " XRAM_RSP_IVT_LOCK>" 4580 << " Get acces to IVT / no pending inval request" << std::endl; 4581 #endif 4582 } 4583 } 4584 break; 4403 4585 } 4404 4586 ///////////////////////// … … 4415 4597 } 4416 4598 /////////////////////// 4417 case XRAM_RSP_DIR_UPDT: // updates the cache (both data & directory) 4418 // and possibly set an inval request in IVT 4419 { 4420 // check if this is an instruction read, this means pktid is either 4421 // TYPE_READ_INS_UNC 0bX010 with TSAR encoding 4422 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 4423 bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) and r_xram_rsp_trt_buf.proc_read; 4424 4425 // check if this is a cached read, this means pktid is either 4426 // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding 4427 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 4428 bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) and r_xram_rsp_trt_buf.proc_read; 4429 4430 bool dirty = false; 4431 4432 // update cache data 4433 size_t set = r_xram_rsp_victim_set.read(); 4434 size_t way = r_xram_rsp_victim_way.read(); 4435 for(size_t word=0; word<m_words ; word++) 4436 { 4437 m_cache_data.write(way, set, word, r_xram_rsp_trt_buf.wdata[word]); 4438 4439 dirty = dirty or (r_xram_rsp_trt_buf.wdata_be[word] != 0); 4440 4441 if(m_monitor_ok) 4442 { 4443 addr_t address = r_xram_rsp_trt_buf.nline<<6 | word<<2; 4444 check_monitor( address, r_xram_rsp_trt_buf.wdata[word], false); 4445 } 4446 } 4599 case XRAM_RSP_DIR_UPDT: // updates the cache (both data & directory), 4600 // erases the TRT entry if victim not dirty, 4601 // and set inval request in IVT if required 4602 { 4603 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP) and 4604 "MEMC ERROR in XRAM_RSP_DIR_UPDT state: Bad DIR allocation"); 4605 4606 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) and 4607 "MEMC ERROR in XRAM_RSP_DIR_UPDT state: Bad TRT allocation"); 4608 4609 assert( (r_alloc_ivt_fsm.read() == ALLOC_IVT_XRAM_RSP) and 4610 "MEMC ERROR in XRAM_RSP_DIR_UPDT state: Bad IVT allocation"); 4611 4612 // check if this is an instruction read, this means pktid is either 4613 // TYPE_READ_INS_UNC 0bX010 with TSAR encoding 4614 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 4615 4616 // check if this is a cached read, this means pktid is either 4617 // TYPE_READ_DATA_MISS 0bX001 with TSAR encoding 4618 // TYPE_READ_INS_MISS 0bX011 with TSAR encoding 4619 bool cached_read = (r_xram_rsp_trt_buf.pktid & 0x1) and r_xram_rsp_trt_buf.proc_read; 4620 4621 bool inst_read = (r_xram_rsp_trt_buf.pktid & 0x2) and r_xram_rsp_trt_buf.proc_read; 4622 4623 bool dirty = false; 4624 4625 // update cache data 4626 size_t set = r_xram_rsp_victim_set.read(); 4627 size_t way = r_xram_rsp_victim_way.read(); 4628 for(size_t word=0; word<m_words ; word++) 4629 { 4630 m_cache_data.write(way, set, word, r_xram_rsp_trt_buf.wdata[word]); 4631 dirty = dirty or (r_xram_rsp_trt_buf.wdata_be[word] != 0); 4632 4633 } 4447 4634 4448 4635 // update cache directory … … 4458 4645 { 4459 4646 entry.owner.srcid = r_xram_rsp_trt_buf.srcid; 4460 #if L1_MULTI_CACHE4461 entry.owner.cache_id= r_xram_rsp_trt_buf.pktid;4462 #endif4463 4647 entry.owner.inst = inst_read; 4464 4648 entry.count = 1; … … 4466 4650 else 4467 4651 { 4468 entry.owner.srcid = r_xram_rsp_trt_buf.srcid; 4469 #if L1_MULTI_CACHE 4470 entry.owner.cache_id = 0; 4471 #endif 4652 entry.owner.srcid = 0; 4472 4653 entry.owner.inst = 0; 4473 4654 entry.count = 0; … … 4495 4676 4496 4677 r_xram_rsp_ivt_index = index; 4497 if(!wok) 4498 { 4499 std::cout << "VCI_MEM_CACHE ERROR " << name() << " XRAM_RSP_DIR_UPDT" 4500 << " invalidate_tab entry free but write unsuccessful" << std::endl; 4501 exit(0); 4502 } 4678 assert( wok and 4679 "MEMC ERROR in XRAM_RSP_DIR_UPDT state: IVT should not be full"); 4680 4503 4681 } 4504 4682 if (!r_xram_rsp_victim_coherent.read()) 4505 4683 { 4506 4684 //m_llsc_table.sw(r_xram_rsp_victim_nline.read()*m_words*4); 4507 m_llsc_table.sw(r_xram_rsp_victim_nline.read() );4685 m_llsc_table.sw(r_xram_rsp_victim_nline.read(), 0, m_words - 1); 4508 4686 } 4509 4687 #if DEBUG_MEMC_XRAM_RSP … … 4539 4717 case XRAM_RSP_TRT_DIRTY: // set the TRT entry (write to XRAM) if the victim is dirty or not coherent (RWT) 4540 4718 { 4541 if(r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) 4542 { 4543 4544 m_trt.set(r_xram_rsp_trt_index.read(), 4545 false, // write to XRAM 4546 r_xram_rsp_victim_nline.read(), // line index 4547 0, 4548 0, 4549 0, 4550 false, 4551 0, 4552 0, 4553 std::vector<be_t> (m_words,0), 4554 std::vector<data_t> (m_words,0)); 4555 4556 #if DEBUG_MEMC_XRAM_RSP 4557 if(m_debug) 4719 if(r_alloc_trt_fsm.read() == ALLOC_TRT_XRAM_RSP) 4720 { 4721 std::vector<data_t> data_vector; 4722 data_vector.clear(); 4723 for(size_t i=0; i<m_words; i++) 4724 { 4725 data_vector.push_back(r_xram_rsp_victim_data[i].read()); 4726 } 4727 m_trt.set( r_xram_rsp_trt_index.read(), 4728 false, // PUT 4729 r_xram_rsp_victim_nline.read(), // line index 4730 0, // unused 4731 0, // unused 4732 0, // unused 4733 false, // not proc_read 4734 0, // unused 4735 0, // unused 4736 std::vector<be_t>(m_words,0xF), 4737 data_vector); 4738 #if DEBUG_MEMC_XRAM_RSP 4739 if(m_debug) 4740 m_trt.print(0); 4558 4741 std::cout << " <MEMC " << name() << " XRAM_RSP_TRT_DIRTY>" 4559 4742 << " Set TRT entry for the put transaction" 4560 4743 << " / dirty victim line = " << r_xram_rsp_victim_nline.read() << std::endl; 4561 4744 #endif 4745 4746 if( not r_xram_rsp_victim_coherent ) 4747 std::cout << "a victim coherent not sent trt index =" << r_xram_rsp_trt_index.read() << std::endl; 4562 4748 if(r_xram_rsp_trt_buf.proc_read) r_xram_rsp_fsm = XRAM_RSP_DIR_RSP; 4563 4749 else if(r_xram_rsp_victim_inval.read()) r_xram_rsp_fsm = XRAM_RSP_INVAL; … … 4573 4759 case XRAM_RSP_DIR_RSP: // Request a response to TGT_RSP FSM 4574 4760 { 4575 if( !r_xram_rsp_to_tgt_rsp_req.read())4761 if( not r_xram_rsp_to_tgt_rsp_req.read()) 4576 4762 { 4577 4763 r_xram_rsp_to_tgt_rsp_srcid = r_xram_rsp_trt_buf.srcid; … … 4627 4813 xram_rsp_to_cc_send_fifo_srcid = r_xram_rsp_victim_copy.read(); 4628 4814 xram_rsp_to_cc_send_fifo_inst = r_xram_rsp_victim_copy_inst.read(); 4629 #if L1_MULTI_CACHE4630 xram_rsp_to_cc_send_fifo_cache_id = r_xram_rsp_victim_copy_cache.read();4631 #endif4632 4815 xram_rsp_to_cc_send_fifo_put = multi_req; 4633 r_xram_rsp_next_ptr 4634 4635 if(r_xram_rsp_victim_dirty ) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY;4816 r_xram_rsp_next_ptr = r_xram_rsp_victim_ptr.read(); 4817 4818 if(r_xram_rsp_victim_dirty and r_xram_rsp_victim_coherent) r_xram_rsp_fsm = XRAM_RSP_WRITE_DIRTY; 4636 4819 else if(not_last_multi_req) r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ; 4637 4820 else r_xram_rsp_fsm = XRAM_RSP_IDLE; 4638 4821 4822 // std::cout << "cleanup sent for trt index =" << r_xram_rsp_trt_index.read() << std::endl; 4639 4823 #if DEBUG_MEMC_XRAM_RSP 4640 4824 if(m_debug) 4641 4825 std::cout << " <MEMC " << name() << " XRAM_RSP_INVAL>" 4642 4826 << " Send an inval request to CC_SEND FSM" 4643 << " / victim line = " << r_xram_rsp_victim_nline.read()<< std::endl;4827 << " / address = " << r_xram_rsp_victim_nline.read()*m_words*4 << std::endl; 4644 4828 #endif 4645 4829 } … … 4649 4833 case XRAM_RSP_WRITE_DIRTY: // send a write request to IXR_CMD FSM 4650 4834 { 4651 if(!r_xram_rsp_to_ixr_cmd_req.read() and !r_xram_rsp_to_ixr_cmd_inval_ncc_pending.read()) 4652 { 4653 r_xram_rsp_to_ixr_cmd_req = true; 4654 r_xram_rsp_to_ixr_cmd_nline = r_xram_rsp_victim_nline.read(); 4655 r_xram_rsp_to_ixr_cmd_trdid = r_xram_rsp_trt_index.read(); 4656 for(size_t i=0; i<m_words ; i++) 4657 { 4658 r_xram_rsp_to_ixr_cmd_data[i] = r_xram_rsp_victim_data[i]; 4659 std::cout << "data L2 = " << std::hex << r_xram_rsp_victim_data[i] << std::dec << std::endl; 4660 } 4661 m_cpt_write_dirty++; 4835 if ( not r_xram_rsp_to_ixr_cmd_req.read() ) 4836 { 4837 r_xram_rsp_to_ixr_cmd_req = true; 4838 r_xram_rsp_to_ixr_cmd_index = r_xram_rsp_trt_index.read(); 4839 4840 m_cpt_write_dirty++; 4662 4841 4663 if ((!r_xram_rsp_victim_coherent.read()) and (r_xram_rsp_victim_count.read() == 1)) //if NCC, we save the data in case of not dirty L1 4664 { 4665 r_xram_rsp_to_ixr_cmd_req = false; 4666 r_xram_rsp_to_ixr_cmd_inval_ncc_pending = true; 4667 r_xram_rsp_fsm = XRAM_RSP_IDLE; 4668 break; 4669 } 4670 4671 bool multi_req = !r_xram_rsp_victim_is_cnt.read() and r_xram_rsp_victim_inval.read(); 4672 bool not_last_multi_req = multi_req and (r_xram_rsp_victim_count.read() != 1); 4673 4674 if(not_last_multi_req) r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ; 4675 else r_xram_rsp_fsm = XRAM_RSP_IDLE; 4842 bool multi_req = not r_xram_rsp_victim_is_cnt.read() and 4843 r_xram_rsp_victim_inval.read(); 4844 bool not_last_multi_req = multi_req and (r_xram_rsp_victim_count.read() != 1); 4845 4846 if(not_last_multi_req) r_xram_rsp_fsm = XRAM_RSP_HEAP_REQ; 4847 else r_xram_rsp_fsm = XRAM_RSP_IDLE; 4676 4848 4677 4849 #if DEBUG_MEMC_XRAM_RSP … … 4681 4853 << " / victim line = " << r_xram_rsp_victim_nline.read() << std::endl; 4682 4854 #endif 4683 }4684 break;4855 } 4856 break; 4685 4857 } 4686 4858 ///////////////////////// … … 4711 4883 4712 4884 xram_rsp_to_cc_send_fifo_srcid = entry.owner.srcid; 4713 #if L1_MULTI_CACHE4714 xram_rsp_to_cc_send_fifo_cache_id = entry.owner.cache_id;4715 #endif4716 4885 xram_rsp_to_cc_send_fifo_inst = entry.owner.inst; 4717 4886 xram_rsp_to_cc_send_fifo_put = true; … … 4757 4926 HeapEntry last_entry; 4758 4927 last_entry.owner.srcid = 0; 4759 #if L1_MULTI_CACHE4760 last_entry.owner.cache_id = 0;4761 #endif4762 4928 last_entry.owner.inst = false; 4763 4929 if(m_heap.is_full()) … … 4783 4949 break; 4784 4950 } 4785 // 4951 ///////////////////////// 4786 4952 case XRAM_RSP_ERROR_ERASE: // erase TRT entry in case of error 4787 4953 { … … 4873 5039 r_cleanup_contains_data = false; 4874 5040 4875 if(srcid >= m_initiators) 4876 { 4877 std::cout 4878 << "VCI_MEM_CACHE ERROR " << name() 4879 << " CLEANUP_IDLE state" << std::endl 4880 << "illegal srcid for cleanup request" << std::endl; 4881 4882 exit(0); 4883 } 5041 assert( (srcid < m_initiators) and 5042 "MEMC ERROR in CLEANUP_IDLE state : illegal SRCID value"); 4884 5043 4885 5044 m_cpt_cleanup++; … … 5026 5185 r_cleanup_copy = entry.owner.srcid; 5027 5186 r_cleanup_copy_inst = entry.owner.inst; 5028 #if L1_MULTI_CACHE5029 r_cleanup_copy_cache = entry.owner.cache_id;5030 #endif5031 5187 5032 5188 //RWT … … 5034 5190 m_cache_data.read_line(way, set, r_cleanup_old_data); 5035 5191 r_cleanup_coherent = entry.cache_coherent; 5036 5037 5038 5192 5039 5193 if(entry.valid) // hit : the copy must be cleared … … 5101 5255 bool match_srcid = (r_cleanup_copy.read() == r_cleanup_srcid.read()); 5102 5256 5103 #if L1_MULTI_CACHE5104 match_srcid &= (r_cleanup_copy_cache.read() == r_cleanup_pktid.read());5105 #endif5106 5107 5257 bool match_inst = (r_cleanup_copy_inst.read() == r_cleanup_inst.read()); 5108 5258 bool match = match_srcid and match_inst; … … 5149 5299 entry.owner.srcid = r_read_to_cleanup_srcid.read(); 5150 5300 entry.owner.inst = 0; 5151 #if L1_MULTI_CACHE5152 entry.owner.cache_id = r_cleanup_copy_cache.read();5153 #endif5154 5301 } 5155 5302 else … … 5158 5305 entry.owner.srcid = r_cleanup_copy.read(); 5159 5306 entry.owner.inst = r_cleanup_copy_inst.read(); 5160 #if L1_MULTI_CACHE5161 entry.owner.cache_id = r_cleanup_copy_cache.read();5162 #endif5163 5307 } 5164 5308 if (r_read_to_cleanup_is_ll.read()) … … 5172 5316 entry.owner.srcid = 0; 5173 5317 entry.owner.inst = 0; 5174 #if L1_MULTI_CACHE 5175 entry.owner.cache_id = 0; 5176 #endif 5177 } 5178 5318 } 5179 5319 5180 5320 if (r_cleanup_contains_data.read()) … … 5184 5324 m_cache_data.write(way, set, word, r_cleanup_data[word].read(), 0xF); 5185 5325 } 5186 m_llsc_table.sw(r_cleanup_nline.read() );5326 m_llsc_table.sw(r_cleanup_nline.read(), 0 , m_words - 1); 5187 5327 //m_llsc_table.sw(r_cleanup_nline.read()*m_words*4); 5188 5328 } 5189 5329 5190 5191 5330 m_cache_directory.write(set, way, entry); 5192 5193 5331 5194 5332 /*RWT*/ … … 5346 5484 // 1. the matching copy is directly in the directory 5347 5485 // 2. the matching copy is the first copy in the heap 5348 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) 5349 { 5350 std::cout 5351 << "VCI_MEM_CACHE ERROR " << name() 5352 << " CLEANUP_HEAP_LOCK state" 5353 << " bad HEAP allocation" << std::endl; 5354 5355 exit(0); 5356 } 5486 assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and 5487 "MEMC ERROR in CLEANUP_HEAP_LOCK state: bad HEAP allocation"); 5357 5488 5358 5489 size_t way = r_cleanup_way.read(); … … 5376 5507 r_cleanup_prev_inst = heap_entry.owner.inst; 5377 5508 5378 #if L1_MULTI_CACHE 5379 match_dir = match_dir and(r_cleanup_copy_cache.read() == r_cleanup_pktid.read()); 5380 match_heap = match_heap and(heap_entry.owner.cache_id == r_cleanup_pktid.read()); 5381 r_cleanup_prev_cache_id = heap_entry.owner.cache_id; 5382 #endif 5383 5384 if(not match_dir and not match_heap and last) 5385 { 5386 std::cout 5387 << "VCI_MEM_CACHE ERROR " << name() 5388 << " CLEANUP_HEAP_LOCK state" 5389 << " hit but copy not found" 5390 << std::endl; 5391 /**/ 5392 std::cout 5393 << "r_cleanup_srcid = " << r_cleanup_srcid.read() 5394 << " / r_cleanup_inst = " << r_cleanup_inst.read() << std::endl 5395 << "r_cleanup_copy = " << r_cleanup_copy.read() 5396 << " / r_cleanup_copy_inst = " << r_cleanup_copy_inst.read() << std::endl 5397 << "heap_entry.owner.srcid = " << heap_entry.owner.srcid 5398 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl 5399 /**/ 5400 << "nline = " << r_cleanup_nline << std::endl; 5401 exit(0); 5402 } 5403 5404 if(match_dir and match_heap) 5405 { 5406 std::cout 5407 << "VCI_MEM_CACHE ERROR " << name() 5408 << " CLEANUP_HEAP_LOCK state" 5409 << " two copies matching the cleanup owner id" 5410 << std::endl; 5411 /**/ 5412 std::cout 5413 << "r_cleanup_srcid = " << r_cleanup_srcid.read() 5414 << " / r_cleanup_inst = " << r_cleanup_inst.read() << std::endl 5415 << "r_cleanup_copy = " << r_cleanup_copy.read() 5416 << " / r_cleanup_copy_inst = " << r_cleanup_copy_inst.read() << std::endl 5417 << "heap_entry.owner.srcid = " << heap_entry.owner.srcid 5418 << " / heap_entry.owner.inst = " << heap_entry.owner.inst << std::endl 5419 /**/ 5420 << "nline = " << r_cleanup_nline << std::endl; 5421 exit(0); 5422 } 5509 assert( (not last or match_dir or match_heap) and 5510 "MEMC ERROR in CLEANUP_HEAP_LOCK state: hit but no copy found"); 5511 5512 assert( (not match_dir or not match_heap) and 5513 "MEMC ERROR in CLEANUP_HEAP_LOCK state: two matching copies found"); 5423 5514 5424 5515 DirectoryEntry dir_entry; … … 5439 5530 dir_entry.owner.srcid = heap_entry.owner.srcid; 5440 5531 dir_entry.owner.inst = heap_entry.owner.inst; 5441 5442 #if L1_MULTI_CACHE5443 dir_entry.owner.cache_id = heap_entry.owner.cache_id;5444 #endif5445 5446 5532 r_cleanup_next_ptr = r_cleanup_ptr.read(); 5447 5533 r_cleanup_fsm = CLEANUP_HEAP_FREE; … … 5456 5542 dir_entry.owner.srcid = r_cleanup_copy.read(); 5457 5543 dir_entry.owner.inst = r_cleanup_copy_inst.read(); 5458 5459 #if L1_MULTI_CACHE5460 dir_entry.owner.cache_id = r_cleanup_copy_cache.read();5461 #endif5462 5463 5544 r_cleanup_next_ptr = r_cleanup_ptr.read(); 5464 5545 r_cleanup_fsm = CLEANUP_HEAP_FREE; … … 5472 5553 dir_entry.owner.srcid = r_cleanup_copy.read(); 5473 5554 dir_entry.owner.inst = r_cleanup_copy_inst.read(); 5474 5475 #if L1_MULTI_CACHE5476 dir_entry.owner.cache_id = r_cleanup_copy_cache.read();5477 #endif5478 5479 5555 r_cleanup_next_ptr = heap_entry.next; 5480 5556 r_cleanup_fsm = CLEANUP_HEAP_SEARCH; … … 5482 5558 5483 5559 m_cache_directory.write(set,way,dir_entry); 5484 5485 5560 5486 5561 #if DEBUG_MEMC_CLEANUP … … 5508 5583 // This state is handling the case where the copy 5509 5584 // is in the heap, but is not the first in the linked list 5510 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) 5511 { 5512 std::cout 5513 << "VCI_MEM_CACHE ERROR " << name() 5514 << " CLEANUP_HEAP_SEARCH state" 5515 << " bad HEAP allocation" << std::endl; 5516 5517 exit(0); 5518 } 5585 assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and 5586 "MEMC ERROR in CLEANUP_HEAP_LOCK state: bad HEAP allocation"); 5519 5587 5520 5588 HeapEntry heap_entry = m_heap.read(r_cleanup_next_ptr.read()); … … 5525 5593 bool match_heap = match_heap_srcid and match_heap_inst; 5526 5594 5527 #if L1_MULTI_CACHE 5528 match_heap = match_heap and(heap_entry.owner.cache_id == r_cleanup_pktid.read()); 5529 #endif 5530 5531 if(not match_heap and last) 5532 { 5533 std::cout 5534 << "VCI_MEM_CACHE_ERROR " << name() 5535 << " CLEANUP_HEAP_SEARCH state" 5536 << " cleanup on valid line but copy not found" 5537 << std::endl; 5538 5539 exit(0); 5540 } 5541 5542 // the matching copy must be removed 5595 assert( (not last or match_heap) and 5596 "MEMC ERROR in CLEANUP_HEAP_SEARCH state: no copy found"); 5597 5598 // the matching copy must be removed 5543 5599 if(match_heap) 5544 5600 { … … 5554 5610 r_cleanup_prev_inst = heap_entry.owner.inst; 5555 5611 r_cleanup_next_ptr = heap_entry.next; 5556 5557 5612 r_cleanup_fsm = CLEANUP_HEAP_SEARCH; 5558 5559 #if L1_MULTI_CACHE5560 r_cleanup_prev_cache_id = heap_entry.owner.cache_id;5561 #endif5562 5613 } 5563 5614 … … 5595 5646 case CLEANUP_HEAP_CLEAN: // remove a copy in the linked list 5596 5647 { 5597 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) 5598 { 5599 std::cout 5600 << "VCI_MEM_CACHE ERROR " << name() 5601 << " CLEANUP_HEAP_CLEAN state" 5602 << "Bad HEAP allocation" << std::endl; 5603 5604 exit(0); 5605 } 5648 assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and 5649 "MEMC ERROR in CLEANUP_HEAP_LOCK state: bad HEAP allocation"); 5606 5650 5607 5651 HeapEntry heap_entry; 5608 5652 heap_entry.owner.srcid = r_cleanup_prev_srcid.read(); 5609 5653 heap_entry.owner.inst = r_cleanup_prev_inst.read(); 5610 5611 #if L1_MULTI_CACHE5612 heap_entry.owner.cache_id = r_cleanup_prev_cache_id.read();5613 #endif5614 5615 5654 bool last = (r_cleanup_next_ptr.read() == r_cleanup_ptr.read()); 5616 5655 … … 5641 5680 // and becomes the head of the list of free entries 5642 5681 { 5643 if(r_alloc_heap_fsm.read() != ALLOC_HEAP_CLEANUP) 5644 { 5645 std::cout 5646 << "VCI_MEM_CACHE ERROR " << name() 5647 << " CLEANUP_HEAP_CLEAN state" << std::endl 5648 << "Bad HEAP allocation" << std::endl; 5649 5650 exit(0); 5651 } 5652 5682 assert( (r_alloc_heap_fsm.read() == ALLOC_HEAP_CLEANUP) and 5683 "MEMC ERROR in CLEANUP_HEAP_LOCK state: bad HEAP allocation"); 5653 5684 HeapEntry heap_entry; 5654 5685 heap_entry.owner.srcid = 0; 5655 5686 heap_entry.owner.inst = false; 5656 5657 #if L1_MULTI_CACHE5658 heap_entry.owner.cache_id = 0;5659 #endif5660 5687 5661 5688 if(m_heap.is_full()) … … 5706 5733 #endif 5707 5734 m_cpt_cleanup_fsm_n_upt_lock++; 5708 break; 5709 } 5710 5711 // pending inval 5712 r_cleanup_write_srcid = m_ivt.srcid(index); 5713 r_cleanup_write_trdid = m_ivt.trdid(index); 5714 r_cleanup_write_pktid = m_ivt.pktid(index); 5715 r_cleanup_need_rsp = m_ivt.need_rsp(index); 5716 r_cleanup_need_ack = m_ivt.need_ack(index); 5717 r_cleanup_index = index; 5718 5719 r_cleanup_fsm = CLEANUP_IVT_DECREMENT; 5720 5735 } 5736 else 5737 { 5738 // pending inval 5739 r_cleanup_write_srcid = m_ivt.srcid(index); 5740 r_cleanup_write_trdid = m_ivt.trdid(index); 5741 r_cleanup_write_pktid = m_ivt.pktid(index); 5742 r_cleanup_need_rsp = m_ivt.need_rsp(index); 5743 r_cleanup_need_ack = m_ivt.need_ack(index); 5744 r_cleanup_index = index; 5745 r_cleanup_fsm = CLEANUP_IVT_DECREMENT; 5721 5746 #if DEBUG_MEMC_CLEANUP 5722 5747 if(m_debug) … … 5727 5752 << " / ivt_entry = " << index << std::endl; 5728 5753 #endif 5754 } 5729 5755 break; 5730 5756 } … … 5732 5758 case CLEANUP_IVT_DECREMENT: // decrement response counter in IVT matching entry 5733 5759 { 5734 if(r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP) 5735 { 5736 std::cout 5737 << "VCI_MEM_CACHE ERROR " << name() 5738 << " CLEANUP_IVT_DECREMENT state" << std::endl 5739 << "Bad IVT allocation" 5740 << std::endl; 5741 5742 exit(0); 5743 } 5760 assert( (r_alloc_ivt_fsm.read() == ALLOC_IVT_CLEANUP) and 5761 "MEMC ERROR in CLEANUP_IVT_DECREMENT state: Bad IVT allocation"); 5744 5762 5745 5763 size_t count = 0; 5746 5764 m_ivt.decrement(r_cleanup_index.read(), count); 5747 5748 5765 5749 5766 if(count == 0) // multi inval transaction completed … … 5775 5792 case CLEANUP_IVT_CLEAR: // Clear IVT entry 5776 5793 { 5777 if(r_alloc_ivt_fsm.read() != ALLOC_IVT_CLEANUP) 5778 { 5779 std::cout 5780 << "VCI_MEM_CACHE ERROR " << name() 5781 << " CLEANUP_IVT_CLEAR state" << std::endl 5782 << "Bad IVT allocation" 5783 << std::endl; 5784 5785 exit(0); 5786 } 5794 assert( (r_alloc_ivt_fsm.read() == ALLOC_IVT_CLEANUP) and 5795 "MEMC ERROR in CLEANUP_IVT_CLEAR state : bad IVT allocation"); 5787 5796 5788 5797 m_ivt.clear(r_cleanup_index.read()); 5789 5798 5799 if ( r_cleanup_need_ack.read() ) 5800 { 5801 assert( (r_config_rsp_lines.read() > 0) and 5802 "MEMC ERROR in CLEANUP_IVT_CLEAR state"); 5803 5804 r_config_rsp_lines = r_config_rsp_lines.read() - 1; 5805 } 5806 5790 5807 if ( r_cleanup_need_rsp.read() ) r_cleanup_fsm = CLEANUP_WRITE_RSP; 5791 else if ( r_cleanup_need_ack.read() ) r_cleanup_fsm = CLEANUP_CONFIG_ACK;5792 5808 else if ( r_cleanup_ncc.read() ) r_cleanup_fsm = CLEANUP_IXR_REQ; 5793 5809 else r_cleanup_fsm = CLEANUP_SEND_CLACK; … … 5799 5815 << " IVT_index = " << r_cleanup_index.read() << std::endl; 5800 5816 #endif 5801 break;5802 }5817 break; 5818 } 5803 5819 /////////////////////// 5804 5820 case CLEANUP_WRITE_RSP: // response to a previous write on the direct network … … 5812 5828 r_cleanup_to_tgt_rsp_trdid = r_cleanup_write_trdid.read(); 5813 5829 r_cleanup_to_tgt_rsp_pktid = r_cleanup_write_pktid.read(); 5814 r_cleanup_to_tgt_rsp_type = true; 5830 r_cleanup_to_tgt_rsp_type = true; 5815 5831 5816 5832 if (r_cleanup_ncc.read()) … … 5833 5849 break; 5834 5850 } 5835 ////////////////////////5836 case CLEANUP_CONFIG_ACK: // signals inval completion to CONFIG FSM5837 // wait if pending request5838 {5839 if ( r_cleanup_to_config_ack.read() ) break;5840 5841 r_cleanup_to_config_ack = true;5842 r_cleanup_fsm = CLEANUP_SEND_CLACK;5843 5844 #if DEBUG_MEMC_CLEANUP5845 if(m_debug)5846 std::cout << " <MEMC " << name() << " CLEANUP_CONFIG_ACK>"5847 << " Acknowledge broacast inval completion" << std::endl;5848 #endif5849 break;5850 }5851 5852 5851 ///////////////////////// 5853 5852 case CLEANUP_IXR_REQ: 5854 5853 { 5855 5856 5854 //Send a request to the ixr to write the data in the XRAM using the prereserved TRT entry 5857 5855 if (r_alloc_trt_fsm.read() == ALLOC_TRT_CLEANUP) 5858 5856 { 5859 if( !r_cleanup_to_ixr_cmd_req.read())5857 if( not r_cleanup_to_ixr_cmd_req.read()) 5860 5858 { 5861 5859 size_t index = 0; … … 5864 5862 assert (hit and "CLEANUP_IXR_REQ found no matching entry in TRT"); 5865 5863 5866 r_cleanup_to_ixr_cmd_req = true; 5867 5868 for(size_t i = 0; i < m_words; i++){ 5869 r_cleanup_to_ixr_cmd_data[i] = r_cleanup_data[i]; 5864 r_cleanup_to_ixr_cmd_req = true; 5865 5866 if (r_cleanup_contains_data.read()) 5867 { 5868 std::vector<data_t> data_vector; 5869 data_vector.clear(); 5870 5871 for(size_t i=0; i<m_words; i++) 5872 { 5873 data_vector.push_back(r_cleanup_data[i]); 5870 5874 } 5871 5875 5872 r_cleanup_to_ixr_cmd_srcid = r_cleanup_srcid.read(); 5873 r_cleanup_to_ixr_cmd_trdid = index; 5874 r_cleanup_to_ixr_cmd_pktid = r_cleanup_pktid.read(); 5875 r_cleanup_to_ixr_cmd_nline = r_cleanup_nline.read(); 5876 r_cleanup_to_ixr_cmd_ncc_l1_dirty = r_cleanup_contains_data.read(); 5877 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5876 m_trt.set(index, 5877 false, // write to XRAM 5878 r_cleanup_nline.read(), // line index 5879 0, 5880 0, 5881 0, 5882 false, 5883 0, 5884 0, 5885 std::vector<be_t> (m_words,0), 5886 data_vector); 5887 } 5888 //std::cout << "cleanup with a non coherent ligne in trt index = " << index << std::endl; 5889 r_cleanup_to_ixr_cmd_srcid = r_cleanup_srcid.read(); 5890 r_cleanup_to_ixr_cmd_index = index; 5891 r_cleanup_to_ixr_cmd_pktid = r_cleanup_pktid.read(); 5892 r_cleanup_to_ixr_cmd_nline = r_cleanup_nline.read(); 5893 //r_cleanup_to_ixr_cmd_l1_dirty_ncc = r_cleanup_contains_data.read(); 5894 r_cleanup_fsm = CLEANUP_SEND_CLACK; 5878 5895 #if DEBUG_MEMC_CLEANUP 5879 5896 if(m_debug) 5880 5897 { 5898 m_trt.print(0); 5881 5899 std::cout 5882 5900 << " <MEMC " << name() … … 5993 6011 r_cas_wdata = m_cmd_cas_wdata_fifo.read(); 5994 6012 5995 if(r_cas_cpt.read() >3) // more than 4 flits... 5996 { 5997 std::cout << "VCI_MEM_CACHE ERROR in CAS_IDLE state : illegal CAS command" 5998 << std::endl; 5999 exit(0); 6000 } 6001 6002 if(r_cas_cpt.read() ==2) 6013 assert( (r_cas_cpt.read() <= 3) and // no more than 4 flits... 6014 "MEMC ERROR in CAS_IDLE state: illegal CAS command"); 6015 6016 if(r_cas_cpt.read() ==2) 6003 6017 r_cas_wdata = m_cmd_cas_wdata_fifo.read(); 6004 6018 … … 6034 6048 case CAS_DIR_LOCK: // Read the directory 6035 6049 { 6036 if(r_alloc_dir_fsm.read() == ALLOC_DIR_CAS) 6037 { 6050 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS) and 6051 "MEMC ERROR in CAS_DIR_LOCK: Bad DIR allocation"); 6052 6038 6053 size_t way = 0; 6039 6054 DirectoryEntry entry(m_cache_directory.read(m_cmd_cas_addr_fifo.read(), way)); … … 6045 6060 r_cas_way = way; 6046 6061 r_cas_copy = entry.owner.srcid; 6047 #if L1_MULTI_CACHE6048 r_cas_copy_cache = entry.owner.cache_id;6049 #endif6050 6062 r_cas_copy_inst = entry.owner.inst; 6051 6063 r_cas_ptr = entry.ptr; … … 6065 6077 } 6066 6078 #endif 6067 } 6068 else 6069 { 6070 std::cout 6071 << "VCI_MEM_CACHE ERROR " << name() 6072 << " CAS_DIR_LOCK state" << std::endl 6073 << "Bad DIR allocation" << std::endl; 6074 6075 exit(0); 6076 } 6077 6078 break; 6079 break; 6079 6080 } 6080 6081 ///////////////////// … … 6094 6095 entry.tag = r_cas_tag.read(); 6095 6096 entry.owner.srcid = r_cas_copy.read(); 6096 #if L1_MULTI_CACHE6097 entry.owner.cache_id = r_cas_copy_cache.read();6098 #endif6099 6097 entry.owner.inst = r_cas_copy_inst.read(); 6100 6098 entry.count = r_cas_count.read(); … … 6156 6154 { 6157 6155 // The CAS is a success => sw access to the llsc_global_table 6158 // BUG LLSC6159 addr_t nline = m_nline[(addr_t)(m_cmd_cas_addr_fifo.read())];6160 m_llsc_table.sw(nline);6161 6156 //m_llsc_table.sw(m_cmd_cas_addr_fifo.read()); 6162 6157 /**//*std::cout << "MEMCACHE : from proc " << m_cmd_cas_srcid_fifo.read() 6163 6158 << " | @ " << std::hex << m_cmd_cas_addr_fifo.read() 6164 6159 << " | WRITE (cas triggered)" << std::endl;*/ 6160 m_llsc_table.sw(m_nline[(addr_t)m_cmd_cas_addr_fifo.read()],m_x[(addr_t)(m_cmd_cas_addr_fifo.read())],m_x[(addr_t)(m_cmd_cas_addr_fifo.read())]); 6165 6161 6166 6162 // test coherence request … … 6170 6166 { 6171 6167 r_cas_fsm = CAS_BC_TRT_LOCK; // broadcast invalidate required 6168 #if DEBUG_MEMC_CAS 6169 if(m_debug) 6170 std::cout << " <MEMC " << name() << " CAS_DIR_HIT_WRITE>" 6171 << " Broacast Inval required" 6172 << " / copies = " << r_cas_count.read() << std::endl; 6173 #endif 6174 6172 6175 } 6173 6176 else if(!r_cas_to_cc_send_multi_req.read() and … … 6175 6178 { 6176 6179 r_cas_fsm = CAS_UPT_LOCK; // multi update required 6180 #if DEBUG_MEMC_CAS 6181 if(m_debug) 6182 std::cout << " <MEMC " << name() << " CAS_DIR_HIT_WRITE>" 6183 << " Multi Inval required" 6184 << " / copies = " << r_cas_count.read() << std::endl; 6185 #endif 6177 6186 } 6178 6187 else 6179 6188 { 6180 6189 r_cas_fsm = CAS_WAIT; 6190 #if DEBUG_MEMC_CAS 6191 if(m_debug) 6192 std::cout << " <MEMC " << name() << " CAS_DIR_HIT_WRITE>" 6193 << " CC_SEND FSM busy: release all locks and retry" << std::endl; 6194 #endif 6181 6195 } 6182 6196 } … … 6193 6207 6194 6208 r_cas_fsm = CAS_RSP_SUCCESS; 6195 6196 // monitor6197 if(m_monitor_ok)6198 {6199 addr_t address = m_cmd_cas_addr_fifo.read();6200 check_monitor( address, r_cas_wdata.read(), false);6201 6202 if(r_cas_cpt.read() == 4)6203 check_monitor( address+4, m_cmd_cas_wdata_fifo.read(), false);6204 }6205 6209 6206 6210 #if DEBUG_MEMC_CAS … … 6256 6260 r_cas_fsm = CAS_UPT_HEAP_LOCK; 6257 6261 6258 // monitor6259 if(m_monitor_ok)6260 {6261 addr_t address = m_cmd_cas_addr_fifo.read();6262 check_monitor( address, r_cas_wdata.read(), false);6263 6264 if(r_cas_cpt.read() ==4)6265 check_monitor( address+4, m_cmd_cas_wdata_fifo.read(), false);6266 }6267 6262 } 6268 6263 else // releases the locks protecting UPT and DIR UPT full … … 6350 6345 cas_to_cc_send_fifo_inst = r_cas_copy_inst.read(); 6351 6346 cas_to_cc_send_fifo_srcid = r_cas_copy.read(); 6352 #if L1_MULTI_CACHE6353 cas_to_cc_send_fifo_cache_id= r_cas_copy_cache.read();6354 #endif6355 6347 if(r_cas_count.read() == 1) // one single copy 6356 6348 { … … 6387 6379 HeapEntry entry = m_heap.read(r_cas_ptr.read()); 6388 6380 cas_to_cc_send_fifo_srcid = entry.owner.srcid; 6389 #if L1_MULTI_CACHE6390 cas_to_cc_send_fifo_cache_id = entry.owner.cache_id;6391 #endif6392 6381 cas_to_cc_send_fifo_inst = entry.owner.inst; 6393 6382 cas_to_cc_send_fifo_put = true; … … 6421 6410 case CAS_BC_TRT_LOCK: // check the TRT to register a PUT transaction 6422 6411 { 6423 if(r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) 6424 { 6425 if(!r_cas_to_ixr_cmd_req) // we can transfer the request to IXR_CMD FSM 6426 { 6427 // fill the data buffer 6428 size_t word = m_x[(addr_t)(m_cmd_cas_addr_fifo.read())]; 6429 for(size_t i = 0; i<m_words; i++) 6430 { 6431 if(i == word) 6412 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS) and 6413 "MEMC ERROR in CAS_BC_TRT_LOCK state: Bas DIR allocation"); 6414 6415 if(r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) 6416 { 6417 size_t wok_index = 0; 6418 bool wok = !m_trt.full(wok_index); 6419 if( wok ) 6432 6420 { 6433 r_cas_to_ixr_cmd_data[i] = r_cas_wdata.read(); 6434 } 6435 else if((i == word+1) and (r_cas_cpt.read() == 4)) // 64 bit CAS 6436 { 6437 r_cas_to_ixr_cmd_data[i] = m_cmd_cas_wdata_fifo.read(); 6421 r_cas_trt_index = wok_index; 6422 r_cas_fsm = CAS_BC_IVT_LOCK; 6438 6423 } 6439 6424 else 6440 6425 { 6441 r_cas_to_ixr_cmd_data[i] = r_cas_data[i].read(); 6426 r_cas_fsm = CAS_WAIT; 6427 m_cpt_cas_fsm_n_trt_lock++; 6442 6428 } 6443 } 6444 size_t wok_index = 0; 6445 bool wok = !m_trt.full(wok_index); 6446 if(wok) 6447 { 6448 r_cas_trt_index = wok_index; 6449 r_cas_fsm = CAS_BC_IVT_LOCK; 6450 } 6451 else 6452 { 6453 r_cas_fsm = CAS_WAIT; 6454 } 6455 } 6456 else 6457 { 6458 r_cas_fsm = CAS_WAIT; 6459 } 6460 m_cpt_cas_fsm_n_trt_lock++; 6461 } 6462 6429 6430 #if DEBUG_MEMC_CAS 6431 if(m_debug) 6432 std::cout << " <MEMC " << name() << " CAS_BC_TRT_LOCK> Check TRT" 6433 << " : wok = " << wok << " / index = " << wok_index << std::endl; 6434 #endif 6435 } 6463 6436 m_cpt_cas_fsm_trt_lock++; 6464 6437 … … 6502 6475 m_cache_data.write(way, set, word+1, m_cmd_cas_wdata_fifo.read()); 6503 6476 6504 // monitor6505 if(m_monitor_ok)6506 {6507 addr_t address = m_cmd_cas_addr_fifo.read();6508 check_monitor( address, r_cas_wdata.read(), false);6509 6510 if(r_cas_cpt.read() ==4)6511 check_monitor( address+4, m_cmd_cas_wdata_fifo.read(), false);6512 }6513 6477 r_cas_upt_index = index; 6514 6478 r_cas_fsm = CAS_BC_DIR_INVAL; … … 6537 6501 case CAS_BC_DIR_INVAL: // Register the PUT transaction in TRT, and inval the DIR entry 6538 6502 { 6539 if((r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) and 6540 (r_alloc_ivt_fsm.read() == ALLOC_IVT_CAS) and 6541 (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS)) 6542 { 6543 // set TRT 6544 m_trt.set(r_cas_trt_index.read(), 6545 false, // PUT request to XRAM 6546 m_nline[(addr_t)(m_cmd_cas_addr_fifo.read())], 6547 0, 6548 0, 6549 0, 6550 false, // not a processor read 6551 0, 6552 0, 6553 std::vector<be_t> (m_words,0), 6554 std::vector<data_t> (m_words,0)); 6503 assert( (r_alloc_dir_fsm.read() == ALLOC_DIR_CAS) and 6504 "MEMC ERROR in CAS_BC_DIR_INVAL state: Bad DIR allocation"); 6505 6506 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) and 6507 "MEMC ERROR in CAS_BC_DIR_INVAL state: Bad TRT allocation"); 6508 6509 assert( (r_alloc_ivt_fsm.read() == ALLOC_IVT_CAS) and 6510 "MEMC ERROR in CAS_BC_DIR_INVAL state: Bad IVT allocation"); 6511 6512 std::vector<data_t> data_vector; 6513 data_vector.clear(); 6514 size_t word = m_x[(addr_t)(m_cmd_cas_addr_fifo.read())]; 6515 for(size_t i=0; i<m_words; i++) 6516 { 6517 if(i == word) // first modified word 6518 data_vector.push_back( r_cas_wdata.read() ); 6519 else if((i == word+1) and (r_cas_cpt.read() == 4)) // second modified word 6520 data_vector.push_back( m_cmd_cas_wdata_fifo.read() ); 6521 else // unmodified words 6522 data_vector.push_back( r_cas_data[i].read() ); 6523 } 6524 m_trt.set( r_cas_trt_index.read(), 6525 false, // PUT request 6526 m_nline[(addr_t)(m_cmd_cas_addr_fifo.read())], 6527 0, 6528 0, 6529 0, 6530 false, // not a processor read 6531 0, 6532 0, 6533 std::vector<be_t> (m_words,0), 6534 data_vector ); 6555 6535 6556 6536 // invalidate directory entry … … 6558 6538 entry.valid = false; 6559 6539 entry.dirty = false; 6560 entry.tag = 0;6540 entry.tag = 0; 6561 6541 entry.is_cnt = false; 6562 6542 entry.lock = false; 6563 6543 entry.count = 0; 6564 6544 entry.owner.srcid = 0; 6565 #if L1_MULTI_CACHE6566 entry.owner.cache_id= 0;6567 #endif6568 6545 entry.owner.inst = false; 6569 6546 entry.ptr = 0; … … 6576 6553 #if DEBUG_MEMC_CAS 6577 6554 if(m_debug) 6578 std::cout << " <MEMC " << name() 6579 << " CAS_BC_DIR_INVAL> Register the PUT in TRT and invalidate DIR entry" 6580 << " / nline = " << std::hex << m_nline[(addr_t)(m_cmd_cas_addr_fifo.read())] 6581 << " / set = " << std::dec << set << " / way = " << way << std::endl; 6582 #endif 6583 } 6584 else 6585 { 6586 assert(false and "LOCK ERROR in CAS_FSM, STATE = CAS_BC_DIR_INVAL"); 6587 } 6555 m_trt.print(0); 6556 std::cout << " <MEMC " << name() << " CAS_BC_DIR_INVAL> Inval DIR & register in TRT:" 6557 << " address = " << m_cmd_cas_addr_fifo.read() << std::endl; 6558 #endif 6588 6559 break; 6589 6560 } … … 6591 6562 case CAS_BC_CC_SEND: // Request the broadcast inval to CC_SEND FSM 6592 6563 { 6593 if( !r_cas_to_cc_send_multi_req.read() and6594 !r_cas_to_cc_send_brdcast_req.read())6564 if( not r_cas_to_cc_send_multi_req.read() and 6565 not r_cas_to_cc_send_brdcast_req.read()) 6595 6566 { 6596 6567 r_cas_to_cc_send_multi_req = false; … … 6608 6579 case CAS_BC_XRAM_REQ: // request the IXR FSM to start a put transaction 6609 6580 { 6610 if( !r_cas_to_ixr_cmd_req)6581 if( not r_cas_to_ixr_cmd_req.read() ) 6611 6582 { 6612 6583 r_cas_to_ixr_cmd_req = true; 6613 r_cas_to_ixr_cmd_write = true; 6614 r_cas_to_ixr_cmd_nline = m_nline[(addr_t)(m_cmd_cas_addr_fifo.read())]; 6615 r_cas_to_ixr_cmd_trdid = r_cas_trt_index.read(); 6584 r_cas_to_ixr_cmd_put = true; 6585 r_cas_to_ixr_cmd_index = r_cas_trt_index.read(); 6616 6586 r_cas_fsm = CAS_IDLE; 6617 6587 cmd_cas_fifo_get = true; … … 6622 6592 std::cout << " <MEMC " << name() 6623 6593 << " CAS_BC_XRAM_REQ> Request a PUT transaction to IXR_CMD FSM" << std::hex 6624 << " / nline = " << m_nline[(addr_t) m_cmd_cas_addr_fifo.read()]6594 << " / address = " << (addr_t) m_cmd_cas_addr_fifo.read() 6625 6595 << " / trt_index = " << r_cas_trt_index.read() << std::endl; 6626 6596 #endif 6627 6597 } 6628 else 6629 { 6630 std::cout << "ERROR in MEM_CACHE / CAS_BC_XRAM_REQ state" 6631 << " : request should not have been previously set" << std::endl; 6632 } 6598 6633 6599 break; 6634 6600 } … … 6636 6602 case CAS_RSP_FAIL: // request TGT_RSP FSM to send a failure response 6637 6603 { 6638 if( !r_cas_to_tgt_rsp_req)6639 { 6640 cmd_cas_fifo_get = true;6604 if( not r_cas_to_tgt_rsp_req.read() ) 6605 { 6606 cmd_cas_fifo_get = true; 6641 6607 r_cas_cpt = 0; 6642 r_cas_to_tgt_rsp_req = true;6608 r_cas_to_tgt_rsp_req = true; 6643 6609 r_cas_to_tgt_rsp_data = 1; 6644 6610 r_cas_to_tgt_rsp_srcid = m_cmd_cas_srcid_fifo.read(); … … 6658 6624 case CAS_RSP_SUCCESS: // request TGT_RSP FSM to send a success response 6659 6625 { 6660 if( !r_cas_to_tgt_rsp_req)6626 if( not r_cas_to_tgt_rsp_req.read() ) 6661 6627 { 6662 6628 cmd_cas_fifo_get = true; … … 6687 6653 bool hit_write = m_trt.hit_write( 6688 6654 m_nline[(addr_t) m_cmd_cas_addr_fifo.read()]); 6689 bool wok = !m_trt.full(index);6655 bool wok = not m_trt.full(index); 6690 6656 6691 6657 #if DEBUG_MEMC_CAS … … 6719 6685 case CAS_MISS_TRT_SET: // register the GET transaction in TRT 6720 6686 { 6721 if(r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) 6722 { 6687 assert( (r_alloc_trt_fsm.read() == ALLOC_TRT_CAS) and 6688 "MEMC ERROR in CAS_MISS_TRT_SET state: Bad TRT allocation"); 6689 6723 6690 std::vector<be_t> be_vector; 6724 6691 std::vector<data_t> data_vector; … … 6732 6699 6733 6700 m_trt.set(r_cas_trt_index.read(), 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6701 true, // read request 6702 m_nline[(addr_t) m_cmd_cas_addr_fifo.read()], 6703 m_cmd_cas_srcid_fifo.read(), 6704 m_cmd_cas_trdid_fifo.read(), 6705 m_cmd_cas_pktid_fifo.read(), 6706 false, // write request from processor 6707 0, 6708 0, 6709 be_vector, 6710 data_vector); 6744 6711 r_cas_fsm = CAS_MISS_XRAM_REQ; 6745 6712 … … 6747 6714 if(m_debug) 6748 6715 { 6716 m_trt.print(0); 6749 6717 std::cout << " <MEMC " << name() << " CAS_MISS_TRT_SET> Register a GET transaction in TRT" << std::hex 6750 6718 << " / nline = " << m_nline[(addr_t) m_cmd_cas_addr_fifo.read()] … … 6752 6720 } 6753 6721 #endif 6754 }6755 6722 break; 6756 6723 } … … 6758 6725 case CAS_MISS_XRAM_REQ: // request the IXR_CMD FSM to fetch the missing line 6759 6726 { 6760 if( !r_cas_to_ixr_cmd_req)6727 if( not r_cas_to_ixr_cmd_req.read() ) 6761 6728 { 6762 6729 r_cas_to_ixr_cmd_req = true; 6763 r_cas_to_ixr_cmd_write = false; 6764 r_cas_to_ixr_cmd_trdid = r_cas_trt_index.read(); 6765 r_cas_to_ixr_cmd_nline = m_nline[(addr_t) m_cmd_cas_addr_fifo.read()]; 6730 r_cas_to_ixr_cmd_put = false; 6731 r_cas_to_ixr_cmd_index = r_cas_trt_index.read(); 6766 6732 r_cas_fsm = CAS_WAIT; 6767 6733 6768 6734 #if DEBUG_MEMC_CAS 6769 if(m_debug) 6770 { 6771 std::cout << " <MEMC " << name() << " CAS_MISS_XRAM_REQ> Request a GET transaction to IXR_CMD FSM" << std::hex 6772 << " / nline = " << m_nline[(addr_t) m_cmd_cas_addr_fifo.read()] 6773 << " / trt_index = " << r_cas_trt_index.read() << std::endl; 6774 } 6735 if(m_debug) 6736 std::cout << " <MEMC " << name() << " CAS_MISS_XRAM_REQ> Request a GET transaction" 6737 << " / address = " << std::hex << (addr_t) m_cmd_cas_addr_fifo.read() 6738 << " / trt_index = " << std::dec << r_cas_trt_index.read() << std::endl; 6775 6739 #endif 6776 6740 } … … 7643 7607 r_tgt_rsp_cpt = r_cleanup_to_tgt_rsp_first_word.read(); 7644 7608 } 7645 7646 7609 else if(r_config_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_CONFIG; 7647 7610 else if(r_tgt_cmd_to_tgt_rsp_req) r_tgt_rsp_fsm = TGT_RSP_TGT_CMD; … … 7780 7743 } 7781 7744 ///////////////////// 7782 case TGT_RSP_TGT_CMD: // send the response for a segmentation violation7745 case TGT_RSP_TGT_CMD: // send the response for a configuration access 7783 7746 { 7784 7747 if ( p_vci_tgt.rspack ) … … 7792 7755 std::cout 7793 7756 << " <MEMC " << name() 7794 << " TGT_RSP_TGT_CMD> Se gmentation violation response"7757 << " TGT_RSP_TGT_CMD> Send response for a configuration access" 7795 7758 << " / rsrcid = " << std::hex << r_tgt_cmd_to_tgt_rsp_srcid.read() 7796 7759 << " / rtrdid = " << r_tgt_cmd_to_tgt_rsp_trdid.read() 7797 7760 << " / rpktid = " << r_tgt_cmd_to_tgt_rsp_pktid.read() 7761 << " / error = " << r_tgt_cmd_to_tgt_rsp_error.read() 7798 7762 << std::endl; 7799 7763 } … … 7916 7880 #endif 7917 7881 7918 7919 7882 uint32_t last_word_idx = r_cleanup_to_tgt_rsp_first_word.read() + r_cleanup_to_tgt_rsp_length.read() - 1; 7920 7883 bool is_ll = ((r_cleanup_to_tgt_rsp_pktid.read() & 0x7) == TYPE_LL); … … 7972 7935 } 7973 7936 } 7974 7975 7937 } 7976 7938 break; … … 8114 8076 else if (r_multi_ack_fsm.read() == MULTI_ACK_UPT_LOCK) 8115 8077 r_alloc_upt_fsm = ALLOC_UPT_MULTI_ACK; 8116 8117 8078 else 8118 8079 m_cpt_upt_unused++; … … 8145 8106 else if (r_cas_fsm.read() == CAS_UPT_LOCK) 8146 8107 r_alloc_upt_fsm = ALLOC_UPT_CAS; 8147 8148 8108 else 8149 8109 m_cpt_upt_unused++; … … 8178 8138 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8179 8139 8180 else if (r_xram_rsp_fsm.read() == XRAM_RSP_I NVAL_LOCK)8140 else if (r_xram_rsp_fsm.read() == XRAM_RSP_IVT_LOCK) 8181 8141 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8182 8142 … … 8188 8148 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8189 8149 8190 else if (r_config_fsm.read() == CONFIG_ DIR_IVT_LOCK)8150 else if (r_config_fsm.read() == CONFIG_IVT_LOCK) 8191 8151 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8192 8152 … … 8200 8160 if (r_read_fsm.read() != READ_IVT_LOCK) 8201 8161 { 8202 if (r_xram_rsp_fsm.read() == XRAM_RSP_I NVAL_LOCK)8162 if (r_xram_rsp_fsm.read() == XRAM_RSP_IVT_LOCK) 8203 8163 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8204 8164 … … 8210 8170 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8211 8171 8212 else if (r_config_fsm.read() == CONFIG_ DIR_IVT_LOCK)8172 else if (r_config_fsm.read() == CONFIG_IVT_LOCK) 8213 8173 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8214 8174 … … 8217 8177 (r_write_fsm.read() == WRITE_MISS_IVT_LOCK)) 8218 8178 r_alloc_ivt_fsm = ALLOC_IVT_WRITE; 8219 8220 8179 else 8221 8180 m_cpt_ivt_unused++; … … 8225 8184 ////////////////////////// 8226 8185 case ALLOC_IVT_XRAM_RSP: // allocated to XRAM_RSP FSM 8227 if(r_xram_rsp_fsm.read() != XRAM_RSP_I NVAL_LOCK)8186 if(r_xram_rsp_fsm.read() != XRAM_RSP_IVT_LOCK) 8228 8187 { 8229 8188 if ((r_cleanup_fsm.read() == CLEANUP_IVT_LOCK) or … … 8234 8193 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8235 8194 8236 else if (r_config_fsm.read() == CONFIG_ DIR_IVT_LOCK)8195 else if (r_config_fsm.read() == CONFIG_IVT_LOCK) 8237 8196 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8238 8197 … … 8259 8218 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8260 8219 8261 else if (r_config_fsm.read() == CONFIG_ DIR_IVT_LOCK)8220 else if (r_config_fsm.read() == CONFIG_IVT_LOCK) 8262 8221 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8263 8222 … … 8270 8229 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8271 8230 8272 else if (r_xram_rsp_fsm.read() == XRAM_RSP_I NVAL_LOCK)8231 else if (r_xram_rsp_fsm.read() == XRAM_RSP_IVT_LOCK) 8273 8232 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8274 8233 … … 8282 8241 if (r_cas_fsm.read() != CAS_BC_IVT_LOCK) 8283 8242 { 8284 if (r_config_fsm.read() == CONFIG_ DIR_IVT_LOCK)8243 if (r_config_fsm.read() == CONFIG_IVT_LOCK) 8285 8244 r_alloc_ivt_fsm = ALLOC_IVT_CONFIG; 8286 8245 … … 8293 8252 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8294 8253 8295 else if (r_xram_rsp_fsm.read() == XRAM_RSP_I NVAL_LOCK)8254 else if (r_xram_rsp_fsm.read() == XRAM_RSP_IVT_LOCK) 8296 8255 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8297 8256 … … 8307 8266 ////////////////////////// 8308 8267 case ALLOC_IVT_CONFIG: // allocated to CONFIG FSM 8309 if (r_config_fsm.read() != CONFIG_ DIR_IVT_LOCK)8268 if (r_config_fsm.read() != CONFIG_IVT_LOCK) 8310 8269 { 8311 8270 if ((r_write_fsm.read() == WRITE_BC_IVT_LOCK) or … … 8317 8276 r_alloc_ivt_fsm = ALLOC_IVT_READ; 8318 8277 8319 else if (r_xram_rsp_fsm.read() == XRAM_RSP_I NVAL_LOCK)8278 else if (r_xram_rsp_fsm.read() == XRAM_RSP_IVT_LOCK) 8320 8279 r_alloc_ivt_fsm = ALLOC_IVT_XRAM_RSP; 8321 8280 … … 8326 8285 else if(r_cas_fsm.read() == CAS_BC_IVT_LOCK) 8327 8286 r_alloc_ivt_fsm = ALLOC_IVT_CAS; 8328 8329 8287 else 8330 8288 m_cpt_ivt_unused++; … … 8361 8319 if ( (r_config_fsm.read() != CONFIG_DIR_REQ) and 8362 8320 (r_config_fsm.read() != CONFIG_DIR_ACCESS) and 8363 (r_config_fsm.read() != CONFIG_DIR_IVT_LOCK) ) 8321 (r_config_fsm.read() != CONFIG_TRT_LOCK) and 8322 (r_config_fsm.read() != CONFIG_TRT_SET) and 8323 (r_config_fsm.read() != CONFIG_IVT_LOCK) ) 8364 8324 { 8365 8325 if(r_read_fsm.read() == READ_DIR_REQ) … … 8417 8377 if(((r_write_fsm.read() != WRITE_DIR_REQ) and 8418 8378 (r_write_fsm.read() != WRITE_DIR_LOCK) and 8419 (r_write_fsm.read() != WRITE_ DIR_READ) and8379 (r_write_fsm.read() != WRITE_BC_DIR_READ) and 8420 8380 (r_write_fsm.read() != WRITE_DIR_HIT) and 8421 8381 (r_write_fsm.read() != WRITE_BC_TRT_LOCK) and … … 8530 8490 if( (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_LOCK) and 8531 8491 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) and 8532 (r_xram_rsp_fsm.read() != XRAM_RSP_I NVAL_LOCK))8492 (r_xram_rsp_fsm.read() != XRAM_RSP_IVT_LOCK)) 8533 8493 { 8534 8494 if(r_config_fsm.read() == CONFIG_DIR_REQ) … … 8579 8539 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8580 8540 8541 else if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8542 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8543 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8544 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8545 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8546 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8547 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8548 8581 8549 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 8582 8550 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) … … 8587 8555 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8588 8556 8557 else if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8558 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8559 8589 8560 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8590 8561 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; … … 8607 8578 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8608 8579 8580 else if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8581 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8582 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8583 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8584 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8585 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8586 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8587 8609 8588 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 8610 8589 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) … … 8618 8597 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8619 8598 8599 else if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8600 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8601 8620 8602 else if(r_read_fsm.read() == READ_TRT_LOCK) 8621 8603 r_alloc_trt_fsm = ALLOC_TRT_READ; … … 8634 8616 (r_cas_fsm.read() != CAS_BC_IVT_LOCK)) 8635 8617 { 8636 if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 8637 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 8618 if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8619 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8620 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8621 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8622 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8623 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8624 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8625 8626 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 8627 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 8638 8628 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8639 8629 … … 8645 8635 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8646 8636 8637 else if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8638 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8639 8647 8640 else if(r_read_fsm.read() == READ_TRT_LOCK) 8648 8641 r_alloc_trt_fsm = ALLOC_TRT_READ; … … 8658 8651 m_cpt_cas_fsm_trt_used++; 8659 8652 break; 8653 /////////////////////// 8654 case ALLOC_TRT_IXR_CMD: 8655 if((r_ixr_cmd_fsm.read() != IXR_CMD_READ_TRT) and 8656 (r_ixr_cmd_fsm.read() != IXR_CMD_WRITE_TRT) and 8657 (r_ixr_cmd_fsm.read() != IXR_CMD_CAS_TRT) and 8658 (r_ixr_cmd_fsm.read() != IXR_CMD_XRAM_TRT) and 8659 (r_ixr_cmd_fsm.read() != IXR_CMD_CLEANUP_TRT) and 8660 (r_ixr_cmd_fsm.read() != IXR_CMD_CONFIG_TRT)) 8661 { 8662 if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 8663 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 8664 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8665 8666 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or 8667 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 8668 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8669 8670 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8671 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8672 8673 8674 else if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8675 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8676 8677 else if(r_read_fsm.read() == READ_TRT_LOCK) 8678 r_alloc_trt_fsm = ALLOC_TRT_READ; 8679 8680 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or 8681 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 8682 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 8683 8684 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or 8685 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 8686 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8687 } 8688 break; 8660 8689 8661 8690 //////////////////////// … … 8665 8694 (r_xram_rsp_fsm.read() != XRAM_RSP_TRT_COPY) and 8666 8695 (r_xram_rsp_fsm.read() != XRAM_RSP_DIR_UPDT) and 8667 (r_xram_rsp_fsm.read() != XRAM_RSP_I NVAL_LOCK))8696 (r_xram_rsp_fsm.read() != XRAM_RSP_IVT_LOCK)) 8668 8697 { 8669 8698 if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or … … 8685 8714 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8686 8715 8716 else if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8717 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8718 8719 else if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8720 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8721 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8722 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8723 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8724 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8725 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8726 8687 8727 else 8688 8728 m_cpt_trt_unused++; … … 8697 8737 (r_ixr_rsp_fsm.read() != IXR_RSP_TRT_READ)) 8698 8738 { 8739 if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8740 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8699 8741 8700 if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ)8742 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8701 8743 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8702 8744 … … 8711 8753 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 8712 8754 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8755 8756 else if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8757 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8758 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8759 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8760 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8761 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8762 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8713 8763 8714 8764 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) && … … 8746 8796 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 8747 8797 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8748 } 8749 break; 8798 8799 else if( r_config_fsm.read() == CONFIG_TRT_LOCK ) 8800 r_alloc_trt_fsm = ALLOC_TRT_CONFIG; 8801 8802 else if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8803 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8804 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8805 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8806 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8807 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8808 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8809 } 8810 break; 8811 ////////////////////// 8812 case ALLOC_TRT_CONFIG: 8813 if((r_config_fsm.read() != CONFIG_TRT_LOCK) and 8814 (r_config_fsm.read() != CONFIG_TRT_SET)) 8815 { 8816 if(r_read_fsm.read() == READ_TRT_LOCK) 8817 r_alloc_trt_fsm = ALLOC_TRT_READ; 8818 8819 else if((r_write_fsm.read() == WRITE_MISS_TRT_LOCK) or 8820 (r_write_fsm.read() == WRITE_BC_TRT_LOCK)) 8821 r_alloc_trt_fsm = ALLOC_TRT_WRITE; 8822 8823 else if((r_cas_fsm.read() == CAS_MISS_TRT_LOCK) or 8824 (r_cas_fsm.read() == CAS_BC_TRT_LOCK)) 8825 r_alloc_trt_fsm = ALLOC_TRT_CAS; 8826 8827 else if((r_ixr_cmd_fsm.read() == IXR_CMD_READ_TRT) or 8828 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_TRT) or 8829 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_TRT) or 8830 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_TRT) or 8831 (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_TRT) or 8832 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_TRT) ) 8833 r_alloc_trt_fsm = ALLOC_TRT_IXR_CMD; 8834 8835 else if((r_xram_rsp_fsm.read() == XRAM_RSP_DIR_LOCK) and 8836 (r_alloc_dir_fsm.read() == ALLOC_DIR_XRAM_RSP)) 8837 r_alloc_trt_fsm = ALLOC_TRT_XRAM_RSP; 8838 8839 else if (r_cleanup_fsm.read() == CLEANUP_IXR_REQ) 8840 r_alloc_trt_fsm = ALLOC_TRT_CLEANUP; 8841 8842 else if((r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) or 8843 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) 8844 r_alloc_trt_fsm = ALLOC_TRT_IXR_RSP; 8845 } 8846 break; 8847 8750 8848 8751 8849 } // end switch alloc_trt_fsm … … 9034 9132 m_write_to_cc_send_srcid_fifo.update( write_to_cc_send_fifo_get, write_to_cc_send_fifo_put, 9035 9133 write_to_cc_send_fifo_srcid ); 9036 #if L1_MULTI_CACHE9037 m_write_to_cc_send_cache_id_fifo.update( write_to_cc_send_fifo_get, write_to_cc_send_fifo_put,9038 write_to_cc_send_fifo_cache_id );9039 #endif9040 9134 9041 9135 //////////////////////////////////////////////////////////////////////////////////// … … 9047 9141 m_config_to_cc_send_srcid_fifo.update( config_to_cc_send_fifo_get, config_to_cc_send_fifo_put, 9048 9142 config_to_cc_send_fifo_srcid ); 9049 #if L1_MULTI_CACHE9050 m_config_to_cc_send_cache_id_fifo.update( config_to_cc_send_fifo_get, config_to_cc_send_fifo_put,9051 config_to_cc_send_fifo_cache_id );9052 #endif9053 9143 9054 9144 //////////////////////////////////////////////////////////////////////////////////// … … 9060 9150 m_xram_rsp_to_cc_send_srcid_fifo.update( xram_rsp_to_cc_send_fifo_get, xram_rsp_to_cc_send_fifo_put, 9061 9151 xram_rsp_to_cc_send_fifo_srcid ); 9062 #if L1_MULTI_CACHE9063 m_xram_rsp_to_cc_send_cache_id_fifo.update( xram_rsp_to_cc_send_fifo_get, xram_rsp_to_cc_send_fifo_put,9064 xram_rsp_to_cc_send_fifo_cache_id );9065 #endif9066 9152 9067 9153 //////////////////////////////////////////////////////////////////////////////////// … … 9073 9159 m_cas_to_cc_send_srcid_fifo.update( cas_to_cc_send_fifo_get, cas_to_cc_send_fifo_put, 9074 9160 cas_to_cc_send_fifo_srcid ); 9075 #if L1_MULTI_CACHE9076 m_cas_to_cc_send_cache_id_fifo.update( cas_to_cc_send_fifo_get, cas_to_cc_send_fifo_put,9077 cas_to_cc_send_fifo_cache_id );9078 #endif9079 9080 9161 m_cpt_cycles++; 9081 9162 … … 9089 9170 // Command signals on the p_vci_ixr port 9090 9171 //////////////////////////////////////////////////////////// 9091 9092 p_vci_ixr.be = 0xFF; // nor transmited to external ram 9172 // DATA width is 8 bytes 9173 // The following values are not transmitted to XRAM 9174 // p_vci_ixr.be 9175 // p_vci_ixr.pktid 9176 // p_vci_ixr.cons 9177 // p_vci_ixr.wrap 9178 // p_vci_ixr.contig 9179 // p_vci_ixr.clen 9180 // p_vci_ixr.cfixed 9181 9182 p_vci_ixr.plen = 64; 9183 p_vci_ixr.srcid = m_srcid_x; 9184 p_vci_ixr.trdid = r_ixr_cmd_trdid.read(); 9185 p_vci_ixr.address = (addr_t)r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2); 9186 p_vci_ixr.be = 0xFF; 9093 9187 p_vci_ixr.pktid = 0; 9094 p_vci_ixr.srcid = m_srcid_x;9095 9188 p_vci_ixr.cons = false; 9096 9189 p_vci_ixr.wrap = false; … … 9098 9191 p_vci_ixr.clen = 0; 9099 9192 p_vci_ixr.cfixed = false; 9100 p_vci_ixr.plen = 64; 9101 9102 if(r_ixr_cmd_fsm.read() == IXR_CMD_READ) 9103 { 9104 p_vci_ixr.cmd = vci_param_ext::CMD_READ; 9105 p_vci_ixr.cmdval = true; 9106 p_vci_ixr.address = (addr_t)(r_read_to_ixr_cmd_nline.read() * m_words * 4); 9107 p_vci_ixr.wdata = 0; 9108 p_vci_ixr.trdid = r_read_to_ixr_cmd_trdid.read(); 9109 p_vci_ixr.eop = true; 9193 9194 if ( (r_ixr_cmd_fsm.read() == IXR_CMD_READ_SEND) or 9195 (r_ixr_cmd_fsm.read() == IXR_CMD_WRITE_SEND) or 9196 (r_ixr_cmd_fsm.read() == IXR_CMD_CAS_SEND) or 9197 (r_ixr_cmd_fsm.read() == IXR_CMD_XRAM_SEND) or 9198 (r_ixr_cmd_fsm.read() == IXR_CMD_CONFIG_SEND) ) 9199 { 9200 p_vci_ixr.cmdval = true; 9201 9202 if ( r_ixr_cmd_get.read() ) // GET 9203 { 9204 p_vci_ixr.cmd = vci_param_ext::CMD_READ; 9205 p_vci_ixr.wdata = 0; 9206 p_vci_ixr.eop = true; 9207 } 9208 else // PUT 9209 { 9210 size_t word = r_ixr_cmd_word.read(); 9211 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 9212 p_vci_ixr.wdata = ((wide_data_t)(r_ixr_cmd_wdata[word].read())) | 9213 ((wide_data_t)(r_ixr_cmd_wdata[word+1].read()) << 32); 9214 p_vci_ixr.eop = (word == (m_words-2)); 9215 } 9110 9216 } 9111 else if(r_ixr_cmd_fsm.read() == IXR_CMD_CAS) 9112 { 9113 if(r_cas_to_ixr_cmd_write.read()) 9114 { 9115 size_t word = r_ixr_cmd_cpt.read(); 9116 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 9117 p_vci_ixr.cmdval = true; 9118 p_vci_ixr.address = (addr_t)( (r_cas_to_ixr_cmd_nline.read() * m_words + word) * 4 ); 9119 p_vci_ixr.wdata = ((wide_data_t)(r_cas_to_ixr_cmd_data[word].read())) | 9120 ((wide_data_t)(r_cas_to_ixr_cmd_data[word+1].read()) << 32); 9121 p_vci_ixr.trdid = r_cas_to_ixr_cmd_trdid.read(); 9122 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words-2)); 9123 } 9124 else 9125 { 9126 p_vci_ixr.cmd = vci_param_ext::CMD_READ; 9127 p_vci_ixr.cmdval = true; 9128 p_vci_ixr.address = (addr_t)(r_cas_to_ixr_cmd_nline.read() *m_words*4); 9129 p_vci_ixr.wdata = 0; 9130 p_vci_ixr.trdid = r_cas_to_ixr_cmd_trdid.read(); 9131 p_vci_ixr.eop = true; 9132 } 9133 } 9134 else if(r_ixr_cmd_fsm.read() == IXR_CMD_WRITE) 9135 { 9136 if(r_write_to_ixr_cmd_write.read()) 9137 { 9138 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 9139 p_vci_ixr.cmdval = true; 9140 p_vci_ixr.address = (addr_t)( (r_write_to_ixr_cmd_nline.read() * m_words + 9141 r_ixr_cmd_cpt.read()) * 4 ); 9142 p_vci_ixr.wdata = ((wide_data_t)(r_write_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 9143 ((wide_data_t)(r_write_to_ixr_cmd_data[r_ixr_cmd_cpt.read()+1].read()) << 32)); 9144 p_vci_ixr.trdid = r_write_to_ixr_cmd_trdid.read(); 9145 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words-2)); 9146 } 9147 else 9148 { 9149 p_vci_ixr.cmd = vci_param_ext::CMD_READ; 9150 p_vci_ixr.cmdval = true; 9151 p_vci_ixr.address = (addr_t)(r_write_to_ixr_cmd_nline.read() *m_words*4); 9152 p_vci_ixr.wdata = 0; 9153 p_vci_ixr.trdid = r_write_to_ixr_cmd_trdid.read(); 9154 p_vci_ixr.eop = true; 9155 } 9156 } 9157 else if(r_ixr_cmd_fsm.read() == IXR_CMD_XRAM) 9158 { 9159 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 9160 p_vci_ixr.cmdval = true; 9161 p_vci_ixr.address = (addr_t)( (r_xram_rsp_to_ixr_cmd_nline.read() * m_words + 9162 r_ixr_cmd_cpt.read()) * 4 ); 9163 p_vci_ixr.wdata = ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 9164 ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()+1].read()) << 32)); 9165 p_vci_ixr.trdid = r_xram_rsp_to_ixr_cmd_trdid.read(); 9166 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words-2)); 9167 } 9168 else if (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_DATA) 9217 else if (r_ixr_cmd_fsm.read() == IXR_CMD_CLEANUP_DATA_SEND) 9169 9218 { 9170 9219 p_vci_ixr.cmd = vci_param_ext::CMD_WRITE; 9171 9220 p_vci_ixr.cmdval = true; 9172 p_vci_ixr.address = (addr_t)((r_cleanup_to_ixr_cmd_nline.read() * m_words + r_ixr_cmd_cpt.read()) * 4); 9173 if (r_cleanup_to_ixr_cmd_ncc_l1_dirty.read()) //if L1 was dirty, the correct data is in the cleanup 9174 { 9175 p_vci_ixr.wdata = ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 9176 ((wide_data_t)(r_cleanup_to_ixr_cmd_data[r_ixr_cmd_cpt.read()+1].read()) << 32)); 9177 if(r_cleanup_to_ixr_cmd_nline.read() == 0x12bb) 9178 std::cout << "IXR data dirty = " << std::hex << p_vci_ixr.wdata << std::dec << std::endl; 9179 } 9180 else //if L1 was not dirty, the data is in the L2 9181 { 9182 p_vci_ixr.wdata = ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()].read()) | 9183 ((wide_data_t)(r_xram_rsp_to_ixr_cmd_data[r_ixr_cmd_cpt.read()+1].read()) << 32)); 9184 if(r_cleanup_to_ixr_cmd_nline.read() == 0x12bb) 9185 std::cout << "IXR data not dirty = " << std::hex << p_vci_ixr.wdata << std::dec << std::endl; 9186 } 9187 p_vci_ixr.trdid = r_cleanup_to_ixr_cmd_trdid.read(); 9188 p_vci_ixr.eop = (r_ixr_cmd_cpt == (m_words - 2)); 9221 /*p_vci_ixr.address = (addr_t)((r_cleanup_to_ixr_cmd_nline.read() * m_words + 9222 r_ixr_cmd_word.read()) * 4);*/ 9223 p_vci_ixr.address = (addr_t)r_ixr_cmd_address.read() + (r_ixr_cmd_word.read()<<2); 9224 p_vci_ixr.wdata = ((wide_data_t)(r_ixr_cmd_wdata[r_ixr_cmd_word.read()].read()) | 9225 ((wide_data_t)(r_ixr_cmd_wdata[r_ixr_cmd_word.read() + 1].read()) << 32)); 9226 p_vci_ixr.trdid = r_cleanup_to_ixr_cmd_index.read(); 9227 p_vci_ixr.eop = (r_ixr_cmd_word == (m_words - 2)); 9189 9228 } 9229 9190 9230 else 9191 9231 { 9192 p_vci_ixr.cmdval = false; 9193 p_vci_ixr.cmd = vci_param_ext::CMD_READ; 9194 p_vci_ixr.address = 0; 9195 p_vci_ixr.wdata = 0; 9196 p_vci_ixr.trdid = 0; 9197 p_vci_ixr.eop = false; 9232 p_vci_ixr.cmdval = false; 9198 9233 } 9199 9234 … … 9202 9237 //////////////////////////////////////////////////// 9203 9238 9204 if(((r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP) and 9205 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ)) or 9206 (r_ixr_rsp_fsm.read() == IXR_RSP_ACK)) 9207 9208 p_vci_ixr.rspack = true; 9209 9210 else 9211 p_vci_ixr.rspack = false; 9239 if( (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_READ) or 9240 (r_ixr_rsp_fsm.read() == IXR_RSP_TRT_ERASE) ) 9241 { 9242 p_vci_ixr.rspack = (r_alloc_trt_fsm.read() == ALLOC_TRT_IXR_RSP); 9243 } 9244 else if (r_ixr_rsp_fsm.read() == IXR_RSP_ACK) 9245 { 9246 p_vci_ixr.rspack = true; 9247 } 9248 else // r_ixr_rsp_fsm == IXR_RSP_IDLE 9249 { 9250 p_vci_ixr.rspack = false; 9251 } 9212 9252 9213 9253 //////////////////////////////////////////////////// … … 9279 9319 { 9280 9320 p_vci_tgt.rspval = true; 9281 p_vci_tgt.rdata = 0;9321 p_vci_tgt.rdata = r_tgt_cmd_to_tgt_rsp_rdata.read(); 9282 9322 p_vci_tgt.rsrcid = r_tgt_cmd_to_tgt_rsp_srcid.read(); 9283 9323 p_vci_tgt.rtrdid = r_tgt_cmd_to_tgt_rsp_trdid.read(); … … 9904 9944 //////////////////////////////////////////////////////////////////// 9905 9945 9906 switch(r_cleanup_fsm.read())9946 if ( r_cleanup_fsm.read() == CLEANUP_SEND_CLACK ) 9907 9947 { 9908 case CLEANUP_IDLE: 9909 case CLEANUP_GET_NLINE: 9910 case CLEANUP_DIR_REQ: 9911 case CLEANUP_DIR_LOCK: 9912 case CLEANUP_DIR_WRITE: 9913 case CLEANUP_HEAP_REQ: 9914 case CLEANUP_HEAP_LOCK: 9915 case CLEANUP_HEAP_SEARCH: 9916 case CLEANUP_HEAP_CLEAN: 9917 case CLEANUP_HEAP_FREE: 9918 case CLEANUP_IVT_LOCK: 9919 case CLEANUP_IVT_DECREMENT: 9920 case CLEANUP_IVT_CLEAR: 9921 case CLEANUP_WRITE_RSP: 9922 case CLEANUP_CONFIG_ACK: 9923 p_dspin_clack.write = false; 9924 p_dspin_clack.eop = false; 9925 p_dspin_clack.data = 0; 9926 9927 break; 9928 9929 case CLEANUP_SEND_CLACK: 9930 { 9931 uint8_t cleanup_ack_type; 9932 if(r_cleanup_inst.read()) 9933 { 9948 uint8_t cleanup_ack_type; 9949 if(r_cleanup_inst.read()) 9950 { 9934 9951 cleanup_ack_type = DspinDhccpParam::TYPE_CLACK_INST; 9935 9936 9937 9952 } 9953 else 9954 { 9938 9955 cleanup_ack_type = DspinDhccpParam::TYPE_CLACK_DATA; 9939 } 9940 9941 uint64_t flit = 0; 9942 uint64_t dest = 9943 r_cleanup_srcid.read() << 9956 } 9957 9958 uint64_t flit = 0; 9959 uint64_t dest = r_cleanup_srcid.read() << 9944 9960 (DspinDhccpParam::SRCID_WIDTH - vci_param_int::S); 9945 9961 … … 9964 9980 DspinDhccpParam::CLACK_TYPE); 9965 9981 9966 p_dspin_clack.eop = true; 9967 p_dspin_clack.write = true; 9968 p_dspin_clack.data = flit; 9969 } 9970 break; 9982 p_dspin_clack.eop = true; 9983 p_dspin_clack.write = true; 9984 p_dspin_clack.data = flit; 9971 9985 } 9972 9986 else 9987 { 9988 p_dspin_clack.write = false; 9989 p_dspin_clack.eop = false; 9990 p_dspin_clack.data = 0; 9991 } 9973 9992 /////////////////////////////////////////////////////////////////// 9974 9993 // p_dspin_p2m port (CC_RECEIVE FSM) -
Property
svn:mergeinfo
set to
(toggle deleted branches)
Note: See TracChangeset
for help on using the changeset viewer.