mem-cache: Use findBlock() in accessBlock()
[gem5.git] / src / mem / cache / tags / base.cc
index 2ec1379b00a0e7ec01d8c73ff8c94ad9bc1fff65..8b52b746eaa2809080b0acba1331219a8acd15fd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 ARM Limited
+ * Copyright (c) 2013,2016 ARM Limited
  * All rights reserved.
  *
  * The license below extends only to copyright in the software and shall
  * Definitions of BaseTags.
  */
 
-#include "config/the_isa.hh"
-#include "cpu/smt.hh" //maxThreadsPerCPU
 #include "mem/cache/tags/base.hh"
+
+#include "cpu/smt.hh" //maxThreadsPerCPU
 #include "mem/cache/base.hh"
 #include "sim/sim_exit.hh"
 
 using namespace std;
 
 BaseTags::BaseTags(const Params *p)
-    : ClockedObject(p), blkSize(p->block_size), size(p->size),
-      hitLatency(p->hit_latency), cache(nullptr), warmupBound(0),
-      warmedUp(false), numBlocks(0)
+    : ClockedObject(p), blkSize(p->block_size), blkMask(blkSize - 1),
+      size(p->size),
+      lookupLatency(p->tag_latency),
+      accessLatency(p->sequential_access ?
+                    p->tag_latency + p->data_latency :
+                    std::max(p->tag_latency, p->data_latency)),
+      cache(nullptr),
+      warmupBound((p->warmup_percentage/100.0) * (p->size / p->block_size)),
+      warmedUp(false), numBlocks(p->size / p->block_size)
 {
 }
 
@@ -71,7 +77,10 @@ BaseTags::setCache(BaseCache *_cache)
 void
 BaseTags::regStats()
 {
+    ClockedObject::regStats();
+
     using namespace Stats;
+
     replacements
         .init(maxThreadsPerCPU)
         .name(name() + ".replacements")