packet.hh revision 7691
12381SN/A/* 22592SN/A * Copyright (c) 2006 The Regents of The University of Michigan 37636Ssteve.reinhardt@amd.com * Copyright (c) 2010 Advanced Micro Devices, Inc. 42381SN/A * All rights reserved. 52381SN/A * 62381SN/A * Redistribution and use in source and binary forms, with or without 72381SN/A * modification, are permitted provided that the following conditions are 82381SN/A * met: redistributions of source code must retain the above copyright 92381SN/A * notice, this list of conditions and the following disclaimer; 102381SN/A * redistributions in binary form must reproduce the above copyright 112381SN/A * notice, this list of conditions and the following disclaimer in the 122381SN/A * documentation and/or other materials provided with the distribution; 132381SN/A * neither the name of the copyright holders nor the names of its 142381SN/A * contributors may be used to endorse or promote products derived from 152381SN/A * this software without specific prior written permission. 162381SN/A * 172381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282665Ssaidi@eecs.umich.edu * 292665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski 302665Ssaidi@eecs.umich.edu * Steve Reinhardt 312665Ssaidi@eecs.umich.edu * Ali Saidi 322381SN/A */ 332381SN/A 342381SN/A/** 352381SN/A * @file 362662Sstever@eecs.umich.edu * Declaration of the Packet class. 372381SN/A */ 382381SN/A 392381SN/A#ifndef __MEM_PACKET_HH__ 402381SN/A#define __MEM_PACKET_HH__ 412381SN/A 423348Sbinkertn@umich.edu#include <cassert> 433348Sbinkertn@umich.edu#include <list> 444022Sstever@eecs.umich.edu#include <bitset> 453348Sbinkertn@umich.edu 465735Snate@binkert.org#include "base/cast.hh" 474024Sbinkertn@umich.edu#include "base/compiler.hh" 484610Ssaidi@eecs.umich.edu#include "base/fast_alloc.hh" 495735Snate@binkert.org#include "base/flags.hh" 503940Ssaidi@eecs.umich.edu#include "base/misc.hh" 515314Sstever@gmail.com#include "base/printable.hh" 526216Snate@binkert.org#include "base/types.hh" 532392SN/A#include "mem/request.hh" 544167Sbinkertn@umich.edu#include "sim/core.hh" 552394SN/A 562394SN/Astruct Packet; 573349Sbinkertn@umich.edutypedef Packet *PacketPtr; 582394SN/Atypedef uint8_t* PacketDataPtr; 592812Srdreslin@umich.edutypedef std::list<PacketPtr> PacketList; 602812Srdreslin@umich.edu 614022Sstever@eecs.umich.educlass MemCmd 624022Sstever@eecs.umich.edu{ 635735Snate@binkert.org friend class Packet; 645735Snate@binkert.org 654022Sstever@eecs.umich.edu public: 665735Snate@binkert.org /** 675735Snate@binkert.org * List of all commands associated with a packet. 685735Snate@binkert.org */ 694022Sstever@eecs.umich.edu enum Command 704022Sstever@eecs.umich.edu { 714022Sstever@eecs.umich.edu InvalidCmd, 724022Sstever@eecs.umich.edu ReadReq, 734473Sstever@eecs.umich.edu ReadResp, 745319Sstever@gmail.com ReadRespWithInvalidate, 754022Sstever@eecs.umich.edu WriteReq, 764022Sstever@eecs.umich.edu WriteResp, 774022Sstever@eecs.umich.edu Writeback, 784022Sstever@eecs.umich.edu SoftPFReq, 794022Sstever@eecs.umich.edu HardPFReq, 804022Sstever@eecs.umich.edu SoftPFResp, 814022Sstever@eecs.umich.edu HardPFResp, 824022Sstever@eecs.umich.edu WriteInvalidateReq, 834022Sstever@eecs.umich.edu WriteInvalidateResp, 844022Sstever@eecs.umich.edu UpgradeReq, 857465Ssteve.reinhardt@amd.com SCUpgradeReq, // Special "weak" upgrade for StoreCond 864628Sstever@eecs.umich.edu UpgradeResp, 877465Ssteve.reinhardt@amd.com SCUpgradeFailReq, // Failed SCUpgradeReq in MSHR (never sent) 887465Ssteve.reinhardt@amd.com UpgradeFailResp, // Valid for SCUpgradeReq only 894022Sstever@eecs.umich.edu ReadExReq, 904022Sstever@eecs.umich.edu ReadExResp, 914626Sstever@eecs.umich.edu LoadLockedReq, 924626Sstever@eecs.umich.edu StoreCondReq, 937669Ssteve.reinhardt@amd.com StoreCondFailReq, // Failed StoreCondReq in MSHR (never sent) 944626Sstever@eecs.umich.edu StoreCondResp, 954040Ssaidi@eecs.umich.edu SwapReq, 964040Ssaidi@eecs.umich.edu SwapResp, 975650Sgblack@eecs.umich.edu MessageReq, 985650Sgblack@eecs.umich.edu MessageResp, 994870Sstever@eecs.umich.edu // Error responses 1004870Sstever@eecs.umich.edu // @TODO these should be classified as responses rather than 1014870Sstever@eecs.umich.edu // requests; coding them as requests initially for backwards 1024870Sstever@eecs.umich.edu // compatibility 1034870Sstever@eecs.umich.edu NetworkNackError, // nacked at network layer (not by protocol) 1044870Sstever@eecs.umich.edu InvalidDestError, // packet dest field invalid 1054870Sstever@eecs.umich.edu BadAddressError, // memory address invalid 1065314Sstever@gmail.com // Fake simulator-only commands 1075314Sstever@gmail.com PrintReq, // Print state matching address 1084022Sstever@eecs.umich.edu NUM_MEM_CMDS 1094022Sstever@eecs.umich.edu }; 1104022Sstever@eecs.umich.edu 1114022Sstever@eecs.umich.edu private: 1125735Snate@binkert.org /** 1135735Snate@binkert.org * List of command attributes. 1145735Snate@binkert.org */ 1154022Sstever@eecs.umich.edu enum Attribute 1164022Sstever@eecs.umich.edu { 1174626Sstever@eecs.umich.edu IsRead, //!< Data flows from responder to requester 1184626Sstever@eecs.umich.edu IsWrite, //!< Data flows from requester to responder 1197465Ssteve.reinhardt@amd.com IsUpgrade, 1204626Sstever@eecs.umich.edu IsPrefetch, //!< Not a demand access 1214022Sstever@eecs.umich.edu IsInvalidate, 1224626Sstever@eecs.umich.edu NeedsExclusive, //!< Requires exclusive copy to complete in-cache 1234626Sstever@eecs.umich.edu IsRequest, //!< Issued by requester 1244626Sstever@eecs.umich.edu IsResponse, //!< Issue by responder 1254626Sstever@eecs.umich.edu NeedsResponse, //!< Requester needs response from target 1264022Sstever@eecs.umich.edu IsSWPrefetch, 1274022Sstever@eecs.umich.edu IsHWPrefetch, 1286076Sgblack@eecs.umich.edu IsLlsc, //!< Alpha/MIPS LL or SC access 1294626Sstever@eecs.umich.edu HasData, //!< There is an associated payload 1304870Sstever@eecs.umich.edu IsError, //!< Error response 1315314Sstever@gmail.com IsPrint, //!< Print state matching address (for debugging) 1324022Sstever@eecs.umich.edu NUM_COMMAND_ATTRIBUTES 1334022Sstever@eecs.umich.edu }; 1344022Sstever@eecs.umich.edu 1355735Snate@binkert.org /** 1365735Snate@binkert.org * Structure that defines attributes and other data associated 1375735Snate@binkert.org * with a Command. 1385735Snate@binkert.org */ 1395735Snate@binkert.org struct CommandInfo 1405735Snate@binkert.org { 1415735Snate@binkert.org /// Set of attribute flags. 1424022Sstever@eecs.umich.edu const std::bitset<NUM_COMMAND_ATTRIBUTES> attributes; 1435735Snate@binkert.org /// Corresponding response for requests; InvalidCmd if no 1445735Snate@binkert.org /// response is applicable. 1454022Sstever@eecs.umich.edu const Command response; 1465735Snate@binkert.org /// String representation (for printing) 1474022Sstever@eecs.umich.edu const std::string str; 1484022Sstever@eecs.umich.edu }; 1494022Sstever@eecs.umich.edu 1505735Snate@binkert.org /// Array to map Command enum to associated info. 1514022Sstever@eecs.umich.edu static const CommandInfo commandInfo[]; 1524022Sstever@eecs.umich.edu 1534022Sstever@eecs.umich.edu private: 1544022Sstever@eecs.umich.edu 1554022Sstever@eecs.umich.edu Command cmd; 1564022Sstever@eecs.umich.edu 1575735Snate@binkert.org bool 1585735Snate@binkert.org testCmdAttrib(MemCmd::Attribute attrib) const 1595735Snate@binkert.org { 1604022Sstever@eecs.umich.edu return commandInfo[cmd].attributes[attrib] != 0; 1614022Sstever@eecs.umich.edu } 1624022Sstever@eecs.umich.edu 1634022Sstever@eecs.umich.edu public: 1644022Sstever@eecs.umich.edu 1654022Sstever@eecs.umich.edu bool isRead() const { return testCmdAttrib(IsRead); } 1667465Ssteve.reinhardt@amd.com bool isWrite() const { return testCmdAttrib(IsWrite); } 1677465Ssteve.reinhardt@amd.com bool isUpgrade() const { return testCmdAttrib(IsUpgrade); } 1684022Sstever@eecs.umich.edu bool isRequest() const { return testCmdAttrib(IsRequest); } 1694022Sstever@eecs.umich.edu bool isResponse() const { return testCmdAttrib(IsResponse); } 1704870Sstever@eecs.umich.edu bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); } 1714022Sstever@eecs.umich.edu bool needsResponse() const { return testCmdAttrib(NeedsResponse); } 1724022Sstever@eecs.umich.edu bool isInvalidate() const { return testCmdAttrib(IsInvalidate); } 1734022Sstever@eecs.umich.edu bool hasData() const { return testCmdAttrib(HasData); } 1744626Sstever@eecs.umich.edu bool isReadWrite() const { return isRead() && isWrite(); } 1756102Sgblack@eecs.umich.edu bool isLLSC() const { return testCmdAttrib(IsLlsc); } 1764870Sstever@eecs.umich.edu bool isError() const { return testCmdAttrib(IsError); } 1775314Sstever@gmail.com bool isPrint() const { return testCmdAttrib(IsPrint); } 1784022Sstever@eecs.umich.edu 1795735Snate@binkert.org const Command 1805735Snate@binkert.org responseCommand() const 1815735Snate@binkert.org { 1824022Sstever@eecs.umich.edu return commandInfo[cmd].response; 1834022Sstever@eecs.umich.edu } 1844022Sstever@eecs.umich.edu 1855735Snate@binkert.org /// Return the string to a cmd given by idx. 1865735Snate@binkert.org const std::string &toString() const { return commandInfo[cmd].str; } 1874022Sstever@eecs.umich.edu int toInt() const { return (int)cmd; } 1884022Sstever@eecs.umich.edu 1895735Snate@binkert.org MemCmd(Command _cmd) : cmd(_cmd) { } 1905735Snate@binkert.org MemCmd(int _cmd) : cmd((Command)_cmd) { } 1915735Snate@binkert.org MemCmd() : cmd(InvalidCmd) { } 1924022Sstever@eecs.umich.edu 1935735Snate@binkert.org bool operator==(MemCmd c2) const { return (cmd == c2.cmd); } 1945735Snate@binkert.org bool operator!=(MemCmd c2) const { return (cmd != c2.cmd); } 1954022Sstever@eecs.umich.edu}; 1964022Sstever@eecs.umich.edu 1972381SN/A/** 1982662Sstever@eecs.umich.edu * A Packet is used to encapsulate a transfer between two objects in 1992662Sstever@eecs.umich.edu * the memory system (e.g., the L1 and L2 cache). (In contrast, a 2002662Sstever@eecs.umich.edu * single Request travels all the way from the requester to the 2012662Sstever@eecs.umich.edu * ultimate destination and back, possibly being conveyed by several 2022662Sstever@eecs.umich.edu * different Packets along the way.) 2032381SN/A */ 2045314Sstever@gmail.comclass Packet : public FastAlloc, public Printable 2052381SN/A{ 2062813Srdreslin@umich.edu public: 2075735Snate@binkert.org typedef uint32_t FlagsType; 2085735Snate@binkert.org typedef ::Flags<FlagsType> Flags; 2095735Snate@binkert.org typedef short NodeID; 2104022Sstever@eecs.umich.edu 2115735Snate@binkert.org private: 2125735Snate@binkert.org static const FlagsType PUBLIC_FLAGS = 0x00000000; 2135735Snate@binkert.org static const FlagsType PRIVATE_FLAGS = 0x00007F0F; 2145735Snate@binkert.org static const FlagsType COPY_FLAGS = 0x0000000F; 2155735Snate@binkert.org 2165735Snate@binkert.org static const FlagsType SHARED = 0x00000001; 2175735Snate@binkert.org // Special control flags 2185735Snate@binkert.org /// Special timing-mode atomic snoop for multi-level coherence. 2195735Snate@binkert.org static const FlagsType EXPRESS_SNOOP = 0x00000002; 2205735Snate@binkert.org /// Does supplier have exclusive copy? 2215735Snate@binkert.org /// Useful for multi-level coherence. 2225735Snate@binkert.org static const FlagsType SUPPLY_EXCLUSIVE = 0x00000004; 2235735Snate@binkert.org // Snoop response flags 2245735Snate@binkert.org static const FlagsType MEM_INHIBIT = 0x00000008; 2255735Snate@binkert.org /// Are the 'addr' and 'size' fields valid? 2265735Snate@binkert.org static const FlagsType VALID_ADDR = 0x00000100; 2275735Snate@binkert.org static const FlagsType VALID_SIZE = 0x00000200; 2285735Snate@binkert.org /// Is the 'src' field valid? 2295735Snate@binkert.org static const FlagsType VALID_SRC = 0x00000400; 2305735Snate@binkert.org static const FlagsType VALID_DST = 0x00000800; 2315735Snate@binkert.org /// Is the data pointer set to a value that shouldn't be freed 2325735Snate@binkert.org /// when the packet is destroyed? 2335735Snate@binkert.org static const FlagsType STATIC_DATA = 0x00001000; 2345735Snate@binkert.org /// The data pointer points to a value that should be freed when 2355735Snate@binkert.org /// the packet is destroyed. 2365735Snate@binkert.org static const FlagsType DYNAMIC_DATA = 0x00002000; 2375735Snate@binkert.org /// the data pointer points to an array (thus delete []) needs to 2385735Snate@binkert.org /// be called on it rather than simply delete. 2395735Snate@binkert.org static const FlagsType ARRAY_DATA = 0x00004000; 2405735Snate@binkert.org 2415735Snate@binkert.org Flags flags; 2425735Snate@binkert.org 2435735Snate@binkert.org public: 2444022Sstever@eecs.umich.edu typedef MemCmd::Command Command; 2454022Sstever@eecs.umich.edu 2465735Snate@binkert.org /// The command field of the packet. 2474870Sstever@eecs.umich.edu MemCmd cmd; 2484870Sstever@eecs.umich.edu 2495735Snate@binkert.org /// A pointer to the original request. 2504870Sstever@eecs.umich.edu RequestPtr req; 2514870Sstever@eecs.umich.edu 2522566SN/A private: 2535735Snate@binkert.org /** 2545735Snate@binkert.org * A pointer to the data being transfered. It can be differnt 2555735Snate@binkert.org * sizes at each level of the heirarchy so it belongs in the 2565735Snate@binkert.org * packet, not request. This may or may not be populated when a 2575735Snate@binkert.org * responder recieves the packet. If not populated it memory should 2585735Snate@binkert.org * be allocated. 2592566SN/A */ 2602566SN/A PacketDataPtr data; 2612566SN/A 2625735Snate@binkert.org /// The address of the request. This address could be virtual or 2635735Snate@binkert.org /// physical, depending on the system configuration. 2642381SN/A Addr addr; 2652381SN/A 2665735Snate@binkert.org /// The size of the request or transfer. 2676227Snate@binkert.org unsigned size; 2682381SN/A 2695735Snate@binkert.org /** 2705735Snate@binkert.org * Device address (e.g., bus ID) of the source of the 2715735Snate@binkert.org * transaction. The source is not responsible for setting this 2725735Snate@binkert.org * field; it is set implicitly by the interconnect when the packet 2735735Snate@binkert.org * is first sent. 2745735Snate@binkert.org */ 2755735Snate@binkert.org NodeID src; 2762381SN/A 2775735Snate@binkert.org /** 2785735Snate@binkert.org * Device address (e.g., bus ID) of the destination of the 2795735Snate@binkert.org * transaction. The special value Broadcast indicates that the 2805735Snate@binkert.org * packet should be routed based on its address. This field is 2815735Snate@binkert.org * initialized in the constructor and is thus always valid (unlike 2825735Snate@binkert.org * addr, size, and src). 2835735Snate@binkert.org */ 2845735Snate@binkert.org NodeID dest; 2852641Sstever@eecs.umich.edu 2865735Snate@binkert.org /** 2875735Snate@binkert.org * The original value of the command field. Only valid when the 2884870Sstever@eecs.umich.edu * current command field is an error condition; in that case, the 2894870Sstever@eecs.umich.edu * previous contents of the command field are copied here. This 2904870Sstever@eecs.umich.edu * field is *not* set on non-error responses. 2914870Sstever@eecs.umich.edu */ 2924870Sstever@eecs.umich.edu MemCmd origCmd; 2934870Sstever@eecs.umich.edu 2942641Sstever@eecs.umich.edu public: 2955735Snate@binkert.org /// Used to calculate latencies for each packet. 2962811Srdreslin@umich.edu Tick time; 2972811Srdreslin@umich.edu 2985735Snate@binkert.org /// The time at which the packet will be fully transmitted 2993218Sgblack@eecs.umich.edu Tick finishTime; 3003218Sgblack@eecs.umich.edu 3015735Snate@binkert.org /// The time at which the first chunk of the packet will be transmitted 3023218Sgblack@eecs.umich.edu Tick firstWordTime; 3033218Sgblack@eecs.umich.edu 3045735Snate@binkert.org /// The special destination address indicating that the packet 3055735Snate@binkert.org /// should be routed based on its address. 3065735Snate@binkert.org static const NodeID Broadcast = -1; 3072623SN/A 3085735Snate@binkert.org /** 3095735Snate@binkert.org * A virtual base opaque structure used to hold state associated 3105735Snate@binkert.org * with the packet but specific to the sending device (e.g., an 3115735Snate@binkert.org * MSHR). A pointer to this state is returned in the packet's 3125735Snate@binkert.org * response so that the sender can quickly look up the state 3135735Snate@binkert.org * needed to process it. A specific subclass would be derived 3145735Snate@binkert.org * from this to carry state specific to a particular sending 3155735Snate@binkert.org * device. 3165735Snate@binkert.org */ 3175735Snate@binkert.org struct SenderState 3185735Snate@binkert.org { 3192641Sstever@eecs.umich.edu virtual ~SenderState() {} 3202641Sstever@eecs.umich.edu }; 3212641Sstever@eecs.umich.edu 3225315Sstever@gmail.com /** 3235315Sstever@gmail.com * Object used to maintain state of a PrintReq. The senderState 3245315Sstever@gmail.com * field of a PrintReq should always be of this type. 3255315Sstever@gmail.com */ 3265735Snate@binkert.org class PrintReqState : public SenderState, public FastAlloc 3275735Snate@binkert.org { 3285735Snate@binkert.org private: 3295735Snate@binkert.org /** 3305735Snate@binkert.org * An entry in the label stack. 3315735Snate@binkert.org */ 3325735Snate@binkert.org struct LabelStackEntry 3335735Snate@binkert.org { 3345314Sstever@gmail.com const std::string label; 3355314Sstever@gmail.com std::string *prefix; 3365314Sstever@gmail.com bool labelPrinted; 3375735Snate@binkert.org LabelStackEntry(const std::string &_label, std::string *_prefix); 3385314Sstever@gmail.com }; 3395314Sstever@gmail.com 3405314Sstever@gmail.com typedef std::list<LabelStackEntry> LabelStack; 3415314Sstever@gmail.com LabelStack labelStack; 3425314Sstever@gmail.com 3435314Sstever@gmail.com std::string *curPrefixPtr; 3445314Sstever@gmail.com 3455314Sstever@gmail.com public: 3465314Sstever@gmail.com std::ostream &os; 3475314Sstever@gmail.com const int verbosity; 3485314Sstever@gmail.com 3495314Sstever@gmail.com PrintReqState(std::ostream &os, int verbosity = 0); 3505314Sstever@gmail.com ~PrintReqState(); 3515314Sstever@gmail.com 3525735Snate@binkert.org /** 3535735Snate@binkert.org * Returns the current line prefix. 3545735Snate@binkert.org */ 3555314Sstever@gmail.com const std::string &curPrefix() { return *curPrefixPtr; } 3565315Sstever@gmail.com 3575735Snate@binkert.org /** 3585735Snate@binkert.org * Push a label onto the label stack, and prepend the given 3595315Sstever@gmail.com * prefix string onto the current prefix. Labels will only be 3605735Snate@binkert.org * printed if an object within the label's scope is printed. 3615735Snate@binkert.org */ 3625314Sstever@gmail.com void pushLabel(const std::string &lbl, 3635314Sstever@gmail.com const std::string &prefix = " "); 3645735Snate@binkert.org 3655735Snate@binkert.org /** 3665735Snate@binkert.org * Pop a label off the label stack. 3675735Snate@binkert.org */ 3685314Sstever@gmail.com void popLabel(); 3695735Snate@binkert.org 3705735Snate@binkert.org /** 3715735Snate@binkert.org * Print all of the pending unprinted labels on the 3725315Sstever@gmail.com * stack. Called by printObj(), so normally not called by 3735735Snate@binkert.org * users unless bypassing printObj(). 3745735Snate@binkert.org */ 3755314Sstever@gmail.com void printLabels(); 3765735Snate@binkert.org 3775735Snate@binkert.org /** 3785735Snate@binkert.org * Print a Printable object to os, because it matched the 3795735Snate@binkert.org * address on a PrintReq. 3805735Snate@binkert.org */ 3815314Sstever@gmail.com void printObj(Printable *obj); 3825314Sstever@gmail.com }; 3835314Sstever@gmail.com 3845735Snate@binkert.org /** 3855735Snate@binkert.org * This packet's sender state. Devices should use dynamic_cast<> 3865735Snate@binkert.org * to cast to the state appropriate to the sender. The intent of 3875735Snate@binkert.org * this variable is to allow a device to attach extra information 3885735Snate@binkert.org * to a request. A response packet must return the sender state 3895735Snate@binkert.org * that was attached to the original request (even if a new packet 3905735Snate@binkert.org * is created). 3915735Snate@binkert.org */ 3922662Sstever@eecs.umich.edu SenderState *senderState; 3932641Sstever@eecs.umich.edu 3945735Snate@binkert.org /// Return the string name of the cmd field (for debugging and 3955735Snate@binkert.org /// tracing). 3964022Sstever@eecs.umich.edu const std::string &cmdString() const { return cmd.toString(); } 3972811Srdreslin@umich.edu 3985735Snate@binkert.org /// Return the index of this command. 3994022Sstever@eecs.umich.edu inline int cmdToIndex() const { return cmd.toInt(); } 4002811Srdreslin@umich.edu 4014022Sstever@eecs.umich.edu bool isRead() const { return cmd.isRead(); } 4027465Ssteve.reinhardt@amd.com bool isWrite() const { return cmd.isWrite(); } 4037465Ssteve.reinhardt@amd.com bool isUpgrade() const { return cmd.isUpgrade(); } 4044022Sstever@eecs.umich.edu bool isRequest() const { return cmd.isRequest(); } 4054022Sstever@eecs.umich.edu bool isResponse() const { return cmd.isResponse(); } 4064870Sstever@eecs.umich.edu bool needsExclusive() const { return cmd.needsExclusive(); } 4074022Sstever@eecs.umich.edu bool needsResponse() const { return cmd.needsResponse(); } 4084022Sstever@eecs.umich.edu bool isInvalidate() const { return cmd.isInvalidate(); } 4094022Sstever@eecs.umich.edu bool hasData() const { return cmd.hasData(); } 4104040Ssaidi@eecs.umich.edu bool isReadWrite() const { return cmd.isReadWrite(); } 4116102Sgblack@eecs.umich.edu bool isLLSC() const { return cmd.isLLSC(); } 4124870Sstever@eecs.umich.edu bool isError() const { return cmd.isError(); } 4135314Sstever@gmail.com bool isPrint() const { return cmd.isPrint(); } 4142812Srdreslin@umich.edu 4154870Sstever@eecs.umich.edu // Snoop flags 4165735Snate@binkert.org void assertMemInhibit() { flags.set(MEM_INHIBIT); } 4175764Snate@binkert.org bool memInhibitAsserted() { return flags.isSet(MEM_INHIBIT); } 4185735Snate@binkert.org void assertShared() { flags.set(SHARED); } 4195764Snate@binkert.org bool sharedAsserted() { return flags.isSet(SHARED); } 4204870Sstever@eecs.umich.edu 4214895Sstever@eecs.umich.edu // Special control flags 4225735Snate@binkert.org void setExpressSnoop() { flags.set(EXPRESS_SNOOP); } 4235764Snate@binkert.org bool isExpressSnoop() { return flags.isSet(EXPRESS_SNOOP); } 4245735Snate@binkert.org void setSupplyExclusive() { flags.set(SUPPLY_EXCLUSIVE); } 4257687Ssteve.reinhardt@amd.com void clearSupplyExclusive() { flags.clear(SUPPLY_EXCLUSIVE); } 4265764Snate@binkert.org bool isSupplyExclusive() { return flags.isSet(SUPPLY_EXCLUSIVE); } 4274895Sstever@eecs.umich.edu 4284870Sstever@eecs.umich.edu // Network error conditions... encapsulate them as methods since 4294870Sstever@eecs.umich.edu // their encoding keeps changing (from result field to command 4304870Sstever@eecs.umich.edu // field, etc.) 4315735Snate@binkert.org void 4325735Snate@binkert.org setNacked() 4335735Snate@binkert.org { 4345735Snate@binkert.org assert(isResponse()); 4355735Snate@binkert.org cmd = MemCmd::NetworkNackError; 4365735Snate@binkert.org } 4375735Snate@binkert.org 4385735Snate@binkert.org void 4395735Snate@binkert.org setBadAddress() 4405735Snate@binkert.org { 4415735Snate@binkert.org assert(isResponse()); 4425735Snate@binkert.org cmd = MemCmd::BadAddressError; 4435735Snate@binkert.org } 4445735Snate@binkert.org 4455735Snate@binkert.org bool wasNacked() const { return cmd == MemCmd::NetworkNackError; } 4465735Snate@binkert.org bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; } 4474986Ssaidi@eecs.umich.edu void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } 4482814Srdreslin@umich.edu 4496768SBrad.Beckmann@amd.com bool isSrcValid() { return flags.isSet(VALID_SRC); } 4505735Snate@binkert.org /// Accessor function to get the source index of the packet. 4515764Snate@binkert.org NodeID getSrc() const { assert(flags.isSet(VALID_SRC)); return src; } 4525735Snate@binkert.org /// Accessor function to set the source index of the packet. 4535735Snate@binkert.org void setSrc(NodeID _src) { src = _src; flags.set(VALID_SRC); } 4545735Snate@binkert.org /// Reset source field, e.g. to retransmit packet on different bus. 4555735Snate@binkert.org void clearSrc() { flags.clear(VALID_SRC); } 4562641Sstever@eecs.umich.edu 4576768SBrad.Beckmann@amd.com bool isDestValid() { return flags.isSet(VALID_DST); } 4585735Snate@binkert.org /// Accessor function for the destination index of the packet. 4595764Snate@binkert.org NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; } 4605735Snate@binkert.org /// Accessor function to set the destination index of the packet. 4615735Snate@binkert.org void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); } 4622381SN/A 4635764Snate@binkert.org Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 4646227Snate@binkert.org unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } 4655735Snate@binkert.org Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); } 4662549SN/A 4675735Snate@binkert.org /** 4687550SBrad.Beckmann@amd.com * It has been determined that the SC packet should successfully update 4697550SBrad.Beckmann@amd.com * memory. Therefore, convert this SC packet to a normal write. 4707550SBrad.Beckmann@amd.com */ 4717550SBrad.Beckmann@amd.com void 4727550SBrad.Beckmann@amd.com convertScToWrite() 4737550SBrad.Beckmann@amd.com { 4747550SBrad.Beckmann@amd.com assert(isLLSC()); 4757550SBrad.Beckmann@amd.com assert(isWrite()); 4767550SBrad.Beckmann@amd.com cmd = MemCmd::WriteReq; 4777550SBrad.Beckmann@amd.com } 4787550SBrad.Beckmann@amd.com 4797550SBrad.Beckmann@amd.com /** 4807550SBrad.Beckmann@amd.com * When ruby is in use, Ruby will monitor the cache line and thus M5 4817550SBrad.Beckmann@amd.com * phys memory should treat LL ops as normal reads. 4827550SBrad.Beckmann@amd.com */ 4837550SBrad.Beckmann@amd.com void 4847550SBrad.Beckmann@amd.com convertLlToRead() 4857550SBrad.Beckmann@amd.com { 4867550SBrad.Beckmann@amd.com assert(isLLSC()); 4877550SBrad.Beckmann@amd.com assert(isRead()); 4887550SBrad.Beckmann@amd.com cmd = MemCmd::ReadReq; 4897550SBrad.Beckmann@amd.com } 4907550SBrad.Beckmann@amd.com 4917550SBrad.Beckmann@amd.com /** 4925735Snate@binkert.org * Constructor. Note that a Request object must be constructed 4935735Snate@binkert.org * first, but the Requests's physical address and size fields need 4945735Snate@binkert.org * not be valid. The command and destination addresses must be 4955735Snate@binkert.org * supplied. 4965735Snate@binkert.org */ 4975735Snate@binkert.org Packet(Request *_req, MemCmd _cmd, NodeID _dest) 4985745Snate@binkert.org : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 4996104Ssteve.reinhardt@amd.com dest(_dest), time(curTick), senderState(NULL) 5002641Sstever@eecs.umich.edu { 5016104Ssteve.reinhardt@amd.com if (req->hasPaddr()) { 5026104Ssteve.reinhardt@amd.com addr = req->getPaddr(); 5036104Ssteve.reinhardt@amd.com flags.set(VALID_ADDR); 5046104Ssteve.reinhardt@amd.com } 5056104Ssteve.reinhardt@amd.com if (req->hasSize()) { 5066104Ssteve.reinhardt@amd.com size = req->getSize(); 5076104Ssteve.reinhardt@amd.com flags.set(VALID_SIZE); 5086104Ssteve.reinhardt@amd.com } 5092813Srdreslin@umich.edu } 5102813Srdreslin@umich.edu 5115735Snate@binkert.org /** 5125735Snate@binkert.org * Alternate constructor if you are trying to create a packet with 5135735Snate@binkert.org * a request that is for a whole block, not the address from the 5145735Snate@binkert.org * req. this allows for overriding the size/addr of the req. 5155735Snate@binkert.org */ 5165735Snate@binkert.org Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize) 5175745Snate@binkert.org : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 5186104Ssteve.reinhardt@amd.com dest(_dest), time(curTick), senderState(NULL) 5192813Srdreslin@umich.edu { 5206104Ssteve.reinhardt@amd.com if (req->hasPaddr()) { 5216104Ssteve.reinhardt@amd.com addr = req->getPaddr() & ~(_blkSize - 1); 5226104Ssteve.reinhardt@amd.com flags.set(VALID_ADDR); 5236104Ssteve.reinhardt@amd.com } 5246104Ssteve.reinhardt@amd.com size = _blkSize; 5256104Ssteve.reinhardt@amd.com flags.set(VALID_SIZE); 5264626Sstever@eecs.umich.edu } 5274626Sstever@eecs.umich.edu 5285735Snate@binkert.org /** 5295735Snate@binkert.org * Alternate constructor for copying a packet. Copy all fields 5304887Sstever@eecs.umich.edu * *except* if the original packet's data was dynamic, don't copy 5314887Sstever@eecs.umich.edu * that, as we can't guarantee that the new packet's lifetime is 5324887Sstever@eecs.umich.edu * less than that of the original packet. In this case the new 5335735Snate@binkert.org * packet should allocate its own data. 5345735Snate@binkert.org */ 5355735Snate@binkert.org Packet(Packet *pkt, bool clearFlags = false) 5365735Snate@binkert.org : cmd(pkt->cmd), req(pkt->req), 5375764Snate@binkert.org data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL), 5385735Snate@binkert.org addr(pkt->addr), size(pkt->size), src(pkt->src), dest(pkt->dest), 5395735Snate@binkert.org time(curTick), senderState(pkt->senderState) 5404626Sstever@eecs.umich.edu { 5415735Snate@binkert.org if (!clearFlags) 5425735Snate@binkert.org flags.set(pkt->flags & COPY_FLAGS); 5435735Snate@binkert.org 5445735Snate@binkert.org flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE|VALID_SRC|VALID_DST)); 5455735Snate@binkert.org flags.set(pkt->flags & STATIC_DATA); 5462641Sstever@eecs.umich.edu } 5472549SN/A 5485735Snate@binkert.org /** 5495735Snate@binkert.org * clean up packet variables 5505735Snate@binkert.org */ 5512566SN/A ~Packet() 5525387Sstever@gmail.com { 5535387Sstever@gmail.com // If this is a request packet for which there's no response, 5545387Sstever@gmail.com // delete the request object here, since the requester will 5555387Sstever@gmail.com // never get the chance. 5565387Sstever@gmail.com if (req && isRequest() && !needsResponse()) 5575387Sstever@gmail.com delete req; 5585735Snate@binkert.org deleteData(); 5595387Sstever@gmail.com } 5602566SN/A 5615735Snate@binkert.org /** 5625735Snate@binkert.org * Reinitialize packet address and size from the associated 5635735Snate@binkert.org * Request object, and reset other fields that may have been 5645735Snate@binkert.org * modified by a previous transaction. Typically called when a 5655735Snate@binkert.org * statically allocated Request/Packet pair is reused for multiple 5665735Snate@binkert.org * transactions. 5675735Snate@binkert.org */ 5685735Snate@binkert.org void 5695735Snate@binkert.org reinitFromRequest() 5705735Snate@binkert.org { 5716104Ssteve.reinhardt@amd.com assert(req->hasPaddr()); 5724870Sstever@eecs.umich.edu flags = 0; 5736104Ssteve.reinhardt@amd.com addr = req->getPaddr(); 5746104Ssteve.reinhardt@amd.com size = req->getSize(); 5756223Snate@binkert.org time = req->time(); 5765735Snate@binkert.org 5775735Snate@binkert.org flags.set(VALID_ADDR|VALID_SIZE); 5785735Snate@binkert.org deleteData(); 5792662Sstever@eecs.umich.edu } 5802566SN/A 5814626Sstever@eecs.umich.edu /** 5824626Sstever@eecs.umich.edu * Take a request packet and modify it in place to be suitable for 5834626Sstever@eecs.umich.edu * returning as a response to that request. The source and 5844626Sstever@eecs.umich.edu * destination fields are *not* modified, as is appropriate for 5854626Sstever@eecs.umich.edu * atomic accesses. 5864626Sstever@eecs.umich.edu */ 5875735Snate@binkert.org void 5885735Snate@binkert.org makeResponse() 5894626Sstever@eecs.umich.edu { 5902662Sstever@eecs.umich.edu assert(needsResponse()); 5912855Srdreslin@umich.edu assert(isRequest()); 5924986Ssaidi@eecs.umich.edu origCmd = cmd; 5934022Sstever@eecs.umich.edu cmd = cmd.responseCommand(); 5945745Snate@binkert.org 5957464Ssteve.reinhardt@amd.com // responses are never express, even if the snoop that 5967464Ssteve.reinhardt@amd.com // triggered them was 5977464Ssteve.reinhardt@amd.com flags.clear(EXPRESS_SNOOP); 5987464Ssteve.reinhardt@amd.com 5995745Snate@binkert.org dest = src; 6005764Snate@binkert.org flags.set(VALID_DST, flags.isSet(VALID_SRC)); 6015745Snate@binkert.org flags.clear(VALID_SRC); 6022641Sstever@eecs.umich.edu } 6032641Sstever@eecs.umich.edu 6045735Snate@binkert.org void 6055735Snate@binkert.org makeAtomicResponse() 6064870Sstever@eecs.umich.edu { 6074870Sstever@eecs.umich.edu makeResponse(); 6084870Sstever@eecs.umich.edu } 6094870Sstever@eecs.umich.edu 6105735Snate@binkert.org void 6115735Snate@binkert.org makeTimingResponse() 6123348Sbinkertn@umich.edu { 6134870Sstever@eecs.umich.edu makeResponse(); 6143135Srdreslin@umich.edu } 6153135Srdreslin@umich.edu 6163348Sbinkertn@umich.edu /** 6173348Sbinkertn@umich.edu * Take a request packet that has been returned as NACKED and 6183348Sbinkertn@umich.edu * modify it so that it can be sent out again. Only packets that 6193348Sbinkertn@umich.edu * need a response can be NACKED, so verify that that is true. 6203348Sbinkertn@umich.edu */ 6213348Sbinkertn@umich.edu void 6223348Sbinkertn@umich.edu reinitNacked() 6233348Sbinkertn@umich.edu { 6244870Sstever@eecs.umich.edu assert(wasNacked()); 6254870Sstever@eecs.umich.edu cmd = origCmd; 6264870Sstever@eecs.umich.edu assert(needsResponse()); 6274870Sstever@eecs.umich.edu setDest(Broadcast); 6282685Ssaidi@eecs.umich.edu } 6292685Ssaidi@eecs.umich.edu 6307006Snate@binkert.org void 6317006Snate@binkert.org setSize(unsigned size) 6327006Snate@binkert.org { 6337006Snate@binkert.org assert(!flags.isSet(VALID_SIZE)); 6347006Snate@binkert.org 6357006Snate@binkert.org this->size = size; 6367006Snate@binkert.org flags.set(VALID_SIZE); 6377006Snate@binkert.org } 6387006Snate@binkert.org 6392685Ssaidi@eecs.umich.edu 6403348Sbinkertn@umich.edu /** 6413348Sbinkertn@umich.edu * Set the data pointer to the following value that should not be 6423348Sbinkertn@umich.edu * freed. 6432566SN/A */ 6442566SN/A template <typename T> 6453348Sbinkertn@umich.edu void 6463348Sbinkertn@umich.edu dataStatic(T *p) 6473348Sbinkertn@umich.edu { 6485764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 6493348Sbinkertn@umich.edu data = (PacketDataPtr)p; 6505735Snate@binkert.org flags.set(STATIC_DATA); 6513348Sbinkertn@umich.edu } 6522566SN/A 6533348Sbinkertn@umich.edu /** 6543348Sbinkertn@umich.edu * Set the data pointer to a value that should have delete [] 6553348Sbinkertn@umich.edu * called on it. 6563348Sbinkertn@umich.edu */ 6572566SN/A template <typename T> 6583348Sbinkertn@umich.edu void 6593348Sbinkertn@umich.edu dataDynamicArray(T *p) 6603348Sbinkertn@umich.edu { 6615764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 6623348Sbinkertn@umich.edu data = (PacketDataPtr)p; 6635735Snate@binkert.org flags.set(DYNAMIC_DATA|ARRAY_DATA); 6643348Sbinkertn@umich.edu } 6653348Sbinkertn@umich.edu 6663348Sbinkertn@umich.edu /** 6673348Sbinkertn@umich.edu * set the data pointer to a value that should have delete called 6683348Sbinkertn@umich.edu * on it. 6693348Sbinkertn@umich.edu */ 6703348Sbinkertn@umich.edu template <typename T> 6713348Sbinkertn@umich.edu void 6723348Sbinkertn@umich.edu dataDynamic(T *p) 6733348Sbinkertn@umich.edu { 6745764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 6753348Sbinkertn@umich.edu data = (PacketDataPtr)p; 6765735Snate@binkert.org flags.set(DYNAMIC_DATA); 6773348Sbinkertn@umich.edu } 6783348Sbinkertn@umich.edu 6795735Snate@binkert.org /** 6805735Snate@binkert.org * get a pointer to the data ptr. 6815735Snate@binkert.org */ 6823348Sbinkertn@umich.edu template <typename T> 6833348Sbinkertn@umich.edu T* 6843348Sbinkertn@umich.edu getPtr() 6853348Sbinkertn@umich.edu { 6865764Snate@binkert.org assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 6873348Sbinkertn@umich.edu return (T*)data; 6883348Sbinkertn@umich.edu } 6892566SN/A 6905735Snate@binkert.org /** 6915735Snate@binkert.org * return the value of what is pointed to in the packet. 6925735Snate@binkert.org */ 6932566SN/A template <typename T> 6942592SN/A T get(); 6952566SN/A 6965735Snate@binkert.org /** 6975735Snate@binkert.org * set the value in the data pointer to v. 6985735Snate@binkert.org */ 6992566SN/A template <typename T> 7002592SN/A void set(T v); 7012566SN/A 7023348Sbinkertn@umich.edu /** 7034626Sstever@eecs.umich.edu * Copy data into the packet from the provided pointer. 7044626Sstever@eecs.umich.edu */ 7055735Snate@binkert.org void 7065735Snate@binkert.org setData(uint8_t *p) 7074626Sstever@eecs.umich.edu { 7087691SAli.Saidi@ARM.com if (p != getPtr<uint8_t>()) 7097691SAli.Saidi@ARM.com std::memcpy(getPtr<uint8_t>(), p, getSize()); 7104626Sstever@eecs.umich.edu } 7114626Sstever@eecs.umich.edu 7124626Sstever@eecs.umich.edu /** 7134626Sstever@eecs.umich.edu * Copy data into the packet from the provided block pointer, 7144626Sstever@eecs.umich.edu * which is aligned to the given block size. 7154626Sstever@eecs.umich.edu */ 7165735Snate@binkert.org void 7175735Snate@binkert.org setDataFromBlock(uint8_t *blk_data, int blkSize) 7184626Sstever@eecs.umich.edu { 7194626Sstever@eecs.umich.edu setData(blk_data + getOffset(blkSize)); 7204626Sstever@eecs.umich.edu } 7214626Sstever@eecs.umich.edu 7224626Sstever@eecs.umich.edu /** 7234626Sstever@eecs.umich.edu * Copy data from the packet to the provided block pointer, which 7244626Sstever@eecs.umich.edu * is aligned to the given block size. 7254626Sstever@eecs.umich.edu */ 7265735Snate@binkert.org void 7275735Snate@binkert.org writeData(uint8_t *p) 7284626Sstever@eecs.umich.edu { 7294626Sstever@eecs.umich.edu std::memcpy(p, getPtr<uint8_t>(), getSize()); 7304626Sstever@eecs.umich.edu } 7314626Sstever@eecs.umich.edu 7324626Sstever@eecs.umich.edu /** 7334626Sstever@eecs.umich.edu * Copy data from the packet to the memory at the provided pointer. 7344626Sstever@eecs.umich.edu */ 7355735Snate@binkert.org void 7365735Snate@binkert.org writeDataToBlock(uint8_t *blk_data, int blkSize) 7374626Sstever@eecs.umich.edu { 7384626Sstever@eecs.umich.edu writeData(blk_data + getOffset(blkSize)); 7394626Sstever@eecs.umich.edu } 7404626Sstever@eecs.umich.edu 7414626Sstever@eecs.umich.edu /** 7423348Sbinkertn@umich.edu * delete the data pointed to in the data pointer. Ok to call to 7433348Sbinkertn@umich.edu * matter how data was allocted. 7443348Sbinkertn@umich.edu */ 7455735Snate@binkert.org void 7465735Snate@binkert.org deleteData() 7475735Snate@binkert.org { 7485764Snate@binkert.org if (flags.isSet(ARRAY_DATA)) 7495735Snate@binkert.org delete [] data; 7505764Snate@binkert.org else if (flags.isSet(DYNAMIC_DATA)) 7515735Snate@binkert.org delete data; 7525735Snate@binkert.org 7535735Snate@binkert.org flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA); 7545735Snate@binkert.org data = NULL; 7555735Snate@binkert.org } 7562566SN/A 7572566SN/A /** If there isn't data in the packet, allocate some. */ 7585735Snate@binkert.org void 7595735Snate@binkert.org allocate() 7605735Snate@binkert.org { 7615735Snate@binkert.org if (data) { 7625764Snate@binkert.org assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 7635745Snate@binkert.org return; 7645735Snate@binkert.org } 7655745Snate@binkert.org 7665764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 7675745Snate@binkert.org flags.set(DYNAMIC_DATA|ARRAY_DATA); 7685745Snate@binkert.org data = new uint8_t[getSize()]; 7695735Snate@binkert.org } 7705735Snate@binkert.org 7712568SN/A 7724626Sstever@eecs.umich.edu /** 7734626Sstever@eecs.umich.edu * Check a functional request against a memory value represented 7744626Sstever@eecs.umich.edu * by a base/size pair and an associated data array. If the 7754626Sstever@eecs.umich.edu * functional request is a read, it may be satisfied by the memory 7764626Sstever@eecs.umich.edu * value. If the functional request is a write, it may update the 7774626Sstever@eecs.umich.edu * memory value. 7784626Sstever@eecs.umich.edu */ 7795314Sstever@gmail.com bool checkFunctional(Printable *obj, Addr base, int size, uint8_t *data); 7804626Sstever@eecs.umich.edu 7814626Sstever@eecs.umich.edu /** 7824626Sstever@eecs.umich.edu * Check a functional request against a memory value stored in 7835315Sstever@gmail.com * another packet (i.e. an in-transit request or response). 7844626Sstever@eecs.umich.edu */ 7855735Snate@binkert.org bool 7865735Snate@binkert.org checkFunctional(PacketPtr other) 7875735Snate@binkert.org { 7885735Snate@binkert.org uint8_t *data = other->hasData() ? other->getPtr<uint8_t>() : NULL; 7895735Snate@binkert.org return checkFunctional(other, other->getAddr(), other->getSize(), 7905735Snate@binkert.org data); 7914626Sstever@eecs.umich.edu } 7925314Sstever@gmail.com 7935315Sstever@gmail.com /** 7945315Sstever@gmail.com * Push label for PrintReq (safe to call unconditionally). 7955315Sstever@gmail.com */ 7965735Snate@binkert.org void 7975735Snate@binkert.org pushLabel(const std::string &lbl) 7985735Snate@binkert.org { 7995735Snate@binkert.org if (isPrint()) 8005735Snate@binkert.org safe_cast<PrintReqState*>(senderState)->pushLabel(lbl); 8015314Sstever@gmail.com } 8025314Sstever@gmail.com 8035315Sstever@gmail.com /** 8045315Sstever@gmail.com * Pop label for PrintReq (safe to call unconditionally). 8055315Sstever@gmail.com */ 8065735Snate@binkert.org void 8075735Snate@binkert.org popLabel() 8085735Snate@binkert.org { 8095735Snate@binkert.org if (isPrint()) 8105735Snate@binkert.org safe_cast<PrintReqState*>(senderState)->popLabel(); 8115314Sstever@gmail.com } 8125314Sstever@gmail.com 8135314Sstever@gmail.com void print(std::ostream &o, int verbosity = 0, 8145314Sstever@gmail.com const std::string &prefix = "") const; 8152381SN/A}; 8162381SN/A 8172381SN/A#endif //__MEM_PACKET_HH 818