diff options
Diffstat (limited to 'src/mem/cache/cache_builder.cc')
-rw-r--r-- | src/mem/cache/cache_builder.cc | 148 |
1 files changed, 58 insertions, 90 deletions
diff --git a/src/mem/cache/cache_builder.cc b/src/mem/cache/cache_builder.cc index 03646ec2a..4b1b19718 100644 --- a/src/mem/cache/cache_builder.cc +++ b/src/mem/cache/cache_builder.cc @@ -37,7 +37,6 @@ // Must be included first to determine which caches we want #include "mem/config/cache.hh" -#include "mem/config/compression.hh" #include "mem/config/prefetch.hh" #include "mem/cache/base_cache.hh" @@ -69,9 +68,7 @@ // Compression Templates #include "base/compression/null_compression.hh" -#if defined(USE_LZSS_COMPRESSION) #include "base/compression/lzss_compression.hh" -#endif // CacheTags Templates #include "mem/cache/tags/cache_tags.hh" @@ -211,156 +208,127 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(BaseCache) END_INIT_SIM_OBJECT_PARAMS(BaseCache) -#define BUILD_CACHE(t, comp, b, c) do { \ - Prefetcher<CacheTags<t, comp>, b> *pf; \ +#define BUILD_CACHE(t, c) do { \ + Prefetcher<CacheTags<t> > *pf; \ if (pf_policy == "tagged") { \ - BUILD_TAGGED_PREFETCHER(t, comp, b); \ + BUILD_TAGGED_PREFETCHER(t); \ } \ else if (pf_policy == "stride") { \ - BUILD_STRIDED_PREFETCHER(t, comp, b); \ + BUILD_STRIDED_PREFETCHER(t); \ } \ else if (pf_policy == "ghb") { \ - BUILD_GHB_PREFETCHER(t, comp, b); \ + BUILD_GHB_PREFETCHER(t); \ } \ else { \ - BUILD_NULL_PREFETCHER(t, comp, b); \ + BUILD_NULL_PREFETCHER(t); \ } \ - Cache<CacheTags<t, comp>, b, c>::Params params(tagStore, mq, coh, \ + Cache<CacheTags<t>, c>::Params params(tagStore, mq, coh, \ base_params, \ - /*in_bus, out_bus,*/ pf, \ + pf, \ prefetch_access, hit_latency); \ - Cache<CacheTags<t, comp>, b, c> *retval = \ - new Cache<CacheTags<t, comp>, b, c>(getInstanceName(), /*hier,*/ \ - params); \ -/* if (in_bus == NULL) { \ - retval->setSlaveInterface(new MemoryInterface<Cache<CacheTags<t, comp>, b, c> >(getInstanceName(), hier, retval, mem_trace)); \ - } else { \ - retval->setSlaveInterface(new SlaveInterface<Cache<CacheTags<t, comp>, b, c>, Bus>(getInstanceName(), hier, retval, in_bus, mem_trace)); \ - } \ - retval->setMasterInterface(new MasterInterface<Cache<CacheTags<t, comp>, b, c>, Bus>(getInstanceName(), hier, retval, out_bus)); \ - out_bus->rangeChange(); \ - return retval; \ -*/return retval; \ + Cache<CacheTags<t>, c> *retval = \ + new Cache<CacheTags<t>, c>(getInstanceName(), params); \ +return retval; \ } while (0) #define BUILD_CACHE_PANIC(x) do { \ panic("%s not compiled into M5", x); \ } while (0) -#if defined(USE_LZSS_COMPRESSION) -#define BUILD_COMPRESSED_CACHE(TAGS, tags, b, c) do { \ - if (compressed_bus || store_compressed){ \ - CacheTags<TAGS, LZSSCompression> *tagStore = \ - new CacheTags<TAGS, LZSSCompression>(tags, \ - compression_latency, \ - true, store_compressed, \ - adaptive_compression, \ - prefetch_miss); \ - BUILD_CACHE(TAGS, LZSSCompression, b, c); \ - } else { \ - CacheTags<TAGS, NullCompression> *tagStore = \ - new CacheTags<TAGS, NullCompression>(tags, \ - compression_latency, \ - true, store_compressed, \ - adaptive_compression, \ - prefetch_miss); \ - BUILD_CACHE(TAGS, NullCompression, b, c); \ - } \ - } while (0) -#else -#define BUILD_COMPRESSED_CACHE(TAGS, tags, b, c) do { \ - if (compressed_bus || store_compressed){ \ - BUILD_CACHE_PANIC("compressed caches"); \ +#define BUILD_COMPRESSED_CACHE(TAGS, tags, c) \ + do { \ + CompressionAlgorithm *compAlg; \ + if (compressed_bus || store_compressed) { \ + compAlg = new LZSSCompression(); \ } else { \ - CacheTags<TAGS, NullCompression> *tagStore = \ - new CacheTags<TAGS, NullCompression>(tags, \ - compression_latency, \ - true, store_compressed, \ - adaptive_compression \ - prefetch_miss); \ - BUILD_CACHE(TAGS, NullCompression, b, c); \ + compAlg = new NullCompression(); \ } \ + CacheTags<TAGS> *tagStore = \ + new CacheTags<TAGS>(tags, compression_latency, true, \ + store_compressed, adaptive_compression, \ + compressed_bus, \ + compAlg, prefetch_miss); \ + BUILD_CACHE(TAGS, c); \ } while (0) -#endif #if defined(USE_CACHE_FALRU) -#define BUILD_FALRU_CACHE(b,c) do { \ +#define BUILD_FALRU_CACHE(c) do { \ FALRU *tags = new FALRU(block_size, size, latency); \ - BUILD_COMPRESSED_CACHE(FALRU, tags, b, c); \ + BUILD_COMPRESSED_CACHE(FALRU, tags, c); \ } while (0) #else -#define BUILD_FALRU_CACHE(b, c) BUILD_CACHE_PANIC("falru cache") +#define BUILD_FALRU_CACHE(c) BUILD_CACHE_PANIC("falru cache") #endif #if defined(USE_CACHE_LRU) -#define BUILD_LRU_CACHE(b, c) do { \ +#define BUILD_LRU_CACHE(c) do { \ LRU *tags = new LRU(numSets, block_size, assoc, latency); \ - BUILD_COMPRESSED_CACHE(LRU, tags, b, c); \ + BUILD_COMPRESSED_CACHE(LRU, tags, c); \ } while (0) #else -#define BUILD_LRU_CACHE(b, c) BUILD_CACHE_PANIC("lru cache") +#define BUILD_LRU_CACHE(c) BUILD_CACHE_PANIC("lru cache") #endif #if defined(USE_CACHE_SPLIT) -#define BUILD_SPLIT_CACHE(b, c) do { \ +#define BUILD_SPLIT_CACHE(c) do { \ Split *tags = new Split(numSets, block_size, assoc, split_size, lifo, \ two_queue, latency); \ - BUILD_COMPRESSED_CACHE(Split, tags, b, c); \ + BUILD_COMPRESSED_CACHE(Split, tags, c); \ } while (0) #else -#define BUILD_SPLIT_CACHE(b, c) BUILD_CACHE_PANIC("split cache") +#define BUILD_SPLIT_CACHE(c) BUILD_CACHE_PANIC("split cache") #endif #if defined(USE_CACHE_SPLIT_LIFO) -#define BUILD_SPLIT_LIFO_CACHE(b, c) do { \ +#define BUILD_SPLIT_LIFO_CACHE(c) do { \ SplitLIFO *tags = new SplitLIFO(block_size, size, assoc, \ latency, two_queue, -1); \ - BUILD_COMPRESSED_CACHE(SplitLIFO, tags, b, c); \ + BUILD_COMPRESSED_CACHE(SplitLIFO, tags, c); \ } while (0) #else -#define BUILD_SPLIT_LIFO_CACHE(b, c) BUILD_CACHE_PANIC("lifo cache") +#define BUILD_SPLIT_LIFO_CACHE(c) BUILD_CACHE_PANIC("lifo cache") #endif #if defined(USE_CACHE_IIC) -#define BUILD_IIC_CACHE(b ,c) do { \ +#define BUILD_IIC_CACHE(c) do { \ IIC *tags = new IIC(iic_params); \ - BUILD_COMPRESSED_CACHE(IIC, tags, b, c); \ + BUILD_COMPRESSED_CACHE(IIC, tags, c); \ } while (0) #else -#define BUILD_IIC_CACHE(b, c) BUILD_CACHE_PANIC("iic") +#define BUILD_IIC_CACHE(c) BUILD_CACHE_PANIC("iic") #endif -#define BUILD_CACHES(b, c) do { \ +#define BUILD_CACHES(c) do { \ if (repl == NULL) { \ if (numSets == 1) { \ - BUILD_FALRU_CACHE(b, c); \ + BUILD_FALRU_CACHE(c); \ } else { \ if (split == true) { \ - BUILD_SPLIT_CACHE(b, c); \ + BUILD_SPLIT_CACHE(c); \ } else if (lifo == true) { \ - BUILD_SPLIT_LIFO_CACHE(b, c); \ + BUILD_SPLIT_LIFO_CACHE(c); \ } else { \ - BUILD_LRU_CACHE(b, c); \ + BUILD_LRU_CACHE(c); \ } \ } \ } else { \ - BUILD_IIC_CACHE(b, c); \ + BUILD_IIC_CACHE(c); \ } \ } while (0) #define BUILD_COHERENCE(b) do { \ if (protocol == NULL) { \ UniCoherence *coh = new UniCoherence(); \ - BUILD_CACHES(b, UniCoherence); \ + BUILD_CACHES(UniCoherence); \ } else { \ SimpleCoherence *coh = new SimpleCoherence(protocol); \ - BUILD_CACHES(b, SimpleCoherence); \ + BUILD_CACHES(SimpleCoherence); \ } \ } while (0) #if defined(USE_TAGGED) -#define BUILD_TAGGED_PREFETCHER(t, comp, b) pf = new \ - TaggedPrefetcher<CacheTags<t, comp>, b>(prefetcher_size, \ +#define BUILD_TAGGED_PREFETCHER(t) pf = new \ + TaggedPrefetcher<CacheTags<t> >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -368,12 +336,12 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache) prefetch_latency, \ prefetch_degree) #else -#define BUILD_TAGGED_PREFETCHER(t, comp, b) BUILD_CACHE_PANIC("Tagged Prefetcher") +#define BUILD_TAGGED_PREFETCHER(t) BUILD_CACHE_PANIC("Tagged Prefetcher") #endif #if defined(USE_STRIDED) -#define BUILD_STRIDED_PREFETCHER(t, comp, b) pf = new \ - StridePrefetcher<CacheTags<t, comp>, b>(prefetcher_size, \ +#define BUILD_STRIDED_PREFETCHER(t) pf = new \ + StridePrefetcher<CacheTags<t> >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -382,12 +350,12 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache) prefetch_degree, \ prefetch_use_cpu_id) #else -#define BUILD_STRIDED_PREFETCHER(t, comp, b) BUILD_CACHE_PANIC("Stride Prefetcher") +#define BUILD_STRIDED_PREFETCHER(t) BUILD_CACHE_PANIC("Stride Prefetcher") #endif #if defined(USE_GHB) -#define BUILD_GHB_PREFETCHER(t, comp, b) pf = new \ - GHBPrefetcher<CacheTags<t, comp>, b>(prefetcher_size, \ +#define BUILD_GHB_PREFETCHER(t) pf = new \ + GHBPrefetcher<CacheTags<t> >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -396,12 +364,12 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache) prefetch_degree, \ prefetch_use_cpu_id) #else -#define BUILD_GHB_PREFETCHER(t, comp, b) BUILD_CACHE_PANIC("GHB Prefetcher") +#define BUILD_GHB_PREFETCHER(t) BUILD_CACHE_PANIC("GHB Prefetcher") #endif #if defined(USE_TAGGED) -#define BUILD_NULL_PREFETCHER(t, comp, b) pf = new \ - TaggedPrefetcher<CacheTags<t, comp>, b>(prefetcher_size, \ +#define BUILD_NULL_PREFETCHER(t) pf = new \ + TaggedPrefetcher<CacheTags<t> >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -409,7 +377,7 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache) prefetch_latency, \ prefetch_degree) #else -#define BUILD_NULL_PREFETCHER(t, comp, b) BUILD_CACHE_PANIC("NULL Prefetcher (uses Tagged)") +#define BUILD_NULL_PREFETCHER(t) BUILD_CACHE_PANIC("NULL Prefetcher (uses Tagged)") #endif CREATE_SIM_OBJECT(BaseCache) |