- Timestamp:
- May 28, 2013, 9:53:03 AM (12 years ago)
- Location:
- trunk/modules/vci_cc_vcache_wrapper/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_cc_vcache_wrapper/caba/source/include/vci_cc_vcache_wrapper.h
r386 r394 63 63 : public soclib::caba::BaseModule 64 64 { 65 typedef uint32_t vaddr_t; 66 typedef uint32_t tag_t; 67 typedef uint32_t type_t; 68 typedef typename iss_t::DataOperationType data_op_t; 69 70 typedef typename vci_param::addr_t paddr_t; 71 typedef typename vci_param::data_t vci_data_t; 72 typedef typename vci_param::be_t vci_be_t; 73 typedef typename vci_param::srcid_t vci_srcid_t; 74 typedef typename vci_param::trdid_t vci_trdid_t; 75 typedef typename vci_param::pktid_t vci_pktid_t; 76 typedef typename vci_param::plen_t vci_plen_t; 77 78 enum icache_fsm_state_e { 65 66 typedef typename vci_param::fast_addr_t paddr_t; 67 68 enum icache_fsm_state_e 69 { 79 70 ICACHE_IDLE, 80 71 // handling XTN processor requests … … 104 95 }; 105 96 106 enum dcache_fsm_state_e { 97 enum dcache_fsm_state_e 98 { 107 99 DCACHE_IDLE, 108 100 // handling itlb & dtlb miss … … 154 146 }; 155 147 156 enum cmd_fsm_state_e { 148 enum cmd_fsm_state_e 149 { 157 150 CMD_IDLE, 158 151 CMD_INS_MISS, … … 166 159 }; 167 160 168 enum rsp_fsm_state_e { 161 enum rsp_fsm_state_e 162 { 169 163 RSP_IDLE, 170 164 RSP_INS_MISS, … … 176 170 }; 177 171 178 enum cc_receive_fsm_state_e { 172 enum cc_receive_fsm_state_e 173 { 179 174 CC_RECEIVE_IDLE, 180 175 CC_RECEIVE_CLACK, … … 188 183 }; 189 184 190 enum cc_send_fsm_state_e { 185 enum cc_send_fsm_state_e 186 { 191 187 CC_SEND_IDLE, 192 188 CC_SEND_CLEANUP_1, … … 224 220 225 221 // cc_send_type 226 typedef enum { 222 typedef enum 223 { 227 224 CC_TYPE_CLEANUP, 228 225 CC_TYPE_MULTI_ACK, … … 230 227 231 228 // cc_receive_type 232 typedef enum { 229 typedef enum 230 { 233 231 CC_TYPE_CLACK, 234 232 CC_TYPE_BRDCAST, … … 238 236 239 237 // TLB Mode : ITLB / DTLB / ICACHE / DCACHE 240 enum { 238 enum 239 { 241 240 INS_TLB_MASK = 0x8, 242 241 DATA_TLB_MASK = 0x4, … … 298 297 soclib::common::AddressDecodingTable<uint32_t, bool> m_cacheability_table; 299 298 300 const vci_srcid_tm_srcid;299 const size_t m_srcid; 301 300 const size_t m_cc_global_id; 302 301 const size_t m_nline_width; … … 330 329 331 330 ///////////////////////////////////////////// 332 // debug variables (for each FSM)331 // debug variables 333 332 ///////////////////////////////////////////// 334 bool m_debug_previous_hit; 335 bool m_idebug_previous_hit; 336 bool m_debug_dcache_fsm; 337 bool m_debug_icache_fsm; 338 bool m_debug_inval_itlb_fsm; 339 bool m_debug_inval_dtlb_fsm; 333 bool m_debug_previous_i_hit; 334 bool m_debug_previous_d_hit; 335 bool m_debug_activated; 340 336 341 337 /////////////////////////////// … … 404 400 sc_signal<uint32_t> r_dcache_save_vaddr; // virtual address (from proc) 405 401 sc_signal<uint32_t> r_dcache_save_wdata; // write data (from proc) 406 sc_signal< vci_be_t> r_dcache_save_be; // byte enable (from proc)402 sc_signal<uint32_t> r_dcache_save_be; // byte enable (from proc) 407 403 sc_signal<paddr_t> r_dcache_save_paddr; // physical address 408 404 sc_signal<bool> r_dcache_save_cacheable; // address cacheable … … 425 421 sc_signal<bool> r_dcache_vci_ll_req; // atomic read request LL 426 422 sc_signal<bool> r_dcache_vci_sc_req; // atomic write request SC 427 sc_signal< vci_data_t>r_dcache_vci_sc_data; // SC data (command)423 sc_signal<uint32_t> r_dcache_vci_sc_data; // SC data (command) 428 424 429 425 // register used for XTN inval … … 482 478 483 479 // dcache directory extension 484 bool *r_dcache_in_tlb; // copy exist in dtlb or itlb 485 bool *r_dcache_contains_ptd; // cache line contains a PTD 480 bool *r_dcache_in_tlb; // copy exist in dtlb or itlb 481 bool *r_dcache_contains_ptd; // cache line contains a PTD 482 483 // Physical address extension for data access 484 sc_signal<uint32_t> r_dcache_paddr_ext; // CP2 register (if vci_address > 32) 486 485 487 486 /////////////////////////////////// … … 489 488 /////////////////////////////////// 490 489 sc_signal<int> r_vci_cmd_fsm; 491 sc_signal<size_t> r_vci_cmd_min; // used for write bursts492 sc_signal<size_t> r_vci_cmd_max; // used for write bursts493 sc_signal<size_t> r_vci_cmd_cpt; // used for write bursts494 sc_signal<bool> r_vci_cmd_imiss_prio; // round-robin between imiss & dmiss490 sc_signal<size_t> r_vci_cmd_min; // used for write bursts 491 sc_signal<size_t> r_vci_cmd_max; // used for write bursts 492 sc_signal<size_t> r_vci_cmd_cpt; // used for write bursts 493 sc_signal<bool> r_vci_cmd_imiss_prio; // round-robin between imiss & dmiss 495 494 496 495 /////////////////////////////////// … … 501 500 sc_signal<bool> r_vci_rsp_ins_error; 502 501 sc_signal<bool> r_vci_rsp_data_error; 503 GenericFifo<uint32_t> r_vci_rsp_fifo_icache; // response FIFO to ICACHE FSM504 GenericFifo<uint32_t> r_vci_rsp_fifo_dcache; // response FIFO to DCACHE FSM502 GenericFifo<uint32_t> r_vci_rsp_fifo_icache; // response FIFO to ICACHE FSM 503 GenericFifo<uint32_t> r_vci_rsp_fifo_dcache; // response FIFO to DCACHE FSM 505 504 506 505 /////////////////////////////////// 507 506 // CC_SEND FSM REGISTER 508 507 /////////////////////////////////// 509 sc_signal<int> r_cc_send_fsm; // state register510 sc_signal<bool> r_cc_send_last_client; // round robin flip-flop :0 dcache / 1 icache508 sc_signal<int> r_cc_send_fsm; // state register 509 sc_signal<bool> r_cc_send_last_client; // 0 dcache / 1 icache 511 510 512 511 /////////////////////////////////// 513 512 // CC_RECEIVE FSM REGISTER 514 513 /////////////////////////////////// 515 sc_signal<int> r_cc_receive_fsm; // state register516 sc_signal<bool> r_cc_receive_data_ins; // request concerning: 0 dcache / 1 icache517 518 // communication cc updt FIFObetween CC_RECEIVE FSM and ICACHE/DCACHE FSM519 sc_signal<size_t> r_cc_receive_word_idx; // word index514 sc_signal<int> r_cc_receive_fsm; // state register 515 sc_signal<bool> r_cc_receive_data_ins; // request to : 0 dcache / 1 icache 516 517 // communication between CC_RECEIVE FSM and ICACHE/DCACHE FSM 518 sc_signal<size_t> r_cc_receive_word_idx; // word index 520 519 GenericFifo<uint32_t> r_cc_receive_updt_fifo_be; 521 520 GenericFifo<uint32_t> r_cc_receive_updt_fifo_data; … … 523 522 524 523 // communication between CC_RECEIVE FSM and ICACHE FSM 525 sc_signal<bool> r_cc_receive_icache_req; // cc_receive to icache request526 sc_signal<cc_receive_t> r_cc_receive_icache_type; // cc_receive type of coherencerequest527 sc_signal<size_t> r_cc_receive_icache_way; // cc_receive to icache way528 sc_signal<size_t> r_cc_receive_icache_set; // cc_receive to icache set524 sc_signal<bool> r_cc_receive_icache_req; // cc_receive to icache request 525 sc_signal<cc_receive_t> r_cc_receive_icache_type; // cc_receive type of request 526 sc_signal<size_t> r_cc_receive_icache_way; // cc_receive to icache way 527 sc_signal<size_t> r_cc_receive_icache_set; // cc_receive to icache set 529 528 sc_signal<size_t> r_cc_receive_icache_updt_tab_idx; // cc_receive update table index 530 sc_signal<paddr_t> r_cc_receive_icache_nline; // cache line physical address529 sc_signal<paddr_t> r_cc_receive_icache_nline; // cache line physical address 531 530 532 531 // communication between CC_RECEIVE FSM and DCACHE FSM 533 sc_signal<bool> r_cc_receive_dcache_req; // cc_receive to dcache request534 sc_signal<cc_receive_t> r_cc_receive_dcache_type; // cc_receive type of coherencerequest535 sc_signal<size_t> r_cc_receive_dcache_way; // cc_receive to dcache way536 sc_signal<size_t> r_cc_receive_dcache_set; // cc_receive to dcache set532 sc_signal<bool> r_cc_receive_dcache_req; // cc_receive to dcache request 533 sc_signal<cc_receive_t> r_cc_receive_dcache_type; // cc_receive type of request 534 sc_signal<size_t> r_cc_receive_dcache_way; // cc_receive to dcache way 535 sc_signal<size_t> r_cc_receive_dcache_set; // cc_receive to dcache set 537 536 sc_signal<size_t> r_cc_receive_dcache_updt_tab_idx; // cc_receive update table index 538 sc_signal<paddr_t> r_cc_receive_dcache_nline; // cache line physical address537 sc_signal<paddr_t> r_cc_receive_dcache_nline; // cache line physical address 539 538 540 539 ////////////////////////////////////////////////////////////////// … … 714 713 void print_trace(size_t mode = 0); 715 714 void cache_monitor(paddr_t addr); 716 inline void iss_set_debug_mask(uint v) { 717 r_iss.set_debug_mask(v); 715 inline void iss_set_debug_mask(uint v) 716 { 717 r_iss.set_debug_mask(v); 718 718 } 719 719 -
trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
r387 r394 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 { … … 464 464 << " | " << rsp_fsm_state_str[r_vci_rsp_fsm.read()] 465 465 << " | " << cc_receive_fsm_state_str[r_cc_receive_fsm.read()] 466 << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()]; 466 << " | " << cc_send_fsm_state_str[r_cc_send_fsm.read()] 467 << " | MMU = " << r_mmu_mode.read(); 467 468 if (r_dcache_updt_req.read() ) std::cout << " | P1_UPDT"; 468 469 if (r_dcache_wbuf_req.read() ) std::cout << " | P1_WBUF"; … … 499 500 ////////////////////////////////////////// 500 501 { 501 size_t cache_way; 502 size_t cache_set; 503 size_t cache_word; 504 uint32_t cache_rdata; 505 bool cache_hit = r_dcache.read_neutral( addr, 506 &cache_rdata, 507 &cache_way, 508 &cache_set, 509 &cache_word ); 510 bool icache_hit = r_icache.read_neutral( addr, 511 &cache_rdata, 512 &cache_way, 513 &cache_set, 514 &cache_word ); 515 if ( cache_hit != m_debug_previous_hit ) 516 { 517 std::cout << "PROC " << name() 518 << " dcache change at cycle " << std::dec << m_cpt_total_cycles 519 << " for adresse " << std::hex << addr 520 << " / HIT = " << std::dec << cache_hit << std::endl; 521 m_debug_previous_hit = cache_hit; 522 } 523 if ( icache_hit != m_idebug_previous_hit ) 524 { 525 std::cout << "PROC " << name() 526 << " icache change at cycle " << std::dec << m_cpt_total_cycles 527 << " for adresse " << std::hex << addr 528 << " / HIT = " << icache_hit << std::endl; 529 m_idebug_previous_hit = icache_hit; 502 bool cache_hit; 503 size_t cache_way = 0; 504 size_t cache_set = 0; 505 size_t cache_word = 0; 506 uint32_t cache_rdata = 0; 507 508 cache_hit = r_dcache.read_neutral( addr, 509 &cache_rdata, 510 &cache_way, 511 &cache_set, 512 &cache_word ); 513 514 if ( cache_hit != m_debug_previous_d_hit ) 515 { 516 std::cout << "Monitor PROC " << name() 517 << " DCACHE at cycle " << std::dec << m_cpt_total_cycles 518 << " / HIT = " << cache_hit 519 << " / PADDR = " << std::hex << addr 520 << " / DATA = " << cache_rdata 521 << " / WAY = " << cache_way << std::endl; 522 m_debug_previous_d_hit = cache_hit; 523 } 524 525 cache_hit = r_icache.read_neutral( addr, 526 &cache_rdata, 527 &cache_way, 528 &cache_set, 529 &cache_word ); 530 531 if ( cache_hit != m_debug_previous_i_hit ) 532 { 533 std::cout << "Monitor PROC " << name() 534 << " ICACHE at cycle " << std::dec << m_cpt_total_cycles 535 << " / HIT = " << cache_hit 536 << " / PADDR = " << std::hex << addr 537 << " / DATA = " << cache_rdata 538 << " / WAY = " << cache_way << std::endl; 539 m_debug_previous_i_hit = cache_hit; 530 540 } 531 541 } … … 681 691 ///////////////////////// 682 692 { 683 #define LLSCLocalTable GenericLLSCLocalTable<8000, 1, paddr_t, vci_trdid_t, vci_data_t>684 693 if ( not p_resetn.read() ) 685 694 { … … 698 707 r_cc_send_fsm = CC_SEND_IDLE; 699 708 709 // reset data physical address extension 710 r_dcache_paddr_ext = 0; 711 700 712 // reset dcache directory extension 701 713 for (size_t i=0 ; i< m_dcache_ways*m_dcache_sets ; i++) … … 710 722 711 723 // ICACHE & DCACHE activated 724 // ITLB & DTLB desactivated 712 725 r_mmu_mode = 0x3; 713 726 … … 762 775 763 776 // Debug variables 764 m_debug_previous_hit = false; 765 m_idebug_previous_hit = false; 766 m_debug_dcache_fsm = false; 767 m_debug_icache_fsm = false; 777 m_debug_previous_i_hit = false; 778 m_debug_previous_d_hit = false; 779 m_debug_activated = false; 768 780 769 781 // activity counters … … 905 917 m_cpt_total_cycles++; 906 918 907 m_debug_icache_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 908 m_debug_dcache_fsm = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 919 m_debug_activated = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok; 909 920 910 921 ///////////////////////////////////////////////////////////////////// … … 1157 1168 r_icache_fsm = ICACHE_MISS_SELECT; 1158 1169 #if DEBUG_ICACHE 1159 if ( m_debug_icache_fsm ) 1160 { 1161 std::cout << " <PROC " << name() 1162 << " ICACHE_IDLE> READ MISS in icache" 1163 << " : PADDR = " << std::hex << paddr << std::endl; 1164 } 1170 if ( m_debug_activated ) 1171 std::cout << " <PROC " << name() << " ICACHE_IDLE> READ MISS in icache" 1172 << " : PADDR = " << std::hex << paddr << std::endl; 1165 1173 #endif 1166 1174 r_icache_miss_req = true; … … 1182 1190 r_icache_fsm = ICACHE_IDLE; 1183 1191 #if DEBUG_ICACHE 1184 if ( m_debug_icache_fsm ) 1185 { 1186 std::cout << " <PROC " << name() 1187 << " ICACHE_IDLE> READ HIT in icache" 1188 << " : PADDR = " << std::hex << paddr << std::endl; 1189 } 1192 if ( m_debug_activated ) 1193 std::cout << " <PROC " << name() << " ICACHE_IDLE> READ HIT in icache" 1194 << " : PADDR = " << std::hex << paddr << std::endl; 1190 1195 #endif 1191 1196 } … … 1197 1202 1198 1203 #if DEBUG_ICACHE 1199 if ( m_debug_ icache_fsm)1204 if ( m_debug_activated ) 1200 1205 { 1201 1206 std::cout << " <PROC " << name() … … 1271 1276 { 1272 1277 int state; 1273 uint32_ttag;1278 paddr_t tag; 1274 1279 size_t way = r_icache_flush_count.read()/m_icache_sets; 1275 1280 size_t set = r_icache_flush_count.read()%m_icache_sets; … … 1505 1510 1506 1511 #if DEBUG_ICACHE 1507 if ( m_debug_ dcache_fsm)1512 if ( m_debug_activated ) 1508 1513 { 1509 1514 std::cout << " <PROC " << name() … … 1531 1536 CACHE_SLOT_STATE_ZOMBI); 1532 1537 #if DEBUG_ICACHE 1533 if ( m_debug_ dcache_fsm)1538 if ( m_debug_activated ) 1534 1539 { 1535 1540 std::cout << " <PROC " << name() … … 1588 1593 r_vci_rsp_fifo_icache.read() ); 1589 1594 #if DEBUG_ICACHE 1590 if ( m_debug_ icache_fsm)1595 if ( m_debug_activated ) 1591 1596 { 1592 1597 std::cout << " <PROC " << name() … … 1648 1653 CACHE_SLOT_STATE_ZOMBI ); 1649 1654 #if DEBUG_ICACHE 1650 if ( m_debug_ icache_fsm)1655 if ( m_debug_activated ) 1651 1656 { 1652 1657 std::cout << " <PROC " << name() … … 1672 1677 CACHE_SLOT_STATE_VALID ); 1673 1678 #if DEBUG_ICACHE 1674 if ( m_debug_ icache_fsm)1679 if ( m_debug_activated ) 1675 1680 { 1676 1681 std::cout << " <PROC " << name() … … 1754 1759 1755 1760 #if DEBUG_ICACHE 1756 if ( m_debug_ icache_fsm)1761 if ( m_debug_activated ) 1757 1762 { 1758 1763 std::cout << " <PROC " << name() … … 1787 1792 } 1788 1793 #if DEBUG_ICACHE 1789 if ( m_debug_ icache_fsm)1794 if ( m_debug_activated ) 1790 1795 { 1791 1796 std::cout << " <PROC " << name() … … 1856 1861 1857 1862 #if DEBUG_ICACHE 1858 if ( m_debug_ icache_fsm)1863 if ( m_debug_activated ) 1859 1864 { 1860 1865 std::cout << " <PROC " << name() … … 1900 1905 1901 1906 #if DEBUG_ICACHE 1902 if ( m_debug_ icache_fsm)1907 if ( m_debug_activated ) 1903 1908 { 1904 1909 std::cout << " <PROC " << name() … … 1963 1968 1964 1969 #if DEBUG_ICACHE 1965 if ( m_debug_ icache_fsm)1970 if ( m_debug_activated ) 1966 1971 { 1967 1972 std::cout << " <PROC " << name() … … 2153 2158 else // identity mapping 2154 2159 { 2155 paddr = (paddr_t)m_dreq.addr; 2160 paddr = (paddr_t)m_dreq.addr; 2161 // we take into account the paddr extension 2162 if (vci_param::N > 32) 2163 paddr = paddr | ((paddr_t)(r_dcache_paddr_ext.read()) << 32); 2156 2164 } 2157 2165 } // end physical address computation … … 2227 2235 2228 2236 #if DEBUG_DCACHE 2229 if ( m_debug_dcache_fsm ) 2230 { 2231 std::cout << " <PROC " << name() 2232 << " DCACHE_IDLE> Cache update in P1 stage" << std::dec 2233 << " / WAY = " << r_dcache_save_cache_way.read() 2234 << " / SET = " << r_dcache_save_cache_set.read() 2235 << " / WORD = " << r_dcache_save_cache_word.read() << std::hex 2236 << " / DATA = " << r_dcache_save_wdata.read() 2237 << " / BE = " << r_dcache_save_be.read() << std::endl; 2238 } 2237 if ( m_debug_activated ) 2238 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2239 << " Cache update in P1 stage" << std::dec 2240 << " / WAY = " << r_dcache_save_cache_way.read() 2241 << " / SET = " << r_dcache_save_cache_set.read() 2242 << " / WORD = " << r_dcache_save_cache_word.read() << std::hex 2243 << " / WDATA = " << r_dcache_save_wdata.read() 2244 << " / BE = " << r_dcache_save_be.read() << std::endl; 2239 2245 #endif 2240 2246 } // end test TLB inval … … 2379 2385 case iss_t::XTN_MMU_WORD_HI: 2380 2386 m_drsp.rdata = r_mmu_word_hi.read(); 2387 m_drsp.valid = true; 2388 m_drsp.error = false; 2389 break; 2390 2391 case iss_t::XTN_DATA_PADDR_EXT: 2392 m_drsp.rdata = r_dcache_paddr_ext.read(); 2381 2393 m_drsp.valid = true; 2382 2394 m_drsp.error = false; … … 2503 2515 m_drsp.valid = true; 2504 2516 r_dcache_fsm = DCACHE_IDLE; 2517 break; 2518 2519 case iss_t::XTN_DATA_PADDR_EXT: // no cache or tlb access 2520 r_dcache_paddr_ext = m_dreq.wdata; 2521 m_drsp.valid = true; 2522 r_dcache_fsm = DCACHE_IDLE; 2505 2523 break; 2506 2524 … … 2568 2586 m_drsp.rdata = 0; 2569 2587 #if DEBUG_DCACHE 2570 if ( m_debug_dcache_fsm ) 2571 { 2572 std::cout << " <PROC " << name() 2573 << ".DCACHE_IDLE> HIT in dtlb, but privilege violation" << std::endl; 2574 } 2588 if ( m_debug_activated ) 2589 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2590 << " HIT in dtlb, but privilege violation" << std::endl; 2575 2591 #endif 2576 2592 } … … 2586 2602 m_drsp.rdata = 0; 2587 2603 #if DEBUG_DCACHE 2588 if ( m_debug_dcache_fsm ) 2589 { 2590 std::cout << " <PROC " << name() 2591 << ".DCACHE_IDLE> HIT in dtlb, but writable violation" << std::endl; 2592 } 2604 if ( m_debug_activated ) 2605 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2606 << " HIT in dtlb, but writable violation" << std::endl; 2593 2607 #endif 2594 2608 } … … 2607 2621 } // end DTLB activated 2608 2622 2609 if ( valid_req ) // processor request is valid after TLB check2623 if ( valid_req ) // processor request is valid (after MMU check) 2610 2624 { 2611 2625 r_dcache_save_cacheable = cacheable; … … 2631 2645 r_dcache_fsm = DCACHE_MISS_SELECT; 2632 2646 #if DEBUG_DCACHE 2633 if ( m_debug_dcache_fsm ) 2634 { 2635 std::cout << " <PROC " << name() 2636 << " DCACHE_IDLE> READ MISS in dcache" 2637 << " : PADDR = " << std::hex << paddr << std::endl; 2638 } 2647 if ( m_debug_activated ) 2648 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2649 << " READ MISS in dcache" 2650 << " / PADDR = " << std::hex << paddr << std::endl; 2639 2651 #endif 2640 2652 } … … 2643 2655 // stalled until cleanup is acknowledged 2644 2656 r_dcache_fsm = DCACHE_IDLE; 2657 #if DEBUG_DCACHE 2658 if ( m_debug_activated ) 2659 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2660 << " Pending cleanup, stalled until cleanup acknowledge" 2661 << " / PADDR = " << std::hex << paddr << std::endl; 2662 #endif 2645 2663 } 2646 2664 else // cache hit … … 2654 2672 m_drsp.rdata = cache_rdata; 2655 2673 #if DEBUG_DCACHE 2656 if ( m_debug_dcache_fsm ) 2657 { 2658 std::cout << " <PROC " << name() 2659 << " DCACHE_IDLE> READ HIT in dcache" 2660 << " : PADDR = " << std::hex << paddr << std::endl; 2661 } 2674 if ( m_debug_activated ) 2675 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2676 << " READ HIT in dcache" 2677 << " / PADDR = " << std::hex << paddr << std::endl; 2662 2678 #endif 2663 2679 } … … 2670 2686 r_dcache_fsm = DCACHE_UNC_WAIT; 2671 2687 #if DEBUG_DCACHE 2672 if ( m_debug_dcache_fsm ) 2673 { 2674 std::cout << " <PROC " << name() 2675 << " DCACHE_IDLE> READ UNCACHEABLE in dcache" 2676 << " : PADDR = " << std::hex << paddr << std::endl; 2677 } 2688 if ( m_debug_activated ) 2689 std::cout << " <PROC " << name() << " DCACHE_IDLE>" 2690 << " READ UNCACHEABLE in dcache" 2691 << " / PADDR = " << std::hex << paddr << std::endl; 2678 2692 #endif 2679 2693 } … … 2845 2859 if ( not bypass ) // Try to read PTE1/PTD1 in dcache 2846 2860 { 2847 pte_paddr = ( paddr_t)r_mmu_ptpr.read() << (INDEX1_NBITS+2) |2848 ( paddr_t)((r_dcache_tlb_vaddr.read() >> PAGE_M_NBITS) << 2);2861 pte_paddr = (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) | 2862 ((((paddr_t)r_dcache_tlb_vaddr.read()) >> PAGE_M_NBITS) << 2); 2849 2863 r_dcache_tlb_paddr = pte_paddr; 2850 2864 r_dcache_fsm = DCACHE_TLB_PTE1_GET; … … 2859 2873 2860 2874 #if DEBUG_DCACHE 2861 if ( m_debug_ dcache_fsm)2875 if ( m_debug_activated ) 2862 2876 { 2863 2877 if ( r_dcache_tlb_ins.read() ) 2864 { 2865 std::cout << " <PROC " << name() << ".DCACHE_TLB_MISS> ITLB miss"; 2866 } 2878 std::cout << " <PROC " << name() << " DCACHE_TLB_MISS> ITLB miss"; 2867 2879 else 2868 { 2869 std::cout << " <PROC " << name() << ".DCACHE_TLB_MISS> DTLB miss"; 2870 } 2880 std::cout << " <PROC " << name() << " DCACHE_TLB_MISS> DTLB miss"; 2871 2881 std::cout << " / VADDR = " << std::hex << r_dcache_tlb_vaddr.read() 2882 << " / ptpr = " << (((paddr_t)r_mmu_ptpr.read()) << (INDEX1_NBITS+2)) 2872 2883 << " / BYPASS = " << bypass 2873 2884 << " / PTE_ADR = " << pte_paddr << std::endl; … … 2924 2935 2925 2936 #if DEBUG_DCACHE 2926 if ( m_debug_ dcache_fsm)2937 if ( m_debug_activated ) 2927 2938 { 2928 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache, but unmapped" 2939 std::cout << " <PROC " << name() 2940 << " DCACHE_TLB_PTE1_GET> HIT in dcache, but unmapped" 2929 2941 << std::hex << " / paddr = " << r_dcache_tlb_paddr.read() 2930 2942 << std::dec << " / way = " << way … … 2960 2972 2961 2973 #if DEBUG_DCACHE 2962 if ( m_debug_ dcache_fsm)2974 if ( m_debug_activated ) 2963 2975 { 2964 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache" 2976 std::cout << " <PROC " << name() 2977 << " DCACHE_TLB_PTE1_GET> HIT in dcache" 2965 2978 << std::hex << " / paddr = " << r_dcache_tlb_paddr.read() 2966 2979 << std::dec << " / way = " << way … … 2981 2994 2982 2995 #if DEBUG_DCACHE 2983 if ( m_debug_ dcache_fsm)2996 if ( m_debug_activated ) 2984 2997 { 2985 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> HIT in dcache" 2998 std::cout << " <PROC " << name() 2999 << " DCACHE_TLB_PTE1_GET> HIT in dcache" 2986 3000 << std::hex << " / paddr = " << r_dcache_tlb_paddr.read() 2987 3001 << std::dec << " / way = " << way … … 3007 3021 3008 3022 #if DEBUG_DCACHE 3009 if ( m_debug_ dcache_fsm)3023 if ( m_debug_activated ) 3010 3024 { 3011 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_GET> MISS in dcache:" 3025 std::cout << " <PROC " << name() 3026 << " DCACHE_TLB_PTE1_GET> MISS in dcache:" 3012 3027 << " PTE1 address = " << std::hex << r_dcache_tlb_paddr.read() << std::endl; 3013 3028 } … … 3047 3062 3048 3063 #if DEBUG_DCACHE 3049 if ( m_debug_ dcache_fsm)3064 if ( m_debug_activated ) 3050 3065 { 3051 3066 if ( r_dcache_tlb_ins.read() ) 3052 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_SELECT> Select a slot in ITLB:"; 3067 std::cout << " <PROC " << name() 3068 << " DCACHE_TLB_PTE1_SELECT> Select a slot in ITLB:"; 3053 3069 else 3054 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_SELECT> Select a slot in DTLB:"; 3070 std::cout << " <PROC " << name() 3071 << ".DCACHE_TLB_PTE1_SELECT> Select a slot in DTLB:"; 3055 3072 std::cout << " way = " << std::dec << way 3056 3073 << " / set = " << set << std::endl; … … 3117 3134 3118 3135 #if DEBUG_DCACHE 3119 if ( m_debug_ dcache_fsm)3136 if ( m_debug_activated ) 3120 3137 { 3121 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> write PTE1 in ITLB"; 3122 std::cout << " / set = " << std::dec << r_dcache_tlb_set.read() 3138 std::cout << " <PROC " << name() 3139 << " DCACHE_TLB_PTE1_UPDT> write PTE1 in ITLB" 3140 << " / set = " << std::dec << r_dcache_tlb_set.read() 3123 3141 << " / way = " << r_dcache_tlb_way.read() << std::endl; 3124 3142 r_itlb.printTrace(); … … 3140 3158 3141 3159 #if DEBUG_DCACHE 3142 if ( m_debug_ dcache_fsm)3160 if ( m_debug_activated ) 3143 3161 { 3144 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> write PTE1 in DTLB"; 3145 std::cout << " / set = " << std::dec << r_dcache_tlb_set.read() 3162 std::cout << " <PROC " << name() 3163 << " DCACHE_TLB_PTE1_UPDT> write PTE1 in DTLB" 3164 << " / set = " << std::dec << r_dcache_tlb_set.read() 3146 3165 << " / way = " << r_dcache_tlb_way.read() << std::endl; 3147 3166 r_dtlb.printTrace(); … … 3156 3175 3157 3176 #if DEBUG_DCACHE 3158 if ( m_debug_ dcache_fsm)3177 if ( m_debug_activated ) 3159 3178 { 3160 std::cout << " <PROC " << name() << ".DCACHE_TLB_PTE1_UPDT> L/R bit update required" 3179 std::cout << " <PROC " << name() 3180 << " DCACHE_TLB_PTE1_UPDT> L/R bit update required" 3161 3181 << std::endl; 3162 3182 } … … 3215 3235 3216 3236 #if DEBUG_DCACHE 3217 if ( m_debug_ dcache_fsm)3237 if ( m_debug_activated ) 3218 3238 { 3219 3239 std::cout << " <PROC " << name() … … 3235 3255 3236 3256 #if DEBUG_DCACHE 3237 if ( m_debug_ dcache_fsm)3257 if ( m_debug_activated ) 3238 3258 { 3239 3259 std::cout << " <PROC " << name() … … 3251 3271 3252 3272 #if DEBUG_DCACHE 3253 if ( m_debug_ dcache_fsm)3273 if ( m_debug_activated ) 3254 3274 { 3255 3275 std::cout << " <PROC " << name() … … 3268 3288 3269 3289 #if DEBUG_DCACHE 3270 if ( m_debug_ dcache_fsm)3290 if ( m_debug_activated ) 3271 3291 { 3272 3292 std::cout << " <PROC " << name() … … 3306 3326 3307 3327 #if DEBUG_DCACHE 3308 if ( m_debug_ dcache_fsm)3328 if ( m_debug_activated ) 3309 3329 { 3310 3330 if ( r_dcache_tlb_ins.read() ) … … 3382 3402 3383 3403 #if DEBUG_DCACHE 3384 if ( m_debug_ dcache_fsm)3404 if ( m_debug_activated ) 3385 3405 { 3386 3406 std::cout << " <PROC " << name() … … 3406 3426 3407 3427 #if DEBUG_DCACHE 3408 if ( m_debug_ dcache_fsm)3428 if ( m_debug_activated ) 3409 3429 { 3410 3430 std::cout << " <PROC " << name() … … 3424 3444 3425 3445 #if DEBUG_DCACHE 3426 if ( m_debug_ dcache_fsm)3446 if ( m_debug_activated ) 3427 3447 { 3428 3448 std::cout << " <PROC " << name() … … 3437 3457 { 3438 3458 #if DEBUG_DCACHE 3439 if ( m_debug_ dcache_fsm)3459 if ( m_debug_activated ) 3440 3460 { 3441 3461 std::cout << " <PROC " << name() … … 3482 3502 { 3483 3503 #if DEBUG_DCACHE 3484 if ( m_debug_ dcache_fsm)3504 if ( m_debug_activated ) 3485 3505 { 3486 3506 std::cout << " <PROC " << name() … … 3497 3517 { 3498 3518 #if DEBUG_DCACHE 3499 if ( m_debug_ dcache_fsm)3519 if ( m_debug_activated ) 3500 3520 { 3501 3521 std::cout << " <PROC " << name() … … 3603 3623 { 3604 3624 int state; 3605 uint32_ttag;3625 paddr_t tag; 3606 3626 size_t way = r_dcache_flush_count.read()/m_dcache_sets; 3607 3627 size_t set = r_dcache_flush_count.read()%m_dcache_sets; … … 3723 3743 3724 3744 #if DEBUG_DCACHE 3725 if ( m_debug_ dcache_fsm)3745 if ( m_debug_activated ) 3726 3746 { 3727 3747 std::cout << " <PROC " << name() … … 3766 3786 3767 3787 #if DEBUG_DCACHE 3768 if ( m_debug_ dcache_fsm)3788 if ( m_debug_activated ) 3769 3789 { 3770 3790 std::cout << " <PROC " << name() … … 3826 3846 3827 3847 #if DEBUG_DCACHE 3828 if ( m_debug_ dcache_fsm)3848 if ( m_debug_activated ) 3829 3849 { 3830 3850 std::cout << " <PROC " << name() … … 3900 3920 3901 3921 #if DEBUG_DCACHE 3902 if ( m_debug_ dcache_fsm)3922 if ( m_debug_activated ) 3903 3923 { 3904 3924 std::cout << " <PROC " << name() … … 3907 3927 << " / SET = " << set 3908 3928 << " / PADDR = " << std::hex << r_dcache_save_paddr.read(); 3909 if(cleanup) std::cout << " / VICTIM = " << std::hex << victim<< std::endl;3929 if(cleanup) std::cout << " / VICTIM = " << (victim*m_dcache_words*4) << std::endl; 3910 3930 else std::cout << std::endl; 3911 3931 } … … 3923 3943 size_t way = r_dcache_miss_way.read(); 3924 3944 size_t set = r_dcache_miss_set.read(); 3925 paddr_t nline = r_dcache_save_paddr.read() / (m_dcache_words<<2);3926 3945 3927 3946 #ifdef INSTRUMENTATION … … 3932 3951 CACHE_SLOT_STATE_ZOMBI ); 3933 3952 #if DEBUG_DCACHE 3934 if ( m_debug_ dcache_fsm)3953 if ( m_debug_activated ) 3935 3954 { 3936 3955 std::cout << " <PROC " << name() … … 4054 4073 r_vci_rsp_fifo_dcache.read() ); 4055 4074 #if DEBUG_DCACHE 4056 if ( m_debug_ dcache_fsm)4075 if ( m_debug_activated ) 4057 4076 { 4058 4077 std::cout << " <PROC " << name() … … 4097 4116 if ( r_dcache_miss_inval.read() ) // switch slot to ZOMBI state, and new cleanup 4098 4117 { 4099 if ( not r_dcache_cc_send_req.read() ) // blocked until previous cc_send request issent4118 if ( not r_dcache_cc_send_req.read() ) // blocked until previous request sent 4100 4119 { 4101 4120 r_dcache_miss_inval = false; … … 4114 4133 CACHE_SLOT_STATE_ZOMBI ); 4115 4134 #if DEBUG_DCACHE 4116 if ( m_debug_dcache_fsm ) 4117 { 4118 std::cout << " <PROC " << name() 4119 << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state" 4120 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4121 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4122 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4123 } 4135 if ( m_debug_activated ) 4136 std::cout << " <PROC " << name() 4137 << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state" 4138 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4139 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4140 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4124 4141 #endif 4125 4142 } … … 4139 4156 4140 4157 #if DEBUG_DCACHE 4141 if ( m_debug_dcache_fsm ) 4142 { 4143 std::cout << " <PROC " << name() 4144 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state" 4145 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4146 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4147 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4148 4149 // r_dcache.printTrace(); 4150 4151 4152 } 4158 if ( m_debug_activated ) 4159 std::cout << " <PROC " << name() 4160 << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state" 4161 << " PADDR = " << std::hex << r_dcache_save_paddr.read() 4162 << " / WAY = " << std::dec << r_dcache_miss_way.read() 4163 << " / SET = " << r_dcache_miss_set.read() << std::endl; 4153 4164 #endif 4154 4165 // reset directory extension … … 4322 4333 4323 4334 #if DEBUG_DCACHE 4324 if ( m_debug_ dcache_fsm)4335 if ( m_debug_activated ) 4325 4336 { 4326 4337 std::cout << " <PROC " << name() … … 4362 4373 4363 4374 #if DEBUG_DCACHE 4364 if ( m_debug_ dcache_fsm)4375 if ( m_debug_activated ) 4365 4376 { 4366 4377 std::cout << " <PROC " << name() … … 4384 4395 4385 4396 #if DEBUG_DCACHE 4386 if ( m_debug_ dcache_fsm)4397 if ( m_debug_activated ) 4387 4398 { 4388 4399 std::cout << " <PROC " << name() … … 4390 4401 << " r_dcache_vci_paddr = " << r_dcache_vci_paddr.read() 4391 4402 << " mask = " << mask 4392 << " (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) = " << (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) 4393 << " (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) = " << (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) 4394 << " ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) = " << ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) 4403 << " (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) = " 4404 << (r_dcache_fsm_cc_save == DCACHE_MISS_WAIT) 4405 << " (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) = " 4406 << (r_dcache_fsm_cc_save == DCACHE_MISS_DIR_UPDT) 4407 << " ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) = " 4408 << ((r_dcache_vci_paddr.read() & mask) == (paddr & mask)) 4395 4409 <<std::endl; 4396 4410 } … … 4420 4434 r_cc_receive_dcache_req = false; 4421 4435 #if DEBUG_DCACHE 4422 if ( m_debug_ dcache_fsm)4436 if ( m_debug_activated ) 4423 4437 { 4424 4438 std::cout << " <PROC " << name() … … 4454 4468 4455 4469 #if DEBUG_DCACHE 4456 if ( m_debug_ dcache_fsm)4470 if ( m_debug_activated ) 4457 4471 { 4458 4472 std::cout << " <PROC " << name() … … 4518 4532 4519 4533 #if DEBUG_DCACHE 4520 if ( m_debug_ dcache_fsm)4534 if ( m_debug_activated ) 4521 4535 { 4522 4536 std::cout << " <PROC " << name() … … 4557 4571 4558 4572 #if DEBUG_DCACHE 4559 if ( m_debug_ dcache_fsm)4573 if ( m_debug_activated ) 4560 4574 { 4561 4575 std::cout << " <PROC " << name() … … 4573 4587 4574 4588 #if DEBUG_DCACHE 4575 if ( m_debug_ dcache_fsm)4589 if ( m_debug_activated ) 4576 4590 { 4577 4591 std::cout << " <PROC " << name() … … 4629 4643 4630 4644 #if DEBUG_DCACHE 4631 if ( m_debug_ dcache_fsm)4645 if ( m_debug_activated ) 4632 4646 { 4633 4647 std::cout << " <PROC " << name() … … 4649 4663 4650 4664 #if DEBUG_DCACHE 4651 if ( m_debug_ dcache_fsm)4665 if ( m_debug_activated ) 4652 4666 { 4653 4667 std::cout << " <PROC " << name() … … 4722 4736 4723 4737 #if DEBUG_DCACHE 4724 if ( m_debug_ dcache_fsm)4738 if ( m_debug_activated ) 4725 4739 { 4726 4740 std::cout << " <PROC " << name() … … 4739 4753 r_dcache_cc_need_write = false; 4740 4754 #if DEBUG_DCACHE 4741 if ( m_debug_ dcache_fsm)4755 if ( m_debug_activated ) 4742 4756 { 4743 4757 std::cout << " <PROC " << name() … … 4793 4807 4794 4808 #if DEBUG_DCACHE 4795 if ( m_debug_ dcache_fsmand ok )4809 if ( m_debug_activated and ok ) 4796 4810 { 4797 4811 std::cout << " <PROC " << name() … … 4809 4823 4810 4824 #if DEBUG_DCACHE 4811 if ( m_debug_dcache_fsm and ok ) 4812 { 4813 std::cout << " <PROC " << name() 4814 << ".DCACHE_INVAL_TLB_SCAN> Invalidate DTLB entry:" << std::hex 4815 << " line = " << line << std::dec 4816 << " / set = " << set 4817 << " / way = " << way << std::endl; 4818 } 4825 if ( m_debug_activated and ok ) 4826 std::cout << " <PROC " << name() << " DCACHE_INVAL_TLB_SCAN>" 4827 << " Invalidate DTLB entry" << std::hex 4828 << " / line = " << line << std::dec 4829 << " / set = " << set 4830 << " / way = " << way << std::endl; 4819 4831 #endif 4820 4832 } … … 4911 4923 case CMD_IDLE: 4912 4924 { 4913 // D DACHE read requests (r_dcache_vci_miss_req or r_dcache_vci_ll_req), and4925 // DCACHE read requests (r_dcache_vci_miss_req or r_dcache_vci_ll_req), and 4914 4926 // ICACHE read requests (r_icache_miss_req) require both a write_buffer access 4915 4927 // to check a possible pending write on the same cache line. … … 4936 4948 or r_vci_cmd_imiss_prio.read() ); 4937 4949 4938 4939 4950 // 1 - Data Read Miss 4940 4951 if ( dcache_miss_req and r_wbuf.miss(r_dcache_vci_paddr.read()) ) … … 4970 4981 else if ( r_icache_unc_req.read() ) 4971 4982 { 4972 r_vci_cmd_fsm = CMD_INS_UNC;4973 r_icache_unc_req = false;4983 r_vci_cmd_fsm = CMD_INS_UNC; 4984 r_icache_unc_req = false; 4974 4985 // m_cpt_iunc_transaction++; 4975 4986 } … … 5000 5011 // m_cpt_cas_transaction++; 5001 5012 } 5013 5014 #if DEBUG_CMD 5015 if ( m_debug_activated ) 5016 { 5017 std::cout << " <PROC " << name() << " CMD_IDLE>" 5018 << " / dmiss_req = " << dcache_miss_req 5019 << " / imiss_req = " << icache_miss_req 5020 << std::endl; 5021 } 5022 #endif 5002 5023 break; 5003 5024 } … … 5820 5841 5821 5842 5822 // Send coherence packets on DSPIN L2M5843 // Send coherence packets on DSPIN P2M 5823 5844 // it depends on the CC_SEND FSM 5824 5845 … … 5857 5878 5858 5879 DspinDhccpParam::dspin_set(dspin_send_data, 5859 r_dcache_cc_send_nline.read() & 0x300000000ULL,5880 (r_dcache_cc_send_nline.read() & 0x300000000ULL)>>32, 5860 5881 DspinDhccpParam::CLEANUP_NLINE_MSB); 5861 5882 … … 5879 5900 5880 5901 DspinDhccpParam::dspin_set(dspin_send_data, 5881 r_icache_cc_send_nline.read() & 0x300000000ULL,5902 (r_icache_cc_send_nline.read() & 0x300000000ULL)>>32, 5882 5903 DspinDhccpParam::CLEANUP_NLINE_MSB); 5883 5904
Note: See TracChangeset
for help on using the changeset viewer.