summaryrefslogtreecommitdiff
path: root/src/mem/cache/cache_builder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/cache/cache_builder.cc')
-rw-r--r--src/mem/cache/cache_builder.cc105
1 files changed, 32 insertions, 73 deletions
diff --git a/src/mem/cache/cache_builder.cc b/src/mem/cache/cache_builder.cc
index d4b1787e0..4c9592a1b 100644
--- a/src/mem/cache/cache_builder.cc
+++ b/src/mem/cache/cache_builder.cc
@@ -42,7 +42,6 @@
#include "mem/cache/base_cache.hh"
#include "mem/cache/cache.hh"
#include "mem/bus.hh"
-#include "mem/cache/coherence/coherence_protocol.hh"
#include "params/BaseCache.hh"
// Tag Templates
@@ -66,18 +65,6 @@
#include "mem/cache/tags/split_lifo.hh"
#endif
-// Compression Templates
-#include "base/compression/null_compression.hh"
-#include "base/compression/lzss_compression.hh"
-
-// MissQueue Templates
-#include "mem/cache/miss/miss_queue.hh"
-#include "mem/cache/miss/blocking_buffer.hh"
-
-// Coherence Templates
-#include "mem/cache/coherence/uni_coherence.hh"
-#include "mem/cache/coherence/simple_coherence.hh"
-
//Prefetcher Headers
#if defined(USE_GHB)
#include "mem/cache/prefetch/ghb_prefetcher.hh"
@@ -93,7 +80,7 @@
using namespace std;
using namespace TheISA;
-#define BUILD_CACHE(TAGS, tags, c) \
+#define BUILD_CACHE(TAGS, tags) \
do { \
BasePrefetcher *pf; \
if (prefetch_policy == Enums::tagged) { \
@@ -108,16 +95,12 @@ using namespace TheISA;
else { \
BUILD_NULL_PREFETCHER(TAGS); \
} \
- Cache<TAGS, c>::Params params(tags, mq, coh, base_params, \
- pf, prefetch_access, latency, \
- true, \
- store_compressed, \
- adaptive_compression, \
- compressed_bus, \
- compAlg, compression_latency, \
- prefetch_miss); \
- Cache<TAGS, c> *retval = \
- new Cache<TAGS, c>(name, params); \
+ Cache<TAGS>::Params params(tags, base_params, \
+ pf, prefetch_access, latency, \
+ true, \
+ prefetch_miss); \
+ Cache<TAGS> *retval = \
+ new Cache<TAGS>(name, params); \
return retval; \
} while (0)
@@ -125,90 +108,72 @@ using namespace TheISA;
panic("%s not compiled into M5", x); \
} while (0)
-#define BUILD_COMPRESSED_CACHE(TAGS, tags, c) \
- do { \
- CompressionAlgorithm *compAlg; \
- if (compressed_bus || store_compressed) { \
- compAlg = new LZSSCompression(); \
- } else { \
- compAlg = new NullCompression(); \
- } \
- BUILD_CACHE(TAGS, tags, c); \
- } while (0)
-
#if defined(USE_CACHE_FALRU)
-#define BUILD_FALRU_CACHE(c) do { \
+#define BUILD_FALRU_CACHE do { \
FALRU *tags = new FALRU(block_size, size, latency); \
- BUILD_COMPRESSED_CACHE(FALRU, tags, c); \
+ BUILD_CACHE(FALRU, tags); \
} while (0)
#else
-#define BUILD_FALRU_CACHE(c) BUILD_CACHE_PANIC("falru cache")
+#define BUILD_FALRU_CACHE BUILD_CACHE_PANIC("falru cache")
#endif
#if defined(USE_CACHE_LRU)
-#define BUILD_LRU_CACHE(c) do { \
+#define BUILD_LRU_CACHE do { \
LRU *tags = new LRU(numSets, block_size, assoc, latency); \
- BUILD_COMPRESSED_CACHE(LRU, tags, c); \
+ BUILD_CACHE(LRU, tags); \
} while (0)
#else
-#define BUILD_LRU_CACHE(c) BUILD_CACHE_PANIC("lru cache")
+#define BUILD_LRU_CACHE BUILD_CACHE_PANIC("lru cache")
#endif
#if defined(USE_CACHE_SPLIT)
-#define BUILD_SPLIT_CACHE(c) do { \
+#define BUILD_SPLIT_CACHE do { \
Split *tags = new Split(numSets, block_size, assoc, split_size, lifo, \
two_queue, latency); \
- BUILD_COMPRESSED_CACHE(Split, tags, c); \
+ BUILD_CACHE(Split, tags); \
} while (0)
#else
-#define BUILD_SPLIT_CACHE(c) BUILD_CACHE_PANIC("split cache")
+#define BUILD_SPLIT_CACHE BUILD_CACHE_PANIC("split cache")
#endif
#if defined(USE_CACHE_SPLIT_LIFO)
-#define BUILD_SPLIT_LIFO_CACHE(c) do { \
+#define BUILD_SPLIT_LIFO_CACHE do { \
SplitLIFO *tags = new SplitLIFO(block_size, size, assoc, \
latency, two_queue, -1); \
- BUILD_COMPRESSED_CACHE(SplitLIFO, tags, c); \
+ BUILD_CACHE(SplitLIFO, tags); \
} while (0)
#else
-#define BUILD_SPLIT_LIFO_CACHE(c) BUILD_CACHE_PANIC("lifo cache")
+#define BUILD_SPLIT_LIFO_CACHE BUILD_CACHE_PANIC("lifo cache")
#endif
#if defined(USE_CACHE_IIC)
-#define BUILD_IIC_CACHE(c) do { \
+#define BUILD_IIC_CACHE do { \
IIC *tags = new IIC(iic_params); \
- BUILD_COMPRESSED_CACHE(IIC, tags, c); \
+ BUILD_CACHE(IIC, tags); \
} while (0)
#else
-#define BUILD_IIC_CACHE(c) BUILD_CACHE_PANIC("iic")
+#define BUILD_IIC_CACHE BUILD_CACHE_PANIC("iic")
#endif
-#define BUILD_CACHES(c) do { \
+#define BUILD_CACHES do { \
if (repl == NULL) { \
if (numSets == 1) { \
- BUILD_FALRU_CACHE(c); \
+ BUILD_FALRU_CACHE; \
} else { \
if (split == true) { \
- BUILD_SPLIT_CACHE(c); \
+ BUILD_SPLIT_CACHE; \
} else if (lifo == true) { \
- BUILD_SPLIT_LIFO_CACHE(c); \
+ BUILD_SPLIT_LIFO_CACHE; \
} else { \
- BUILD_LRU_CACHE(c); \
+ BUILD_LRU_CACHE; \
} \
} \
} else { \
- BUILD_IIC_CACHE(c); \
+ BUILD_IIC_CACHE; \
} \
} while (0)
#define BUILD_COHERENCE(b) do { \
- if (protocol == NULL) { \
- UniCoherence *coh = new UniCoherence(); \
- BUILD_CACHES(UniCoherence); \
- } else { \
- SimpleCoherence *coh = new SimpleCoherence(protocol); \
- BUILD_CACHES(SimpleCoherence); \
- } \
} while (0)
#if defined(USE_TAGGED)
@@ -274,8 +239,9 @@ BaseCacheParams::create()
}
// Build BaseCache param object
- BaseCache::Params base_params(addr_range, latency,
- block_size, max_miss_count);
+ BaseCache::Params base_params(latency, block_size,
+ mshrs, tgts_per_mshr, write_buffers,
+ max_miss_count);
//Warnings about prefetcher policy
if (prefetch_policy == Enums::none) {
@@ -310,13 +276,6 @@ BaseCacheParams::create()
const void *repl = NULL;
#endif
- if (mshrs == 1 /*|| out_bus->doEvents() == false*/) {
- BlockingBuffer *mq = new BlockingBuffer(true);
- BUILD_COHERENCE(BlockingBuffer);
- } else {
- MissQueue *mq = new MissQueue(mshrs, tgts_per_mshr, write_buffers,
- true, prefetch_miss);
- BUILD_COHERENCE(MissQueue);
- }
+ BUILD_CACHES;
return NULL;
}