Ignore:
Timestamp:
Mar 21, 2012, 3:24:54 PM (13 years ago)
Author:
bouyer
Message:

Introduce read_neutral(), which returns a directory entry without updating
the LRU bit.
Use read_neutral() in cache_monitor(), so that it doesn't affect the
cache state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/vci_mem_cache_v4/caba/source/include/mem_cache_directory_v4.h

    r143 r212  
    267267      }
    268268    } // end read()
     269
     270    /////////////////////////////////////////////////////////////////////
     271    // The read_neutral() function reads a directory entry, without
     272    // changing the LRU
     273    // Arguments :
     274    // - address : the address of the entry
     275    // The function returns a copy of a (valid or invalid) entry 
     276    /////////////////////////////////////////////////////////////////////
     277    DirectoryEntry read_neutral(const addr_t &address)
     278    {
     279
     280#define L2 soclib::common::uint32_log2
     281      const size_t set = (size_t)(address >> (L2(m_words) + 2)) & (m_sets - 1);
     282      const tag_t  tag = (tag_t)(address >> (L2(m_sets) + L2(m_words) + 2));
     283#undef L2
     284
     285      bool hit       = false;
     286      for ( size_t i=0 ; i<m_ways ; i++ ) {
     287        bool equal = ( m_dir_tab[set][i].tag == tag );
     288        bool valid = m_dir_tab[set][i].valid;
     289        hit = equal && valid;
     290        if ( hit ) {                   
     291          return DirectoryEntry(m_dir_tab[set][i]);
     292        }
     293      }
     294      return DirectoryEntry();
     295    } // end read_neutral()
    269296
    270297    /////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.