Hi all,

We want to re-insert the evicted block from lru position into mru depending
on contextSrc (assumed to be cpu-id).

Assuming 4 cpus, cpu-id= 0,1,2,3

if contextSrc=0/1 , the block is inserted into mru of the same set, else it
is to be discarded.

We updated lru.cc as follows
-------------------------------------------------------------------------------------------
LRU::findVictim(Addr addr, PacketList &writebacks)
{
    int flag=0;
    unsigned set = extractSet(addr);
    // grab a replacement candidate
    BlkType *blk;
   while(flag==0)
{
    blk = sets[set].blks[assoc-1];

    if (blk->isValid())
   {

     replacements[0]++;
        totalRefs += blk->refCount;
        ++sampledRefs;
        blk->refCount = 0;

     // deal with evicted block

    if(blk->contextSrc!=-1)
    {
        //for spiller caches

        if(blk->contextSrc== 0 || blk->contextSrc==1)
        {

            insertBlock(addr,blk, blk->contextSrc);
            flag=0;

        }

        // for reciever caches
        else
        {

            occupancies[blk->contextSrc % cache->numCpus()]--;
                    blk->contextSrc = -1;
            flag=1;
// flag is set if contexsrc = 2/3
        }

    }
     else
    {

    occupancies[cache->numCpus()]--;
        flag=1;
        }
   }
   else
    flag=1;


        DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n",
                set, regenerateBlkAddr(blk->tag, set));
    }// while end
    return blk;
}

------------------------------------------------------------------------------------------------------------------------------
we wanted to see the contents of the cache set , so added printing
statements as follows in cacheset.cc
---------------------------------------------------------------------------------------------------------------------------------
void
CacheSet::moveToHead(CacheBlk *blk)
{
        // nothing to do if blk is already head
    if (blks[0] == blk)
        return;



    // write 'next' block into blks[i], moving up from MRU toward LRU
    // until we overwrite the block we moved to head.

    // start by setting up to write 'blk' into blks[0]
    int i = 0;
    CacheBlk *next = blk;
    inform("before insertion\n");
    for(int i=0;i<assoc;i++)
    inform("blocks[%d] = %x,",i,blks[i]);
    i=0;
    do {
        assert(i < assoc);
        // swap blks[i] and next

        CacheBlk *tmp = blks[i];
        blks[i] = next;
        next = tmp;

        ++i;
    } while (next != blk);
inform("After insertion\n");
  for(int i=0;i<assoc;i++)
    inform("blocks[%d] = %x,",i,blks[i]);
}

But for the same set we saw the following status

info: before insertion
info: blocks[0] = 0xa552684,
info: blocks[1] = 0xa5526bc,
info: blocks[2] = 0xa5526f4,
info: blocks[3] = 0xa55272c,
info: blocks[4] = 0xa552764,
info: blocks[5] = 0xa55279c,
info: blocks[6] = 0xa5527d4,
info: blocks[7] = 0xa55280c,

info: after insertion
info: blocks[0] = 0xa55280c,
info: blocks[1] = 0xa552684,
info: blocks[2] = 0xa5526bc,
info: blocks[3] = 0xa5526f4,
info: blocks[4] = 0xa55272c,
info: blocks[5] = 0xa552764,
info: blocks[6] = 0xa55279c,
info: blocks[7] = 0xa5527d4,

info: before insertion
info: blocks[0] = 0xa5fd284,

For the same set, block[0] shows two different value...why?
-- 
Sunitha.P
9092892876
_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to