packet.hh revision 7636
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, 934626Sstever@eecs.umich.edu StoreCondResp, 944040Ssaidi@eecs.umich.edu SwapReq, 954040Ssaidi@eecs.umich.edu SwapResp, 965650Sgblack@eecs.umich.edu MessageReq, 975650Sgblack@eecs.umich.edu MessageResp, 984870Sstever@eecs.umich.edu // Error responses 994870Sstever@eecs.umich.edu // @TODO these should be classified as responses rather than 1004870Sstever@eecs.umich.edu // requests; coding them as requests initially for backwards 1014870Sstever@eecs.umich.edu // compatibility 1024870Sstever@eecs.umich.edu NetworkNackError, // nacked at network layer (not by protocol) 1034870Sstever@eecs.umich.edu InvalidDestError, // packet dest field invalid 1044870Sstever@eecs.umich.edu BadAddressError, // memory address invalid 1055314Sstever@gmail.com // Fake simulator-only commands 1065314Sstever@gmail.com PrintReq, // Print state matching address 1074022Sstever@eecs.umich.edu NUM_MEM_CMDS 1084022Sstever@eecs.umich.edu }; 1094022Sstever@eecs.umich.edu 1104022Sstever@eecs.umich.edu private: 1115735Snate@binkert.org /** 1125735Snate@binkert.org * List of command attributes. 1135735Snate@binkert.org */ 1144022Sstever@eecs.umich.edu enum Attribute 1154022Sstever@eecs.umich.edu { 1164626Sstever@eecs.umich.edu IsRead, //!< Data flows from responder to requester 1174626Sstever@eecs.umich.edu IsWrite, //!< Data flows from requester to responder 1187465Ssteve.reinhardt@amd.com IsUpgrade, 1194626Sstever@eecs.umich.edu IsPrefetch, //!< Not a demand access 1204022Sstever@eecs.umich.edu IsInvalidate, 1214626Sstever@eecs.umich.edu NeedsExclusive, //!< Requires exclusive copy to complete in-cache 1224626Sstever@eecs.umich.edu IsRequest, //!< Issued by requester 1234626Sstever@eecs.umich.edu IsResponse, //!< Issue by responder 1244626Sstever@eecs.umich.edu NeedsResponse, //!< Requester needs response from target 1254022Sstever@eecs.umich.edu IsSWPrefetch, 1264022Sstever@eecs.umich.edu IsHWPrefetch, 1276076Sgblack@eecs.umich.edu IsLlsc, //!< Alpha/MIPS LL or SC access 1284626Sstever@eecs.umich.edu HasData, //!< There is an associated payload 1294870Sstever@eecs.umich.edu IsError, //!< Error response 1305314Sstever@gmail.com IsPrint, //!< Print state matching address (for debugging) 1314022Sstever@eecs.umich.edu NUM_COMMAND_ATTRIBUTES 1324022Sstever@eecs.umich.edu }; 1334022Sstever@eecs.umich.edu 1345735Snate@binkert.org /** 1355735Snate@binkert.org * Structure that defines attributes and other data associated 1365735Snate@binkert.org * with a Command. 1375735Snate@binkert.org */ 1385735Snate@binkert.org struct CommandInfo 1395735Snate@binkert.org { 1405735Snate@binkert.org /// Set of attribute flags. 1414022Sstever@eecs.umich.edu const std::bitset<NUM_COMMAND_ATTRIBUTES> attributes; 1425735Snate@binkert.org /// Corresponding response for requests; InvalidCmd if no 1435735Snate@binkert.org /// response is applicable. 1444022Sstever@eecs.umich.edu const Command response; 1455735Snate@binkert.org /// String representation (for printing) 1464022Sstever@eecs.umich.edu const std::string str; 1474022Sstever@eecs.umich.edu }; 1484022Sstever@eecs.umich.edu 1495735Snate@binkert.org /// Array to map Command enum to associated info. 1504022Sstever@eecs.umich.edu static const CommandInfo commandInfo[]; 1514022Sstever@eecs.umich.edu 1524022Sstever@eecs.umich.edu private: 1534022Sstever@eecs.umich.edu 1544022Sstever@eecs.umich.edu Command cmd; 1554022Sstever@eecs.umich.edu 1565735Snate@binkert.org bool 1575735Snate@binkert.org testCmdAttrib(MemCmd::Attribute attrib) const 1585735Snate@binkert.org { 1594022Sstever@eecs.umich.edu return commandInfo[cmd].attributes[attrib] != 0; 1604022Sstever@eecs.umich.edu } 1614022Sstever@eecs.umich.edu 1624022Sstever@eecs.umich.edu public: 1634022Sstever@eecs.umich.edu 1644022Sstever@eecs.umich.edu bool isRead() const { return testCmdAttrib(IsRead); } 1657465Ssteve.reinhardt@amd.com bool isWrite() const { return testCmdAttrib(IsWrite); } 1667465Ssteve.reinhardt@amd.com bool isUpgrade() const { return testCmdAttrib(IsUpgrade); } 1674022Sstever@eecs.umich.edu bool isRequest() const { return testCmdAttrib(IsRequest); } 1684022Sstever@eecs.umich.edu bool isResponse() const { return testCmdAttrib(IsResponse); } 1694870Sstever@eecs.umich.edu bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); } 1704022Sstever@eecs.umich.edu bool needsResponse() const { return testCmdAttrib(NeedsResponse); } 1714022Sstever@eecs.umich.edu bool isInvalidate() const { return testCmdAttrib(IsInvalidate); } 1724022Sstever@eecs.umich.edu bool hasData() const { return testCmdAttrib(HasData); } 1734626Sstever@eecs.umich.edu bool isReadWrite() const { return isRead() && isWrite(); } 1746102Sgblack@eecs.umich.edu bool isLLSC() const { return testCmdAttrib(IsLlsc); } 1754870Sstever@eecs.umich.edu bool isError() const { return testCmdAttrib(IsError); } 1765314Sstever@gmail.com bool isPrint() const { return testCmdAttrib(IsPrint); } 1774022Sstever@eecs.umich.edu 1785735Snate@binkert.org const Command 1795735Snate@binkert.org responseCommand() const 1805735Snate@binkert.org { 1814022Sstever@eecs.umich.edu return commandInfo[cmd].response; 1824022Sstever@eecs.umich.edu } 1834022Sstever@eecs.umich.edu 1845735Snate@binkert.org /// Return the string to a cmd given by idx. 1855735Snate@binkert.org const std::string &toString() const { return commandInfo[cmd].str; } 1864022Sstever@eecs.umich.edu int toInt() const { return (int)cmd; } 1874022Sstever@eecs.umich.edu 1885735Snate@binkert.org MemCmd(Command _cmd) : cmd(_cmd) { } 1895735Snate@binkert.org MemCmd(int _cmd) : cmd((Command)_cmd) { } 1905735Snate@binkert.org MemCmd() : cmd(InvalidCmd) { } 1914022Sstever@eecs.umich.edu 1925735Snate@binkert.org bool operator==(MemCmd c2) const { return (cmd == c2.cmd); } 1935735Snate@binkert.org bool operator!=(MemCmd c2) const { return (cmd != c2.cmd); } 1944022Sstever@eecs.umich.edu}; 1954022Sstever@eecs.umich.edu 1962381SN/A/** 1972662Sstever@eecs.umich.edu * A Packet is used to encapsulate a transfer between two objects in 1982662Sstever@eecs.umich.edu * the memory system (e.g., the L1 and L2 cache). (In contrast, a 1992662Sstever@eecs.umich.edu * single Request travels all the way from the requester to the 2002662Sstever@eecs.umich.edu * ultimate destination and back, possibly being conveyed by several 2012662Sstever@eecs.umich.edu * different Packets along the way.) 2022381SN/A */ 2035314Sstever@gmail.comclass Packet : public FastAlloc, public Printable 2042381SN/A{ 2052813Srdreslin@umich.edu public: 2065735Snate@binkert.org typedef uint32_t FlagsType; 2075735Snate@binkert.org typedef ::Flags<FlagsType> Flags; 2085735Snate@binkert.org typedef short NodeID; 2094022Sstever@eecs.umich.edu 2105735Snate@binkert.org private: 2115735Snate@binkert.org static const FlagsType PUBLIC_FLAGS = 0x00000000; 2125735Snate@binkert.org static const FlagsType PRIVATE_FLAGS = 0x00007F0F; 2135735Snate@binkert.org static const FlagsType COPY_FLAGS = 0x0000000F; 2145735Snate@binkert.org 2155735Snate@binkert.org static const FlagsType SHARED = 0x00000001; 2165735Snate@binkert.org // Special control flags 2175735Snate@binkert.org /// Special timing-mode atomic snoop for multi-level coherence. 2185735Snate@binkert.org static const FlagsType EXPRESS_SNOOP = 0x00000002; 2195735Snate@binkert.org /// Does supplier have exclusive copy? 2205735Snate@binkert.org /// Useful for multi-level coherence. 2215735Snate@binkert.org static const FlagsType SUPPLY_EXCLUSIVE = 0x00000004; 2225735Snate@binkert.org // Snoop response flags 2235735Snate@binkert.org static const FlagsType MEM_INHIBIT = 0x00000008; 2245735Snate@binkert.org /// Are the 'addr' and 'size' fields valid? 2255735Snate@binkert.org static const FlagsType VALID_ADDR = 0x00000100; 2265735Snate@binkert.org static const FlagsType VALID_SIZE = 0x00000200; 2275735Snate@binkert.org /// Is the 'src' field valid? 2285735Snate@binkert.org static const FlagsType VALID_SRC = 0x00000400; 2295735Snate@binkert.org static const FlagsType VALID_DST = 0x00000800; 2305735Snate@binkert.org /// Is the data pointer set to a value that shouldn't be freed 2315735Snate@binkert.org /// when the packet is destroyed? 2325735Snate@binkert.org static const FlagsType STATIC_DATA = 0x00001000; 2335735Snate@binkert.org /// The data pointer points to a value that should be freed when 2345735Snate@binkert.org /// the packet is destroyed. 2355735Snate@binkert.org static const FlagsType DYNAMIC_DATA = 0x00002000; 2365735Snate@binkert.org /// the data pointer points to an array (thus delete []) needs to 2375735Snate@binkert.org /// be called on it rather than simply delete. 2385735Snate@binkert.org static const FlagsType ARRAY_DATA = 0x00004000; 2395735Snate@binkert.org 2405735Snate@binkert.org Flags flags; 2415735Snate@binkert.org 2425735Snate@binkert.org public: 2434022Sstever@eecs.umich.edu typedef MemCmd::Command Command; 2444022Sstever@eecs.umich.edu 2455735Snate@binkert.org /// The command field of the packet. 2464870Sstever@eecs.umich.edu MemCmd cmd; 2474870Sstever@eecs.umich.edu 2485735Snate@binkert.org /// A pointer to the original request. 2494870Sstever@eecs.umich.edu RequestPtr req; 2504870Sstever@eecs.umich.edu 2512566SN/A private: 2525735Snate@binkert.org /** 2535735Snate@binkert.org * A pointer to the data being transfered. It can be differnt 2545735Snate@binkert.org * sizes at each level of the heirarchy so it belongs in the 2555735Snate@binkert.org * packet, not request. This may or may not be populated when a 2565735Snate@binkert.org * responder recieves the packet. If not populated it memory should 2575735Snate@binkert.org * be allocated. 2582566SN/A */ 2592566SN/A PacketDataPtr data; 2602566SN/A 2615735Snate@binkert.org /// The address of the request. This address could be virtual or 2625735Snate@binkert.org /// physical, depending on the system configuration. 2632381SN/A Addr addr; 2642381SN/A 2655735Snate@binkert.org /// The size of the request or transfer. 2666227Snate@binkert.org unsigned size; 2672381SN/A 2685735Snate@binkert.org /** 2695735Snate@binkert.org * Device address (e.g., bus ID) of the source of the 2705735Snate@binkert.org * transaction. The source is not responsible for setting this 2715735Snate@binkert.org * field; it is set implicitly by the interconnect when the packet 2725735Snate@binkert.org * is first sent. 2735735Snate@binkert.org */ 2745735Snate@binkert.org NodeID src; 2752381SN/A 2765735Snate@binkert.org /** 2775735Snate@binkert.org * Device address (e.g., bus ID) of the destination of the 2785735Snate@binkert.org * transaction. The special value Broadcast indicates that the 2795735Snate@binkert.org * packet should be routed based on its address. This field is 2805735Snate@binkert.org * initialized in the constructor and is thus always valid (unlike 2815735Snate@binkert.org * addr, size, and src). 2825735Snate@binkert.org */ 2835735Snate@binkert.org NodeID dest; 2842641Sstever@eecs.umich.edu 2855735Snate@binkert.org /** 2865735Snate@binkert.org * The original value of the command field. Only valid when the 2874870Sstever@eecs.umich.edu * current command field is an error condition; in that case, the 2884870Sstever@eecs.umich.edu * previous contents of the command field are copied here. This 2894870Sstever@eecs.umich.edu * field is *not* set on non-error responses. 2904870Sstever@eecs.umich.edu */ 2914870Sstever@eecs.umich.edu MemCmd origCmd; 2924870Sstever@eecs.umich.edu 2932641Sstever@eecs.umich.edu public: 2945735Snate@binkert.org /// Used to calculate latencies for each packet. 2952811Srdreslin@umich.edu Tick time; 2962811Srdreslin@umich.edu 2975735Snate@binkert.org /// The time at which the packet will be fully transmitted 2983218Sgblack@eecs.umich.edu Tick finishTime; 2993218Sgblack@eecs.umich.edu 3005735Snate@binkert.org /// The time at which the first chunk of the packet will be transmitted 3013218Sgblack@eecs.umich.edu Tick firstWordTime; 3023218Sgblack@eecs.umich.edu 3035735Snate@binkert.org /// The special destination address indicating that the packet 3045735Snate@binkert.org /// should be routed based on its address. 3055735Snate@binkert.org static const NodeID Broadcast = -1; 3062623SN/A 3075735Snate@binkert.org /** 3085735Snate@binkert.org * A virtual base opaque structure used to hold state associated 3095735Snate@binkert.org * with the packet but specific to the sending device (e.g., an 3105735Snate@binkert.org * MSHR). A pointer to this state is returned in the packet's 3115735Snate@binkert.org * response so that the sender can quickly look up the state 3125735Snate@binkert.org * needed to process it. A specific subclass would be derived 3135735Snate@binkert.org * from this to carry state specific to a particular sending 3145735Snate@binkert.org * device. 3155735Snate@binkert.org */ 3165735Snate@binkert.org struct SenderState 3175735Snate@binkert.org { 3182641Sstever@eecs.umich.edu virtual ~SenderState() {} 3192641Sstever@eecs.umich.edu }; 3202641Sstever@eecs.umich.edu 3215315Sstever@gmail.com /** 3225315Sstever@gmail.com * Object used to maintain state of a PrintReq. The senderState 3235315Sstever@gmail.com * field of a PrintReq should always be of this type. 3245315Sstever@gmail.com */ 3255735Snate@binkert.org class PrintReqState : public SenderState, public FastAlloc 3265735Snate@binkert.org { 3275735Snate@binkert.org private: 3285735Snate@binkert.org /** 3295735Snate@binkert.org * An entry in the label stack. 3305735Snate@binkert.org */ 3315735Snate@binkert.org struct LabelStackEntry 3325735Snate@binkert.org { 3335314Sstever@gmail.com const std::string label; 3345314Sstever@gmail.com std::string *prefix; 3355314Sstever@gmail.com bool labelPrinted; 3365735Snate@binkert.org LabelStackEntry(const std::string &_label, std::string *_prefix); 3375314Sstever@gmail.com }; 3385314Sstever@gmail.com 3395314Sstever@gmail.com typedef std::list<LabelStackEntry> LabelStack; 3405314Sstever@gmail.com LabelStack labelStack; 3415314Sstever@gmail.com 3425314Sstever@gmail.com std::string *curPrefixPtr; 3435314Sstever@gmail.com 3445314Sstever@gmail.com public: 3455314Sstever@gmail.com std::ostream &os; 3465314Sstever@gmail.com const int verbosity; 3475314Sstever@gmail.com 3485314Sstever@gmail.com PrintReqState(std::ostream &os, int verbosity = 0); 3495314Sstever@gmail.com ~PrintReqState(); 3505314Sstever@gmail.com 3515735Snate@binkert.org /** 3525735Snate@binkert.org * Returns the current line prefix. 3535735Snate@binkert.org */ 3545314Sstever@gmail.com const std::string &curPrefix() { return *curPrefixPtr; } 3555315Sstever@gmail.com 3565735Snate@binkert.org /** 3575735Snate@binkert.org * Push a label onto the label stack, and prepend the given 3585315Sstever@gmail.com * prefix string onto the current prefix. Labels will only be 3595735Snate@binkert.org * printed if an object within the label's scope is printed. 3605735Snate@binkert.org */ 3615314Sstever@gmail.com void pushLabel(const std::string &lbl, 3625314Sstever@gmail.com const std::string &prefix = " "); 3635735Snate@binkert.org 3645735Snate@binkert.org /** 3655735Snate@binkert.org * Pop a label off the label stack. 3665735Snate@binkert.org */ 3675314Sstever@gmail.com void popLabel(); 3685735Snate@binkert.org 3695735Snate@binkert.org /** 3705735Snate@binkert.org * Print all of the pending unprinted labels on the 3715315Sstever@gmail.com * stack. Called by printObj(), so normally not called by 3725735Snate@binkert.org * users unless bypassing printObj(). 3735735Snate@binkert.org */ 3745314Sstever@gmail.com void printLabels(); 3755735Snate@binkert.org 3765735Snate@binkert.org /** 3775735Snate@binkert.org * Print a Printable object to os, because it matched the 3785735Snate@binkert.org * address on a PrintReq. 3795735Snate@binkert.org */ 3805314Sstever@gmail.com void printObj(Printable *obj); 3815314Sstever@gmail.com }; 3825314Sstever@gmail.com 3835735Snate@binkert.org /** 3845735Snate@binkert.org * This packet's sender state. Devices should use dynamic_cast<> 3855735Snate@binkert.org * to cast to the state appropriate to the sender. The intent of 3865735Snate@binkert.org * this variable is to allow a device to attach extra information 3875735Snate@binkert.org * to a request. A response packet must return the sender state 3885735Snate@binkert.org * that was attached to the original request (even if a new packet 3895735Snate@binkert.org * is created). 3905735Snate@binkert.org */ 3912662Sstever@eecs.umich.edu SenderState *senderState; 3922641Sstever@eecs.umich.edu 3935735Snate@binkert.org /// Return the string name of the cmd field (for debugging and 3945735Snate@binkert.org /// tracing). 3954022Sstever@eecs.umich.edu const std::string &cmdString() const { return cmd.toString(); } 3962811Srdreslin@umich.edu 3975735Snate@binkert.org /// Return the index of this command. 3984022Sstever@eecs.umich.edu inline int cmdToIndex() const { return cmd.toInt(); } 3992811Srdreslin@umich.edu 4004022Sstever@eecs.umich.edu bool isRead() const { return cmd.isRead(); } 4017465Ssteve.reinhardt@amd.com bool isWrite() const { return cmd.isWrite(); } 4027465Ssteve.reinhardt@amd.com bool isUpgrade() const { return cmd.isUpgrade(); } 4034022Sstever@eecs.umich.edu bool isRequest() const { return cmd.isRequest(); } 4044022Sstever@eecs.umich.edu bool isResponse() const { return cmd.isResponse(); } 4054870Sstever@eecs.umich.edu bool needsExclusive() const { return cmd.needsExclusive(); } 4064022Sstever@eecs.umich.edu bool needsResponse() const { return cmd.needsResponse(); } 4074022Sstever@eecs.umich.edu bool isInvalidate() const { return cmd.isInvalidate(); } 4084022Sstever@eecs.umich.edu bool hasData() const { return cmd.hasData(); } 4094040Ssaidi@eecs.umich.edu bool isReadWrite() const { return cmd.isReadWrite(); } 4106102Sgblack@eecs.umich.edu bool isLLSC() const { return cmd.isLLSC(); } 4114870Sstever@eecs.umich.edu bool isError() const { return cmd.isError(); } 4125314Sstever@gmail.com bool isPrint() const { return cmd.isPrint(); } 4132812Srdreslin@umich.edu 4144870Sstever@eecs.umich.edu // Snoop flags 4155735Snate@binkert.org void assertMemInhibit() { flags.set(MEM_INHIBIT); } 4165764Snate@binkert.org bool memInhibitAsserted() { return flags.isSet(MEM_INHIBIT); } 4175735Snate@binkert.org void assertShared() { flags.set(SHARED); } 4185764Snate@binkert.org bool sharedAsserted() { return flags.isSet(SHARED); } 4194870Sstever@eecs.umich.edu 4204895Sstever@eecs.umich.edu // Special control flags 4215735Snate@binkert.org void setExpressSnoop() { flags.set(EXPRESS_SNOOP); } 4225764Snate@binkert.org bool isExpressSnoop() { return flags.isSet(EXPRESS_SNOOP); } 4235735Snate@binkert.org void setSupplyExclusive() { flags.set(SUPPLY_EXCLUSIVE); } 4245764Snate@binkert.org bool isSupplyExclusive() { return flags.isSet(SUPPLY_EXCLUSIVE); } 4254895Sstever@eecs.umich.edu 4264870Sstever@eecs.umich.edu // Network error conditions... encapsulate them as methods since 4274870Sstever@eecs.umich.edu // their encoding keeps changing (from result field to command 4284870Sstever@eecs.umich.edu // field, etc.) 4295735Snate@binkert.org void 4305735Snate@binkert.org setNacked() 4315735Snate@binkert.org { 4325735Snate@binkert.org assert(isResponse()); 4335735Snate@binkert.org cmd = MemCmd::NetworkNackError; 4345735Snate@binkert.org } 4355735Snate@binkert.org 4365735Snate@binkert.org void 4375735Snate@binkert.org setBadAddress() 4385735Snate@binkert.org { 4395735Snate@binkert.org assert(isResponse()); 4405735Snate@binkert.org cmd = MemCmd::BadAddressError; 4415735Snate@binkert.org } 4425735Snate@binkert.org 4435735Snate@binkert.org bool wasNacked() const { return cmd == MemCmd::NetworkNackError; } 4445735Snate@binkert.org bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; } 4454986Ssaidi@eecs.umich.edu void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } 4462814Srdreslin@umich.edu 4476768SBrad.Beckmann@amd.com bool isSrcValid() { return flags.isSet(VALID_SRC); } 4485735Snate@binkert.org /// Accessor function to get the source index of the packet. 4495764Snate@binkert.org NodeID getSrc() const { assert(flags.isSet(VALID_SRC)); return src; } 4505735Snate@binkert.org /// Accessor function to set the source index of the packet. 4515735Snate@binkert.org void setSrc(NodeID _src) { src = _src; flags.set(VALID_SRC); } 4525735Snate@binkert.org /// Reset source field, e.g. to retransmit packet on different bus. 4535735Snate@binkert.org void clearSrc() { flags.clear(VALID_SRC); } 4542641Sstever@eecs.umich.edu 4556768SBrad.Beckmann@amd.com bool isDestValid() { return flags.isSet(VALID_DST); } 4565735Snate@binkert.org /// Accessor function for the destination index of the packet. 4575764Snate@binkert.org NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; } 4585735Snate@binkert.org /// Accessor function to set the destination index of the packet. 4595735Snate@binkert.org void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); } 4602381SN/A 4615764Snate@binkert.org Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 4626227Snate@binkert.org unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } 4635735Snate@binkert.org Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); } 4642549SN/A 4655735Snate@binkert.org /** 4667550SBrad.Beckmann@amd.com * It has been determined that the SC packet should successfully update 4677550SBrad.Beckmann@amd.com * memory. Therefore, convert this SC packet to a normal write. 4687550SBrad.Beckmann@amd.com */ 4697550SBrad.Beckmann@amd.com void 4707550SBrad.Beckmann@amd.com convertScToWrite() 4717550SBrad.Beckmann@amd.com { 4727550SBrad.Beckmann@amd.com assert(isLLSC()); 4737550SBrad.Beckmann@amd.com assert(isWrite()); 4747550SBrad.Beckmann@amd.com cmd = MemCmd::WriteReq; 4757550SBrad.Beckmann@amd.com } 4767550SBrad.Beckmann@amd.com 4777550SBrad.Beckmann@amd.com /** 4787550SBrad.Beckmann@amd.com * When ruby is in use, Ruby will monitor the cache line and thus M5 4797550SBrad.Beckmann@amd.com * phys memory should treat LL ops as normal reads. 4807550SBrad.Beckmann@amd.com */ 4817550SBrad.Beckmann@amd.com void 4827550SBrad.Beckmann@amd.com convertLlToRead() 4837550SBrad.Beckmann@amd.com { 4847550SBrad.Beckmann@amd.com assert(isLLSC()); 4857550SBrad.Beckmann@amd.com assert(isRead()); 4867550SBrad.Beckmann@amd.com cmd = MemCmd::ReadReq; 4877550SBrad.Beckmann@amd.com } 4887550SBrad.Beckmann@amd.com 4897550SBrad.Beckmann@amd.com /** 4905735Snate@binkert.org * Constructor. Note that a Request object must be constructed 4915735Snate@binkert.org * first, but the Requests's physical address and size fields need 4925735Snate@binkert.org * not be valid. The command and destination addresses must be 4935735Snate@binkert.org * supplied. 4945735Snate@binkert.org */ 4955735Snate@binkert.org Packet(Request *_req, MemCmd _cmd, NodeID _dest) 4965745Snate@binkert.org : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 4976104Ssteve.reinhardt@amd.com dest(_dest), time(curTick), senderState(NULL) 4982641Sstever@eecs.umich.edu { 4996104Ssteve.reinhardt@amd.com if (req->hasPaddr()) { 5006104Ssteve.reinhardt@amd.com addr = req->getPaddr(); 5016104Ssteve.reinhardt@amd.com flags.set(VALID_ADDR); 5026104Ssteve.reinhardt@amd.com } 5036104Ssteve.reinhardt@amd.com if (req->hasSize()) { 5046104Ssteve.reinhardt@amd.com size = req->getSize(); 5056104Ssteve.reinhardt@amd.com flags.set(VALID_SIZE); 5066104Ssteve.reinhardt@amd.com } 5072813Srdreslin@umich.edu } 5082813Srdreslin@umich.edu 5095735Snate@binkert.org /** 5105735Snate@binkert.org * Alternate constructor if you are trying to create a packet with 5115735Snate@binkert.org * a request that is for a whole block, not the address from the 5125735Snate@binkert.org * req. this allows for overriding the size/addr of the req. 5135735Snate@binkert.org */ 5145735Snate@binkert.org Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize) 5155745Snate@binkert.org : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 5166104Ssteve.reinhardt@amd.com dest(_dest), time(curTick), senderState(NULL) 5172813Srdreslin@umich.edu { 5186104Ssteve.reinhardt@amd.com if (req->hasPaddr()) { 5196104Ssteve.reinhardt@amd.com addr = req->getPaddr() & ~(_blkSize - 1); 5206104Ssteve.reinhardt@amd.com flags.set(VALID_ADDR); 5216104Ssteve.reinhardt@amd.com } 5226104Ssteve.reinhardt@amd.com size = _blkSize; 5236104Ssteve.reinhardt@amd.com flags.set(VALID_SIZE); 5244626Sstever@eecs.umich.edu } 5254626Sstever@eecs.umich.edu 5265735Snate@binkert.org /** 5275735Snate@binkert.org * Alternate constructor for copying a packet. Copy all fields 5284887Sstever@eecs.umich.edu * *except* if the original packet's data was dynamic, don't copy 5294887Sstever@eecs.umich.edu * that, as we can't guarantee that the new packet's lifetime is 5304887Sstever@eecs.umich.edu * less than that of the original packet. In this case the new 5315735Snate@binkert.org * packet should allocate its own data. 5325735Snate@binkert.org */ 5335735Snate@binkert.org Packet(Packet *pkt, bool clearFlags = false) 5345735Snate@binkert.org : cmd(pkt->cmd), req(pkt->req), 5355764Snate@binkert.org data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL), 5365735Snate@binkert.org addr(pkt->addr), size(pkt->size), src(pkt->src), dest(pkt->dest), 5375735Snate@binkert.org time(curTick), senderState(pkt->senderState) 5384626Sstever@eecs.umich.edu { 5395735Snate@binkert.org if (!clearFlags) 5405735Snate@binkert.org flags.set(pkt->flags & COPY_FLAGS); 5415735Snate@binkert.org 5425735Snate@binkert.org flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE|VALID_SRC|VALID_DST)); 5435735Snate@binkert.org flags.set(pkt->flags & STATIC_DATA); 5442641Sstever@eecs.umich.edu } 5452549SN/A 5465735Snate@binkert.org /** 5475735Snate@binkert.org * clean up packet variables 5485735Snate@binkert.org */ 5492566SN/A ~Packet() 5505387Sstever@gmail.com { 5515387Sstever@gmail.com // If this is a request packet for which there's no response, 5525387Sstever@gmail.com // delete the request object here, since the requester will 5535387Sstever@gmail.com // never get the chance. 5545387Sstever@gmail.com if (req && isRequest() && !needsResponse()) 5555387Sstever@gmail.com delete req; 5565735Snate@binkert.org deleteData(); 5575387Sstever@gmail.com } 5582566SN/A 5595735Snate@binkert.org /** 5605735Snate@binkert.org * Reinitialize packet address and size from the associated 5615735Snate@binkert.org * Request object, and reset other fields that may have been 5625735Snate@binkert.org * modified by a previous transaction. Typically called when a 5635735Snate@binkert.org * statically allocated Request/Packet pair is reused for multiple 5645735Snate@binkert.org * transactions. 5655735Snate@binkert.org */ 5665735Snate@binkert.org void 5675735Snate@binkert.org reinitFromRequest() 5685735Snate@binkert.org { 5696104Ssteve.reinhardt@amd.com assert(req->hasPaddr()); 5704870Sstever@eecs.umich.edu flags = 0; 5716104Ssteve.reinhardt@amd.com addr = req->getPaddr(); 5726104Ssteve.reinhardt@amd.com size = req->getSize(); 5736223Snate@binkert.org time = req->time(); 5745735Snate@binkert.org 5755735Snate@binkert.org flags.set(VALID_ADDR|VALID_SIZE); 5765735Snate@binkert.org deleteData(); 5772662Sstever@eecs.umich.edu } 5782566SN/A 5794626Sstever@eecs.umich.edu /** 5804626Sstever@eecs.umich.edu * Take a request packet and modify it in place to be suitable for 5814626Sstever@eecs.umich.edu * returning as a response to that request. The source and 5824626Sstever@eecs.umich.edu * destination fields are *not* modified, as is appropriate for 5834626Sstever@eecs.umich.edu * atomic accesses. 5844626Sstever@eecs.umich.edu */ 5855735Snate@binkert.org void 5865735Snate@binkert.org makeResponse() 5874626Sstever@eecs.umich.edu { 5882662Sstever@eecs.umich.edu assert(needsResponse()); 5892855Srdreslin@umich.edu assert(isRequest()); 5904986Ssaidi@eecs.umich.edu origCmd = cmd; 5914022Sstever@eecs.umich.edu cmd = cmd.responseCommand(); 5925745Snate@binkert.org 5937464Ssteve.reinhardt@amd.com // responses are never express, even if the snoop that 5947464Ssteve.reinhardt@amd.com // triggered them was 5957464Ssteve.reinhardt@amd.com flags.clear(EXPRESS_SNOOP); 5967464Ssteve.reinhardt@amd.com 5975745Snate@binkert.org dest = src; 5985764Snate@binkert.org flags.set(VALID_DST, flags.isSet(VALID_SRC)); 5995745Snate@binkert.org flags.clear(VALID_SRC); 6002641Sstever@eecs.umich.edu } 6012641Sstever@eecs.umich.edu 6025735Snate@binkert.org void 6035735Snate@binkert.org makeAtomicResponse() 6044870Sstever@eecs.umich.edu { 6054870Sstever@eecs.umich.edu makeResponse(); 6064870Sstever@eecs.umich.edu } 6074870Sstever@eecs.umich.edu 6085735Snate@binkert.org void 6095735Snate@binkert.org makeTimingResponse() 6103348Sbinkertn@umich.edu { 6114870Sstever@eecs.umich.edu makeResponse(); 6123135Srdreslin@umich.edu } 6133135Srdreslin@umich.edu 6143348Sbinkertn@umich.edu /** 6153348Sbinkertn@umich.edu * Take a request packet that has been returned as NACKED and 6163348Sbinkertn@umich.edu * modify it so that it can be sent out again. Only packets that 6173348Sbinkertn@umich.edu * need a response can be NACKED, so verify that that is true. 6183348Sbinkertn@umich.edu */ 6193348Sbinkertn@umich.edu void 6203348Sbinkertn@umich.edu reinitNacked() 6213348Sbinkertn@umich.edu { 6224870Sstever@eecs.umich.edu assert(wasNacked()); 6234870Sstever@eecs.umich.edu cmd = origCmd; 6244870Sstever@eecs.umich.edu assert(needsResponse()); 6254870Sstever@eecs.umich.edu setDest(Broadcast); 6262685Ssaidi@eecs.umich.edu } 6272685Ssaidi@eecs.umich.edu 6287006Snate@binkert.org void 6297006Snate@binkert.org setSize(unsigned size) 6307006Snate@binkert.org { 6317006Snate@binkert.org assert(!flags.isSet(VALID_SIZE)); 6327006Snate@binkert.org 6337006Snate@binkert.org this->size = size; 6347006Snate@binkert.org flags.set(VALID_SIZE); 6357006Snate@binkert.org } 6367006Snate@binkert.org 6372685Ssaidi@eecs.umich.edu 6383348Sbinkertn@umich.edu /** 6393348Sbinkertn@umich.edu * Set the data pointer to the following value that should not be 6403348Sbinkertn@umich.edu * freed. 6412566SN/A */ 6422566SN/A template <typename T> 6433348Sbinkertn@umich.edu void 6443348Sbinkertn@umich.edu dataStatic(T *p) 6453348Sbinkertn@umich.edu { 6465764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 6473348Sbinkertn@umich.edu data = (PacketDataPtr)p; 6485735Snate@binkert.org flags.set(STATIC_DATA); 6493348Sbinkertn@umich.edu } 6502566SN/A 6513348Sbinkertn@umich.edu /** 6523348Sbinkertn@umich.edu * Set the data pointer to a value that should have delete [] 6533348Sbinkertn@umich.edu * called on it. 6543348Sbinkertn@umich.edu */ 6552566SN/A template <typename T> 6563348Sbinkertn@umich.edu void 6573348Sbinkertn@umich.edu dataDynamicArray(T *p) 6583348Sbinkertn@umich.edu { 6595764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 6603348Sbinkertn@umich.edu data = (PacketDataPtr)p; 6615735Snate@binkert.org flags.set(DYNAMIC_DATA|ARRAY_DATA); 6623348Sbinkertn@umich.edu } 6633348Sbinkertn@umich.edu 6643348Sbinkertn@umich.edu /** 6653348Sbinkertn@umich.edu * set the data pointer to a value that should have delete called 6663348Sbinkertn@umich.edu * on it. 6673348Sbinkertn@umich.edu */ 6683348Sbinkertn@umich.edu template <typename T> 6693348Sbinkertn@umich.edu void 6703348Sbinkertn@umich.edu dataDynamic(T *p) 6713348Sbinkertn@umich.edu { 6725764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 6733348Sbinkertn@umich.edu data = (PacketDataPtr)p; 6745735Snate@binkert.org flags.set(DYNAMIC_DATA); 6753348Sbinkertn@umich.edu } 6763348Sbinkertn@umich.edu 6775735Snate@binkert.org /** 6785735Snate@binkert.org * get a pointer to the data ptr. 6795735Snate@binkert.org */ 6803348Sbinkertn@umich.edu template <typename T> 6813348Sbinkertn@umich.edu T* 6823348Sbinkertn@umich.edu getPtr() 6833348Sbinkertn@umich.edu { 6845764Snate@binkert.org assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 6853348Sbinkertn@umich.edu return (T*)data; 6863348Sbinkertn@umich.edu } 6872566SN/A 6885735Snate@binkert.org /** 6895735Snate@binkert.org * return the value of what is pointed to in the packet. 6905735Snate@binkert.org */ 6912566SN/A template <typename T> 6922592SN/A T get(); 6932566SN/A 6945735Snate@binkert.org /** 6955735Snate@binkert.org * set the value in the data pointer to v. 6965735Snate@binkert.org */ 6972566SN/A template <typename T> 6982592SN/A void set(T v); 6992566SN/A 7003348Sbinkertn@umich.edu /** 7014626Sstever@eecs.umich.edu * Copy data into the packet from the provided pointer. 7024626Sstever@eecs.umich.edu */ 7035735Snate@binkert.org void 7045735Snate@binkert.org setData(uint8_t *p) 7054626Sstever@eecs.umich.edu { 7064626Sstever@eecs.umich.edu std::memcpy(getPtr<uint8_t>(), p, getSize()); 7074626Sstever@eecs.umich.edu } 7084626Sstever@eecs.umich.edu 7094626Sstever@eecs.umich.edu /** 7104626Sstever@eecs.umich.edu * Copy data into the packet from the provided block pointer, 7114626Sstever@eecs.umich.edu * which is aligned to the given block size. 7124626Sstever@eecs.umich.edu */ 7135735Snate@binkert.org void 7145735Snate@binkert.org setDataFromBlock(uint8_t *blk_data, int blkSize) 7154626Sstever@eecs.umich.edu { 7164626Sstever@eecs.umich.edu setData(blk_data + getOffset(blkSize)); 7174626Sstever@eecs.umich.edu } 7184626Sstever@eecs.umich.edu 7194626Sstever@eecs.umich.edu /** 7204626Sstever@eecs.umich.edu * Copy data from the packet to the provided block pointer, which 7214626Sstever@eecs.umich.edu * is aligned to the given block size. 7224626Sstever@eecs.umich.edu */ 7235735Snate@binkert.org void 7245735Snate@binkert.org writeData(uint8_t *p) 7254626Sstever@eecs.umich.edu { 7264626Sstever@eecs.umich.edu std::memcpy(p, getPtr<uint8_t>(), getSize()); 7274626Sstever@eecs.umich.edu } 7284626Sstever@eecs.umich.edu 7294626Sstever@eecs.umich.edu /** 7304626Sstever@eecs.umich.edu * Copy data from the packet to the memory at the provided pointer. 7314626Sstever@eecs.umich.edu */ 7325735Snate@binkert.org void 7335735Snate@binkert.org writeDataToBlock(uint8_t *blk_data, int blkSize) 7344626Sstever@eecs.umich.edu { 7354626Sstever@eecs.umich.edu writeData(blk_data + getOffset(blkSize)); 7364626Sstever@eecs.umich.edu } 7374626Sstever@eecs.umich.edu 7384626Sstever@eecs.umich.edu /** 7393348Sbinkertn@umich.edu * delete the data pointed to in the data pointer. Ok to call to 7403348Sbinkertn@umich.edu * matter how data was allocted. 7413348Sbinkertn@umich.edu */ 7425735Snate@binkert.org void 7435735Snate@binkert.org deleteData() 7445735Snate@binkert.org { 7455764Snate@binkert.org if (flags.isSet(ARRAY_DATA)) 7465735Snate@binkert.org delete [] data; 7475764Snate@binkert.org else if (flags.isSet(DYNAMIC_DATA)) 7485735Snate@binkert.org delete data; 7495735Snate@binkert.org 7505735Snate@binkert.org flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA); 7515735Snate@binkert.org data = NULL; 7525735Snate@binkert.org } 7532566SN/A 7542566SN/A /** If there isn't data in the packet, allocate some. */ 7555735Snate@binkert.org void 7565735Snate@binkert.org allocate() 7575735Snate@binkert.org { 7585735Snate@binkert.org if (data) { 7595764Snate@binkert.org assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 7605745Snate@binkert.org return; 7615735Snate@binkert.org } 7625745Snate@binkert.org 7635764Snate@binkert.org assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 7645745Snate@binkert.org flags.set(DYNAMIC_DATA|ARRAY_DATA); 7655745Snate@binkert.org data = new uint8_t[getSize()]; 7665735Snate@binkert.org } 7675735Snate@binkert.org 7682568SN/A 7694626Sstever@eecs.umich.edu /** 7704626Sstever@eecs.umich.edu * Check a functional request against a memory value represented 7714626Sstever@eecs.umich.edu * by a base/size pair and an associated data array. If the 7724626Sstever@eecs.umich.edu * functional request is a read, it may be satisfied by the memory 7734626Sstever@eecs.umich.edu * value. If the functional request is a write, it may update the 7744626Sstever@eecs.umich.edu * memory value. 7754626Sstever@eecs.umich.edu */ 7765314Sstever@gmail.com bool checkFunctional(Printable *obj, Addr base, int size, uint8_t *data); 7774626Sstever@eecs.umich.edu 7784626Sstever@eecs.umich.edu /** 7794626Sstever@eecs.umich.edu * Check a functional request against a memory value stored in 7805315Sstever@gmail.com * another packet (i.e. an in-transit request or response). 7814626Sstever@eecs.umich.edu */ 7825735Snate@binkert.org bool 7835735Snate@binkert.org checkFunctional(PacketPtr other) 7845735Snate@binkert.org { 7855735Snate@binkert.org uint8_t *data = other->hasData() ? other->getPtr<uint8_t>() : NULL; 7865735Snate@binkert.org return checkFunctional(other, other->getAddr(), other->getSize(), 7875735Snate@binkert.org data); 7884626Sstever@eecs.umich.edu } 7895314Sstever@gmail.com 7905315Sstever@gmail.com /** 7915315Sstever@gmail.com * Push label for PrintReq (safe to call unconditionally). 7925315Sstever@gmail.com */ 7935735Snate@binkert.org void 7945735Snate@binkert.org pushLabel(const std::string &lbl) 7955735Snate@binkert.org { 7965735Snate@binkert.org if (isPrint()) 7975735Snate@binkert.org safe_cast<PrintReqState*>(senderState)->pushLabel(lbl); 7985314Sstever@gmail.com } 7995314Sstever@gmail.com 8005315Sstever@gmail.com /** 8015315Sstever@gmail.com * Pop label for PrintReq (safe to call unconditionally). 8025315Sstever@gmail.com */ 8035735Snate@binkert.org void 8045735Snate@binkert.org popLabel() 8055735Snate@binkert.org { 8065735Snate@binkert.org if (isPrint()) 8075735Snate@binkert.org safe_cast<PrintReqState*>(senderState)->popLabel(); 8085314Sstever@gmail.com } 8095314Sstever@gmail.com 8105314Sstever@gmail.com void print(std::ostream &o, int verbosity = 0, 8115314Sstever@gmail.com const std::string &prefix = "") const; 8122381SN/A}; 8132381SN/A 8142381SN/A#endif //__MEM_PACKET_HH 815