src/mem/ruby/structures/CacheMemory.cc
//fanyao: deallocated is called right before one way is to
//be evicted. Only one exception, MEMORY_INV event from external
//soures. This could be determined based on core_id
deallocated is called right before one way is to
be evicted. Only one exception, MEMORY_INV event from external
soures. This could be determined based on core_id
deallocated is called right before one way is to be evicted . Only one exception MEMORY_INV event from external soures . This could be determined based on core_id
void
CacheMemory::deallocate(Addr address, int core_id)
{
    assert(address == makeLineAddress(address));
    assert(isTagPresent(address));
    DPRINTF(RubyCache, "address: %#x\n", address);
    int64_t cacheSet = addressToCacheSet(address);
    int loc = findTagInSet(cacheSet, address);
    if (loc != -1) {
        if (core_id!=88)
        {
            assert(m_np == 4); 
            int ways[4] = {0};
            for(int j = 0; j < m_cache_assoc; j++)
            {
                assert(m_cache[cacheSet][j] != NULL);
                ways[m_cache[cacheSet][j]->getCoreId()]++;
            }
            int evicted_core_id = m_cache[cacheSet][loc]->getCoreId();
            if(core_id == -1)                
                core_id = 0;
            DPRINTF(WayEvictMICRO17, ",src_core:%d, evict_core:%d, "
                   "way-core0:%d, way-core1:%s, way-core2:%d, way-core3:%d, "
                   "cache_set:%lld, evict_address:%#x\n",
                   core_id, evicted_core_id, ways[0], ways[1], 
                   ways[2], ways[3], cacheSet, address);
            if (core_id!=evicted_core_id){
              last_evicting_core_id=core_id;
              last_evicted_core_id=evicted_core_id;
              newEvict(core_id, evicted_core_id, address);
            }
        }
        delete m_cache[cacheSet][loc];
        m_cache[cacheSet][loc] = NULL;
        m_tag_index.erase(address);
    }
}
void CacheMemory :: deallocate ( Addr address , int core_id ) { assert ( address == makeLineAddress ( address ) ) ; assert ( isTagPresent ( address ) ) ; DPRINTF ( RubyCache , " \n " , address ) ; int64_t cacheSet = addressToCacheSet ( address ) ; int loc = findTagInSet ( cacheSet , address ) ; if ( loc != -1 ) { if ( core_id != 88 ) { assert ( m_np == 4 ) ; int ways [ 4 ] = { 0 } ; for ( int j = 0 ; j < m_cache_assoc ; j ++ ) { assert ( m_cache [ cacheSet ] [ j ] != NULL ) ; ways [ m_cache [ cacheSet ] [ j ] -> getCoreId ( ) ] ++ ; } int evicted_core_id = m_cache [ cacheSet ] [ loc ] -> getCoreId ( ) ; if ( core_id == -1 ) core_id = 0 ; DPRINTF ( WayEvictMICRO17 , " " " " " \n " , core_id , evicted_core_id , ways [ 0 ] , ways [ 1 ] , ways [ 2 ] , ways [ 3 ] , cacheSet , address ) ; if ( core_id != evicted_core_id ) { last_evicting_core_id = core_id ; last_evicted_core_id = evicted_core_id ; newEvict ( core_id , evicted_core_id , address ) ; } } delete m_cache [ cacheSet ] [ loc ] ; m_cache [ cacheSet ] [ loc ] = NULL ; m_tag_index . erase ( address ) ; } }
fanyao: deallocated is called right before one way is to
be evicted.
fanyao : deallocated is called right before one way is to be evicted .
//fanyao added: the share of ways for each core //this is a little be hacky //if(m_cache_level == 2 && core_id != 88) //let's now consider only 4 cores //std::memset(way, 0, m_np); //currently unknown at what instance when core_id //could be -1 //hongyu //--