packet.hh revision 3218
12381SN/A/* 22592SN/A * Copyright (c) 2006 The Regents of The University of Michigan 32381SN/A * All rights reserved. 42381SN/A * 52381SN/A * Redistribution and use in source and binary forms, with or without 62381SN/A * modification, are permitted provided that the following conditions are 72381SN/A * met: redistributions of source code must retain the above copyright 82381SN/A * notice, this list of conditions and the following disclaimer; 92381SN/A * redistributions in binary form must reproduce the above copyright 102381SN/A * notice, this list of conditions and the following disclaimer in the 112381SN/A * documentation and/or other materials provided with the distribution; 122381SN/A * neither the name of the copyright holders nor the names of its 132381SN/A * contributors may be used to endorse or promote products derived from 142381SN/A * this software without specific prior written permission. 152381SN/A * 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. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski 292665Ssaidi@eecs.umich.edu * Steve Reinhardt 302665Ssaidi@eecs.umich.edu * Ali Saidi 312381SN/A */ 322381SN/A 332381SN/A/** 342381SN/A * @file 352662Sstever@eecs.umich.edu * Declaration of the Packet class. 362381SN/A */ 372381SN/A 382381SN/A#ifndef __MEM_PACKET_HH__ 392381SN/A#define __MEM_PACKET_HH__ 402381SN/A 413348Sbinkertn@umich.edu#include "mem/request.hh" 423348Sbinkertn@umich.edu#include "sim/host.hh" 433348Sbinkertn@umich.edu#include "sim/root.hh" 442392SN/A#include <list> 452980Sgblack@eecs.umich.edu#include <cassert> 462394SN/A 472394SN/Astruct Packet; 482394SN/Atypedef Packet* PacketPtr; 493349Sbinkertn@umich.edutypedef uint8_t* PacketDataPtr; 502394SN/Atypedef std::list<PacketPtr> PacketList; 512812Srdreslin@umich.edu 522812Srdreslin@umich.edu//Coherence Flags 532812Srdreslin@umich.edu#define NACKED_LINE 1 << 0 542812Srdreslin@umich.edu#define SATISFIED 1 << 1 552812Srdreslin@umich.edu#define SHARED_LINE 1 << 2 562812Srdreslin@umich.edu#define CACHE_LINE_FILL 1 << 3 572813Srdreslin@umich.edu#define COMPRESSED 1 << 4 582813Srdreslin@umich.edu#define NO_ALLOCATE 1 << 5 592813Srdreslin@umich.edu#define SNOOP_COMMIT 1 << 6 603074Srdreslin@umich.edu 612382SN/A/** 623208Srdreslin@umich.edu * A Packet is used to encapsulate a transfer between two objects in 633214Srdreslin@umich.edu * the memory system (e.g., the L1 and L2 cache). (In contrast, a 642381SN/A * single Request travels all the way from the requester to the 652662Sstever@eecs.umich.edu * ultimate destination and back, possibly being conveyed by several 662662Sstever@eecs.umich.edu * different Packets along the way.) 672662Sstever@eecs.umich.edu */ 682662Sstever@eecs.umich.educlass Packet 692662Sstever@eecs.umich.edu{ 702381SN/A public: 712641Sstever@eecs.umich.edu /** Temporary FLAGS field until cache gets working, this should be in coherence/sender state. */ 722381SN/A uint64_t flags; 732813Srdreslin@umich.edu 742813Srdreslin@umich.edu private: 752813Srdreslin@umich.edu /** A pointer to the data being transfered. It can be differnt 762813Srdreslin@umich.edu * sizes at each level of the heirarchy so it belongs in the 772566SN/A * packet, not request. This may or may not be populated when a 782662Sstever@eecs.umich.edu * responder recieves the packet. If not populated it memory 792662Sstever@eecs.umich.edu * should be allocated. 802662Sstever@eecs.umich.edu */ 812662Sstever@eecs.umich.edu PacketDataPtr data; 822662Sstever@eecs.umich.edu 832566SN/A /** Is the data pointer set to a value that shouldn't be freed 842566SN/A * when the packet is destroyed? */ 852566SN/A bool staticData; 862662Sstever@eecs.umich.edu /** The data pointer points to a value that should be freed when 872662Sstever@eecs.umich.edu * the packet is destroyed. */ 882566SN/A bool dynamicData; 892662Sstever@eecs.umich.edu /** the data pointer points to an array (thus delete [] ) needs to 902662Sstever@eecs.umich.edu * be called on it rather than simply delete.*/ 912566SN/A bool arrayData; 922662Sstever@eecs.umich.edu 932662Sstever@eecs.umich.edu /** The address of the request. This address could be virtual or 942566SN/A * physical, depending on the system configuration. */ 952566SN/A Addr addr; 962662Sstever@eecs.umich.edu 972662Sstever@eecs.umich.edu /** The size of the request or transfer. */ 982381SN/A int size; 992381SN/A 1002662Sstever@eecs.umich.edu /** Device address (e.g., bus ID) of the source of the 1012381SN/A * transaction. The source is not responsible for setting this 1022381SN/A * field; it is set implicitly by the interconnect when the 1032662Sstever@eecs.umich.edu * packet * is first sent. */ 1042662Sstever@eecs.umich.edu short src; 1052662Sstever@eecs.umich.edu 1063349Sbinkertn@umich.edu /** Device address (e.g., bus ID) of the destination of the 1072381SN/A * transaction. The special value Broadcast indicates that the 1082381SN/A * packet should be routed based on its address. This field is 1092662Sstever@eecs.umich.edu * initialized in the constructor and is thus always valid 1102662Sstever@eecs.umich.edu * (unlike * addr, size, and src). */ 1112662Sstever@eecs.umich.edu short dest; 1122662Sstever@eecs.umich.edu 1132662Sstever@eecs.umich.edu /** Are the 'addr' and 'size' fields valid? */ 1142641Sstever@eecs.umich.edu bool addrSizeValid; 1152641Sstever@eecs.umich.edu /** Is the 'src' field valid? */ 1162663Sstever@eecs.umich.edu bool srcValid; 1172663Sstever@eecs.umich.edu 1182662Sstever@eecs.umich.edu 1192641Sstever@eecs.umich.edu public: 1202813Srdreslin@umich.edu 1212641Sstever@eecs.umich.edu /** Used to calculate latencies for each packet.*/ 1222641Sstever@eecs.umich.edu Tick time; 1232641Sstever@eecs.umich.edu 1242811Srdreslin@umich.edu /** The time at which the packet will be fully transmitted */ 1252811Srdreslin@umich.edu Tick finishTime; 1262811Srdreslin@umich.edu 1273218Sgblack@eecs.umich.edu /** The time at which the first chunk of the packet will be transmitted */ 1283218Sgblack@eecs.umich.edu Tick firstWordTime; 1293218Sgblack@eecs.umich.edu 1303218Sgblack@eecs.umich.edu /** The special destination address indicating that the packet 1313218Sgblack@eecs.umich.edu * should be routed based on its address. */ 1323218Sgblack@eecs.umich.edu static const short Broadcast = -1; 1332662Sstever@eecs.umich.edu 1342662Sstever@eecs.umich.edu /** A pointer to the original request. */ 1352623SN/A RequestPtr req; 1362623SN/A 1372662Sstever@eecs.umich.edu /** A virtual base opaque structure used to hold coherence-related 1382641Sstever@eecs.umich.edu * state. A specific subclass would be derived from this to 1392641Sstever@eecs.umich.edu * carry state specific to a particular coherence protocol. */ 1402662Sstever@eecs.umich.edu class CoherenceState { 1412662Sstever@eecs.umich.edu public: 1422662Sstever@eecs.umich.edu virtual ~CoherenceState() {} 1432641Sstever@eecs.umich.edu }; 1442641Sstever@eecs.umich.edu 1452641Sstever@eecs.umich.edu /** This packet's coherence state. Caches should use 1462641Sstever@eecs.umich.edu * dynamic_cast<> to cast to the state appropriate for the 1472641Sstever@eecs.umich.edu * system's coherence protocol. */ 1482662Sstever@eecs.umich.edu CoherenceState *coherence; 1492662Sstever@eecs.umich.edu 1502662Sstever@eecs.umich.edu /** A virtual base opaque structure used to hold state associated 1512662Sstever@eecs.umich.edu * with the packet but specific to the sending device (e.g., an 1522641Sstever@eecs.umich.edu * MSHR). A pointer to this state is returned in the packet's 1532662Sstever@eecs.umich.edu * response so that the sender can quickly look up the state 1542662Sstever@eecs.umich.edu * needed to process it. A specific subclass would be derived 1552662Sstever@eecs.umich.edu * from this to carry state specific to a particular sending 1562662Sstever@eecs.umich.edu * device. */ 1572662Sstever@eecs.umich.edu class SenderState { 1582662Sstever@eecs.umich.edu public: 1592662Sstever@eecs.umich.edu virtual ~SenderState() {} 1602641Sstever@eecs.umich.edu }; 1612641Sstever@eecs.umich.edu 1622641Sstever@eecs.umich.edu /** This packet's sender state. Devices should use dynamic_cast<> 1632641Sstever@eecs.umich.edu * to cast to the state appropriate to the sender. */ 1642641Sstever@eecs.umich.edu SenderState *senderState; 1652662Sstever@eecs.umich.edu 1662662Sstever@eecs.umich.edu private: 1672662Sstever@eecs.umich.edu /** List of command attributes. */ 1682641Sstever@eecs.umich.edu // If you add a new CommandAttribute, make sure to increase NUM_MEM_CMDS 1692641Sstever@eecs.umich.edu // as well. 1702641Sstever@eecs.umich.edu enum CommandAttribute 1713158Sgblack@eecs.umich.edu { 1723158Sgblack@eecs.umich.edu IsRead = 1 << 0, 1732641Sstever@eecs.umich.edu IsWrite = 1 << 1, 1742641Sstever@eecs.umich.edu IsPrefetch = 1 << 2, 1753260Ssaidi@eecs.umich.edu IsInvalidate = 1 << 3, 1763260Ssaidi@eecs.umich.edu IsRequest = 1 << 4, 1773260Ssaidi@eecs.umich.edu IsResponse = 1 << 5, 1783260Ssaidi@eecs.umich.edu NeedsResponse = 1 << 6, 1793260Ssaidi@eecs.umich.edu IsSWPrefetch = 1 << 7, 1803260Ssaidi@eecs.umich.edu IsHWPrefetch = 1 << 8, 1813260Ssaidi@eecs.umich.edu HasData = 1 << 9 1822811Srdreslin@umich.edu }; 1833156Sgblack@eecs.umich.edu 1843214Srdreslin@umich.edu//For statistics we need max number of commands, hard code it at 1853260Ssaidi@eecs.umich.edu//20 for now. @todo fix later 1862641Sstever@eecs.umich.edu#define NUM_MEM_CMDS 1 << 10 1872641Sstever@eecs.umich.edu 1882641Sstever@eecs.umich.edu public: 1892641Sstever@eecs.umich.edu /** List of all commands associated with a packet. */ 1902641Sstever@eecs.umich.edu enum Command 1912641Sstever@eecs.umich.edu { 1922813Srdreslin@umich.edu InvalidCmd = 0, 1933260Ssaidi@eecs.umich.edu ReadReq = IsRead | IsRequest | NeedsResponse, 1943260Ssaidi@eecs.umich.edu WriteReq = IsWrite | IsRequest | NeedsResponse | HasData, 1953260Ssaidi@eecs.umich.edu WriteReqNoAck = IsWrite | IsRequest | HasData, 1963260Ssaidi@eecs.umich.edu ReadResp = IsRead | IsResponse | NeedsResponse | HasData, 1973260Ssaidi@eecs.umich.edu WriteResp = IsWrite | IsResponse | NeedsResponse, 1983158Sgblack@eecs.umich.edu Writeback = IsWrite | IsRequest | HasData, 1992811Srdreslin@umich.edu SoftPFReq = IsRead | IsRequest | IsSWPrefetch | NeedsResponse, 2002811Srdreslin@umich.edu HardPFReq = IsRead | IsRequest | IsHWPrefetch | NeedsResponse, 2013156Sgblack@eecs.umich.edu SoftPFResp = IsRead | IsResponse | IsSWPrefetch 2023158Sgblack@eecs.umich.edu | NeedsResponse | HasData, 2033156Sgblack@eecs.umich.edu HardPFResp = IsRead | IsResponse | IsHWPrefetch 2043260Ssaidi@eecs.umich.edu | NeedsResponse | HasData, 2052812Srdreslin@umich.edu InvalidateReq = IsInvalidate | IsRequest, 2063293Srdreslin@umich.edu WriteInvalidateReq = IsWrite | IsInvalidate | IsRequest | HasData, 2073293Srdreslin@umich.edu UpgradeReq = IsInvalidate | IsRequest, 2083335Srdreslin@umich.edu ReadExReq = IsRead | IsInvalidate | IsRequest | NeedsResponse, 2093335Srdreslin@umich.edu ReadExResp = IsRead | IsInvalidate | IsResponse 2103207Srdreslin@umich.edu | NeedsResponse | HasData 2112855Srdreslin@umich.edu }; 2123156Sgblack@eecs.umich.edu 2133158Sgblack@eecs.umich.edu /** Return the string name of the cmd field (for debugging and 2142641Sstever@eecs.umich.edu * tracing). */ 2152641Sstever@eecs.umich.edu const std::string &cmdString() const; 2162662Sstever@eecs.umich.edu 2172662Sstever@eecs.umich.edu /** Reutrn the string to a cmd given by idx. */ 2182641Sstever@eecs.umich.edu const std::string &cmdIdxToString(Command idx); 2192381SN/A 2202811Srdreslin@umich.edu /** Return the index of this command. */ 2212811Srdreslin@umich.edu inline int cmdToIndex() const { return (int) cmd; } 2222811Srdreslin@umich.edu 2232811Srdreslin@umich.edu /** The command field of the packet. */ 2242811Srdreslin@umich.edu Command cmd; 2252811Srdreslin@umich.edu 2262662Sstever@eecs.umich.edu bool isRead() { return (cmd & IsRead) != 0; } 2272381SN/A bool isWrite() { return (cmd & IsWrite) != 0; } 2282381SN/A bool isRequest() { return (cmd & IsRequest) != 0; } 2293260Ssaidi@eecs.umich.edu bool isResponse() { return (cmd & IsResponse) != 0; } 2303260Ssaidi@eecs.umich.edu bool needsResponse() { return (cmd & NeedsResponse) != 0; } 2313260Ssaidi@eecs.umich.edu bool isInvalidate() { return (cmd & IsInvalidate) != 0; } 2323260Ssaidi@eecs.umich.edu bool hasData() { return (cmd & HasData) != 0; } 2333260Ssaidi@eecs.umich.edu 2343260Ssaidi@eecs.umich.edu bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; } 2353260Ssaidi@eecs.umich.edu bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; } 2362812Srdreslin@umich.edu bool isCompressed() { return (flags & COMPRESSED) != 0; } 2373260Ssaidi@eecs.umich.edu 2383260Ssaidi@eecs.umich.edu bool nic_pkt() { assert("Unimplemented\n" && 0); return false; } 2393260Ssaidi@eecs.umich.edu 2402814Srdreslin@umich.edu /** Possible results of a packet's request. */ 2413039Sstever@eecs.umich.edu enum Result 2422641Sstever@eecs.umich.edu { 2432662Sstever@eecs.umich.edu Success, 2442641Sstever@eecs.umich.edu BadAddress, 2452641Sstever@eecs.umich.edu Nacked, 2462641Sstever@eecs.umich.edu Unknown 2472641Sstever@eecs.umich.edu }; 2482685Ssaidi@eecs.umich.edu 2492641Sstever@eecs.umich.edu /** The result of this packet's request. */ 2502641Sstever@eecs.umich.edu Result result; 2512641Sstever@eecs.umich.edu 2522662Sstever@eecs.umich.edu /** Accessor function that returns the source index of the packet. */ 2532641Sstever@eecs.umich.edu short getSrc() const { assert(srcValid); return src; } 2542381SN/A void setSrc(short _src) { src = _src; srcValid = true; } 2552381SN/A 2562641Sstever@eecs.umich.edu /** Accessor function that returns the destination index of 2572641Sstever@eecs.umich.edu the packet. */ 2582381SN/A short getDest() const { return dest; } 2592381SN/A void setDest(short _dest) { dest = _dest; } 2602381SN/A 2612381SN/A Addr getAddr() const { assert(addrSizeValid); return addr; } 2622641Sstever@eecs.umich.edu int getSize() const { assert(addrSizeValid); return size; } 2632549SN/A Addr getOffset(int blkSize) const { return addr & (Addr)(blkSize - 1); } 2642663Sstever@eecs.umich.edu 2652663Sstever@eecs.umich.edu void addrOverride(Addr newAddr) { assert(addrSizeValid); addr = newAddr; } 2662883Srdreslin@umich.edu void cmdOverride(Command newCmd) { cmd = newCmd; } 2672813Srdreslin@umich.edu 2682813Srdreslin@umich.edu /** Constructor. Note that a Request object must be constructed 2692813Srdreslin@umich.edu * first, but the Requests's physical address and size fields 2702641Sstever@eecs.umich.edu * need not be valid. The command and destination addresses 2712662Sstever@eecs.umich.edu * must be supplied. */ 2722662Sstever@eecs.umich.edu Packet(Request *_req, Command _cmd, short _dest) 2732662Sstever@eecs.umich.edu : data(NULL), staticData(false), dynamicData(false), arrayData(false), 2742662Sstever@eecs.umich.edu addr(_req->paddr), size(_req->size), dest(_dest), 2752641Sstever@eecs.umich.edu addrSizeValid(_req->validPaddr), 2762566SN/A srcValid(false), 2772641Sstever@eecs.umich.edu req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 2782663Sstever@eecs.umich.edu result(Unknown) 2792814Srdreslin@umich.edu { 2802641Sstever@eecs.umich.edu flags = 0; 2812662Sstever@eecs.umich.edu time = curTick; 2822641Sstever@eecs.umich.edu } 2832813Srdreslin@umich.edu 2843018Srdreslin@umich.edu /** Alternate constructor if you are trying to create a packet with 2852813Srdreslin@umich.edu * a request that is for a whole block, not the address from the req. 2862813Srdreslin@umich.edu * this allows for overriding the size/addr of the req.*/ 2872813Srdreslin@umich.edu Packet(Request *_req, Command _cmd, short _dest, int _blkSize) 2882813Srdreslin@umich.edu : data(NULL), staticData(false), dynamicData(false), arrayData(false), 2892813Srdreslin@umich.edu addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), 2902813Srdreslin@umich.edu dest(_dest), 2912813Srdreslin@umich.edu addrSizeValid(_req->validPaddr), srcValid(false), 2922813Srdreslin@umich.edu req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 2932814Srdreslin@umich.edu result(Unknown) 2942814Srdreslin@umich.edu { 2952813Srdreslin@umich.edu flags = 0; 2962813Srdreslin@umich.edu time = curTick; 2972813Srdreslin@umich.edu } 2982813Srdreslin@umich.edu 2993018Srdreslin@umich.edu /** Destructor. */ 3002641Sstever@eecs.umich.edu ~Packet() 3012549SN/A { deleteData(); } 3022662Sstever@eecs.umich.edu 3032566SN/A /** Reinitialize packet address and size from the associated 3042566SN/A * Request object, and reset other fields that may have been 3052566SN/A * modified by a previous transaction. Typically called when a 3062662Sstever@eecs.umich.edu * statically allocated Request/Packet pair is reused for 3072662Sstever@eecs.umich.edu * multiple transactions. */ 3082662Sstever@eecs.umich.edu void reinitFromRequest() { 3092662Sstever@eecs.umich.edu assert(req->validPaddr); 3102662Sstever@eecs.umich.edu addr = req->paddr; 3112662Sstever@eecs.umich.edu size = req->size; 3122662Sstever@eecs.umich.edu time = req->time; 3132663Sstever@eecs.umich.edu addrSizeValid = true; 3142663Sstever@eecs.umich.edu result = Unknown; 3153018Srdreslin@umich.edu if (dynamicData) { 3162663Sstever@eecs.umich.edu deleteData(); 3172662Sstever@eecs.umich.edu dynamicData = false; 3182662Sstever@eecs.umich.edu arrayData = false; 3192662Sstever@eecs.umich.edu } 3202662Sstever@eecs.umich.edu } 3212662Sstever@eecs.umich.edu 3222662Sstever@eecs.umich.edu /** Take a request packet and modify it in place to be suitable 3232662Sstever@eecs.umich.edu * for returning as a response to that request. Used for timing 3242566SN/A * accesses only. For atomic and functional accesses, the 3252662Sstever@eecs.umich.edu * request packet is always implicitly passed back *without* 3262662Sstever@eecs.umich.edu * modifying the destination fields, so this function 3272662Sstever@eecs.umich.edu * should not be called. */ 3282662Sstever@eecs.umich.edu void makeTimingResponse() { 3293135Srdreslin@umich.edu assert(needsResponse()); 3302662Sstever@eecs.umich.edu assert(isRequest()); 3312662Sstever@eecs.umich.edu int icmd = (int)cmd; 3322662Sstever@eecs.umich.edu icmd &= ~(IsRequest); 3332855Srdreslin@umich.edu icmd |= IsResponse; 3342662Sstever@eecs.umich.edu cmd = (Command)icmd; 3352855Srdreslin@umich.edu dest = src; 3362662Sstever@eecs.umich.edu srcValid = false; 3373216Srdreslin@umich.edu } 3383216Srdreslin@umich.edu 3393217Srdreslin@umich.edu /** Take a request packet and modify it in place to be suitable 3403217Srdreslin@umich.edu * for returning as a response to that request. 3412662Sstever@eecs.umich.edu */ 3422662Sstever@eecs.umich.edu void makeAtomicResponse() { 3432662Sstever@eecs.umich.edu assert(needsResponse()); 3442641Sstever@eecs.umich.edu assert(isRequest()); 3452641Sstever@eecs.umich.edu int icmd = (int)cmd; 3463348Sbinkertn@umich.edu icmd &= ~(IsRequest); 3473348Sbinkertn@umich.edu icmd |= IsResponse; 3483348Sbinkertn@umich.edu cmd = (Command)icmd; 3493135Srdreslin@umich.edu } 3503348Sbinkertn@umich.edu 3513348Sbinkertn@umich.edu /** Take a request packet that has been returned as NACKED and modify it so 3523135Srdreslin@umich.edu * that it can be sent out again. Only packets that need a response can be 3533135Srdreslin@umich.edu * NACKED, so verify that that is true. */ 3543135Srdreslin@umich.edu void reinitNacked() { 3553135Srdreslin@umich.edu assert(needsResponse() && result == Nacked); 3563135Srdreslin@umich.edu dest = Broadcast; 3573261Srdreslin@umich.edu result = Unknown; 3583261Srdreslin@umich.edu } 3593261Srdreslin@umich.edu 3603261Srdreslin@umich.edu 3613135Srdreslin@umich.edu /** Set the data pointer to the following value that should not be freed. */ 3623135Srdreslin@umich.edu template <typename T> 3633135Srdreslin@umich.edu void dataStatic(T *p); 3643348Sbinkertn@umich.edu 3653348Sbinkertn@umich.edu /** Set the data pointer to a value that should have delete [] called on it. 3663348Sbinkertn@umich.edu */ 3673348Sbinkertn@umich.edu template <typename T> 3683348Sbinkertn@umich.edu void dataDynamicArray(T *p); 3693348Sbinkertn@umich.edu 3703348Sbinkertn@umich.edu /** set the data pointer to a value that should have delete called on it. */ 3713348Sbinkertn@umich.edu template <typename T> 3722685Ssaidi@eecs.umich.edu void dataDynamic(T *p); 3732685Ssaidi@eecs.umich.edu 3742685Ssaidi@eecs.umich.edu /** return the value of what is pointed to in the packet. */ 3752685Ssaidi@eecs.umich.edu template <typename T> 3762685Ssaidi@eecs.umich.edu T get(); 3772685Ssaidi@eecs.umich.edu 3783348Sbinkertn@umich.edu /** get a pointer to the data ptr. */ 3793348Sbinkertn@umich.edu template <typename T> 3803348Sbinkertn@umich.edu T* getPtr(); 3812566SN/A 3822566SN/A /** set the value in the data pointer to v. */ 3833348Sbinkertn@umich.edu template <typename T> 3843348Sbinkertn@umich.edu void set(T v); 3853348Sbinkertn@umich.edu 3863348Sbinkertn@umich.edu /** delete the data pointed to in the data pointer. Ok to call to matter how 3873348Sbinkertn@umich.edu * data was allocted. */ 3883348Sbinkertn@umich.edu void deleteData(); 3893348Sbinkertn@umich.edu 3903348Sbinkertn@umich.edu /** If there isn't data in the packet, allocate some. */ 3912566SN/A void allocate(); 3923348Sbinkertn@umich.edu 3933348Sbinkertn@umich.edu /** Do the packet modify the same addresses. */ 3943348Sbinkertn@umich.edu bool intersect(Packet *p); 3953348Sbinkertn@umich.edu}; 3962566SN/A 3973348Sbinkertn@umich.edubool fixPacket(Packet *func, Packet *timing); 3983348Sbinkertn@umich.edu#endif //__MEM_PACKET_HH 3993348Sbinkertn@umich.edu