Changeset 443 for branches/v5/modules/vci_cc_vcache_wrapper/caba/source/src
- Timestamp:
- Jul 17, 2013, 2:42:13 PM (11 years ago)
- Location:
- branches/v5/modules/vci_cc_vcache_wrapper
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/v5/modules/vci_cc_vcache_wrapper
-
Property
svn:mergeinfo
set to
/trunk/modules/vci_cc_vcache_wrapper merged eligible
-
Property
svn:mergeinfo
set to
-
branches/v5/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r369 r443 34 34 #define DEBUG_DCACHE 1 35 35 #define DEBUG_ICACHE 1 36 #define DEBUG_C LEANUP 136 #define DEBUG_CMD 0 37 37 38 38 namespace soclib { … … 96 96 "DCACHE_XTN_DT_INVAL", 97 97 98 "DCACHE_DIRTY_ PTE_GET",98 "DCACHE_DIRTY_GET_PTE", 99 99 "DCACHE_DIRTY_WAIT", 100 100 … … 130 130 }; 131 131 132 const char *vci_pktid_type_str[] = { 133 "TYPE_READ_DATA_UNC", 134 "TYPE_READ_DATA_MISS", 135 "TYPE_READ_INS_UNC", 136 "TYPE_READ_INS_MISS", 137 "TYPE_WRITE", 138 "TYPE_CAS", 139 "TYPE_LL", 140 "TYPE_SC", 141 }; 142 143 const char *vci_cmd_type_str[] = { 144 "NOP or STORE_COND", 145 "READ", 146 "WRITE", 147 "LOCKED_READ" 148 }; 149 132 150 const char *rsp_fsm_state_str[] = { 133 151 "RSP_IDLE", … … 160 178 } 161 179 162 #define tmpl(...) template<typename vci_param, typename iss_t> __VA_ARGS__ VciCcVCacheWrapper<vci_param, iss_t> 180 #define tmpl(...) \ 181 template<typename vci_param, \ 182 size_t dspin_in_width, \ 183 size_t dspin_out_width, \ 184 typename iss_t> __VA_ARGS__ \ 185 VciCcVCacheWrapper<vci_param, dspin_in_width, dspin_out_width, iss_t> 163 186 164 187 using namespace soclib::common; … … 375 398 r_dtlb("dtlb", proc_id, dtlb_ways,dtlb_sets,vci_param::N) 376 399 { 400 std::cout << " - Building VciCcVcacheWrapper : " << name << std::endl; 401 377 402 assert( ((icache_words*vci_param::B) < (1<<vci_param::K)) and 378 403 "Need more PLEN bits."); … … 459 484 << " | " << rsp_fsm_state_str[r_vci_rsp_fsm.read()] 460 485 << " | " << cc_receive_fsm_state_str[r_cc_receive_fsm.read()] 461 << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()]; 486 << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()] 487 << " | MMU = " << r_mmu_mode.read(); 462 488 if (r_dcache_updt_req.read() ) std::cout << " | P1_UPDT"; 463 489 if (r_dcache_wbuf_req.read() ) std::cout << " | P1_WBUF"; … … 494 520 ////////////////////////////////////////// 495 521 { 496 size_t cache_way; 497 size_t cache_set; 498 size_t cache_word; 499 uint32_t cache_rdata; 500 bool cache_hit = r_dcache.read_neutral( addr, 501 &cache_rdata, 502 &cache_way, 503 &cache_set, 504 &cache_word ); 505 bool icache_hit = r_icache.read_neutral( addr, 506 &cache_rdata, 507 &cache_way, 508 &cache_set, 509 &cache_word ); 510 if ( cache_hit != m_debug_previous_hit ) 511 { 512 std::cout << "PROC " << name() 513 << " dcache change at cycle " << std::dec << m_cpt_total_cycles 514 << " for adresse " << std::hex << addr 515 << " / HIT = " << std::dec << cache_hit << std::endl; 516 m_debug_previous_hit = cache_hit; 517 } 518 if ( icache_hit != m_idebug_previous_hit ) 519 { 520 std::cout << "PROC " << name() 521 << " icache change at cycle " << std::dec << m_cpt_total_cycles 522 << " for adresse " << std::hex << addr 523 << " / HIT = " << icache_hit << std::endl; 524 m_idebug_previous_hit = icache_hit; 522 bool cache_hit; 523 size_t cache_way = 0; 524 size_t cache_set = 0; 525 size_t cache_word = 0; 526 uint32_t cache_rdata = 0; 527 528 cache_hit = r_dcache.read_neutral( addr, 529 &cache_rdata, 530 &cache_way, 531 &cache_set, 532 &cache_word ); 533 534 if ( cache_hit != m_debug_previous_d_hit ) 535 { 536 std::cout << "Monitor PROC " << name() 537 << " DCACHE at cycle " << std::dec << m_cpt_total_cycles 538 << " / HIT = " << cache_hit 539 << " / PADDR = " << std::hex << addr 540 << " / DATA = " << cache_rdata 541 << " / WAY = " << cache_way << std::endl; 542 m_debug_previous_d_hit = cache_hit; 543 } 544 545 cache_hit = r_icache.read_neutral( addr, 546 &cache_rdata, 547 &cache_way, 548 &cache_set, 549 &cache_word ); 550 551 if ( cache_hit != m_debug_previous_i_hit ) 552 { 553 std::cout << "Monitor PROC " << name() 554 << " ICACHE at cycle " << std::dec << m_cpt_total_cycles 555 << " / HIT = " << cache_hit 556 << " / PADDR = " << std::hex << addr 557 << " / DATA = " << cache_rdata 558 << " / WAY = " << cache_way << std::endl; 559 m_debug_previous_i_hit = cache_hit; 525 560 } 526 561 } … … 676 711 ///////////////////////// 677 712 { 678 #define LLSCLocalTable GenericLLSCLocalTable<8000, 1, paddr_t, vci_trdid_t, vci_data_t>679 713 if ( not p_resetn.read() ) 680 714 { … … 693 727 r_cc_send_fsm = CC_SEND_IDLE; 694 728 729 // reset data physical address extension 730 r_dcache_paddr_ext = 0; 731 695 732 // reset dcache directory extension 696 733 for (size_t i=0 ; i< m_dcache_ways*m_dcache_sets ; i++) … … 705 742 706 743 // ICACHE & DCACHE activated 744 // ITLB & DTLB desactivated 707 745 r_mmu_mode = 0x3; 708 746 … … 757 795 758 796 // Debug variables 759 m_debug_previous_hit = false; 760 m_idebug_previous_hit = false; 761 m_debug_dcache_fsm = false; 762 m_debug_icache_fsm = false; 797 m_debug_previous_i_hit = false; 798 m_debug_previous_d_hit = false; 799 m_debug_activated = false; 763 800 764 801 // activity counters … … 869 906 // init the llsc reservation buffer 870 907 r_dcache_llsc_valid = false; 908 m_monitor_ok = false; 871 909 872 910 return; … … 900 938 m_cpt_total_cycles++; 901 939 902 m_debug_icache_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 903 m_debug_dcache_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 940 m_debug_activated = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 904 941 905 942 ///////////////////////////////////////////////////////////////////// … … 1151 1188 // we request a VCI transaction 1152 1189 r_icache_fsm = ICACHE_MISS_SELECT; 1153 r_icache_miss_req = true; 1190 #if DEBUG_ICACHE 1191 if ( m_debug_activated ) 1192 std::cout << " <PROC " << name() << " ICACHE_IDLE> READ MISS in icache" 1193 << " : PADDR = " << std::hex << paddr << std::endl; 1194 #endif 1195 r_icache_miss_req = true; 1154 1196 } 1155 1197 else if (cache_state == CACHE_SLOT_STATE_ZOMBI ) // pending cleanup … … 1168 1210 m_irsp.instruction = cache_inst; 1169 1211 r_icache_fsm = ICACHE_IDLE; 1212 #if DEBUG_ICACHE 1213 if ( m_debug_activated ) 1214 std::cout << " <PROC " << name() << " ICACHE_IDLE> READ HIT in icache" 1215 << " : PADDR = " << std::hex << paddr << std::endl; 1216 #endif 1170 1217 } 1171 1218 } … … 1174 1221 r_icache_unc_req = true; 1175 1222 r_icache_fsm = ICACHE_UNC_WAIT; 1223 1224 #if DEBUG_ICACHE 1225 if ( m_debug_activated ) 1226 { 1227 std::cout << " <PROC " << name() 1228 << " ICACHE_IDLE> READ UNCACHEABLE in icache" 1229 << " : PADDR = " << std::hex << paddr << std::endl; 1230 } 1231 #endif 1176 1232 } 1177 1233 } // end if m_ireq.valid … … 1230 1286 // A cleanup request is generated for each valid line 1231 1287 { 1288 // coherence request (from CC_RECEIVE FSM) 1289 if ( r_cc_receive_icache_req.read() ) 1290 { 1291 r_icache_fsm = ICACHE_CC_CHECK; 1292 r_icache_fsm_save = r_icache_fsm.read(); 1293 break; 1294 } 1295 1232 1296 if ( not r_icache_cc_send_req.read() ) // blocked until previous cc_send request is sent 1233 1297 { 1234 1298 int state; 1235 uint32_ttag;1299 paddr_t tag; 1236 1300 size_t way = r_icache_flush_count.read()/m_icache_sets; 1237 1301 size_t set = r_icache_flush_count.read()%m_icache_sets; … … 1249 1313 // request cleanup 1250 1314 r_icache_cc_send_req = true; 1251 r_icache_cc_send_nline = tag * m_icache_sets ;1315 r_icache_cc_send_nline = tag * m_icache_sets + set; 1252 1316 r_icache_cc_send_way = way; 1253 1317 r_icache_cc_send_type = CC_TYPE_CLEANUP; … … 1467 1531 1468 1532 #if DEBUG_ICACHE 1469 if ( m_debug_ dcache_fsm)1533 if ( m_debug_activated ) 1470 1534 { 1471 1535 std::cout << " <PROC " << name() … … 1493 1557 CACHE_SLOT_STATE_ZOMBI); 1494 1558 #if DEBUG_ICACHE 1495 if ( m_debug_ dcache_fsm)1559 if ( m_debug_activated ) 1496 1560 { 1497 1561 std::cout << " <PROC " << name() … … 1550 1614 r_vci_rsp_fifo_icache.read() ); 1551 1615 #if DEBUG_ICACHE 1552 if ( m_debug_ icache_fsm)1616 if ( m_debug_activated ) 1553 1617 { 1554 1618 std::cout << " <PROC " << name() … … 1610 1674 CACHE_SLOT_STATE_ZOMBI ); 1611 1675 #if DEBUG_ICACHE 1612 if ( m_debug_ icache_fsm)1676 if ( m_debug_activated ) 1613 1677 { 1614 1678 std::cout << " <PROC " << name() … … 1634 1698 CACHE_SLOT_STATE_VALID ); 1635 1699 #if DEBUG_ICACHE 1636 if ( m_debug_ icache_fsm)1700 if ( m_debug_activated ) 1637 1701 { 1638 1702 std::cout << " <PROC " << name() … … 1716 1780 1717 1781 #if DEBUG_ICACHE 1718 if ( m_debug_ icache_fsm)1782 if ( m_debug_activated ) 1719 1783 { 1720 1784 std::cout << " <PROC " << name() … … 1749 1813 } 1750 1814 #if DEBUG_ICACHE 1751 if ( m_debug_ icache_fsm)1815 if ( m_debug_activated ) 1752 1816 { 1753 1817 std::cout << " <PROC " << name() … … 1759 1823 else // no match 1760 1824 { 1761 int state ;1762 size_t way ;1763 size_t set ;1764 size_t word ;1825 int state = 0; 1826 size_t way = 0; 1827 size_t set = 0; 1828 size_t word = 0; 1765 1829 1766 1830 #ifdef INSTRUMENTATION … … 1818 1882 1819 1883 #if DEBUG_ICACHE 1820 if ( m_debug_ icache_fsm)1884 if ( m_debug_activated ) 1821 1885 { 1822 1886 std::cout << " <PROC " << name() … … 1862 1926 1863 1927 #if DEBUG_ICACHE 1864 if ( m_debug_ icache_fsm)1928 if ( m_debug_activated ) 1865 1929 { 1866 1930 std::cout << " <PROC " << name() … … 1925 1989 1926 1990 #if DEBUG_ICACHE 1927 if ( m_debug_ icache_fsm)1991 if ( m_debug_activated ) 1928 1992 { 1929 1993 std::cout << " <PROC " << name() … … 2085 2149 size_t tlb_way; 2086 2150 size_t tlb_set; 2087 paddr_t tlb_nline ;2151 paddr_t tlb_nline = 0; 2088 2152 size_t cache_way; 2089 2153 size_t cache_set; … … 2115 2179 else // identity mapping 2116 2180 { 2117 paddr = (paddr_t)m_dreq.addr; 2181 paddr = (paddr_t)m_dreq.addr; 2182 // we take into account the paddr extension 2183 if (vci_param::N > 32) 2184 paddr = paddr | ((paddr_t)(r_dcache_paddr_ext.read()) << 32); 2118 2185 } 2119 2186 } // end physical address computation … … 2189 2256 2190 2257 #if DEBUG_DCACHE 2191 if ( m_debug_dcache_fsm ) 2192 { 2193 std::cout << " <PROC " << name() 2194 << " DCACHE_IDLE> Cache update in P1 stage" << std::dec 2195 << " / WAY = " << r_dcache_save_cache_way.read() 2196 << " / SET = " << r_dcache_save_cache_set.read() 2197 << " / WORD = " << r_dcache_save_cache_word.read() << std::hex 2198 << " / DATA = " << r_dcache_save_wdata.read() 2199 << " / BE = " << r_dcache_save_be.read() << std::endl; 2200 } 2258 if ( m_debug_activated ) 2259 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2260 << " Cache update in P1 stage" << std::dec 2261 << " / WAY = " << r_dcache_save_cache_way.read() 2262 << " / SET = " << r_dcache_save_cache_set.read() 2263 << " / WORD = " << r_dcache_save_cache_word.read() << std::hex 2264 << " / WDATA = " << r_dcache_save_wdata.read() 2265 << " / BE = " << r_dcache_save_be.read() << std::endl; 2201 2266 #endif 2202 2267 } // end test TLB inval … … 2341 2406 case iss_t::XTN_MMU_WORD_HI: 2342 2407 m_drsp.rdata = r_mmu_word_hi.read(); 2408 m_drsp.valid = true; 2409 m_drsp.error = false; 2410 break; 2411 2412 case iss_t::XTN_DATA_PADDR_EXT: 2413 m_drsp.rdata = r_dcache_paddr_ext.read(); 2343 2414 m_drsp.valid = true; 2344 2415 m_drsp.error = false; … … 2465 2536 m_drsp.valid = true; 2466 2537 r_dcache_fsm = DCACHE_IDLE; 2538 break; 2539 2540 case iss_t::XTN_DATA_PADDR_EXT: // no cache or tlb access 2541 r_dcache_paddr_ext = m_dreq.wdata; 2542 m_drsp.valid = true; 2543 r_dcache_fsm = DCACHE_IDLE; 2467 2544 break; 2468 2545 … … 2530 2607 m_drsp.rdata = 0; 2531 2608 #if DEBUG_DCACHE 2532 if ( m_debug_dcache_fsm ) 2533 { 2534 std::cout << " <PROC " << name() 2535 << ".DCACHE_IDLE> HIT in dtlb, but privilege violation" << std::endl; 2536 } 2609 if ( m_debug_activated ) 2610 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2611 << " HIT in dtlb, but privilege violation" << std::endl; 2537 2612 #endif 2538 2613 } … … 2548 2623 m_drsp.rdata = 0; 2549 2624 #if DEBUG_DCACHE 2550 if ( m_debug_dcache_fsm ) 2551 { 2552 std::cout << " <PROC " << name() 2553 << ".DCACHE_IDLE> HIT in dtlb, but writable violation" << std::endl; 2554 } 2625 if ( m_debug_activated ) 2626 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2627 << " HIT in dtlb, but writable violation" << std::endl; 2555 2628 #endif 2556 2629 } … … 2569 2642 } // end DTLB activated 2570 2643 2571 if ( valid_req ) // processor request is valid after TLB check2644 if ( valid_req ) // processor request is valid (after MMU check) 2572 2645 { 2573 2646 r_dcache_save_cacheable = cacheable; … … 2593 2666 r_dcache_fsm = DCACHE_MISS_SELECT; 2594 2667 #if DEBUG_DCACHE 2595 if ( m_debug_dcache_fsm ) 2596 { 2597 std::cout << " <PROC " << name() 2598 << ".DCACHE_IDLE> READ MISS in dcache" << std::endl; 2599 } 2668 if ( m_debug_activated ) 2669 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2670 << " READ MISS in dcache" 2671 << " / PADDR = " << std::hex << paddr << std::endl; 2600 2672 #endif 2601 2673 } … … 2604 2676 // stalled until cleanup is acknowledged 2605 2677 r_dcache_fsm = DCACHE_IDLE; 2678 #if DEBUG_DCACHE 2679 if ( m_debug_activated ) 2680 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2681 << " Pending cleanup, stalled until cleanup acknowledge" 2682 << " / PADDR = " << std::hex << paddr << std::endl; 2683 #endif 2606 2684 } 2607 2685 else // cache hit … … 2615 2693 m_drsp.rdata = cache_rdata; 2616 2694 #if DEBUG_DCACHE 2617 if ( m_debug_dcache_fsm ) 2618 { 2619 std::cout << " <PROC " << name() 2620 << ".DCACHE_IDLE> READ HIT in dcache" << std::endl; 2621 } 2695 if ( m_debug_activated ) 2696 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2697 << " READ HIT in dcache" 2698 << " / PADDR = " << std::hex << paddr << std::endl; 2622 2699 #endif 2623 2700 } … … 2630 2707 r_dcache_fsm = DCACHE_UNC_WAIT; 2631 2708 #if DEBUG_DCACHE 2632 if ( m_debug_dcache_fsm ) 2633 { 2634 std::cout << " <PROC " << name() 2635 << ".DCACHE_IDLE> READ UNCACHEABLE in dcache" << std::endl; 2636 } 2709 if ( m_debug_activated ) 2710 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2711 << " READ UNCACHEABLE in dcache" 2712 << " / PADDR = " << std::hex << paddr << std::endl; 2637 2713 #endif 2638 2714 } … … 2804 2880 if ( not bypass ) // Try to read PTE1/PTD1 in dcache 2805 2881 { 2806 pte_paddr = ( paddr_t)r_mmu_ptpr.read() << (INDEX1_NBITS+2) |2807 ( paddr_t)((r_dcache_tlb_vaddr.read() >> PAGE_M_NBITS) << 2);2882 pte_paddr = (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) | 2883 ((((paddr_t)r_dcache_tlb_vaddr.read()) >> PAGE_M_NBITS) << 2); 2808 2884 r_dcache_tlb_paddr = pte_paddr; 2809 2885 r_dcache_fsm = DCACHE_TLB_PTE1_GET; … … 2818 2894 2819 2895 #if DEBUG_DCACHE 2820 if ( m_debug_ dcache_fsm)2896 if ( m_debug_activated ) 2821 2897 { 2822 2898 if ( r_dcache_tlb_ins.read() ) 2823 { 2824 std::cout << " <PROC " << name() << ".DCACHE_TLB_MISS> ITLB miss"; 2825 } 2899 std::cout << " <PROC " << name() << " DCACHE_TLB_MISS> ITLB miss"; 2826 2900 else 2827 { 2828 std::cout << " <PROC " << name() << ".DCACHE_TLB_MISS> DTLB miss"; 2829 } 2901 std::cout << " <PROC " << name() << " DCACHE_TLB_MISS> DTLB miss"; 2830 2902 std::cout << " / VADDR = " << std::hex << r_dcache_tlb_vaddr.read() 2903 << " / ptpr = " << (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) 2831 2904 << " / BYPASS = " << bypass 2832 2905 << " / PTE_ADR = " << pte_paddr << std::endl; … … 2883 2956 2884 2957 #if DEBUG_DCACHE 2885 if ( m_debug_ dcache_fsm)2958 if ( m_debug_activated ) 2886 2959 { 2887 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache, but unmapped" 2960 std::cout << " <PROC " << name() 2961 << " DCACHE_TLB_PTE1_GET> HIT in dcache, but unmapped" 2888 2962 << std::hex << " / paddr = " << r_dcache_tlb_paddr.read() 2889 2963 << std::dec << " / way = " << way … … 2919 2993 2920 2994 #if DEBUG_DCACHE 2921 if ( m_debug_ dcache_fsm)2995 if ( m_debug_activated ) 2922 2996 { 2923 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache" 2997 std::cout << " <PROC " << name() 2998 << " DCACHE_TLB_PTE1_GET> HIT in dcache" 2924 2999 << std::hex << " / paddr = " << r_dcache_tlb_paddr.read() 2925 3000 << std::dec << " / way = " << way … … 2940 3015 2941 3016 #if DEBUG_DCACHE 2942 if ( m_debug_ dcache_fsm)3017 if ( m_debug_activated ) 2943 3018 { 2944 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache" 3019 std::cout << " <PROC " << name() 3020 << " DCACHE_TLB_PTE1_GET> HIT in dcache" 2945 3021 << std::hex << " / paddr = " << r_dcache_tlb_paddr.read() 2946 3022 << std::dec << " / way = " << way … … 2966 3042 2967 3043 #if DEBUG_DCACHE 2968 if ( m_debug_ dcache_fsm)3044 if ( m_debug_activated ) 2969 3045 { 2970 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> MISS in dcache:" 3046 std::cout << " <PROC " << name() 3047 << " DCACHE_TLB_PTE1_GET> MISS in dcache:" 2971 3048 << " PTE1 address = " << std::hex << r_dcache_tlb_paddr.read() << std::endl; 2972 3049 } … … 3006 3083 3007 3084 #if DEBUG_DCACHE 3008 if ( m_debug_ dcache_fsm)3085 if ( m_debug_activated ) 3009 3086 { 3010 3087 if ( r_dcache_tlb_ins.read() ) 3011 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_SELECT> Select a slot in ITLB:"; 3088 std::cout << " <PROC " << name() 3089 << " DCACHE_TLB_PTE1_SELECT> Select a slot in ITLB:"; 3012 3090 else 3013 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_SELECT> Select a slot in DTLB:"; 3091 std::cout << " <PROC " << name() 3092 << ".DCACHE_TLB_PTE1_SELECT> Select a slot in DTLB:"; 3014 3093 std::cout << " way = " << std::dec << way 3015 3094 << " / set = " << set << std::endl; … … 3076 3155 3077 3156 #if DEBUG_DCACHE 3078 if ( m_debug_ dcache_fsm)3157 if ( m_debug_activated ) 3079 3158 { 3080 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> write PTE1 in ITLB"; 3081 std::cout << " / set = " << std::dec << r_dcache_tlb_set.read() 3159 std::cout << " <PROC " << name() 3160 << " DCACHE_TLB_PTE1_UPDT> write PTE1 in ITLB" 3161 << " / set = " << std::dec << r_dcache_tlb_set.read() 3082 3162 << " / way = " << r_dcache_tlb_way.read() << std::endl; 3083 3163 r_itlb.printTrace(); … … 3099 3179 3100 3180 #if DEBUG_DCACHE 3101 if ( m_debug_ dcache_fsm)3181 if ( m_debug_activated ) 3102 3182 { 3103 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> write PTE1 in DTLB"; 3104 std::cout << " / set = " << std::dec << r_dcache_tlb_set.read() 3183 std::cout << " <PROC " << name() 3184 << " DCACHE_TLB_PTE1_UPDT> write PTE1 in DTLB" 3185 << " / set = " << std::dec << r_dcache_tlb_set.read() 3105 3186 << " / way = " << r_dcache_tlb_way.read() << std::endl; 3106 3187 r_dtlb.printTrace(); … … 3115 3196 3116 3197 #if DEBUG_DCACHE 3117 if ( m_debug_ dcache_fsm)3198 if ( m_debug_activated ) 3118 3199 { 3119 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> L/R bit update required" 3200 std::cout << " <PROC " << name() 3201 << " DCACHE_TLB_PTE1_UPDT> L/R bit update required" 3120 3202 << std::endl; 3121 3203 } … … 3174 3256 3175 3257 #if DEBUG_DCACHE 3176 if ( m_debug_ dcache_fsm)3258 if ( m_debug_activated ) 3177 3259 { 3178 3260 std::cout << " <PROC " << name() 3179 << " DCACHE_TLB_PTE2_GET> HIT in dcache, but PTE isunmapped"3261 << " DCACHE_TLB_PTE2_GET> HIT in dcache, but PTE unmapped" 3180 3262 << " PTE_FLAGS = " << std::hex << pte_flags 3181 3263 << " PTE_PPN = " << std::hex << pte_ppn << std::endl; … … 3194 3276 3195 3277 #if DEBUG_DCACHE 3196 if ( m_debug_ dcache_fsm)3278 if ( m_debug_activated ) 3197 3279 { 3198 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE2_GET> HIT in dcache:" 3280 std::cout << " <PROC " << name() 3281 << " DCACHE_TLB_PTE2_GET> HIT in dcache:" 3199 3282 << " PTE_FLAGS = " << std::hex << pte_flags 3200 3283 << " PTE_PPN = " << std::hex << pte_ppn << std::endl; … … 3207 3290 // stalled until cleanup is acknowledged 3208 3291 r_dcache_fsm = DCACHE_TLB_PTE2_GET; 3292 3293 #if DEBUG_DCACHE 3294 if ( m_debug_activated ) 3295 { 3296 std::cout << " <PROC " << name() 3297 << " DCACHE_TLB_PTE2_GET> ZOMBI in dcache: waiting cleanup ack" 3298 << std::endl; 3299 } 3300 #endif 3209 3301 } 3210 3302 else // we must load the missing cache line in dcache … … 3217 3309 3218 3310 #if DEBUG_DCACHE 3219 if ( m_debug_ dcache_fsm)3311 if ( m_debug_activated ) 3220 3312 { 3221 3313 std::cout << " <PROC " << name() … … 3255 3347 3256 3348 #if DEBUG_DCACHE 3257 if ( m_debug_ dcache_fsm)3349 if ( m_debug_activated ) 3258 3350 { 3259 3351 if ( r_dcache_tlb_ins.read() ) … … 3331 3423 3332 3424 #if DEBUG_DCACHE 3333 if ( m_debug_ dcache_fsm)3425 if ( m_debug_activated ) 3334 3426 { 3335 3427 std::cout << " <PROC " << name() … … 3355 3447 3356 3448 #if DEBUG_DCACHE 3357 if ( m_debug_ dcache_fsm)3449 if ( m_debug_activated ) 3358 3450 { 3359 3451 std::cout << " <PROC " << name() … … 3373 3465 3374 3466 #if DEBUG_DCACHE 3375 if ( m_debug_ dcache_fsm)3467 if ( m_debug_activated ) 3376 3468 { 3377 3469 std::cout << " <PROC " << name() … … 3386 3478 { 3387 3479 #if DEBUG_DCACHE 3388 if ( m_debug_ dcache_fsm)3480 if ( m_debug_activated ) 3389 3481 { 3390 3482 std::cout << " <PROC " << name() … … 3431 3523 { 3432 3524 #if DEBUG_DCACHE 3433 if ( m_debug_ dcache_fsm)3525 if ( m_debug_activated ) 3434 3526 { 3435 3527 std::cout << " <PROC " << name() … … 3446 3538 { 3447 3539 #if DEBUG_DCACHE 3448 if ( m_debug_ dcache_fsm)3540 if ( m_debug_activated ) 3449 3541 { 3450 3542 std::cout << " <PROC " << name() … … 3541 3633 // returns to IDLE and flush TLBs when last slot 3542 3634 { 3635 // coherence request (from CC_RECEIVE FSM) 3636 if ( r_cc_receive_dcache_req.read() ) 3637 { 3638 r_dcache_fsm = DCACHE_CC_CHECK; 3639 r_dcache_fsm_cc_save = r_dcache_fsm.read(); 3640 break; 3641 } 3642 3543 3643 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request is sent 3544 3644 { 3545 3645 int state; 3546 uint32_ttag;3646 paddr_t tag; 3547 3647 size_t way = r_dcache_flush_count.read()/m_dcache_sets; 3548 3648 size_t set = r_dcache_flush_count.read()%m_dcache_sets; … … 3560 3660 // request cleanup 3561 3661 r_dcache_cc_send_req = true; 3562 r_dcache_cc_send_nline = tag * m_dcache_sets ;3662 r_dcache_cc_send_nline = tag * m_dcache_sets + set; 3563 3663 r_dcache_cc_send_way = way; 3564 3664 r_dcache_cc_send_type = CC_TYPE_CLEANUP; … … 3664 3764 3665 3765 #if DEBUG_DCACHE 3666 if ( m_debug_ dcache_fsm)3766 if ( m_debug_activated ) 3667 3767 { 3668 3768 std::cout << " <PROC " << name() … … 3707 3807 3708 3808 #if DEBUG_DCACHE 3709 if ( m_debug_ dcache_fsm)3809 if ( m_debug_activated ) 3710 3810 { 3711 3811 std::cout << " <PROC " << name() … … 3767 3867 3768 3868 #if DEBUG_DCACHE 3769 if ( m_debug_ dcache_fsm)3869 if ( m_debug_activated ) 3770 3870 { 3771 3871 std::cout << " <PROC " << name() … … 3804 3904 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request is sent 3805 3905 { 3806 bool found ;3807 bool cleanup ;3808 size_t way ;3809 size_t set ;3810 paddr_t victim ;3906 bool found = false; 3907 bool cleanup = false; 3908 size_t way = 0; 3909 size_t set = 0; 3910 paddr_t victim = 0; 3811 3911 3812 3912 #ifdef INSTRUMENTATION … … 3841 3941 3842 3942 #if DEBUG_DCACHE 3843 if ( m_debug_ dcache_fsm)3943 if ( m_debug_activated ) 3844 3944 { 3845 3945 std::cout << " <PROC " << name() … … 3848 3948 << " / SET = " << set 3849 3949 << " / PADDR = " << std::hex << r_dcache_save_paddr.read(); 3850 if(cleanup) std::cout << " / VICTIM = " << std::hex << victim<< std::endl;3950 if(cleanup) std::cout << " / VICTIM = " << (victim*m_dcache_words*4) << std::endl; 3851 3951 else std::cout << std::endl; 3852 3952 } … … 3864 3964 size_t way = r_dcache_miss_way.read(); 3865 3965 size_t set = r_dcache_miss_set.read(); 3866 paddr_t nline = r_dcache_save_paddr.read() / (m_dcache_words<<2);3867 3966 3868 3967 #ifdef INSTRUMENTATION … … 3873 3972 CACHE_SLOT_STATE_ZOMBI ); 3874 3973 #if DEBUG_DCACHE 3875 if ( m_debug_ dcache_fsm)3974 if ( m_debug_activated ) 3876 3975 { 3877 3976 std::cout << " <PROC " << name() … … 3886 3985 { 3887 3986 r_dcache_in_tlb[way*m_dcache_sets+set] = false; 3888 r_dcache_tlb_inval_line = nline;3987 r_dcache_tlb_inval_line = r_dcache_cc_send_nline; 3889 3988 r_dcache_tlb_inval_set = 0; 3890 3989 r_dcache_fsm_scan_save = DCACHE_MISS_WAIT; … … 3995 4094 r_vci_rsp_fifo_dcache.read() ); 3996 4095 #if DEBUG_DCACHE 3997 if ( m_debug_ dcache_fsm)4096 if ( m_debug_activated ) 3998 4097 { 3999 4098 std::cout << " <PROC " << name() 4000 4099 << " DCACHE_MISS_DATA_UPDT> Write one word:" 4001 << " / DATA = " << r_vci_rsp_fifo_dcache.read()4100 << " / DATA = " << std::hex << r_vci_rsp_fifo_dcache.read() 4002 4101 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4003 4102 << " / SET = " << r_dcache_miss_set.read() … … 4038 4137 if ( r_dcache_miss_inval.read() ) // switch slot to ZOMBI state, and new cleanup 4039 4138 { 4040 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request issent4139 if ( not r_dcache_cc_send_req.read() ) // blocked until previous request sent 4041 4140 { 4042 4141 r_dcache_miss_inval = false; … … 4055 4154 CACHE_SLOT_STATE_ZOMBI ); 4056 4155 #if DEBUG_DCACHE 4057 if ( m_debug_dcache_fsm ) 4058 { 4059 std::cout << " <PROC " << name() 4060 << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state" 4061 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4062 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4063 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4064 } 4156 if ( m_debug_activated ) 4157 std::cout << " <PROC " << name() 4158 << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state" 4159 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4160 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4161 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4065 4162 #endif 4066 4163 } … … 4080 4177 4081 4178 #if DEBUG_DCACHE 4082 if ( m_debug_dcache_fsm ) 4083 { 4084 std::cout << " <PROC " << name() 4085 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state" 4086 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4087 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4088 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4089 4090 r_dcache.printTrace(); 4091 4092 4093 } 4179 if ( m_debug_activated ) 4180 std::cout << " <PROC " << name() 4181 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state" 4182 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4183 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4184 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4094 4185 #endif 4095 4186 // reset directory extension … … 4263 4354 4264 4355 #if DEBUG_DCACHE 4265 if ( m_debug_ dcache_fsm)4356 if ( m_debug_activated ) 4266 4357 { 4267 4358 std::cout << " <PROC " << name() … … 4303 4394 4304 4395 #if DEBUG_DCACHE 4305 if ( m_debug_ dcache_fsm)4396 if ( m_debug_activated ) 4306 4397 { 4307 4398 std::cout << " <PROC " << name() … … 4325 4416 4326 4417 #if DEBUG_DCACHE 4327 if ( m_debug_ dcache_fsm)4418 if ( m_debug_activated ) 4328 4419 { 4329 4420 std::cout << " <PROC " << name() … … 4331 4422 << " r_dcache_vci_paddr = " << r_dcache_vci_paddr.read() 4332 4423 << " mask = " << mask 4333 << " (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) = " << (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) 4334 << " (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) = " << (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) 4335 << " ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) = " << ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) 4424 << " (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) = " 4425 << (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) 4426 << " (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) = " 4427 << (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) 4428 << " ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) = " 4429 << ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) 4336 4430 <<std::endl; 4337 4431 } … … 4361 4455 r_cc_receive_dcache_req = false; 4362 4456 #if DEBUG_DCACHE 4363 if ( m_debug_ dcache_fsm)4457 if ( m_debug_activated ) 4364 4458 { 4365 4459 std::cout << " <PROC " << name() … … 4395 4489 4396 4490 #if DEBUG_DCACHE 4397 if ( m_debug_ dcache_fsm)4491 if ( m_debug_activated ) 4398 4492 { 4399 4493 std::cout << " <PROC " << name() … … 4406 4500 else // no match 4407 4501 { 4408 int state ;4409 size_t way ;4410 size_t set ;4411 size_t word ;4502 int state = 0; 4503 size_t way = 0; 4504 size_t set = 0; 4505 size_t word = 0; 4412 4506 4413 4507 #ifdef INSTRUMENTATION … … 4459 4553 4460 4554 #if DEBUG_DCACHE 4461 if ( m_debug_ dcache_fsm)4555 if ( m_debug_activated ) 4462 4556 { 4463 4557 std::cout << " <PROC " << name() … … 4498 4592 4499 4593 #if DEBUG_DCACHE 4500 if ( m_debug_ dcache_fsm)4594 if ( m_debug_activated ) 4501 4595 { 4502 4596 std::cout << " <PROC " << name() … … 4514 4608 4515 4609 #if DEBUG_DCACHE 4516 if ( m_debug_ dcache_fsm)4610 if ( m_debug_activated ) 4517 4611 { 4518 4612 std::cout << " <PROC " << name() … … 4570 4664 4571 4665 #if DEBUG_DCACHE 4572 if ( m_debug_ dcache_fsm)4666 if ( m_debug_activated ) 4573 4667 { 4574 4668 std::cout << " <PROC " << name() … … 4590 4684 4591 4685 #if DEBUG_DCACHE 4592 if ( m_debug_ dcache_fsm)4686 if ( m_debug_activated ) 4593 4687 { 4594 4688 std::cout << " <PROC " << name() … … 4608 4702 4609 4703 // wait to send a request to cc_send_fsm 4610 if(not r_ icache_cc_send_req.read())4704 if(not r_dcache_cc_send_req.read()) 4611 4705 // cc_send is available 4612 4706 { … … 4663 4757 4664 4758 #if DEBUG_DCACHE 4665 if ( m_debug_ dcache_fsm)4759 if ( m_debug_activated ) 4666 4760 { 4667 4761 std::cout << " <PROC " << name() … … 4680 4774 r_dcache_cc_need_write = false; 4681 4775 #if DEBUG_DCACHE 4682 if ( m_debug_ dcache_fsm)4776 if ( m_debug_activated ) 4683 4777 { 4684 4778 std::cout << " <PROC " << name() … … 4734 4828 4735 4829 #if DEBUG_DCACHE 4736 if ( m_debug_ dcache_fsmand ok )4830 if ( m_debug_activated and ok ) 4737 4831 { 4738 4832 std::cout << " <PROC " << name() … … 4750 4844 4751 4845 #if DEBUG_DCACHE 4752 if ( m_debug_dcache_fsm and ok ) 4753 { 4754 std::cout << " <PROC " << name() 4755 << ".DCACHE_INVAL_TLB_SCAN> Invalidate DTLB entry:" << std::hex 4756 << " line = " << line << std::dec 4757 << " / set = " << set 4758 << " / way = " << way << std::endl; 4759 } 4846 if ( m_debug_activated and ok ) 4847 std::cout << " <PROC " << name() << " DCACHE_INVAL_TLB_SCAN>" 4848 << " Invalidate DTLB entry" << std::hex 4849 << " / line = " << line << std::dec 4850 << " / set = " << set 4851 << " / way = " << way << std::endl; 4760 4852 #endif 4761 4853 } … … 4847 4939 //////////////////////////////////////////////////////////////////////////////////// 4848 4940 4941 4849 4942 switch ( r_vci_cmd_fsm.read() ) 4850 4943 { … … 4852 4945 case CMD_IDLE: 4853 4946 { 4854 // D DACHE read requests (r_dcache_vci_miss_req or r_dcache_vci_ll_req), and4947 // DCACHE read requests (r_dcache_vci_miss_req or r_dcache_vci_ll_req), and 4855 4948 // ICACHE read requests (r_icache_miss_req) require both a write_buffer access 4856 4949 // to check a possible pending write on the same cache line. … … 4877 4970 or r_vci_cmd_imiss_prio.read() ); 4878 4971 4879 4880 4972 // 1 - Data Read Miss 4881 4973 if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) … … 4911 5003 else if ( r_icache_unc_req.read() ) 4912 5004 { 4913 r_vci_cmd_fsm = CMD_INS_UNC;4914 r_icache_unc_req = false;5005 r_vci_cmd_fsm = CMD_INS_UNC; 5006 r_icache_unc_req = false; 4915 5007 // m_cpt_iunc_transaction++; 4916 5008 } … … 4941 5033 // m_cpt_cas_transaction++; 4942 5034 } 5035 5036 #if DEBUG_CMD 5037 if ( m_debug_activated ) 5038 { 5039 std::cout << " <PROC " << name() << " CMD_IDLE>" 5040 << " / dmiss_req = " << dcache_miss_req 5041 << " / imiss_req = " << icache_miss_req 5042 << std::endl; 5043 } 5044 #endif 4943 5045 break; 4944 5046 } … … 4977 5079 { 4978 5080 // all read VCI commands contain one single flit 4979 if ( p_vci.cmdack.read() ) r_vci_cmd_fsm = CMD_IDLE; 5081 if ( p_vci.cmdack.read() ) { 5082 r_vci_cmd_fsm = CMD_IDLE; 5083 } 4980 5084 break; 4981 5085 } … … 5172 5276 break; 5173 5277 } 5174 ///////////////// ///5278 ///////////////// 5175 5279 case RSP_DATA_LL: 5176 5280 { … … 5181 5285 r_vci_rsp_data_error = true; 5182 5286 r_vci_rsp_fsm = RSP_IDLE; 5287 break; 5183 5288 } 5184 5289 if (r_vci_rsp_cpt.read() == 0) //first flit … … 5243 5348 // we first check for the last client and listen for // 5244 5349 // a request of the other, then update the client // 5350 // r_cc_send_last_client : 0 dcache / 1 icache 5245 5351 /////////////////////////////////////////////////////// 5246 // r_cc_send_last_client : 0 dcache / 1 icache5247 5352 bool update_last_client = r_cc_send_last_client.read(); 5248 5353 if ( r_cc_send_last_client.read() == 0 ) // last client was dcache … … 5261 5366 if (r_dcache_cc_send_req.read() or r_icache_cc_send_req.read()) 5262 5367 { 5263 // test if the new client is dcache and has a cleanup request 5264 if ( (update_last_client == 0) and (r_dcache_cc_send_type.read() == CC_TYPE_CLEANUP)) 5368 // the new client is dcache and has a cleanup request 5369 if ( (update_last_client == 0) and 5370 (r_dcache_cc_send_type.read() == CC_TYPE_CLEANUP)) 5265 5371 r_cc_send_fsm = CC_SEND_CLEANUP_1; 5266 // test if the new client is dcache and has a multi acknowledgement request 5267 else if ( (update_last_client == 0) and (r_dcache_cc_send_type.read() == CC_TYPE_MULTI_ACK)) 5372 // the new client is dcache and has a multi acknowledgement request 5373 else if ( (update_last_client == 0) and 5374 (r_dcache_cc_send_type.read() == CC_TYPE_MULTI_ACK)) 5268 5375 r_cc_send_fsm = CC_SEND_MULTI_ACK; 5269 // test if the new client is icache and has a cleanup request 5270 else if ( (update_last_client == 1) and (r_icache_cc_send_type.read() == CC_TYPE_CLEANUP)) 5376 // the new client is icache and has a cleanup request 5377 else if ( (update_last_client == 1) and 5378 (r_icache_cc_send_type.read() == CC_TYPE_CLEANUP)) 5271 5379 r_cc_send_fsm = CC_SEND_CLEANUP_1; 5272 // test if the new client is icache and has a multi acknowledgement request 5273 else if ( (update_last_client == 1) and (r_icache_cc_send_type.read() == CC_TYPE_MULTI_ACK)) 5380 // the new client is icache and has a multi acknowledgement request 5381 else if ( (update_last_client == 1) and 5382 (r_icache_cc_send_type.read() == CC_TYPE_MULTI_ACK)) 5274 5383 r_cc_send_fsm = CC_SEND_MULTI_ACK; 5275 5384 } … … 5321 5430 // C_RECEIVE FSM 5322 5431 // This FSM receive all coherence packets on a DSPIN40 port. 5323 // There is 4packet types:5432 // There is 7 packet types: 5324 5433 // - CC_DATA_INVAL : DCACHE invalidate request 5325 5434 // - CC_DATA_UPDT : DCACHE update request (multi-words) … … 5341 5450 uint64_t receive_data = p_dspin_in.data.read(); 5342 5451 // initialize coherence packet type 5343 uint64_t receive_type = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::FROM_MC_TYPE); 5452 uint64_t receive_type = DspinDhccpParam::dspin_get(receive_data, 5453 DspinDhccpParam::FROM_MC_TYPE); 5344 5454 // initialize data/ins flip_flop (0 data / 1 ins) 5345 5455 r_cc_receive_data_ins = (bool)(receive_type & 0x1); … … 5376 5486 5377 5487 // for data CLACK, wait for dcache to take the request 5378 if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) 5488 if ((r_cc_receive_data_ins.read() == 0) and 5489 not (r_cc_receive_dcache_req.read())) 5379 5490 { 5380 5491 // request dcache to handle the CLACK 5381 5492 r_cc_receive_dcache_req = true; 5382 r_cc_receive_dcache_set = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::CLEANUP_ACK_SET) & ((1ULL<<(uint32_log2(m_dcache_sets)))-1); 5383 r_cc_receive_dcache_way = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::CLEANUP_ACK_WAY) & ((1ULL<<(uint32_log2(m_dcache_ways)))-1); 5493 r_cc_receive_dcache_set = DspinDhccpParam::dspin_get(receive_data, 5494 DspinDhccpParam::CLEANUP_ACK_SET) & 5495 ((1ULL<<(uint32_log2(m_dcache_sets)))-1); 5496 r_cc_receive_dcache_way = DspinDhccpParam::dspin_get(receive_data, 5497 DspinDhccpParam::CLEANUP_ACK_WAY) & 5498 ((1ULL<<(uint32_log2(m_dcache_ways)))-1); 5384 5499 r_cc_receive_dcache_type = CC_TYPE_CLACK; 5385 5500 // get back to idle state … … 5388 5503 } 5389 5504 // for ins CLACK, wait for icache to take the request 5390 if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())) 5505 if ((r_cc_receive_data_ins.read() == 1) and 5506 not (r_cc_receive_icache_req.read())) 5391 5507 { 5392 5508 // request icache to handle the CLACK 5393 5509 r_cc_receive_icache_req = true; 5394 r_cc_receive_icache_set = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::CLEANUP_ACK_SET) & ((1ULL<<(uint32_log2(m_icache_sets)))-1); 5395 r_cc_receive_icache_way = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::CLEANUP_ACK_WAY) & ((1ULL<<(uint32_log2(m_icache_ways)))-1); 5510 r_cc_receive_icache_set = DspinDhccpParam::dspin_get(receive_data, 5511 DspinDhccpParam::CLEANUP_ACK_SET) & 5512 ((1ULL<<(uint32_log2(m_icache_sets)))-1); 5513 r_cc_receive_icache_way = DspinDhccpParam::dspin_get(receive_data, 5514 DspinDhccpParam::CLEANUP_ACK_WAY) & 5515 ((1ULL<<(uint32_log2(m_icache_ways)))-1); 5396 5516 r_cc_receive_icache_type = CC_TYPE_CLACK; 5397 5517 // get back to idle state … … 5418 5538 // not to actually post a request to an available cache => need a 5419 5539 // flip_flop to check that ? 5420 if (not (r_cc_receive_icache_req.read()) and not (r_cc_receive_dcache_req.read()) and (p_dspin_in.write.read())) 5540 if (not (r_cc_receive_icache_req.read()) and 5541 not (r_cc_receive_dcache_req.read()) and 5542 (p_dspin_in.write.read())) 5421 5543 { 5422 5544 // request dcache to handle the BROADCAST 5423 5545 r_cc_receive_dcache_req = true; 5424 r_cc_receive_dcache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::BROADCAST_NLINE); 5546 r_cc_receive_dcache_nline = DspinDhccpParam::dspin_get(receive_data, 5547 DspinDhccpParam::BROADCAST_NLINE); 5425 5548 r_cc_receive_dcache_type = CC_TYPE_BRDCAST; 5426 5549 // request icache to handle the BROADCAST 5427 5550 r_cc_receive_icache_req = true; 5428 r_cc_receive_icache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::BROADCAST_NLINE); 5551 r_cc_receive_icache_nline = DspinDhccpParam::dspin_get(receive_data, 5552 DspinDhccpParam::BROADCAST_NLINE); 5429 5553 r_cc_receive_icache_type = CC_TYPE_BRDCAST; 5430 5554 // get back to idle state … … 5441 5565 uint64_t receive_data = p_dspin_in.data.read(); 5442 5566 // for data INVAL, wait for dcache to take the request 5443 if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read())) 5444 { 5445 r_cc_receive_dcache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_UPDT_INDEX); 5567 if ((r_cc_receive_data_ins.read() == 0) and 5568 not (r_cc_receive_dcache_req.read())) 5569 { 5570 r_cc_receive_dcache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data, 5571 DspinDhccpParam::MULTI_INVAL_UPDT_INDEX); 5446 5572 r_cc_receive_fsm = CC_RECEIVE_INVAL_NLINE; 5447 5573 break; 5448 5574 } 5449 5575 // for ins INVAL, wait for icache to take the request 5450 if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read())) 5451 { 5452 r_cc_receive_icache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_INVAL_UPDT_INDEX); 5576 if ((r_cc_receive_data_ins.read() == 1) and 5577 not (r_cc_receive_icache_req.read())) 5578 { 5579 r_cc_receive_icache_updt_tab_idx = DspinDhccpParam::dspin_get(receive_data, 5580 DspinDhccpParam::MULTI_INVAL_UPDT_INDEX); 5453 5581 r_cc_receive_fsm = CC_RECEIVE_INVAL_NLINE; 5454 5582 break; … … 5463 5591 uint64_t receive_data = p_dspin_in.data.read(); 5464 5592 // for data INVAL, wait for dcache to take the request 5465 if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read()) and (p_dspin_in.write.read())) 5593 if ( (r_cc_receive_data_ins.read() == 0) and 5594 not (r_cc_receive_dcache_req.read()) and 5595 (p_dspin_in.write.read()) ) 5466 5596 { 5467 5597 // request dcache to handle the INVAL … … 5485 5615 } 5486 5616 // we should never get there 5487 assert ( false && " CC_RECEIVE_INVAL_NLINE : incoherent handling of either r_cc_receive_data_ins or r_cc_receive_*cache_req\n");5617 assert ( false && "ERROR in CC_VCACHE : CC_RECEIVE_INVAL_NLINE\n"); 5488 5618 } 5489 5619 //////////////////////////// … … 5518 5648 // for data INVAL, wait for dcache to take the request and fifo to 5519 5649 // be empty 5520 if ((r_cc_receive_data_ins.read() == 0) and not (r_cc_receive_dcache_req.read()) and r_cc_receive_updt_fifo_be.empty() and (p_dspin_in.write.read())) 5650 if ( (r_cc_receive_data_ins.read() == 0) and 5651 not (r_cc_receive_dcache_req.read()) and 5652 r_cc_receive_updt_fifo_be.empty() and 5653 (p_dspin_in.write.read()) ) 5521 5654 { 5522 5655 r_cc_receive_dcache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE); … … 5529 5662 // for ins INVAL, wait for icache to take the request and fifo to be 5530 5663 // empty 5531 if ((r_cc_receive_data_ins.read() == 1) and not (r_cc_receive_icache_req.read()) and r_cc_receive_updt_fifo_be.empty() and (p_dspin_in.write.read())) 5664 if ( (r_cc_receive_data_ins.read() == 1) and 5665 not (r_cc_receive_icache_req.read()) and 5666 r_cc_receive_updt_fifo_be.empty() and 5667 (p_dspin_in.write.read())) 5532 5668 { 5533 5669 r_cc_receive_icache_nline = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_NLINE); … … 5539 5675 } 5540 5676 // we should never get there 5541 assert ( false && " CC_RECEIVE_UPDT_NLINE : incoherent handling of either r_cc_receive_data_ins or r_cc_receive_*cache_req or r_cc_receive_fifo\n");5677 assert ( false && "ERROR in CC_VCACHE : CC_RECEIVE_UPDT_NLINE \n"); 5542 5678 break; 5543 5679 } … … 5550 5686 r_cc_receive_icache_req = true; 5551 5687 5552 // sample data, be and eop5553 uint64_t receive_data = p_dspin_in.data.read();5554 5688 // wait for the fifo 5555 5689 if (r_cc_receive_updt_fifo_be.wok() and (p_dspin_in.write.read())) 5556 5690 { 5557 cc_receive_updt_fifo_be = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_BE); 5691 uint64_t receive_data = p_dspin_in.data.read(); 5692 bool receive_eop = p_dspin_in.eop.read(); 5693 cc_receive_updt_fifo_be = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_BE); 5558 5694 cc_receive_updt_fifo_data = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::MULTI_UPDT_DATA); 5559 // sample eop to test for state exit 5560 bool flit_eop = DspinDhccpParam::dspin_get(receive_data,DspinDhccpParam::FROM_MC_EOP); 5561 cc_receive_updt_fifo_eop = flit_eop; 5695 cc_receive_updt_fifo_eop = receive_eop; 5562 5696 cc_receive_updt_fifo_put = true; 5563 if(flit_eop) 5564 r_cc_receive_fsm = CC_RECEIVE_IDLE; 5697 if ( receive_eop ) r_cc_receive_fsm = CC_RECEIVE_IDLE; 5565 5698 } 5566 5699 break; … … 5610 5743 p_vci.cfixed = false; 5611 5744 5745 if ( m_monitor_ok ) { 5746 if ( p_vci.cmdack.read() == true and p_vci.cmdval == true) { 5747 if (((p_vci.address.read()) >= m_monitor_base) and 5748 ((p_vci.address.read()) < m_monitor_base + m_monitor_length) ) { 5749 std::cout << "CC_VCACHE Monitor " << name() << std::hex 5750 << " Access type = " << vci_cmd_type_str[p_vci.cmd.read()] 5751 << " Pktid type = " << vci_pktid_type_str[p_vci.pktid.read()] 5752 << " : address = " << p_vci.address.read() 5753 << " / be = " << p_vci.be.read(); 5754 if ( p_vci.cmd.read() == vci_param::CMD_WRITE ) { 5755 std::cout << " / data = " << p_vci.wdata.read(); 5756 } 5757 std::cout << std::dec << std::endl; 5758 } 5759 } 5760 } 5761 5612 5762 switch ( r_vci_cmd_fsm.read() ) { 5613 5763 … … 5738 5888 5739 5889 5740 // Send coherence packets on DSPIN L2M5890 // Send coherence packets on DSPIN P2M 5741 5891 // it depends on the CC_SEND FSM 5742 5892 … … 5754 5904 { 5755 5905 // initialize dspin send data 5756 DspinDhccpParam::dspin_set(dspin_send_data,5757 0,5758 DspinDhccpParam::FROM_L1_EOP);5906 // DspinDhccpParam::dspin_set(dspin_send_data, 5907 // 0, 5908 // DspinDhccpParam::FROM_L1_EOP); 5759 5909 DspinDhccpParam::dspin_set(dspin_send_data, 5760 5910 m_cc_global_id, … … 5775 5925 5776 5926 DspinDhccpParam::dspin_set(dspin_send_data, 5777 r_dcache_cc_send_nline.read() & 0x300000000ULL,5927 (r_dcache_cc_send_nline.read() & 0x300000000ULL)>>32, 5778 5928 DspinDhccpParam::CLEANUP_NLINE_MSB); 5779 5929 … … 5797 5947 5798 5948 DspinDhccpParam::dspin_set(dspin_send_data, 5799 r_icache_cc_send_nline.read() & 0x300000000ULL,5949 (r_icache_cc_send_nline.read() & 0x300000000ULL)>>32, 5800 5950 DspinDhccpParam::CLEANUP_NLINE_MSB); 5801 5951 … … 5811 5961 p_dspin_out.data = dspin_send_data; 5812 5962 p_dspin_out.write = true; 5963 p_dspin_out.eop = false; 5813 5964 break; 5814 5965 } … … 5817 5968 { 5818 5969 // initialize dspin send data 5819 DspinDhccpParam::dspin_set(dspin_send_data,5820 1,5821 DspinDhccpParam::FROM_L1_EOP);5970 // DspinDhccpParam::dspin_set(dspin_send_data, 5971 // 1, 5972 // DspinDhccpParam::FROM_L1_EOP); 5822 5973 5823 5974 if(r_cc_send_last_client.read() == 0) // dcache active request … … 5836 5987 p_dspin_out.data = dspin_send_data; 5837 5988 p_dspin_out.write = true; 5989 p_dspin_out.eop = true; 5838 5990 break; 5839 5991 } … … 5842 5994 { 5843 5995 // initialize dspin send data 5844 DspinDhccpParam::dspin_set(dspin_send_data,5845 1,5846 DspinDhccpParam::FROM_L1_EOP);5996 // DspinDhccpParam::dspin_set(dspin_send_data, 5997 // 1, 5998 // DspinDhccpParam::FROM_L1_EOP); 5847 5999 DspinDhccpParam::dspin_set(dspin_send_data, 5848 6000 0, … … 5884 6036 p_dspin_out.data = dspin_send_data; 5885 6037 p_dspin_out.write = true; 6038 p_dspin_out.eop = true; 5886 6039 5887 6040 break; … … 5951 6104 r_cc_receive_updt_fifo_be.empty()) 5952 6105 or 5953 (( r_cc_receive_data_ins.read() == 1) and6106 (((r_cc_receive_data_ins.read() == 1) and 5954 6107 not r_cc_receive_icache_req.read()) and 5955 r_cc_receive_updt_fifo_be.empty()) 6108 r_cc_receive_updt_fifo_be.empty())) 5956 6109 p_dspin_in.read = true; 5957 6110 else … … 5987 6140 } // end genMoore 5988 6141 6142 tmpl(void)::start_monitor(paddr_t base, paddr_t length) 6143 // This version of monitor print both Read and Write request 6144 { 6145 m_monitor_ok = true; 6146 m_monitor_base = base; 6147 m_monitor_length = length; 6148 } 6149 6150 tmpl(void)::stop_monitor() 6151 { 6152 m_monitor_ok = false; 6153 } 6154 5989 6155 }} 5990 6156
Note: See TracChangeset
for help on using the changeset viewer.