Daniel Carvalho has submitted this change and it was merged. (
https://gem5-review.googlesource.com/10141 )
Change subject: mem-cache: Use ReplaceableEntry in findBlockBySetAndWay
......................................................................
mem-cache: Use ReplaceableEntry in findBlockBySetAndWay
With a sector cache you can't find a block using only its set
and way, as there is the sector offset to take into account. As
all of these blocks inherit from ReplaceableEntry, the return
type of this function has been updated.
This function has also been declared closer to findBlock() due
to their similar functionality.
Change-Id: I4730a2b4ebb5738f7fc118201e208a1b9c3ba8e8
Reviewed-on: https://gem5-review.googlesource.com/10141
Reviewed-by: Nikos Nikoleris <[email protected]>
Maintainer: Nikos Nikoleris <[email protected]>
---
M src/mem/cache/tags/base.hh
M src/mem/cache/tags/base_set_assoc.cc
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
5 files changed, 29 insertions(+), 26 deletions(-)
Approvals:
Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh
index 358ad10..167364f 100644
--- a/src/mem/cache/tags/base.hh
+++ b/src/mem/cache/tags/base.hh
@@ -196,6 +196,15 @@
virtual CacheBlk * findBlock(Addr addr, bool is_secure) const = 0;
/**
+ * Find a block given set and way.
+ *
+ * @param set The set of the block.
+ * @param way The way of the block.
+ * @return The block.
+ */
+ virtual ReplaceableEntry* findBlockBySetAndWay(int set, int way) const
= 0;
+
+ /**
* Align an address to the block size.
* @param addr the address to align.
* @return The block address.
@@ -216,14 +225,6 @@
}
/**
- * Find the cache block given set and way
- * @param set The set of the block.
- * @param way The way of the block.
- * @return The cache block.
- */
- virtual CacheBlk *findBlockBySetAndWay(int set, int way) const = 0;
-
- /**
* Limit the allocation for the cache ways.
* @param ways The maximum number of ways available for replacement.
*/
diff --git a/src/mem/cache/tags/base_set_assoc.cc
b/src/mem/cache/tags/base_set_assoc.cc
index 9cd93db..ae98dcf 100644
--- a/src/mem/cache/tags/base_set_assoc.cc
+++ b/src/mem/cache/tags/base_set_assoc.cc
@@ -126,7 +126,7 @@
return blk;
}
-CacheBlk*
+ReplaceableEntry*
BaseSetAssoc::findBlockBySetAndWay(int set, int way) const
{
return sets[set].blks[way];
diff --git a/src/mem/cache/tags/base_set_assoc.hh
b/src/mem/cache/tags/base_set_assoc.hh
index 830af6f..4755662 100644
--- a/src/mem/cache/tags/base_set_assoc.hh
+++ b/src/mem/cache/tags/base_set_assoc.hh
@@ -130,14 +130,6 @@
void invalidate(CacheBlk *blk) override;
/**
- * Find the cache block given set and way
- * @param set The set of the block.
- * @param way The way of the block.
- * @return The cache block.
- */
- CacheBlk *findBlockBySetAndWay(int set, int way) const override;
-
- /**
* Access block and update replacement data. May not succeed, in which
case
* nullptr is returned. This has all the implications of a cache
* access and should only be used as such. Returns the access latency
as a
@@ -199,6 +191,15 @@
CacheBlk* findBlock(Addr addr, bool is_secure) const override;
/**
+ * Find a block given set and way.
+ *
+ * @param set The set of the block.
+ * @param way The way of the block.
+ * @return The block.
+ */
+ ReplaceableEntry* findBlockBySetAndWay(int set, int way) const
override;
+
+ /**
* Find replacement victim based on address.
*
* @param addr Address to find a victim for.
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index 29dab3b..a6e1b3b 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -185,7 +185,7 @@
return blk;
}
-CacheBlk*
+ReplaceableEntry*
FALRU::findBlockBySetAndWay(int set, int way) const
{
assert(set == 0);
diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh
index dbb39b7..22b67c5 100644
--- a/src/mem/cache/tags/fa_lru.hh
+++ b/src/mem/cache/tags/fa_lru.hh
@@ -186,6 +186,15 @@
CacheBlk* findBlock(Addr addr, bool is_secure) const override;
/**
+ * Find a block given set and way.
+ *
+ * @param set The set of the block.
+ * @param way The way of the block.
+ * @return The block.
+ */
+ ReplaceableEntry* findBlockBySetAndWay(int set, int way) const
override;
+
+ /**
* Find replacement victim based on address.
*
* @param addr Address to find a victim for.
@@ -202,14 +211,6 @@
void insertBlock(PacketPtr pkt, CacheBlk *blk) override;
/**
- * Find the cache block given set and way
- * @param set The set of the block.
- * @param way The way of the block.
- * @return The cache block.
- */
- CacheBlk* findBlockBySetAndWay(int set, int way) const override;
-
- /**
* Generate the tag from the addres. For fully associative this is
just the
* block address.
* @param addr The address to get the tag from.
--
To view, visit https://gem5-review.googlesource.com/10141
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I4730a2b4ebb5738f7fc118201e208a1b9c3ba8e8
Gerrit-Change-Number: 10141
Gerrit-PatchSet: 9
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev