packet.hh (12349:47f454120200) packet.hh (12351:17eaa27bef22)
1/*
2 * Copyright (c) 2012-2017 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

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

65#include "base/types.hh"
66#include "mem/request.hh"
67#include "sim/core.hh"
68
69class Packet;
70typedef Packet *PacketPtr;
71typedef uint8_t* PacketDataPtr;
72typedef std::list<PacketPtr> PacketList;
1/*
2 * Copyright (c) 2012-2017 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

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

65#include "base/types.hh"
66#include "mem/request.hh"
67#include "sim/core.hh"
68
69class Packet;
70typedef Packet *PacketPtr;
71typedef uint8_t* PacketDataPtr;
72typedef std::list<PacketPtr> PacketList;
73typedef uint64_t PacketId;
73
74class MemCmd
75{
76 friend class Packet;
77
78 public:
79 /**
80 * List of all commands associated with a packet.

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

311 Flags flags;
312
313 public:
314 typedef MemCmd::Command Command;
315
316 /// The command field of the packet.
317 MemCmd cmd;
318
74
75class MemCmd
76{
77 friend class Packet;
78
79 public:
80 /**
81 * List of all commands associated with a packet.

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

312 Flags flags;
313
314 public:
315 typedef MemCmd::Command Command;
316
317 /// The command field of the packet.
318 MemCmd cmd;
319
320 const PacketId id;
321
319 /// A pointer to the original request.
320 const RequestPtr req;
321
322 private:
323 /**
324 * A pointer to the data being transfered. It can be differnt
325 * sizes at each level of the heirarchy so it belongs in the
326 * packet, not request. This may or may not be populated when a

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

738 }
739
740 /**
741 * Constructor. Note that a Request object must be constructed
742 * first, but the Requests's physical address and size fields need
743 * not be valid. The command must be supplied.
744 */
745 Packet(const RequestPtr _req, MemCmd _cmd)
322 /// A pointer to the original request.
323 const RequestPtr req;
324
325 private:
326 /**
327 * A pointer to the data being transfered. It can be differnt
328 * sizes at each level of the heirarchy so it belongs in the
329 * packet, not request. This may or may not be populated when a

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

741 }
742
743 /**
744 * Constructor. Note that a Request object must be constructed
745 * first, but the Requests's physical address and size fields need
746 * not be valid. The command must be supplied.
747 */
748 Packet(const RequestPtr _req, MemCmd _cmd)
746 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false),
747 size(0), headerDelay(0), snoopDelay(0), payloadDelay(0),
748 senderState(NULL)
749 : cmd(_cmd), id((PacketId)_req), req(_req), data(nullptr), addr(0),
750 _isSecure(false), size(0), headerDelay(0), snoopDelay(0),
751 payloadDelay(0), senderState(NULL)
749 {
750 if (req->hasPaddr()) {
751 addr = req->getPaddr();
752 flags.set(VALID_ADDR);
753 _isSecure = req->isSecure();
754 }
755 if (req->hasSize()) {
756 size = req->getSize();
757 flags.set(VALID_SIZE);
758 }
759 }
760
761 /**
762 * Alternate constructor if you are trying to create a packet with
763 * a request that is for a whole block, not the address from the
764 * req. this allows for overriding the size/addr of the req.
765 */
752 {
753 if (req->hasPaddr()) {
754 addr = req->getPaddr();
755 flags.set(VALID_ADDR);
756 _isSecure = req->isSecure();
757 }
758 if (req->hasSize()) {
759 size = req->getSize();
760 flags.set(VALID_SIZE);
761 }
762 }
763
764 /**
765 * Alternate constructor if you are trying to create a packet with
766 * a request that is for a whole block, not the address from the
767 * req. this allows for overriding the size/addr of the req.
768 */
766 Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize)
767 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false),
768 headerDelay(0), snoopDelay(0), payloadDelay(0),
769 senderState(NULL)
769 Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize, PacketId _id = 0)
770 : cmd(_cmd), id(_id ? _id : (PacketId)_req), req(_req), data(nullptr),
771 addr(0), _isSecure(false), headerDelay(0), snoopDelay(0),
772 payloadDelay(0), senderState(NULL)
770 {
771 if (req->hasPaddr()) {
772 addr = req->getPaddr() & ~(_blkSize - 1);
773 flags.set(VALID_ADDR);
774 _isSecure = req->isSecure();
775 }
776 size = _blkSize;
777 flags.set(VALID_SIZE);
778 }
779
780 /**
781 * Alternate constructor for copying a packet. Copy all fields
782 * *except* if the original packet's data was dynamic, don't copy
783 * that, as we can't guarantee that the new packet's lifetime is
784 * less than that of the original packet. In this case the new
785 * packet should allocate its own data.
786 */
787 Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data)
773 {
774 if (req->hasPaddr()) {
775 addr = req->getPaddr() & ~(_blkSize - 1);
776 flags.set(VALID_ADDR);
777 _isSecure = req->isSecure();
778 }
779 size = _blkSize;
780 flags.set(VALID_SIZE);
781 }
782
783 /**
784 * Alternate constructor for copying a packet. Copy all fields
785 * *except* if the original packet's data was dynamic, don't copy
786 * that, as we can't guarantee that the new packet's lifetime is
787 * less than that of the original packet. In this case the new
788 * packet should allocate its own data.
789 */
790 Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data)
788 : cmd(pkt->cmd), req(pkt->req),
791 : cmd(pkt->cmd), id(pkt->id), req(pkt->req),
789 data(nullptr),
790 addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size),
791 bytesValid(pkt->bytesValid),
792 headerDelay(pkt->headerDelay),
793 snoopDelay(0),
794 payloadDelay(pkt->payloadDelay),
795 senderState(pkt->senderState)
796 {

--- 440 unchanged lines hidden ---
792 data(nullptr),
793 addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size),
794 bytesValid(pkt->bytesValid),
795 headerDelay(pkt->headerDelay),
796 snoopDelay(0),
797 payloadDelay(pkt->payloadDelay),
798 senderState(pkt->senderState)
799 {

--- 440 unchanged lines hidden ---