1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 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; --- 41 unchanged lines hidden (view full) --- 50 */ 51class MSHR : public Packet::SenderState, public Printable 52{ 53 54 public: 55 56 class Target { 57 public: |
58 59 enum Source { 60 FromCPU, 61 FromSnoop, 62 FromPrefetcher 63 }; 64 |
65 Tick recvTime; //!< Time when request was received (for stats) 66 Tick readyTime; //!< Time when request is ready to be serviced 67 Counter order; //!< Global order (for memory consistency mgmt) 68 PacketPtr pkt; //!< Pending request packet. |
69 Source source; //!< Did request come from cpu, memory, or prefetcher? |
70 bool markedPending; //!< Did we mark upstream MSHR 71 //!< as downstreamPending? 72 |
73 Target(PacketPtr _pkt, Tick _readyTime, Counter _order, |
74 Source _source, bool _markedPending) |
75 : recvTime(curTick), readyTime(_readyTime), order(_order), |
76 pkt(_pkt), source(_source), markedPending(_markedPending) |
77 {} 78 }; 79 80 class TargetList : public std::list<Target> { 81 /** Target list iterator. */ 82 typedef std::list<Target>::iterator Iterator; 83 typedef std::list<Target>::const_iterator ConstIterator; 84 85 public: 86 bool needsExclusive; 87 bool hasUpgrade; 88 89 TargetList(); 90 void resetFlags() { needsExclusive = hasUpgrade = false; } 91 bool isReset() { return !needsExclusive && !hasUpgrade; } 92 void add(PacketPtr pkt, Tick readyTime, Counter order, |
93 Target::Source source, bool markPending); |
94 void replaceUpgrades(); 95 void clearDownstreamPending(); 96 bool checkFunctional(PacketPtr pkt); 97 void print(std::ostream &os, int verbosity, 98 const std::string &prefix) const; 99 }; 100 101 /** A list of MSHRs. */ --- 136 unchanged lines hidden (view full) --- 238 targets->pop_front(); 239 } 240 241 bool isForwardNoResponse() const 242 { 243 if (getNumTargets() != 1) 244 return false; 245 Target *tgt = getTarget(); |
246 return tgt->source == Target::FromCPU && !tgt->pkt->needsResponse(); |
247 } 248 249 bool promoteDeferredTargets(); 250 251 void handleFill(Packet *pkt, CacheBlk *blk); 252 253 bool checkFunctional(PacketPtr pkt); 254 255 /** 256 * Prints the contents of this MSHR for debugging. 257 */ 258 void print(std::ostream &os, 259 int verbosity = 0, 260 const std::string &prefix = "") const; 261}; 262 263#endif //__MSHR_HH__ |