Changeset 233 for trunk/modules


Ignore:
Timestamp:
May 25, 2012, 3:50:13 PM (12 years ago)
Author:
alain
Message:

Fixing a bug in the DCACHE_IDLE state: The coherence request were not
taken in case of blocking write caused by write buffer full.
This is a dead-lock case.

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  
    19861986                        //  1  / 1  / write(A2) / read(A1)  / read request delayed
    19871987    {
     1988        bool tlb_inval_required = false;
     1989        bool write_pipe_frozen  = false;
     1990
    19881991        ////////////////////////////////////////////////////////////////////////////////
    19891992        // Handling P2 pipe-line stage
     
    19921995        // If the modified cache line has copies in TLBs, we launch a TLB invalidate
    19931996        // operation, going to DCACHE_INVAL_TLB_SCAN state.
    1994 
    1995         bool tlb_inval_required = false;
    19961997
    19971998        if ( r_dcache_p1_valid.read() )         // P2 stage activated
     
    20452046        // We must write into wbuf and test the hit in dcache.
    20462047        // 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 write
    2049         // request registration is possible, but he 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.
    20502051        // 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.
    20522053
    20532054        if ( r_dcache_p0_valid.read() )  // P1 stage activated
    20542055        {
    2055             // write not cacheable, and previous non cacheable write registered
     2056            // frozen if write not cacheable, and previous non cacheable write registered
    20562057            if ( not r_dcache_p0_cacheable.read() and r_dcache_pending_unc_write.read() )
    20572058            {
    20582059                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
    20682070m_cpt_wbuf_write++;
    20692071#endif
    2070             // write buffer full
    2071             if ( not wok )
    2072             {
    2073                 r_dcache_p1_valid = false;
    2074                 break;
    2075             }
    2076             // update the write_buffer state extension
    2077             r_dcache_pending_unc_write = not r_dcache_p0_cacheable.read();
    2078 
    2079             // read directory to check local copy
    2080             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 activated
    2085             {
    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 );
    20902092#ifdef INSTRUMENTATION
    20912093m_cpt_dcache_dir_read++;
    20922094#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
    21162120        {
    21172121            r_dcache_p1_valid = false;
     
    21682172
    21692173        // processor request
    2170         else if ( m_dreq.valid )
     2174        else if ( m_dreq.valid and not write_pipe_frozen )
    21712175        {
    21722176            // 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;
    21772181            uint32_t    cache_rdata;
    2178             bool        cache_hit;
     2182            bool            cache_hit;
    21792183
    21802184            if ( (r_mmu_mode.read() & DATA_CACHE_MASK) and      // cache activated
Note: See TracChangeset for help on using the changeset viewer.