- Timestamp:
- Feb 26, 2013, 4:19:54 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/generic_cache_tsar/include/generic_cache.h
r297 r303 600 600 bool* cleanup ) 601 601 { 602 size_t _set = m_y[ad]; 603 604 *found = false; 605 602 606 // 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 ) 606 610 { 607 611 *found = true; … … 613 617 } 614 618 // 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; 629 630 } 630 631 } 631 632 // 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; 645 643 } 646 644 }
Note: See TracChangeset
for help on using the changeset viewer.