Changeset 73 for trunk/modules/vci_cc_vcache_wrapper2_v1/caba
- Timestamp:
- Aug 7, 2010, 12:42:20 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_cc_vcache_wrapper2_v1/caba/source/src/vci_cc_vcache_wrapper2_v1.cpp
r72 r73 1007 1007 else // MMU activated 1008 1008 { 1009 size_t c_way, c_set; 1009 1010 m_cpt_ins_tlb_read++; 1010 1011 icache_hit_t = icache_tlb.cctranslate(ireq.addr, &tlb_ipaddr, &icache_pte_info, … … 1014 1015 spc_ipaddr = ((paddr_t)r_icache_ppn_save << PAGE_K_NBITS) | (paddr_t)(ireq.addr & PAGE_K_MASK); 1015 1016 icache_cached = icache_pte_info.c; 1017 if (icache_hit_t) { 1018 if (!r_dcache.read(icache_tlb_nline << (uint32_log2(m_dcache_words) + 2), &icache_ins, &c_way, &c_set)) { 1019 std::cout << "itlb PTE " << std::hex << icache_tlb_nline << " " << (icache_tlb_nline << (uint32_log2(m_dcache_words) + 2)) << " not in cache" << std::endl; 1020 abort(); 1021 } 1022 if (!r_dcache_in_itlb[m_dcache_sets*c_way+c_set]) { 1023 std::cout << "itlb PTE " << std::hex << icache_tlb_nline << " " 1024 << (icache_tlb_nline << (uint32_log2(m_dcache_words) + 2)) << 1025 " " << c_way << "," << c_set << " @" << &r_dcache_in_itlb[m_dcache_sets*c_way+c_set] << " not in_itlb" << std::endl; 1026 abort(); 1027 } 1028 } 1016 1029 } 1017 1030 … … 2031 2044 // invalidate cache 2032 2045 if( (( r_icache_fsm_save == ICACHE_TLB1_READ ) || ( r_icache_fsm_save == ICACHE_TLB2_READ ) || 2033 /* ( r_icache_fsm_save == ICACHE_TLB1_WRITE )|| ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) ||*/2046 ( r_icache_fsm_save == ICACHE_TLB1_WRITE )|| ( r_icache_fsm_save == ICACHE_TLB2_WRITE ) || 2034 2047 ( r_icache_fsm_save == ICACHE_TLB1_UPDT ) || ( r_icache_fsm_save == ICACHE_TLB2_UPDT )) && 2035 2048 (((r_icache_paddr_save.read() & ~((m_icache_words<<2)-1)) >> (uint32_log2(m_icache_words) + 2) ) == r_dcache_itlb_inval_line.read()) ) … … 2556 2569 else // MMU activated 2557 2570 { 2571 size_t c_way, c_set; 2558 2572 m_cpt_data_tlb_read++; 2559 2573 dcache_hit_t = dcache_tlb.cctranslate(dreq.addr, &tlb_dpaddr, &dcache_pte_info, … … 2565 2579 ((dreq.type != iss_t::DATA_LL) && (dreq.type != iss_t::DATA_SC) && 2566 2580 (dreq.type != iss_t::XTN_READ) && (dreq.type != iss_t::XTN_WRITE)); 2581 if (dcache_hit_t) { 2582 if (!r_dcache.read(dcache_tlb_nline << (uint32_log2(m_dcache_words) + 2), &dcache_rdata, &c_way, &c_set)) { 2583 std::cout << "dtlb PTE " << std::hex << dcache_tlb_nline << " " << (dcache_tlb_nline << (uint32_log2(m_dcache_words) + 2)) << " not in cache" << std::endl; 2584 abort(); 2585 } 2586 if (!r_dcache_in_dtlb[m_dcache_sets*c_way+c_set]) { 2587 std::cout << "dtlb PTE " << std::hex << dcache_tlb_nline << 2588 " " << c_way << "," << c_set << " not in_dtlb" << 2589 std::endl; 2590 abort(); 2591 } 2592 } 2567 2593 } 2568 2594 … … 3556 3582 if (dcache_tlb.update(r_dcache_pte_update,dreq.addr,(r_dcache_tlb_paddr.read() >> (uint32_log2(m_dcache_words)+2)),&victim_index)) 3557 3583 { 3558 r_dcache.setinbit((paddr_t)victim_index *m_dcache_words*2, r_dcache_in_dtlb, false);3584 r_dcache.setinbit((paddr_t)victim_index << (uint32_log2(m_dcache_words) + 2), r_dcache_in_dtlb, false); 3559 3585 } 3560 3586 r_dcache.setinbit(r_dcache_tlb_paddr, r_dcache_in_dtlb, true); … … 4013 4039 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)) 4014 4040 { 4015 r_dcache.setinbit((paddr_t)victim_index *m_dcache_words*2, r_dcache_in_dtlb, false);4041 r_dcache.setinbit((paddr_t)victim_index << (uint32_log2(m_dcache_words) + 2), r_dcache_in_dtlb, false); 4016 4042 } 4017 4043 r_dcache.setinbit(r_dcache_tlb_paddr, r_dcache_in_dtlb, true); … … 4036 4062 if ( r_dcache_itlb_cleanup_req ) 4037 4063 { 4038 r_dcache.setinbit(((paddr_t)r_dcache_itlb_cleanup_line.read() *m_dcache_words*2), r_dcache_in_itlb, false);4064 r_dcache.setinbit(((paddr_t)r_dcache_itlb_cleanup_line.read() << (uint32_log2(m_dcache_words) + 2)), r_dcache_in_itlb, false); 4039 4065 r_dcache_itlb_cleanup_req = false; 4040 4066 } … … 4046 4072 if(dcache_tlb.checkcleanup(way, set, &victim_index)) 4047 4073 { 4048 r_dcache.setinbit((paddr_t)(victim_index << (m_dcache_words+2)), r_dcache_in_dtlb, false); 4074 /* 4075 * this is correct because checkcleanup returns true only 4076 * if none of the PTE entries of the line is global. 4077 */ 4078 r_dcache.setinbit((paddr_t)victim_index << (uint32_log2(m_dcache_words) + 2), r_dcache_in_dtlb, false); 4049 4079 } 4050 4080 } … … 4143 4173 if ( dcache_tlb.inval(r_dcache_wdata_save, &victim_index) ) 4144 4174 { 4145 r_dcache.setinbit((paddr_t)(victim_index << ( m_dcache_words+2)), r_dcache_in_dtlb, false);4175 r_dcache.setinbit((paddr_t)(victim_index << (uint32_log2(m_dcache_words) + 2)), r_dcache_in_dtlb, false); 4146 4176 } 4147 4177 r_dtlb_translation_valid = false; … … 4954 4984 if ( dreq.valid ) m_cost_data_miss_frz++; 4955 4985 4956 r_dcache.setinbit(( (paddr_t)r_dcache_itlb_cleanup_line.read()*m_dcache_words*2), r_dcache_in_itlb, false);4986 r_dcache.setinbit((paddr_t)r_dcache_itlb_cleanup_line.read() << (uint32_log2(m_dcache_words) + 2), r_dcache_in_itlb, false); 4957 4987 r_dcache_itlb_cleanup_req = false; 4958 4988 r_dcache_fsm = DCACHE_IDLE;
Note: See TracChangeset
for help on using the changeset viewer.