summaryrefslogtreecommitdiff
path: root/src/mem/cache/miss
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@gmail.com>2008-02-10 14:15:42 -0800
committerSteve Reinhardt <stever@gmail.com>2008-02-10 14:15:42 -0800
commitd56e77c180aeca0ff1ba271378424787345ec0b8 (patch)
tree2533f37fd2657cca05c3459aba34e128548c8172 /src/mem/cache/miss
parent6cc1573923754ecb406d03ab4d807f928737c294 (diff)
downloadgem5-d56e77c180aeca0ff1ba271378424787345ec0b8.tar.xz
Rename cache files for brevity and consistency with rest of tree.
--HG-- rename : src/mem/cache/base_cache.cc => src/mem/cache/base.cc rename : src/mem/cache/base_cache.hh => src/mem/cache/base.hh rename : src/mem/cache/cache_blk.cc => src/mem/cache/blk.cc rename : src/mem/cache/cache_blk.hh => src/mem/cache/blk.hh rename : src/mem/cache/cache_builder.cc => src/mem/cache/builder.cc rename : src/mem/cache/miss/mshr.cc => src/mem/cache/mshr.cc rename : src/mem/cache/miss/mshr.hh => src/mem/cache/mshr.hh rename : src/mem/cache/miss/mshr_queue.cc => src/mem/cache/mshr_queue.cc rename : src/mem/cache/miss/mshr_queue.hh => src/mem/cache/mshr_queue.hh rename : src/mem/cache/prefetch/base_prefetcher.cc => src/mem/cache/prefetch/base.cc rename : src/mem/cache/prefetch/base_prefetcher.hh => src/mem/cache/prefetch/base.hh rename : src/mem/cache/prefetch/ghb_prefetcher.cc => src/mem/cache/prefetch/ghb.cc rename : src/mem/cache/prefetch/ghb_prefetcher.hh => src/mem/cache/prefetch/ghb.hh rename : src/mem/cache/prefetch/stride_prefetcher.cc => src/mem/cache/prefetch/stride.cc rename : src/mem/cache/prefetch/stride_prefetcher.hh => src/mem/cache/prefetch/stride.hh rename : src/mem/cache/prefetch/tagged_prefetcher.cc => src/mem/cache/prefetch/tagged.cc rename : src/mem/cache/prefetch/tagged_prefetcher.hh => src/mem/cache/prefetch/tagged.hh rename : src/mem/cache/tags/base_tags.cc => src/mem/cache/tags/base.cc rename : src/mem/cache/tags/base_tags.hh => src/mem/cache/tags/base.hh rename : src/mem/cache/tags/Repl.py => src/mem/cache/tags/iic_repl/Repl.py rename : src/mem/cache/tags/repl/gen.cc => src/mem/cache/tags/iic_repl/gen.cc rename : src/mem/cache/tags/repl/gen.hh => src/mem/cache/tags/iic_repl/gen.hh rename : src/mem/cache/tags/repl/repl.hh => src/mem/cache/tags/iic_repl/repl.hh extra : convert_revision : ff7a35cc155a8d80317563c45cebe405984eac62
Diffstat (limited to 'src/mem/cache/miss')
-rw-r--r--src/mem/cache/miss/SConscript34
-rw-r--r--src/mem/cache/miss/mshr.cc424
-rw-r--r--src/mem/cache/miss/mshr.hh254
-rw-r--r--src/mem/cache/miss/mshr_queue.cc247
-rw-r--r--src/mem/cache/miss/mshr_queue.hh214
5 files changed, 0 insertions, 1173 deletions
diff --git a/src/mem/cache/miss/SConscript b/src/mem/cache/miss/SConscript
deleted file mode 100644
index 376d670cd..000000000
--- a/src/mem/cache/miss/SConscript
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- mode:python -*-
-
-# Copyright (c) 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: Nathan Binkert
-
-Import('*')
-
-Source('mshr.cc')
-Source('mshr_queue.cc')
diff --git a/src/mem/cache/miss/mshr.cc b/src/mem/cache/miss/mshr.cc
deleted file mode 100644
index d711ca537..000000000
--- a/src/mem/cache/miss/mshr.cc
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Copyright (c) 2002-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
- * Dave Greene
- */
-
-/**
- * @file
- * Miss Status and Handling Register (MSHR) definitions.
- */
-
-#include <assert.h>
-#include <string>
-#include <vector>
-#include <algorithm>
-
-#include "mem/cache/miss/mshr.hh"
-#include "sim/core.hh" // for curTick
-#include "sim/host.hh"
-#include "base/misc.hh"
-#include "mem/cache/cache.hh"
-
-using namespace std;
-
-MSHR::MSHR()
-{
- inService = false;
- ntargets = 0;
- threadNum = -1;
- targets = new TargetList();
- deferredTargets = new TargetList();
-}
-
-
-MSHR::TargetList::TargetList()
- : needsExclusive(false), hasUpgrade(false)
-{}
-
-
-inline void
-MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
- Counter order, bool cpuSide, bool markPending)
-{
- if (cpuSide) {
- if (pkt->needsExclusive()) {
- needsExclusive = true;
- }
-
- if (pkt->cmd == MemCmd::UpgradeReq) {
- hasUpgrade = true;
- }
- }
-
- if (markPending) {
- MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState);
- if (mshr != NULL) {
- assert(!mshr->downstreamPending);
- mshr->downstreamPending = true;
- }
- }
-
- push_back(Target(pkt, readyTime, order, cpuSide, markPending));
-}
-
-
-void
-MSHR::TargetList::replaceUpgrades()
-{
- if (!hasUpgrade)
- return;
-
- Iterator end_i = end();
- for (Iterator i = begin(); i != end_i; ++i) {
- if (i->pkt->cmd == MemCmd::UpgradeReq) {
- i->pkt->cmd = MemCmd::ReadExReq;
- DPRINTF(Cache, "Replacing UpgradeReq with ReadExReq\n");
- }
- }
-
- hasUpgrade = false;
-}
-
-
-void
-MSHR::TargetList::clearDownstreamPending()
-{
- Iterator end_i = end();
- for (Iterator i = begin(); i != end_i; ++i) {
- if (i->markedPending) {
- MSHR *mshr = dynamic_cast<MSHR*>(i->pkt->senderState);
- if (mshr != NULL) {
- mshr->clearDownstreamPending();
- }
- }
- }
-}
-
-
-bool
-MSHR::TargetList::checkFunctional(PacketPtr pkt)
-{
- Iterator end_i = end();
- for (Iterator i = begin(); i != end_i; ++i) {
- if (pkt->checkFunctional(i->pkt)) {
- return true;
- }
- }
-
- return false;
-}
-
-
-void
-MSHR::TargetList::
-print(std::ostream &os, int verbosity, const std::string &prefix) const
-{
- ConstIterator end_i = end();
- for (ConstIterator i = begin(); i != end_i; ++i) {
- ccprintf(os, "%s%s: ", prefix, i->isCpuSide() ? "cpu" : "mem");
- i->pkt->print(os, verbosity, "");
- }
-}
-
-
-void
-MSHR::allocate(Addr _addr, int _size, PacketPtr target,
- Tick whenReady, Counter _order)
-{
- addr = _addr;
- size = _size;
- readyTime = whenReady;
- order = _order;
- assert(target);
- isCacheFill = false;
- _isUncacheable = target->req->isUncacheable();
- inService = false;
- downstreamPending = false;
- threadNum = 0;
- ntargets = 1;
- // Don't know of a case where we would allocate a new MSHR for a
- // snoop (mem-side request), so set cpuSide to true here.
- assert(targets->isReset());
- targets->add(target, whenReady, _order, true, true);
- assert(deferredTargets->isReset());
- pendingInvalidate = false;
- pendingShared = false;
- data = NULL;
-}
-
-
-void
-MSHR::clearDownstreamPending()
-{
- assert(downstreamPending);
- downstreamPending = false;
- // recursively clear flag on any MSHRs we will be forwarding
- // responses to
- targets->clearDownstreamPending();
-}
-
-bool
-MSHR::markInService()
-{
- assert(!inService);
- if (isSimpleForward()) {
- // we just forwarded the request packet & don't expect a
- // response, so get rid of it
- assert(getNumTargets() == 1);
- popTarget();
- return true;
- }
- inService = true;
- if (!downstreamPending) {
- // let upstream caches know that the request has made it to a
- // level where it's going to get a response
- targets->clearDownstreamPending();
- }
- return false;
-}
-
-
-void
-MSHR::deallocate()
-{
- assert(targets->empty());
- targets->resetFlags();
- assert(deferredTargets->isReset());
- assert(ntargets == 0);
- inService = false;
- //allocIter = NULL;
- //readyIter = NULL;
-}
-
-/*
- * Adds a target to an MSHR
- */
-void
-MSHR::allocateTarget(PacketPtr pkt, Tick whenReady, Counter _order)
-{
- // if there's a request already in service for this MSHR, we will
- // have to defer the new target until after the response if any of
- // the following are true:
- // - there are other targets already deferred
- // - there's a pending invalidate to be applied after the response
- // comes back (but before this target is processed)
- // - the outstanding request is for a non-exclusive block and this
- // target requires an exclusive block
- if (inService &&
- (!deferredTargets->empty() || pendingInvalidate ||
- (!targets->needsExclusive && pkt->needsExclusive()))) {
- // need to put on deferred list
- deferredTargets->add(pkt, whenReady, _order, true, true);
- } else {
- // No request outstanding, or still OK to append to
- // outstanding request: append to regular target list. Only
- // mark pending if current request hasn't been issued yet
- // (isn't in service).
- targets->add(pkt, whenReady, _order, true, !inService);
- }
-
- ++ntargets;
-}
-
-bool
-MSHR::handleSnoop(PacketPtr pkt, Counter _order)
-{
- if (!inService || (pkt->isExpressSnoop() && downstreamPending)) {
- // Request has not been issued yet, or it's been issued
- // locally but is buffered unissued at some downstream cache
- // which is forwarding us this snoop. Either way, the packet
- // we're snooping logically precedes this MSHR's request, so
- // the snoop has no impact on the MSHR, but must be processed
- // in the standard way by the cache. The only exception is
- // that if we're an L2+ cache buffering an UpgradeReq from a
- // higher-level cache, and the snoop is invalidating, then our
- // buffered upgrades must be converted to read exclusives,
- // since the upper-level cache no longer has a valid copy.
- // That is, even though the upper-level cache got out on its
- // local bus first, some other invalidating transaction
- // reached the global bus before the upgrade did.
- if (pkt->needsExclusive()) {
- targets->replaceUpgrades();
- deferredTargets->replaceUpgrades();
- }
-
- return false;
- }
-
- // From here on down, the request issued by this MSHR logically
- // precedes the request we're snooping.
-
- if (pkt->needsExclusive()) {
- // snooped request still precedes the re-request we'll have to
- // issue for deferred targets, if any...
- deferredTargets->replaceUpgrades();
- }
-
- if (pendingInvalidate) {
- // a prior snoop has already appended an invalidation, so
- // logically we don't have the block anymore; no need for
- // further snooping.
- return true;
- }
-
- if (targets->needsExclusive || pkt->needsExclusive()) {
- // actual target device (typ. PhysicalMemory) will delete the
- // packet on reception, so we need to save a copy here
- PacketPtr cp_pkt = new Packet(pkt, true);
- targets->add(cp_pkt, curTick, _order, false,
- downstreamPending && targets->needsExclusive);
- ++ntargets;
-
- if (targets->needsExclusive) {
- // We're awaiting an exclusive copy, so ownership is pending.
- // It's up to us to respond once the data arrives.
- pkt->assertMemInhibit();
- pkt->setSupplyExclusive();
- } else {
- // Someone else may respond before we get around to
- // processing this snoop, which means the copied request
- // pointer will no longer be valid
- cp_pkt->req = NULL;
- }
-
- if (pkt->needsExclusive()) {
- // This transaction will take away our pending copy
- pendingInvalidate = true;
- }
- } else {
- // Read to a read: no conflict, so no need to record as
- // target, but make sure neither reader thinks he's getting an
- // exclusive copy
- pendingShared = true;
- pkt->assertShared();
- }
-
- return true;
-}
-
-
-bool
-MSHR::promoteDeferredTargets()
-{
- assert(targets->empty());
- if (deferredTargets->empty()) {
- return false;
- }
-
- // swap targets & deferredTargets lists
- TargetList *tmp = targets;
- targets = deferredTargets;
- deferredTargets = tmp;
-
- assert(targets->size() == ntargets);
-
- // clear deferredTargets flags
- deferredTargets->resetFlags();
-
- pendingInvalidate = false;
- pendingShared = false;
- order = targets->front().order;
- readyTime = std::max(curTick, targets->front().readyTime);
-
- return true;
-}
-
-
-void
-MSHR::handleFill(Packet *pkt, CacheBlk *blk)
-{
- if (pendingShared) {
- // we snooped another read while this read was in
- // service... assert shared line on its behalf
- pkt->assertShared();
- }
-
- if (!pkt->sharedAsserted() && !pendingInvalidate
- && deferredTargets->needsExclusive) {
- // We got an exclusive response, but we have deferred targets
- // which are waiting to request an exclusive copy (not because
- // of a pending invalidate). This can happen if the original
- // request was for a read-only (non-exclusive) block, but we
- // got an exclusive copy anyway because of the E part of the
- // MOESI/MESI protocol. Since we got the exclusive copy
- // there's no need to defer the targets, so move them up to
- // the regular target list.
- assert(!targets->needsExclusive);
- targets->needsExclusive = true;
- // if any of the deferred targets were upper-level cache
- // requests marked downstreamPending, need to clear that
- assert(!downstreamPending); // not pending here anymore
- deferredTargets->clearDownstreamPending();
- // this clears out deferredTargets too
- targets->splice(targets->end(), *deferredTargets);
- deferredTargets->resetFlags();
- }
-}
-
-
-bool
-MSHR::checkFunctional(PacketPtr pkt)
-{
- // For printing, we treat the MSHR as a whole as single entity.
- // For other requests, we iterate over the individual targets
- // since that's where the actual data lies.
- if (pkt->isPrint()) {
- pkt->checkFunctional(this, addr, size, NULL);
- return false;
- } else {
- return (targets->checkFunctional(pkt) ||
- deferredTargets->checkFunctional(pkt));
- }
-}
-
-
-void
-MSHR::print(std::ostream &os, int verbosity, const std::string &prefix) const
-{
- ccprintf(os, "%s[%x:%x] %s %s %s state: %s %s %s %s\n",
- prefix, addr, addr+size-1,
- isCacheFill ? "Fill" : "",
- needsExclusive() ? "Excl" : "",
- _isUncacheable ? "Unc" : "",
- inService ? "InSvc" : "",
- downstreamPending ? "DwnPend" : "",
- pendingInvalidate ? "PendInv" : "",
- pendingShared ? "PendShared" : "");
-
- ccprintf(os, "%s Targets:\n", prefix);
- targets->print(os, verbosity, prefix + " ");
- if (!deferredTargets->empty()) {
- ccprintf(os, "%s Deferred Targets:\n", prefix);
- deferredTargets->print(os, verbosity, prefix + " ");
- }
-}
-
-MSHR::~MSHR()
-{
-}
diff --git a/src/mem/cache/miss/mshr.hh b/src/mem/cache/miss/mshr.hh
deleted file mode 100644
index fdb0485cb..000000000
--- a/src/mem/cache/miss/mshr.hh
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2002-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
- */
-
-/**
- * @file
- * Miss Status and Handling Register (MSHR) declaration.
- */
-
-#ifndef __MSHR_HH__
-#define __MSHR_HH__
-
-#include <list>
-
-#include "base/printable.hh"
-#include "mem/packet.hh"
-
-class CacheBlk;
-class MSHRQueue;
-
-/**
- * Miss Status and handling Register. This class keeps all the information
- * needed to handle a cache miss including a list of target requests.
- */
-class MSHR : public Packet::SenderState, public Printable
-{
-
- public:
-
- class Target {
- public:
- Tick recvTime; //!< Time when request was received (for stats)
- Tick readyTime; //!< Time when request is ready to be serviced
- Counter order; //!< Global order (for memory consistency mgmt)
- PacketPtr pkt; //!< Pending request packet.
- bool cpuSide; //!< Did request come from cpu side or mem side?
- bool markedPending; //!< Did we mark upstream MSHR
- //!< as downstreamPending?
-
- bool isCpuSide() const { return cpuSide; }
-
- Target(PacketPtr _pkt, Tick _readyTime, Counter _order,
- bool _cpuSide, bool _markedPending)
- : recvTime(curTick), readyTime(_readyTime), order(_order),
- pkt(_pkt), cpuSide(_cpuSide), markedPending(_markedPending)
- {}
- };
-
- class TargetList : public std::list<Target> {
- /** Target list iterator. */
- typedef std::list<Target>::iterator Iterator;
- typedef std::list<Target>::const_iterator ConstIterator;
-
- public:
- bool needsExclusive;
- bool hasUpgrade;
-
- TargetList();
- void resetFlags() { needsExclusive = hasUpgrade = false; }
- bool isReset() { return !needsExclusive && !hasUpgrade; }
- void add(PacketPtr pkt, Tick readyTime, Counter order,
- bool cpuSide, bool markPending);
- void replaceUpgrades();
- void clearDownstreamPending();
- bool checkFunctional(PacketPtr pkt);
- void print(std::ostream &os, int verbosity,
- const std::string &prefix) const;
- };
-
- /** A list of MSHRs. */
- typedef std::list<MSHR *> List;
- /** MSHR list iterator. */
- typedef List::iterator Iterator;
- /** MSHR list const_iterator. */
- typedef List::const_iterator ConstIterator;
-
- /** Pointer to queue containing this MSHR. */
- MSHRQueue *queue;
-
- /** Cycle when ready to issue */
- Tick readyTime;
-
- /** Order number assigned by the miss queue. */
- Counter order;
-
- /** Address of the request. */
- Addr addr;
-
- /** Size of the request. */
- int size;
-
- /** True if the request has been sent to the bus. */
- bool inService;
-
- /** True if we will be putting the returned block in the cache */
- bool isCacheFill;
-
- /** True if we need to get an exclusive copy of the block. */
- bool needsExclusive() const { return targets->needsExclusive; }
-
- /** True if the request is uncacheable */
- bool _isUncacheable;
-
- bool downstreamPending;
-
- bool pendingInvalidate;
- bool pendingShared;
-
- /** Thread number of the miss. */
- short threadNum;
- /** The number of currently allocated targets. */
- short ntargets;
-
-
- /** Data buffer (if needed). Currently used only for pending
- * upgrade handling. */
- uint8_t *data;
-
- /**
- * Pointer to this MSHR on the ready list.
- * @sa MissQueue, MSHRQueue::readyList
- */
- Iterator readyIter;
-
- /**
- * Pointer to this MSHR on the allocated list.
- * @sa MissQueue, MSHRQueue::allocatedList
- */
- Iterator allocIter;
-
-private:
- /** List of all requests that match the address */
- TargetList *targets;
-
- TargetList *deferredTargets;
-
-public:
-
- bool isUncacheable() { return _isUncacheable; }
-
- /**
- * Allocate a miss to this MSHR.
- * @param cmd The requesting command.
- * @param addr The address of the miss.
- * @param asid The address space id of the miss.
- * @param size The number of bytes to request.
- * @param pkt The original miss.
- */
- void allocate(Addr addr, int size, PacketPtr pkt,
- Tick when, Counter _order);
-
- bool markInService();
-
- void clearDownstreamPending();
-
- /**
- * Mark this MSHR as free.
- */
- void deallocate();
-
- /**
- * Add a request to the list of targets.
- * @param target The target.
- */
- void allocateTarget(PacketPtr target, Tick when, Counter order);
- bool handleSnoop(PacketPtr target, Counter order);
-
- /** A simple constructor. */
- MSHR();
- /** A simple destructor. */
- ~MSHR();
-
- /**
- * Returns the current number of allocated targets.
- * @return The current number of allocated targets.
- */
- int getNumTargets() { return ntargets; }
-
- /**
- * Returns a pointer to the target list.
- * @return a pointer to the target list.
- */
- TargetList *getTargetList() { return targets; }
-
- /**
- * Returns true if there are targets left.
- * @return true if there are targets
- */
- bool hasTargets() { return !targets->empty(); }
-
- /**
- * Returns a reference to the first target.
- * @return A pointer to the first target.
- */
- Target *getTarget() { assert(hasTargets()); return &targets->front(); }
-
- /**
- * Pop first target.
- */
- void popTarget()
- {
- --ntargets;
- targets->pop_front();
- }
-
- bool isSimpleForward()
- {
- if (getNumTargets() != 1)
- return false;
- Target *tgt = getTarget();
- return tgt->isCpuSide() && !tgt->pkt->needsResponse();
- }
-
- bool promoteDeferredTargets();
-
- void handleFill(Packet *pkt, CacheBlk *blk);
-
- bool checkFunctional(PacketPtr pkt);
-
- /**
- * Prints the contents of this MSHR for debugging.
- */
- void print(std::ostream &os,
- int verbosity = 0,
- const std::string &prefix = "") const;
-};
-
-#endif //__MSHR_HH__
diff --git a/src/mem/cache/miss/mshr_queue.cc b/src/mem/cache/miss/mshr_queue.cc
deleted file mode 100644
index 71da7e4c1..000000000
--- a/src/mem/cache/miss/mshr_queue.cc
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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
- */
-
-/** @file
- * Definition of MSHRQueue class functions.
- */
-
-#include "mem/cache/miss/mshr_queue.hh"
-
-using namespace std;
-
-MSHRQueue::MSHRQueue(const std::string &_label,
- int num_entries, int reserve, int _index)
- : label(_label),
- numEntries(num_entries + reserve - 1), numReserve(reserve),
- index(_index)
-{
- allocated = 0;
- inServiceEntries = 0;
- registers = new MSHR[numEntries];
- for (int i = 0; i < numEntries; ++i) {
- registers[i].queue = this;
- freeList.push_back(&registers[i]);
- }
-}
-
-MSHRQueue::~MSHRQueue()
-{
- delete [] registers;
-}
-
-MSHR *
-MSHRQueue::findMatch(Addr addr) const
-{
- MSHR::ConstIterator i = allocatedList.begin();
- MSHR::ConstIterator end = allocatedList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
- if (mshr->addr == addr) {
- return mshr;
- }
- }
- return NULL;
-}
-
-bool
-MSHRQueue::findMatches(Addr addr, vector<MSHR*>& matches) const
-{
- // Need an empty vector
- assert(matches.empty());
- bool retval = false;
- MSHR::ConstIterator i = allocatedList.begin();
- MSHR::ConstIterator end = allocatedList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
- if (mshr->addr == addr) {
- retval = true;
- matches.push_back(mshr);
- }
- }
- return retval;
-}
-
-
-bool
-MSHRQueue::checkFunctional(PacketPtr pkt, Addr blk_addr)
-{
- pkt->pushLabel(label);
- MSHR::ConstIterator i = allocatedList.begin();
- MSHR::ConstIterator end = allocatedList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
- if (mshr->addr == blk_addr && mshr->checkFunctional(pkt)) {
- pkt->popLabel();
- return true;
- }
- }
- pkt->popLabel();
- return false;
-}
-
-
-MSHR *
-MSHRQueue::findPending(Addr addr, int size) const
-{
- MSHR::ConstIterator i = readyList.begin();
- MSHR::ConstIterator end = readyList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
- if (mshr->addr < addr) {
- if (mshr->addr + mshr->size > addr) {
- return mshr;
- }
- } else {
- if (addr + size > mshr->addr) {
- return mshr;
- }
- }
- }
- return NULL;
-}
-
-
-MSHR::Iterator
-MSHRQueue::addToReadyList(MSHR *mshr)
-{
- if (readyList.empty() || readyList.back()->readyTime <= mshr->readyTime) {
- return readyList.insert(readyList.end(), mshr);
- }
-
- MSHR::Iterator i = readyList.begin();
- MSHR::Iterator end = readyList.end();
- for (; i != end; ++i) {
- if ((*i)->readyTime > mshr->readyTime) {
- return readyList.insert(i, mshr);
- }
- }
- assert(false);
- return end; // keep stupid compilers happy
-}
-
-
-MSHR *
-MSHRQueue::allocate(Addr addr, int size, PacketPtr &pkt,
- Tick when, Counter order)
-{
- assert(!freeList.empty());
- MSHR *mshr = freeList.front();
- assert(mshr->getNumTargets() == 0);
- freeList.pop_front();
-
- mshr->allocate(addr, size, pkt, when, order);
- mshr->allocIter = allocatedList.insert(allocatedList.end(), mshr);
- mshr->readyIter = addToReadyList(mshr);
-
- allocated += 1;
- return mshr;
-}
-
-
-void
-MSHRQueue::deallocate(MSHR *mshr)
-{
- deallocateOne(mshr);
-}
-
-MSHR::Iterator
-MSHRQueue::deallocateOne(MSHR *mshr)
-{
- MSHR::Iterator retval = allocatedList.erase(mshr->allocIter);
- freeList.push_front(mshr);
- allocated--;
- if (mshr->inService) {
- inServiceEntries--;
- } else {
- readyList.erase(mshr->readyIter);
- }
- mshr->deallocate();
- return retval;
-}
-
-void
-MSHRQueue::moveToFront(MSHR *mshr)
-{
- if (!mshr->inService) {
- assert(mshr == *(mshr->readyIter));
- readyList.erase(mshr->readyIter);
- mshr->readyIter = readyList.insert(readyList.begin(), mshr);
- }
-}
-
-void
-MSHRQueue::markInService(MSHR *mshr)
-{
- if (mshr->markInService()) {
- deallocate(mshr);
- } else {
- readyList.erase(mshr->readyIter);
- inServiceEntries += 1;
- }
-}
-
-void
-MSHRQueue::markPending(MSHR *mshr)
-{
- assert(mshr->inService);
- mshr->inService = false;
- --inServiceEntries;
- /**
- * @ todo might want to add rerequests to front of pending list for
- * performance.
- */
- mshr->readyIter = addToReadyList(mshr);
-}
-
-void
-MSHRQueue::squash(int threadNum)
-{
- MSHR::Iterator i = allocatedList.begin();
- MSHR::Iterator end = allocatedList.end();
- for (; i != end;) {
- MSHR *mshr = *i;
- if (mshr->threadNum == threadNum) {
- while (mshr->hasTargets()) {
- mshr->popTarget();
- assert(0/*target->req->getThreadNum()*/ == threadNum);
- }
- assert(!mshr->hasTargets());
- assert(mshr->ntargets==0);
- if (!mshr->inService) {
- i = deallocateOne(mshr);
- } else {
- //mshr->pkt->flags &= ~CACHE_LINE_FILL;
- ++i;
- }
- } else {
- ++i;
- }
- }
-}
diff --git a/src/mem/cache/miss/mshr_queue.hh b/src/mem/cache/miss/mshr_queue.hh
deleted file mode 100644
index e04745087..000000000
--- a/src/mem/cache/miss/mshr_queue.hh
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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
- */
-
-/** @file
- * Declaration of a structure to manage MSHRs.
- */
-
-#ifndef __MEM__CACHE__MISS__MSHR_QUEUE_HH__
-#define __MEM__CACHE__MISS__MSHR_QUEUE_HH__
-
-#include <vector>
-
-#include "mem/packet.hh"
-#include "mem/cache/miss/mshr.hh"
-
-/**
- * A Class for maintaining a list of pending and allocated memory requests.
- */
-class MSHRQueue
-{
- private:
- /** Local label (for functional print requests) */
- const std::string label;
-
- /** MSHR storage. */
- MSHR *registers;
- /** Holds pointers to all allocated entries. */
- MSHR::List allocatedList;
- /** Holds pointers to entries that haven't been sent to the bus. */
- MSHR::List readyList;
- /** Holds non allocated entries. */
- MSHR::List freeList;
-
- // Parameters
- /**
- * The total number of entries in this queue. This number is set as the
- * number of entries requested plus (numReserve - 1). This allows for
- * the same number of effective entries while still maintaining the reserve.
- */
- const int numEntries;
-
- /**
- * The number of entries to hold in reserve. This is needed because copy
- * operations can allocate upto 4 entries at one time.
- */
- const int numReserve;
-
- MSHR::Iterator addToReadyList(MSHR *mshr);
-
-
- public:
- /** The number of allocated entries. */
- int allocated;
- /** The number of entries that have been forwarded to the bus. */
- int inServiceEntries;
- /** The index of this queue within the cache (MSHR queue vs. write
- * buffer). */
- const int index;
-
- /**
- * Create a queue with a given number of entries.
- * @param num_entrys The number of entries in this queue.
- * @param reserve The minimum number of entries needed to satisfy
- * any access.
- */
- MSHRQueue(const std::string &_label, int num_entries, int reserve,
- int index);
-
- /** Destructor */
- ~MSHRQueue();
-
- /**
- * Find the first MSHR that matches the provided address.
- * @param addr The address to find.
- * @return Pointer to the matching MSHR, null if not found.
- */
- MSHR *findMatch(Addr addr) const;
-
- /**
- * Find and return all the matching entries in the provided vector.
- * @param addr The address to find.
- * @param matches The vector to return pointers to the matching entries.
- * @return True if any matches are found, false otherwise.
- * @todo Typedef the vector??
- */
- bool findMatches(Addr addr, std::vector<MSHR*>& matches) const;
-
- /**
- * Find any pending requests that overlap the given request.
- * @param pkt The request to find.
- * @return A pointer to the earliest matching MSHR.
- */
- MSHR *findPending(Addr addr, int size) const;
-
- bool checkFunctional(PacketPtr pkt, Addr blk_addr);
-
- /**
- * Allocates a new MSHR for the request and size. This places the request
- * as the first target in the MSHR.
- * @param pkt The request to handle.
- * @param size The number in bytes to fetch from memory.
- * @return The a pointer to the MSHR allocated.
- *
- * @pre There are free entries.
- */
- MSHR *allocate(Addr addr, int size, PacketPtr &pkt,
- Tick when, Counter order);
-
- /**
- * Removes the given MSHR from the queue. This places the MSHR on the
- * free list.
- * @param mshr
- */
- void deallocate(MSHR *mshr);
-
- /**
- * Remove a MSHR from the queue. Returns an iterator into the
- * allocatedList for faster squash implementation.
- * @param mshr The MSHR to remove.
- * @return An iterator to the next entry in the allocatedList.
- */
- MSHR::Iterator deallocateOne(MSHR *mshr);
-
- /**
- * Moves the MSHR to the front of the pending list if it is not
- * in service.
- * @param mshr The entry to move.
- */
- void moveToFront(MSHR *mshr);
-
- /**
- * Mark the given MSHR as in service. This removes the MSHR from the
- * readyList. Deallocates the MSHR if it does not expect a response.
- * @param mshr The MSHR to mark in service.
- */
- void markInService(MSHR *mshr);
-
- /**
- * Mark an in service entry as pending, used to resend a request.
- * @param mshr The MSHR to resend.
- */
- void markPending(MSHR *mshr);
-
- /**
- * Squash outstanding requests with the given thread number. If a request
- * is in service, just squashes the targets.
- * @param threadNum The thread to squash.
- */
- void squash(int threadNum);
-
- /**
- * Returns true if the pending list is not empty.
- * @return True if there are outstanding requests.
- */
- bool havePending() const
- {
- return !readyList.empty();
- }
-
- /**
- * Returns true if there are no free entries.
- * @return True if this queue is full.
- */
- bool isFull() const
- {
- return (allocated > numEntries - numReserve);
- }
-
- /**
- * Returns the MSHR at the head of the readyList.
- * @return The next request to service.
- */
- MSHR *getNextMSHR() const
- {
- if (readyList.empty() || readyList.front()->readyTime > curTick) {
- return NULL;
- }
- return readyList.front();
- }
-
- Tick nextMSHRReadyTime() const
- {
- return readyList.empty() ? MaxTick : readyList.front()->readyTime;
- }
-};
-
-#endif //__MEM__CACHE__MISS__MSHR_QUEUE_HH__