summaryrefslogtreecommitdiff
path: root/src/mem/cache/blk.hh
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-04-16 15:36:33 +0200
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-06-01 11:21:46 +0000
commit7704113d94f2e574afeb079e0cc5b98fc6bed33b (patch)
tree62f52772add95114e3a68f9eee39d0648439bca8 /src/mem/cache/blk.hh
parent888bdb67e181710283372ae1a74698e216ee3ac2 (diff)
downloadgem5-7704113d94f2e574afeb079e0cc5b98fc6bed33b.tar.xz
mem-cache: Create an address aware TempCacheBlk
tempBlock has its member variables manually set in order to allow it to be used in the block address regeneration function. This is not necessary, and ti can be simply given the address, so it does not need to be aware of set and tag. This will simplify implementation of sector and skewed caches. Change-Id: Iaffb10c323509722cd5589fe1030b818d43336d6 Reviewed-on: https://gem5-review.googlesource.com/9961 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache/blk.hh')
-rw-r--r--src/mem/cache/blk.hh63
1 files changed, 61 insertions, 2 deletions
diff --git a/src/mem/cache/blk.hh b/src/mem/cache/blk.hh
index c94c3ba7d..c4ec12ff3 100644
--- a/src/mem/cache/blk.hh
+++ b/src/mem/cache/blk.hh
@@ -166,7 +166,6 @@ class CacheBlk : public ReplaceableEntry
std::list<Lock> lockList;
public:
-
CacheBlk()
{
invalidate();
@@ -261,7 +260,7 @@ class CacheBlk : public ReplaceableEntry
* @param src_master_ID The source requestor ID.
* @param task_ID The new task ID.
*/
- void insert(const Addr tag, const State is_secure, const int src_master_ID,
+ void insert(const Addr tag, const bool is_secure, const int src_master_ID,
const uint32_t task_ID);
/**
@@ -394,6 +393,66 @@ class CacheBlk : public ReplaceableEntry
};
/**
+ * Special instance of CacheBlk for use with tempBlk that deals with its
+ * block address regeneration.
+ * @sa Cache
+ */
+class TempCacheBlk final : public CacheBlk
+{
+ private:
+ /**
+ * Copy of the block's address, used to regenerate tempBlock's address.
+ */
+ Addr _addr;
+
+ public:
+ TempCacheBlk() : CacheBlk() {}
+ TempCacheBlk(const TempCacheBlk&) = delete;
+ TempCacheBlk& operator=(const TempCacheBlk&) = delete;
+ ~TempCacheBlk() {};
+
+ /**
+ * Invalidate the block and clear all state.
+ */
+ void invalidate() override {
+ CacheBlk::invalidate();
+
+ _addr = MaxAddr;
+ }
+
+ /**
+ * Set member variables when a block insertion occurs. A TempCacheBlk does
+ * not have all the information required to regenerate the block's address,
+ * so it is provided the address itself for easy regeneration.
+ *
+ * @param addr Block address.
+ * @param is_secure Whether the block is in secure space or not.
+ */
+ void insert(const Addr addr, const bool is_secure)
+ {
+ // Set block address
+ _addr = addr;
+
+ // Set secure state
+ if (is_secure) {
+ status = BlkSecure;
+ } else {
+ status = 0;
+ }
+ }
+
+ /**
+ * Get block's address.
+ *
+ * @return addr Address value.
+ */
+ Addr getAddr() const
+ {
+ return _addr;
+ }
+};
+
+/**
* Simple class to provide virtual print() method on cache blocks
* without allocating a vtable pointer for every single cache block.
* Just wrap the CacheBlk object in an instance of this before passing