summaryrefslogtreecommitdiff
path: root/src/mem/cache/replacement_policies/base.hh
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-10-11 15:02:54 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-10-11 13:24:53 +0000
commita120af889b3fdf38eeb528002f6b40af159cb6a9 (patch)
treeb00610dfc305cd8be8a59f48e1b2d6027ea6f157 /src/mem/cache/replacement_policies/base.hh
parent7ed25a91c2ead4ada3554e52525aa72044f16237 (diff)
downloadgem5-a120af889b3fdf38eeb528002f6b40af159cb6a9.tar.xz
mem-cache: Factor ReplaceableEntry out
ReplaceableEntry is referenced by many classes that do not necessarily need access to the replacement policies. Therefore, in order to allow better compilation units, we factor it out to a new file. Change-Id: I0823567bf1ca336ffcdf783682ef473e8878d7fd Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/13418 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache/replacement_policies/base.hh')
-rw-r--r--src/mem/cache/replacement_policies/base.hh59
1 files changed, 1 insertions, 58 deletions
diff --git a/src/mem/cache/replacement_policies/base.hh b/src/mem/cache/replacement_policies/base.hh
index 6ac7dca85..6cb8c9de4 100644
--- a/src/mem/cache/replacement_policies/base.hh
+++ b/src/mem/cache/replacement_policies/base.hh
@@ -33,68 +33,11 @@
#include <memory>
+#include "mem/cache/replacement_policies/replaceable_entry.hh"
#include "params/BaseReplacementPolicy.hh"
#include "sim/sim_object.hh"
/**
- * The replacement data needed by the replacement policy.
- * Each replacement policy should have its own replacement data.
- */
-struct ReplacementData {};
-
-/**
- * A replaceable entry is used by any table-like structure that needs to
- * implement replacement functionality. It provides the replacement data
- * pointer instantiated and needed by the replacement policy used.
- * @sa Replacement Policies
- */
-class ReplaceableEntry
-{
- private:
- /**
- * Set to which this entry belongs.
- */
- uint32_t _set;
-
- /**
- * Way (relative position within the set) to which this entry belongs.
- */
- uint32_t _way;
-
- public:
- /**
- * Replacement data associated to this entry.
- * It is instantiated by the replacement policy.
- */
- std::shared_ptr<ReplacementData> replacementData;
-
- /**
- * Set both the set and way. Should be called only once.
- *
- * @param set The set of this entry.
- * @param way The way of this entry.
- */
- void setPosition(const uint32_t set, const uint32_t way) {
- _set = set;
- _way = way;
- }
-
- /**
- * Get set number.
- *
- * @return The set to which this entry belongs.
- */
- uint32_t getSet() const { return _set; }
-
- /**
- * Get way number.
- *
- * @return The way to which this entry belongs.
- */
- uint32_t getWay() const { return _way; }
-};
-
-/**
* Replacement candidates as chosen by the indexing policy.
*/
typedef std::vector<ReplaceableEntry*> ReplacementCandidates;