Changeset 611 for branches/RWT/modules/vci_mem_cache/caba/source
- Timestamp:
- Dec 31, 2013, 12:53:47 PM (11 years ago)
- Location:
- branches/RWT/modules/vci_mem_cache/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RWT/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
r604 r611 454 454 uint32_t m_cpt_update_cost; // Number of (flits * distance) for UPDT 455 455 456 uint32_t m_cpt_m _inval;// Number of requests causing M_INV457 uint32_t m_cpt_m _inval_local;// Number of local M_INV transactions458 uint32_t m_cpt_m _inval_remote;// Number of remote M_INV transactions459 uint32_t m_cpt_m _inval_cost;// Number of (flits * distance) for M_INV460 461 uint32_t m_cpt_b r_inval;// Number of BROADCAST INVAL456 uint32_t m_cpt_minval; // Number of requests causing M_INV 457 uint32_t m_cpt_minval_local; // Number of local M_INV transactions 458 uint32_t m_cpt_minval_remote; // Number of remote M_INV transactions 459 uint32_t m_cpt_minval_cost; // Number of (flits * distance) for M_INV 460 461 uint32_t m_cpt_binval; // Number of BROADCAST INVAL 462 462 463 463 uint32_t m_cpt_cleanup_local; // Number of local CLEANUP transactions … … 583 583 sc_in<bool> p_clk; 584 584 sc_in<bool> p_resetn; 585 sc_in<bool> p_irq; 585 586 soclib::caba::VciTarget<vci_param_int> p_vci_tgt; 586 587 soclib::caba::VciInitiator<vci_param_ext> p_vci_ixr; … … 645 646 uint32_t req_distance(uint32_t req_srcid); 646 647 bool is_local_req(uint32_t req_srcid); 648 int read_instrumentation(uint32_t regr, uint32_t & rdata); 647 649 648 650 // Component attributes … … 685 687 // broadcast address 686 688 uint32_t m_broadcast_boundaries; 689 690 // configuration interface constants 691 const uint32_t m_config_addr_mask; 692 const uint32_t m_config_regr_width; 693 const uint32_t m_config_func_width; 694 const uint32_t m_config_regr_idx_mask; 695 const uint32_t m_config_func_idx_mask; 687 696 688 697 // Fifo between TGT_CMD fsm and READ fsm -
branches/RWT/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
r604 r611 412 412 m_broadcast_boundaries(0x7C1F), 413 413 414 // CONFIG interface 415 m_config_addr_mask((1<<12)-1), 416 417 m_config_regr_width(7), 418 m_config_func_width(3), 419 m_config_regr_idx_mask((1<<m_config_regr_width)-1), 420 m_config_func_idx_mask((1<<m_config_func_width)-1), 421 414 422 // FIFOs 415 423 m_cmd_read_addr_fifo("m_cmd_read_addr_fifo", 4), … … 677 685 } 678 686 687 ///////////////////////////////////////////////////// 688 tmpl(int)::read_instrumentation(uint32_t regr, uint32_t & rdata) 689 ///////////////////////////////////////////////////// 690 { 691 int error = 0; 692 693 switch(regr) 694 { 695 /////////////////////////////////////////////////////// 696 // DIRECT instrumentation registers // 697 // Registers of 32 bits and therefore only LO is // 698 // implemented. // 699 // // 700 // The HI may be used in future implementations // 701 /////////////////////////////////////////////////////// 702 703 // LOCAL 704 705 case MEMC_LOCAL_READ_LO : rdata = m_cpt_read_local ; break; 706 case MEMC_LOCAL_WRITE_LO : rdata = m_cpt_write_flits_local ; break; 707 case MEMC_LOCAL_LL_LO : rdata = m_cpt_ll_local ; break; 708 case MEMC_LOCAL_SC_LO : rdata = m_cpt_sc_local ; break; 709 case MEMC_LOCAL_CAS_LO : rdata = m_cpt_cas_local ; break; 710 case MEMC_LOCAL_READ_HI : 711 case MEMC_LOCAL_WRITE_HI : 712 case MEMC_LOCAL_LL_HI : 713 case MEMC_LOCAL_SC_HI : 714 case MEMC_LOCAL_CAS_HI : rdata = 0; break; 715 716 // REMOTE 717 718 case MEMC_REMOTE_READ_LO : rdata = m_cpt_read_remote ; break; 719 case MEMC_REMOTE_WRITE_LO : rdata = m_cpt_write_flits_remote ; break; 720 case MEMC_REMOTE_LL_LO : rdata = m_cpt_ll_remote ; break; 721 case MEMC_REMOTE_SC_LO : rdata = m_cpt_sc_remote ; break; 722 case MEMC_REMOTE_CAS_LO : rdata = m_cpt_cas_remote ; break; 723 case MEMC_REMOTE_READ_HI : 724 case MEMC_REMOTE_WRITE_HI : 725 case MEMC_REMOTE_LL_HI : 726 case MEMC_REMOTE_SC_HI : 727 case MEMC_REMOTE_CAS_HI : rdata = 0; break; 728 729 // COST 730 731 case MEMC_COST_READ_LO : rdata = m_cpt_read_cost ; break; 732 case MEMC_COST_WRITE_LO : rdata = m_cpt_write_cost; break; 733 case MEMC_COST_LL_LO : rdata = m_cpt_ll_cost ; break; 734 case MEMC_COST_SC_LO : rdata = m_cpt_sc_cost ; break; 735 case MEMC_COST_CAS_LO : rdata = m_cpt_cas_cost ; break; 736 case MEMC_COST_READ_HI : 737 case MEMC_COST_WRITE_HI : 738 case MEMC_COST_LL_HI : 739 case MEMC_COST_SC_HI : 740 case MEMC_COST_CAS_HI : rdata = 0; break; 741 742 /////////////////////////////////////////////////////// 743 // COHERENCE instrumentation registers // 744 // Registers of 32 bits and therefore only LO is // 745 // implemented. // 746 // // 747 // The HI may be used in future implementations // 748 /////////////////////////////////////////////////////// 749 750 // LOCAL 751 752 case MEMC_LOCAL_MUPDATE_LO : rdata = m_cpt_update_local ; break; 753 case MEMC_LOCAL_MINVAL_LO : rdata = m_cpt_minval_local ; break; 754 case MEMC_LOCAL_CLEANUP_LO : rdata = m_cpt_cleanup_local; break; 755 case MEMC_LOCAL_MUPDATE_HI : 756 case MEMC_LOCAL_MINVAL_HI : 757 case MEMC_LOCAL_CLEANUP_HI : rdata = 0; break; 758 759 // REMOTE 760 761 case MEMC_REMOTE_MUPDATE_LO : rdata = m_cpt_update_remote ; break; 762 case MEMC_REMOTE_MINVAL_LO : rdata = m_cpt_minval_remote ; break; 763 case MEMC_REMOTE_CLEANUP_LO : rdata = m_cpt_cleanup_remote; break; 764 case MEMC_REMOTE_MUPDATE_HI : 765 case MEMC_REMOTE_MINVAL_HI : 766 case MEMC_REMOTE_CLEANUP_HI : rdata = 0; break; 767 768 // COST 769 770 case MEMC_COST_MUPDATE_LO : rdata = m_cpt_update_cost ; break; 771 case MEMC_COST_MINVAL_LO : rdata = m_cpt_minval_cost ; break; 772 case MEMC_COST_CLEANUP_LO : rdata = m_cpt_cleanup_cost ; break; 773 case MEMC_COST_MUPDATE_HI : 774 case MEMC_COST_MINVAL_HI : 775 case MEMC_COST_CLEANUP_HI : rdata = 0; break; 776 777 // TOTAL 778 779 case MEMC_TOTAL_MUPDATE_LO : rdata = m_cpt_update ; break; 780 case MEMC_TOTAL_MINVAL_LO : rdata = m_cpt_minval ; break; 781 case MEMC_TOTAL_BINVAL_LO : rdata = m_cpt_binval ; break; 782 case MEMC_TOTAL_MUPDATE_HI : 783 case MEMC_TOTAL_MINVAL_HI : 784 case MEMC_TOTAL_BINVAL_HI : rdata = 0; break; 785 786 // unknown register 787 788 default : error = 1; 789 } 790 791 return error; 792 } 679 793 680 794 ////////////////////////////////////////////////// … … 746 860 << "[022] UPDT COST (FLITS * DIST) = " << m_cpt_update_cost << std::endl 747 861 << std::endl 748 << "[023] REQUESTS TRIG. M_INV = " << m_cpt_m _inval << std::endl749 << "[024] LOCAL M_INV = " << m_cpt_m _inval_local << std::endl750 << "[025] REMOTE M_INV = " << m_cpt_m _inval_remote << std::endl751 << "[026] M_INV COST (FLITS * DIST) = " << m_cpt_m _inval_cost << std::endl862 << "[023] REQUESTS TRIG. M_INV = " << m_cpt_minval << std::endl 863 << "[024] LOCAL M_INV = " << m_cpt_minval_local << std::endl 864 << "[025] REMOTE M_INV = " << m_cpt_minval_remote << std::endl 865 << "[026] M_INV COST (FLITS * DIST) = " << m_cpt_minval_cost << std::endl 752 866 << std::endl 753 << "[027] BROADCAT INVAL = " << m_cpt_b r_inval << std::endl867 << "[027] BROADCAT INVAL = " << m_cpt_binval << std::endl 754 868 << std::endl 755 869 << "[028] LOCAL CLEANUP = " << m_cpt_cleanup_local << std::endl … … 800 914 << "[117] AV. REMOTE UPDT PER UP REQ = " << (double) m_cpt_update_remote / m_cpt_update << std::endl 801 915 << std::endl 802 << "[118] INVAL MULTICAST RATE = " << (double) m_cpt_m _inval / m_cpt_cycles << std::endl803 << "[119] AVE. INVAL PER M_INV = " << (double) (m_cpt_m _inval_local + m_cpt_m_inval_remote) / m_cpt_m_inval << std::endl804 << "[120] AV. LOC INV PER M_INV = " << (double) m_cpt_m _inval_local / m_cpt_m_inval << std::endl805 << "[121] AV. REM INV PER M_INV = " << (double) m_cpt_m _inval_remote / m_cpt_m_inval << std::endl916 << "[118] INVAL MULTICAST RATE = " << (double) m_cpt_minval / m_cpt_cycles << std::endl 917 << "[119] AVE. INVAL PER M_INV = " << (double) (m_cpt_minval_local + m_cpt_minval_remote) / m_cpt_minval << std::endl 918 << "[120] AV. LOC INV PER M_INV = " << (double) m_cpt_minval_local / m_cpt_minval << std::endl 919 << "[121] AV. REM INV PER M_INV = " << (double) m_cpt_minval_remote / m_cpt_minval << std::endl 806 920 << std::endl 807 << "[122] INVAL BROADCAST RATE = " << (double) m_cpt_b r_inval / m_cpt_cycles << std::endl921 << "[122] INVAL BROADCAST RATE = " << (double) m_cpt_binval / m_cpt_cycles << std::endl 808 922 << "[123] WRITE DIRTY RATE = " << (double) m_cpt_write_dirty / m_cpt_cycles << std::endl 809 923 << std::endl … … 1025 1139 m_cpt_update_remote = 0; 1026 1140 m_cpt_update_cost = 0; 1027 m_cpt_m _inval = 0;1028 m_cpt_m _inval_local = 0;1029 m_cpt_m _inval_remote = 0;1030 m_cpt_m _inval_cost = 0;1031 m_cpt_b r_inval = 0;1141 m_cpt_minval = 0; 1142 m_cpt_minval_local = 0; 1143 m_cpt_minval_remote = 0; 1144 m_cpt_minval_cost = 0; 1145 m_cpt_binval = 0; 1032 1146 m_cpt_cleanup_local = 0; 1033 1147 m_cpt_cleanup_remote = 0; … … 1308 1422 case TGT_CMD_CONFIG: // execute config request and return response 1309 1423 { 1424 /////////////////////////////////////////////////////////// 1425 // Decoding CONFIG interface commands // 1426 // // 1427 // VCI ADDRESS // 1428 // ================================================ // 1429 // GLOBAL | LOCAL | ... | FUNC_IDX | REGS_IDX | 00 // 1430 // IDX | IDX | | (3 bits) | (7 bits) | // 1431 // ================================================ // 1432 // // 1433 // For instrumentation : FUNC_IDX = 0b001 // 1434 // // 1435 // REGS_IDX // 1436 // ============================================ // 1437 // Z | Y | X | W // 1438 // (1 bit) | (2 bits) | (3 bits) | (1 bit) // 1439 // ============================================ // 1440 // // 1441 // Z : DIRECT / COHERENCE // 1442 // Y : SUBTYPE ( LOCAL, REMOTE, OTHER ) // 1443 // X : REGISTER INDEX // 1444 // W : HI / LO // 1445 // // 1446 // For configuration: FUNC_IDX = 0b000 // 1447 // // 1448 // REGS_IDX // 1449 // ============================================ // 1450 // RESERVED | X | // 1451 // (4 bits) | (3 bits) | // 1452 // ============================================ // 1453 // // 1454 // X : REGISTER INDEX // 1455 // // 1456 // For WRITE MISS error signaling: FUNC = 0x010 // 1457 // // 1458 // REGS_IDX // 1459 // ============================================ // 1460 // RESERVED | X | // 1461 // (4 bits) | (3 bits) | // 1462 // ============================================ // 1463 // // 1464 // X : REGISTER INDEX // 1465 // // 1466 /////////////////////////////////////////////////////////// 1467 1468 addr_t addr_lsb = p_vci_tgt.address.read() & 1469 m_config_addr_mask; 1470 1471 addr_t cell = (addr_lsb / vci_param_int::B); 1472 1473 size_t regr = cell & 1474 m_config_regr_idx_mask; 1475 1476 size_t func = (cell >> m_config_regr_width) & 1477 m_config_func_idx_mask; 1478 1479 bool need_rsp; 1480 int error; 1481 uint32_t rdata = 0; // default value 1482 uint32_t wdata = p_vci_tgt.wdata.read(); 1483 1484 switch(func) 1485 { 1486 // memory operation 1487 case MEMC_CONFIG: 1488 { 1489 if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) // get lock 1490 and (regr == MEMC_LOCK)) 1491 { 1492 rdata = (uint32_t) r_config_lock.read(); 1493 need_rsp = true; 1494 error = 0; 1495 r_config_lock = true; 1496 } 1497 else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // release lock 1498 and (regr == MEMC_LOCK)) 1499 { 1500 need_rsp = true; 1501 error = 0; 1502 r_config_lock = false; 1503 } 1504 else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set addr_lo 1505 and (regr == MEMC_ADDR_LO)) 1506 { 1507 assert( ((wdata % (m_words * vci_param_int::B)) == 0) and 1508 "VCI_MEM_CACHE CONFIG ERROR: The buffer must be aligned on a cache line"); 1509 1510 need_rsp = true; 1511 error = 0; 1512 r_config_address = (r_config_address.read() & 0xFFFFFFFF00000000LL) | 1513 ((addr_t)wdata); 1514 } 1515 else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set addr_hi 1516 and (regr == MEMC_ADDR_HI)) 1517 1518 { 1519 need_rsp = true; 1520 error = 0; 1521 r_config_address = (r_config_address.read() & 0x00000000FFFFFFFFLL) | 1522 (((addr_t) wdata) << 32); 1523 } 1524 else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set buf_lines 1525 and (regr == MEMC_BUF_LENGTH)) 1526 { 1527 need_rsp = true; 1528 error = 0; 1529 size_t lines = wdata / (m_words << 2); 1530 if (wdata % (m_words << 2)) lines++; 1531 r_config_cmd_lines = lines; 1532 r_config_rsp_lines = 0; 1533 } 1534 else if ((p_vci_tgt.cmd.read() == vci_param_int::CMD_WRITE) // set cmd type 1535 and (regr == MEMC_CMD_TYPE)) 1536 { 1537 need_rsp = false; 1538 error = 0; 1539 r_config_cmd = wdata; 1540 1541 // prepare delayed response from CONFIG FSM 1542 r_config_srcid = p_vci_tgt.srcid.read(); 1543 r_config_trdid = p_vci_tgt.trdid.read(); 1544 r_config_pktid = p_vci_tgt.pktid.read(); 1545 } 1546 else 1547 { 1548 need_rsp = true; 1549 error = 1; 1550 } 1551 1552 break; 1553 } 1554 1555 // instrumentation registers 1556 case MEMC_INSTRM: 1557 { 1558 need_rsp = true; 1559 1560 if (p_vci_tgt.cmd.read() == vci_param_int::CMD_READ) 1561 { 1562 error = read_instrumentation(regr, rdata); 1563 } 1564 else 1565 { 1566 error = 1; 1567 } 1568 1569 break; 1570 } 1571 1572 //unknown function 1573 default: 1574 { 1575 need_rsp = true; 1576 error = 1; 1577 1578 break; 1579 } 1580 } 1581 1582 if (need_rsp) 1583 { 1584 // blocked if previous pending request to TGT_RSP FSM 1585 if (r_tgt_cmd_to_tgt_rsp_req.read()) break; 1586 1587 r_tgt_cmd_to_tgt_rsp_srcid = p_vci_tgt.srcid.read(); 1588 r_tgt_cmd_to_tgt_rsp_trdid = p_vci_tgt.trdid.read(); 1589 r_tgt_cmd_to_tgt_rsp_pktid = p_vci_tgt.pktid.read(); 1590 r_tgt_cmd_to_tgt_rsp_req = true; 1591 r_tgt_cmd_to_tgt_rsp_error = error; 1592 r_tgt_cmd_to_tgt_rsp_rdata = rdata; 1593 } 1594 1595 r_tgt_cmd_fsm = TGT_CMD_IDLE; 1596 1597 #if DEBUG_MEMC_TGT_CMD 1598 if (m_debug) 1599 std::cout << " <MEMC " << name() << " TGT_CMD_CONFIG> Configuration request:" 1600 << " address = " << std::hex << p_vci_tgt.address.read() 1601 << " / func = " << func 1602 << " / regr = " << regr 1603 << " / rdata = " << rdata 1604 << " / wdata = " << p_vci_tgt.wdata.read() 1605 << " / need_rsp = " << need_rsp 1606 << " / error = " << error << std::endl; 1607 #endif 1608 break; 1609 } 1610 1611 #if 0 1612 case TGT_CMD_CONFIG: // execute config request and return response 1613 { 1310 1614 addr_t seg_base = m_seg[m_seg_config]->baseAddress(); 1311 1615 addr_t address = p_vci_tgt.address.read(); … … 1405 1709 break; 1406 1710 } 1711 #endif // #if 0 1407 1712 ////////////////// 1408 1713 case TGT_CMD_READ: // Push a read request into read fifo … … 7191 7496 if (is_local_req(m_config_to_cc_send_srcid_fifo.read())) 7192 7497 { 7193 m_cpt_m _inval_local++;7498 m_cpt_minval_local++; 7194 7499 } 7195 7500 else 7196 7501 { 7197 m_cpt_m _inval_remote++;7198 m_cpt_m _inval_cost += req_distance(m_config_to_cc_send_srcid_fifo.read());7502 m_cpt_minval_remote++; 7503 m_cpt_minval_cost += req_distance(m_config_to_cc_send_srcid_fifo.read()); 7199 7504 } 7200 7505 // </Activity Counters> … … 7204 7509 if(r_config_to_cc_send_multi_req.read()) r_config_to_cc_send_multi_req = false; 7205 7510 // <Activity Counters> 7206 m_cpt_m _inval++;7511 m_cpt_minval++; 7207 7512 // </Activity Counters> 7208 7513 r_cc_send_fsm = CC_SEND_CONFIG_IDLE; … … 7236 7541 if(not p_dspin_m2p.read) break; 7237 7542 // <Activity Counters> 7238 m_cpt_b r_inval++;7543 m_cpt_binval++; 7239 7544 // </Activity Counters> 7240 7545 r_config_to_cc_send_brdcast_req = false; … … 7258 7563 if (is_local_req(m_xram_rsp_to_cc_send_srcid_fifo.read())) 7259 7564 { 7260 m_cpt_m _inval_local++;7565 m_cpt_minval_local++; 7261 7566 } 7262 7567 else 7263 7568 { 7264 m_cpt_m _inval_remote++;7265 m_cpt_m _inval_cost += req_distance(m_xram_rsp_to_cc_send_srcid_fifo.read());7569 m_cpt_minval_remote++; 7570 m_cpt_minval_cost += req_distance(m_xram_rsp_to_cc_send_srcid_fifo.read()); 7266 7571 } 7267 7572 // </Activity Counters> … … 7271 7576 if(r_xram_rsp_to_cc_send_multi_req.read()) r_xram_rsp_to_cc_send_multi_req = false; 7272 7577 // <Activity Counters> 7273 m_cpt_m _inval++;7578 m_cpt_minval++; 7274 7579 // </Activity Counters> 7275 7580 r_cc_send_fsm = CC_SEND_XRAM_RSP_IDLE; … … 7303 7608 if(not p_dspin_m2p.read) break; 7304 7609 // <Activity Counters> 7305 m_cpt_b r_inval++;7610 m_cpt_binval++; 7306 7611 // </Activity Counters> 7307 7612 r_xram_rsp_to_cc_send_brdcast_req = false; … … 7388 7693 7389 7694 // <Activity Counters> 7390 m_cpt_b r_inval++;7695 m_cpt_binval++; 7391 7696 // </Activity Counters> 7392 7697 … … 7477 7782 if(not p_dspin_m2p.read) break; 7478 7783 // <Activity Counters> 7479 m_cpt_b r_inval++;7784 m_cpt_binval++; 7480 7785 // </Activity Counters> 7481 7786
Note: See TracChangeset
for help on using the changeset viewer.