mem-cache: Fix non-bijective function in Skewed caches
[gem5.git] / src / mem / cache / blk.cc
index d4a2eaee8c08002064bf52a2330585fc87dc5621..45bd9bfd43a2869d8efdc9874579b797c9c72879 100644 (file)
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2012-2013 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 2007 The Regents of The University of Michigan
  * All rights reserved.
  *
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "mem/cache/blk.hh"
+
 #include "base/cprintf.hh"
-#include "mem/cache/cache_blk.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
 {
-    ccprintf(os, "%sblk %c%c%c\n", prefix,
+    ccprintf(os, "%sblk %c%c%c%c\n", prefix,
              blk->isValid()    ? 'V' : '-',
              blk->isWritable() ? 'E' : '-',
-             blk->isDirty()    ? 'M' : '-');
+             blk->isDirty()    ? 'M' : '-',
+             blk->isSecure()   ? 'S' : '-');
 }