gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-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
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2006 The Regents of The University of Michigan
15  * Copyright (c) 2010,2015 Advanced Micro Devices, Inc.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Authors: Ron Dreslinski
42  * Steve Reinhardt
43  * Ali Saidi
44  * Andreas Hansson
45  */
46 
52 #ifndef __MEM_PACKET_HH__
53 #define __MEM_PACKET_HH__
54 
55 #include <bitset>
56 #include <cassert>
57 #include <list>
58 
59 #include "base/cast.hh"
60 #include "base/compiler.hh"
61 #include "base/flags.hh"
62 #include "base/misc.hh"
63 #include "base/printable.hh"
64 #include "base/types.hh"
65 #include "mem/request.hh"
66 #include "sim/core.hh"
67 
68 class Packet;
69 typedef Packet *PacketPtr;
70 typedef uint8_t* PacketDataPtr;
72 
73 class MemCmd
74 {
75  friend class Packet;
76 
77  public:
81  enum Command
82  {
98  SCUpgradeReq, // Special "weak" upgrade for StoreCond
100  SCUpgradeFailReq, // Failed SCUpgradeReq in MSHR (never sent)
101  UpgradeFailResp, // Valid for SCUpgradeReq only
108  StoreCondFailReq, // Failed StoreCondReq in MSHR (never sent)
116  // Error responses
117  // @TODO these should be classified as responses rather than
118  // requests; coding them as requests initially for backwards
119  // compatibility
120  InvalidDestError, // packet dest field invalid
121  BadAddressError, // memory address invalid
122  FunctionalReadError, // unable to fulfill functional read
123  FunctionalWriteError, // unable to fulfill functional write
124  // Fake simulator-only commands
125  PrintReq, // Print state matching address
126  FlushReq, //request for a cache flush
127  InvalidateReq, // request for address to be invalidated
130  };
131 
132  private:
137  {
156  };
157 
162  struct CommandInfo
163  {
165  const std::bitset<NUM_COMMAND_ATTRIBUTES> attributes;
170  const std::string str;
171  };
172 
174  static const CommandInfo commandInfo[];
175 
176  private:
177 
179 
180  bool
182  {
183  return commandInfo[cmd].attributes[attrib] != 0;
184  }
185 
186  public:
187 
188  bool isRead() const { return testCmdAttrib(IsRead); }
189  bool isWrite() const { return testCmdAttrib(IsWrite); }
190  bool isUpgrade() const { return testCmdAttrib(IsUpgrade); }
191  bool isRequest() const { return testCmdAttrib(IsRequest); }
192  bool isResponse() const { return testCmdAttrib(IsResponse); }
193  bool needsWritable() const { return testCmdAttrib(NeedsWritable); }
194  bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
195  bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
196  bool isEviction() const { return testCmdAttrib(IsEviction); }
197  bool fromCache() const { return testCmdAttrib(FromCache); }
198 
202  bool isWriteback() const { return testCmdAttrib(IsEviction) &&
204 
210  bool hasData() const { return testCmdAttrib(HasData); }
211  bool isLLSC() const { return testCmdAttrib(IsLlsc); }
212  bool isSWPrefetch() const { return testCmdAttrib(IsSWPrefetch); }
213  bool isHWPrefetch() const { return testCmdAttrib(IsHWPrefetch); }
214  bool isPrefetch() const { return testCmdAttrib(IsSWPrefetch) ||
216  bool isError() const { return testCmdAttrib(IsError); }
217  bool isPrint() const { return testCmdAttrib(IsPrint); }
218  bool isFlush() const { return testCmdAttrib(IsFlush); }
219 
220  Command
222  {
223  return commandInfo[cmd].response;
224  }
225 
227  const std::string &toString() const { return commandInfo[cmd].str; }
228  int toInt() const { return (int)cmd; }
229 
230  MemCmd(Command _cmd) : cmd(_cmd) { }
231  MemCmd(int _cmd) : cmd((Command)_cmd) { }
233 
234  bool operator==(MemCmd c2) const { return (cmd == c2.cmd); }
235  bool operator!=(MemCmd c2) const { return (cmd != c2.cmd); }
236 };
237 
245 class Packet : public Printable
246 {
247  public:
248  typedef uint32_t FlagsType;
249  typedef ::Flags<FlagsType> Flags;
250 
251  private:
252 
253  enum : FlagsType {
254  // Flags to transfer across when copying a packet
255  COPY_FLAGS = 0x0000000F,
256 
257  // Does this packet have sharers (which means it should not be
258  // considered writable) or not. See setHasSharers below.
259  HAS_SHARERS = 0x00000001,
260 
261  // Special control flags
263  EXPRESS_SNOOP = 0x00000002,
264 
269 
270  // Snoop co-ordination flag to indicate that a cache is
271  // responding to a snoop. See setCacheResponding below.
272  CACHE_RESPONDING = 0x00000008,
273 
275  VALID_ADDR = 0x00000100,
276  VALID_SIZE = 0x00000200,
277 
280  STATIC_DATA = 0x00001000,
284  DYNAMIC_DATA = 0x00002000,
285 
288  SUPPRESS_FUNC_ERROR = 0x00008000,
289 
290  // Signal block present to squash prefetch and cache evict packets
291  // through express snoop flag
292  BLOCK_CACHED = 0x00010000
293  };
294 
296 
297  public:
299 
302 
305 
306  private:
315 
319 
321  bool _isSecure;
322 
324  unsigned size;
325 
330 
331  public:
332 
340  uint32_t headerDelay;
341 
348  uint32_t snoopDelay;
349 
358  uint32_t payloadDelay;
359 
377  struct SenderState
378  {
381  virtual ~SenderState() {}
382  };
383 
388  class PrintReqState : public SenderState
389  {
390  private:
395  {
396  const std::string label;
397  std::string *prefix;
399  LabelStackEntry(const std::string &_label, std::string *_prefix);
400  };
401 
404 
405  std::string *curPrefixPtr;
406 
407  public:
408  std::ostream &os;
409  const int verbosity;
410 
411  PrintReqState(std::ostream &os, int verbosity = 0);
412  ~PrintReqState();
413 
417  const std::string &curPrefix() { return *curPrefixPtr; }
418 
424  void pushLabel(const std::string &lbl,
425  const std::string &prefix = " ");
426 
430  void popLabel();
431 
437  void printLabels();
438 
443  void printObj(Printable *obj);
444  };
445 
455 
464  void pushSenderState(SenderState *sender_state);
465 
475 
483  template <typename T>
485  {
486  T *t = NULL;
487  SenderState* sender_state = senderState;
488  while (t == NULL && sender_state != NULL) {
489  t = dynamic_cast<T*>(sender_state);
490  sender_state = sender_state->predecessor;
491  }
492  return t;
493  }
494 
497  const std::string &cmdString() const { return cmd.toString(); }
498 
500  inline int cmdToIndex() const { return cmd.toInt(); }
501 
502  bool isRead() const { return cmd.isRead(); }
503  bool isWrite() const { return cmd.isWrite(); }
504  bool isUpgrade() const { return cmd.isUpgrade(); }
505  bool isRequest() const { return cmd.isRequest(); }
506  bool isResponse() const { return cmd.isResponse(); }
507  bool needsWritable() const
508  {
509  // we should never check if a response needsWritable, the
510  // request has this flag, and for a response we should rather
511  // look at the hasSharers flag (if not set, the response is to
512  // be considered writable)
513  assert(isRequest());
514  return cmd.needsWritable();
515  }
516  bool needsResponse() const { return cmd.needsResponse(); }
517  bool isInvalidate() const { return cmd.isInvalidate(); }
518  bool isEviction() const { return cmd.isEviction(); }
519  bool fromCache() const { return cmd.fromCache(); }
520  bool isWriteback() const { return cmd.isWriteback(); }
521  bool hasData() const { return cmd.hasData(); }
522  bool hasRespData() const
523  {
524  MemCmd resp_cmd = cmd.responseCommand();
525  return resp_cmd.hasData();
526  }
527  bool isLLSC() const { return cmd.isLLSC(); }
528  bool isError() const { return cmd.isError(); }
529  bool isPrint() const { return cmd.isPrint(); }
530  bool isFlush() const { return cmd.isFlush(); }
531 
533 
553  {
554  assert(isRequest());
555  assert(!flags.isSet(CACHE_RESPONDING));
557  }
558  bool cacheResponding() const { return flags.isSet(CACHE_RESPONDING); }
585  bool hasSharers() const { return flags.isSet(HAS_SHARERS); }
587 
601  bool isExpressSnoop() const { return flags.isSet(EXPRESS_SNOOP); }
602 
613  {
614  assert(cacheResponding());
615  assert(!responderHadWritable());
617  }
618  bool responderHadWritable() const
619  { return flags.isSet(RESPONDER_HAD_WRITABLE); }
620 
624  bool isBlockCached() const { return flags.isSet(BLOCK_CACHED); }
626 
627  // Network error conditions... encapsulate them as methods since
628  // their encoding keeps changing (from result field to command
629  // field, etc.)
630  void
632  {
633  assert(isResponse());
635  }
636 
637  void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
638 
639  Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }
647  void setAddr(Addr _addr) { assert(flags.isSet(VALID_ADDR)); addr = _addr; }
648 
649  unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; }
650 
651  Addr getOffset(unsigned int blk_size) const
652  {
653  return getAddr() & Addr(blk_size - 1);
654  }
655 
656  Addr getBlockAddr(unsigned int blk_size) const
657  {
658  return getAddr() & ~(Addr(blk_size - 1));
659  }
660 
661  bool isSecure() const
662  {
663  assert(flags.isSet(VALID_ADDR));
664  return _isSecure;
665  }
666 
671  bool isAtomicOp() const { return req->isAtomic(); }
672 
677  void
679  {
680  assert(isLLSC());
681  assert(isWrite());
683  }
684 
689  void
691  {
692  assert(isLLSC());
693  assert(isRead());
695  }
696 
702  Packet(const RequestPtr _req, MemCmd _cmd)
703  : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false),
704  size(0), headerDelay(0), snoopDelay(0), payloadDelay(0),
705  senderState(NULL)
706  {
707  if (req->hasPaddr()) {
708  addr = req->getPaddr();
710  _isSecure = req->isSecure();
711  }
712  if (req->hasSize()) {
713  size = req->getSize();
715  }
716  }
717 
723  Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize)
724  : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false),
726  senderState(NULL)
727  {
728  if (req->hasPaddr()) {
729  addr = req->getPaddr() & ~(_blkSize - 1);
731  _isSecure = req->isSecure();
732  }
733  size = _blkSize;
735  }
736 
744  Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data)
745  : cmd(pkt->cmd), req(pkt->req),
746  data(nullptr),
747  addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size),
748  bytesValid(pkt->bytesValid),
749  headerDelay(pkt->headerDelay),
750  snoopDelay(0),
753  {
754  if (!clear_flags)
755  flags.set(pkt->flags & COPY_FLAGS);
756 
757  flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE));
758 
759  // should we allocate space for data, or not, the express
760  // snoops do not need to carry any data as they only serve to
761  // co-ordinate state changes
762  if (alloc_data) {
763  // even if asked to allocate data, if the original packet
764  // holds static data, then the sender will not be doing
765  // any memcpy on receiving the response, thus we simply
766  // carry the pointer forward
767  if (pkt->flags.isSet(STATIC_DATA)) {
768  data = pkt->data;
770  } else {
771  allocate();
772  }
773  }
774  }
775 
779  static MemCmd
781  {
782  if (req->isLLSC())
783  return MemCmd::LoadLockedReq;
784  else if (req->isPrefetch())
785  return MemCmd::SoftPFReq;
786  else
787  return MemCmd::ReadReq;
788  }
789 
793  static MemCmd
795  {
796  if (req->isLLSC())
797  return MemCmd::StoreCondReq;
798  else if (req->isSwap())
799  return MemCmd::SwapReq;
800  else
801  return MemCmd::WriteReq;
802  }
803 
808  static PacketPtr
810  {
811  return new Packet(req, makeReadCmd(req));
812  }
813 
814  static PacketPtr
816  {
817  return new Packet(req, makeWriteCmd(req));
818  }
819 
824  {
825  // Delete the request object if this is a request packet which
826  // does not need a response, because the requester will not get
827  // a chance. If the request packet needs a response then the
828  // request will be deleted on receipt of the response
829  // packet. We also make sure to never delete the request for
830  // express snoops, even for cases when responses are not
831  // needed (CleanEvict and Writeback), since the snoop packet
832  // re-uses the same request.
833  if (req && isRequest() && !needsResponse() &&
834  !isExpressSnoop()) {
835  delete req;
836  }
837  deleteData();
838  }
839 
844  void
846  {
847  assert(needsResponse());
848  assert(isRequest());
849  cmd = cmd.responseCommand();
850 
851  // responses are never express, even if the snoop that
852  // triggered them was
854  }
855 
856  void
858  {
859  makeResponse();
860  }
861 
862  void
864  {
865  makeResponse();
866  }
867 
868  void
870  {
871  if (!success) {
872  if (isWrite()) {
874  } else {
876  }
877  }
878  }
879 
880  void
881  setSize(unsigned size)
882  {
883  assert(!flags.isSet(VALID_SIZE));
884 
885  this->size = size;
887  }
888 
889 
890  public:
907  template <typename T>
908  void
910  {
912  data = (PacketDataPtr)p;
914  }
915 
924  template <typename T>
925  void
926  dataStaticConst(const T *p)
927  {
929  data = const_cast<PacketDataPtr>(p);
931  }
932 
945  template <typename T>
946  void
948  {
950  data = (PacketDataPtr)p;
952  }
953 
957  template <typename T>
958  T*
960  {
962  return (T*)data;
963  }
964 
965  template <typename T>
966  const T*
967  getConstPtr() const
968  {
970  return (const T*)data;
971  }
972 
977  template <typename T>
978  T getBE() const;
979 
984  template <typename T>
985  T getLE() const;
986 
991  template <typename T>
992  T get(ByteOrder endian) const;
993 
998  template <typename T>
999  T get() const;
1000 
1002  template <typename T>
1003  void setBE(T v);
1004 
1006  template <typename T>
1007  void setLE(T v);
1008 
1013  template <typename T>
1014  void set(T v, ByteOrder endian);
1015 
1017  template <typename T>
1018  void set(T v);
1019 
1023  void
1024  setData(const uint8_t *p)
1025  {
1026  // we should never be copying data onto itself, which means we
1027  // must idenfity packets with static data, as they carry the
1028  // same pointer from source to destination and back
1029  assert(p != getPtr<uint8_t>() || flags.isSet(STATIC_DATA));
1030 
1031  if (p != getPtr<uint8_t>())
1032  // for packet with allocated dynamic data, we copy data from
1033  // one to the other, e.g. a forwarded response to a response
1034  std::memcpy(getPtr<uint8_t>(), p, getSize());
1035  }
1036 
1041  void
1042  setDataFromBlock(const uint8_t *blk_data, int blkSize)
1043  {
1044  setData(blk_data + getOffset(blkSize));
1045  }
1046 
1051  void
1052  writeData(uint8_t *p) const
1053  {
1054  std::memcpy(p, getConstPtr<uint8_t>(), getSize());
1055  }
1056 
1060  void
1061  writeDataToBlock(uint8_t *blk_data, int blkSize) const
1062  {
1063  writeData(blk_data + getOffset(blkSize));
1064  }
1065 
1070  void
1072  {
1073  if (flags.isSet(DYNAMIC_DATA))
1074  delete [] data;
1075 
1077  data = NULL;
1078  }
1079 
1081  void
1083  {
1084  // if either this command or the response command has a data
1085  // payload, actually allocate space
1086  if (hasData() || hasRespData()) {
1089  data = new uint8_t[getSize()];
1090  }
1091  }
1092 
1095  private: // Private data accessor methods
1097  template <typename T>
1098  T getRaw() const;
1099 
1101  template <typename T>
1102  void setRaw(T v);
1103 
1104  public:
1114  bool
1116  {
1117  // all packets that are carrying a payload should have a valid
1118  // data pointer
1119  return checkFunctional(other, other->getAddr(), other->isSecure(),
1120  other->getSize(),
1121  other->hasData() ?
1122  other->getPtr<uint8_t>() : NULL);
1123  }
1124 
1129  bool
1131  {
1132  return cmd == MemCmd::HardPFReq || isEviction();
1133  }
1134 
1139  bool
1141  {
1143  }
1144 
1152  bool
1153  checkFunctional(Printable *obj, Addr base, bool is_secure, int size,
1154  uint8_t *_data);
1155 
1159  void
1160  pushLabel(const std::string &lbl)
1161  {
1162  if (isPrint())
1164  }
1165 
1169  void
1171  {
1172  if (isPrint())
1174  }
1175 
1176  void print(std::ostream &o, int verbosity = 0,
1177  const std::string &prefix = "") const;
1178 
1185  std::string print() const;
1186 };
1187 
1188 #endif //__MEM_PACKET_HH
bool isSecure() const
Definition: packet.hh:661
Alpha/MIPS LL or SC access.
Definition: packet.hh:149
bool needsWritable() const
Definition: packet.hh:193
MemCmd(int _cmd)
Definition: packet.hh:231
bool isLLSC() const
Definition: packet.hh:527
Requires writable copy to complete in-cache.
Definition: packet.hh:142
std::vector< bool > bytesValid
Track the bytes found that satisfy a functional read.
Definition: packet.hh:329
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
void setResponderHadWritable()
On responding to a snoop request (which only happens for Modified or Owned lines), make sure that we can transform an Owned response to a Modified one.
Definition: packet.hh:612
void setSize(unsigned size)
Definition: packet.hh:881
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag...
Definition: packet.hh:584
Data flows from requester to responder.
Definition: packet.hh:139
Bitfield< 28 > v
Definition: miscregs.hh:1366
MemCmd::Command Command
Definition: packet.hh:298
bool isBlockCached() const
Definition: packet.hh:624
The data pointer points to a value that should be freed when the packet is destroyed.
Definition: packet.hh:284
bool isPrint() const
Definition: packet.hh:529
Definition: packet.hh:73
bool testCmdAttrib(MemCmd::Attribute attrib) const
Definition: packet.hh:181
There is an associated payload.
Definition: packet.hh:150
void setSuppressFuncError()
Definition: packet.hh:621
bool fromCache() const
Definition: packet.hh:197
Is the data pointer set to a value that shouldn't be freed when the packet is destroyed?
Definition: packet.hh:280
Object used to maintain state of a PrintReq.
Definition: packet.hh:388
Packet(const RequestPtr _req, MemCmd _cmd)
Constructor.
Definition: packet.hh:702
uint32_t snoopDelay
Keep track of the extra delay incurred by snooping upwards before sending a request down the memory s...
Definition: packet.hh:348
void makeTimingResponse()
Definition: packet.hh:863
Flush the address from caches.
Definition: packet.hh:153
LabelStackEntry(const std::string &_label, std::string *_prefix)
Definition: packet.cc:378
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
Definition: packet.cc:358
::Flags< FlagsType > Flags
Definition: packet.hh:249
bool isExpressSnoop() const
Definition: packet.hh:601
bool isWriteback() const
A writeback is an eviction that carries data.
Definition: packet.hh:202
uint8_t * PacketDataPtr
Definition: packet.hh:70
LabelStack labelStack
Definition: packet.hh:403
Bitfield< 6 > c2
Addr getBlockAddr(unsigned int blk_size) const
Definition: packet.hh:656
void clear()
Definition: flags.hh:68
bool hasData() const
Definition: packet.hh:521
bool hasSize() const
Accessor for size.
Definition: request.hh:546
bool isWrite() const
Definition: packet.hh:503
bool isSet() const
Definition: flags.hh:62
suppress the error if this packet encounters a functional access failure.
Definition: packet.hh:288
void setRaw(T v)
Set the value in the data pointer to v without byte swapping.
bool isInvalidate() const
Definition: packet.hh:195
Requester needs response from target.
Definition: packet.hh:145
bool fromCache() const
Definition: packet.hh:519
bool responderHadWritable() const
Definition: packet.hh:618
const int verbosity
Definition: packet.hh:409
uint32_t FlagsType
Definition: packet.hh:248
bool suppressFuncError() const
Definition: packet.hh:622
bool isUpgrade() const
Definition: packet.hh:190
bool isWriteback() const
Definition: packet.hh:520
int cmdToIndex() const
Return the index of this command.
Definition: packet.hh:500
static const CommandInfo commandInfo[]
Array to map Command enum to associated info.
Definition: packet.hh:174
bool isPrefetch() const
Definition: request.hh:770
void setBE(T v)
Set the value in the data pointer to v as big endian.
const std::string & curPrefix()
Returns the current line prefix.
Definition: packet.hh:417
void popLabel()
Pop a label off the label stack.
Definition: packet.cc:392
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
Definition: packet.hh:1160
bool isRequest() const
Definition: packet.hh:505
PrintReqState(std::ostream &os, int verbosity=0)
Definition: packet.cc:364
T * getPtr()
get a pointer to the data ptr.
Definition: packet.hh:959
bool mustCheckAbove() const
Does the request need to check for cached copies of the same block in the memory hierarchy above...
Definition: packet.hh:1130
void writeData(uint8_t *p) const
Copy data from the packet to the provided block pointer, which is aligned to the given block size...
Definition: packet.hh:1052
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
Definition: packet.hh:909
bool isWrite() const
Definition: packet.hh:189
Allow a responding cache to inform the cache hierarchy that it had a writable copy before responding...
Definition: packet.hh:268
void setLE(T v)
Set the value in the data pointer to v as little endian.
Flags flags
Definition: packet.hh:295
MemCmd()
Definition: packet.hh:232
bool isHWPrefetch() const
Definition: packet.hh:213
std::ostream & os
Definition: packet.hh:408
void setFunctionalResponseStatus(bool success)
Definition: packet.hh:869
Structure that defines attributes and other data associated with a Command.
Definition: packet.hh:162
bool isRequest() const
Definition: packet.hh:191
PacketDataPtr data
A pointer to the data being transfered.
Definition: packet.hh:314
An entry in the label stack.
Definition: packet.hh:394
unsigned size
The size of the request or transfer.
Definition: packet.hh:324
void convertScToWrite()
It has been determined that the SC packet should successfully update memory.
Definition: packet.hh:678
AtomicOpFunctor * getAtomicOpFunctor()
Definition: request.hh:576
T getRaw() const
Get the data in the packet without byte swapping.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
Definition: packet.hh:340
SenderState * predecessor
Definition: packet.hh:379
bool isLLSC() const
Definition: request.hh:771
bool hasRespData() const
Definition: packet.hh:522
Attribute
List of command attributes.
Definition: packet.hh:136
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
Definition: packet.hh:1024
Packet * PacketPtr
Definition: packet.hh:68
void makeAtomicResponse()
Definition: packet.hh:857
bool hasSharers() const
Definition: packet.hh:585
Issued by requester.
Definition: packet.hh:143
void deleteData()
delete the data pointed to in the data pointer.
Definition: packet.hh:1071
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
Definition: packet.hh:1170
void printLabels()
Print all of the pending unprinted labels on the stack.
Definition: packet.cc:401
bool operator==(MemCmd c2) const
Definition: packet.hh:234
ByteOrder
Definition: types.hh:204
bool isError() const
Definition: packet.hh:216
Bitfield< 51, 12 > base
Definition: pagetable.hh:85
Are the 'addr' and 'size' fields valid?
Definition: packet.hh:275
Addr getPaddr() const
Definition: request.hh:519
const RequestPtr req
A pointer to the original request.
Definition: packet.hh:304
MemCmd(Command _cmd)
Definition: packet.hh:230
void dataStaticConst(const T *p)
Set the data pointer to the following value that should not be freed.
Definition: packet.hh:926
Error response.
Definition: packet.hh:151
bool needsResponse() const
Definition: packet.hh:516
bool isUpgrade() const
Definition: packet.hh:504
STL list class.
Definition: stl.hh:54
static MemCmd makeReadCmd(const RequestPtr req)
Generate the appropriate read MemCmd based on the Request flags.
Definition: packet.hh:780
bool isRead() const
Definition: packet.hh:502
bool isSwap() const
Definition: request.hh:774
bool needsWritable() const
Definition: packet.hh:507
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
bool _isSecure
True if the request targets the secure memory space.
Definition: packet.hh:321
bool cacheResponding() const
Definition: packet.hh:558
Addr addr
The address of the request.
Definition: packet.hh:318
bool isCleanEviction() const
Is this packet a clean eviction, including both actual clean evict packets, but also clean writebacks...
Definition: packet.hh:1140
void convertLlToRead()
When ruby is in use, Ruby will monitor the cache line and the phys memory should treat LL ops as norm...
Definition: packet.hh:690
bool isResponse() const
Definition: packet.hh:192
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
Definition: packet.hh:358
T safe_cast(U ptr)
Definition: cast.hh:61
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
const std::bitset< NUM_COMMAND_ATTRIBUTES > attributes
Set of attribute flags.
Definition: packet.hh:165
Print state matching address (for debugging)
Definition: packet.hh:152
bool isPrefetch() const
Definition: packet.hh:214
bool isEviction() const
Definition: packet.hh:196
std::string * curPrefixPtr
Definition: packet.hh:405
Abstract base class for objects which support being printed to a stream for debugging.
Definition: printable.hh:44
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void setBadAddress()
Definition: packet.hh:631
void setDataFromBlock(const uint8_t *blk_data, int blkSize)
Copy data into the packet from the provided block pointer, which is aligned to the given block size...
Definition: packet.hh:1042
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a MemObject that sees the packet.
Definition: packet.hh:377
bool isSWPrefetch() const
Definition: packet.hh:212
bool isAtomicOp() const
Definition: packet.hh:671
bool checkFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
Definition: packet.hh:1115
bool needsResponse() const
Definition: packet.hh:194
static MemCmd makeWriteCmd(const RequestPtr req)
Generate the appropriate write MemCmd based on the Request flags.
Definition: packet.hh:794
bool noneSet() const
Definition: flags.hh:66
void pushLabel(const std::string &lbl, const std::string &prefix=" ")
Push a label onto the label stack, and prepend the given prefix string onto the current prefix...
Definition: packet.cc:384
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
Definition: packet.hh:845
void setAddr(Addr _addr)
Update the address of this packet mid-transaction.
Definition: packet.hh:647
Issue by responder.
Definition: packet.hh:144
~Packet()
clean up packet variables
Definition: packet.hh:823
Data flows from responder to requester.
Definition: packet.hh:138
const Command response
Corresponding response for requests; InvalidCmd if no response is applicable.
Definition: packet.hh:168
bool isError() const
Definition: packet.hh:528
Special timing-mode atomic snoop for multi-level coherence.
Definition: packet.hh:263
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
Definition: packet.hh:497
SenderState * senderState
This packet's sender state.
Definition: packet.hh:454
MemCmd cmd
The command field of the packet.
Definition: packet.hh:301
bool isFlush() const
Definition: packet.hh:218
bool isPrint() const
Definition: packet.hh:217
bool hasData() const
Check if this particular packet type carries payload data.
Definition: packet.hh:210
std::list< PacketPtr > PacketList
Definition: packet.hh:71
const std::string & toString() const
Return the string to a cmd given by idx.
Definition: packet.hh:227
bool operator!=(MemCmd c2) const
Definition: packet.hh:235
static PacketPtr createRead(const RequestPtr req)
Constructor-like methods that return Packets based on Request objects.
Definition: packet.hh:809
bool isAtomic() const
Definition: request.hh:786
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
Definition: packet.hh:947
void setBlockCached()
Definition: packet.hh:623
Request originated from a caching agent.
Definition: packet.hh:154
virtual ~SenderState()
Definition: packet.hh:381
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
Definition: packet.cc:329
Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize)
Alternate constructor if you are trying to create a packet with a request that is for a whole block...
Definition: packet.hh:723
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
Definition: packet.hh:484
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
Definition: packet.cc:337
bool isLLSC() const
Definition: packet.hh:211
bool isEviction() const
Definition: packet.hh:518
void copyError(Packet *pkt)
Definition: packet.hh:637
const T * getConstPtr() const
Definition: packet.hh:967
void setExpressSnoop()
The express snoop flag is used for two purposes.
Definition: packet.hh:600
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
Definition: packet.hh:670
Bitfield< 5 > t
Definition: miscregs.hh:1382
unsigned getSize() const
Definition: packet.hh:649
Command
List of all commands associated with a packet.
Definition: packet.hh:81
bool isInvalidate() const
Definition: packet.hh:517
static PacketPtr createWrite(const RequestPtr req)
Definition: packet.hh:815
unsigned getSize() const
Definition: request.hh:552
Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data)
Alternate constructor for copying a packet.
Definition: packet.hh:744
const std::string str
String representation (for printing)
Definition: packet.hh:170
Bitfield< 0 > p
bool isRead() const
Definition: packet.hh:188
Command responseCommand() const
Definition: packet.hh:221
int toInt() const
Definition: packet.hh:228
void set(Type flags)
Definition: flags.hh:70
std::list< LabelStackEntry > LabelStack
Definition: packet.hh:402
Command cmd
Definition: packet.hh:178
void allocate()
Allocate memory for the packet.
Definition: packet.hh:1082
bool hasPaddr() const
Accessor for paddr.
Definition: request.hh:513
void printObj(Printable *obj)
Print a Printable object to os, because it matched the address on a PrintReq.
Definition: packet.cc:418
Addr getOffset(unsigned int blk_size) const
Definition: packet.hh:651
bool isSecure() const
Definition: request.hh:777
T getBE() const
Get the data in the packet byte swapped from big endian to host endian.
bool isResponse() const
Definition: packet.hh:506
Addr getAddr() const
Definition: packet.hh:639
void clearBlockCached()
Definition: packet.hh:625
bool isFlush() const
Definition: packet.hh:530
void writeDataToBlock(uint8_t *blk_data, int blkSize) const
Copy data from the packet to the memory at the provided pointer.
Definition: packet.hh:1061
void setCacheResponding()
Snoop flags.
Definition: packet.hh:552

Generated on Fri Jun 9 2017 13:03:49 for gem5 by doxygen 1.8.6