From c0f21b09c81e5562a916f7cb562a7df7f7709f4a Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Sat, 2 Dec 2006 13:33:46 -0500 Subject: Fixes for MIPS_SE compiling. Regressions seem to work, but Korey should make sure these changes (commit especially) work okay. src/cpu/o3/commit_impl.hh: src/cpu/o3/fetch_impl.hh: Fixes for MIPS_SE compile. --HG-- extra : convert_revision : fde9616f8e72b397c5ca965774172372cff53790 --- src/cpu/o3/commit_impl.hh | 1 + src/cpu/o3/fetch_impl.hh | 2 ++ 2 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index e72679710..43305f962 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -748,6 +748,7 @@ DefaultCommit::commit() } } else { bdelay_done_seq_num = squashed_inst; + squash_bdelay_slot = true; } #endif diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index 63d22b293..4c378e18b 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -1139,6 +1139,8 @@ DefaultFetch::fetch(bool &status_change) ext_inst = TheISA::makeExtMI(inst, fetch_PC); #elif THE_ISA == SPARC_ISA ext_inst = TheISA::makeExtMI(inst, cpu->thread[tid]->getTC()); +#elif THE_ISA == MIPS_ISA + ext_inst = TheISA::makeExtMI(inst, cpu->thread[tid]->getTC()); #endif // Create a new DynInst from the instruction fetched. -- cgit v1.2.3 From 6f94c3c8d755d1cdd3854fde5741305afcd44b19 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 2 Dec 2006 22:22:58 -0800 Subject: Make cache compression policy a runtime virtual thing instead of a template policy. --HG-- extra : convert_revision : 6a4ac7a189a950390a973fdfce94f56190de92db --- src/base/compression/base.hh | 71 +++++++++++++++++++ src/base/compression/lzss_compression.hh | 4 +- src/base/compression/null_compression.hh | 28 ++------ src/mem/cache/cache.cc | 76 ++++++--------------- src/mem/cache/cache_builder.cc | 101 ++++++++++------------------ src/mem/cache/miss/blocking_buffer.hh | 1 + src/mem/cache/prefetch/ghb_prefetcher.cc | 6 +- src/mem/cache/prefetch/stride_prefetcher.cc | 6 +- 8 files changed, 137 insertions(+), 156 deletions(-) create mode 100644 src/base/compression/base.hh (limited to 'src') diff --git a/src/base/compression/base.hh b/src/base/compression/base.hh new file mode 100644 index 000000000..8d1f8d6b5 --- /dev/null +++ b/src/base/compression/base.hh @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2003-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: Erik Hallnor + * Nathan Binkert + */ + +#ifndef __BASE_COMPRESSION_BASE_HH__ +#define __BASE_COMPRESSION_BASE_HH__ + +/** + * @file + * This file defines a base (abstract virtual) compression algorithm object. + */ + +#include + +/** + * Abstract virtual compression algorithm object. + */ +class CompressionAlgorithm +{ + public: + virtual ~CompressionAlgorithm() {} + + /** + * Uncompress the data, causes a fatal since no data should be compressed. + * @param dest The output buffer. + * @param src The compressed data. + * @param size The number of bytes in src. + * + * @retval The size of the uncompressed data. + */ + virtual int uncompress(uint8_t * dest, uint8_t *src, int size) = 0; + + /** + * Compress the data, just returns the source data. + * @param dest The output buffer. + * @param src The data to be compressed. + * @param size The number of bytes in src. + * + * @retval The size of the compressed data. + */ + virtual int compress(uint8_t *dest, uint8_t *src, int size) = 0; +}; + +#endif //__BASE_COMPRESSION_BASE_HH__ diff --git a/src/base/compression/lzss_compression.hh b/src/base/compression/lzss_compression.hh index 35e4dcb3f..a23d07ffd 100644 --- a/src/base/compression/lzss_compression.hh +++ b/src/base/compression/lzss_compression.hh @@ -35,12 +35,12 @@ * LZSSCompression declarations. */ -#include "sim/host.hh" // for uint8_t +#include "base/compression/base.hh" /** * Simple LZSS compression scheme. */ -class LZSSCompression +class LZSSCompression : public CompressionAlgorithm { /** * Finds the longest substring for the given offset. diff --git a/src/base/compression/null_compression.hh b/src/base/compression/null_compression.hh index 5a582d828..ff110807a 100644 --- a/src/base/compression/null_compression.hh +++ b/src/base/compression/null_compression.hh @@ -38,41 +38,23 @@ */ #include "base/misc.hh" // for fatal() -#include "sim/host.hh" +#include "base/compression/base.hh" /** * A dummy compression class to use when no data compression is desired. */ -class NullCompression +class NullCompression : public CompressionAlgorithm { public: - /** - * Uncompress the data, causes a fatal since no data should be compressed. - * @param dest The output buffer. - * @param src The compressed data. - * @param size The number of bytes in src. - * - * @retval The size of the uncompressed data. - */ - static int uncompress(uint8_t * dest, uint8_t *src, int size) + int uncompress(uint8_t * dest, uint8_t *src, int size) { fatal("Can't uncompress data"); } - /** - * Compress the data, just returns the source data. - * @param dest The output buffer. - * @param src The data to be compressed. - * @param size The number of bytes in src. - * - * @retval The size of the compressed data. - */ - - static int compress(uint8_t *dest, uint8_t *src, int size) + int compress(uint8_t *dest, uint8_t *src, int size) { - memcpy(dest,src,size); - return size; + fatal("Can't compress data"); } }; diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc index db66c096e..54d1d151f 100644 --- a/src/mem/cache/cache.cc +++ b/src/mem/cache/cache.cc @@ -37,7 +37,6 @@ */ #include "mem/config/cache.hh" -#include "mem/config/compression.hh" #include "mem/cache/tags/cache_tags.hh" @@ -61,11 +60,6 @@ #include "mem/cache/tags/split_lifo.hh" #endif -#include "base/compression/null_compression.hh" -#if defined(USE_LZSS_COMPRESSION) -#include "base/compression/lzss_compression.hh" -#endif - #include "mem/cache/miss/miss_queue.hh" #include "mem/cache/miss/blocking_buffer.hh" @@ -79,68 +73,38 @@ #if defined(USE_CACHE_FALRU) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#if defined(USE_LZSS_COMPRESSION) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#endif +template class Cache, BlockingBuffer, SimpleCoherence>; +template class Cache, BlockingBuffer, UniCoherence>; +template class Cache, MissQueue, SimpleCoherence>; +template class Cache, MissQueue, UniCoherence>; #endif #if defined(USE_CACHE_IIC) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#if defined(USE_LZSS_COMPRESSION) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#endif +template class Cache, BlockingBuffer, SimpleCoherence>; +template class Cache, BlockingBuffer, UniCoherence>; +template class Cache, MissQueue, SimpleCoherence>; +template class Cache, MissQueue, UniCoherence>; #endif #if defined(USE_CACHE_LRU) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#if defined(USE_LZSS_COMPRESSION) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#endif +template class Cache, BlockingBuffer, SimpleCoherence>; +template class Cache, BlockingBuffer, UniCoherence>; +template class Cache, MissQueue, SimpleCoherence>; +template class Cache, MissQueue, UniCoherence>; #endif #if defined(USE_CACHE_SPLIT) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#if defined(USE_LZSS_COMPRESSION) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#endif +template class Cache, BlockingBuffer, SimpleCoherence>; +template class Cache, BlockingBuffer, UniCoherence>; +template class Cache, MissQueue, SimpleCoherence>; +template class Cache, MissQueue, UniCoherence>; #endif #if defined(USE_CACHE_SPLIT_LIFO) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#if defined(USE_LZSS_COMPRESSION) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; -#endif +template class Cache, BlockingBuffer, SimpleCoherence>; +template class Cache, BlockingBuffer, UniCoherence>; +template class Cache, MissQueue, SimpleCoherence>; +template class Cache, MissQueue, UniCoherence>; #endif #endif //DOXYGEN_SHOULD_SKIP_THIS diff --git a/src/mem/cache/cache_builder.cc b/src/mem/cache/cache_builder.cc index 03646ec2a..7d4207ae1 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,77 +208,47 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(BaseCache) END_INIT_SIM_OBJECT_PARAMS(BaseCache) -#define BUILD_CACHE(t, comp, b, c) do { \ - Prefetcher, b> *pf; \ +#define BUILD_CACHE(t, b, c) do { \ + Prefetcher, b> *pf; \ if (pf_policy == "tagged") { \ - BUILD_TAGGED_PREFETCHER(t, comp, b); \ + BUILD_TAGGED_PREFETCHER(t, b); \ } \ else if (pf_policy == "stride") { \ - BUILD_STRIDED_PREFETCHER(t, comp, b); \ + BUILD_STRIDED_PREFETCHER(t, b); \ } \ else if (pf_policy == "ghb") { \ - BUILD_GHB_PREFETCHER(t, comp, b); \ + BUILD_GHB_PREFETCHER(t, b); \ } \ else { \ - BUILD_NULL_PREFETCHER(t, comp, b); \ + BUILD_NULL_PREFETCHER(t, b); \ } \ - Cache, b, c>::Params params(tagStore, mq, coh, \ + Cache, b, c>::Params params(tagStore, mq, coh, \ base_params, \ - /*in_bus, out_bus,*/ pf, \ + pf, \ prefetch_access, hit_latency); \ - Cache, b, c> *retval = \ - new Cache, b, c>(getInstanceName(), /*hier,*/ \ - params); \ -/* if (in_bus == NULL) { \ - retval->setSlaveInterface(new MemoryInterface, b, c> >(getInstanceName(), hier, retval, mem_trace)); \ - } else { \ - retval->setSlaveInterface(new SlaveInterface, b, c>, Bus>(getInstanceName(), hier, retval, in_bus, mem_trace)); \ - } \ - retval->setMasterInterface(new MasterInterface, b, c>, Bus>(getInstanceName(), hier, retval, out_bus)); \ - out_bus->rangeChange(); \ - return retval; \ -*/return retval; \ + Cache, b, c> *retval = \ + new Cache, b, 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 *tagStore = \ - new CacheTags(tags, \ - compression_latency, \ - true, store_compressed, \ - adaptive_compression, \ - prefetch_miss); \ - BUILD_CACHE(TAGS, LZSSCompression, b, c); \ - } else { \ - CacheTags *tagStore = \ - new CacheTags(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, b, c) \ + do { \ + CompressionAlgorithm *compAlg; \ + if (compressed_bus || store_compressed) { \ + compAlg = new LZSSCompression(); \ } else { \ - CacheTags *tagStore = \ - new CacheTags(tags, \ - compression_latency, \ - true, store_compressed, \ - adaptive_compression \ - prefetch_miss); \ - BUILD_CACHE(TAGS, NullCompression, b, c); \ + compAlg = new NullCompression(); \ } \ + CacheTags *tagStore = \ + new CacheTags(tags, compression_latency, true, \ + store_compressed, adaptive_compression, \ + compAlg, prefetch_miss); \ + BUILD_CACHE(TAGS, b, c); \ } while (0) -#endif #if defined(USE_CACHE_FALRU) #define BUILD_FALRU_CACHE(b,c) do { \ @@ -359,8 +326,8 @@ END_INIT_SIM_OBJECT_PARAMS(BaseCache) } while (0) #if defined(USE_TAGGED) -#define BUILD_TAGGED_PREFETCHER(t, comp, b) pf = new \ - TaggedPrefetcher, b>(prefetcher_size, \ +#define BUILD_TAGGED_PREFETCHER(t, b) pf = new \ + TaggedPrefetcher, b>(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -368,12 +335,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, b) BUILD_CACHE_PANIC("Tagged Prefetcher") #endif #if defined(USE_STRIDED) -#define BUILD_STRIDED_PREFETCHER(t, comp, b) pf = new \ - StridePrefetcher, b>(prefetcher_size, \ +#define BUILD_STRIDED_PREFETCHER(t, b) pf = new \ + StridePrefetcher, b>(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -382,12 +349,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, b) BUILD_CACHE_PANIC("Stride Prefetcher") #endif #if defined(USE_GHB) -#define BUILD_GHB_PREFETCHER(t, comp, b) pf = new \ - GHBPrefetcher, b>(prefetcher_size, \ +#define BUILD_GHB_PREFETCHER(t, b) pf = new \ + GHBPrefetcher, b>(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -396,12 +363,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, b) BUILD_CACHE_PANIC("GHB Prefetcher") #endif #if defined(USE_TAGGED) -#define BUILD_NULL_PREFETCHER(t, comp, b) pf = new \ - TaggedPrefetcher, b>(prefetcher_size, \ +#define BUILD_NULL_PREFETCHER(t, b) pf = new \ + TaggedPrefetcher, b>(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -409,7 +376,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, b) BUILD_CACHE_PANIC("NULL Prefetcher (uses Tagged)") #endif CREATE_SIM_OBJECT(BaseCache) diff --git a/src/mem/cache/miss/blocking_buffer.hh b/src/mem/cache/miss/blocking_buffer.hh index 934a843a6..a952c688c 100644 --- a/src/mem/cache/miss/blocking_buffer.hh +++ b/src/mem/cache/miss/blocking_buffer.hh @@ -38,6 +38,7 @@ #include +#include "base/misc.hh" // for fatal() #include "mem/cache/miss/mshr.hh" #include "base/statistics.hh" diff --git a/src/mem/cache/prefetch/ghb_prefetcher.cc b/src/mem/cache/prefetch/ghb_prefetcher.cc index 247ec6e8b..dd1b8aee4 100644 --- a/src/mem/cache/prefetch/ghb_prefetcher.cc +++ b/src/mem/cache/prefetch/ghb_prefetcher.cc @@ -38,8 +38,6 @@ #include "mem/cache/tags/lru.hh" -#include "base/compression/null_compression.hh" - #include "mem/cache/miss/miss_queue.hh" #include "mem/cache/miss/blocking_buffer.hh" @@ -48,7 +46,7 @@ // Template Instantiations #ifndef DOXYGEN_SHOULD_SKIP_THIS -template class GHBPrefetcher, MissQueue>; -template class GHBPrefetcher, BlockingBuffer>; +template class GHBPrefetcher, MissQueue>; +template class GHBPrefetcher, BlockingBuffer>; #endif //DOXYGEN_SHOULD_SKIP_THIS diff --git a/src/mem/cache/prefetch/stride_prefetcher.cc b/src/mem/cache/prefetch/stride_prefetcher.cc index 93a096468..c3b428dab 100644 --- a/src/mem/cache/prefetch/stride_prefetcher.cc +++ b/src/mem/cache/prefetch/stride_prefetcher.cc @@ -38,8 +38,6 @@ #include "mem/cache/tags/lru.hh" -#include "base/compression/null_compression.hh" - #include "mem/cache/miss/miss_queue.hh" #include "mem/cache/miss/blocking_buffer.hh" @@ -48,7 +46,7 @@ // Template Instantiations #ifndef DOXYGEN_SHOULD_SKIP_THIS -template class StridePrefetcher, MissQueue>; -template class StridePrefetcher, BlockingBuffer>; +template class StridePrefetcher, MissQueue>; +template class StridePrefetcher, BlockingBuffer>; #endif //DOXYGEN_SHOULD_SKIP_THIS -- cgit v1.2.3 From 4c0014a1871292ba2a78e131dcff3c96a4b70225 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 2 Dec 2006 22:23:46 -0800 Subject: Fix help strings on GenRepl params. --HG-- extra : convert_revision : 520814e193b9e86b6410f3ab98d62ed131d295aa --- src/python/m5/objects/Repl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/python/m5/objects/Repl.py b/src/python/m5/objects/Repl.py index 10892cf6f..b76aa1d6e 100644 --- a/src/python/m5/objects/Repl.py +++ b/src/python/m5/objects/Repl.py @@ -6,6 +6,6 @@ class Repl(SimObject): class GenRepl(Repl): type = 'GenRepl' - fresh_res = Param.Int("associativity") - num_pools = Param.Int("capacity in bytes") - pool_res = Param.Int("block size in bytes") + fresh_res = Param.Int("Fresh pool residency time") + num_pools = Param.Int("Number of priority pools") + pool_res = Param.Int("Pool residency time") -- cgit v1.2.3 From e6d7e8af2169ae77fe211c0e5141ebbc818acda5 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sat, 2 Dec 2006 22:24:52 -0800 Subject: Support better param conversions to/from numeric subclasses. --HG-- extra : convert_revision : 2ccb75b0912a384789458710fd9bbb65626f839e --- src/python/m5/params.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 9e5f985c3..d83d5f73f 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -237,6 +237,12 @@ class NumericParamValue(ParamValue): def __float__(self): return float(self.value) + def __long__(self): + return long(self.value) + + def __int__(self): + return int(self.value) + # hook for bounds checking def _check(self): return @@ -308,8 +314,11 @@ class CheckedInt(NumericParamValue): def __init__(self, value): if isinstance(value, str): self.value = convert.toInteger(value) - elif isinstance(value, (int, long, float)): + elif isinstance(value, (int, long, float, NumericParamValue)): self.value = long(value) + else: + raise TypeError, "Can't convert object of type %s to CheckedInt" \ + % type(value).__name__ self._check() class Int(CheckedInt): cxx_type = 'int'; size = 32; unsigned = False -- cgit v1.2.3 From 5fbf3aa47112b3d28971c0bab604ce9cc3f67b16 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Mon, 4 Dec 2006 09:10:53 -0800 Subject: Turn cache MissQueue/BlockingBuffer into virtual object instead of template parameter. --HG-- extra : convert_revision : fce0fbd041149b9c781eb23f480ba84fddbfd4a0 --- src/SConscript | 1 + src/mem/cache/cache.cc | 30 +-- src/mem/cache/cache.hh | 15 +- src/mem/cache/cache_builder.cc | 92 +++++----- src/mem/cache/cache_impl.hh | 70 +++---- src/mem/cache/miss/blocking_buffer.cc | 41 +++-- src/mem/cache/miss/blocking_buffer.hh | 60 +----- src/mem/cache/miss/miss_buffer.cc | 62 +++++++ src/mem/cache/miss/miss_buffer.hh | 223 +++++++++++++++++++++++ src/mem/cache/miss/miss_queue.cc | 36 ++-- src/mem/cache/miss/miss_queue.hh | 30 +-- src/mem/cache/prefetch/ghb_prefetcher.cc | 6 +- src/mem/cache/prefetch/ghb_prefetcher.hh | 10 +- src/mem/cache/prefetch/stride_prefetcher.cc | 6 +- src/mem/cache/prefetch/stride_prefetcher.hh | 10 +- src/mem/cache/prefetch/tagged_prefetcher.hh | 8 +- src/mem/cache/prefetch/tagged_prefetcher_impl.hh | 10 +- 17 files changed, 449 insertions(+), 261 deletions(-) create mode 100644 src/mem/cache/miss/miss_buffer.cc create mode 100644 src/mem/cache/miss/miss_buffer.hh (limited to 'src') diff --git a/src/SConscript b/src/SConscript index 429e1bee1..f54e1de0d 100644 --- a/src/SConscript +++ b/src/SConscript @@ -108,6 +108,7 @@ base_sources = Split(''' mem/cache/coherence/coherence_protocol.cc mem/cache/coherence/uni_coherence.cc mem/cache/miss/blocking_buffer.cc + mem/cache/miss/miss_buffer.cc mem/cache/miss/miss_queue.cc mem/cache/miss/mshr.cc mem/cache/miss/mshr_queue.cc diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc index 54d1d151f..29ca09060 100644 --- a/src/mem/cache/cache.cc +++ b/src/mem/cache/cache.cc @@ -73,38 +73,28 @@ #if defined(USE_CACHE_FALRU) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; +template class Cache, SimpleCoherence>; +template class Cache, UniCoherence>; #endif #if defined(USE_CACHE_IIC) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; +template class Cache, SimpleCoherence>; +template class Cache, UniCoherence>; #endif #if defined(USE_CACHE_LRU) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; +template class Cache, SimpleCoherence>; +template class Cache, UniCoherence>; #endif #if defined(USE_CACHE_SPLIT) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; +template class Cache, SimpleCoherence>; +template class Cache, UniCoherence>; #endif #if defined(USE_CACHE_SPLIT_LIFO) -template class Cache, BlockingBuffer, SimpleCoherence>; -template class Cache, BlockingBuffer, UniCoherence>; -template class Cache, MissQueue, SimpleCoherence>; -template class Cache, MissQueue, UniCoherence>; +template class Cache, SimpleCoherence>; +template class Cache, UniCoherence>; #endif #endif //DOXYGEN_SHOULD_SKIP_THIS diff --git a/src/mem/cache/cache.hh b/src/mem/cache/cache.hh index 1f3b087bb..29502042c 100644 --- a/src/mem/cache/cache.hh +++ b/src/mem/cache/cache.hh @@ -42,6 +42,7 @@ #include "cpu/smt.hh" // SMT_MAX_THREADS #include "mem/cache/base_cache.hh" +#include "mem/cache/miss/miss_buffer.hh" #include "mem/cache/prefetch/prefetcher.hh" //Forward decleration @@ -55,7 +56,7 @@ class MSHR; * @sa MissQueue. Coherence handles all coherence policy details @sa * UniCoherence, SimpleMultiCoherence. */ -template +template class Cache : public BaseCache { public: @@ -68,12 +69,12 @@ class Cache : public BaseCache /** Tag and data Storage */ TagStore *tags; /** Miss and Writeback handler */ - Buffering *missQueue; + MissBuffer *missQueue; /** Coherence protocol. */ Coherence *coherence; /** Prefetcher */ - Prefetcher *prefetcher; + Prefetcher *prefetcher; /** * The clock ratio of the outgoing bus. @@ -105,16 +106,16 @@ class Cache : public BaseCache { public: TagStore *tags; - Buffering *missQueue; + MissBuffer *missQueue; Coherence *coherence; BaseCache::Params baseParams; - Prefetcher *prefetcher; + Prefetcher *prefetcher; bool prefetchAccess; int hitLatency; - Params(TagStore *_tags, Buffering *mq, Coherence *coh, + Params(TagStore *_tags, MissBuffer *mq, Coherence *coh, BaseCache::Params params, - Prefetcher *_prefetcher, + Prefetcher *_prefetcher, bool prefetch_access, int hit_latency) : tags(_tags), missQueue(mq), coherence(coh), baseParams(params), diff --git a/src/mem/cache/cache_builder.cc b/src/mem/cache/cache_builder.cc index 7d4207ae1..44e8cf1dd 100644 --- a/src/mem/cache/cache_builder.cc +++ b/src/mem/cache/cache_builder.cc @@ -208,26 +208,26 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(BaseCache) END_INIT_SIM_OBJECT_PARAMS(BaseCache) -#define BUILD_CACHE(t, b, c) do { \ - Prefetcher, b> *pf; \ +#define BUILD_CACHE(t, c) do { \ + Prefetcher > *pf; \ if (pf_policy == "tagged") { \ - BUILD_TAGGED_PREFETCHER(t, b); \ + BUILD_TAGGED_PREFETCHER(t); \ } \ else if (pf_policy == "stride") { \ - BUILD_STRIDED_PREFETCHER(t, b); \ + BUILD_STRIDED_PREFETCHER(t); \ } \ else if (pf_policy == "ghb") { \ - BUILD_GHB_PREFETCHER(t, b); \ + BUILD_GHB_PREFETCHER(t); \ } \ else { \ - BUILD_NULL_PREFETCHER(t, b); \ + BUILD_NULL_PREFETCHER(t); \ } \ - Cache, b, c>::Params params(tagStore, mq, coh, \ + Cache, c>::Params params(tagStore, mq, coh, \ base_params, \ pf, \ prefetch_access, hit_latency); \ - Cache, b, c> *retval = \ - new Cache, b, c>(getInstanceName(), params); \ + Cache, c> *retval = \ + new Cache, c>(getInstanceName(), params); \ return retval; \ } while (0) @@ -235,7 +235,7 @@ return retval; \ panic("%s not compiled into M5", x); \ } while (0) -#define BUILD_COMPRESSED_CACHE(TAGS, tags, b, c) \ +#define BUILD_COMPRESSED_CACHE(TAGS, tags, c) \ do { \ CompressionAlgorithm *compAlg; \ if (compressed_bus || store_compressed) { \ @@ -247,87 +247,87 @@ return retval; \ new CacheTags(tags, compression_latency, true, \ store_compressed, adaptive_compression, \ compAlg, prefetch_miss); \ - BUILD_CACHE(TAGS, b, c); \ + BUILD_CACHE(TAGS, c); \ } while (0) #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, b) pf = new \ - TaggedPrefetcher, b>(prefetcher_size, \ +#define BUILD_TAGGED_PREFETCHER(t) pf = new \ + TaggedPrefetcher >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -335,12 +335,12 @@ return retval; \ prefetch_latency, \ prefetch_degree) #else -#define BUILD_TAGGED_PREFETCHER(t, 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, b) pf = new \ - StridePrefetcher, b>(prefetcher_size, \ +#define BUILD_STRIDED_PREFETCHER(t) pf = new \ + StridePrefetcher >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -349,12 +349,12 @@ return retval; \ prefetch_degree, \ prefetch_use_cpu_id) #else -#define BUILD_STRIDED_PREFETCHER(t, 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, b) pf = new \ - GHBPrefetcher, b>(prefetcher_size, \ +#define BUILD_GHB_PREFETCHER(t) pf = new \ + GHBPrefetcher >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -363,12 +363,12 @@ return retval; \ prefetch_degree, \ prefetch_use_cpu_id) #else -#define BUILD_GHB_PREFETCHER(t, 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, b) pf = new \ - TaggedPrefetcher, b>(prefetcher_size, \ +#define BUILD_NULL_PREFETCHER(t) pf = new \ + TaggedPrefetcher >(prefetcher_size, \ !prefetch_past_page, \ prefetch_serial_squash, \ prefetch_cache_check_push, \ @@ -376,7 +376,7 @@ return retval; \ prefetch_latency, \ prefetch_degree) #else -#define BUILD_NULL_PREFETCHER(t, 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) diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 3a681bc52..6742d5892 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -55,9 +55,9 @@ bool SIGNAL_NACK_HACK; -template +template bool -Cache:: +Cache:: doTimingAccess(PacketPtr pkt, CachePort *cachePort, bool isCpuSide) { if (isCpuSide) @@ -81,9 +81,9 @@ doTimingAccess(PacketPtr pkt, CachePort *cachePort, bool isCpuSide) return true; } -template +template Tick -Cache:: +Cache:: doAtomicAccess(PacketPtr pkt, bool isCpuSide) { if (isCpuSide) @@ -103,9 +103,9 @@ doAtomicAccess(PacketPtr pkt, bool isCpuSide) return hitLatency; } -template +template void -Cache:: +Cache:: doFunctionalAccess(PacketPtr pkt, bool isCpuSide) { if (isCpuSide) @@ -123,19 +123,19 @@ doFunctionalAccess(PacketPtr pkt, bool isCpuSide) } } -template +template void -Cache:: +Cache:: recvStatusChange(Port::Status status, bool isCpuSide) { } -template -Cache:: +template +Cache:: Cache(const std::string &_name, - Cache::Params ¶ms) + Cache::Params ¶ms) : BaseCache(_name, params.baseParams), prefetchAccess(params.prefetchAccess), tags(params.tags), missQueue(params.missQueue), @@ -154,9 +154,9 @@ Cache(const std::string &_name, invalidatePkt = new Packet(invalidateReq, Packet::InvalidateReq, 0); } -template +template void -Cache::regStats() +Cache::regStats() { BaseCache::regStats(); tags->regStats(name()); @@ -165,9 +165,9 @@ Cache::regStats() prefetcher->regStats(name()); } -template +template bool -Cache::access(PacketPtr &pkt) +Cache::access(PacketPtr &pkt) { //@todo Add back in MemDebug Calls // MemDebug::cacheAccess(pkt); @@ -253,9 +253,9 @@ Cache::access(PacketPtr &pkt) } -template +template PacketPtr -Cache::getPacket() +Cache::getPacket() { assert(missQueue->havePending()); PacketPtr pkt = missQueue->getPacket(); @@ -276,9 +276,9 @@ Cache::getPacket() return pkt; } -template +template void -Cache::sendResult(PacketPtr &pkt, MSHR* mshr, +Cache::sendResult(PacketPtr &pkt, MSHR* mshr, bool success) { if (success && !(SIGNAL_NACK_HACK)) { @@ -319,9 +319,9 @@ Cache::sendResult(PacketPtr &pkt, MSHR* mshr, } } -template +template void -Cache::handleResponse(PacketPtr &pkt) +Cache::handleResponse(PacketPtr &pkt) { BlkType *blk = NULL; if (pkt->senderState) { @@ -363,16 +363,16 @@ Cache::handleResponse(PacketPtr &pkt) } } -template +template PacketPtr -Cache::getCoherencePacket() +Cache::getCoherencePacket() { return coherence->getPacket(); } -template +template void -Cache::sendCoherenceResult(PacketPtr &pkt, +Cache::sendCoherenceResult(PacketPtr &pkt, MSHR *cshr, bool success) { @@ -380,9 +380,9 @@ Cache::sendCoherenceResult(PacketPtr &pkt, } -template +template void -Cache::snoop(PacketPtr &pkt) +Cache::snoop(PacketPtr &pkt) { if (pkt->req->isUncacheable()) { //Can't get a hit on an uncacheable address @@ -514,9 +514,9 @@ Cache::snoop(PacketPtr &pkt) tags->handleSnoop(blk, new_state); } -template +template void -Cache::snoopResponse(PacketPtr &pkt) +Cache::snoopResponse(PacketPtr &pkt) { //Need to handle the response, if NACKED if (pkt->flags & NACKED_LINE) { @@ -533,9 +533,9 @@ Cache::snoopResponse(PacketPtr &pkt) } } -template +template void -Cache::invalidateBlk(Addr addr) +Cache::invalidateBlk(Addr addr) { tags->invalidateBlk(addr); } @@ -544,9 +544,9 @@ Cache::invalidateBlk(Addr addr) /** * @todo Fix to not assume write allocate */ -template +template Tick -Cache::probe(PacketPtr &pkt, bool update, +Cache::probe(PacketPtr &pkt, bool update, CachePort* otherSidePort) { // MemDebug::cacheProbe(pkt); @@ -694,9 +694,9 @@ return 0; return 0; } -template +template Tick -Cache::snoopProbe(PacketPtr &pkt) +Cache::snoopProbe(PacketPtr &pkt) { //Send a atomic (false) invalidate up if the protocol calls for it if (coherence->propogateInvalidate(pkt, false)) { diff --git a/src/mem/cache/miss/blocking_buffer.cc b/src/mem/cache/miss/blocking_buffer.cc index bf741e547..4a431d82d 100644 --- a/src/mem/cache/miss/blocking_buffer.cc +++ b/src/mem/cache/miss/blocking_buffer.cc @@ -33,11 +33,9 @@ * Definitions of a simple buffer for a blocking cache. */ -#include "cpu/smt.hh" //for maxThreadsPerCPU #include "mem/cache/base_cache.hh" #include "mem/cache/miss/blocking_buffer.hh" #include "mem/cache/prefetch/base_prefetcher.hh" -#include "sim/eventq.hh" // for Event declaration. #include "mem/request.hh" /** @@ -46,27 +44,10 @@ void BlockingBuffer::regStats(const std::string &name) { - using namespace Stats; - writebacks - .init(maxThreadsPerCPU) - .name(name + ".writebacks") - .desc("number of writebacks") - .flags(total) - ; + MissBuffer::regStats(name); } -void -BlockingBuffer::setCache(BaseCache *_cache) -{ - cache = _cache; - blkSize = cache->getBlockSize(); -} -void -BlockingBuffer::setPrefetcher(BasePrefetcher *_prefetcher) -{ - prefetcher = _prefetcher; -} void BlockingBuffer::handleMiss(PacketPtr &pkt, int blk_size, Tick time) { @@ -241,3 +222,23 @@ BlockingBuffer::doWriteback(PacketPtr &pkt) cache->setBlocked(Blocked_NoWBBuffers); cache->setMasterRequest(Request_WB, curTick); } + + +MSHR * +BlockingBuffer::findMSHR(Addr addr) +{ + if (miss.addr == addr && miss.pkt) + return &miss; + return NULL; +} + + +bool +BlockingBuffer::findWrites(Addr addr, std::vector& writes) +{ + if (wb.addr == addr && wb.pkt) { + writes.push_back(&wb); + return true; + } + return false; +} diff --git a/src/mem/cache/miss/blocking_buffer.hh b/src/mem/cache/miss/blocking_buffer.hh index a952c688c..205068a8c 100644 --- a/src/mem/cache/miss/blocking_buffer.hh +++ b/src/mem/cache/miss/blocking_buffer.hh @@ -39,16 +39,13 @@ #include #include "base/misc.hh" // for fatal() +#include "mem/cache/miss/miss_buffer.hh" #include "mem/cache/miss/mshr.hh" -#include "base/statistics.hh" - -class BaseCache; -class BasePrefetcher; /** * Miss and writeback storage for a blocking cache. */ -class BlockingBuffer +class BlockingBuffer : public MissBuffer { protected: /** Miss storage. */ @@ -56,38 +53,13 @@ protected: /** WB storage. */ MSHR wb; - //Params - - /** Allocate on write misses. */ - const bool writeAllocate; - - /** Pointer to the parent cache. */ - BaseCache* cache; - - BasePrefetcher* prefetcher; - - /** Block size of the parent cache. */ - int blkSize; - - // Statistics - /** - * @addtogroup CacheStatistics - * @{ - */ - /** Number of blocks written back per thread. */ - Stats::Vector<> writebacks; - - /** - * @} - */ - public: /** * Builds and initializes this buffer. * @param write_allocate If true, treat write misses the same as reads. */ BlockingBuffer(bool write_allocate) - : writeAllocate(write_allocate) + : MissBuffer(write_allocate) { } @@ -97,14 +69,6 @@ public: */ void regStats(const std::string &name); - /** - * Called by the parent cache to set the back pointer. - * @param _cache A pointer to the parent cache. - */ - void setCache(BaseCache *_cache); - - void setPrefetcher(BasePrefetcher *_prefetcher); - /** * Handle a cache miss properly. Requests the bus and marks the cache as * blocked. @@ -184,12 +148,7 @@ public: * @param asid The address space id. * @return A pointer to miss if it matches. */ - MSHR* findMSHR(Addr addr) - { - if (miss.addr == addr && miss.pkt) - return &miss; - return NULL; - } + MSHR* findMSHR(Addr addr); /** * Searches for the supplied address in the write buffer. @@ -198,16 +157,7 @@ public: * @param writes List of pointers to the matching writes. * @return True if there is a matching write. */ - bool findWrites(Addr addr, std::vector& writes) - { - if (wb.addr == addr && wb.pkt) { - writes.push_back(&wb); - return true; - } - return false; - } - - + bool findWrites(Addr addr, std::vector& writes); /** * Perform a writeback of dirty data to the given address. diff --git a/src/mem/cache/miss/miss_buffer.cc b/src/mem/cache/miss/miss_buffer.cc new file mode 100644 index 000000000..4d9cd0958 --- /dev/null +++ b/src/mem/cache/miss/miss_buffer.cc @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2003-2006 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: Erik Hallnor + */ + +#include "cpu/smt.hh" //for maxThreadsPerCPU +#include "mem/cache/base_cache.hh" +#include "mem/cache/miss/miss_buffer.hh" +#include "mem/cache/prefetch/base_prefetcher.hh" + +/** + * @todo Move writebacks into shared BaseBuffer class. + */ +void +MissBuffer::regStats(const std::string &name) +{ + using namespace Stats; + writebacks + .init(maxThreadsPerCPU) + .name(name + ".writebacks") + .desc("number of writebacks") + .flags(total) + ; +} + +void +MissBuffer::setCache(BaseCache *_cache) +{ + cache = _cache; + blkSize = cache->getBlockSize(); +} + +void +MissBuffer::setPrefetcher(BasePrefetcher *_prefetcher) +{ + prefetcher = _prefetcher; +} diff --git a/src/mem/cache/miss/miss_buffer.hh b/src/mem/cache/miss/miss_buffer.hh new file mode 100644 index 000000000..3e3080578 --- /dev/null +++ b/src/mem/cache/miss/miss_buffer.hh @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2003-2006 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: Steve Reinhardt + */ + +/** + * @file + * MissBuffer declaration. + */ + +#ifndef __MISS_BUFFER_HH__ +#define __MISS_BUFFER_HH__ + +class BaseCache; +class BasePrefetcher; +class MSHR; + +/** + * Abstract base class for cache miss buffering. + */ +class MissBuffer +{ + protected: + /** True if the cache should allocate on a write miss. */ + const bool writeAllocate; + + /** Pointer to the parent cache. */ + BaseCache *cache; + + /** The Prefetcher */ + BasePrefetcher *prefetcher; + + /** Block size of the parent cache. */ + int blkSize; + + // Statistics + /** + * @addtogroup CacheStatistics + * @{ + */ + /** Number of blocks written back per thread. */ + Stats::Vector<> writebacks; + + /** + * @} + */ + + public: + MissBuffer(bool write_allocate) + : writeAllocate(write_allocate) + { + } + + virtual ~MissBuffer() {} + + /** + * Called by the parent cache to set the back pointer. + * @param _cache A pointer to the parent cache. + */ + void setCache(BaseCache *_cache); + + void setPrefetcher(BasePrefetcher *_prefetcher); + + /** + * Register statistics for this object. + * @param name The name of the parent cache. + */ + virtual void regStats(const std::string &name); + + /** + * Handle a cache miss properly. Either allocate an MSHR for the request, + * or forward it through the write buffer. + * @param pkt The request that missed in the cache. + * @param blk_size The block size of the cache. + * @param time The time the miss is detected. + */ + virtual void handleMiss(PacketPtr &pkt, int blk_size, Tick time) = 0; + + /** + * Fetch the block for the given address and buffer the given target. + * @param addr The address to fetch. + * @param asid The address space of the address. + * @param blk_size The block size of the cache. + * @param time The time the miss is detected. + * @param target The target for the fetch. + */ + virtual MSHR *fetchBlock(Addr addr, int blk_size, Tick time, + PacketPtr &target) = 0; + + /** + * Selects a outstanding request to service. + * @return The request to service, NULL if none found. + */ + virtual PacketPtr getPacket() = 0; + + /** + * Set the command to the given bus command. + * @param pkt The request to update. + * @param cmd The bus command to use. + */ + virtual void setBusCmd(PacketPtr &pkt, Packet::Command cmd) = 0; + + /** + * Restore the original command in case of a bus transmission error. + * @param pkt The request to reset. + */ + virtual void restoreOrigCmd(PacketPtr &pkt) = 0; + + /** + * Marks a request as in service (sent on the bus). This can have side + * effect since storage for no response commands is deallocated once they + * are successfully sent. + * @param pkt The request that was sent on the bus. + */ + virtual void markInService(PacketPtr &pkt, MSHR* mshr) = 0; + + /** + * Collect statistics and free resources of a satisfied request. + * @param pkt The request that has been satisfied. + * @param time The time when the request is satisfied. + */ + virtual void handleResponse(PacketPtr &pkt, Tick time) = 0; + + /** + * Removes all outstanding requests for a given thread number. If a request + * has been sent to the bus, this function removes all of its targets. + * @param threadNum The thread number of the requests to squash. + */ + virtual void squash(int threadNum) = 0; + + /** + * Return the current number of outstanding misses. + * @return the number of outstanding misses. + */ + virtual int getMisses() = 0; + + /** + * Searches for the supplied address in the miss queue. + * @param addr The address to look for. + * @param asid The address space id. + * @return The MSHR that contains the address, NULL if not found. + * @warning Currently only searches the miss queue. If non write allocate + * might need to search the write buffer for coherence. + */ + virtual MSHR* findMSHR(Addr addr) = 0; + + /** + * Searches for the supplied address in the write buffer. + * @param addr The address to look for. + * @param asid The address space id. + * @param writes The list of writes that match the address. + * @return True if any writes are found + */ + virtual bool findWrites(Addr addr, std::vector& writes) = 0; + + /** + * Perform a writeback of dirty data to the given address. + * @param addr The address to write to. + * @param asid The address space id. + * @param xc The execution context of the address space. + * @param size The number of bytes to write. + * @param data The data to write, can be NULL. + * @param compressed True if the data is compressed. + */ + virtual void doWriteback(Addr addr, int size, uint8_t *data, + bool compressed) = 0; + + /** + * Perform the given writeback request. + * @param pkt The writeback request. + */ + virtual void doWriteback(PacketPtr &pkt) = 0; + + /** + * Returns true if there are outstanding requests. + * @return True if there are outstanding requests. + */ + virtual bool havePending() = 0; + + /** + * Add a target to the given MSHR. This assumes it is in the miss queue. + * @param mshr The mshr to add a target to. + * @param pkt The target to add. + */ + virtual void addTarget(MSHR *mshr, PacketPtr &pkt) = 0; + + /** + * Allocate a MSHR to hold a list of targets to a block involved in a copy. + * If the block is marked done then the MSHR already holds the data to + * fill the block. Otherwise the block needs to be fetched. + * @param addr The address to buffer. + * @param asid The address space ID. + * @return A pointer to the allocated MSHR. + */ + virtual MSHR* allocateTargetList(Addr addr) = 0; +}; + +#endif //__MISS_BUFFER_HH__ diff --git a/src/mem/cache/miss/miss_queue.cc b/src/mem/cache/miss/miss_queue.cc index 3c4586272..1d3e22326 100644 --- a/src/mem/cache/miss/miss_queue.cc +++ b/src/mem/cache/miss/miss_queue.cc @@ -48,16 +48,25 @@ using namespace std; */ MissQueue::MissQueue(int numMSHRs, int numTargets, int write_buffers, bool write_allocate, bool prefetch_miss) - : mq(numMSHRs, 4), wb(write_buffers,numMSHRs+1000), numMSHR(numMSHRs), + : MissBuffer(write_allocate), + mq(numMSHRs, 4), wb(write_buffers,numMSHRs+1000), numMSHR(numMSHRs), numTarget(numTargets), writeBuffers(write_buffers), - writeAllocate(write_allocate), order(0), prefetchMiss(prefetch_miss) + order(0), prefetchMiss(prefetch_miss) { noTargetMSHR = NULL; } + +MissQueue::~MissQueue() +{ +} + + void MissQueue::regStats(const string &name) { + MissBuffer::regStats(name); + Request temp_req((Addr) NULL, 4, 0); Packet::Command temp_cmd = Packet::ReadReq; Packet temp_pkt(&temp_req, temp_cmd, 0); //@todo FIx command strings so this isn't neccessary @@ -65,13 +74,6 @@ MissQueue::regStats(const string &name) using namespace Stats; - writebacks - .init(maxThreadsPerCPU) - .name(name + ".writebacks") - .desc("number of writebacks") - .flags(total) - ; - // MSHR hit statistics for (int access_idx = 0; access_idx < NUM_MEM_CMDS; ++access_idx) { Packet::Command cmd = (Packet::Command)access_idx; @@ -336,18 +338,6 @@ MissQueue::regStats(const string &name) } -void -MissQueue::setCache(BaseCache *_cache) -{ - cache = _cache; - blkSize = cache->getBlockSize(); -} - -void -MissQueue::setPrefetcher(BasePrefetcher *_prefetcher) -{ - prefetcher = _prefetcher; -} MSHR* MissQueue::allocateMiss(PacketPtr &pkt, int size, Tick time) @@ -706,13 +696,13 @@ MissQueue::squash(int threadNum) } MSHR* -MissQueue::findMSHR(Addr addr) const +MissQueue::findMSHR(Addr addr) { return mq.findMatch(addr); } bool -MissQueue::findWrites(Addr addr, vector &writes) const +MissQueue::findWrites(Addr addr, vector &writes) { return wb.findMatches(addr,writes); } diff --git a/src/mem/cache/miss/miss_queue.hh b/src/mem/cache/miss/miss_queue.hh index b67a896f4..1f9bb1e0c 100644 --- a/src/mem/cache/miss/miss_queue.hh +++ b/src/mem/cache/miss/miss_queue.hh @@ -38,19 +38,18 @@ #include +#include "mem/cache/miss/miss_buffer.hh" #include "mem/cache/miss/mshr.hh" #include "mem/cache/miss/mshr_queue.hh" #include "base/statistics.hh" -class BaseCache; -class BasePrefetcher; /** * Manages cache misses and writebacks. Contains MSHRs to store miss data * and the writebuffer for writes/writebacks. * @todo need to handle data on writes better (encapsulate). * @todo need to make replacements/writebacks happen in Cache::access */ -class MissQueue +class MissQueue : public MissBuffer { protected: /** The MSHRs. */ @@ -66,16 +65,6 @@ class MissQueue const int numTarget; /** The number of write buffers. */ const int writeBuffers; - /** True if the cache should allocate on a write miss. */ - const bool writeAllocate; - /** Pointer to the parent cache. */ - BaseCache* cache; - - /** The Prefetcher */ - BasePrefetcher *prefetcher; - - /** The block size of the parent cache. */ - int blkSize; /** Increasing order number assigned to each incoming request. */ uint64_t order; @@ -87,9 +76,6 @@ class MissQueue * @addtogroup CacheStatistics * @{ */ - /** Number of blocks written back per thread. */ - Stats::Vector<> writebacks; - /** Number of misses that hit in the MSHRs per command and thread. */ Stats::Vector<> mshr_hits[NUM_MEM_CMDS]; /** Demand misses that hit in the MSHRs. */ @@ -203,14 +189,6 @@ class MissQueue */ void regStats(const std::string &name); - /** - * Called by the parent cache to set the back pointer. - * @param _cache A pointer to the parent cache. - */ - void setCache(BaseCache *_cache); - - void setPrefetcher(BasePrefetcher *_prefetcher); - /** * Handle a cache miss properly. Either allocate an MSHR for the request, * or forward it through the write buffer. @@ -289,7 +267,7 @@ class MissQueue * @warning Currently only searches the miss queue. If non write allocate * might need to search the write buffer for coherence. */ - MSHR* findMSHR(Addr addr) const; + MSHR* findMSHR(Addr addr); /** * Searches for the supplied address in the write buffer. @@ -298,7 +276,7 @@ class MissQueue * @param writes The list of writes that match the address. * @return True if any writes are found */ - bool findWrites(Addr addr, std::vector& writes) const; + bool findWrites(Addr addr, std::vector& writes); /** * Perform a writeback of dirty data to the given address. diff --git a/src/mem/cache/prefetch/ghb_prefetcher.cc b/src/mem/cache/prefetch/ghb_prefetcher.cc index dd1b8aee4..a6c419113 100644 --- a/src/mem/cache/prefetch/ghb_prefetcher.cc +++ b/src/mem/cache/prefetch/ghb_prefetcher.cc @@ -38,15 +38,11 @@ #include "mem/cache/tags/lru.hh" -#include "mem/cache/miss/miss_queue.hh" -#include "mem/cache/miss/blocking_buffer.hh" - #include "mem/cache/prefetch/ghb_prefetcher.hh" // Template Instantiations #ifndef DOXYGEN_SHOULD_SKIP_THIS -template class GHBPrefetcher, MissQueue>; -template class GHBPrefetcher, BlockingBuffer>; +template class GHBPrefetcher >; #endif //DOXYGEN_SHOULD_SKIP_THIS diff --git a/src/mem/cache/prefetch/ghb_prefetcher.hh b/src/mem/cache/prefetch/ghb_prefetcher.hh index 14f5747df..c558a3e64 100644 --- a/src/mem/cache/prefetch/ghb_prefetcher.hh +++ b/src/mem/cache/prefetch/ghb_prefetcher.hh @@ -43,16 +43,16 @@ /** * 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. Buffering handles all misses and writes/writebacks + * storage @sa TagStore. MissBuffer handles all misses and writes/writebacks * @sa MissQueue. Coherence handles all coherence policy details @sa * UniCoherence, SimpleMultiCoherence. */ -template -class GHBPrefetcher : public Prefetcher +template +class GHBPrefetcher : public Prefetcher { protected: - Buffering* mq; + MissBuffer* mq; TagStore* tags; Addr second_last_miss_addr[64/*MAX_CPUS*/]; @@ -67,7 +67,7 @@ class GHBPrefetcher : public Prefetcher GHBPrefetcher(int size, bool pageStop, bool serialSquash, bool cacheCheckPush, bool onlyData, Tick latency, int degree, bool useCPUId) - :Prefetcher(size, pageStop, serialSquash, + :Prefetcher(size, pageStop, serialSquash, cacheCheckPush, onlyData), latency(latency), degree(degree), useCPUId(useCPUId) { diff --git a/src/mem/cache/prefetch/stride_prefetcher.cc b/src/mem/cache/prefetch/stride_prefetcher.cc index c3b428dab..2204871cc 100644 --- a/src/mem/cache/prefetch/stride_prefetcher.cc +++ b/src/mem/cache/prefetch/stride_prefetcher.cc @@ -38,15 +38,11 @@ #include "mem/cache/tags/lru.hh" -#include "mem/cache/miss/miss_queue.hh" -#include "mem/cache/miss/blocking_buffer.hh" - #include "mem/cache/prefetch/stride_prefetcher.hh" // Template Instantiations #ifndef DOXYGEN_SHOULD_SKIP_THIS -template class StridePrefetcher, MissQueue>; -template class StridePrefetcher, BlockingBuffer>; +template class StridePrefetcher >; #endif //DOXYGEN_SHOULD_SKIP_THIS diff --git a/src/mem/cache/prefetch/stride_prefetcher.hh b/src/mem/cache/prefetch/stride_prefetcher.hh index d6fb8ab66..57e430400 100644 --- a/src/mem/cache/prefetch/stride_prefetcher.hh +++ b/src/mem/cache/prefetch/stride_prefetcher.hh @@ -43,16 +43,16 @@ /** * 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. Buffering handles all misses and writes/writebacks + * storage @sa TagStore. MissBuffer handles all misses and writes/writebacks * @sa MissQueue. Coherence handles all coherence policy details @sa * UniCoherence, SimpleMultiCoherence. */ -template -class StridePrefetcher : public Prefetcher +template +class StridePrefetcher : public Prefetcher { protected: - Buffering* mq; + MissBuffer* mq; TagStore* tags; class strideEntry @@ -84,7 +84,7 @@ class StridePrefetcher : public Prefetcher StridePrefetcher(int size, bool pageStop, bool serialSquash, bool cacheCheckPush, bool onlyData, Tick latency, int degree, bool useCPUId) - :Prefetcher(size, pageStop, serialSquash, + :Prefetcher(size, pageStop, serialSquash, cacheCheckPush, onlyData), latency(latency), degree(degree), useCPUId(useCPUId) { diff --git a/src/mem/cache/prefetch/tagged_prefetcher.hh b/src/mem/cache/prefetch/tagged_prefetcher.hh index b61e57dcc..dc2aaec50 100644 --- a/src/mem/cache/prefetch/tagged_prefetcher.hh +++ b/src/mem/cache/prefetch/tagged_prefetcher.hh @@ -41,16 +41,16 @@ /** * 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. Buffering handles all misses and writes/writebacks + * storage @sa TagStore. MissBuffer handles all misses and writes/writebacks * @sa MissQueue. Coherence handles all coherence policy details @sa * UniCoherence, SimpleMultiCoherence. */ -template -class TaggedPrefetcher : public Prefetcher +template +class TaggedPrefetcher : public Prefetcher { protected: - Buffering* mq; + MissBuffer* mq; TagStore* tags; Tick latency; diff --git a/src/mem/cache/prefetch/tagged_prefetcher_impl.hh b/src/mem/cache/prefetch/tagged_prefetcher_impl.hh index a18de4571..b3d4284c7 100644 --- a/src/mem/cache/prefetch/tagged_prefetcher_impl.hh +++ b/src/mem/cache/prefetch/tagged_prefetcher_impl.hh @@ -36,20 +36,20 @@ #include "arch/isa_traits.hh" #include "mem/cache/prefetch/tagged_prefetcher.hh" -template -TaggedPrefetcher:: +template +TaggedPrefetcher:: TaggedPrefetcher(int size, bool pageStop, bool serialSquash, bool cacheCheckPush, bool onlyData, Tick latency, int degree) - :Prefetcher(size, pageStop, serialSquash, + :Prefetcher(size, pageStop, serialSquash, cacheCheckPush, onlyData), latency(latency), degree(degree) { } -template +template void -TaggedPrefetcher:: +TaggedPrefetcher:: calculatePrefetch(PacketPtr &pkt, std::list &addresses, std::list &delays) { -- cgit v1.2.3 From 1c28682cea09830f675945bc2052e5445ba0c81b Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 5 Dec 2006 07:16:36 -0800 Subject: Don't compress data on writebacks unless it's actually necessary. --HG-- extra : convert_revision : 7a068e28f9ea2f6aab57be7133b47bda72d10302 --- src/mem/cache/cache_builder.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mem/cache/cache_builder.cc b/src/mem/cache/cache_builder.cc index 44e8cf1dd..4b1b19718 100644 --- a/src/mem/cache/cache_builder.cc +++ b/src/mem/cache/cache_builder.cc @@ -246,6 +246,7 @@ return retval; \ CacheTags *tagStore = \ new CacheTags(tags, compression_latency, true, \ store_compressed, adaptive_compression, \ + compressed_bus, \ compAlg, prefetch_miss); \ BUILD_CACHE(TAGS, c); \ } while (0) -- cgit v1.2.3 From b618e733bd580391702a844404417f9723b94588 Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Wed, 6 Dec 2006 14:23:31 -0500 Subject: Fix for MIPS_SE/m5.fast compile. --HG-- extra : convert_revision : dbb893250974ac6db7b6c1ba67263fd35098ca43 --- src/cpu/o3/commit_impl.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh index 43305f962..f400d757b 100644 --- a/src/cpu/o3/commit_impl.hh +++ b/src/cpu/o3/commit_impl.hh @@ -1197,16 +1197,16 @@ DefaultCommit::getInsts() rename_idx < fromRename->size; rename_idx++) { DynInstPtr inst = fromRename->insts[rename_idx]; - int tid = inst->threadNumber; if (!inst->isSquashed()) { DPRINTF(Commit, "Inserting PC %#x [sn:%i] [tid:%i] into ", - "skidBuffer.\n", inst->readPC(), inst->seqNum, tid); + "skidBuffer.\n", inst->readPC(), inst->seqNum, + inst->threadNumber); skidBuffer.push(inst); } else { DPRINTF(Commit, "Instruction PC %#x [sn:%i] [tid:%i] was " "squashed, skipping.\n", - inst->readPC(), inst->seqNum, tid); + inst->readPC(), inst->seqNum, inst->threadNumber); } } } -- cgit v1.2.3 From 1868c9fd7f9805e6f0a9cf3ceab958c8b36259b0 Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Mon, 11 Dec 2006 23:47:30 -0500 Subject: Fix for fetch to use the icache's block size to generate proper access size. --HG-- extra : convert_revision : 0f292233ac05b584f527c32f80e3ca3d40a6a2c1 --- src/cpu/o3/fetch_impl.hh | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index 4c378e18b..622259495 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -151,36 +151,6 @@ DefaultFetch::DefaultFetch(Params *params) " RoundRobin,LSQcount,IQcount}\n"); } - // Size of cache block. - cacheBlkSize = 64; - - // Create mask to get rid of offset bits. - cacheBlkMask = (cacheBlkSize - 1); - - for (int tid=0; tid < numThreads; tid++) { - - fetchStatus[tid] = Running; - - priorityList.push_back(tid); - - memReq[tid] = NULL; - - // Create space to store a cache line. - cacheData[tid] = new uint8_t[cacheBlkSize]; - cacheDataPC[tid] = 0; - cacheDataValid[tid] = false; - - delaySlotInfo[tid].branchSeqNum = -1; - delaySlotInfo[tid].numInsts = 0; - delaySlotInfo[tid].targetAddr = 0; - delaySlotInfo[tid].targetReady = false; - - stalls[tid].decode = false; - stalls[tid].rename = false; - stalls[tid].iew = false; - stalls[tid].commit = false; - } - // Get the size of an instruction. instSize = sizeof(TheISA::MachInst); } @@ -353,6 +323,36 @@ DefaultFetch::initStage() nextNPC[tid] = cpu->readNextNPC(tid); #endif } + + // Size of cache block. + cacheBlkSize = icachePort->peerBlockSize(); + + // Create mask to get rid of offset bits. + cacheBlkMask = (cacheBlkSize - 1); + + for (int tid=0; tid < numThreads; tid++) { + + fetchStatus[tid] = Running; + + priorityList.push_back(tid); + + memReq[tid] = NULL; + + // Create space to store a cache line. + cacheData[tid] = new uint8_t[cacheBlkSize]; + cacheDataPC[tid] = 0; + cacheDataValid[tid] = false; + + delaySlotInfo[tid].branchSeqNum = -1; + delaySlotInfo[tid].numInsts = 0; + delaySlotInfo[tid].targetAddr = 0; + delaySlotInfo[tid].targetReady = false; + + stalls[tid].decode = false; + stalls[tid].rename = false; + stalls[tid].iew = false; + stalls[tid].commit = false; + } } template -- cgit v1.2.3 From 34924ce3b82ec19322990c721369b08ddfd3df8a Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Mon, 11 Dec 2006 23:51:21 -0500 Subject: Fix up in case a req hasn't yet been generated for this instruction (if there was a fault prior to translation). --HG-- extra : convert_revision : 43f4ea5e6a234cc6071006eab72135c11b8523c8 --- src/cpu/o3/lsq_unit_impl.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cpu/o3/lsq_unit_impl.hh b/src/cpu/o3/lsq_unit_impl.hh index 4facea9f9..3b84d3411 100644 --- a/src/cpu/o3/lsq_unit_impl.hh +++ b/src/cpu/o3/lsq_unit_impl.hh @@ -418,7 +418,8 @@ LSQUnit::executeLoad(DynInstPtr &inst) // realizes there is activity. // Mark it as executed unless it is an uncached load that // needs to hit the head of commit. - if (!(inst->req->isUncacheable()) || inst->isAtCommit()) { + if (!(inst->req && inst->req->isUncacheable()) || + inst->isAtCommit()) { inst->setExecuted(); } iewStage->instToCommit(inst); -- cgit v1.2.3 From cdc3e5bc22369166eb4c616e8512324d60b6a20e Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 12 Dec 2006 02:21:03 -0500 Subject: Get rid of unused lock code. --HG-- extra : convert_revision : a8030132268662ca54f487b8d32d09ba224317a8 --- src/cpu/ozone/cpu.hh | 99 --------------------------------------- src/cpu/ozone/inorder_back_end.hh | 74 ----------------------------- src/cpu/simple_thread.hh | 69 --------------------------- 3 files changed, 242 deletions(-) (limited to 'src') diff --git a/src/cpu/ozone/cpu.hh b/src/cpu/ozone/cpu.hh index c1373944d..0da446c9c 100644 --- a/src/cpu/ozone/cpu.hh +++ b/src/cpu/ozone/cpu.hh @@ -448,30 +448,6 @@ class OzoneCPU : public BaseCPU } #endif - /** Old CPU read from memory function. No longer used. */ - template - Fault read(Request *req, T &data) - { -#if 0 -#if FULL_SYSTEM && defined(TARGET_ALPHA) - if (req->isLocked()) { - req->xc->setMiscReg(TheISA::Lock_Addr_DepTag, req->paddr); - req->xc->setMiscReg(TheISA::Lock_Flag_DepTag, true); - } -#endif - if (req->isLocked()) { - lockAddrList.insert(req->paddr); - lockFlag = true; - } -#endif - Fault error; - - error = this->mem->read(req, data); - data = gtoh(data); - return error; - } - - /** CPU read function, forwards read to LSQ. */ template Fault read(Request *req, T &data, int load_idx) @@ -479,81 +455,6 @@ class OzoneCPU : public BaseCPU return backEnd->read(req, data, load_idx); } - /** Old CPU write to memory function. No longer used. */ - template - Fault write(Request *req, T &data) - { -#if 0 -#if FULL_SYSTEM && defined(TARGET_ALPHA) - ExecContext *xc; - - // If this is a store conditional, act appropriately - if (req->isLocked()) { - xc = req->xc; - - if (req->isUncacheable()) { - // Don't update result register (see stq_c in isa_desc) - req->result = 2; - xc->setStCondFailures(0);//Needed? [RGD] - } else { - bool lock_flag = xc->readMiscReg(TheISA::Lock_Flag_DepTag); - Addr lock_addr = xc->readMiscReg(TheISA::Lock_Addr_DepTag); - req->result = lock_flag; - if (!lock_flag || - ((lock_addr & ~0xf) != (req->paddr & ~0xf))) { - xc->setMiscReg(TheISA::Lock_Flag_DepTag, false); - xc->setStCondFailures(xc->readStCondFailures() + 1); - if (((xc->readStCondFailures()) % 100000) == 0) { - std::cerr << "Warning: " - << xc->readStCondFailures() - << " consecutive store conditional failures " - << "on cpu " << req->xc->readCpuId() - << std::endl; - } - return NoFault; - } - else xc->setStCondFailures(0); - } - } - - // Need to clear any locked flags on other proccessors for - // this address. Only do this for succsful Store Conditionals - // and all other stores (WH64?). Unsuccessful Store - // Conditionals would have returned above, and wouldn't fall - // through. - for (int i = 0; i < this->system->threadContexts.size(); i++){ - xc = this->system->threadContexts[i]; - if ((xc->readMiscReg(TheISA::Lock_Addr_DepTag) & ~0xf) == - (req->paddr & ~0xf)) { - xc->setMiscReg(TheISA::Lock_Flag_DepTag, false); - } - } - -#endif - - if (req->isLocked()) { - if (req->isUncacheable()) { - req->result = 2; - } else { - if (this->lockFlag) { - if (lockAddrList.find(req->paddr) != - lockAddrList.end()) { - req->result = 1; - } else { - req->result = 0; - return NoFault; - } - } else { - req->result = 0; - return NoFault; - } - } - } -#endif - - return this->mem->write(req, (T)htog(data)); - } - /** CPU write function, forwards write to LSQ. */ template Fault write(Request *req, T &data, int store_idx) diff --git a/src/cpu/ozone/inorder_back_end.hh b/src/cpu/ozone/inorder_back_end.hh index b2522bdc8..4fd8e02f8 100644 --- a/src/cpu/ozone/inorder_back_end.hh +++ b/src/cpu/ozone/inorder_back_end.hh @@ -236,25 +236,6 @@ InorderBackEnd::read(Addr addr, T &data, unsigned flags) */ return fault; } -#if 0 -template -template -Fault -InorderBackEnd::read(MemReqPtr &req, T &data) -{ -#if FULL_SYSTEM && defined(TARGET_ALPHA) - if (req->isLocked()) { - req->xc->setMiscReg(TheISA::Lock_Addr_DepTag, req->paddr); - req->xc->setMiscReg(TheISA::Lock_Flag_DepTag, true); - } -#endif - - Fault error; - error = thread->mem->read(req, data); - data = LittleEndianGuest::gtoh(data); - return error; -} -#endif template template @@ -296,61 +277,6 @@ InorderBackEnd::write(T data, Addr addr, unsigned flags, uint64_t *res) */ return fault; } -#if 0 -template -template -Fault -InorderBackEnd::write(MemReqPtr &req, T &data) -{ -#if FULL_SYSTEM && defined(TARGET_ALPHA) - ExecContext *xc; - - // If this is a store conditional, act appropriately - if (req->isLocked()) { - xc = req->xc; - - if (req->isUncacheable()) { - // Don't update result register (see stq_c in isa_desc) - req->result = 2; - xc->setStCondFailures(0);//Needed? [RGD] - } else { - bool lock_flag = xc->readMiscReg(TheISA::Lock_Flag_DepTag); - Addr lock_addr = xc->readMiscReg(TheISA::Lock_Addr_DepTag); - req->result = lock_flag; - if (!lock_flag || - ((lock_addr & ~0xf) != (req->paddr & ~0xf))) { - xc->setMiscReg(TheISA::Lock_Flag_DepTag, false); - xc->setStCondFailures(xc->readStCondFailures() + 1); - if (((xc->readStCondFailures()) % 100000) == 0) { - std::cerr << "Warning: " - << xc->readStCondFailures() - << " consecutive store conditional failures " - << "on cpu " << req->xc->readCpuId() - << std::endl; - } - return NoFault; - } - else xc->setStCondFailures(0); - } - } - - // Need to clear any locked flags on other proccessors for - // this address. Only do this for succsful Store Conditionals - // and all other stores (WH64?). Unsuccessful Store - // Conditionals would have returned above, and wouldn't fall - // through. - for (int i = 0; i < cpu->system->execContexts.size(); i++){ - xc = cpu->system->execContexts[i]; - if ((xc->readMiscReg(TheISA::Lock_Addr_DepTag) & ~0xf) == - (req->paddr & ~0xf)) { - xc->setMiscReg(TheISA::Lock_Flag_DepTag, false); - } - } - -#endif - return thread->mem->write(req, (T)LittleEndianGuest::htog(data)); -} -#endif template template diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh index e8757c8c2..10bbe292c 100644 --- a/src/cpu/simple_thread.hh +++ b/src/cpu/simple_thread.hh @@ -232,75 +232,6 @@ class SimpleThread : public ThreadState /// Set the status to Halted. void halt(); -/* - template - Fault read(RequestPtr &req, T &data) - { -#if FULL_SYSTEM && THE_ISA == ALPHA_ISA - if (req->isLocked()) { - req->xc->setMiscReg(TheISA::Lock_Addr_DepTag, req->paddr); - req->xc->setMiscReg(TheISA::Lock_Flag_DepTag, true); - } -#endif - - Fault error; - error = mem->prot_read(req->paddr, data, req->size); - data = LittleEndianGuest::gtoh(data); - return error; - } - - template - Fault write(RequestPtr &req, T &data) - { -#if FULL_SYSTEM && THE_ISA == ALPHA_ISA - ExecContext *xc; - - // If this is a store conditional, act appropriately - if (req->isLocked()) { - xc = req->xc; - - if (req->isUncacheable()) { - // Don't update result register (see stq_c in isa_desc) - req->result = 2; - xc->setStCondFailures(0);//Needed? [RGD] - } else { - bool lock_flag = xc->readMiscReg(TheISA::Lock_Flag_DepTag); - Addr lock_addr = xc->readMiscReg(TheISA::Lock_Addr_DepTag); - req->result = lock_flag; - if (!lock_flag || - ((lock_addr & ~0xf) != (req->paddr & ~0xf))) { - xc->setMiscReg(TheISA::Lock_Flag_DepTag, false); - xc->setStCondFailures(xc->readStCondFailures() + 1); - if (((xc->readStCondFailures()) % 100000) == 0) { - std::cerr << "Warning: " - << xc->readStCondFailures() - << " consecutive store conditional failures " - << "on cpu " << req->xc->readCpuId() - << std::endl; - } - return NoFault; - } - else xc->setStCondFailures(0); - } - } - - // Need to clear any locked flags on other proccessors for - // this address. Only do this for succsful Store Conditionals - // and all other stores (WH64?). Unsuccessful Store - // Conditionals would have returned above, and wouldn't fall - // through. - for (int i = 0; i < system->execContexts.size(); i++){ - xc = system->execContexts[i]; - if ((xc->readMiscReg(TheISA::Lock_Addr_DepTag) & ~0xf) == - (req->paddr & ~0xf)) { - xc->setMiscReg(TheISA::Lock_Flag_DepTag, false); - } - } - -#endif - return mem->prot_write(req->paddr, (T)htog(data), req->size); - } -*/ virtual bool misspeculating(); Fault instRead(RequestPtr &req) -- cgit v1.2.3 From 6c8c86f2f97913788237f763d4810ab12730ca60 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 12 Dec 2006 09:58:40 -0800 Subject: Rename the StaticInst-based (read|set)(Int|Float)Reg methods to (read|set)(Int|Float)RegOperand to distinguish from non-StaticInst version. --HG-- extra : convert_revision : b33ce0ebe2fee86cc791c00a35d8c6e395e1380c --- src/arch/isa_parser.py | 25 +++++++++++++------------ src/arch/mips/isa/formats/fp.isa | 6 +++--- src/cpu/base_dyn_inst.hh | 12 +++++++----- src/cpu/checker/cpu.hh | 25 ++++++++++++++----------- src/cpu/exec_context.hh | 25 ++++++++++++++----------- src/cpu/o3/alpha/dyn_inst.hh | 35 +++++++++++++++++++---------------- src/cpu/o3/mips/dyn_inst.hh | 35 +++++++++++++++++++---------------- src/cpu/ozone/dyn_inst.hh | 25 ++++++++++++++----------- src/cpu/simple/base.hh | 25 ++++++++++++++----------- 9 files changed, 117 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py index 6504c7b32..a96622d4a 100755 --- a/src/arch/isa_parser.py +++ b/src/arch/isa_parser.py @@ -1180,15 +1180,16 @@ class IntRegOperand(Operand): if (self.ctype == 'float' or self.ctype == 'double'): error(0, 'Attempt to read integer register as FP') if (self.size == self.dflt_size): - return '%s = xc->readIntReg(this, %d);\n' % \ + return '%s = xc->readIntRegOperand(this, %d);\n' % \ (self.base_name, self.src_reg_idx) elif (self.size > self.dflt_size): - int_reg_val = 'xc->readIntReg(this, %d)' % (self.src_reg_idx) + int_reg_val = 'xc->readIntRegOperand(this, %d)' % \ + (self.src_reg_idx) if (self.is_signed): int_reg_val = 'sext<%d>(%s)' % (self.dflt_size, int_reg_val) return '%s = %s;\n' % (self.base_name, int_reg_val) else: - return '%s = bits(xc->readIntReg(this, %d), %d, 0);\n' % \ + return '%s = bits(xc->readIntRegOperand(this, %d), %d, 0);\n' % \ (self.base_name, self.src_reg_idx, self.size-1) def makeWrite(self): @@ -1201,7 +1202,7 @@ class IntRegOperand(Operand): wb = ''' { %s final_val = %s; - xc->setIntReg(this, %d, final_val);\n + xc->setIntRegOperand(this, %d, final_val);\n if (traceData) { traceData->setData(final_val); } }''' % (self.dflt_ctype, final_val, self.dest_reg_idx) return wb @@ -1227,13 +1228,13 @@ class FloatRegOperand(Operand): bit_select = 0 width = 0; if (self.ctype == 'float'): - func = 'readFloatReg' + func = 'readFloatRegOperand' width = 32; elif (self.ctype == 'double'): - func = 'readFloatReg' + func = 'readFloatRegOperand' width = 64; else: - func = 'readFloatRegBits' + func = 'readFloatRegOperandBits' if (self.ctype == 'uint32_t'): width = 32; elif (self.ctype == 'uint64_t'): @@ -1259,18 +1260,18 @@ class FloatRegOperand(Operand): width = 0 if (self.ctype == 'float'): width = 32 - func = 'setFloatReg' + func = 'setFloatRegOperand' elif (self.ctype == 'double'): width = 64 - func = 'setFloatReg' + func = 'setFloatRegOperand' elif (self.ctype == 'uint32_t'): - func = 'setFloatRegBits' + func = 'setFloatRegOperandBits' width = 32 elif (self.ctype == 'uint64_t'): - func = 'setFloatRegBits' + func = 'setFloatRegOperandBits' width = 64 else: - func = 'setFloatRegBits' + func = 'setFloatRegOperandBits' final_ctype = 'uint%d_t' % self.dflt_size if (self.size != self.dflt_size and self.is_signed): final_val = 'sext<%d>(%s)' % (self.size, self.base_name) diff --git a/src/arch/mips/isa/formats/fp.isa b/src/arch/mips/isa/formats/fp.isa index cdb892b3f..153f3f949 100644 --- a/src/arch/mips/isa/formats/fp.isa +++ b/src/arch/mips/isa/formats/fp.isa @@ -99,7 +99,7 @@ output exec {{ int size = sizeof(src_op) * 8; for (int i = 0; i < inst->numSrcRegs(); i++) { - uint64_t src_bits = xc->readFloatRegBits(inst, 0, size); + uint64_t src_bits = xc->readFloatRegOperandBits(inst, 0, size); if (isNan(&src_bits, size) ) { if (isSnan(&src_bits, size)) { @@ -113,7 +113,7 @@ output exec {{ mips_nan = src_bits; } - xc->setFloatRegBits(inst, 0, mips_nan, size); + xc->setFloatRegOperandBits(inst, 0, mips_nan, size); if (traceData) { traceData->setData(mips_nan); } return true; } @@ -139,7 +139,7 @@ output exec {{ } //Set value to QNAN - cpu->setFloatRegBits(inst, 0, mips_nan, size); + cpu->setFloatRegOperandBits(inst, 0, mips_nan, size); //Read FCSR from FloatRegFile uint32_t fcsr_bits = cpu->tcBase()->readFloatRegBits(FCSR); diff --git a/src/cpu/base_dyn_inst.hh b/src/cpu/base_dyn_inst.hh index 4a4555566..9037c96df 100644 --- a/src/cpu/base_dyn_inst.hh +++ b/src/cpu/base_dyn_inst.hh @@ -406,14 +406,15 @@ class BaseDynInst : public FastAlloc, public RefCounted double readDoubleResult() { return instResult.dbl; } /** Records an integer register being set to a value. */ - void setIntReg(const StaticInst *si, int idx, uint64_t val) + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { if (recordResult) instResult.integer = val; } /** Records an fp register being set to a value. */ - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width) { if (recordResult) { if (width == 32) @@ -426,21 +427,22 @@ class BaseDynInst : public FastAlloc, public RefCounted } /** Records an fp register being set to a value. */ - void setFloatReg(const StaticInst *si, int idx, FloatReg val) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val) { if (recordResult) instResult.dbl = (double)val; } /** Records an fp register being set to an integer value. */ - void setFloatRegBits(const StaticInst *si, int idx, uint64_t val, int width) + void setFloatRegOperandBits(const StaticInst *si, int idx, uint64_t val, + int width) { if (recordResult) instResult.integer = val; } /** Records an fp register being set to an integer value. */ - void setFloatRegBits(const StaticInst *si, int idx, uint64_t val) + void setFloatRegOperandBits(const StaticInst *si, int idx, uint64_t val) { if (recordResult) instResult.integer = val; diff --git a/src/cpu/checker/cpu.hh b/src/cpu/checker/cpu.hh index 9be54529f..3e08193ee 100644 --- a/src/cpu/checker/cpu.hh +++ b/src/cpu/checker/cpu.hh @@ -216,42 +216,44 @@ class CheckerCPU : public BaseCPU // storage (which is pretty hard to imagine they would have reason // to do). - uint64_t readIntReg(const StaticInst *si, int idx) + uint64_t readIntRegOperand(const StaticInst *si, int idx) { return thread->readIntReg(si->srcRegIdx(idx)); } - FloatReg readFloatReg(const StaticInst *si, int idx, int width) + FloatReg readFloatRegOperand(const StaticInst *si, int idx, int width) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatReg(reg_idx, width); } - FloatReg readFloatReg(const StaticInst *si, int idx) + FloatReg readFloatRegOperand(const StaticInst *si, int idx) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatReg(reg_idx); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx, int width) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx, + int width) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatRegBits(reg_idx, width); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatRegBits(reg_idx); } - void setIntReg(const StaticInst *si, int idx, uint64_t val) + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { thread->setIntReg(si->destRegIdx(idx), val); result.integer = val; } - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatReg(reg_idx, val, width); @@ -265,22 +267,23 @@ class CheckerCPU : public BaseCPU }; } - void setFloatReg(const StaticInst *si, int idx, FloatReg val) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatReg(reg_idx, val); result.dbl = (double)val; } - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val, - int width) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val, int width) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatRegBits(reg_idx, val, width); result.integer = val; } - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatRegBits(reg_idx, val); diff --git a/src/cpu/exec_context.hh b/src/cpu/exec_context.hh index 13f70fa79..edccd747f 100644 --- a/src/cpu/exec_context.hh +++ b/src/cpu/exec_context.hh @@ -48,39 +48,42 @@ class ExecContext { // to do). /** Reads an integer register. */ - uint64_t readIntReg(const StaticInst *si, int idx); + uint64_t readIntRegOperand(const StaticInst *si, int idx); /** Reads a floating point register of a specific width. */ - FloatReg readFloatReg(const StaticInst *si, int idx, int width); + FloatReg readFloatRegOperand(const StaticInst *si, int idx, int width); /** Reads a floating point register of single register width. */ - FloatReg readFloatReg(const StaticInst *si, int idx); + FloatReg readFloatRegOperand(const StaticInst *si, int idx); /** Reads a floating point register of a specific width in its * binary format, instead of by value. */ - FloatRegBits readFloatRegBits(const StaticInst *si, int idx, int width); + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx, + int width); /** Reads a floating point register in its binary format, instead * of by value. */ - FloatRegBits readFloatRegBits(const StaticInst *si, int idx); + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx); /** Sets an integer register to a value. */ - void setIntReg(const StaticInst *si, int idx, uint64_t val); + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val); /** Sets a floating point register of a specific width to a value. */ - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width); + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width); /** Sets a floating point register of single width to a value. */ - void setFloatReg(const StaticInst *si, int idx, FloatReg val); + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val); /** Sets the bits of a floating point register of a specific width * to a binary value. */ - void setFloatRegBits(const StaticInst *si, int idx, - FloatRegBits val, int width); + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val, int width); /** Sets the bits of a floating point register of single width * to a binary value. */ - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val); + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val); /** Reads the PC. */ uint64_t readPC(); diff --git a/src/cpu/o3/alpha/dyn_inst.hh b/src/cpu/o3/alpha/dyn_inst.hh index 31df8ff78..49cc5a201 100644 --- a/src/cpu/o3/alpha/dyn_inst.hh +++ b/src/cpu/o3/alpha/dyn_inst.hh @@ -163,27 +163,28 @@ class AlphaDynInst : public BaseDynInst // storage (which is pretty hard to imagine they would have reason // to do). - uint64_t readIntReg(const StaticInst *si, int idx) + uint64_t readIntRegOperand(const StaticInst *si, int idx) { return this->cpu->readIntReg(_srcRegIdx[idx]); } - FloatReg readFloatReg(const StaticInst *si, int idx, int width) + FloatReg readFloatRegOperand(const StaticInst *si, int idx, int width) { return this->cpu->readFloatReg(_srcRegIdx[idx], width); } - FloatReg readFloatReg(const StaticInst *si, int idx) + FloatReg readFloatRegOperand(const StaticInst *si, int idx) { return this->cpu->readFloatReg(_srcRegIdx[idx]); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx, int width) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx, + int width) { return this->cpu->readFloatRegBits(_srcRegIdx[idx], width); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx) { return this->cpu->readFloatRegBits(_srcRegIdx[idx]); } @@ -191,35 +192,37 @@ class AlphaDynInst : public BaseDynInst /** @todo: Make results into arrays so they can handle multiple dest * registers. */ - void setIntReg(const StaticInst *si, int idx, uint64_t val) + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { this->cpu->setIntReg(_destRegIdx[idx], val); - BaseDynInst::setIntReg(si, idx, val); + BaseDynInst::setIntRegOperand(si, idx, val); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width) { this->cpu->setFloatReg(_destRegIdx[idx], val, width); - BaseDynInst::setFloatReg(si, idx, val, width); + BaseDynInst::setFloatRegOperand(si, idx, val, width); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val) { this->cpu->setFloatReg(_destRegIdx[idx], val); - BaseDynInst::setFloatReg(si, idx, val); + BaseDynInst::setFloatRegOperand(si, idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, - FloatRegBits val, int width) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val, int width) { this->cpu->setFloatRegBits(_destRegIdx[idx], val, width); - BaseDynInst::setFloatRegBits(si, idx, val); + BaseDynInst::setFloatRegOperandBits(si, idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val) { this->cpu->setFloatRegBits(_destRegIdx[idx], val); - BaseDynInst::setFloatRegBits(si, idx, val); + BaseDynInst::setFloatRegOperandBits(si, idx, val); } /** Returns the physical register index of the i'th destination diff --git a/src/cpu/o3/mips/dyn_inst.hh b/src/cpu/o3/mips/dyn_inst.hh index 9e95b2bfb..833371e00 100755 --- a/src/cpu/o3/mips/dyn_inst.hh +++ b/src/cpu/o3/mips/dyn_inst.hh @@ -156,27 +156,28 @@ class MipsDynInst : public BaseDynInst // storage (which is pretty hard to imagine they would have reason // to do). - uint64_t readIntReg(const StaticInst *si, int idx) + uint64_t readIntRegOperand(const StaticInst *si, int idx) { return this->cpu->readIntReg(_srcRegIdx[idx]); } - FloatReg readFloatReg(const StaticInst *si, int idx, int width) + FloatReg readFloatRegOperand(const StaticInst *si, int idx, int width) { return this->cpu->readFloatReg(_srcRegIdx[idx], width); } - FloatReg readFloatReg(const StaticInst *si, int idx) + FloatReg readFloatRegOperand(const StaticInst *si, int idx) { return this->cpu->readFloatReg(_srcRegIdx[idx]); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx, int width) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx, + int width) { return this->cpu->readFloatRegBits(_srcRegIdx[idx], width); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx) { return this->cpu->readFloatRegBits(_srcRegIdx[idx]); } @@ -184,35 +185,37 @@ class MipsDynInst : public BaseDynInst /** @todo: Make results into arrays so they can handle multiple dest * registers. */ - void setIntReg(const StaticInst *si, int idx, uint64_t val) + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { this->cpu->setIntReg(_destRegIdx[idx], val); - BaseDynInst::setIntReg(si, idx, val); + BaseDynInst::setIntRegOperand(si, idx, val); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width) { this->cpu->setFloatReg(_destRegIdx[idx], val, width); - BaseDynInst::setFloatReg(si, idx, val, width); + BaseDynInst::setFloatRegOperand(si, idx, val, width); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val) { this->cpu->setFloatReg(_destRegIdx[idx], val); - BaseDynInst::setFloatReg(si, idx, val); + BaseDynInst::setFloatRegOperand(si, idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, - FloatRegBits val, int width) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val, int width) { this->cpu->setFloatRegBits(_destRegIdx[idx], val, width); - BaseDynInst::setFloatRegBits(si, idx, val); + BaseDynInst::setFloatRegOperandBits(si, idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val) { this->cpu->setFloatRegBits(_destRegIdx[idx], val); - BaseDynInst::setFloatRegBits(si, idx, val); + BaseDynInst::setFloatRegOperandBits(si, idx, val); } /** Returns the physical register index of the i'th destination diff --git a/src/cpu/ozone/dyn_inst.hh b/src/cpu/ozone/dyn_inst.hh index 9445a5309..88f96b14b 100644 --- a/src/cpu/ozone/dyn_inst.hh +++ b/src/cpu/ozone/dyn_inst.hh @@ -146,12 +146,12 @@ class OzoneDynInst : public BaseDynInst // storage (which is pretty hard to imagine they would have reason // to do). - uint64_t readIntReg(const StaticInst *si, int idx) + uint64_t readIntRegOperand(const StaticInst *si, int idx) { return srcInsts[idx]->readIntResult(); } - FloatReg readFloatReg(const StaticInst *si, int idx, int width) + FloatReg readFloatRegOperand(const StaticInst *si, int idx, int width) { switch(width) { case 32: @@ -164,17 +164,18 @@ class OzoneDynInst : public BaseDynInst } } - FloatReg readFloatReg(const StaticInst *si, int idx) + FloatReg readFloatRegOperand(const StaticInst *si, int idx) { return srcInsts[idx]->readFloatResult(); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx, int width) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx, + int width) { return srcInsts[idx]->readIntResult(); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx) { return srcInsts[idx]->readIntResult(); } @@ -182,28 +183,30 @@ class OzoneDynInst : public BaseDynInst /** @todo: Make results into arrays so they can handle multiple dest * registers. */ - void setIntReg(const StaticInst *si, int idx, uint64_t val) + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { BaseDynInst::setIntReg(si, idx, val); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width) { BaseDynInst::setFloatReg(si, idx, val, width); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val) { BaseDynInst::setFloatReg(si, idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, - FloatRegBits val, int width) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val, int width) { BaseDynInst::setFloatRegBits(si, idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val) { BaseDynInst::setFloatRegBits(si, idx, val); } diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index efb884325..c39bfa9cd 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -213,60 +213,63 @@ class BaseSimpleCPU : public BaseCPU // storage (which is pretty hard to imagine they would have reason // to do). - uint64_t readIntReg(const StaticInst *si, int idx) + uint64_t readIntRegOperand(const StaticInst *si, int idx) { return thread->readIntReg(si->srcRegIdx(idx)); } - FloatReg readFloatReg(const StaticInst *si, int idx, int width) + FloatReg readFloatRegOperand(const StaticInst *si, int idx, int width) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatReg(reg_idx, width); } - FloatReg readFloatReg(const StaticInst *si, int idx) + FloatReg readFloatRegOperand(const StaticInst *si, int idx) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatReg(reg_idx); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx, int width) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx, + int width) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatRegBits(reg_idx, width); } - FloatRegBits readFloatRegBits(const StaticInst *si, int idx) + FloatRegBits readFloatRegOperandBits(const StaticInst *si, int idx) { int reg_idx = si->srcRegIdx(idx) - TheISA::FP_Base_DepTag; return thread->readFloatRegBits(reg_idx); } - void setIntReg(const StaticInst *si, int idx, uint64_t val) + void setIntRegOperand(const StaticInst *si, int idx, uint64_t val) { thread->setIntReg(si->destRegIdx(idx), val); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val, int width) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val, + int width) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatReg(reg_idx, val, width); } - void setFloatReg(const StaticInst *si, int idx, FloatReg val) + void setFloatRegOperand(const StaticInst *si, int idx, FloatReg val) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatReg(reg_idx, val); } - void setFloatRegBits(const StaticInst *si, int idx, - FloatRegBits val, int width) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val, int width) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatRegBits(reg_idx, val, width); } - void setFloatRegBits(const StaticInst *si, int idx, FloatRegBits val) + void setFloatRegOperandBits(const StaticInst *si, int idx, + FloatRegBits val) { int reg_idx = si->destRegIdx(idx) - TheISA::FP_Base_DepTag; thread->setFloatRegBits(reg_idx, val); -- cgit v1.2.3 From c7ad7b44eb8c604c5865e3168a10563afa13075e Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Tue, 12 Dec 2006 17:35:46 -0500 Subject: Allow for multiple redirects to happen on a single cycle (only the one for the oldest instruction is passed on to commit). This fixes a minor bug when multiple FU completions come back out of order (due to the order in which the FUs are freed up), and the oldest redirect isn't recorded properly. The eon benchmark should run now. src/cpu/o3/iew_impl.hh: Allow for multiple redirects to happen on a single cycle (only the one for the oldest instruction is passed on to commit). --HG-- extra : convert_revision : b7d202dee1754539ed814f0fac59adb8c6328ee1 --- src/cpu/o3/iew_impl.hh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cpu/o3/iew_impl.hh b/src/cpu/o3/iew_impl.hh index ba5260fe2..76047b295 100644 --- a/src/cpu/o3/iew_impl.hh +++ b/src/cpu/o3/iew_impl.hh @@ -514,6 +514,7 @@ DefaultIEW::squashDueToMemOrder(DynInstPtr &inst, unsigned tid) toCommit->squash[tid] = true; toCommit->squashedSeqNum[tid] = inst->seqNum; toCommit->nextPC[tid] = inst->readNextPC(); + toCommit->branchMispredict[tid] = false; toCommit->includeSquashInst[tid] = false; @@ -530,6 +531,7 @@ DefaultIEW::squashDueToMemBlocked(DynInstPtr &inst, unsigned tid) toCommit->squash[tid] = true; toCommit->squashedSeqNum[tid] = inst->seqNum; toCommit->nextPC[tid] = inst->readPC(); + toCommit->branchMispredict[tid] = false; // Must include the broadcasted SN in the squash. toCommit->includeSquashInst[tid] = true; @@ -1291,7 +1293,8 @@ DefaultIEW::executeInsts() } else if (fault != NoFault) { // If the instruction faulted, then we need to send it along to commit // without the instruction completing. - DPRINTF(IEW, "Store has fault! [sn:%lli]\n", inst->seqNum); + DPRINTF(IEW, "Store has fault %s! [sn:%lli]\n", + fault->name(), inst->seqNum); // Send this instruction to commit, also make sure iew stage // realizes there is activity. @@ -1328,7 +1331,8 @@ DefaultIEW::executeInsts() // instruction first, so the branch resolution order will be correct. unsigned tid = inst->threadNumber; - if (!fetchRedirect[tid]) { + if (!fetchRedirect[tid] || + toCommit->squashedSeqNum[tid] > inst->seqNum) { if (inst->mispredicted()) { fetchRedirect[tid] = true; @@ -1350,8 +1354,6 @@ DefaultIEW::executeInsts() predictedNotTakenIncorrect++; } } else if (ldstQueue.violation(tid)) { - fetchRedirect[tid] = true; - // If there was an ordering violation, then get the // DynInst that caused the violation. Note that this // clears the violation signal. @@ -1362,6 +1364,14 @@ DefaultIEW::executeInsts() "%#x, inst PC: %#x. Addr is: %#x.\n", violator->readPC(), inst->readPC(), inst->physEffAddr); + // Ensure the violating instruction is older than + // current squash + if (fetchRedirect[tid] && + violator->seqNum >= toCommit->squashedSeqNum[tid]) + continue; + + fetchRedirect[tid] = true; + // Tell the instruction queue that a violation has occured. instQueue.violation(inst, violator); -- cgit v1.2.3 From 98bb1c62b31e988f81d9fc03cf14aca25fd008db Mon Sep 17 00:00:00 2001 From: Lisa Hsu Date: Wed, 13 Dec 2006 17:51:28 -0500 Subject: fix MiscRegFile::readRegWithEffect, which neglected the MISCREGS. --HG-- extra : convert_revision : 4fdffe01b8e63e24b97a2e4194c747e6cf5e25ba --- src/arch/alpha/miscregfile.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/arch/alpha/miscregfile.cc b/src/arch/alpha/miscregfile.cc index 962d4609f..67f6c98e4 100644 --- a/src/arch/alpha/miscregfile.cc +++ b/src/arch/alpha/miscregfile.cc @@ -89,12 +89,26 @@ namespace AlphaISA MiscReg MiscRegFile::readRegWithEffect(int misc_reg, ThreadContext *tc) { + switch(misc_reg) { + case MISCREG_FPCR: + return fpcr; + case MISCREG_UNIQ: + return uniq; + case MISCREG_LOCKFLAG: + return lock_flag; + case MISCREG_LOCKADDR: + return lock_addr; + case MISCREG_INTR: + return intr_flag; #if FULL_SYSTEM - return readIpr(misc_reg, tc); + default: + return readIpr(misc_reg, tc); #else - panic("No faulting misc regs in SE mode!"); - return 0; + default: + panic("No faulting misc regs in SE mode!"); + return 0; #endif + } } void -- cgit v1.2.3