2 * Copyright (c) 2002-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Authors: Erik Hallnor
33 * Miss Status and Handling Register (MSHR) declaration.
39 #include "mem/packet.hh"
46 * Miss Status and handling Register. This class keeps all the information
47 * needed to handle a cache miss including a list of target pktuests.
51 /** Defines the Data structure of the MSHR targetlist. */
52 typedef std::list<Packet *> TargetList;
53 /** Target list iterator. */
54 typedef std::list<Packet *>::iterator TargetListIterator;
55 /** A list of MSHRs. */
56 typedef std::list<MSHR *> List;
57 /** MSHR list iterator. */
58 typedef List::iterator Iterator;
59 /** MSHR list const_iterator. */
60 typedef List::const_iterator ConstIterator;
62 /** Address of the miss. */
64 /** Adress space id of the miss. */
66 /** True if the pktuest has been sent to the bus. */
68 /** Thread number of the miss. */
70 /** The pktuest that is forwarded to the next level of the hierarchy. */
72 /** The number of currently allocated targets. */
74 /** The original pktuesting command. */
75 Packet::Command originalCmd;
76 /** Order number of assigned by the miss queue. */
80 * Pointer to this MSHR on the ready list.
81 * @sa MissQueue, MSHRQueue::readyList
85 * Pointer to this MSHR on the allocated list.
86 * @sa MissQueue, MSHRQueue::allocatedList
91 /** List of all pktuests that match the address */
96 * Allocate a miss to this MSHR.
97 * @param cmd The pktuesting command.
98 * @param addr The address of the miss.
99 * @param asid The address space id of the miss.
100 * @param size The number of bytes to pktuest.
101 * @param pkt The original miss.
103 void allocate(Packet::Command cmd, Addr addr, int size,
107 * Allocate this MSHR as a buffer for the given pktuest.
108 * @param target The memory pktuest to buffer.
110 void allocateAsBuffer(Packet * &target);
113 * Mark this MSHR as free.
118 * Add a pktuest to the list of targets.
119 * @param target The target.
121 void allocateTarget(Packet * &target);
123 /** A simple constructor. */
125 /** A simple destructor. */
129 * Returns the current number of allocated targets.
130 * @return The current number of allocated targets.
138 * Returns a pointer to the target list.
139 * @return a pointer to the target list.
141 TargetList* getTargetList()
147 * Returns a reference to the first target.
148 * @return A pointer to the first target.
152 return targets.front();
165 * Returns true if there are targets left.
166 * @return true if there are targets
170 return !targets.empty();
174 * Prints the contents of this MSHR to stderr.