mem-cache: Add a masked const value pattern to compressors
[gem5.git] / src / mem / cache / cache_blk.cc
index d4a2eaee8c08002064bf52a2330585fc87dc5621..c4730caebc718d29714e9b76729dbf559743c474 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 "base/cprintf.hh"
 #include "mem/cache/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)
+{
+    // Make sure that the block has been properly invalidated
+    assert(status == 0);
+
+    // 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) {
+        setSecure();
+    }
+
+    // Validate block
+    setValid();
+}
+
 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' : '-');
 }