summaryrefslogtreecommitdiff
path: root/src/mem/cache/blk.hh
diff options
context:
space:
mode:
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