[Gems-users] How to access cache entry in LRUPolicy


Date: Fri, 12 Feb 2010 11:22:05 +0530
From: Liz Joy <lizjoy86@xxxxxxxxx>
Subject: [Gems-users] How to access cache entry in LRUPolicy
Thank u very much for the reply ...

I am using GEMS -2.1.1..and MSI_MOSI_CMP_protocol...What actually I want to do is...I have a shared single banked L2 cache shared by multiple cores say 4. I need to attach the id of the core to the block or to the way of L2 cache,which brought the block into the L2 cache .This id associated with each L2 cache entry is to be used while selecting the victim for replacement.So,I  added a new additional member to Address.h................................. NodeID m_processorid.In CacheMemory constructor I set the processorid of all the entries as -1.

 m_cache[i].setSize(m_cache_assoc);
    for (int j = 0; j < m_cache_assoc; j++) {
      m_cache[i][j].m_Address.setAddress(0);
      m_cache[i][j].m_Permission = AccessPermission_NotPresent;
      m_cache[i][j].m_Address.setInitialOwner(-1);
  }

Is that right???

While allocating a new block to L2 cache....I added the line

 m_cache[cacheSet][i].m_Address.m_processorid = address.m_processorid;

in allocate() in CacheMemory.h under the condition if(m_machType == MACHINETYPE_L2CACHE_ENUM).
Is that write???
So in cacheprobe() in CacheMemory.h while choosing the victim I need to make the selection based the m_processorid associated with each L2 cache entry.For that I added a new function getVictimOwner(Index set,NodeID processorid) to LRUPolicy.h (Also to AbstractRepalcementPolicy.h and PseudoLRUPolicy.h).This function is invoked in cacheProbe() of CacheMemory.h.In this function ,I need to choose the victim as the one which is LRU in the set but from among those having the same processorid as the one whose request has caused the replacement.So,for that,I wrote the following code where I need to access each way of corresponding L2 cache and cross check the processorid.
for(unsigned int i=0;i < m_assoc; i++)
{
        if(m_cache[set][i].m_Address.m_processorid == processorid)............................//line no 98
        {
                smallest_time = m_last_ref_ptr[set][i];
                smallest_index = i;
                break;

        }
}

for (unsigned int i=0; i < m_assoc; i++)
 {

        if(m_cache[set][i].m_Address.m_processorid == processorid)....................//line no 109
        {
                 time = m_last_ref_ptr[set][i];
                                 //assert(m_cache[cacheSet][i].m_Permission != AccessPermission_NotPresent);

                if (time < smallest_time)
                {
                         smallest_index = i;
                         smallest_time = time;
                }
         }
  }

But I dont know how to access the L2 cache entries in the set in LRUPolicy.h.I am not familiar with the templates.Can you please help me on how to perform this checkingand what modifications I need to do in the modules??
Expecting a reply soon......

Thanks in Advance
Liz
[← Prev in Thread] Current Thread [Next in Thread→]