mem-cache: Fix non-bijective function in Skewed caches
[gem5.git] / src / mem / cache / blk.cc
index 210304dbf00b158db26cfafb4dbf5674a79be38c..45bd9bfd43a2869d8efdc9874579b797c9c72879 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "base/cprintf.hh"
 #include "mem/cache/blk.hh"
 
+#include "base/cprintf.hh"
+
+void
+CacheBlk::insert(const Addr tag, const bool is_secure,
+                 const int src_master_ID, const uint32_t task_ID)
+{
+    // Set block tag
+    this->tag = tag;
+
+    // Set source requestor ID
+    srcMasterId = src_master_ID;
+
+    // Set task ID
+    task_id = task_ID;
+
+    // Set insertion tick as current tick
+    tickInserted = curTick();
+
+    // Insertion counts as a reference to the block
+    refCount = 1;
+
+    // Set secure state
+    if (is_secure) {
+        status = BlkSecure;
+    } else {
+        status = 0;
+    }
+}
+
 void
 CacheBlkPrintWrapper::print(std::ostream &os, int verbosity,
                             const std::string &prefix) const