A few minor non-debug compilation issues.
[gem5.git] / src / mem / cache / tags / split_lru.cc
index ea5b92d6f2f29d46fba75a810abc4d016597fd6d..4d271a92ad9b5db54d54cc36052057cdee0974ad 100644 (file)
 #include "mem/cache/base_cache.hh"
 #include "base/intmath.hh"
 #include "mem/cache/tags/split_lru.hh"
-#include "sim/root.hh"
+#include "sim/core.hh"
 
 using namespace std;
 
 SplitBlk*
-SplitCacheSet::findBlk(int asid, Addr tag) const
+SplitCacheSet::findBlk(Addr tag) const
 {
     for (int i = 0; i < assoc; ++i) {
         if (blks[i]->tag == tag && blks[i]->isValid()) {
@@ -135,7 +135,6 @@ SplitLRU::SplitLRU(int _numSets, int _blkSize, int _assoc, int _hit_latency, int
             // table; won't matter because the block is invalid
             blk->tag = j;
             blk->whenReady = 0;
-            blk->req->asid = -1;
             blk->isTouched = false;
             blk->size = blkSize;
             sets[i].blks[j]=blk;
@@ -172,23 +171,23 @@ SplitLRU::regStats(const std::string &name)
 
 // probe cache for presence of given block.
 bool
-SplitLRU::probe(int asid, Addr addr) const
+SplitLRU::probe(Addr addr) const
 {
     //  return(findBlock(Read, addr, asid) != 0);
     Addr tag = extractTag(addr);
     unsigned myset = extractSet(addr);
 
-    SplitBlk *blk = sets[myset].findBlk(asid, tag);
+    SplitBlk *blk = sets[myset].findBlk(tag);
 
     return (blk != NULL);      // true if in cache
 }
 
 SplitBlk*
-SplitLRU::findBlock(Addr addr, int asid, int &lat)
+SplitLRU::findBlock(Addr addr, int &lat)
 {
     Addr tag = extractTag(addr);
     unsigned set = extractSet(addr);
-    SplitBlk *blk = sets[set].findBlk(asid, tag);
+    SplitBlk *blk = sets[set].findBlk(tag);
     lat = hitLatency;
     if (blk != NULL) {
         // move this block to head of the MRU list
@@ -203,49 +202,25 @@ SplitLRU::findBlock(Addr addr, int asid, int &lat)
     return blk;
 }
 
-SplitBlk*
-SplitLRU::findBlock(Packet * &pkt, int &lat)
-{
-    Addr addr = pkt->paddr;
-    int asid = pkt->req->asid;
-
-    Addr tag = extractTag(addr);
-    unsigned set = extractSet(addr);
-    SplitBlk *blk = sets[set].findBlk(asid, tag);
-    lat = hitLatency;
-    if (blk != NULL) {
-        // move this block to head of the MRU list
-        sets[set].moveToHead(blk);
-        if (blk->whenReady > curTick && blk->whenReady - curTick > hitLatency){
-            lat = blk->whenReady - curTick;
-        }
-        blk->refCount += 1;
-        hits++;
-    }
-
-    return blk;
-}
 
 SplitBlk*
-SplitLRU::findBlock(Addr addr, int asid) const
+SplitLRU::findBlock(Addr addr) const
 {
     Addr tag = extractTag(addr);
     unsigned set = extractSet(addr);
-    SplitBlk *blk = sets[set].findBlk(asid, tag);
+    SplitBlk *blk = sets[set].findBlk(tag);
     return blk;
 }
 
 SplitBlk*
-SplitLRU::findReplacement(Packet * &pkt, PacketList* &writebacks,
-                     BlkList &compress_blocks)
+SplitLRU::findReplacement(Addr addr, PacketList &writebacks)
 {
-    unsigned set = extractSet(pkt->paddr);
+    unsigned set = extractSet(addr);
     // grab a replacement candidate
     SplitBlk *blk = sets[set].blks[assoc-1];
     sets[set].moveToHead(blk);
     if (blk->isValid()) {
-        int thread_num = (blk->xc) ? blk->xc->getThreadNum() : 0;
-        replacements[thread_num]++;
+        replacements[0]++;
         totalRefs += blk->refCount;
         ++sampledRefs;
         blk->refCount = 0;
@@ -264,9 +239,8 @@ SplitLRU::findReplacement(Packet * &pkt, PacketList* &writebacks,
 }
 
 void
-SplitLRU::invalidateBlk(int asid, Addr addr)
+SplitLRU::invalidateBlk(SplitLRU::BlkType *blk)
 {
-    SplitBlk *blk = findBlock(addr, asid);
     if (blk) {
         blk->status = 0;
         blk->isTouched = false;
@@ -274,51 +248,6 @@ SplitLRU::invalidateBlk(int asid, Addr addr)
     }
 }
 
-void
-SplitLRU::doCopy(Addr source, Addr dest, int asid, PacketList* &writebacks)
-{
-    assert(source == blkAlign(source));
-    assert(dest == blkAlign(dest));
-    SplitBlk *source_blk = findBlock(source, asid);
-    assert(source_blk);
-    SplitBlk *dest_blk = findBlock(dest, asid);
-    if (dest_blk == NULL) {
-        // Need to do a replacement
-        Packet * pkt = new Packet();
-        pkt->paddr = dest;
-        BlkList dummy_list;
-        dest_blk = findReplacement(pkt, writebacks, dummy_list);
-        if (dest_blk->isValid() && dest_blk->isModified()) {
-            // Need to writeback data.
-            pkt = buildWritebackReq(regenerateBlkAddr(dest_blk->tag,
-                                                      dest_blk->set),
-                                    dest_blk->req->asid,
-                                    dest_blk->xc,
-                                    blkSize,
-                                    (cache->doData())?dest_blk->data:0,
-                                    dest_blk->size);
-            writebacks.push_back(pkt);
-        }
-        dest_blk->tag = extractTag(dest);
-        dest_blk->req->asid = asid;
-        /**
-         * @todo Do we need to pass in the execution context, or can we
-         * assume its the same?
-         */
-        assert(source_blk->xc);
-        dest_blk->xc = source_blk->xc;
-    }
-    /**
-     * @todo Can't assume the status once we have coherence on copies.
-     */
-
-    // Set this block as readable, writeable, and dirty.
-    dest_blk->status = 7;
-    if (cache->doData()) {
-        memcpy(dest_blk->data, source_blk->data, blkSize);
-    }
-}
-
 void
 SplitLRU::cleanupRefs()
 {