Go to the documentation of this file.
47 #ifndef __MEM_PACKET_HH__
48 #define __MEM_PACKET_HH__
479 const std::string &prefix =
" ");
537 template <
typename T>
542 while (
t == NULL && sender_state != NULL) {
543 t =
dynamic_cast<T*
>(sender_state);
834 if (
req->hasPaddr()) {
850 if (
req->isHTMCmd()) {
854 if (
req->hasSize()) {
875 if (
req->hasPaddr()) {
876 addr =
req->getPaddr() & ~(_blkSize - 1);
941 if (
req->isHTMCmd()) {
942 if (
req->isHTMAbort())
946 }
else if (
req->isLLSC())
948 else if (
req->isPrefetchEx())
950 else if (
req->isPrefetch())
964 else if (
req->isSwap() ||
req->isAtomic())
966 else if (
req->isCacheInvalidate()) {
969 }
else if (
req->isCacheClean()) {
1058 const int blk_size)
const;
1105 template <
typename T>
1122 template <
typename T>
1143 template <
typename T>
1155 template <
typename T>
1164 template <
typename T>
1169 return (
const T*)
data;
1176 template <
typename T>
1183 template <
typename T>
1190 template <
typename T>
1191 T
get(ByteOrder endian)
const;
1194 template <
typename T>
1198 template <
typename T>
1205 template <
typename T>
1206 void set(T
v, ByteOrder endian);
1212 uint64_t
getUintX(ByteOrder endian)
const;
1219 void setUintX(uint64_t
w, ByteOrder endian);
1232 if (
p != getPtr<uint8_t>()) {
1235 std::memcpy(getPtr<uint8_t>(),
p,
getSize());
1257 std::memcpy(
p, getConstPtr<uint8_t>(),
getSize());
1259 assert(
req->getByteEnable().size() ==
getSize());
1261 const uint8_t *
base = getConstPtr<uint8_t>();
1263 if (
req->getByteEnable()[
i]) {
1313 template <
typename T>
1317 template <
typename T>
1338 warn(
"Trying to check against a masked write, skipping."
1339 " (addr: 0x%x, other addr: 0x%x)",
getAddr(),
1349 other->
getPtr<uint8_t>() : NULL);
1396 safe_cast<PrintReqState*>(
senderState)->pushLabel(lbl);
1406 safe_cast<PrintReqState*>(
senderState)->popLabel();
1409 void print(std::ostream &o,
int verbosity = 0,
1410 const std::string &prefix =
"")
const;
1418 std::string
print()
const;
1473 #endif //__MEM_PACKET_HH
bool writeThrough() const
void setSuppressFuncError()
void makeAtomicResponse()
T getBE() const
Get the data in the packet byte swapped from big endian to host endian.
void popLabel()
Pop a label off the label stack.
bool isSWPrefetch() const
AddrRange getAddrRange() const
Get address range to which this packet belongs.
void dataStaticConst(const T *p)
Set the data pointer to the following value that should not be freed.
const std::bitset< NUM_COMMAND_ATTRIBUTES > attributes
Set of attribute flags.
void makeTimingResponse()
@ IsFlush
Flush the address from caches.
bool cacheResponding() const
An entry in the label stack.
std::list< LabelStackEntry > LabelStack
void copyResponderFlags(const PacketPtr pkt)
Copy the reponse flags from an input packet to this packet.
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
HtmCacheFailure htmReturnReason
Holds the return status of the transaction.
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
void setCacheResponding()
Snoop flags.
bool isHtmTransactional() const
Returns whether or not this packet/request originates in the CPU executing in transactional mode,...
bool isExpressSnoop() const
Addr addr
The address of the request.
bool responderHadWritable() const
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...
@ IsWrite
Data flows from requester to responder.
Structure that defines attributes and other data associated with a Command.
bool isWriteback() const
A writeback is an eviction that carries data.
void setResponderHadWritable()
On responding to a snoop request (which only happens for Modified or Owned lines),...
@ SUPPRESS_FUNC_ERROR
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.
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag,...
void setSatisfied()
Set when a request hits in a cache and the cache is not going to respond.
Packet(const RequestPtr &_req, MemCmd _cmd)
Constructor.
static MemCmd makeReadCmd(const RequestPtr &req)
Generate the appropriate read MemCmd based on the Request flags.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
bool needsWritable() const
bool isInvalidate() const
std::shared_ptr< Request > RequestPtr
RequestPtr req
A pointer to the original request.
RequestorID requestorId() const
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
uint64_t htmTransactionUid
A global unique identifier of the transaction.
PacketDataPtr data
A pointer to the data being transferred.
const Command response
Corresponding response for requests; InvalidCmd if no response is applicable.
~Packet()
clean up packet variables
bool matchBlockAddr(const Addr addr, const bool is_secure, const int blk_size) const
Check if packet corresponds to a given block-aligned address and address space.
void convertScToWrite()
It has been determined that the SC packet should successfully update memory.
void writeDataToBlock(uint8_t *blk_data, int blkSize) const
Copy data from the packet to the provided block pointer, which is aligned to the given block size.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
void setBE(T v)
Set the value in the data pointer to v as big endian.
void copyError(Packet *pkt)
const std::string str
String representation (for printing)
Command
List of all commands associated with a packet.
std::string * curPrefixPtr
Packet(const RequestPtr &_req, MemCmd _cmd, int _blkSize, PacketId _id=0)
Alternate constructor if you are trying to create a packet with a request that is for a whole block,...
uint8_t qosValue() const
QoS Value getter Returns 0 if QoS value was never set (constructor default).
@ IsResponse
Issue by responder.
bool isInvalidate() const
bool isWholeLineWrite(unsigned blk_size)
void setWriteThrough()
A writeback/writeclean cmd gets propagated further downstream by the receiver when the flag is set.
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.
A virtual base opaque structure used to hold state associated with the packet (e.g....
bool matchAddr(const Addr addr, const bool is_secure) const
Check if packet corresponds to a given address and address space.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
const std::string & toString() const
Return the string to a cmd given by idx.
Addr getBlockAddr(unsigned int blk_size) const
const std::string & cmdString() const
Return the string name of the cmd field (for debugging and tracing).
bool _isSecure
True if the request targets the secure memory space.
LabelStackEntry(const std::string &_label, std::string *_prefix)
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
bool needsResponse() const
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
@ IsPrint
Print state matching address (for debugging)
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
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.
bool testCmdAttrib(MemCmd::Attribute attrib) const
@ IsLlsc
Alpha/MIPS LL or SC access.
bool suppressFuncError() const
void setHtmTransactionFailedInCache(const HtmCacheFailure ret_code)
Stipulates that this packet/request has returned from the cache hierarchy in a failed transaction.
const std::string & curPrefix()
Returns the current line prefix.
bool mustCheckAbove() const
Does the request need to check for cached copies of the same block in the memory hierarchy above.
void setUintX(uint64_t w, ByteOrder endian)
Set the value in the word w after truncating it to the length of the packet and then byteswapping it ...
void setHtmTransactional(uint64_t val)
Stipulates that this packet/request originates in the CPU executing in transactional mode,...
std::vector< bool > bytesValid
Track the bytes found that satisfy a functional read.
PrintReqState(std::ostream &os, int verbosity=0)
Addr getOffset(unsigned int blk_size) const
uint32_t snoopDelay
Keep track of the extra delay incurred by snooping upwards before sending a request down the memory s...
static const CommandInfo commandInfo[]
Array to map Command enum to associated info.
Attribute
List of command attributes.
Abstract base class for objects which support being printed to a stream for debugging.
@ HasData
There is an associated payload.
static MemCmd makeWriteCmd(const RequestPtr &req)
Generate the appropriate write MemCmd based on the Request flags.
void qosValue(const uint8_t qos_value)
QoS Value setter Interface for setting QoS priority value of the packet.
@ IsRequest
Issued by requester.
bool needsWritable() const
int cmdToIndex() const
Return the index of this command.
::Flags< FlagsType > Flags
Object used to maintain state of a PrintReq.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
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.
bool htmTransactionFailedInCache() const
Returns whether or not this packet/request has returned from the cache hierarchy in a failed transact...
@ IsRead
Data flows from responder to requester.
bool needsResponse() const
bool isCleanEviction() const
Is this packet a clean eviction, including both actual clean evict packets, but also clean writebacks...
uint64_t getHtmTransactionUid() const
If a packet/request originates in a CPU executing in transactional mode, i.e.
MemCmd cmd
The command field of the packet.
T getRaw() const
Get the data in the packet without byte swapping.
static PacketPtr createWrite(const RequestPtr &req)
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
@ FromCache
Request originated from a caching agent.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
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...
bool operator==(MemCmd c2) const
@ NeedsResponse
Requester needs response from target.
void printLabels()
Print all of the pending unprinted labels on the stack.
void setExpressSnoop()
The express snoop flag is used for two purposes.
@ IsClean
Cleans any existing dirty blocks.
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
@ EXPRESS_SNOOP
Special timing-mode atomic snoop for multi-level coherence.
void makeHtmTransactionalReqResponse(const HtmCacheFailure ret_code)
Communicates to the core that a packet was processed by the memory subsystem while running in transac...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data)
Alternate constructor for copying a packet.
bool isMaskedWrite() const
void printObj(Printable *obj)
Print a Printable object to os, because it matched the address on a PrintReq.
@ STATIC_DATA
Is the data pointer set to a value that shouldn't be freed when the packet is destroyed?
void setLE(T v)
Set the value in the data pointer to v as little endian.
T * getPtr()
get a pointer to the data ptr.
unsigned size
The size of the request or transfer.
bool isHWPrefetch() const
std::list< PacketPtr > PacketList
bool operator!=(MemCmd c2) const
bool hasData() const
Check if this particular packet type carries payload data.
SenderState * senderState
This packet's sender state.
HtmCacheFailure getHtmTransactionFailedInCacheRC() const
If a packet/request has returned from the cache hierarchy in a failed transaction,...
@ RESPONDER_HAD_WRITABLE
Allow a responding cache to inform the cache hierarchy that it had a writable copy before responding.
bool isBlockCached() const
void allocate()
Allocate memory for the packet.
@ DYNAMIC_DATA
The data pointer points to a value that should be freed when the packet is destroyed.
SenderState * predecessor
@ NeedsWritable
Requires writable copy to complete in-cache.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
const T * getConstPtr() const
void setFunctionalResponseStatus(bool success)
Command responseCommand() const
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
@ VALID_ADDR
Are the 'addr' and 'size' fields valid?
void setSize(unsigned size)
void deleteData()
delete the data pointed to in the data pointer.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17