trace: reimplement the DTRACE function so it doesn't use a vector
[gem5.git] / src / mem / cache / tags / iic.cc
index a8ef4e6fb2ea182912749ffe5f70e881e4537041..113ad8b4dff24b079fffd6e82b7c0a1aa07ceb1b 100644 (file)
  */
 
 #include <algorithm>
+#include <cmath>
 #include <string>
 #include <vector>
 
-#include <math.h>
-
-#include "mem/cache/base.hh"
-#include "mem/cache/tags/iic.hh"
 #include "base/intmath.hh"
-#include "sim/core.hh" // for curTick
-
-#include "base/trace.hh" // for DPRINTF
-
+#include "base/trace.hh"
+#include "debug/Cache.hh"
+#include "debug/IIC.hh"
+#include "debug/IICMore.hh"
+#include "mem/cache/tags/iic.hh"
+#include "mem/cache/base.hh"
+#include "sim/core.hh"
 
 using namespace std;
 
@@ -60,7 +60,6 @@ IIC::IIC(IIC::Params &params) :
     tagShift(floorLog2(blkSize)), blkMask(blkSize - 1),
     subShift(floorLog2(subSize)), subMask(numSub - 1),
     hashDelay(params.hashDelay),
-    numBlocks(params.size/subSize),
     numTags(hashSets * assoc + params.size/blkSize -1),
     numSecondary(params.size/blkSize),
     tagNull(numTags),
@@ -88,6 +87,7 @@ IIC::IIC(IIC::Params &params) :
 
     warmedUp = false;
     warmupBound = params.size/blkSize;
+    numBlocks = params.size/subSize;
 
     // Replacement Policy Initialization
     repl = params.rp;
@@ -260,8 +260,8 @@ IIC::accessBlock(Addr addr, int &lat, int context_src)
         hitDepthTotal += sets[set].depth;
         tag_ptr->status |= BlkReferenced;
         lat = set_lat;
-        if (tag_ptr->whenReady > curTick && tag_ptr->whenReady - curTick > set_lat) {
-            lat = tag_ptr->whenReady - curTick;
+        if (tag_ptr->whenReady > curTick() && tag_ptr->whenReady - curTick() > set_lat) {
+            lat = tag_ptr->whenReady - curTick();
         }
 
         tag_ptr->refCount += 1;
@@ -440,7 +440,7 @@ IIC::getFreeTag(int set, PacketList & writebacks)
     tagsInUse++;
     if (!warmedUp && tagsInUse.value() >= warmupBound) {
         warmedUp = true;
-        warmupCycle = curTick;
+        warmupCycle = curTick();
     }
 
     return tag_ptr;
@@ -631,6 +631,14 @@ IIC::invalidateBlk(IIC::BlkType *tag_ptr)
     }
 }
 
+void
+IIC::clearLocks()
+{
+    for (int i = 0; i < numTags; i++){
+        tagStore[i].clearLoadLocks();
+    }
+}
+
 void
 IIC::cleanupRefs()
 {