diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2013-07-18 08:31:16 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2013-07-18 08:31:16 -0400 |
commit | d4273cc9a6f3c00566e97ebcd71509ed14477b37 (patch) | |
tree | 9b50625fc5d2bb457a959f379a45687903660237 /src/cpu/o3/fetch_impl.hh | |
parent | 4e8ecd7c6fd0447f563179b5a8fdbb13b562ca9e (diff) | |
download | gem5-d4273cc9a6f3c00566e97ebcd71509ed14477b37.tar.xz |
mem: Set the cache line size on a system level
This patch removes the notion of a peer block size and instead sets
the cache line size on the system level.
Previously the size was set per cache, and communicated through the
interconnect. There were plenty checks to ensure that everyone had the
same size specified, and these checks are now removed. Another benefit
that is not yet harnessed is that the cache line size is now known at
construction time, rather than after the port binding. Hence, the
block size can be locally stored and does not have to be queried every
time it is used.
A follow-on patch updates the configuration scripts accordingly.
Diffstat (limited to 'src/cpu/o3/fetch_impl.hh')
-rw-r--r-- | src/cpu/o3/fetch_impl.hh | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/cpu/o3/fetch_impl.hh b/src/cpu/o3/fetch_impl.hh index 43effa9d7..0445de921 100644 --- a/src/cpu/o3/fetch_impl.hh +++ b/src/cpu/o3/fetch_impl.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 ARM Limited + * Copyright (c) 2010-2013 ARM Limited * All rights reserved. * * The license below extends only to copyright in the software and shall @@ -81,6 +81,8 @@ DefaultFetch<Impl>::DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params) fetchWidth(params->fetchWidth), retryPkt(NULL), retryTid(InvalidThreadID), + cacheBlkSize(cpu->cacheLineSize()), + cacheBlkMask(cacheBlkSize - 1), numThreads(params->numThreads), numFetchingThreads(params->smtNumFetchingThreads), finishTranslationEvent(this) @@ -126,11 +128,17 @@ DefaultFetch<Impl>::DefaultFetch(O3CPU *_cpu, DerivO3CPUParams *params) instSize = sizeof(TheISA::MachInst); for (int i = 0; i < Impl::MaxThreads; i++) { - cacheData[i] = NULL; decoder[i] = new TheISA::Decoder; } branchPred = params->branchPred; + + for (ThreadID tid = 0; tid < numThreads; tid++) { + // Create space to store a cache line. + cacheData[tid] = new uint8_t[cacheBlkSize]; + cacheDataPC[tid] = 0; + cacheDataValid[tid] = false; + } } template <class Impl> @@ -336,34 +344,6 @@ DefaultFetch<Impl>::resetStage() wroteToTimeBuffer = false; _status = Inactive; - - // this CPU could still be unconnected if we are restoring from a - // checkpoint and this CPU is to be switched in, thus we can only - // do this here if the instruction port is actually connected, if - // not we have to do it as part of takeOverFrom. - if (cpu->getInstPort().isConnected()) - setIcache(); -} - -template<class Impl> -void -DefaultFetch<Impl>::setIcache() -{ - assert(cpu->getInstPort().isConnected()); - - // Size of cache block. - cacheBlkSize = cpu->getInstPort().peerBlockSize(); - - // Create mask to get rid of offset bits. - cacheBlkMask = (cacheBlkSize - 1); - - for (ThreadID tid = 0; tid < numThreads; tid++) { - // Create space to store a cache line. - if (!cacheData[tid]) - cacheData[tid] = new uint8_t[cacheBlkSize]; - cacheDataPC[tid] = 0; - cacheDataValid[tid] = false; - } } template<class Impl> |