Changeset 142 for trunk


Ignore:
Timestamp:
Mar 17, 2011, 2:32:38 PM (14 years ago)
Author:
guthmull
Message:

Eviction can now be random. Unselected by default.

File:
1 edited

Legend:

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

    r140 r142  
    88
    99#define L1_MULTI_CACHE      1
     10//#define RANDOM_EVICTION
    1011
    1112namespace soclib { namespace caba {
     
    189190    size_t                                      m_words;
    190191    size_t                                      m_width;
     192    uint32_t                lfsr;
    191193
    192194    // the directory & lru tables
     
    205207      m_words = words;
    206208      m_width = address_width;
     209      lfsr = -1;
    207210
    208211      m_dir_tab = new DirectoryEntry*[sets];
     
    324327        }
    325328      }
     329
     330#ifdef RANDOM_EVICTION
     331      lfsr = (lfsr >> 1) ^ ((-(lfsr & 1)) & 0xd0000001);
     332      way = lfsr % m_ways;
     333      return DirectoryEntry(m_dir_tab[set][way]);
     334#endif
     335
    326336      for(size_t i=0; i<m_ways; i++){
    327337        if(!(m_lru_tab[set][i].recent) && !(m_dir_tab[set][i].lock)){
Note: See TracChangeset for help on using the changeset viewer.