Changeset 119
- Timestamp:
- Dec 6, 2010, 6:12:46 AM (14 years ago)
- Location:
- trunk/modules
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source/include/vci_cc_vcache_wrapper2_v1.h
r88 r119 68 68 ICACHE_TLB1_READ, // 02 69 69 ICACHE_TLB1_WRITE, // 03 70 ICACHE_TLB1_UPDT, // 04 71 ICACHE_TLB2_READ, // 05 72 ICACHE_TLB2_WRITE, // 06 73 ICACHE_TLB2_UPDT, // 07 74 ICACHE_SW_FLUSH, // 08 75 ICACHE_TLB_FLUSH, // 09 76 ICACHE_CACHE_FLUSH, // 0a 77 ICACHE_TLB_INVAL, // 0b 78 ICACHE_CACHE_INVAL, // 0c 79 ICACHE_CACHE_INVAL_PA, // 0d 80 ICACHE_MISS_WAIT, // 0e 81 ICACHE_UNC_WAIT, // 0f 82 ICACHE_MISS_UPDT, // 10 83 ICACHE_ERROR, // 11 84 ICACHE_CC_INVAL, // 12 85 ICACHE_TLB_CC_INVAL, // 13 70 ICACHE_TLB1_UPDT_SEL, // 04 71 ICACHE_TLB1_UPDT, // 05 72 ICACHE_TLB2_READ, // 06 73 ICACHE_TLB2_WRITE, // 07 74 ICACHE_TLB2_UPDT_SEL, // 08 75 ICACHE_TLB2_UPDT, // 09 76 ICACHE_SW_FLUSH, // 0a 77 ICACHE_TLB_FLUSH, // 0b 78 ICACHE_CACHE_FLUSH, // 0c 79 ICACHE_TLB_INVAL, // 0d 80 ICACHE_CACHE_INVAL, // 0e 81 ICACHE_CACHE_INVAL_PA, // 0f 82 ICACHE_MISS_WAIT, // 10 83 ICACHE_UNC_WAIT, // 11 84 ICACHE_MISS_UPDT, // 12 85 ICACHE_ERROR, // 13 86 ICACHE_CC_INVAL, // 14 87 ICACHE_TLB_CC_INVAL, // 15 86 88 }; 87 89 … … 94 96 DCACHE_TLB1_READ, // 05 95 97 DCACHE_TLB1_READ_UPDT, // 06 96 DCACHE_TLB1_UPDT, // 07 97 DCACHE_DTLB2_READ_CACHE, // 08 98 DCACHE_TLB2_LL_WAIT, // 09 99 DCACHE_TLB2_SC_WAIT, // 0a 100 DCACHE_TLB2_READ, // 0b 101 DCACHE_TLB2_READ_UPDT, // 0c 102 DCACHE_TLB2_UPDT, // 0d 103 DCACHE_CTXT_SWITCH, // 0e 104 DCACHE_ICACHE_FLUSH, // 0f 105 DCACHE_DCACHE_FLUSH, // 10 106 DCACHE_ITLB_INVAL, // 11 107 DCACHE_DTLB_INVAL, // 12 108 DCACHE_ICACHE_INVAL, // 13 109 DCACHE_DCACHE_INVAL, // 14 110 DCACHE_ICACHE_INVAL_PA, // 15 111 DCACHE_DCACHE_INVAL_PA, // 16 112 DCACHE_DCACHE_SYNC, // 17 113 DCACHE_LL_DIRTY_WAIT, // 18 114 DCACHE_SC_DIRTY_WAIT, // 19 115 DCACHE_WRITE_UPDT, // 1a 116 DCACHE_WRITE_DIRTY, // 1b 117 DCACHE_WRITE_REQ, // 1c 118 DCACHE_MISS_WAIT, // 1d 119 DCACHE_MISS_UPDT, // 1e 120 DCACHE_UNC_WAIT, // 1f 121 DCACHE_ERROR, // 20 122 DCACHE_ITLB_READ, // 21 123 DCACHE_ITLB_UPDT, // 22 124 DCACHE_ITLB_LL_WAIT, // 23 125 DCACHE_ITLB_SC_WAIT, // 24 126 DCACHE_CC_CHECK, // 25 127 DCACHE_CC_INVAL, // 26 128 DCACHE_CC_UPDT, // 27 129 DCACHE_CC_NOP, // 28 130 DCACHE_TLB_CC_INVAL, // 29 131 DCACHE_ITLB_CLEANUP, // 2a 98 DCACHE_TLB1_UPDT_SEL, // 07 99 DCACHE_TLB1_UPDT, // 08 100 DCACHE_DTLB2_READ_CACHE, // 09 101 DCACHE_TLB2_LL_WAIT, // 0a 102 DCACHE_TLB2_SC_WAIT, // 0b 103 DCACHE_TLB2_READ, // 0c 104 DCACHE_TLB2_READ_UPDT, // 0d 105 DCACHE_TLB2_UPDT_SEL, // 0e 106 DCACHE_TLB2_UPDT, // 0f 107 DCACHE_CTXT_SWITCH, // 10 108 DCACHE_ICACHE_FLUSH, // 11 109 DCACHE_DCACHE_FLUSH, // 12 110 DCACHE_ITLB_INVAL, // 13 111 DCACHE_DTLB_INVAL, // 14 112 DCACHE_ICACHE_INVAL, // 15 113 DCACHE_DCACHE_INVAL, // 16 114 DCACHE_ICACHE_INVAL_PA, // 17 115 DCACHE_DCACHE_INVAL_PA, // 18 116 DCACHE_DCACHE_SYNC, // 19 117 DCACHE_LL_DIRTY_WAIT, // 1a 118 DCACHE_SC_DIRTY_WAIT, // 1b 119 DCACHE_WRITE_UPDT, // 1c 120 DCACHE_WRITE_DIRTY, // 1d 121 DCACHE_WRITE_REQ, // 1e 122 DCACHE_MISS_WAIT, // 1f 123 DCACHE_MISS_UPDT, // 20 124 DCACHE_UNC_WAIT, // 21 125 DCACHE_ERROR, // 22 126 DCACHE_ITLB_READ, // 23 127 DCACHE_ITLB_UPDT, // 24 128 DCACHE_ITLB_LL_WAIT, // 25 129 DCACHE_ITLB_SC_WAIT, // 26 130 DCACHE_CC_CHECK, // 27 131 DCACHE_CC_INVAL, // 28 132 DCACHE_CC_UPDT, // 29 133 DCACHE_CC_NOP, // 2a 134 DCACHE_TLB_CC_INVAL, // 2b 135 DCACHE_ITLB_CLEANUP, // 2c 132 136 }; 133 137 -
trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source/src/vci_cc_vcache_wrapper2_v1.cpp
r108 r119 40 40 "ICACHE_BIS", 41 41 "ICACHE_TLB1_READ", 42 "ICACHE_TLB1_WRITE", 42 "ICACHE_TLB1_WRITE", 43 "ICACHE_TLB1_UPDT_SEL", 43 44 "ICACHE_TLB1_UPDT", 44 45 "ICACHE_TLB2_READ", 45 "ICACHE_TLB2_WRITE", 46 "ICACHE_TLB2_WRITE", 47 "ICACHE_TLB2_UPDT_SEL", 46 48 "ICACHE_TLB2_UPDT", 47 49 "ICACHE_SW_FLUSH", … … 65 67 "DCACHE_TLB1_SC_WAIT", 66 68 "DCACHE_TLB1_READ", 67 "DCACHE_TLB1_READ_UPDT", 69 "DCACHE_TLB1_READ_UPDT", 70 "DCACHE_TLB1_UPDT_SEL", 68 71 "DCACHE_TLB1_UPDT", 69 72 "DCACHE_DTLB2_READ_CACHE", … … 72 75 "DCACHE_TLB2_READ", 73 76 "DCACHE_TLB2_READ_UPDT", 77 "DCACHE_TLB2_UPDT_SEL", 74 78 "DCACHE_TLB2_UPDT", 75 79 "DCACHE_CTXT_SWITCH", … … 1117 1121 if ( !icache_hit_c ) 1118 1122 { 1119 m_cpt_ins_miss++;1120 m_cost_ins_miss_frz++;1121 1123 if ( icache_cached ) 1122 1124 { … … 1125 1127 r_icache_vaddr_req = ireq.addr; 1126 1128 r_icache_fsm = ICACHE_MISS_WAIT; 1129 m_cpt_ins_miss++; 1130 m_cost_ins_miss_frz++; 1127 1131 } 1128 1132 else … … 1150 1154 case ICACHE_BIS: 1151 1155 { 1156 if ( ireq.valid ) m_cost_ins_miss_frz++; 1157 1152 1158 // external cache invalidate request 1153 1159 if ( r_tgt_icache_req ) 1154 1160 { 1155 if ( ireq.valid ) m_cost_ins_miss_frz++;1156 1161 r_icache_fsm = ICACHE_CC_INVAL; 1157 1162 r_icache_fsm_save = r_icache_fsm; … … 1162 1167 if ( r_dcache_itlb_inval_req ) 1163 1168 { 1164 if ( ireq.valid ) m_cost_ins_miss_frz++;1165 1169 r_itlb_inval_req = true; 1166 1170 r_icache_fsm = ICACHE_TLB_CC_INVAL; … … 1172 1176 if ( r_icache_inval_tlb_rsp ) 1173 1177 { 1174 if ( ireq.valid ) m_cost_ins_miss_frz++;1175 1178 r_icache_inval_tlb_rsp = false; 1176 1179 r_icache_fsm = ICACHE_IDLE; … … 1284 1287 { 1285 1288 r_icache_pte_update = r_dcache_rsp_itlb_miss; 1286 r_icache_fsm = ICACHE_TLB1_UPDT ;1289 r_icache_fsm = ICACHE_TLB1_UPDT_SEL; 1287 1290 } 1288 1291 else … … 1300 1303 { 1301 1304 r_icache_pte_update = r_dcache_rsp_itlb_miss; 1302 r_icache_fsm = ICACHE_TLB1_UPDT ;1305 r_icache_fsm = ICACHE_TLB1_UPDT_SEL; 1303 1306 } 1304 1307 else … … 1377 1380 else 1378 1381 { 1379 r_icache_fsm = ICACHE_TLB1_UPDT ;1382 r_icache_fsm = ICACHE_TLB1_UPDT_SEL; 1380 1383 } 1381 1384 } … … 1405 1408 } 1406 1409 ////////////////////// 1407 case ICACHE_TLB1_UPDT :1410 case ICACHE_TLB1_UPDT_SEL: 1408 1411 { 1409 1412 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1413 m_cost_ins_tlb_update_acc_frz++; 1410 1414 1411 1415 // external cache invalidate request … … 1426 1430 } 1427 1431 1428 // TLB update and invalidate different PTE1429 if ( !r_dcache_itlb_cleanup_req && !r_icache_inval_tlb_rsp )1430 {1431 paddr_t victim_index = 0;1432 r_dcache_itlb_cleanup_req = icache_tlb.update(r_icache_pte_update,r_icache_vaddr_req.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index);1433 r_dcache_itlb_cleanup_line = victim_index;1434 m_cpt_cc_cleanup_ins++;1435 r_icache_fsm = ICACHE_IDLE;1436 }1437 1438 1432 // TLB update and invalidate same PTE 1439 1433 if ( r_icache_inval_tlb_rsp ) … … 1441 1435 r_icache_inval_tlb_rsp = false; 1442 1436 r_icache_fsm = ICACHE_IDLE; 1443 } 1437 break; 1438 } 1439 1440 if ( r_dcache_itlb_cleanup_req ) break; 1441 1442 size_t way = 0; 1443 size_t set = 0; 1444 paddr_t victim_index = 0; 1445 1446 bool cleanup = icache_tlb.select((r_icache_vaddr_req.read()>> PAGE_M_NBITS),&victim_index,&way,&set); 1447 r_icache_way = way; 1448 r_icache_set = set; 1449 if (cleanup) 1450 { 1451 r_dcache_itlb_cleanup_req = true; 1452 r_dcache_itlb_cleanup_line = victim_index; 1453 m_cpt_cc_cleanup_ins++; 1454 } 1455 r_icache_fsm = ICACHE_TLB1_UPDT; 1456 break; 1457 } 1458 ///////////////////// 1459 case ICACHE_TLB1_UPDT: 1460 { 1461 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1462 m_cost_ins_tlb_update_acc_frz++; 1463 1464 icache_tlb.update(r_icache_pte_update,r_icache_vaddr_req.read(),r_icache_way.read(),r_icache_set.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2))); 1465 r_icache_fsm = ICACHE_IDLE; 1444 1466 break; 1445 1467 } … … 1494 1516 if ( (r_dcache_rsp_itlb_miss & PTE_L_MASK ) >> PTE_L_SHIFT ) // L bit is set 1495 1517 { 1496 r_icache_fsm = ICACHE_TLB2_UPDT ;1518 r_icache_fsm = ICACHE_TLB2_UPDT_SEL; 1497 1519 r_icache_pte_update = r_dcache_rsp_itlb_miss; 1498 1520 } … … 1510 1532 if ( (r_dcache_rsp_itlb_miss & PTE_R_MASK ) >> PTE_R_SHIFT ) // R bit is set 1511 1533 { 1512 r_icache_fsm = ICACHE_TLB2_UPDT ;1534 r_icache_fsm = ICACHE_TLB2_UPDT_SEL; 1513 1535 r_icache_pte_update = r_dcache_rsp_itlb_miss; 1514 1536 } … … 1588 1610 else 1589 1611 { 1590 r_icache_fsm = ICACHE_TLB2_UPDT ;1612 r_icache_fsm = ICACHE_TLB2_UPDT_SEL; 1591 1613 } 1592 1614 } … … 1615 1637 break; 1616 1638 } 1617 ///////////////////// 1618 case ICACHE_TLB2_UPDT :1639 ////////////////////////// 1640 case ICACHE_TLB2_UPDT_SEL: 1619 1641 { 1620 1642 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1643 m_cost_ins_tlb_update_acc_frz++; 1621 1644 1622 1645 // external cache invalidate request … … 1637 1660 } 1638 1661 1639 // TLB update and invalidate different PTE1640 if ( !r_dcache_itlb_cleanup_req && !r_icache_inval_tlb_rsp )1641 {1642 paddr_t victim_index = 0;1643 r_dcache_itlb_cleanup_req = icache_tlb.update(r_icache_pte_update,r_dcache_rsp_itlb_ppn,r_icache_vaddr_req.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index);1644 r_dcache_itlb_cleanup_line = victim_index;1645 m_cpt_cc_cleanup_ins++;1646 r_icache_fsm = ICACHE_IDLE;1647 }1648 1662 // TLB update and invalidate same PTE 1649 1663 if ( r_icache_inval_tlb_rsp ) … … 1651 1665 r_icache_inval_tlb_rsp = false; 1652 1666 r_icache_fsm = ICACHE_IDLE; 1653 } 1654 break; 1667 break; 1668 } 1669 1670 if ( r_dcache_itlb_cleanup_req ) break; 1671 1672 size_t way = 0; 1673 size_t set = 0; 1674 paddr_t victim_index = 0; 1675 1676 bool cleanup = icache_tlb.select((r_icache_vaddr_req.read()>> PAGE_K_NBITS),&victim_index,&way,&set); 1677 r_icache_way = way; 1678 r_icache_set = set; 1679 if (cleanup) 1680 { 1681 r_dcache_itlb_cleanup_req = true; 1682 r_dcache_itlb_cleanup_line = victim_index; 1683 m_cpt_cc_cleanup_ins++; 1684 } 1685 r_icache_fsm = ICACHE_TLB2_UPDT; 1686 break; 1687 } 1688 ///////////////////// 1689 case ICACHE_TLB2_UPDT: 1690 { 1691 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1692 m_cost_ins_tlb_update_acc_frz++; 1693 1694 icache_tlb.update(r_icache_pte_update,r_dcache_rsp_itlb_ppn,r_icache_vaddr_req.read(),r_icache_way.read(),r_icache_set.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2))); 1695 r_icache_fsm = ICACHE_IDLE; 1696 break; 1655 1697 } 1656 1698 ///////////////////////////// … … 1988 2030 1989 2031 r_icache_cleanup_req = r_icache.update(r_icache_paddr_save.read(), buf, &victim_index); 1990 r_icache_cleanup_line = victim_index; m_cpt_cc_cleanup_ins++; 2032 r_icache_cleanup_line = victim_index; 2033 m_cpt_cc_cleanup_ins++; 1991 2034 r_icache_fsm = ICACHE_IDLE; 1992 2035 } … … 2014 2057 m_cost_ins_miss_frz++; 2015 2058 } 2016 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ )||2017 ( r_icache_fsm_save == ICACHE_TLB1_WRITE ) || ( r_icache_fsm_save == ICACHE_TLB2_WRITE )||2018 ( r_icache_fsm_save == ICACHE_TLB1_UPDT ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT ))&& (ireq.valid) )2059 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ ) || 2060 ( r_icache_fsm_save == ICACHE_TLB1_WRITE ) || ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) || 2061 ( r_icache_fsm_save == ICACHE_TLB1_UPDT_SEL ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT_SEL )) && (ireq.valid) ) 2019 2062 { 2020 2063 m_cost_ins_tlb_miss_frz++; … … 2045 2088 m_cost_ins_miss_frz++; 2046 2089 } 2047 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ )||2048 ( r_icache_fsm_save == ICACHE_TLB1_WRITE ) || ( r_icache_fsm_save == ICACHE_TLB2_WRITE )||2049 ( r_icache_fsm_save == ICACHE_TLB1_UPDT ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT ))&& (ireq.valid) )2090 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ ) || 2091 ( r_icache_fsm_save == ICACHE_TLB1_WRITE ) || ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) || 2092 ( r_icache_fsm_save == ICACHE_TLB1_UPDT_SEL ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT_SEL )) && (ireq.valid) ) 2050 2093 { 2051 2094 m_cost_ins_tlb_miss_frz++; … … 2054 2097 if ( r_itlb_inval_req ) break; 2055 2098 // invalidate cache 2056 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ ) ||2057 ( r_icache_fsm_save == ICACHE_TLB1_WRITE ) || ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) ||2058 ( r_icache_fsm_save == ICACHE_TLB1_UPDT ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT)) &&2099 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ ) || 2100 ( r_icache_fsm_save == ICACHE_TLB1_WRITE ) || ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) || 2101 ( r_icache_fsm_save == ICACHE_TLB1_UPDT_SEL ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT_SEL )) && 2059 2102 (((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) >> (uint32_log2(m_icache_words) + 2) ) == r_dcache_itlb_inval_line.read()) ) 2060 2103 { … … 2074 2117 } 2075 2118 } // end switch r_icache_fsm 2076 2077 2119 #ifdef SOCLIB_MODULE_DEBUG 2078 2120 std::cout << name() << " Instruction Response: " << irsp << std::endl; … … 2293 2335 else if ( r_itlb_acc_dcache_req ) // ins tlb write access bit 2294 2336 { 2337 if ( dreq.valid ) m_cost_ins_tlb_occup_cache_frz++; 2338 2295 2339 data_t rsp_itlb_miss; 2296 2340 bool itlb_hit_dcache = r_dcache.read(r_icache_paddr_save, &rsp_itlb_miss); … … 2765 2809 } 2766 2810 break; 2767 /*2768 case iss_t::DATA_READ:2769 m_cpt_read++;2770 if ( dcache_hit_c )2771 {2772 r_dcache_buf_unc_valid = false;2773 r_dcache_fsm = DCACHE_IDLE;2774 drsp.valid = true;2775 drsp.rdata = dcache_rdata;2776 }2777 else2778 {2779 if ( dcache_cached )2780 {2781 r_dcache_miss_req = true;2782 r_dcache_fsm = DCACHE_MISS_WAIT;2783 m_cpt_data_miss++;2784 m_cost_data_miss_frz++;2785 }2786 else2787 {2788 r_dcache_unc_req = true;2789 r_dcache_fsm = DCACHE_UNC_WAIT;2790 m_cpt_unc_read++;2791 m_cost_unc_read_frz++;2792 }2793 }2794 break;2795 case iss_t::DATA_LL:2796 if (r_dcache_llsc_reserved && (r_dcache_llsc_addr_save == tlb_dpaddr) && r_dcache_buf_unc_valid)2797 {2798 r_dcache_buf_unc_valid = false;2799 r_dcache_fsm = DCACHE_IDLE;2800 drsp.valid = true;2801 drsp.rdata = dcache_rdata;2802 }2803 else2804 {2805 r_dcache_llsc_reserved = true;2806 r_dcache_llsc_addr_save = tlb_dpaddr;2807 r_dcache_unc_req = true;2808 r_dcache_fsm = DCACHE_UNC_WAIT;2809 }2810 break;2811 case iss_t::DATA_SC:2812 if (r_dcache_llsc_reserved && (r_dcache_llsc_addr_save == tlb_dpaddr))2813 {2814 r_dcache_llsc_reserved = false;2815 r_dcache_unc_req = true;2816 r_dcache_fsm = DCACHE_UNC_WAIT;2817 }2818 else2819 {2820 if ( r_dcache_buf_unc_valid )2821 {2822 r_dcache_llsc_reserved = false;2823 r_dcache_buf_unc_valid = false;2824 drsp.valid = true;2825 drsp.rdata = dcache_rdata;2826 }2827 r_dcache_fsm = DCACHE_IDLE;2828 }2829 break;2830 */2831 2811 case iss_t::DATA_WRITE: 2832 2812 m_cpt_write++; … … 2918 2898 case DCACHE_BIS: 2919 2899 { 2900 if ( dreq.valid ) m_cost_data_miss_frz++; 2901 2920 2902 // external cache invalidate request 2921 2903 if ( r_tgt_dcache_req ) … … 2923 2905 r_dcache_fsm = DCACHE_CC_CHECK; 2924 2906 r_dcache_fsm_save = r_dcache_fsm; 2925 if ( dreq.valid ) m_cost_data_miss_frz++;2926 2907 break; 2927 2908 } … … 2932 2913 r_dcache_inval_tlb_rsp = false; 2933 2914 r_dcache_fsm = DCACHE_IDLE; 2934 if ( dreq.valid ) m_cost_data_miss_frz++;2935 2915 break; 2936 2916 } … … 3228 3208 r_dcache_tlb_ll_dirty_req = true; 3229 3209 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 3230 //m_cpt_dcache_data_write++;3231 3210 m_cpt_data_tlb_update_dirty++; 3232 3211 m_cost_data_tlb_update_dirty_frz++; … … 3251 3230 { 3252 3231 r_dcache_pte_update = tlb_data; 3253 r_dcache_fsm = DCACHE_TLB1_UPDT ;3232 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3254 3233 } 3255 3234 else … … 3267 3246 { 3268 3247 r_dcache_pte_update = tlb_data; 3269 r_dcache_fsm = DCACHE_TLB1_UPDT ;3248 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3270 3249 } 3271 3250 else … … 3292 3271 { 3293 3272 if ( dreq.valid ) m_cost_data_tlb_miss_frz++; 3294 m_cost_data_tlb_update_acc_frz++; 3273 m_cost_data_tlb_update_acc_frz++; 3274 3295 3275 // external cache invalidate request 3296 3276 if ( r_tgt_dcache_req ) … … 3414 3394 bool write_hit = r_dcache.write(r_dcache_tlb_paddr,r_dcache_pte_update); 3415 3395 assert(write_hit && "Write on miss ignores data for data MMU update data access bit"); 3416 r_dcache_fsm = DCACHE_TLB1_UPDT ;3396 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3417 3397 m_cpt_dcache_data_write++; 3418 3398 } … … 3579 3559 r_dcache_tlb_ll_dirty_req = true; 3580 3560 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 3581 //m_cpt_dcache_data_write++;3582 3561 m_cpt_data_tlb_update_dirty++; 3583 3562 m_cost_data_tlb_update_dirty_frz++; … … 3601 3580 { 3602 3581 r_dcache_pte_update = rsp_dtlb_miss; 3603 r_dcache_fsm = DCACHE_TLB1_UPDT ;3582 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3604 3583 } 3605 3584 else … … 3617 3596 { 3618 3597 r_dcache_pte_update = rsp_dtlb_miss; 3619 r_dcache_fsm = DCACHE_TLB1_UPDT ;3598 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3620 3599 } 3621 3600 else … … 3632 3611 break; 3633 3612 } 3634 ////////////////////// 3635 case DCACHE_TLB1_UPDT :3613 ///////////////////////// 3614 case DCACHE_TLB1_UPDT_SEL: 3636 3615 { 3637 3616 m_cost_data_tlb_miss_frz++; 3638 3617 m_cost_data_tlb_update_acc_frz++; 3618 3639 3619 // external cache invalidate request 3640 3620 if ( r_tgt_dcache_req ) … … 3647 3627 if ( !r_dcache_inval_tlb_rsp && !r_dcache_inval_rsp ) 3648 3628 { 3629 size_t way = 0; 3630 size_t set = 0; 3649 3631 paddr_t victim_index = 0; 3650 if (dcache_tlb.update(r_dcache_pte_update,dreq.addr,(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index)) 3651 { 3652 r_dcache.setinbit((paddr_t)victim_index << (uint32_log2(m_dcache_words)+2), r_dcache_in_dtlb, false); 3653 } 3654 bool set_hit = r_dcache.setinbit(r_dcache_tlb_paddr, r_dcache_in_dtlb, true); 3655 assert(set_hit && "TLB1_UPDT set hit error"); 3656 r_dcache_fsm = DCACHE_IDLE; 3632 bool cleanup = dcache_tlb.select((dreq.addr >> PAGE_M_NBITS),&victim_index,&way,&set); 3633 if (cleanup) 3634 { 3635 r_dcache_dtlb_cleanup_req = true; 3636 r_dcache_dtlb_cleanup_line = victim_index; 3637 m_cpt_cc_cleanup_data++; 3638 } 3639 r_dcache_way = way; 3640 r_dcache_set = set; 3641 r_dcache_fsm = DCACHE_TLB1_UPDT; 3657 3642 } 3658 3643 else … … 3663 3648 } 3664 3649 break; 3650 } 3651 ////////////////////// 3652 case DCACHE_TLB1_UPDT: 3653 { 3654 m_cost_data_tlb_miss_frz++; 3655 m_cost_data_tlb_update_acc_frz++; 3656 3657 if (r_dcache_dtlb_cleanup_req) r_dcache.setinbit(r_dcache_dtlb_cleanup_line.read() << (uint32_log2(m_dcache_words)+2), r_dcache_in_dtlb, false); 3658 bool set_hit = r_dcache.setinbit(r_dcache_tlb_paddr, r_dcache_in_dtlb, true); 3659 assert(set_hit && "TLB1_UPDT set hit error"); 3660 dcache_tlb.update(r_dcache_pte_update,dreq.addr,r_dcache_way.read(),r_dcache_set.read(),(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2))); 3661 r_dcache_fsm = DCACHE_IDLE; 3662 break; 3665 3663 } 3666 3664 ///////////////////////////// … … 3715 3713 r_dcache_pte_update = tlb_data; 3716 3714 r_dcache_ppn_update = tlb_data_ppn; 3717 r_dcache_fsm = DCACHE_TLB2_UPDT ;3715 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3718 3716 } 3719 3717 else … … 3726 3724 r_dcache_pte_update = tlb_data; 3727 3725 r_dcache_ppn_update = tlb_data_ppn; 3728 r_dcache_fsm = DCACHE_TLB2_UPDT ;3726 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3729 3727 } 3730 3728 else … … 3744 3742 r_dcache_pte_update = tlb_data; 3745 3743 r_dcache_ppn_update = tlb_data_ppn; 3746 r_dcache_fsm = DCACHE_TLB2_UPDT ;3744 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3747 3745 } 3748 3746 else … … 3893 3891 bool write_hit = r_dcache.write(r_dcache_tlb_paddr,r_dcache_pte_update); 3894 3892 assert(write_hit && "Write on miss ignores data for data MMU update data access bit"); 3895 r_dcache_fsm = DCACHE_TLB2_UPDT ;3893 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3896 3894 m_cpt_dcache_data_write++; 3897 3895 } … … 4044 4042 r_dcache_pte_update = rsp_dtlb_miss; 4045 4043 r_dcache_ppn_update = tlb_data_ppn; 4046 r_dcache_fsm = DCACHE_TLB2_UPDT ;4044 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 4047 4045 } 4048 4046 else … … 4054 4052 r_dcache_pte_update = rsp_dtlb_miss; 4055 4053 r_dcache_ppn_update = tlb_data_ppn; 4056 r_dcache_fsm = DCACHE_TLB2_UPDT ;4054 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 4057 4055 } 4058 4056 else … … 4072 4070 r_dcache_pte_update = rsp_dtlb_miss; 4073 4071 r_dcache_ppn_update = tlb_data_ppn; 4074 r_dcache_fsm = DCACHE_TLB2_UPDT ;4072 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 4075 4073 } 4076 4074 else … … 4088 4086 break; 4089 4087 } 4090 ////////////////////// 4091 case DCACHE_TLB2_UPDT :4088 ////////////////////////// 4089 case DCACHE_TLB2_UPDT_SEL: 4092 4090 { 4093 4091 m_cost_data_tlb_miss_frz++; 4092 m_cost_data_tlb_update_acc_frz++; 4094 4093 4095 4094 // external cache invalidate request … … 4103 4102 if ( !r_dcache_inval_tlb_rsp && !r_dcache_inval_rsp ) 4104 4103 { 4104 size_t way = 0; 4105 size_t set = 0; 4105 4106 paddr_t victim_index = 0; 4106 if (dcache_tlb.update(r_dcache_pte_update,r_dcache_ppn_update,dreq.addr,(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index)) 4107 { 4108 r_dcache.setinbit((paddr_t)victim_index << (uint32_log2(m_dcache_words)+2), r_dcache_in_dtlb, false); 4109 } 4110 bool set_hit = r_dcache.setinbit(r_dcache_tlb_paddr, r_dcache_in_dtlb, true); 4111 assert(set_hit && "TLB2_UPDT set hit error"); 4112 r_dcache_fsm = DCACHE_IDLE; 4107 bool cleanup = dcache_tlb.select((dreq.addr >> PAGE_K_NBITS),&victim_index,&way,&set); 4108 if (cleanup) 4109 { 4110 r_dcache_dtlb_cleanup_req = true; 4111 r_dcache_dtlb_cleanup_line = victim_index; 4112 m_cpt_cc_cleanup_data++; 4113 } 4114 r_dcache_way = way; 4115 r_dcache_set = set; 4116 r_dcache_fsm = DCACHE_TLB2_UPDT; 4113 4117 } 4114 4118 else … … 4119 4123 } 4120 4124 break; 4125 } 4126 ////////////////////// 4127 case DCACHE_TLB2_UPDT: 4128 { 4129 m_cost_data_tlb_miss_frz++; 4130 m_cost_data_tlb_update_acc_frz++; 4131 4132 if (r_dcache_dtlb_cleanup_req) r_dcache.setinbit(r_dcache_dtlb_cleanup_line.read() << (uint32_log2(m_dcache_words)+2), r_dcache_in_dtlb, false); 4133 bool set_hit = r_dcache.setinbit(r_dcache_tlb_paddr, r_dcache_in_dtlb, true); 4134 assert(set_hit && "TLB2_UPDT set hit error"); 4135 dcache_tlb.update(r_dcache_pte_update,r_dcache_ppn_update,dreq.addr,r_dcache_way.read(),r_dcache_set.read(),(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2))); 4136 r_dcache_fsm = DCACHE_IDLE; 4137 break; 4121 4138 } 4122 4139 /////////////////////// … … 4889 4906 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || 4890 4907 ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT ) || 4891 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT)) && (dreq.valid) )4908 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL )) && (dreq.valid) ) 4892 4909 { 4893 4910 m_cost_data_tlb_miss_frz++; … … 4933 4950 if ( dcache_hit ) 4934 4951 { 4935 if (((( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )||4952 if (((( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL ) || 4936 4953 ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) || 4937 4954 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || … … 4992 5009 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || 4993 5010 ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT ) || 4994 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT)) && (dreq.valid) )5011 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL )) && (dreq.valid) ) 4995 5012 { 4996 5013 m_cost_data_tlb_miss_frz++; … … 5023 5040 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || 5024 5041 ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT ) || 5025 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT)) && (dreq.valid) )5042 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL )) && (dreq.valid) ) 5026 5043 { 5027 5044 m_cost_data_tlb_miss_frz++; … … 5046 5063 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || 5047 5064 ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT ) || 5048 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT)) && (dreq.valid) )5065 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL )) && (dreq.valid) ) 5049 5066 { 5050 5067 m_cost_data_tlb_miss_frz++; … … 5077 5094 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || 5078 5095 ( r_dcache_fsm_save == DCACHE_TLB1_READ_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_READ_UPDT ) || 5079 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT)) && (dreq.valid) )5096 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL )) && (dreq.valid) ) 5080 5097 { 5081 5098 m_cost_data_tlb_miss_frz++; … … 5088 5105 ( r_dcache_fsm_save == DCACHE_TLB1_LL_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_LL_WAIT ) || 5089 5106 ( r_dcache_fsm_save == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save == DCACHE_TLB2_SC_WAIT ) || 5090 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT )||5107 ( r_dcache_fsm_save == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save == DCACHE_TLB2_UPDT_SEL ) || 5091 5108 ( r_dcache_fsm_save == DCACHE_DTLB1_READ_CACHE ) || ( r_dcache_fsm_save == DCACHE_DTLB2_READ_CACHE ) || 5092 5109 ( r_dcache_fsm_save == DCACHE_LL_DIRTY_WAIT ) || ( r_dcache_fsm_save == DCACHE_SC_DIRTY_WAIT ) || … … 6045 6062 6046 6063 } // end switch TGT_FSM 6064 6047 6065 #ifdef SOCLIB_MODULE_DEBUG 6048 6066 std::cout << name() -
trunk/modules/vci_cc_vcache_wrapper_v1/caba/source/include/vci_cc_vcache_wrapper_v1.h
r48 r119 69 69 ICACHE_TLB1_LL_WAIT, // 03 70 70 ICACHE_TLB1_SC_WAIT, // 04 71 ICACHE_TLB1_UPDT, // 05 72 ICACHE_TLB2_READ, // 06 73 ICACHE_TLB2_LL_WAIT, // 07 74 ICACHE_TLB2_SC_WAIT, // 08 75 ICACHE_TLB2_UPDT, // 09 76 ICACHE_TLB_FLUSH, // 0a 77 ICACHE_CACHE_FLUSH, // 0b 78 ICACHE_TLB_INVAL, // 0c 79 ICACHE_CACHE_INVAL, // 0d 80 ICACHE_CACHE_INVAL_PA, // 0e 81 ICACHE_MISS_WAIT, // 0f 82 ICACHE_UNC_WAIT, // 10 83 ICACHE_MISS_UPDT, // 11 84 ICACHE_ERROR, // 12 85 ICACHE_CC_INVAL, // 13 86 ICACHE_TLB_CC_INVAL, // 14 71 ICACHE_TLB1_UPDT_SEL, // 05 72 ICACHE_TLB1_UPDT, // 06 73 ICACHE_TLB2_READ, // 07 74 ICACHE_TLB2_LL_WAIT, // 08 75 ICACHE_TLB2_SC_WAIT, // 09 76 ICACHE_TLB2_UPDT_SEL, // 0a 77 ICACHE_TLB2_UPDT, // 0b 78 ICACHE_TLB_FLUSH, // 0c 79 ICACHE_CACHE_FLUSH, // 0d 80 ICACHE_TLB_INVAL, // 0e 81 ICACHE_CACHE_INVAL, // 0f 82 ICACHE_CACHE_INVAL_PA, // 10 83 ICACHE_MISS_WAIT, // 11 84 ICACHE_UNC_WAIT, // 12 85 ICACHE_MISS_UPDT, // 13 86 ICACHE_ERROR, // 14 87 ICACHE_CC_INVAL, // 15 88 ICACHE_TLB_CC_INVAL, // 16 87 89 }; 88 90 … … 93 95 DCACHE_TLB1_LL_WAIT, // 03 94 96 DCACHE_TLB1_SC_WAIT, // 04 95 DCACHE_TLB1_UPDT, // 05 96 DCACHE_TLB2_READ, // 06 97 DCACHE_TLB2_LL_WAIT, // 07 98 DCACHE_TLB2_SC_WAIT, // 08 99 DCACHE_TLB2_UPDT, // 09 100 DCACHE_CTXT_SWITCH, // 0a 101 DCACHE_ICACHE_FLUSH, // 0b 102 DCACHE_DCACHE_FLUSH, // 0c 103 DCACHE_ITLB_INVAL, // 0d 104 DCACHE_DTLB_INVAL, // 0e 105 DCACHE_ICACHE_INVAL, // 0f 106 DCACHE_DCACHE_INVAL, // 10 107 DCACHE_ICACHE_INVAL_PA, // 0f 108 DCACHE_DCACHE_INVAL_PA, // 10 109 DCACHE_DCACHE_SYNC, // 11 110 DCACHE_LL_DIRTY_WAIT, // 12 111 DCACHE_SC_DIRTY_WAIT, // 13 112 DCACHE_WRITE_UPDT, // 14 113 DCACHE_WRITE_DIRTY, // 15 114 DCACHE_WRITE_REQ, // 16 115 DCACHE_MISS_WAIT, // 17 116 DCACHE_MISS_UPDT, // 18 117 DCACHE_UNC_WAIT, // 19 118 DCACHE_ERROR, // 1a 119 DCACHE_CC_CHECK, // 1b 120 DCACHE_CC_INVAL, // 1c 121 DCACHE_CC_UPDT, // 1d 122 DCACHE_CC_NOP, // 1e 123 DCACHE_TLB_CC_INVAL, // 1f 97 DCACHE_TLB1_UPDT_SEL, // 05 98 DCACHE_TLB1_UPDT, // 06 99 DCACHE_TLB2_READ, // 07 100 DCACHE_TLB2_LL_WAIT, // 08 101 DCACHE_TLB2_SC_WAIT, // 09 102 DCACHE_TLB2_UPDT_SEL, // 0a 103 DCACHE_TLB2_UPDT, // 0b 104 DCACHE_CTXT_SWITCH, // 0c 105 DCACHE_ICACHE_FLUSH, // 0d 106 DCACHE_DCACHE_FLUSH, // 0e 107 DCACHE_ITLB_INVAL, // 0f 108 DCACHE_DTLB_INVAL, // 10 109 DCACHE_ICACHE_INVAL, // 11 110 DCACHE_DCACHE_INVAL, // 12 111 DCACHE_ICACHE_INVAL_PA, // 13 112 DCACHE_DCACHE_INVAL_PA, // 14 113 DCACHE_DCACHE_SYNC, // 15 114 DCACHE_LL_DIRTY_WAIT, // 16 115 DCACHE_SC_DIRTY_WAIT, // 17 116 DCACHE_WRITE_UPDT, // 18 117 DCACHE_WRITE_DIRTY, // 19 118 DCACHE_WRITE_REQ, // 1a 119 DCACHE_MISS_WAIT, // 1b 120 DCACHE_MISS_UPDT, // 1c 121 DCACHE_UNC_WAIT, // 1d 122 DCACHE_ERROR, // 1e 123 DCACHE_CC_CHECK, // 1f 124 DCACHE_CC_INVAL, // 20 125 DCACHE_CC_UPDT, // 21 126 DCACHE_CC_NOP, // 22 127 DCACHE_TLB_CC_INVAL, // 23 124 128 }; 125 129 … … 304 308 sc_signal<bool> r_dcache_tlb_sc_acc_req; // used for tlb entry type update 305 309 sc_signal<bool> r_dcache_tlb_ll_dirty_req; // used for tlb dirty bit update 306 sc_signal<bool> r_dcache_tlb_sc_dirty_req; // used for tlb dirty bit update 310 sc_signal<bool> r_dcache_tlb_sc_dirty_req; // used for tlb dirty bit update 311 sc_signal<bool> r_dcache_sc_updt_dirty; // used for tlb dirty bit update 307 312 sc_signal<bool> r_dcache_tlb_sc_fail; // used for tlb entry sc failed 308 313 sc_signal<bool> r_dcache_tlb_ptba_read; // used for tlb ptba read when write dirty bit -
trunk/modules/vci_cc_vcache_wrapper_v1/caba/source/src/vci_cc_vcache_wrapper_v1.cpp
r104 r119 41 41 "ICACHE_TLB1_LL_WAIT", 42 42 "ICACHE_TLB1_SC_WAIT", 43 "ICACHE_TLB1_UPDT_SEL", 43 44 "ICACHE_TLB1_UPDT", 44 45 "ICACHE_TLB2_READ", 45 46 "ICACHE_TLB2_LL_WAIT", 46 47 "ICACHE_TLB2_SC_WAIT", 48 "ICACHE_TLB2_UPDT_SEL", 47 49 "ICACHE_TLB2_UPDT", 48 50 "ICACHE_TLB_FLUSH", … … 64 66 "DCACHE_TLB1_LL_WAIT", 65 67 "DCACHE_TLB1_SC_WAIT", 68 "DCACHE_TLB1_UPDT_SEL", 66 69 "DCACHE_TLB1_UPDT", 67 70 "DCACHE_TLB2_READ", 68 71 "DCACHE_TLB2_LL_WAIT", 69 72 "DCACHE_TLB2_SC_WAIT", 73 "DCACHE_TLB2_UPDT_SEL", 70 74 "DCACHE_TLB2_UPDT", 71 75 "DCACHE_CTXT_SWITCH", … … 395 399 r_dcache_tlb_ll_dirty_req = false; 396 400 r_dcache_tlb_sc_dirty_req = false; 401 r_dcache_sc_updt_dirty = false; 397 402 r_dcache_tlb_sc_fail = false; 398 403 r_dcache_tlb_ptba_read = false; … … 614 619 615 620 // multi-update or multi-invalidate for data type 616 if ( ( (address &0x3) != 0x3 ) && ( ! m_segment.contains(address)) )621 if ( ( (address&0x3) != 0x3 ) && ( ! m_segment.contains(address)) ) 617 622 { 618 623 std::cout << "error in component VCI_CC_VCACHE_WRAPPER " << name() << std::endl; … … 628 633 (paddr_t)p_vci_tgt.wdata.read() * m_dcache_words * 4; 629 634 630 if ( (address &0x3) == 0x3 ) // broadcast invalidate for data or instruction type635 if ( (address&0x3) == 0x3 ) // broadcast invalidate for data or instruction type 631 636 { 632 637 if ( ! p_vci_tgt.eop.read() ) … … 793 798 case TGT_RSP_ICACHE: 794 799 { 795 if ( (p_vci_tgt.rspack.read() || !r_tgt_icache_rsp.read()) && !r_tgt_icache_req.read() )800 if ( (p_vci_tgt.rspack.read() || !r_tgt_icache_rsp.read()) && !r_tgt_icache_req.read() ) 796 801 { 797 802 r_vci_tgt_fsm = TGT_IDLE; … … 803 808 case TGT_RSP_DCACHE: 804 809 { 805 if ( (p_vci_tgt.rspack.read() || !r_tgt_dcache_rsp.read()) && !r_tgt_dcache_req.read() )810 if ( (p_vci_tgt.rspack.read() || !r_tgt_dcache_rsp.read()) && !r_tgt_dcache_req.read() ) 806 811 { 807 812 r_vci_tgt_fsm = TGT_IDLE; … … 1208 1213 { 1209 1214 r_icache_pte_update = r_icache_miss_buf[0]; 1210 r_icache_fsm = ICACHE_TLB1_UPDT ;1215 r_icache_fsm = ICACHE_TLB1_UPDT_SEL; 1211 1216 } 1212 1217 else … … 1224 1229 { 1225 1230 r_icache_pte_update = r_icache_miss_buf[0]; 1226 r_icache_fsm = ICACHE_TLB1_UPDT ;1231 r_icache_fsm = ICACHE_TLB1_UPDT_SEL; 1227 1232 } 1228 1233 else … … 1356 1361 else 1357 1362 { 1358 r_icache_fsm = ICACHE_TLB1_UPDT ;1363 r_icache_fsm = ICACHE_TLB1_UPDT_SEL; 1359 1364 } 1360 1365 } … … 1362 1367 break; 1363 1368 } 1364 ////////////////////// 1365 case ICACHE_TLB1_UPDT :1369 ////////////////////////// 1370 case ICACHE_TLB1_UPDT_SEL: 1366 1371 { 1367 1372 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; … … 1375 1380 } 1376 1381 1377 // TLB update and invalidate different PTE1378 if ( !r_icache_inval_tlb_rsp && !r_icache_cleanup_req )1379 {1380 paddr_t victim_index = 0;1381 r_icache_cleanup_req = icache_tlb.update1(r_icache_pte_update,r_icache_vaddr_req.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_icache_words)+2)),&victim_index);1382 r_icache_cleanup_line = victim_index;1383 r_icache_cleanup_type = TLB_CLEANUP;1384 m_cpt_cc_cleanup_ins++;1385 r_icache_fsm = ICACHE_IDLE;1386 }1387 1388 1382 // TLB update and invalidate same PTE 1389 1383 if ( r_icache_inval_tlb_rsp ) … … 1392 1386 r_icache_fsm = ICACHE_IDLE; 1393 1387 } 1388 1389 // TLB update and invalidate different PTE 1390 if ( !r_icache_cleanup_req ) 1391 { 1392 size_t way = 0; 1393 size_t set = 0; 1394 paddr_t victim_index = 0; 1395 1396 bool cleanup = icache_tlb.select1((r_icache_vaddr_req.read()>> PAGE_M_NBITS),&victim_index,&way,&set); 1397 r_icache_way = way; 1398 r_icache_set = set; 1399 if (cleanup) 1400 { 1401 r_icache_cleanup_req = true; 1402 r_icache_cleanup_line = victim_index; 1403 r_icache_cleanup_type = TLB_CLEANUP; 1404 m_cpt_cc_cleanup_ins++; 1405 } 1406 r_icache_fsm = ICACHE_TLB1_UPDT; 1407 } 1408 break; 1409 } 1410 ///////////////////// 1411 case ICACHE_TLB1_UPDT: 1412 { 1413 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1414 1415 icache_tlb.update(r_icache_pte_update,r_icache_vaddr_req.read(),r_icache_way.read(),r_icache_set.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_dcache_words)+2))); 1416 r_icache_fsm = ICACHE_IDLE; 1394 1417 break; 1395 1418 } … … 1445 1468 if ( (r_icache_miss_buf[0] & PTE_L_MASK ) >> PTE_L_SHIFT ) // L bit is set 1446 1469 { 1447 r_icache_fsm = ICACHE_TLB2_UPDT ;1470 r_icache_fsm = ICACHE_TLB2_UPDT_SEL; 1448 1471 r_icache_pte_update = r_icache_miss_buf[0]; 1449 1472 } … … 1461 1484 if ( (r_icache_miss_buf[0] & PTE_R_MASK ) >> PTE_R_SHIFT ) // R bit is set 1462 1485 { 1463 r_icache_fsm = ICACHE_TLB2_UPDT ;1486 r_icache_fsm = ICACHE_TLB2_UPDT_SEL; 1464 1487 r_icache_pte_update = r_icache_miss_buf[0]; 1465 1488 } … … 1595 1618 else 1596 1619 { 1597 r_icache_fsm = ICACHE_TLB2_UPDT ;1620 r_icache_fsm = ICACHE_TLB2_UPDT_SEL; 1598 1621 } 1599 1622 } 1600 1623 } 1601 1624 break; 1625 } 1626 ////////////////////////// 1627 case ICACHE_TLB2_UPDT_SEL: 1628 { 1629 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1630 1631 // external cache invalidate request 1632 if ( r_tgt_icache_req ) 1633 { 1634 r_icache_fsm = ICACHE_CC_INVAL; 1635 r_icache_fsm_save = r_icache_fsm; 1636 break; 1637 } 1638 1639 // TLB update and invalidate same PTE 1640 if ( r_icache_inval_tlb_rsp ) 1641 { 1642 r_icache_inval_tlb_rsp = false; 1643 r_icache_fsm = ICACHE_IDLE; 1644 } 1645 1646 // TLB update and invalidate different PTE 1647 if ( !r_icache_cleanup_req ) 1648 { 1649 size_t way = 0; 1650 size_t set = 0; 1651 paddr_t victim_index = 0; 1652 1653 bool cleanup = icache_tlb.select1((r_icache_vaddr_req.read()>> PAGE_K_NBITS),&victim_index,&way,&set); 1654 r_icache_way = way; 1655 r_icache_set = set; 1656 if (cleanup) 1657 { 1658 r_icache_cleanup_req = true; 1659 r_icache_cleanup_line = victim_index; 1660 r_icache_cleanup_type = TLB_CLEANUP; 1661 m_cpt_cc_cleanup_ins++; 1662 } 1663 r_icache_fsm = ICACHE_TLB2_UPDT; 1664 } 1665 1666 break; 1602 1667 } 1603 1668 ///////////////////// 1604 1669 case ICACHE_TLB2_UPDT: 1605 1670 { 1606 if ( ireq.valid ) m_cost_ins_tlb_miss_frz++; 1607 1608 // external cache invalidate request 1609 if ( r_tgt_icache_req ) 1610 { 1611 r_icache_fsm = ICACHE_CC_INVAL; 1612 r_icache_fsm_save = r_icache_fsm; 1613 break; 1614 } 1615 1616 // TLB update and invalidate different PTE 1617 1618 if ( !r_icache_inval_tlb_rsp && !r_icache_cleanup_req ) 1619 { 1620 paddr_t victim_index = 0; 1621 r_icache_cleanup_req = icache_tlb.update1(r_icache_pte_update,r_icache_miss_buf[1],r_icache_vaddr_req.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_icache_words)+2)),&victim_index); 1622 r_icache_cleanup_line = victim_index; 1623 r_icache_cleanup_type = TLB_CLEANUP; 1624 m_cpt_cc_cleanup_ins++; 1625 r_icache_fsm = ICACHE_IDLE; 1626 } 1627 1628 // TLB update and invalidate same PTE 1629 if ( r_icache_inval_tlb_rsp ) 1630 { 1631 r_icache_inval_tlb_rsp = false; 1632 r_icache_fsm = ICACHE_IDLE; 1633 } 1671 icache_tlb.update(r_icache_pte_update,r_icache_miss_buf[1],r_icache_vaddr_req.read(),r_icache_way.read(),r_icache_set.read(),(r_icache_paddr_save.read() >> (uint32_log2(m_icache_words)+2))); 1672 r_icache_fsm = ICACHE_IDLE; 1634 1673 break; 1635 1674 } … … 1662 1701 } 1663 1702 if (clean) break; 1703 set = 0; 1664 1704 } 1665 1705 … … 1711 1751 } 1712 1752 if (clean) break; 1753 set = 0; 1713 1754 } 1714 1755 if (way == m_icache_ways) … … 2016 2057 2017 2058 // invalidate cache 2018 if( (( r_icache_fsm_save.read() == ICACHE_TLB1_READ ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_READ ) ||2019 ( r_icache_fsm_save.read() == ICACHE_TLB1_LL_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_LL_WAIT ) ||2020 ( r_icache_fsm_save.read() == ICACHE_TLB1_SC_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_SC_WAIT ) ||2021 ( r_icache_fsm_save.read() == ICACHE_TLB1_UPDT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_UPDT)) &&2059 if( (( r_icache_fsm_save.read() == ICACHE_TLB1_READ ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_READ ) || 2060 ( r_icache_fsm_save.read() == ICACHE_TLB1_LL_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_LL_WAIT ) || 2061 ( r_icache_fsm_save.read() == ICACHE_TLB1_SC_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_SC_WAIT ) || 2062 ( r_icache_fsm_save.read() == ICACHE_TLB1_UPDT_SEL ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_UPDT_SEL )) && 2022 2063 ((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) == r_tgt_addr.read()) ) 2023 2064 { … … 2032 2073 2033 2074 if( (/*( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ ) ||*/ 2034 ( r_icache_fsm_save.read() == ICACHE_TLB1_LL_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_LL_WAIT ) ||2035 ( r_icache_fsm_save.read() == ICACHE_TLB1_SC_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_SC_WAIT ) ||2036 ( r_icache_fsm_save.read() == ICACHE_TLB1_UPDT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_UPDT)) &&2075 ( r_icache_fsm_save.read() == ICACHE_TLB1_LL_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_LL_WAIT ) || 2076 ( r_icache_fsm_save.read() == ICACHE_TLB1_SC_WAIT ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_SC_WAIT ) || 2077 ( r_icache_fsm_save.read() == ICACHE_TLB1_UPDT_SEL ) || ( r_icache_fsm_save.read() == ICACHE_TLB2_UPDT_SEL )) && 2037 2078 ((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) == r_tgt_addr.read()) ) 2038 2079 { … … 2621 2662 else 2622 2663 { 2623 r_dcache_unc_req = true; 2624 r_dcache_fsm = DCACHE_UNC_WAIT; 2625 m_cpt_unc_read++; 2664 if ( (dreq.type == iss_t::DATA_SC) && !dcache_pte_info.d && (r_mmu_mode.read() & DATA_TLB_MASK) ) // dirty bit update required 2665 { 2666 m_cpt_data_tlb_update_dirty++; 2667 m_cost_data_tlb_update_dirty_frz++; 2668 r_dcache_sc_updt_dirty = true; 2669 if (dcache_tlb.getpagesize(dcache_tlb_way, dcache_tlb_set)) 2670 { 2671 r_dcache_pte_update = dcache_tlb.getpte(dcache_tlb_way, dcache_tlb_set) | PTE_D_MASK; 2672 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 2673 r_dcache_tlb_ll_dirty_req = true; 2674 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 2675 } 2676 else 2677 { 2678 if (dcache_hit_p) 2679 { 2680 r_dcache_pte_update = dcache_tlb.getpte(dcache_tlb_way, dcache_tlb_set) | PTE_D_MASK; 2681 r_dcache_tlb_paddr = (paddr_t)r_dcache_ptba_save | (paddr_t)(((dreq.addr&PTD_ID2_MASK)>>PAGE_K_NBITS) << 3); 2682 r_dcache_tlb_ll_dirty_req = true; 2683 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 2684 } 2685 else // get PTBA to calculate the physical address of PTE 2686 { 2687 data_t ptba; 2688 if (r_dcache.read((paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2), &ptba)) 2689 { 2690 r_dcache_pte_update = dcache_tlb.getpte(dcache_tlb_way, dcache_tlb_set) | PTE_D_MASK; 2691 r_dcache_tlb_paddr = (paddr_t)(ptba & ((1<<(m_paddr_nbits - PAGE_K_NBITS))-1)) << PAGE_K_NBITS | 2692 (paddr_t)(((dreq.addr & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 2693 r_dcache_tlb_ll_dirty_req = true; 2694 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 2695 } 2696 else 2697 { 2698 r_dcache_pte_update = dcache_tlb.getpte(dcache_tlb_way, dcache_tlb_set) | PTE_D_MASK; 2699 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 2700 r_dcache_tlb_read_req = true; 2701 r_dcache_tlb_first_req = true; 2702 r_dcache_tlb_ptba_read = true; 2703 r_dcache_fsm = DCACHE_TLB1_READ; 2704 } 2705 } 2706 } 2707 } 2708 else 2709 { 2710 r_dcache_unc_req = true; 2711 r_dcache_fsm = DCACHE_UNC_WAIT; 2712 m_cpt_unc_read++; 2713 } 2626 2714 m_cost_unc_read_frz++; 2627 2715 } … … 2661 2749 { 2662 2750 r_dcache_pte_update = dcache_tlb.getpte(dcache_tlb_way, dcache_tlb_set) | PTE_D_MASK; 2663 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 2664 r_dcache_tlb_read_req = true; 2665 r_dcache_tlb_first_req = true; 2666 r_dcache_tlb_ptba_read = true; 2667 r_dcache_fsm = DCACHE_TLB1_READ; 2751 data_t ptba; 2752 if (r_dcache.read((paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2), &ptba)) 2753 { 2754 r_dcache_tlb_paddr = (paddr_t)(ptba & ((1<<(m_paddr_nbits - PAGE_K_NBITS))-1)) << PAGE_K_NBITS | (paddr_t)(((dreq.addr & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 2755 r_dcache_tlb_ll_dirty_req = true; 2756 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 2757 } 2758 else 2759 { 2760 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 2761 r_dcache_tlb_read_req = true; 2762 r_dcache_tlb_first_req = true; 2763 r_dcache_tlb_ptba_read = true; 2764 r_dcache_fsm = DCACHE_TLB1_READ; 2765 } 2668 2766 } 2669 2767 } … … 2791 2889 else 2792 2890 { 2793 r_dcache_pte_update = dcache_tlb.getpte(r_dcache_tlb_way_save, r_dcache_tlb_set_save) | PTE_D_MASK; 2794 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 2795 r_dcache_tlb_read_req = true; 2796 r_dcache_tlb_first_req = true; 2797 r_dcache_tlb_ptba_read = true; 2798 r_dcache_fsm = DCACHE_TLB1_READ; 2891 r_dcache_pte_update = dcache_tlb.getpte(r_dcache_tlb_way_save, r_dcache_tlb_set_save) | PTE_D_MASK; 2892 data_t ptba; 2893 if (r_dcache.read((paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2), &ptba)) 2894 { 2895 r_dcache_tlb_paddr = (paddr_t)(ptba & ((1<<(m_paddr_nbits - PAGE_K_NBITS))-1)) << PAGE_K_NBITS | (paddr_t)(((dreq.addr & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 2896 r_dcache_tlb_ll_dirty_req = true; 2897 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 2898 } 2899 else 2900 { 2901 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 2902 r_dcache_tlb_read_req = true; 2903 r_dcache_tlb_first_req = true; 2904 r_dcache_tlb_ptba_read = true; 2905 r_dcache_fsm = DCACHE_TLB1_READ; 2906 } 2799 2907 } 2800 2908 } … … 2847 2955 if (r_dcache_inval_tlb_rsp) r_dcache_inval_tlb_rsp = false; 2848 2956 if (r_dcache_inval_rsp) r_dcache_inval_rsp = false; 2957 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2849 2958 } 2850 2959 else … … 2865 2974 if (r_dcache_inval_tlb_rsp) r_dcache_inval_tlb_rsp = false; 2866 2975 if (r_dcache_inval_rsp) r_dcache_inval_rsp = false; 2976 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2867 2977 } 2868 2978 else if ( r_dcache_inval_tlb_rsp ) … … 2870 2980 r_dcache_inval_tlb_rsp = false; 2871 2981 r_dcache_fsm = DCACHE_IDLE; 2982 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2872 2983 } 2873 2984 else if ( r_dcache_inval_rsp ) … … 2875 2986 r_dcache_inval_rsp = false; 2876 2987 r_dcache_fsm = DCACHE_IDLE; 2988 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2877 2989 } 2878 2990 else … … 2915 3027 if (r_dcache_inval_tlb_rsp) r_dcache_inval_tlb_rsp = false; 2916 3028 if (r_dcache_inval_rsp) r_dcache_inval_rsp = false; 3029 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2917 3030 } 2918 3031 else … … 2923 3036 r_dcache_inval_tlb_rsp = false; 2924 3037 if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false; 3038 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2925 3039 r_dcache_fsm = DCACHE_IDLE; 2926 3040 } … … 2929 3043 r_dcache_inval_rsp = false; 2930 3044 if (r_dcache_tlb_sc_fail) r_dcache_tlb_sc_fail = false; 3045 if (r_dcache_sc_updt_dirty) r_dcache_sc_updt_dirty = false; 2931 3046 r_dcache_fsm = DCACHE_IDLE; 2932 3047 } … … 2977 3092 if (r_dcache_inval_tlb_rsp) r_dcache_inval_tlb_rsp = false; 2978 3093 if (r_dcache_inval_rsp) r_dcache_inval_rsp = false; 3094 if ( r_dcache_tlb_ptba_read ) r_dcache_tlb_ptba_read = false; 2979 3095 break; 2980 3096 } … … 2988 3104 m_cpt_cc_cleanup_data++; 2989 3105 r_dcache_inval_tlb_rsp = false; 3106 if ( r_dcache_tlb_ptba_read ) r_dcache_tlb_ptba_read = false; 2990 3107 break; 2991 3108 } … … 3047 3164 { 3048 3165 r_dcache_pte_update = r_dcache_miss_buf[0]; 3049 r_dcache_fsm = DCACHE_TLB1_UPDT ;3166 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3050 3167 } 3051 3168 else … … 3063 3180 { 3064 3181 r_dcache_pte_update = r_dcache_miss_buf[0]; 3065 r_dcache_fsm = DCACHE_TLB1_UPDT ;3182 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3066 3183 } 3067 3184 else … … 3189 3306 else 3190 3307 { 3191 r_dcache_fsm = DCACHE_TLB1_UPDT ;3308 r_dcache_fsm = DCACHE_TLB1_UPDT_SEL; 3192 3309 } 3193 3310 } 3194 3311 } 3195 3312 break; 3313 } 3314 ////////////////////// 3315 case DCACHE_TLB1_UPDT_SEL: 3316 { 3317 if ( dreq.valid ) m_cost_data_tlb_miss_frz++; 3318 3319 // external cache invalidate request 3320 if ( r_tgt_dcache_req ) 3321 { 3322 r_dcache_fsm = DCACHE_CC_CHECK; 3323 r_dcache_fsm_save = r_dcache_fsm; 3324 break; 3325 } 3326 3327 // TLB update and invalidate same PTE 3328 if ( r_dcache_inval_tlb_rsp ) 3329 { 3330 r_dcache_inval_tlb_rsp = false; 3331 r_dcache_fsm = DCACHE_IDLE; 3332 } 3333 3334 // TLB update and invalidate different PTE 3335 if ( !r_dcache_cleanup_req ) 3336 { 3337 size_t way = 0; 3338 size_t set = 0; 3339 paddr_t victim_index = 0; 3340 bool cleanup = dcache_tlb.select1((dreq.addr >> PAGE_M_NBITS),&victim_index,&way,&set); 3341 r_dcache_way = way; 3342 r_dcache_set = set; 3343 if (cleanup) 3344 { 3345 r_dcache_cleanup_req = true; 3346 r_dcache_cleanup_line = victim_index; 3347 r_dcache_cleanup_type = TLB_CLEANUP; 3348 m_cpt_cc_cleanup_data++; 3349 } 3350 r_dcache_fsm = DCACHE_TLB1_UPDT; 3351 } 3352 break; 3196 3353 } 3197 3354 ////////////////////// … … 3200 3357 if ( dreq.valid ) m_cost_data_tlb_miss_frz++; 3201 3358 3202 // external cache invalidate request 3203 if ( r_tgt_dcache_req ) 3204 { 3205 r_dcache_fsm = DCACHE_CC_CHECK; 3206 r_dcache_fsm_save = r_dcache_fsm; 3207 break; 3208 } 3209 3210 // TLB update and invalidate different PTE 3211 if ( !r_dcache_inval_tlb_rsp && !r_dcache_cleanup_req) 3212 { 3213 paddr_t victim_index = 0; 3214 r_dcache_cleanup_req = dcache_tlb.update1(r_dcache_pte_update,dreq.addr,(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index); 3215 r_dcache_cleanup_line = victim_index; 3216 r_dcache_cleanup_type = TLB_CLEANUP; 3217 m_cpt_cc_cleanup_data++; 3218 r_dcache_fsm = DCACHE_IDLE; 3219 } 3220 3221 // TLB update and invalidate same PTE 3222 if ( r_dcache_inval_tlb_rsp ) 3223 { 3224 r_dcache_inval_tlb_rsp = false; 3225 r_dcache_fsm = DCACHE_IDLE; 3226 } 3359 dcache_tlb.update(r_dcache_pte_update,dreq.addr,r_dcache_way.read(),r_dcache_set.read(),(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2))); 3360 r_dcache_fsm = DCACHE_IDLE; 3227 3361 break; 3228 3362 } … … 3293 3427 { 3294 3428 r_dcache_pte_update = r_dcache_miss_buf[0]; 3295 r_dcache_fsm = DCACHE_TLB2_UPDT ;3429 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3296 3430 } 3297 3431 else … … 3302 3436 { 3303 3437 r_dcache_pte_update = r_dcache_miss_buf[0]; 3304 r_dcache_fsm = DCACHE_TLB2_UPDT ;3438 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3305 3439 } 3306 3440 else … … 3318 3452 { 3319 3453 r_dcache_pte_update = r_dcache_miss_buf[0]; 3320 r_dcache_fsm = DCACHE_TLB2_UPDT ;3454 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3321 3455 } 3322 3456 else … … 3444 3578 else 3445 3579 { 3446 r_dcache_fsm = DCACHE_TLB2_UPDT ;3580 r_dcache_fsm = DCACHE_TLB2_UPDT_SEL; 3447 3581 } 3448 3582 } 3449 3583 } 3450 3584 break; 3585 } 3586 ////////////////////////// 3587 case DCACHE_TLB2_UPDT_SEL: 3588 { 3589 if ( dreq.valid ) m_cost_data_tlb_miss_frz++; 3590 3591 // external cache invalidate request 3592 if ( r_tgt_dcache_req ) 3593 { 3594 r_dcache_fsm = DCACHE_CC_CHECK; 3595 r_dcache_fsm_save = r_dcache_fsm; 3596 break; 3597 } 3598 3599 // TLB update and invalidate same PTE 3600 if ( r_dcache_inval_tlb_rsp ) 3601 { 3602 r_dcache_inval_tlb_rsp = false; 3603 r_dcache_fsm = DCACHE_IDLE; 3604 } 3605 3606 // TLB update and invalidate different PTE 3607 if ( !r_dcache_cleanup_req ) 3608 { 3609 size_t way = 0; 3610 size_t set = 0; 3611 paddr_t victim_index = 0; 3612 bool cleanup = dcache_tlb.select1((dreq.addr >> PAGE_K_NBITS),&victim_index,&way,&set); 3613 r_dcache_way = way; 3614 r_dcache_set = set; 3615 if (cleanup) 3616 { 3617 r_dcache_cleanup_req = true; 3618 r_dcache_cleanup_line = victim_index; 3619 r_dcache_cleanup_type = TLB_CLEANUP; 3620 m_cpt_cc_cleanup_data++; 3621 } 3622 r_dcache_fsm = DCACHE_TLB2_UPDT; 3623 } 3624 break; 3451 3625 } 3452 3626 ////////////////////// … … 3455 3629 if ( dreq.valid ) m_cost_data_tlb_miss_frz++; 3456 3630 3457 // external cache invalidate request 3458 if ( r_tgt_dcache_req ) 3459 { 3460 r_dcache_fsm = DCACHE_CC_CHECK; 3461 r_dcache_fsm_save = r_dcache_fsm; 3462 break; 3463 } 3464 3465 // TLB update and invalidate different PTE 3466 if ( !r_dcache_inval_tlb_rsp && !r_dcache_cleanup_req) 3467 { 3468 paddr_t victim_index = 0; 3469 r_dcache_cleanup_req = dcache_tlb.update1(r_dcache_pte_update,r_dcache_miss_buf[1],dreq.addr,(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index); 3470 r_dcache_cleanup_line = victim_index; 3471 r_dcache_cleanup_type = TLB_CLEANUP; 3472 m_cpt_cc_cleanup_data++; 3473 r_dcache_fsm = DCACHE_IDLE; 3474 } 3475 3476 // TLB update and invalidate same PTE 3477 if ( r_dcache_inval_tlb_rsp ) 3478 { 3479 r_dcache_inval_tlb_rsp = false; 3480 r_dcache_fsm = DCACHE_IDLE; 3481 } 3631 dcache_tlb.update(r_dcache_pte_update,r_dcache_miss_buf[1],dreq.addr,r_dcache_way.read(),r_dcache_set.read(),(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2))); 3632 r_dcache_fsm = DCACHE_IDLE; 3482 3633 break; 3483 3634 } … … 3510 3661 } 3511 3662 if (clean) break; 3663 set = 0; 3512 3664 } 3513 3665 … … 3579 3731 } 3580 3732 if (clean) break; 3733 set = 0; 3581 3734 } 3582 3735 … … 3874 4027 { 3875 4028 r_dcache_pte_update = dcache_tlb.getpte(r_dcache_tlb_way_save, r_dcache_tlb_set_save) | PTE_D_MASK; 3876 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 3877 r_dcache_tlb_ptba_read = true; 3878 r_dcache_tlb_read_req = true; 3879 r_dcache_tlb_first_req = true; 3880 r_dcache_fsm = DCACHE_TLB1_READ; 4029 data_t ptba; 4030 if (r_dcache.read((paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2), &ptba)) 4031 { 4032 r_dcache_tlb_paddr = (paddr_t)(ptba & ((1<<(m_paddr_nbits - PAGE_K_NBITS))-1)) << PAGE_K_NBITS | (paddr_t)(((dreq.addr & PTD_ID2_MASK) >> PAGE_K_NBITS) << 3); 4033 r_dcache_tlb_ll_dirty_req = true; 4034 r_dcache_fsm = DCACHE_LL_DIRTY_WAIT; 4035 4036 } 4037 else 4038 { 4039 r_dcache_tlb_paddr = (paddr_t)r_mmu_ptpr << (INDEX1_NBITS+2) | (paddr_t)((dreq.addr>>PAGE_M_NBITS)<<2); 4040 r_dcache_tlb_ptba_read = true; 4041 r_dcache_tlb_read_req = true; 4042 r_dcache_tlb_first_req = true; 4043 r_dcache_fsm = DCACHE_TLB1_READ; 4044 } 3881 4045 } 3882 4046 } … … 3906 4070 { 3907 4071 r_dcache_fsm = DCACHE_IDLE; 4072 if ( r_dcache_sc_updt_dirty ) r_dcache_sc_updt_dirty = false; 3908 4073 r_dcache_inval_tlb_rsp = false; 3909 4074 break; 3910 4075 } 3911 4076 dcache_tlb.setdirty(r_dcache_tlb_way_save, r_dcache_tlb_set_save); 3912 r_dcache_fsm = DCACHE_WRITE_REQ; 3913 drsp.valid = true; 3914 drsp.rdata = 0; 4077 if ( r_dcache_sc_updt_dirty ) 4078 { 4079 r_dcache_sc_updt_dirty = false; 4080 r_dcache_unc_req = true; 4081 r_dcache_fsm = DCACHE_UNC_WAIT; 4082 m_cpt_unc_read++; 4083 } 4084 else 4085 { 4086 r_dcache_fsm = DCACHE_WRITE_REQ; 4087 drsp.valid = true; 4088 drsp.rdata = 0; 4089 } 3915 4090 break; 3916 4091 } … … 4093 4268 ( r_dcache_fsm_save.read() == DCACHE_TLB1_LL_WAIT ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_LL_WAIT ) || 4094 4269 ( r_dcache_fsm_save.read() == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_SC_WAIT ) || 4095 ( r_dcache_fsm_save.read() == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_UPDT )||4270 ( r_dcache_fsm_save.read() == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_UPDT_SEL ) || 4096 4271 ( r_dcache_fsm_save.read() == DCACHE_LL_DIRTY_WAIT ) || ( r_dcache_fsm_save.read() == DCACHE_SC_DIRTY_WAIT ) || 4097 4272 ( r_dcache_fsm_save.read() == DCACHE_WRITE_DIRTY )) && … … 4111 4286 ( r_dcache_fsm_save.read() == DCACHE_TLB1_LL_WAIT ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_LL_WAIT ) || 4112 4287 ( r_dcache_fsm_save.read() == DCACHE_TLB1_SC_WAIT ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_SC_WAIT ) || 4113 ( r_dcache_fsm_save.read() == DCACHE_TLB1_UPDT ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_UPDT )||4288 ( r_dcache_fsm_save.read() == DCACHE_TLB1_UPDT_SEL ) || ( r_dcache_fsm_save.read() == DCACHE_TLB2_UPDT_SEL ) || 4114 4289 ( r_dcache_fsm_save.read() == DCACHE_LL_DIRTY_WAIT ) || ( r_dcache_fsm_save.read() == DCACHE_SC_DIRTY_WAIT ) || 4115 4290 ( r_dcache_fsm_save.read() == DCACHE_WRITE_DIRTY )) && … … 5099 5274 << "p_vci_tgt.reop:" << p_vci_tgt.reop 5100 5275 << std::endl; 5101 5102 5276 #endif 5103 5277 }
Note: See TracChangeset
for help on using the changeset viewer.