mshr.cc (11286:2071db8f864b) mshr.cc (11375:f98df9231cdd)
1/*
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
2 * Copyright (c) 2012-2013, 2015-2016 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

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

56#include "base/types.hh"
57#include "debug/Cache.hh"
58#include "mem/cache/cache.hh"
59#include "mem/cache/mshr.hh"
60#include "sim/core.hh"
61
62using namespace std;
63
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

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

56#include "base/types.hh"
57#include "debug/Cache.hh"
58#include "mem/cache/cache.hh"
59#include "mem/cache/mshr.hh"
60#include "sim/core.hh"
61
62using namespace std;
63
64MSHR::MSHR() : readyTime(0), _isUncacheable(false), downstreamPending(false),
64MSHR::MSHR() : downstreamPending(false),
65 pendingModified(false),
66 postInvalidate(false), postDowngrade(false),
65 pendingModified(false),
66 postInvalidate(false), postDowngrade(false),
67 queue(NULL), order(0), blkAddr(0),
68 blkSize(0), isSecure(false), inService(false),
69 isForward(false), allocOnFill(false),
70 data(NULL)
67 isForward(false), allocOnFill(false)
71{
72}
73
68{
69}
70
74
75MSHR::TargetList::TargetList()
76 : needsWritable(false), hasUpgrade(false)
77{}
78
79
80inline void
81MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
82 Counter order, Target::Source source, bool markPending)

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

234 downstreamPending = false;
235 assert(targets.isReset());
236 // Don't know of a case where we would allocate a new MSHR for a
237 // snoop (mem-side request), so set source according to request here
238 Target::Source source = (target->cmd == MemCmd::HardPFReq) ?
239 Target::FromPrefetcher : Target::FromCPU;
240 targets.add(target, when_ready, _order, source, true);
241 assert(deferredTargets.isReset());
71MSHR::TargetList::TargetList()
72 : needsWritable(false), hasUpgrade(false)
73{}
74
75
76inline void
77MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
78 Counter order, Target::Source source, bool markPending)

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

230 downstreamPending = false;
231 assert(targets.isReset());
232 // Don't know of a case where we would allocate a new MSHR for a
233 // snoop (mem-side request), so set source according to request here
234 Target::Source source = (target->cmd == MemCmd::HardPFReq) ?
235 Target::FromPrefetcher : Target::FromCPU;
236 targets.add(target, when_ready, _order, source, true);
237 assert(deferredTargets.isReset());
242 data = NULL;
243}
244
245
246void
247MSHR::clearDownstreamPending()
248{
249 assert(downstreamPending);
250 downstreamPending = false;
251 // recursively clear flag on any MSHRs we will be forwarding
252 // responses to
253 targets.clearDownstreamPending();
254}
255
238}
239
240
241void
242MSHR::clearDownstreamPending()
243{
244 assert(downstreamPending);
245 downstreamPending = false;
246 // recursively clear flag on any MSHRs we will be forwarding
247 // responses to
248 targets.clearDownstreamPending();
249}
250
256bool
251void
257MSHR::markInService(bool pending_modified_resp)
258{
259 assert(!inService);
252MSHR::markInService(bool pending_modified_resp)
253{
254 assert(!inService);
260 if (isForwardNoResponse()) {
261 // we just forwarded the request packet & don't expect a
262 // response, so get rid of it
263 assert(getNumTargets() == 1);
264 popTarget();
265 return true;
266 }
267
268 inService = true;
269 pendingModified = targets.needsWritable || pending_modified_resp;
270 postInvalidate = postDowngrade = false;
271
272 if (!downstreamPending) {
273 // let upstream caches know that the request has made it to a
274 // level where it's going to get a response
275 targets.clearDownstreamPending();
276 }
255
256 inService = true;
257 pendingModified = targets.needsWritable || pending_modified_resp;
258 postInvalidate = postDowngrade = false;
259
260 if (!downstreamPending) {
261 // let upstream caches know that the request has made it to a
262 // level where it's going to get a response
263 targets.clearDownstreamPending();
264 }
277 return false;
278}
279
280
281void
282MSHR::deallocate()
283{
284 assert(targets.empty());
285 targets.resetFlags();

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

507 pkt->checkFunctional(this, blkAddr, isSecure, blkSize, NULL);
508 return false;
509 } else {
510 return (targets.checkFunctional(pkt) ||
511 deferredTargets.checkFunctional(pkt));
512 }
513}
514
265}
266
267
268void
269MSHR::deallocate()
270{
271 assert(targets.empty());
272 targets.resetFlags();

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

494 pkt->checkFunctional(this, blkAddr, isSecure, blkSize, NULL);
495 return false;
496 } else {
497 return (targets.checkFunctional(pkt) ||
498 deferredTargets.checkFunctional(pkt));
499 }
500}
501
502bool
503MSHR::sendPacket(Cache &cache)
504{
505 return cache.sendMSHRQueuePacket(this);
506}
515
516void
517MSHR::print(std::ostream &os, int verbosity, const std::string &prefix) const
518{
519 ccprintf(os, "%s[%#llx:%#llx](%s) %s %s %s state: %s %s %s %s %s\n",
520 prefix, blkAddr, blkAddr + blkSize - 1,
521 isSecure ? "s" : "ns",
522 isForward ? "Forward" : "",
523 allocOnFill ? "AllocOnFill" : "",
507
508void
509MSHR::print(std::ostream &os, int verbosity, const std::string &prefix) const
510{
511 ccprintf(os, "%s[%#llx:%#llx](%s) %s %s %s state: %s %s %s %s %s\n",
512 prefix, blkAddr, blkAddr + blkSize - 1,
513 isSecure ? "s" : "ns",
514 isForward ? "Forward" : "",
515 allocOnFill ? "AllocOnFill" : "",
524 isForwardNoResponse() ? "ForwNoResp" : "",
525 needsWritable() ? "Wrtbl" : "",
526 _isUncacheable ? "Unc" : "",
527 inService ? "InSvc" : "",
528 downstreamPending ? "DwnPend" : "",
529 hasPostInvalidate() ? "PostInv" : "",
530 hasPostDowngrade() ? "PostDowngr" : "");
531
532 ccprintf(os, "%s Targets:\n", prefix);

--- 14 unchanged lines hidden ---
516 needsWritable() ? "Wrtbl" : "",
517 _isUncacheable ? "Unc" : "",
518 inService ? "InSvc" : "",
519 downstreamPending ? "DwnPend" : "",
520 hasPostInvalidate() ? "PostInv" : "",
521 hasPostDowngrade() ? "PostDowngr" : "");
522
523 ccprintf(os, "%s Targets:\n", prefix);

--- 14 unchanged lines hidden ---