Ignore:
Timestamp:
Jul 19, 2013, 10:16:17 AM (11 years ago)
Author:
cfuguet
Message:

Merged

/trunk/modules/vci_mem_cache:449 with
/branches/v5/modules/vci_mem_cache:446.

This merge introduces into the branch the last modifications concerning
the VCI memory cache configuration interface

Location:
branches/v5/modules/vci_mem_cache
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/v5/modules/vci_mem_cache

  • branches/v5/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h

    r440 r455  
    1212// to behave in an unpredicted way.
    1313// TODO Either remove the mechanism from the mem cache or update its behaviour.
     14
    1415#define L1_MULTI_CACHE 0
    1516
     
    247248    // The function returns a copy of a (valid or invalid) entry 
    248249    /////////////////////////////////////////////////////////////////////
    249     DirectoryEntry read(const addr_t &address,size_t &way)
     250    DirectoryEntry read(const addr_t &address, size_t &way)
    250251    {
    251252
     
    277278    // way arguments.
    278279    /////////////////////////////////////////////////////////////////////
    279     void inval( const size_t &set, const size_t &way )
     280    void inval( const size_t &way, const size_t &set )
    280281    {
    281282        m_dir_tab[set][way].init();
     
    289290    // The function returns a copy of a (valid or invalid) entry 
    290291    /////////////////////////////////////////////////////////////////////
    291     DirectoryEntry read_neutral(const addr_t &address)
     292    DirectoryEntry read_neutral( const addr_t &address,
     293                                 size_t*      ret_way,
     294                                 size_t*      ret_set )
    292295    {
    293296
    294297#define L2 soclib::common::uint32_log2
    295       const size_t set = (size_t)(address >> (L2(m_words) + 2)) & (m_sets - 1);
    296       const tag_t  tag = (tag_t)(address >> (L2(m_sets) + L2(m_words) + 2));
     298        size_t set = (size_t)(address >> (L2(m_words) + 2)) & (m_sets - 1);
     299        tag_t  tag = (tag_t)(address >> (L2(m_sets) + L2(m_words) + 2));
    297300#undef L2
    298301
    299       bool hit       = false;
    300       for ( size_t i=0 ; i<m_ways ; i++ ) {
    301         bool equal = ( m_dir_tab[set][i].tag == tag );
    302         bool valid = m_dir_tab[set][i].valid;
    303         hit = equal && valid;
    304         if ( hit ) {                   
    305           return DirectoryEntry(m_dir_tab[set][i]);
     302        for ( size_t way = 0 ; way < m_ways ; way++ )
     303        {
     304            bool equal = ( m_dir_tab[set][way].tag == tag );
     305            bool valid = m_dir_tab[set][way].valid;
     306            if ( equal and valid )
     307            {
     308                *ret_set = set;
     309                *ret_way = way;
     310                return DirectoryEntry(m_dir_tab[set][way]);
     311            }
    306312        }
    307       }
    308       return DirectoryEntry();
     313        return DirectoryEntry();
    309314    } // end read_neutral()
    310315
     
    406411    void init()
    407412    {
    408       for ( size_t set=0 ; set<m_sets ; set++ ) {
    409         for ( size_t way=0 ; way<m_ways ; way++ ) {
     413      for ( size_t set=0 ; set<m_sets ; set++ )
     414      {
     415        for ( size_t way=0 ; way<m_ways ; way++ )
     416        {
    410417          m_dir_tab[set][way].init();
    411418          m_lru_tab[set][way].init();
     
    688695        assert((set < m_sets ) && "Cache data error: Trying to read a wrong set" );
    689696        assert((way < m_ways ) && "Cache data error: Trying to read a wrong way" );
    690      
     697
    691698        for (uint32_t word=0; word<m_words; word++)
    692699          cache_line[word].write(m_cache_data[way][set][word]);
Note: See TracChangeset for help on using the changeset viewer.