summaryrefslogtreecommitdiff
path: root/src/mem/cache/cache_blk.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/cache/cache_blk.hh')
-rw-r--r--src/mem/cache/cache_blk.hh29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh
index 80983a637..d7530d656 100644
--- a/src/mem/cache/cache_blk.hh
+++ b/src/mem/cache/cache_blk.hh
@@ -244,10 +244,27 @@ class CacheBlk : public ReplaceableEntry
}
/**
+ * Set valid bit.
+ */
+ virtual void setValid()
+ {
+ assert(!isValid());
+ status |= BlkValid;
+ }
+
+ /**
+ * Set secure bit.
+ */
+ virtual void setSecure()
+ {
+ status |= BlkSecure;
+ }
+
+ /**
* Set member variables when a block insertion occurs. Resets reference
* count to 1 (the insertion counts as a reference), and touch block if
* it hadn't been touched previously. Sets the insertion tick to the
- * current tick. Does not make block valid.
+ * current tick. Marks the block valid.
*
* @param tag Block address tag.
* @param is_secure Whether the block is in secure space or not.
@@ -425,15 +442,19 @@ class TempCacheBlk final : public CacheBlk
void insert(const Addr addr, const bool is_secure,
const int src_master_ID=0, const uint32_t task_ID=0) override
{
+ // Make sure that the block has been properly invalidated
+ assert(status == 0);
+
// Set block address
_addr = addr;
// Set secure state
if (is_secure) {
- status = BlkSecure;
- } else {
- status = 0;
+ setSecure();
}
+
+ // Validate block
+ setValid();
}
/**