52 #ifndef __MEM_PACKET_HH__
53 #define __MEM_PACKET_HH__
425 const std::string &prefix =
" ");
483 template <
typename T>
488 while (t == NULL && sender_state != NULL) {
489 t =
dynamic_cast<T*
>(sender_state);
907 template <
typename T>
924 template <
typename T>
945 template <
typename T>
957 template <
typename T>
965 template <
typename T>
970 return (
const T*)
data;
977 template <
typename T>
984 template <
typename T>
991 template <
typename T>
998 template <
typename T>
1002 template <
typename T>
1006 template <
typename T>
1013 template <
typename T>
1017 template <
typename T>
1031 if (p != getPtr<uint8_t>())
1034 std::memcpy(getPtr<uint8_t>(),
p,
getSize());
1054 std::memcpy(p, getConstPtr<uint8_t>(),
getSize());
1097 template <
typename T>
1101 template <
typename T>
1122 other->
getPtr<uint8_t>() : NULL);
1176 void print(std::ostream &o,
int verbosity = 0,
1177 const std::string &prefix =
"")
const;
1185 std::string
print()
const;
1188 #endif //__MEM_PACKET_HH
Alpha/MIPS LL or SC access.
bool needsWritable() const
Requires writable copy to complete in-cache.
std::vector< bool > bytesValid
Track the bytes found that satisfy a functional read.
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.
void setSize(unsigned size)
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag...
Data flows from requester to responder.
bool isBlockCached() const
The data pointer points to a value that should be freed when the packet is destroyed.
bool testCmdAttrib(MemCmd::Attribute attrib) const
There is an associated payload.
void setSuppressFuncError()
Is the data pointer set to a value that shouldn't be freed when the packet is destroyed?
Object used to maintain state of a PrintReq.
Packet(const RequestPtr _req, MemCmd _cmd)
Constructor.
uint32_t snoopDelay
Keep track of the extra delay incurred by snooping upwards before sending a request down the memory s...
void makeTimingResponse()
Flush the address from caches.
LabelStackEntry(const std::string &_label, std::string *_prefix)
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...
::Flags< FlagsType > Flags
bool isExpressSnoop() const
bool isWriteback() const
A writeback is an eviction that carries data.
Addr getBlockAddr(unsigned int blk_size) const
bool hasSize() const
Accessor for size.
suppress the error if this packet encounters a functional access failure.
void setRaw(T v)
Set the value in the data pointer to v without byte swapping.
bool isInvalidate() const
Requester needs response from target.
bool responderHadWritable() const
bool suppressFuncError() const
int cmdToIndex() const
Return the index of this command.
static const CommandInfo commandInfo[]
Array to map Command enum to associated info.
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.
void popLabel()
Pop a label off the label stack.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
PrintReqState(std::ostream &os, int verbosity=0)
T * getPtr()
get a pointer to the data ptr.
bool mustCheckAbove() const
Does the request need to check for cached copies of the same block in the memory hierarchy above...
void writeData(uint8_t *p) const
Copy data from the packet to the provided block pointer, which is aligned to the given block size...
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
Allow a responding cache to inform the cache hierarchy that it had a writable copy before responding...
void setLE(T v)
Set the value in the data pointer to v as little endian.
bool isHWPrefetch() const
void setFunctionalResponseStatus(bool success)
Structure that defines attributes and other data associated with a Command.
PacketDataPtr data
A pointer to the data being transfered.
An entry in the label stack.
unsigned size
The size of the request or transfer.
void convertScToWrite()
It has been determined that the SC packet should successfully update memory.
AtomicOpFunctor * getAtomicOpFunctor()
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.
SenderState * predecessor
Attribute
List of command attributes.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
void makeAtomicResponse()
void deleteData()
delete the data pointed to in the data pointer.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
void printLabels()
Print all of the pending unprinted labels on the stack.
bool operator==(MemCmd c2) const
Are the 'addr' and 'size' fields valid?
const RequestPtr req
A pointer to the original request.
void dataStaticConst(const T *p)
Set the data pointer to the following value that should not be freed.
bool needsResponse() const
static MemCmd makeReadCmd(const RequestPtr req)
Generate the appropriate read MemCmd based on the Request flags.
bool needsWritable() const
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.
bool _isSecure
True if the request targets the secure memory space.
bool cacheResponding() const
Addr addr
The address of the request.
bool isCleanEviction() const
Is this packet a clean eviction, including both actual clean evict packets, but also clean writebacks...
void convertLlToRead()
When ruby is in use, Ruby will monitor the cache line and the phys memory should treat LL ops as norm...
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
const std::bitset< NUM_COMMAND_ATTRIBUTES > attributes
Set of attribute flags.
Print state matching address (for debugging)
std::string * curPrefixPtr
Abstract base class for objects which support being printed to a stream for debugging.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
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...
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.
bool isSWPrefetch() const
bool checkFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
bool needsResponse() const
static MemCmd makeWriteCmd(const RequestPtr req)
Generate the appropriate write MemCmd based on the Request flags.
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...
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
void setAddr(Addr _addr)
Update the address of this packet mid-transaction.
~Packet()
clean up packet variables
Data flows from responder to requester.
const Command response
Corresponding response for requests; InvalidCmd if no response is applicable.
Special timing-mode atomic snoop for multi-level coherence.
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
SenderState * senderState
This packet's sender state.
MemCmd cmd
The command field of the packet.
bool hasData() const
Check if this particular packet type carries payload data.
std::list< PacketPtr > PacketList
const std::string & toString() const
Return the string to a cmd given by idx.
bool operator!=(MemCmd c2) const
static PacketPtr createRead(const RequestPtr req)
Constructor-like methods that return Packets based on Request objects.
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
Request originated from a caching agent.
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...
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...
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
void copyError(Packet *pkt)
const T * getConstPtr() const
void setExpressSnoop()
The express snoop flag is used for two purposes.
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
Command
List of all commands associated with a packet.
bool isInvalidate() const
static PacketPtr createWrite(const RequestPtr req)
Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data)
Alternate constructor for copying a packet.
const std::string str
String representation (for printing)
Command responseCommand() const
std::list< LabelStackEntry > LabelStack
void allocate()
Allocate memory for the packet.
bool hasPaddr() const
Accessor for paddr.
void printObj(Printable *obj)
Print a Printable object to os, because it matched the address on a PrintReq.
Addr getOffset(unsigned int blk_size) const
T getBE() const
Get the data in the packet byte swapped from big endian to host endian.
void writeDataToBlock(uint8_t *blk_data, int blkSize) const
Copy data from the packet to the memory at the provided pointer.
void setCacheResponding()
Snoop flags.