Changeset 303


Ignore:
Timestamp:
Feb 26, 2013, 4:19:54 PM (11 years ago)
Author:
joannou
Message:

Bug fix in generic_cache_tsar component :
In the read_select function,

  • Added an _set variable uset instead of the argument for inner tests.
  • Initialized found argument to false, and use it for inner tests.
  • Removed the if(!found) tests.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/generic_cache_tsar/include/generic_cache.h

    r297 r303  
    600600                            bool*     cleanup )
    601601    {
     602        size_t _set = m_y[ad];
     603
     604        *found = false;
     605
    602606        // Search first empty slot
    603         for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ )
    604         {
    605             if ( cache_state(_way, *set) == CACHE_SLOT_STATE_EMPTY )
     607        for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ )
     608        {
     609            if ( cache_state(_way, _set) == CACHE_SLOT_STATE_EMPTY )
    606610            {
    607611                *found   = true;
     
    613617        }
    614618        // Search first not zombi old slot
    615         if ( !found )
    616         {
    617             for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ )
    618             {
    619                 if ( not cache_lru(_way, *set) and
    620                      (cache_state(_way, *set) != CACHE_SLOT_STATE_ZOMBI) )
    621                 {
    622                     *found   = true;
    623                     *cleanup = true;
    624                     *way     = _way;
    625                     *set     = m_y[ad];
    626                     *victim  = (addr_t)((cache_tag(*way,*set) * m_sets) + *set);
    627                     return;
    628                 }
     619        for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ )
     620        {
     621            if ( not cache_lru(_way, _set) and
     622                 (cache_state(_way, _set) != CACHE_SLOT_STATE_ZOMBI) )
     623            {
     624                *found   = true;
     625                *cleanup = true;
     626                *way     = _way;
     627                *set     = m_y[ad];
     628                *victim  = (addr_t)((cache_tag(*way,_set) * m_sets) + _set);
     629                return;
    629630            }
    630631        }
    631632        // Search first not zombi slot
    632         if ( !found )
    633         {
    634             for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ )
    635             {
    636                 if ( cache_state(_way, *set) != CACHE_SLOT_STATE_ZOMBI)
    637                 {
    638                     *found   = true;
    639                     *cleanup = true;
    640                     *way    = _way;
    641                     *set     = m_y[ad];
    642                     *victim  = (addr_t)((cache_tag(*way,*set) * m_sets) + *set);
    643                     return;
    644                 }
     633        for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ )
     634        {
     635            if ( cache_state(_way, _set) != CACHE_SLOT_STATE_ZOMBI)
     636            {
     637                *found   = true;
     638                *cleanup = true;
     639                *way    = _way;
     640                *set     = m_y[ad];
     641                *victim  = (addr_t)((cache_tag(*way,_set) * m_sets) + _set);
     642                return;
    645643            }
    646644        }
Note: See TracChangeset for help on using the changeset viewer.