packet.hh revision 2814
12381SN/A/*
212652Sandreas.sandberg@arm.com * Copyright (c) 2006 The Regents of The University of Michigan
38949Sandreas.hansson@arm.com * All rights reserved.
48949Sandreas.hansson@arm.com *
58949Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
68949Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are
78949Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright
88949Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer;
98949Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright
108949Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the
118949Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution;
128949Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its
138949Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from
142592SN/A * this software without specific prior written permission.
1510975Sdavid.hashe@amd.com *
162381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272381SN/A *
282381SN/A * Authors: Ron Dreslinski
292381SN/A *          Steve Reinhardt
302381SN/A *          Ali Saidi
312381SN/A */
322381SN/A
332381SN/A/**
342381SN/A * @file
352381SN/A * Declaration of the Packet class.
362381SN/A */
372381SN/A
382381SN/A#ifndef __MEM_PACKET_HH__
392381SN/A#define __MEM_PACKET_HH__
402665Ssaidi@eecs.umich.edu
412665Ssaidi@eecs.umich.edu#include "mem/request.hh"
422665Ssaidi@eecs.umich.edu#include "arch/isa_traits.hh"
432665Ssaidi@eecs.umich.edu#include "sim/root.hh"
449031Sandreas.hansson@arm.com#include <list>
4512349Snikos.nikoleris@arm.com
462381SN/Astruct Packet;
472381SN/Atypedef Packet* PacketPtr;
482381SN/Atypedef uint8_t* PacketDataPtr;
492381SN/Atypedef std::list<PacketPtr> PacketList;
502662Sstever@eecs.umich.edu
512381SN/A//Coherence Flags
522381SN/A#define NACKED_LINE 1 << 0
532381SN/A#define SATISFIED 1 << 1
542381SN/A#define SHARED_LINE 1 << 2
552381SN/A#define CACHE_LINE_FILL 1 << 3
568229Snate@binkert.org#define COMPRESSED 1 << 4
573348Sbinkertn@umich.edu#define NO_ALLOCATE 1 << 5
583348Sbinkertn@umich.edu
593348Sbinkertn@umich.edu//For statistics we need max number of commands, hard code it at
605735Snate@binkert.org//20 for now.  @todo fix later
614024Sbinkertn@umich.edu#define NUM_MEM_CMDS 1 << 9
625735Snate@binkert.org
6312334Sgabeblack@google.com/**
645314Sstever@gmail.com * A Packet is used to encapsulate a transfer between two objects in
656216Snate@binkert.org * the memory system (e.g., the L1 and L2 cache).  (In contrast, a
662392SN/A * single Request travels all the way from the requester to the
674167Sbinkertn@umich.edu * ultimate destination and back, possibly being conveyed by several
682394SN/A * different Packets along the way.)
698737Skoansin.tan@gmail.com */
703349Sbinkertn@umich.educlass Packet
712394SN/A{
722812Srdreslin@umich.edu  public:
7312351Snikos.nikoleris@arm.com    /** Temporary FLAGS field until cache gets working, this should be in coherence/sender state. */
742812Srdreslin@umich.edu    uint64_t flags;
754022Sstever@eecs.umich.edu
764022Sstever@eecs.umich.edu  private:
775735Snate@binkert.org   /** A pointer to the data being transfered.  It can be differnt
785735Snate@binkert.org    *    sizes at each level of the heirarchy so it belongs in the
794022Sstever@eecs.umich.edu    *    packet, not request. This may or may not be populated when a
805735Snate@binkert.org    *    responder recieves the packet. If not populated it memory
815735Snate@binkert.org    *    should be allocated.
825735Snate@binkert.org    */
834022Sstever@eecs.umich.edu    PacketDataPtr data;
844022Sstever@eecs.umich.edu
854022Sstever@eecs.umich.edu    /** Is the data pointer set to a value that shouldn't be freed
864022Sstever@eecs.umich.edu     *   when the packet is destroyed? */
874473Sstever@eecs.umich.edu    bool staticData;
885319Sstever@gmail.com    /** The data pointer points to a value that should be freed when
894022Sstever@eecs.umich.edu     *   the packet is destroyed. */
904022Sstever@eecs.umich.edu    bool dynamicData;
9111199Sandreas.hansson@arm.com    /** the data pointer points to an array (thus delete [] ) needs to
9211199Sandreas.hansson@arm.com     *   be called on it rather than simply delete.*/
9312344Snikos.nikoleris@arm.com    bool arrayData;
9410883Sali.jafri@arm.com
954022Sstever@eecs.umich.edu
964022Sstever@eecs.umich.edu    /** The address of the request.  This address could be virtual or
974022Sstever@eecs.umich.edu     *   physical, depending on the system configuration. */
984022Sstever@eecs.umich.edu    Addr addr;
9910886Sandreas.hansson@arm.com
1004022Sstever@eecs.umich.edu     /** The size of the request or transfer. */
1017465Ssteve.reinhardt@amd.com    int size;
1024628Sstever@eecs.umich.edu
1037465Ssteve.reinhardt@amd.com    /** Device address (e.g., bus ID) of the source of the
1047465Ssteve.reinhardt@amd.com     *   transaction. The source is not responsible for setting this
1054022Sstever@eecs.umich.edu     *   field; it is set implicitly by the interconnect when the
1064022Sstever@eecs.umich.edu     *   packet * is first sent.  */
10710885Sandreas.hansson@arm.com    short src;
10810885Sandreas.hansson@arm.com
1094626Sstever@eecs.umich.edu    /** Device address (e.g., bus ID) of the destination of the
1104626Sstever@eecs.umich.edu     *   transaction. The special value Broadcast indicates that the
1117669Ssteve.reinhardt@amd.com     *   packet should be routed based on its address. This field is
1124626Sstever@eecs.umich.edu     *   initialized in the constructor and is thus always valid
1134040Ssaidi@eecs.umich.edu     *   (unlike * addr, size, and src). */
1144040Ssaidi@eecs.umich.edu    short dest;
1155650Sgblack@eecs.umich.edu
1165650Sgblack@eecs.umich.edu    /** Are the 'addr' and 'size' fields valid? */
11711256Santhony.gutierrez@amd.com    bool addrSizeValid;
11811256Santhony.gutierrez@amd.com    /** Is the 'src' field valid? */
11912347Snikos.nikoleris@arm.com    bool srcValid;
12012347Snikos.nikoleris@arm.com
12112347Snikos.nikoleris@arm.com
12212347Snikos.nikoleris@arm.com  public:
1234870Sstever@eecs.umich.edu
1244870Sstever@eecs.umich.edu    /** Used to calculate latencies for each packet.*/
1254870Sstever@eecs.umich.edu    Tick time;
1264870Sstever@eecs.umich.edu
1274870Sstever@eecs.umich.edu    /** The special destination address indicating that the packet
1284870Sstever@eecs.umich.edu     *   should be routed based on its address. */
1298436SBrad.Beckmann@amd.com    static const short Broadcast = -1;
1308436SBrad.Beckmann@amd.com
1315314Sstever@gmail.com    /** A pointer to the original request. */
1325314Sstever@gmail.com    RequestPtr req;
1338184Ssomayeh@cs.wisc.edu
13410886Sandreas.hansson@arm.com    /** A virtual base opaque structure used to hold coherence-related
13510886Sandreas.hansson@arm.com     *    state.  A specific subclass would be derived from this to
1364022Sstever@eecs.umich.edu     *    carry state specific to a particular coherence protocol.  */
1374022Sstever@eecs.umich.edu    class CoherenceState {
1384022Sstever@eecs.umich.edu      public:
1394022Sstever@eecs.umich.edu        virtual ~CoherenceState() {}
1405735Snate@binkert.org    };
1415735Snate@binkert.org
1425735Snate@binkert.org    /** This packet's coherence state.  Caches should use
1434022Sstever@eecs.umich.edu     *   dynamic_cast<> to cast to the state appropriate for the
1444022Sstever@eecs.umich.edu     *   system's coherence protocol.  */
1454626Sstever@eecs.umich.edu    CoherenceState *coherence;
1464626Sstever@eecs.umich.edu
1477465Ssteve.reinhardt@amd.com    /** A virtual base opaque structure used to hold state associated
1484022Sstever@eecs.umich.edu     *    with the packet but specific to the sending device (e.g., an
14912347Snikos.nikoleris@arm.com     *    MSHR).  A pointer to this state is returned in the packet's
15011284Sandreas.hansson@arm.com     *    response so that the sender can quickly look up the state
1514626Sstever@eecs.umich.edu     *    needed to process it.  A specific subclass would be derived
1524626Sstever@eecs.umich.edu     *    from this to carry state specific to a particular sending
1534626Sstever@eecs.umich.edu     *    device.  */
15411199Sandreas.hansson@arm.com    class SenderState {
1554022Sstever@eecs.umich.edu      public:
1564022Sstever@eecs.umich.edu        virtual ~SenderState() {}
1576076Sgblack@eecs.umich.edu    };
1584626Sstever@eecs.umich.edu
1594870Sstever@eecs.umich.edu    /** This packet's sender state.  Devices should use dynamic_cast<>
1605314Sstever@gmail.com     *   to cast to the state appropriate to the sender. */
1618184Ssomayeh@cs.wisc.edu    SenderState *senderState;
16211600Sandreas.hansson@arm.com
1634022Sstever@eecs.umich.edu  private:
1644022Sstever@eecs.umich.edu    /** List of command attributes. */
1654022Sstever@eecs.umich.edu    enum CommandAttribute
1665735Snate@binkert.org    {
1675735Snate@binkert.org        IsRead		= 1 << 0,
1685735Snate@binkert.org        IsWrite		= 1 << 1,
1695735Snate@binkert.org        IsPrefetch	= 1 << 2,
1705735Snate@binkert.org        IsInvalidate	= 1 << 3,
1715735Snate@binkert.org        IsRequest	= 1 << 4,
1725735Snate@binkert.org        IsResponse 	= 1 << 5,
1734022Sstever@eecs.umich.edu        NeedsResponse	= 1 << 6,
1745735Snate@binkert.org        IsSWPrefetch    = 1 << 7,
1755735Snate@binkert.org        IsHWPrefetch    = 1 << 8
1764022Sstever@eecs.umich.edu    };
1775735Snate@binkert.org
1784022Sstever@eecs.umich.edu  public:
1794022Sstever@eecs.umich.edu    /** List of all commands associated with a packet. */
1804022Sstever@eecs.umich.edu    enum Command
1815735Snate@binkert.org    {
1824022Sstever@eecs.umich.edu        InvalidCmd      = 0,
1834022Sstever@eecs.umich.edu        ReadReq		= IsRead  | IsRequest | NeedsResponse,
1844022Sstever@eecs.umich.edu        WriteReq	= IsWrite | IsRequest | NeedsResponse,
1854022Sstever@eecs.umich.edu        WriteReqNoAck	= IsWrite | IsRequest,
1864022Sstever@eecs.umich.edu        ReadResp	= IsRead  | IsResponse,
1874022Sstever@eecs.umich.edu        WriteResp	= IsWrite | IsResponse,
1885735Snate@binkert.org        Writeback       = IsWrite | IsRequest,
1895735Snate@binkert.org        SoftPFReq       = IsRead  | IsRequest | IsSWPrefetch | NeedsResponse,
1905735Snate@binkert.org        HardPFReq       = IsRead  | IsRequest | IsHWPrefetch | NeedsResponse,
1914022Sstever@eecs.umich.edu        SoftPFResp      = IsRead  | IsRequest | IsSWPrefetch | IsResponse,
1924022Sstever@eecs.umich.edu        HardPFResp      = IsRead  | IsRequest | IsHWPrefetch | IsResponse,
1934022Sstever@eecs.umich.edu        InvalidateReq   = IsInvalidate | IsRequest,
1944022Sstever@eecs.umich.edu        WriteInvalidateReq = IsWrite | IsInvalidate | IsRequest,
1954022Sstever@eecs.umich.edu        UpgradeReq      = IsInvalidate | NeedsResponse,
19610583SCurtis.Dunham@arm.com        UpgradeResp     = IsInvalidate | IsResponse,
19710583SCurtis.Dunham@arm.com        ReadExReq       = IsRead | IsInvalidate | NeedsResponse,
19810583SCurtis.Dunham@arm.com        ReadExResp      = IsRead | IsInvalidate | IsResponse
19910583SCurtis.Dunham@arm.com    };
20010583SCurtis.Dunham@arm.com
20111284Sandreas.hansson@arm.com    /** Return the string name of the cmd field (for debugging and
20210583SCurtis.Dunham@arm.com     *   tracing). */
20310583SCurtis.Dunham@arm.com    const std::string &cmdString() const;
20411199Sandreas.hansson@arm.com
20512347Snikos.nikoleris@arm.com    /** Reutrn the string to a cmd given by idx. */
20611600Sandreas.hansson@arm.com    const std::string &cmdIdxToString(Command idx);
20711199Sandreas.hansson@arm.com
20811199Sandreas.hansson@arm.com    /** Return the index of this command. */
20911199Sandreas.hansson@arm.com    inline int cmdToIndex() const { return (int) cmd; }
21011199Sandreas.hansson@arm.com
21111199Sandreas.hansson@arm.com    /** The command field of the packet. */
21211199Sandreas.hansson@arm.com    Command cmd;
21310570Sandreas.hansson@arm.com
21410570Sandreas.hansson@arm.com    bool isRead() 	 { return (cmd & IsRead)  != 0; }
21510570Sandreas.hansson@arm.com    bool isWrite()       { return (cmd & IsWrite) != 0; }
21610570Sandreas.hansson@arm.com    bool isRequest()	 { return (cmd & IsRequest)  != 0; }
21710570Sandreas.hansson@arm.com    bool isResponse()	 { return (cmd & IsResponse) != 0; }
21810570Sandreas.hansson@arm.com    bool needsResponse() { return (cmd & NeedsResponse) != 0; }
2194022Sstever@eecs.umich.edu    bool isInvalidate()  { return (cmd * IsInvalidate) != 0; }
2206102Sgblack@eecs.umich.edu
22110343SCurtis.Dunham@arm.com    bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; }
22210343SCurtis.Dunham@arm.com    bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; }
22310343SCurtis.Dunham@arm.com    bool isCompressed() { return (flags & COMPRESSED) != 0; }
22410343SCurtis.Dunham@arm.com
2254870Sstever@eecs.umich.edu    bool nic_pkt() { assert("Unimplemented\n" && 0); }
2265314Sstever@gmail.com
2278184Ssomayeh@cs.wisc.edu    /** Possible results of a packet's request. */
2284022Sstever@eecs.umich.edu    enum Result
22911294Sandreas.hansson@arm.com    {
2305735Snate@binkert.org        Success,
2315735Snate@binkert.org        BadAddress,
2324022Sstever@eecs.umich.edu        Nacked,
2334022Sstever@eecs.umich.edu        Unknown
2344022Sstever@eecs.umich.edu    };
2355735Snate@binkert.org
2365735Snate@binkert.org    /** The result of this packet's request. */
2374022Sstever@eecs.umich.edu    Result result;
2384022Sstever@eecs.umich.edu
2395735Snate@binkert.org    /** Accessor function that returns the source index of the packet. */
2405735Snate@binkert.org    short getSrc() const { assert(srcValid); return src; }
2415735Snate@binkert.org    void setSrc(short _src) { src = _src; srcValid = true; }
2424022Sstever@eecs.umich.edu
2435735Snate@binkert.org    /** Accessor function that returns the destination index of
2445735Snate@binkert.org        the packet. */
2454022Sstever@eecs.umich.edu    short getDest() const { return dest; }
2464022Sstever@eecs.umich.edu    void setDest(short _dest) { dest = _dest; }
2472381SN/A
2482662Sstever@eecs.umich.edu    Addr getAddr() const { assert(addrSizeValid); return addr; }
2492662Sstever@eecs.umich.edu    int getSize() const { assert(addrSizeValid); return size; }
2502662Sstever@eecs.umich.edu    Addr getOffset(int blkSize) const { return req->getPaddr() & (Addr)(blkSize - 1); }
2512662Sstever@eecs.umich.edu
2522662Sstever@eecs.umich.edu    void addrOverride(Addr newAddr) { assert(addrSizeValid); addr = newAddr; }
2532381SN/A    void cmdOverride(Command newCmd) { cmd = newCmd; }
2549044SAli.Saidi@ARM.com
2552381SN/A    /** Constructor.  Note that a Request object must be constructed
2562813Srdreslin@umich.edu     *   first, but the Requests's physical address and size fields
2575735Snate@binkert.org     *   need not be valid. The command and destination addresses
2585735Snate@binkert.org     *   must be supplied.  */
2594022Sstever@eecs.umich.edu    Packet(Request *_req, Command _cmd, short _dest)
2605735Snate@binkert.org        :  data(NULL), staticData(false), dynamicData(false), arrayData(false),
2615735Snate@binkert.org           addr(_req->paddr), size(_req->size), dest(_dest),
26210938Sandreas.hansson@arm.com           addrSizeValid(_req->validPaddr),
26310938Sandreas.hansson@arm.com           srcValid(false),
26412349Snikos.nikoleris@arm.com           req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
26510938Sandreas.hansson@arm.com           result(Unknown)
26611284Sandreas.hansson@arm.com    {
26711284Sandreas.hansson@arm.com        flags = 0;
26811284Sandreas.hansson@arm.com    }
26911284Sandreas.hansson@arm.com
27010938Sandreas.hansson@arm.com    /** Alternate constructor if you are trying to create a packet with
27110938Sandreas.hansson@arm.com     *  a request that is for a whole block, not the address from the req.
27210938Sandreas.hansson@arm.com     *  this allows for overriding the size/addr of the req.*/
27311284Sandreas.hansson@arm.com    Packet(Request *_req, Command _cmd, short _dest, int _blkSize)
27411284Sandreas.hansson@arm.com        :  data(NULL), staticData(false), dynamicData(false), arrayData(false),
27511284Sandreas.hansson@arm.com           addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize),
27611284Sandreas.hansson@arm.com           dest(_dest),
27711284Sandreas.hansson@arm.com           addrSizeValid(_req->validPaddr), srcValid(false),
27811284Sandreas.hansson@arm.com           req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
27911284Sandreas.hansson@arm.com           result(Unknown)
28011284Sandreas.hansson@arm.com    {
28111284Sandreas.hansson@arm.com        flags = 0;
28210938Sandreas.hansson@arm.com    }
28312346Snikos.nikoleris@arm.com
28412346Snikos.nikoleris@arm.com    /** Destructor. */
28512346Snikos.nikoleris@arm.com    ~Packet()
28612346Snikos.nikoleris@arm.com    { deleteData(); }
28712349Snikos.nikoleris@arm.com
28812349Snikos.nikoleris@arm.com    /** Reinitialize packet address and size from the associated
28912349Snikos.nikoleris@arm.com     *   Request object, and reset other fields that may have been
29012349Snikos.nikoleris@arm.com     *   modified by a previous transaction.  Typically called when a
29111057Sandreas.hansson@arm.com     *   statically allocated Request/Packet pair is reused for
29211057Sandreas.hansson@arm.com     *   multiple transactions. */
29311057Sandreas.hansson@arm.com    void reinitFromRequest() {
29411057Sandreas.hansson@arm.com        assert(req->validPaddr);
29510938Sandreas.hansson@arm.com        addr = req->paddr;
29610938Sandreas.hansson@arm.com        size = req->size;
29710938Sandreas.hansson@arm.com        addrSizeValid = true;
29810938Sandreas.hansson@arm.com        result = Unknown;
29910938Sandreas.hansson@arm.com        if (dynamicData) {
30010938Sandreas.hansson@arm.com            deleteData();
30110938Sandreas.hansson@arm.com            dynamicData = false;
30210938Sandreas.hansson@arm.com            arrayData = false;
30310938Sandreas.hansson@arm.com        }
30410938Sandreas.hansson@arm.com    }
30510938Sandreas.hansson@arm.com
30610938Sandreas.hansson@arm.com    /** Take a request packet and modify it in place to be suitable
30710938Sandreas.hansson@arm.com     *   for returning as a response to that request.  Used for timing
30810938Sandreas.hansson@arm.com     *   accesses only.  For atomic and functional accesses, the
30910938Sandreas.hansson@arm.com     *   request packet is always implicitly passed back *without*
31010938Sandreas.hansson@arm.com     *   modifying the command or destination fields, so this function
3115735Snate@binkert.org     *   should not be called. */
3125735Snate@binkert.org    void makeTimingResponse() {
3135735Snate@binkert.org        assert(needsResponse());
3145735Snate@binkert.org        int icmd = (int)cmd;
3154022Sstever@eecs.umich.edu        icmd &= ~(IsRequest | NeedsResponse);
3164022Sstever@eecs.umich.edu        icmd |= IsResponse;
3175735Snate@binkert.org        cmd = (Command)icmd;
3184870Sstever@eecs.umich.edu        dest = src;
3194870Sstever@eecs.umich.edu        srcValid = false;
32012351Snikos.nikoleris@arm.com    }
32112351Snikos.nikoleris@arm.com
3225735Snate@binkert.org    /** Take a request packet that has been returned as NACKED and modify it so
32312749Sgiacomo.travaglini@arm.com     * that it can be sent out again. Only packets that need a response can be
3244870Sstever@eecs.umich.edu     * NACKED, so verify that that is true. */
3252566SN/A    void reinitNacked() {
3265735Snate@binkert.org        assert(needsResponse() && result == Nacked);
32712633Sodanrc@yahoo.com.br        dest =  Broadcast;
32812633Sodanrc@yahoo.com.br        result = Unknown;
3295735Snate@binkert.org    }
33012633Sodanrc@yahoo.com.br
3315735Snate@binkert.org
3322566SN/A    /** Set the data pointer to the following value that should not be freed. */
3332566SN/A    template <typename T>
3342566SN/A    void dataStatic(T *p);
3355735Snate@binkert.org
3365735Snate@binkert.org    /** Set the data pointer to a value that should have delete [] called on it.
3372381SN/A     */
3382381SN/A    template <typename T>
33910028SGiacomo.Gabrielli@arm.com    void dataDynamicArray(T *p);
34010028SGiacomo.Gabrielli@arm.com
34110028SGiacomo.Gabrielli@arm.com    /** set the data pointer to a value that should have delete called on it. */
3425735Snate@binkert.org    template <typename T>
3436227Snate@binkert.org    void dataDynamic(T *p);
3442381SN/A
3455735Snate@binkert.org    /** return the value of what is pointed to in the packet. */
34610723Sandreas.hansson@arm.com    template <typename T>
3478668Sgeoffrey.blake@arm.com    T get();
34810723Sandreas.hansson@arm.com
3498668Sgeoffrey.blake@arm.com    /** get a pointer to the data ptr. */
3502641Sstever@eecs.umich.edu    template <typename T>
3512811Srdreslin@umich.edu    T* getPtr();
3529547Sandreas.hansson@arm.com
35310694SMarco.Balboni@ARM.com    /** set the value in the data pointer to v. */
35410405Sandreas.hansson@arm.com    template <typename T>
35510405Sandreas.hansson@arm.com    void set(T v);
35610405Sandreas.hansson@arm.com
35710405Sandreas.hansson@arm.com    /** delete the data pointed to in the data pointer. Ok to call to matter how
3589547Sandreas.hansson@arm.com     * data was allocted. */
35910694SMarco.Balboni@ARM.com    void deleteData();
3603218Sgblack@eecs.umich.edu
3619547Sandreas.hansson@arm.com    /** If there isn't data in the packet, allocate some. */
36211127Sandreas.hansson@arm.com    void allocate();
36311127Sandreas.hansson@arm.com
36411127Sandreas.hansson@arm.com    /** Do the packet modify the same addresses. */
36511127Sandreas.hansson@arm.com    bool intersect(Packet *p);
36611127Sandreas.hansson@arm.com};
36711127Sandreas.hansson@arm.com
36811127Sandreas.hansson@arm.combool fixPacket(Packet *func, Packet *timing);
36911127Sandreas.hansson@arm.com#endif //__MEM_PACKET_HH
37010694SMarco.Balboni@ARM.com