Changeset 212


Ignore:
Timestamp:
Mar 21, 2012, 3:24:54 PM (12 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

Location:
trunk/modules/vci_mem_cache_v4/caba/source
Files:
2 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    /////////////////////////////////////////////////////////////////////
  • trunk/modules/vci_mem_cache_v4/caba/source/src/vci_mem_cache_v4.cpp

    r200 r212  
    448448/////////////////////////////////////////////////////
    449449{
    450     size_t way = 0;
    451     DirectoryEntry entry = m_cache_directory.read(addr, way);
     450    DirectoryEntry entry = m_cache_directory.read_neutral(addr);
    452451    if ( (entry.count != m_debug_previous_count) or
    453452         (entry.valid != m_debug_previous_hit) )
Note: See TracChangeset for help on using the changeset viewer.