mshr.hh (9663:45df88079f04) mshr.hh (9725:0d4ee33078bb)
1/*
1/*
2 * Copyright (c) 2012 ARM Limited
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 48 unchanged lines hidden (view full) ---

59/**
60 * Miss Status and handling Register. This class keeps all the information
61 * needed to handle a cache miss including a list of target requests.
62 * @sa \ref gem5MemorySystem "gem5 Memory System"
63 */
64class MSHR : public Packet::SenderState, public Printable
65{
66
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 48 unchanged lines hidden (view full) ---

59/**
60 * Miss Status and handling Register. This class keeps all the information
61 * needed to handle a cache miss including a list of target requests.
62 * @sa \ref gem5MemorySystem "gem5 Memory System"
63 */
64class MSHR : public Packet::SenderState, public Printable
65{
66
67 /**
68 * Consider the MSHRQueue a friend to avoid making everything public
69 */
70 friend class MSHRQueue;
71
72 private:
73
74 /** Cycle when ready to issue */
75 Tick readyTime;
76
77 /** True if the request is uncacheable */
78 bool _isUncacheable;
79
80 /** Flag set by downstream caches */
81 bool downstreamPending;
82
83 /** Will we have a dirty copy after this request? */
84 bool pendingDirty;
85
86 /** Did we snoop an invalidate while waiting for data? */
87 bool postInvalidate;
88
89 /** Did we snoop a read while waiting for data? */
90 bool postDowngrade;
91
67 public:
68
69 class Target {
70 public:
71
72 enum Source {
73 FromCPU,
74 FromSnoop,

--- 41 unchanged lines hidden (view full) ---

116 /** MSHR list iterator. */
117 typedef List::iterator Iterator;
118 /** MSHR list const_iterator. */
119 typedef List::const_iterator ConstIterator;
120
121 /** Pointer to queue containing this MSHR. */
122 MSHRQueue *queue;
123
92 public:
93
94 class Target {
95 public:
96
97 enum Source {
98 FromCPU,
99 FromSnoop,

--- 41 unchanged lines hidden (view full) ---

141 /** MSHR list iterator. */
142 typedef List::iterator Iterator;
143 /** MSHR list const_iterator. */
144 typedef List::const_iterator ConstIterator;
145
146 /** Pointer to queue containing this MSHR. */
147 MSHRQueue *queue;
148
124 /** Cycle when ready to issue */
125 Tick readyTime;
126
127 /** Order number assigned by the miss queue. */
128 Counter order;
129
130 /** Address of the request. */
131 Addr addr;
132
133 /** Size of the request. */
134 int size;
135
136 /** True if the request has been sent to the bus. */
137 bool inService;
138
139 /** True if the request is just a simple forward from an upper level */
140 bool isForward;
141
149 /** Order number assigned by the miss queue. */
150 Counter order;
151
152 /** Address of the request. */
153 Addr addr;
154
155 /** Size of the request. */
156 int size;
157
158 /** True if the request has been sent to the bus. */
159 bool inService;
160
161 /** True if the request is just a simple forward from an upper level */
162 bool isForward;
163
142 /** True if we need to get an exclusive copy of the block. */
143 bool needsExclusive() const { return targets->needsExclusive; }
144
145 /** True if the request is uncacheable */
146 bool _isUncacheable;
147
148 bool downstreamPending;
149
150 /** The pending* and post* flags are only valid if inService is
151 * true. Using the accessor functions lets us detect if these
152 * flags are accessed improperly.
153 */
154
164 /** The pending* and post* flags are only valid if inService is
165 * true. Using the accessor functions lets us detect if these
166 * flags are accessed improperly.
167 */
168
155 /** Will we have a dirty copy after this request? */
156 bool pendingDirty;
169 /** True if we need to get an exclusive copy of the block. */
170 bool needsExclusive() const { return targets.needsExclusive; }
171
157 bool isPendingDirty() const {
158 assert(inService); return pendingDirty;
159 }
160
172 bool isPendingDirty() const {
173 assert(inService); return pendingDirty;
174 }
175
161 /** Did we snoop an invalidate while waiting for data? */
162 bool postInvalidate;
163 bool hasPostInvalidate() const {
164 assert(inService); return postInvalidate;
165 }
166
176 bool hasPostInvalidate() const {
177 assert(inService); return postInvalidate;
178 }
179
167 /** Did we snoop a read while waiting for data? */
168 bool postDowngrade;
169 bool hasPostDowngrade() const {
170 assert(inService); return postDowngrade;
171 }
172
173 /** Thread number of the miss. */
174 ThreadID threadNum;
180 bool hasPostDowngrade() const {
181 assert(inService); return postDowngrade;
182 }
183
184 /** Thread number of the miss. */
185 ThreadID threadNum;
175 /** The number of currently allocated targets. */
176 unsigned short ntargets;
177
186
187 private:
178
179 /** Data buffer (if needed). Currently used only for pending
180 * upgrade handling. */
181 uint8_t *data;
182
183 /**
184 * Pointer to this MSHR on the ready list.
185 * @sa MissQueue, MSHRQueue::readyList
186 */
187 Iterator readyIter;
188
189 /**
190 * Pointer to this MSHR on the allocated list.
191 * @sa MissQueue, MSHRQueue::allocatedList
192 */
193 Iterator allocIter;
194
188
189 /** Data buffer (if needed). Currently used only for pending
190 * upgrade handling. */
191 uint8_t *data;
192
193 /**
194 * Pointer to this MSHR on the ready list.
195 * @sa MissQueue, MSHRQueue::readyList
196 */
197 Iterator readyIter;
198
199 /**
200 * Pointer to this MSHR on the allocated list.
201 * @sa MissQueue, MSHRQueue::allocatedList
202 */
203 Iterator allocIter;
204
195private:
196 /** List of all requests that match the address */
205 /** List of all requests that match the address */
197 TargetList *targets;
206 TargetList targets;
198
207
199 TargetList *deferredTargets;
208 TargetList deferredTargets;
200
209
201public:
210 public:
202
211
203 bool isUncacheable() { return _isUncacheable; }
212 bool isUncacheable() const { return _isUncacheable; }
204
205 /**
206 * Allocate a miss to this MSHR.
207 * @param cmd The requesting command.
208 * @param addr The address of the miss.
209 * @param asid The address space id of the miss.
210 * @param size The number of bytes to request.
211 * @param pkt The original miss.

--- 14 unchanged lines hidden (view full) ---

226 * Add a request to the list of targets.
227 * @param target The target.
228 */
229 void allocateTarget(PacketPtr target, Tick when, Counter order);
230 bool handleSnoop(PacketPtr target, Counter order);
231
232 /** A simple constructor. */
233 MSHR();
213
214 /**
215 * Allocate a miss to this MSHR.
216 * @param cmd The requesting command.
217 * @param addr The address of the miss.
218 * @param asid The address space id of the miss.
219 * @param size The number of bytes to request.
220 * @param pkt The original miss.

--- 14 unchanged lines hidden (view full) ---

235 * Add a request to the list of targets.
236 * @param target The target.
237 */
238 void allocateTarget(PacketPtr target, Tick when, Counter order);
239 bool handleSnoop(PacketPtr target, Counter order);
240
241 /** A simple constructor. */
242 MSHR();
234 /** A simple destructor. */
235 ~MSHR();
236
237 /**
238 * Returns the current number of allocated targets.
239 * @return The current number of allocated targets.
240 */
243
244 /**
245 * Returns the current number of allocated targets.
246 * @return The current number of allocated targets.
247 */
241 int getNumTargets() const { return ntargets; }
248 int getNumTargets() const
249 { return targets.size() + deferredTargets.size(); }
242
243 /**
250
251 /**
244 * Returns a pointer to the target list.
245 * @return a pointer to the target list.
246 */
247 TargetList *getTargetList() { return targets; }
248
249 /**
250 * Returns true if there are targets left.
251 * @return true if there are targets
252 */
252 * Returns true if there are targets left.
253 * @return true if there are targets
254 */
253 bool hasTargets() const { return !targets->empty(); }
255 bool hasTargets() const { return !targets.empty(); }
254
255 /**
256 * Returns a reference to the first target.
257 * @return A pointer to the first target.
258 */
256
257 /**
258 * Returns a reference to the first target.
259 * @return A pointer to the first target.
260 */
259 Target *getTarget() const
261 Target *getTarget()
260 {
261 assert(hasTargets());
262 {
263 assert(hasTargets());
262 return &targets->front();
264 return &targets.front();
263 }
264
265 /**
266 * Pop first target.
267 */
268 void popTarget()
269 {
265 }
266
267 /**
268 * Pop first target.
269 */
270 void popTarget()
271 {
270 --ntargets;
271 targets->pop_front();
272 targets.pop_front();
272 }
273
274 bool isForwardNoResponse() const
275 {
276 if (getNumTargets() != 1)
277 return false;
273 }
274
275 bool isForwardNoResponse() const
276 {
277 if (getNumTargets() != 1)
278 return false;
278 Target *tgt = getTarget();
279 const Target *tgt = &targets.front();
279 return tgt->source == Target::FromCPU && !tgt->pkt->needsResponse();
280 }
281
282 bool promoteDeferredTargets();
283
284 void handleFill(Packet *pkt, CacheBlk *blk);
285
286 bool checkFunctional(PacketPtr pkt);

--- 17 unchanged lines hidden ---
280 return tgt->source == Target::FromCPU && !tgt->pkt->needsResponse();
281 }
282
283 bool promoteDeferredTargets();
284
285 void handleFill(Packet *pkt, CacheBlk *blk);
286
287 bool checkFunctional(PacketPtr pkt);

--- 17 unchanged lines hidden ---