#include <string>
-#include "mem/cache/base.hh"
#include "base/intmath.hh"
+#include "mem/cache/base.hh"
+#include "mem/cache/tags/cacheset.hh"
#include "mem/cache/tags/lru.hh"
#include "sim/core.hh"
-#include "cacheset.hh"
using namespace std;
sets = new CacheSet[numSets];
blks = new BlkType[numSets * assoc];
// allocate data storage in one big chunk
- dataBlks = new uint8_t[numSets*assoc*blkSize];
+ numBlocks = numSets * assoc;
+ dataBlks = new uint8_t[numBlocks * blkSize];
unsigned blkIndex = 0; // index into blks array
for (unsigned i = 0; i < numSets; ++i) {
++sampledRefs;
blk->refCount = 0;
+ // deal with evicted block
+ if (blk->contextSrc != -1) {
+ occupancies[blk->contextSrc % cache->numCpus()]--;
+ blk->contextSrc = -1;
+ } else {
+ occupancies[cache->numCpus()]--;
+ }
+
DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n",
set, regenerateBlkAddr(blk->tag, set));
}
// Set tag for new block. Caller is responsible for setting status.
blk->tag = extractTag(addr);
+ // deal with what we are bringing in
+ if (context_src != -1) {
+ occupancies[context_src % cache->numCpus()]++;
+ } else {
+ occupancies[cache->numCpus()]++;
+ }
+ blk->contextSrc = context_src;
+
unsigned set = extractSet(addr);
sets[set].moveToHead(blk);
}
blk->isTouched = false;
blk->clearLoadLocks();
tagsInUse--;
+ if (blk->contextSrc != -1) {
+ occupancies[blk->contextSrc % cache->numCpus()]--;
+ blk->contextSrc = -1;
+ } else {
+ occupancies[cache->numCpus()]--;
+ }
+ }
+}
+
+void
+LRU::clearLocks()
+{
+ for (int i = 0; i < numBlocks; i++){
+ blks[i].clearLoadLocks();
}
}