Port: Make getAddrRanges const
[gem5.git] / src / mem / cache / builder.cc
index d67a9c9a4854c5494dbcbb879b70d38d20ad8f41..ca8c378fb9ef9688d4a47848338049bbb8bcd986 100644 (file)
  * @file
  * Simobject instatiation of caches.
  */
+#include <list>
 #include <vector>
 
-// Must be included first to determine which caches we want
-#include "enums/Prefetch.hh"
-#include "mem/config/cache.hh"
-#include "mem/config/prefetch.hh"
-#include "mem/cache/base_cache.hh"
+#include "config/the_isa.hh"
+#include "mem/cache/base.hh"
 #include "mem/cache/cache.hh"
-#include "mem/bus.hh"
+#include "mem/config/cache.hh"
 #include "params/BaseCache.hh"
 
 // Tag Templates
 #include "mem/cache/tags/iic.hh"
 #endif
 
-#if defined(USE_CACHE_SPLIT)
-#include "mem/cache/tags/split.hh"
-#endif
-
-#if defined(USE_CACHE_SPLIT_LIFO)
-#include "mem/cache/tags/split_lifo.hh"
-#endif
-
-//Prefetcher Headers
-#if defined(USE_GHB)
-#include "mem/cache/prefetch/ghb_prefetcher.hh"
-#endif
-#if defined(USE_TAGGED)
-#include "mem/cache/prefetch/tagged_prefetcher.hh"
-#endif
-#if defined(USE_STRIDED)
-#include "mem/cache/prefetch/stride_prefetcher.hh"
-#endif
-
 
 using namespace std;
-using namespace TheISA;
-
-#define BUILD_CACHE(TAGS, tags)                                      \
-    do {                                                                \
-        BasePrefetcher *pf;                                             \
-        if (prefetch_policy == Enums::tagged) {                         \
-            BUILD_TAGGED_PREFETCHER(TAGS);                              \
-        }                                                               \
-        else if (prefetch_policy == Enums::stride) {                    \
-            BUILD_STRIDED_PREFETCHER(TAGS);                             \
-        }                                                               \
-        else if (prefetch_policy == Enums::ghb) {                       \
-            BUILD_GHB_PREFETCHER(TAGS);                                 \
-        }                                                               \
-        else {                                                          \
-            BUILD_NULL_PREFETCHER(TAGS);                                \
-        }                                                               \
-        Cache<TAGS> *retval =                                           \
-            new Cache<TAGS>(this, tags, pf);                            \
-        return retval;                                                  \
+
+#define BUILD_CACHE(TAGS, tags)                         \
+    do {                                                \
+        Cache<TAGS> *retval =                           \
+            new Cache<TAGS>(this, tags);            \
+        return retval;                                  \
     } while (0)
 
-#define BUILD_CACHE_PANIC(x) do {                      \
-        panic("%s not compiled into M5", x);           \
+#define BUILD_CACHE_PANIC(x) do {                       \
+        panic("%s not compiled into M5", x);            \
     } while (0)
 
 #if defined(USE_CACHE_FALRU)
-#define BUILD_FALRU_CACHE do {                     \
+#define BUILD_FALRU_CACHE do {                              \
         FALRU *tags = new FALRU(block_size, size, latency); \
-        BUILD_CACHE(FALRU, tags);              \
+        BUILD_CACHE(FALRU, tags);                           \
     } while (0)
 #else
 #define BUILD_FALRU_CACHE BUILD_CACHE_PANIC("falru cache")
 #endif
 
 #if defined(USE_CACHE_LRU)
-#define BUILD_LRU_CACHE do {                           \
-        LRU *tags = new LRU(numSets, block_size, assoc, latency);      \
-        BUILD_CACHE(LRU, tags);                        \
+#define BUILD_LRU_CACHE do {                                            \
+        LRU *tags = new LRU(numSets, block_size, assoc, latency);       \
+        BUILD_CACHE(LRU, tags);                                         \
     } while (0)
 #else
 #define BUILD_LRU_CACHE BUILD_CACHE_PANIC("lru cache")
 #endif
 
-#if defined(USE_CACHE_SPLIT)
-#define BUILD_SPLIT_CACHE do {                                 \
-        Split *tags = new Split(numSets, block_size, assoc, split_size, lifo, \
-                                two_queue, latency);           \
-        BUILD_CACHE(Split, tags);                      \
-    } while (0)
-#else
-#define BUILD_SPLIT_CACHE BUILD_CACHE_PANIC("split cache")
-#endif
-
-#if defined(USE_CACHE_SPLIT_LIFO)
-#define BUILD_SPLIT_LIFO_CACHE do {                            \
-        SplitLIFO *tags = new SplitLIFO(block_size, size, assoc,        \
-                                        latency, two_queue, -1);       \
-        BUILD_CACHE(SplitLIFO, tags);                  \
-    } while (0)
-#else
-#define BUILD_SPLIT_LIFO_CACHE BUILD_CACHE_PANIC("lifo cache")
-#endif
-
 #if defined(USE_CACHE_IIC)
-#define BUILD_IIC_CACHE do {                   \
-        IIC *tags = new IIC(iic_params);               \
-        BUILD_CACHE(IIC, tags);        \
+#define BUILD_IIC_CACHE do {                            \
+        IIC *tags = new IIC(iic_params);                \
+        BUILD_CACHE(IIC, tags);                         \
     } while (0)
 #else
 #define BUILD_IIC_CACHE BUILD_CACHE_PANIC("iic")
 #endif
 
-#define BUILD_CACHES do {                              \
-        if (repl == NULL) {                            \
-            if (numSets == 1) {                                \
-                BUILD_FALRU_CACHE;             \
-            } else {                                   \
-                if (split == true) {                   \
-                    BUILD_SPLIT_CACHE;         \
-                } else if (lifo == true) {             \
-                    BUILD_SPLIT_LIFO_CACHE;    \
-                } else {                               \
-                    BUILD_LRU_CACHE;           \
-                }                                      \
-            }                                          \
-        } else {                                       \
-            BUILD_IIC_CACHE;                   \
-        }                                              \
+#define BUILD_CACHES do {                               \
+        if (repl == NULL) {                             \
+            if (numSets == 1) {                         \
+                BUILD_FALRU_CACHE;                      \
+            } else {                                    \
+               BUILD_LRU_CACHE;                    \
+            }                                           \
+        } else {                                        \
+            BUILD_IIC_CACHE;                            \
+        }                                               \
     } while (0)
 
-#define BUILD_COHERENCE(b) do {                                                \
-    } while (0)
-
-#if defined(USE_TAGGED)
-#define BUILD_TAGGED_PREFETCHER(t)                              \
-    pf = new TaggedPrefetcher(this)
-#else
-#define BUILD_TAGGED_PREFETCHER(t) BUILD_CACHE_PANIC("Tagged Prefetcher")
-#endif
-
-#if defined(USE_STRIDED)
-#define BUILD_STRIDED_PREFETCHER(t)                             \
-    pf = new StridePrefetcher(this)
-#else
-#define BUILD_STRIDED_PREFETCHER(t) BUILD_CACHE_PANIC("Stride Prefetcher")
-#endif
-
-#if defined(USE_GHB)
-#define BUILD_GHB_PREFETCHER(t)                         \
-    pf = new GHBPrefetcher(this)
-#else
-#define BUILD_GHB_PREFETCHER(t) BUILD_CACHE_PANIC("GHB Prefetcher")
-#endif
-
-#if defined(USE_TAGGED)
-#define BUILD_NULL_PREFETCHER(t)                                \
-    pf = new TaggedPrefetcher(this)
-#else
-#define BUILD_NULL_PREFETCHER(t) BUILD_CACHE_PANIC("NULL Prefetcher (uses Tagged)")
-#endif
-
 BaseCache *
 BaseCacheParams::create()
 {
@@ -208,24 +116,6 @@ BaseCacheParams::create()
         subblock_size = block_size;
     }
 
-    //Warnings about prefetcher policy
-    if (prefetch_policy == Enums::none) {
-        if (prefetch_miss || prefetch_access)
-            panic("With no prefetcher, you shouldn't prefetch from"
-                  " either miss or access stream\n");
-    }
-
-    if (prefetch_policy == Enums::tagged || prefetch_policy == Enums::stride ||
-        prefetch_policy == Enums::ghb) {
-
-        if (!prefetch_miss && !prefetch_access)
-            warn("With this prefetcher you should chose a prefetch"
-                 " stream (miss or access)\nNo Prefetching will occur\n");
-
-        if (prefetch_miss && prefetch_access)
-            panic("Can't do prefetches from both miss and access stream");
-    }
-
 #if defined(USE_CACHE_IIC)
     // Build IIC params
     IIC::Params iic_params;