Changeset 233 for trunk/modules/vci_cc_vcache_wrapper_v4/caba/source
- Timestamp:
- May 25, 2012, 3:50:13 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/vci_cc_vcache_wrapper_v4/caba/source/src/vci_cc_vcache_wrapper_v4.cpp
r231 r233 1986 1986 // 1 / 1 / write(A2) / read(A1) / read request delayed 1987 1987 { 1988 bool tlb_inval_required = false; 1989 bool write_pipe_frozen = false; 1990 1988 1991 //////////////////////////////////////////////////////////////////////////////// 1989 1992 // Handling P2 pipe-line stage … … 1992 1995 // If the modified cache line has copies in TLBs, we launch a TLB invalidate 1993 1996 // operation, going to DCACHE_INVAL_TLB_SCAN state. 1994 1995 bool tlb_inval_required = false;1996 1997 1997 1998 if ( r_dcache_p1_valid.read() ) // P2 stage activated … … 2045 2046 // We must write into wbuf and test the hit in dcache. 2046 2047 // If the write request is non cacheable, and there is a pending 2047 // non cacheable write, or if the write buffer is full, we break,2048 // because the P0 and P1 pipe-line stages are frozen until the write2049 // request registration is possible, buthe P2 stage is not frozen.2048 // non cacheable write, or if the write buffer is full, the P0 and P1 stages 2049 // are frozen until the write request registration is possible, 2050 // while the P2 stage is not frozen. 2050 2051 // The r_dcache_p1_valid bit must be computed at all cycles, and 2051 // the P2 stage must be activated if there is local copy in dcache.2052 // the P2 stage must be activated if there is a local copy in dcache. 2052 2053 2053 2054 if ( r_dcache_p0_valid.read() ) // P1 stage activated 2054 2055 { 2055 // write not cacheable, and previous non cacheable write registered2056 // frozen if write not cacheable, and previous non cacheable write registered 2056 2057 if ( not r_dcache_p0_cacheable.read() and r_dcache_pending_unc_write.read() ) 2057 2058 { 2058 2059 r_dcache_p1_valid = false; 2059 break; 2060 } 2061 2062 // try a registration into write buffer 2063 bool wok = r_wbuf.write( r_dcache_p0_paddr.read(), 2064 r_dcache_p0_be.read(), 2065 r_dcache_p0_wdata.read(), 2066 r_dcache_p0_cacheable.read() ); 2067 #ifdef INSTRUMENTATION 2060 write_pipe_frozen = true; 2061 } 2062 else // try a registration into write buffer 2063 { 2064 2065 bool wok = r_wbuf.write( r_dcache_p0_paddr.read(), 2066 r_dcache_p0_be.read(), 2067 r_dcache_p0_wdata.read(), 2068 r_dcache_p0_cacheable.read() ); 2069 #ifdef INSTRUMENTATION 2068 2070 m_cpt_wbuf_write++; 2069 2071 #endif 2070 //write buffer full2071 if ( not wok )2072 {2073 r_dcache_p1_valid = false;2074 break;2075 }2076 // update the write_buffer state extension2077 r_dcache_pending_unc_write = not r_dcache_p0_cacheable.read();2078 2079 // read directory to check local copy2080 size_t cache_way;2081 size_t cache_set;2082 size_t cache_word;2083 bool local_copy;2084 if ( r_mmu_mode.read() & DATA_CACHE_MASK) // cache activated2085 {2086 local_copy = r_dcache.hit( r_dcache_p0_paddr.read(),2087 &cache_way,2088 &cache_set,2089 &cache_word );2072 if ( not wok ) // frozen if write buffer full 2073 { 2074 r_dcache_p1_valid = false; 2075 write_pipe_frozen = true; 2076 } 2077 else // update the write_buffer state extension 2078 { 2079 r_dcache_pending_unc_write = not r_dcache_p0_cacheable.read(); 2080 2081 // read directory to check local copy 2082 size_t cache_way; 2083 size_t cache_set; 2084 size_t cache_word; 2085 bool local_copy; 2086 if ( r_mmu_mode.read() & DATA_CACHE_MASK) // cache activated 2087 { 2088 local_copy = r_dcache.hit( r_dcache_p0_paddr.read(), 2089 &cache_way, 2090 &cache_set, 2091 &cache_word ); 2090 2092 #ifdef INSTRUMENTATION 2091 2093 m_cpt_dcache_dir_read++; 2092 2094 #endif 2093 } 2094 else 2095 { 2096 local_copy = false; 2097 } 2098 2099 // store values for P2 pipe stage 2100 if ( local_copy ) 2101 { 2102 r_dcache_p1_valid = true; 2103 r_dcache_p1_wdata = r_dcache_p0_wdata.read(); 2104 r_dcache_p1_be = r_dcache_p0_be.read(); 2105 r_dcache_p1_paddr = r_dcache_p0_paddr.read(); 2106 r_dcache_p1_cache_way = cache_way; 2107 r_dcache_p1_cache_set = cache_set; 2108 r_dcache_p1_cache_word = cache_word; 2109 } 2110 else 2111 { 2112 r_dcache_p1_valid = false; 2113 } 2114 } 2115 else // P1 stage not activated 2095 } 2096 else 2097 { 2098 local_copy = false; 2099 } 2100 2101 // store values for P2 pipe stage 2102 if ( local_copy ) 2103 { 2104 r_dcache_p1_valid = true; 2105 r_dcache_p1_wdata = r_dcache_p0_wdata.read(); 2106 r_dcache_p1_be = r_dcache_p0_be.read(); 2107 r_dcache_p1_paddr = r_dcache_p0_paddr.read(); 2108 r_dcache_p1_cache_way = cache_way; 2109 r_dcache_p1_cache_set = cache_set; 2110 r_dcache_p1_cache_word = cache_word; 2111 } 2112 else 2113 { 2114 r_dcache_p1_valid = false; 2115 } 2116 } 2117 } 2118 } 2119 else // P1 stage not activated 2116 2120 { 2117 2121 r_dcache_p1_valid = false; … … 2168 2172 2169 2173 // processor request 2170 else if ( m_dreq.valid )2174 else if ( m_dreq.valid and not write_pipe_frozen ) 2171 2175 { 2172 2176 // dcache access using speculative PPN only if pipe-line empty 2173 paddr_t cache_paddr;2174 size_t cache_way;2175 size_t cache_set;2176 size_t cache_word;2177 paddr_t cache_paddr; 2178 size_t cache_way; 2179 size_t cache_set; 2180 size_t cache_word; 2177 2181 uint32_t cache_rdata; 2178 bool cache_hit;2182 bool cache_hit; 2179 2183 2180 2184 if ( (r_mmu_mode.read() & DATA_CACHE_MASK) and // cache activated
Note: See TracChangeset
for help on using the changeset viewer.