No need to template prefetcher on cache TagStore type.
authorSteve Reinhardt <stever@eecs.umich.edu>
Tue, 19 Dec 2006 05:53:06 +0000 (21:53 -0800)
committerSteve Reinhardt <stever@eecs.umich.edu>
Tue, 19 Dec 2006 05:53:06 +0000 (21:53 -0800)
--HG--
rename : src/mem/cache/prefetch/tagged_prefetcher_impl.hh => src/mem/cache/prefetch/tagged_prefetcher.cc
extra : convert_revision : 56c0b51e424a3a6590332dba4866e69a1ad19598

14 files changed:
src/SConscript
src/mem/cache/base_cache.hh
src/mem/cache/cache.hh
src/mem/cache/cache_builder.cc
src/mem/cache/cache_impl.hh
src/mem/cache/prefetch/base_prefetcher.cc
src/mem/cache/prefetch/base_prefetcher.hh
src/mem/cache/prefetch/ghb_prefetcher.cc
src/mem/cache/prefetch/ghb_prefetcher.hh
src/mem/cache/prefetch/stride_prefetcher.cc
src/mem/cache/prefetch/stride_prefetcher.hh
src/mem/cache/prefetch/tagged_prefetcher.cc [new file with mode: 0644]
src/mem/cache/prefetch/tagged_prefetcher.hh
src/mem/cache/prefetch/tagged_prefetcher_impl.hh [deleted file]

index 3149f0e59e3d54d87c835d380628aa5f57f67661..178f5b345d8651641303e24a419ebac1b59a712e 100644 (file)
@@ -114,7 +114,6 @@ base_sources = Split('''
         mem/cache/miss/mshr_queue.cc
         mem/cache/prefetch/base_prefetcher.cc
         mem/cache/prefetch/ghb_prefetcher.cc
-        mem/cache/prefetch/prefetcher.cc
         mem/cache/prefetch/stride_prefetcher.cc
         mem/cache/prefetch/tagged_prefetcher.cc
         mem/cache/tags/base_tags.cc
index a7f035dced9c0814bc6fbe8a06d0b3d7189904e2..c10d98e8ebf912c915325018d17fb99dba337e92 100644 (file)
@@ -692,6 +692,10 @@ class BaseCache : public MemObject
         }
         return true;
     }
+
+    virtual bool inCache(Addr addr) = 0;
+
+    virtual bool inMissQueue(Addr addr) = 0;
 };
 
 #endif //__BASE_CACHE_HH__
index bd88849deb77852d51ee6f80d233342b82c1f1e5..ba424d12874054dff9de31db51c8723243bbffbf 100644 (file)
 #include "mem/cache/base_cache.hh"
 #include "mem/cache/cache_blk.hh"
 #include "mem/cache/miss/miss_buffer.hh"
-#include "mem/cache/prefetch/prefetcher.hh"
 
 //Forward decleration
 class MSHR;
-
+class BasePrefetcher;
 
 /**
  * A template-policy based cache. The behavior of the cache can be altered by
@@ -119,7 +118,7 @@ class Cache : public BaseCache
     Coherence *coherence;
 
     /** Prefetcher */
-    Prefetcher<TagStore> *prefetcher;
+    BasePrefetcher *prefetcher;
 
     /**
      * The clock ratio of the outgoing bus.
@@ -304,7 +303,7 @@ class Cache : public BaseCache
         MissBuffer *missQueue;
         Coherence *coherence;
         BaseCache::Params baseParams;
-        Prefetcher<TagStore> *prefetcher;
+        BasePrefetcher*prefetcher;
         bool prefetchAccess;
         int hitLatency;
         CompressionAlgorithm *compressionAlg;
@@ -319,7 +318,7 @@ class Cache : public BaseCache
 
         Params(TagStore *_tags, MissBuffer *mq, Coherence *coh,
                BaseCache::Params params,
-               Prefetcher<TagStore> *_prefetcher,
+               BasePrefetcher *_prefetcher,
                bool prefetch_access, int hit_latency,
                bool do_fast_writes,
                bool store_compressed, bool adaptive_compression,
@@ -450,6 +449,14 @@ class Cache : public BaseCache
      * @return The estimated completion time.
      */
     Tick snoopProbe(PacketPtr &pkt);
+
+    bool inCache(Addr addr) {
+        return (tags->findBlock(addr) != 0);
+    }
+
+    bool inMissQueue(Addr addr) {
+        return (missQueue->findMSHR(addr) != 0);
+    }
 };
 
 #endif // __CACHE_HH__
index e212650f2fab951a25cd82133f538d715931cde5..318b57d5021f99023d62b423e4c5eb0b04d4d3c6 100644 (file)
@@ -197,7 +197,7 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache)
 
 #define BUILD_CACHE(TAGS, tags, c)                                      \
     do {                                                                \
-        Prefetcher<TAGS> *pf;                                           \
+        BasePrefetcher *pf;                                           \
         if (pf_policy == "tagged") {                                    \
             BUILD_TAGGED_PREFETCHER(TAGS);                              \
         }                                                               \
@@ -314,55 +314,55 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache)
     } while (0)
 
 #if defined(USE_TAGGED)
-#define BUILD_TAGGED_PREFETCHER(t) pf = new   \
-                TaggedPrefetcher<t >(prefetcher_size, \
-                                                        !prefetch_past_page, \
-                                                        prefetch_serial_squash, \
-                                                        prefetch_cache_check_push, \
-                                                        prefetch_data_accesses_only, \
-                                                        prefetch_latency, \
-                                                        prefetch_degree)
+#define BUILD_TAGGED_PREFETCHER(t)                              \
+    pf = new TaggedPrefetcher(prefetcher_size,                  \
+                              !prefetch_past_page,              \
+                              prefetch_serial_squash,           \
+                              prefetch_cache_check_push,        \
+                              prefetch_data_accesses_only,      \
+                              prefetch_latency,                 \
+                              prefetch_degree)
 #else
 #define BUILD_TAGGED_PREFETCHER(t) BUILD_CACHE_PANIC("Tagged Prefetcher")
 #endif
 
 #if defined(USE_STRIDED)
-#define BUILD_STRIDED_PREFETCHER(t) pf = new  \
-                StridePrefetcher<t >(prefetcher_size, \
-                                                        !prefetch_past_page, \
-                                                        prefetch_serial_squash, \
-                                                        prefetch_cache_check_push, \
-                                                        prefetch_data_accesses_only, \
-                                                        prefetch_latency, \
-                                                        prefetch_degree, \
-                                                        prefetch_use_cpu_id)
+#define BUILD_STRIDED_PREFETCHER(t)                             \
+    pf = new StridePrefetcher(prefetcher_size,                  \
+                              !prefetch_past_page,              \
+                              prefetch_serial_squash,           \
+                              prefetch_cache_check_push,        \
+                              prefetch_data_accesses_only,      \
+                              prefetch_latency,                 \
+                              prefetch_degree,                  \
+                              prefetch_use_cpu_id)
 #else
 #define BUILD_STRIDED_PREFETCHER(t) BUILD_CACHE_PANIC("Stride Prefetcher")
 #endif
 
 #if defined(USE_GHB)
-#define BUILD_GHB_PREFETCHER(t) pf = new  \
-                GHBPrefetcher<t >(prefetcher_size, \
-                                                     !prefetch_past_page, \
-                                                     prefetch_serial_squash, \
-                                                     prefetch_cache_check_push, \
-                                                        prefetch_data_accesses_only, \
-                                                     prefetch_latency, \
-                                                     prefetch_degree, \
-                                                     prefetch_use_cpu_id)
+#define BUILD_GHB_PREFETCHER(t)                         \
+    pf = new GHBPrefetcher(prefetcher_size,             \
+                           !prefetch_past_page,         \
+                           prefetch_serial_squash,      \
+                           prefetch_cache_check_push,   \
+                           prefetch_data_accesses_only, \
+                           prefetch_latency,            \
+                           prefetch_degree,             \
+                           prefetch_use_cpu_id)
 #else
 #define BUILD_GHB_PREFETCHER(t) BUILD_CACHE_PANIC("GHB Prefetcher")
 #endif
 
 #if defined(USE_TAGGED)
-#define BUILD_NULL_PREFETCHER(t) pf = new  \
-                TaggedPrefetcher<t >(prefetcher_size, \
-                                                        !prefetch_past_page, \
-                                                        prefetch_serial_squash, \
-                                                        prefetch_cache_check_push, \
-                                                        prefetch_data_accesses_only, \
-                                                        prefetch_latency, \
-                                                        prefetch_degree)
+#define BUILD_NULL_PREFETCHER(t)                                \
+    pf = new TaggedPrefetcher(prefetcher_size,                  \
+                              !prefetch_past_page,              \
+                              prefetch_serial_squash,           \
+                              prefetch_cache_check_push,        \
+                              prefetch_data_accesses_only,      \
+                              prefetch_latency,                 \
+                              prefetch_degree)
 #else
 #define BUILD_NULL_PREFETCHER(t) BUILD_CACHE_PANIC("NULL Prefetcher (uses Tagged)")
 #endif
index 1d78b03c749bba0a81deb1287ae13e94d260d603..2333e4a0e8bd57e2485f1788282f5fe6dd17f788 100644 (file)
@@ -49,7 +49,7 @@
 #include "mem/cache/cache.hh"
 #include "mem/cache/cache_blk.hh"
 #include "mem/cache/miss/mshr.hh"
-#include "mem/cache/prefetch/prefetcher.hh"
+#include "mem/cache/prefetch/base_prefetcher.hh"
 
 #include "sim/sim_exit.hh" // for SimExitEvent
 
@@ -88,8 +88,6 @@ Cache(const std::string &_name,
     missQueue->setPrefetcher(prefetcher);
     coherence->setCache(this);
     prefetcher->setCache(this);
-    prefetcher->setTags(tags);
-    prefetcher->setBuffer(missQueue);
     invalidateReq = new Request((Addr) NULL, blkSize, 0);
     invalidatePkt = new Packet(invalidateReq, Packet::InvalidateReq, 0);
 }
index a1388fad6660cc75eb9d85ab40101c59e0c143c7..4254800b1aad14659e28db580616665254ce9e40 100644 (file)
@@ -102,6 +102,26 @@ BasePrefetcher::regStats(const std::string &name)
         ;
 }
 
+inline bool
+BasePrefetcher::inCache(Addr addr)
+{
+    if (cache->inCache(addr)) {
+        pfCacheHit++;
+        return true;
+    }
+    return false;
+}
+
+inline bool
+BasePrefetcher::inMissQueue(Addr addr)
+{
+    if (cache->inMissQueue(addr)) {
+        pfMSHRHit++;
+        return true;
+    }
+    return false;
+}
+
 PacketPtr
 BasePrefetcher::getPacket()
 {
@@ -118,7 +138,7 @@ BasePrefetcher::getPacket()
         pkt = *pf.begin();
         pf.pop_front();
         if (!cacheCheckPush) {
-            keepTrying = inCache(pkt);
+            keepTrying = cache->inCache(pkt->getAddr());
         }
         if (pf.empty()) {
             cache->clearMasterRequest(Request_PF);
@@ -190,7 +210,7 @@ BasePrefetcher::handleMiss(PacketPtr &pkt, Tick time)
 
             //Check if it is already in the cache
             if (cacheCheckPush) {
-                if (inCache(prefetch)) {
+                if (cache->inCache(prefetch->getAddr())) {
                     addr++;
                     delay++;
                     continue;
@@ -198,7 +218,7 @@ BasePrefetcher::handleMiss(PacketPtr &pkt, Tick time)
             }
 
             //Check if it is already in the miss_queue
-            if (inMissQueue(prefetch->getAddr())) {
+            if (cache->inMissQueue(prefetch->getAddr())) {
                 addr++;
                 delay++;
                 continue;
index 781d3ab09447a3c10eb2089764d1c7769be6317f..2780f5e5aaf7c83dc995224105b55cca5d7d1abd 100644 (file)
 #ifndef __MEM_CACHE_PREFETCH_BASE_PREFETCHER_HH__
 #define __MEM_CACHE_PREFETCH_BASE_PREFETCHER_HH__
 
-#include "mem/packet.hh"
 #include <list>
 
+#include "base/statistics.hh"
+#include "mem/packet.hh"
+
 class BaseCache;
+
 class BasePrefetcher
 {
   protected:
@@ -95,6 +98,10 @@ class BasePrefetcher
 
     void handleMiss(PacketPtr &pkt, Tick time);
 
+    bool inCache(Addr addr);
+
+    bool inMissQueue(Addr addr);
+
     PacketPtr getPacket();
 
     bool havePending()
@@ -106,10 +113,6 @@ class BasePrefetcher
                                    std::list<Addr> &addresses,
                                    std::list<Tick> &delays) = 0;
 
-    virtual bool inCache(PacketPtr &pkt) = 0;
-
-    virtual bool inMissQueue(Addr address) = 0;
-
     std::list<PacketPtr>::iterator inPrefetch(Addr address);
 };
 
index 7d537641eb8eb4034ccaf05bcbc19cbbdae680d1..d7d819a2d3eb97cafe73a09744bbc4a35df05b4d 100644 (file)
 
 /**
  * @file
- * GHB Prefetcher template instantiations.
+ * GHB Prefetcher implementation.
  */
 
-#include "mem/cache/tags/lru.hh"
-
 #include "mem/cache/prefetch/ghb_prefetcher.hh"
+#include "arch/isa_traits.hh"
+
+void
+GHBPrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
+                                 std::list<Tick> &delays)
+{
+    Addr blkAddr = pkt->getAddr() & ~(Addr)(this->blkSize-1);
+    int cpuID = pkt->req->getCpuNum();
+    if (!useCPUId) cpuID = 0;
+
 
-// Template Instantiations
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
+    int new_stride = blkAddr - last_miss_addr[cpuID];
+    int old_stride = last_miss_addr[cpuID] -
+        second_last_miss_addr[cpuID];
 
-template class GHBPrefetcher<LRU >;
+    second_last_miss_addr[cpuID] = last_miss_addr[cpuID];
+    last_miss_addr[cpuID] = blkAddr;
 
-#endif //DOXYGEN_SHOULD_SKIP_THIS
+    if (new_stride == old_stride) {
+        for (int d=1; d <= degree; d++) {
+            Addr newAddr = blkAddr + d * new_stride;
+            if (this->pageStop &&
+                (blkAddr & ~(TheISA::VMPageSize - 1)) !=
+                (newAddr & ~(TheISA::VMPageSize - 1)))
+            {
+                //Spanned the page, so now stop
+                this->pfSpanPage += degree - d + 1;
+                return;
+            }
+            else
+            {
+                addresses.push_back(newAddr);
+                delays.push_back(latency);
+            }
+        }
+    }
+}
index c558a3e64d6cee48fbd831fe472269b2c39bc057..f31b56dcf5901249661743fc3f1ff0f0afb5ed3e 100644 (file)
 
 /**
  * @file
- * Describes a ghb prefetcher based on template policies.
+ * Describes a ghb prefetcher.
  */
 
 #ifndef __MEM_CACHE_PREFETCH_GHB_PREFETCHER_HH__
 #define __MEM_CACHE_PREFETCH_GHB_PREFETCHER_HH__
 
-#include "base/misc.hh" // fatal, panic, and warn
+#include "mem/cache/prefetch/base_prefetcher.hh"
 
-#include "mem/cache/prefetch/prefetcher.hh"
-
-/**
- * A template-policy based cache. The behavior of the cache can be altered by
- * supplying different template policies. TagStore handles all tag and data
- * storage @sa TagStore. MissBuffer handles all misses and writes/writebacks
- * @sa MissQueue. Coherence handles all coherence policy details @sa
- * UniCoherence, SimpleMultiCoherence.
- */
-template <class TagStore>
-class GHBPrefetcher : public Prefetcher<TagStore>
+class GHBPrefetcher : public BasePrefetcher
 {
   protected:
 
-    MissBuffer* mq;
-    TagStore* tags;
-
     Addr second_last_miss_addr[64/*MAX_CPUS*/];
     Addr last_miss_addr[64/*MAX_CPUS*/];
 
@@ -67,48 +54,16 @@ class GHBPrefetcher : public Prefetcher<TagStore>
     GHBPrefetcher(int size, bool pageStop, bool serialSquash,
                   bool cacheCheckPush, bool onlyData,
                   Tick latency, int degree, bool useCPUId)
-        :Prefetcher<TagStore>(size, pageStop, serialSquash,
-                                         cacheCheckPush, onlyData),
-         latency(latency), degree(degree), useCPUId(useCPUId)
+        : BasePrefetcher(size, pageStop, serialSquash,
+                         cacheCheckPush, onlyData),
+          latency(latency), degree(degree), useCPUId(useCPUId)
     {
     }
 
     ~GHBPrefetcher() {}
 
     void calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
-                           std::list<Tick> &delays)
-    {
-        Addr blkAddr = pkt->getAddr() & ~(Addr)(this->blkSize-1);
-        int cpuID = pkt->req->getCpuNum();
-        if (!useCPUId) cpuID = 0;
-
-
-        int new_stride = blkAddr - last_miss_addr[cpuID];
-        int old_stride = last_miss_addr[cpuID] -
-                         second_last_miss_addr[cpuID];
-
-        second_last_miss_addr[cpuID] = last_miss_addr[cpuID];
-        last_miss_addr[cpuID] = blkAddr;
-
-        if (new_stride == old_stride) {
-            for (int d=1; d <= degree; d++) {
-                Addr newAddr = blkAddr + d * new_stride;
-                if (this->pageStop &&
-                    (blkAddr & ~(TheISA::VMPageSize - 1)) !=
-                    (newAddr & ~(TheISA::VMPageSize - 1)))
-                {
-                    //Spanned the page, so now stop
-                    this->pfSpanPage += degree - d + 1;
-                    return;
-                }
-                else
-                {
-                    addresses.push_back(newAddr);
-                    delays.push_back(latency);
-                }
-            }
-        }
-    }
+                           std::list<Tick> &delays);
 };
 
 #endif // __MEM_CACHE_PREFETCH_GHB_PREFETCHER_HH__
index 847f2979ea5ac1bdc17b986ec40ba5897774936b..8d957182a0d99b6de1d7385229c6b9d1eaaa9988 100644 (file)
  * Stride Prefetcher template instantiations.
  */
 
-#include "mem/cache/tags/lru.hh"
-
 #include "mem/cache/prefetch/stride_prefetcher.hh"
 
-// Template Instantiations
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
+void
+StridePrefetcher::calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
+                                    std::list<Tick> &delays)
+{
+//     Addr blkAddr = pkt->paddr & ~(Addr)(this->blkSize-1);
+    int cpuID = pkt->req->getCpuNum();
+    if (!useCPUId) cpuID = 0;
+
+    /* Scan Table for IAddr Match */
+/*     std::list<strideEntry*>::iterator iter;
+  for (iter=table[cpuID].begin();
+  iter !=table[cpuID].end();
+  iter++) {
+  if ((*iter)->IAddr == pkt->pc) break;
+  }
+
+  if (iter != table[cpuID].end()) {
+  //Hit in table
+
+  int newStride = blkAddr - (*iter)->MAddr;
+  if (newStride == (*iter)->stride) {
+  (*iter)->confidence++;
+  }
+  else {
+  (*iter)->stride = newStride;
+  (*iter)->confidence--;
+  }
+
+  (*iter)->MAddr = blkAddr;
 
-template class StridePrefetcher<LRU >;
+  for (int d=1; d <= degree; d++) {
+  Addr newAddr = blkAddr + d * newStride;
+  if (this->pageStop &&
+  (blkAddr & ~(TheISA::VMPageSize - 1)) !=
+  (newAddr & ~(TheISA::VMPageSize - 1)))
+  {
+  //Spanned the page, so now stop
+  this->pfSpanPage += degree - d + 1;
+  return;
+  }
+  else
+  {
+  addresses.push_back(newAddr);
+  delays.push_back(latency);
+  }
+  }
+  }
+  else {
+  //Miss in table
+  //Find lowest confidence and replace
 
-#endif //DOXYGEN_SHOULD_SKIP_THIS
+  }
+*/
+}
index 57e4304006c6c228c2d83f3175c80ae0154aac1d..831e60fb4a7b614e3bb669ca56df90a036cfae4d 100644 (file)
 
 /**
  * @file
- * Describes a strided prefetcher based on template policies.
+ * Describes a strided prefetcher.
  */
 
 #ifndef __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
 #define __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
 
-#include "base/misc.hh" // fatal, panic, and warn
+#include "mem/cache/prefetch/base_prefetcher.hh"
 
-#include "mem/cache/prefetch/prefetcher.hh"
-
-/**
- * A template-policy based cache. The behavior of the cache can be altered by
- * supplying different template policies. TagStore handles all tag and data
- * storage @sa TagStore. MissBuffer handles all misses and writes/writebacks
- * @sa MissQueue. Coherence handles all coherence policy details @sa
- * UniCoherence, SimpleMultiCoherence.
- */
-template <class TagStore>
-class StridePrefetcher : public Prefetcher<TagStore>
+class StridePrefetcher : public BasePrefetcher
 {
   protected:
 
-    MissBuffer* mq;
-    TagStore* tags;
-
     class strideEntry
     {
       public:
@@ -84,66 +71,16 @@ class StridePrefetcher : public Prefetcher<TagStore>
     StridePrefetcher(int size, bool pageStop, bool serialSquash,
                      bool cacheCheckPush, bool onlyData,
                      Tick latency, int degree, bool useCPUId)
-        :Prefetcher<TagStore>(size, pageStop, serialSquash,
-                                         cacheCheckPush, onlyData),
-         latency(latency), degree(degree), useCPUId(useCPUId)
+        : BasePrefetcher(size, pageStop, serialSquash,
+                         cacheCheckPush, onlyData),
+          latency(latency), degree(degree), useCPUId(useCPUId)
     {
     }
 
     ~StridePrefetcher() {}
 
     void calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
-                           std::list<Tick> &delays)
-    {
-//     Addr blkAddr = pkt->paddr & ~(Addr)(this->blkSize-1);
-        int cpuID = pkt->req->getCpuNum();
-        if (!useCPUId) cpuID = 0;
-
-        /* Scan Table for IAddr Match */
-/*     std::list<strideEntry*>::iterator iter;
-        for (iter=table[cpuID].begin();
-             iter !=table[cpuID].end();
-             iter++) {
-            if ((*iter)->IAddr == pkt->pc) break;
-        }
-
-        if (iter != table[cpuID].end()) {
-            //Hit in table
-
-            int newStride = blkAddr - (*iter)->MAddr;
-            if (newStride == (*iter)->stride) {
-                (*iter)->confidence++;
-            }
-            else {
-                (*iter)->stride = newStride;
-                (*iter)->confidence--;
-            }
-
-            (*iter)->MAddr = blkAddr;
-
-            for (int d=1; d <= degree; d++) {
-                Addr newAddr = blkAddr + d * newStride;
-                if (this->pageStop &&
-                    (blkAddr & ~(TheISA::VMPageSize - 1)) !=
-                    (newAddr & ~(TheISA::VMPageSize - 1)))
-                {
-                    //Spanned the page, so now stop
-                    this->pfSpanPage += degree - d + 1;
-                    return;
-                }
-                else
-                {
-                    addresses.push_back(newAddr);
-                    delays.push_back(latency);
-                }
-            }
-        }
-        else {
-            //Miss in table
-            //Find lowest confidence and replace
-
-        }
-*/    }
+                           std::list<Tick> &delays);
 };
 
 #endif // __MEM_CACHE_PREFETCH_STRIDE_PREFETCHER_HH__
diff --git a/src/mem/cache/prefetch/tagged_prefetcher.cc b/src/mem/cache/prefetch/tagged_prefetcher.cc
new file mode 100644 (file)
index 0000000..bc1fa46
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2005 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Ron Dreslinski
+ */
+
+/**
+ * @file
+ * Describes a tagged prefetcher based on template policies.
+ */
+
+#include "arch/isa_traits.hh"
+#include "mem/cache/prefetch/tagged_prefetcher.hh"
+
+TaggedPrefetcher::
+TaggedPrefetcher(int size, bool pageStop, bool serialSquash,
+                 bool cacheCheckPush, bool onlyData,
+                 Tick latency, int degree)
+    : BasePrefetcher(size, pageStop, serialSquash,
+                     cacheCheckPush, onlyData),
+      latency(latency), degree(degree)
+{
+}
+
+void
+TaggedPrefetcher::
+calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
+                  std::list<Tick> &delays)
+{
+    Addr blkAddr = pkt->getAddr() & ~(Addr)(this->blkSize-1);
+
+    for (int d=1; d <= degree; d++) {
+        Addr newAddr = blkAddr + d*(this->blkSize);
+        if (this->pageStop &&
+            (blkAddr & ~(TheISA::VMPageSize - 1)) !=
+            (newAddr & ~(TheISA::VMPageSize - 1)))
+        {
+            //Spanned the page, so now stop
+            this->pfSpanPage += degree - d + 1;
+            return;
+        }
+        else
+        {
+            addresses.push_back(newAddr);
+            delays.push_back(latency);
+        }
+    }
+}
+
+
index dc2aaec50a46eea2363389e7f38a2aa07173959c..b9d228aba0b1d4782747412b22479f6794a2f09e 100644 (file)
 
 /**
  * @file
- * Describes a tagged prefetcher based on template policies.
+ * Describes a tagged prefetcher.
  */
 
 #ifndef __MEM_CACHE_PREFETCH_TAGGED_PREFETCHER_HH__
 #define __MEM_CACHE_PREFETCH_TAGGED_PREFETCHER_HH__
 
-#include "mem/cache/prefetch/prefetcher.hh"
+#include "mem/cache/prefetch/base_prefetcher.hh"
 
-/**
- * A template-policy based cache. The behavior of the cache can be altered by
- * supplying different template policies. TagStore handles all tag and data
- * storage @sa TagStore. MissBuffer handles all misses and writes/writebacks
- * @sa MissQueue. Coherence handles all coherence policy details @sa
- * UniCoherence, SimpleMultiCoherence.
- */
-template <class TagStore>
-class TaggedPrefetcher : public Prefetcher<TagStore>
+class TaggedPrefetcher : public BasePrefetcher
 {
   protected:
 
-    MissBuffer* mq;
-    TagStore* tags;
-
     Tick latency;
     int degree;
 
diff --git a/src/mem/cache/prefetch/tagged_prefetcher_impl.hh b/src/mem/cache/prefetch/tagged_prefetcher_impl.hh
deleted file mode 100644 (file)
index b3d4284..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Ron Dreslinski
- */
-
-/**
- * @file
- * Describes a tagged prefetcher based on template policies.
- */
-
-#include "arch/isa_traits.hh"
-#include "mem/cache/prefetch/tagged_prefetcher.hh"
-
-template <class TagStore>
-TaggedPrefetcher<TagStore>::
-TaggedPrefetcher(int size, bool pageStop, bool serialSquash,
-                 bool cacheCheckPush, bool onlyData,
-                 Tick latency, int degree)
-    :Prefetcher<TagStore>(size, pageStop, serialSquash,
-                                     cacheCheckPush, onlyData),
-     latency(latency), degree(degree)
-{
-}
-
-template <class TagStore>
-void
-TaggedPrefetcher<TagStore>::
-calculatePrefetch(PacketPtr &pkt, std::list<Addr> &addresses,
-                  std::list<Tick> &delays)
-{
-    Addr blkAddr = pkt->getAddr() & ~(Addr)(this->blkSize-1);
-
-    for (int d=1; d <= degree; d++) {
-        Addr newAddr = blkAddr + d*(this->blkSize);
-        if (this->pageStop &&
-            (blkAddr & ~(TheISA::VMPageSize - 1)) !=
-            (newAddr & ~(TheISA::VMPageSize - 1)))
-        {
-            //Spanned the page, so now stop
-            this->pfSpanPage += degree - d + 1;
-            return;
-        }
-        else
-        {
-            addresses.push_back(newAddr);
-            delays.push_back(latency);
-        }
-    }
-}
-
-