summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-12-18 23:07:52 -0800
committerSteve Reinhardt <stever@eecs.umich.edu>2006-12-18 23:07:52 -0800
commit9d7db8bb2bbd5ae6a3653385c896b19da4d33f69 (patch)
treef30120e63501f6ac759e3d828d04a0b0993538fc /src/mem/cache/tags
parentf655932700dbe8d39ee618a2679cb43d2c41eaa1 (diff)
downloadgem5-9d7db8bb2bbd5ae6a3653385c896b19da4d33f69.tar.xz
Streamline Cache/Tags interface: get rid of redundant functions,
don't regenerate address from block in cache so that tags can turn around and use address to look up block again. --HG-- extra : convert_revision : 171018aa6e331d98399c4e5ef24e173c95eaca28
Diffstat (limited to 'src/mem/cache/tags')
-rw-r--r--src/mem/cache/tags/fa_lru.cc43
-rw-r--r--src/mem/cache/tags/fa_lru.hh17
-rw-r--r--src/mem/cache/tags/iic.cc62
-rw-r--r--src/mem/cache/tags/iic.hh16
-rw-r--r--src/mem/cache/tags/lru.cc24
-rw-r--r--src/mem/cache/tags/lru.hh16
-rw-r--r--src/mem/cache/tags/split.cc58
-rw-r--r--src/mem/cache/tags/split.hh16
-rw-r--r--src/mem/cache/tags/split_lifo.cc28
-rw-r--r--src/mem/cache/tags/split_lifo.hh16
-rw-r--r--src/mem/cache/tags/split_lru.cc24
-rw-r--r--src/mem/cache/tags/split_lru.hh16
12 files changed, 27 insertions, 309 deletions
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index a58ddaff8..42a1fe34f 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -153,12 +153,9 @@ FALRU::probe(Addr addr) const
}
void
-FALRU::invalidateBlk(Addr addr)
+FALRU::invalidateBlk(FALRU::BlkType *blk)
{
- Addr blkAddr = blkAlign(addr);
- FALRUBlk* blk = (*tagHash.find(blkAddr)).second;
if (blk) {
- assert(blk->tag == blkAddr);
blk->status = 0;
blk->isTouched = false;
tagsInUse--;
@@ -202,44 +199,6 @@ FALRU::findBlock(Addr addr, int &lat, int *inCache)
return blk;
}
-FALRUBlk*
-FALRU::findBlock(PacketPtr &pkt, int &lat, int *inCache)
-{
- Addr addr = pkt->getAddr();
-
- accesses++;
- int tmp_in_cache = 0;
- Addr blkAddr = blkAlign(addr);
- FALRUBlk* blk = hashLookup(blkAddr);
-
- if (blk && blk->isValid()) {
- assert(blk->tag == blkAddr);
- tmp_in_cache = blk->inCache;
- for (int i = 0; i < numCaches; i++) {
- if (1<<i & blk->inCache) {
- hits[i]++;
- } else {
- misses[i]++;
- }
- }
- hits[numCaches]++;
- if (blk != head){
- moveToHead(blk);
- }
- } else {
- blk = NULL;
- for (int i = 0; i < numCaches+1; ++i) {
- misses[i]++;
- }
- }
- if (inCache) {
- *inCache = tmp_in_cache;
- }
-
- lat = hitLatency;
- //assert(check());
- return blk;
-}
FALRUBlk*
FALRU::findBlock(Addr addr) const
diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh
index 2db89d603..dabbda740 100644
--- a/src/mem/cache/tags/fa_lru.hh
+++ b/src/mem/cache/tags/fa_lru.hh
@@ -173,11 +173,10 @@ public:
bool probe(Addr addr) const;
/**
- * Invalidate the cache block that contains the given addr.
- * @param asid The address space ID.
- * @param addr The address to invalidate.
+ * Invalidate a cache block.
+ * @param blk The block to invalidate.
*/
- void invalidateBlk(Addr addr);
+ void invalidateBlk(BlkType *blk);
/**
* Find the block in the cache and update the replacement data. Returns
@@ -191,16 +190,6 @@ public:
FALRUBlk* findBlock(Addr addr, int &lat, int *inCache = 0);
/**
- * Find the block in the cache and update the replacement data. Returns
- * the access latency and the in cache flags as a side effect
- * @param pkt The req whose block to find
- * @param lat The latency of the access.
- * @param inCache The FALRUBlk::inCache flags.
- * @return Pointer to the cache block.
- */
- FALRUBlk* findBlock(PacketPtr &pkt, int &lat, int *inCache = 0);
-
- /**
* Find the block in the cache, do not update the replacement data.
* @param addr The address to look for.
* @param asid The address space ID.
diff --git a/src/mem/cache/tags/iic.cc b/src/mem/cache/tags/iic.cc
index f4e870659..38f9662ea 100644
--- a/src/mem/cache/tags/iic.cc
+++ b/src/mem/cache/tags/iic.cc
@@ -284,65 +284,6 @@ IIC::findBlock(Addr addr, int &lat)
return tag_ptr;
}
-IICTag*
-IIC::findBlock(PacketPtr &pkt, int &lat)
-{
- Addr addr = pkt->getAddr();
-
- Addr tag = extractTag(addr);
- unsigned set = hash(addr);
- int set_lat;
-
- unsigned long chain_ptr;
-
- if (PROFILE_IIC)
- setAccess.sample(set);
-
- IICTag *tag_ptr = sets[set].findTag(tag, chain_ptr);
- set_lat = 1;
- if (tag_ptr == NULL && chain_ptr != tagNull) {
- int secondary_depth;
- tag_ptr = secondaryChain(tag, chain_ptr, &secondary_depth);
- set_lat += secondary_depth;
- // set depth for statistics fix this later!!! egh
- sets[set].depth = set_lat;
-
- if (tag_ptr != NULL) {
- /* need to move tag into primary table */
- // need to preserve chain: fix this egh
- sets[set].tags[assoc-1]->chain_ptr = tag_ptr->chain_ptr;
- tagSwap(tag_ptr - tagStore, sets[set].tags[assoc-1] - tagStore);
- tag_ptr = sets[set].findTag(tag, chain_ptr);
- assert(tag_ptr!=NULL);
- }
-
- }
- set_lat = set_lat * hashDelay + hitLatency;
- if (tag_ptr != NULL) {
- // IIC replacement: if this is not the first element of
- // list, reorder
- sets[set].moveToHead(tag_ptr);
-
- hitHashDepth.sample(sets[set].depth);
- hashHit++;
- hitDepthTotal += sets[set].depth;
- tag_ptr->status |= BlkReferenced;
- lat = set_lat;
- if (tag_ptr->whenReady > curTick && tag_ptr->whenReady - curTick > set_lat) {
- lat = tag_ptr->whenReady - curTick;
- }
-
- tag_ptr->refCount += 1;
- }
- else {
- // fall through: cache block not found, not a hit...
- missHashDepth.sample(sets[set].depth);
- hashMiss++;
- missDepthTotal += sets[set].depth;
- lat = set_lat;
- }
- return tag_ptr;
-}
IICTag*
IIC::findBlock(Addr addr) const
@@ -695,9 +636,8 @@ IIC::compressBlock(unsigned long index)
}
void
-IIC::invalidateBlk(Addr addr)
+IIC::invalidateBlk(IIC::BlkType *tag_ptr)
{
- IICTag* tag_ptr = findBlock(addr);
if (tag_ptr) {
for (int i = 0; i < tag_ptr->numData; ++i) {
dataReferenceCount[tag_ptr->data_ptr[i]]--;
diff --git a/src/mem/cache/tags/iic.hh b/src/mem/cache/tags/iic.hh
index 92bd6da1d..d0663d330 100644
--- a/src/mem/cache/tags/iic.hh
+++ b/src/mem/cache/tags/iic.hh
@@ -435,11 +435,10 @@ class IIC : public BaseTags
void compressBlock(unsigned long index);
/**
- * Invalidate the block containing the address.
- * @param asid The address space ID.
- * @param addr The address to invalidate.
+ * Invalidate a block.
+ * @param blk The block to invalidate.
*/
- void invalidateBlk(Addr addr);
+ void invalidateBlk(BlkType *blk);
/**
* Find the block and update the replacement data. This call also returns
@@ -452,15 +451,6 @@ class IIC : public BaseTags
IICTag* findBlock(Addr addr, int &lat);
/**
- * Find the block and update the replacement data. This call also returns
- * the access latency as a side effect.
- * @param pkt The req whose block to find
- * @param lat The access latency.
- * @return A pointer to the block found, if any.
- */
- IICTag* findBlock(PacketPtr &pkt, int &lat);
-
- /**
* Find the block, do not update the replacement data.
* @param addr The address to find.
* @param asid The address space ID.
diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc
index 31d29aae6..102bb3506 100644
--- a/src/mem/cache/tags/lru.cc
+++ b/src/mem/cache/tags/lru.cc
@@ -183,27 +183,6 @@ LRU::findBlock(Addr addr, int &lat)
return blk;
}
-LRUBlk*
-LRU::findBlock(PacketPtr &pkt, int &lat)
-{
- Addr addr = pkt->getAddr();
-
- Addr tag = extractTag(addr);
- unsigned set = extractSet(addr);
- LRUBlk *blk = sets[set].findBlk(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;
- }
-
- return blk;
-}
LRUBlk*
LRU::findBlock(Addr addr) const
@@ -240,9 +219,8 @@ LRU::findReplacement(PacketPtr &pkt, PacketList &writebacks,
}
void
-LRU::invalidateBlk(Addr addr)
+LRU::invalidateBlk(LRU::BlkType *blk)
{
- LRUBlk *blk = findBlock(addr);
if (blk) {
blk->status = 0;
blk->isTouched = false;
diff --git a/src/mem/cache/tags/lru.hh b/src/mem/cache/tags/lru.hh
index fed688283..4b94adca6 100644
--- a/src/mem/cache/tags/lru.hh
+++ b/src/mem/cache/tags/lru.hh
@@ -161,20 +161,10 @@ public:
bool probe(Addr addr) const;
/**
- * Invalidate the block containing the given address.
- * @param asid The address space ID.
- * @param addr The address to invalidate.
- */
- void invalidateBlk(Addr addr);
-
- /**
- * Finds the given address in the cache and update replacement data.
- * Returns the access latency as a side effect.
- * @param pkt The request whose block to find.
- * @param lat The access latency.
- * @return Pointer to the cache block if found.
+ * Invalidate the given block.
+ * @param blk The block to invalidate.
*/
- LRUBlk* findBlock(PacketPtr &pkt, int &lat);
+ void invalidateBlk(BlkType *blk);
/**
* Finds the given address in the cache and update replacement data.
diff --git a/src/mem/cache/tags/split.cc b/src/mem/cache/tags/split.cc
index bc74f0e0f..5ac87eaba 100644
--- a/src/mem/cache/tags/split.cc
+++ b/src/mem/cache/tags/split.cc
@@ -266,58 +266,6 @@ Split::probe(Addr addr) const
return success;
}
-SplitBlk*
-Split::findBlock(PacketPtr &pkt, int &lat)
-{
-
- Addr aligned = blkAlign(pkt->getAddr());
-
- if (memHash.count(aligned)) {
- memHash[aligned]++;
- } else if (pkt->nic_pkt()) {
- memHash[aligned] = 1;
- }
-
- SplitBlk *blk = lru->findBlock(pkt->getAddr(), lat);
- if (blk) {
- if (pkt->nic_pkt()) {
- NR_CP_hits++;
- } else {
- CR_CP_hits++;
- }
- } else {
- if (lifo && lifo_net) {
- blk = lifo_net->findBlock(pkt->getAddr(), lat);
-
- } else if (lru_net) {
- blk = lru_net->findBlock(pkt->getAddr(), lat);
- }
- if (blk) {
- if (pkt->nic_pkt()) {
- NR_NP_hits++;
- } else {
- CR_NP_hits++;
- }
- }
- }
-
- if (blk) {
- Tick latency = curTick - blk->ts;
- if (blk->isNIC) {
- if (!blk->isUsed && !pkt->nic_pkt()) {
- useByCPUCycleDist.sample(latency);
- nicUseByCPUCycleTotal += latency;
- nicBlksUsedByCPU++;
- }
- }
- blk->isUsed = true;
-
- if (pkt->nic_pkt()) {
- DPRINTF(Split, "found block in partition %d\n", blk->part);
- }
- }
- return blk;
-}
SplitBlk*
Split::findBlock(Addr addr, int &lat)
@@ -403,14 +351,16 @@ Split::findReplacement(PacketPtr &pkt, PacketList &writebacks,
}
void
-Split::invalidateBlk(Addr addr)
+Split::invalidateBlk(Split::BlkType *blk)
{
- SplitBlk *blk = lru->findBlock(addr);
if (!blk) {
+ fatal("FIXME!\n");
+#if 0
if (lifo && lifo_net)
blk = lifo_net->findBlock(addr);
else if (lru_net)
blk = lru_net->findBlock(addr);
+#endif
if (!blk)
return;
diff --git a/src/mem/cache/tags/split.hh b/src/mem/cache/tags/split.hh
index 898d3c7a0..e6ace0921 100644
--- a/src/mem/cache/tags/split.hh
+++ b/src/mem/cache/tags/split.hh
@@ -184,11 +184,10 @@ class Split : public BaseTags
bool probe(Addr addr) const;
/**
- * Invalidate the block containing the given address.
- * @param asid The address space ID.
- * @param addr The address to invalidate.
+ * Invalidate the given block.
+ * @param blk The block to invalidate.
*/
- void invalidateBlk(Addr addr);
+ void invalidateBlk(BlkType *blk);
/**
* Finds the given address in the cache and update replacement data.
@@ -201,15 +200,6 @@ class Split : public BaseTags
SplitBlk* findBlock(Addr addr, int &lat);
/**
- * Finds the given address in the cache and update replacement data.
- * Returns the access latency as a side effect.
- * @param pkt The memory request whose block to find
- * @param lat The access latency.
- * @return Pointer to the cache block if found.
- */
- SplitBlk* findBlock(PacketPtr &pkt, int &lat);
-
- /**
* Finds the given address in the cache, do not update replacement data.
* @param addr The address to find.
* @param asid The address space ID.
diff --git a/src/mem/cache/tags/split_lifo.cc b/src/mem/cache/tags/split_lifo.cc
index 302e2aaeb..792ff8fa7 100644
--- a/src/mem/cache/tags/split_lifo.cc
+++ b/src/mem/cache/tags/split_lifo.cc
@@ -254,31 +254,6 @@ SplitLIFO::findBlock(Addr addr, int &lat)
return blk;
}
-SplitBlk*
-SplitLIFO::findBlock(PacketPtr &pkt, int &lat)
-{
- Addr addr = pkt->getAddr();
-
- Addr tag = extractTag(addr);
- unsigned set = extractSet(addr);
- SplitBlk *blk = sets[set].findBlk(tag);
-
- if (blk) {
- DPRINTF(Split, "Found LIFO blk %#x in set %d, with tag %#x\n",
- addr, set, tag);
- hits++;
-
- if (twoQueue) {
- blk->isUsed = true;
- sets[set].moveToFirstIn(blk);
- } else {
- sets[set].moveToLastIn(blk);
- }
- }
- lat = hitLatency;
-
- return blk;
-}
SplitBlk*
SplitLIFO::findBlock(Addr addr) const
@@ -335,9 +310,8 @@ SplitLIFO::findReplacement(PacketPtr &pkt, PacketList &writebacks,
}
void
-SplitLIFO::invalidateBlk(Addr addr)
+SplitLIFO::invalidateBlk(SplitLIFO::BlkType *blk)
{
- SplitBlk *blk = findBlock(addr);
if (blk) {
blk->status = 0;
blk->isTouched = false;
diff --git a/src/mem/cache/tags/split_lifo.hh b/src/mem/cache/tags/split_lifo.hh
index 6c3befe37..9001cdb14 100644
--- a/src/mem/cache/tags/split_lifo.hh
+++ b/src/mem/cache/tags/split_lifo.hh
@@ -184,11 +184,10 @@ public:
bool probe( Addr addr) const;
/**
- * Invalidate the block containing the given address.
- * @param asid The address space ID.
- * @param addr The address to invalidate.
+ * Invalidate the given block.
+ * @param blk The block to invalidate.
*/
- void invalidateBlk(Addr addr);
+ void invalidateBlk(BlkType *blk);
/**
* Finds the given address in the cache and update replacement data.
@@ -201,15 +200,6 @@ public:
SplitBlk* findBlock(Addr addr, int &lat);
/**
- * Finds the given address in the cache and update replacement data.
- * Returns the access latency as a side effect.
- * @param pkt The req whose block to find
- * @param lat The access latency.
- * @return Pointer to the cache block if found.
- */
- SplitBlk* findBlock(PacketPtr &pkt, int &lat);
-
- /**
* Finds the given address in the cache, do not update replacement data.
* @param addr The address to find.
* @param asid The address space ID.
diff --git a/src/mem/cache/tags/split_lru.cc b/src/mem/cache/tags/split_lru.cc
index 11c9a5d64..c37d72cb7 100644
--- a/src/mem/cache/tags/split_lru.cc
+++ b/src/mem/cache/tags/split_lru.cc
@@ -202,27 +202,6 @@ SplitLRU::findBlock(Addr addr, int &lat)
return blk;
}
-SplitBlk*
-SplitLRU::findBlock(PacketPtr &pkt, int &lat)
-{
- Addr addr = pkt->getAddr();
-
- Addr tag = extractTag(addr);
- unsigned set = extractSet(addr);
- SplitBlk *blk = sets[set].findBlk(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) const
@@ -261,9 +240,8 @@ SplitLRU::findReplacement(PacketPtr &pkt, PacketList &writebacks,
}
void
-SplitLRU::invalidateBlk(Addr addr)
+SplitLRU::invalidateBlk(SplitLRU::BlkType *blk)
{
- SplitBlk *blk = findBlock(addr);
if (blk) {
blk->status = 0;
blk->isTouched = false;
diff --git a/src/mem/cache/tags/split_lru.hh b/src/mem/cache/tags/split_lru.hh
index 6160d59e5..e17a478d3 100644
--- a/src/mem/cache/tags/split_lru.hh
+++ b/src/mem/cache/tags/split_lru.hh
@@ -167,11 +167,10 @@ public:
bool probe(Addr addr) const;
/**
- * Invalidate the block containing the given address.
- * @param asid The address space ID.
- * @param addr The address to invalidate.
+ * Invalidate the given block.
+ * @param blk The block to invalidate.
*/
- void invalidateBlk(Addr addr);
+ void invalidateBlk(BlkType *blk);
/**
* Finds the given address in the cache and update replacement data.
@@ -184,15 +183,6 @@ public:
SplitBlk* findBlock(Addr addr, int &lat);
/**
- * Finds the given address in the cache and update replacement data.
- * Returns the access latency as a side effect.
- * @param pkt The req whose block to find.
- * @param lat The access latency.
- * @return Pointer to the cache block if found.
- */
- SplitBlk* findBlock(PacketPtr &pkt, int &lat);
-
- /**
* Finds the given address in the cache, do not update replacement data.
* @param addr The address to find.
* @param asid The address space ID.