Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/38116 )
Change subject: mem-cache: Use PacketPtr in tags's accessBlock
......................................................................
mem-cache: Use PacketPtr in tags's accessBlock
Pass the packet to the tags, so that the replacement policies
more execution information.
Change-Id: I201884a6d60e3299fc3c9befebbb2e8b64a007f0
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/mem/cache/base.cc
M src/mem/cache/tags/base.hh
M src/mem/cache/tags/base_set_assoc.hh
M src/mem/cache/tags/fa_lru.cc
M src/mem/cache/tags/fa_lru.hh
M src/mem/cache/tags/sector_tags.cc
M src/mem/cache/tags/sector_tags.hh
7 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index 98467ab..6eb8920 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -1081,7 +1081,7 @@
// Access block in the tags
Cycles tag_latency(0);
- blk = tags->accessBlock(pkt->getAddr(), pkt->isSecure(), tag_latency);
+ blk = tags->accessBlock(pkt, tag_latency);
DPRINTF(Cache, "%s for %s %s\n", __func__, pkt->print(),
blk ? "hit " + blk->print() : "miss");
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh
index 5a407a6..2edf74d 100644
--- a/src/mem/cache/tags/base.hh
+++ b/src/mem/cache/tags/base.hh
@@ -285,12 +285,11 @@
* should only be used as such. Returns the tag lookup latency as a
side
* effect.
*
- * @param addr The address to find.
- * @param is_secure True if the target memory space is secure.
+ * @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @return Pointer to the cache block if found.
*/
- virtual CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat)
= 0;
+ virtual CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) = 0;
/**
* Generate the tag from the given address.
diff --git a/src/mem/cache/tags/base_set_assoc.hh
b/src/mem/cache/tags/base_set_assoc.hh
index b13b007..07e19a5 100644
--- a/src/mem/cache/tags/base_set_assoc.hh
+++ b/src/mem/cache/tags/base_set_assoc.hh
@@ -117,14 +117,13 @@
* should only be used as such. Returns the tag lookup latency as a
side
* effect.
*
- * @param addr The address to find.
- * @param is_secure True if the target memory space is secure.
+ * @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @return Pointer to the cache block if found.
*/
- CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override
+ CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override
{
- CacheBlk *blk = findBlock(addr, is_secure);
+ CacheBlk *blk = findBlock(pkt->getAddr(), pkt->isSecure());
// Access all tags in parallel, hence one in each way. The data
side
// either accesses all blocks in parallel, or one block
sequentially on
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index e61a280..6fbc485 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -127,17 +127,18 @@
}
CacheBlk*
-FALRU::accessBlock(Addr addr, bool is_secure, Cycles &lat)
+FALRU::accessBlock(const PacketPtr pkt, Cycles &lat)
{
- return accessBlock(addr, is_secure, lat, 0);
+ return accessBlock(pkt, lat, 0);
}
CacheBlk*
-FALRU::accessBlock(Addr addr, bool is_secure, Cycles &lat,
+FALRU::accessBlock(const PacketPtr pkt, Cycles &lat,
CachesMask *in_caches_mask)
{
CachesMask mask = 0;
- FALRUBlk* blk = static_cast<FALRUBlk*>(findBlock(addr, is_secure));
+ FALRUBlk* blk =
+ static_cast<FALRUBlk*>(findBlock(pkt->getAddr(), pkt->isSecure()));
// If a cache hit
if (blk && blk->isValid()) {
diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh
index 1d7e45a..550a44b 100644
--- a/src/mem/cache/tags/fa_lru.hh
+++ b/src/mem/cache/tags/fa_lru.hh
@@ -173,19 +173,18 @@
* cache access and should only be used as such.
* Returns tag lookup latency and the inCachesMask flags as a side
effect.
*
- * @param addr The address to look for.
- * @param is_secure True if the target memory space is secure.
+ * @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @param in_cache_mask Mask indicating the caches in which the blk
fits.
* @return Pointer to the cache block.
*/
- CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat,
+ CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat,
CachesMask *in_cache_mask);
/**
* Just a wrapper of above function to conform with the base interface.
*/
- CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override;
+ CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override;
/**
* Find the block in the cache, do not update the replacement data.
diff --git a/src/mem/cache/tags/sector_tags.cc
b/src/mem/cache/tags/sector_tags.cc
index ff2f4a4..f0229bf 100644
--- a/src/mem/cache/tags/sector_tags.cc
+++ b/src/mem/cache/tags/sector_tags.cc
@@ -136,9 +136,9 @@
}
CacheBlk*
-SectorTags::accessBlock(Addr addr, bool is_secure, Cycles &lat)
+SectorTags::accessBlock(const PacketPtr pkt, Cycles &lat)
{
- CacheBlk *blk = findBlock(addr, is_secure);
+ CacheBlk *blk = findBlock(pkt->getAddr(), pkt->isSecure());
// Access all tags in parallel, hence one in each way. The data side
// either accesses all blocks in parallel, or one block sequentially on
diff --git a/src/mem/cache/tags/sector_tags.hh
b/src/mem/cache/tags/sector_tags.hh
index 5c228ee..87594ec 100644
--- a/src/mem/cache/tags/sector_tags.hh
+++ b/src/mem/cache/tags/sector_tags.hh
@@ -134,12 +134,11 @@
* access and should only be used as such. Returns the tag lookup
latency
* as a side effect.
*
- * @param addr The address to find.
- * @param is_secure True if the target memory space is secure.
+ * @param pkt The packet holding the address to find.
* @param lat The latency of the tag lookup.
* @return Pointer to the cache block if found.
*/
- CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat) override;
+ CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override;
/**
* Insert the new block into the cache and update replacement data.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38116
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I201884a6d60e3299fc3c9befebbb2e8b64a007f0
Gerrit-Change-Number: 38116
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s