packet.hh revision 13350
12381SN/A/* 210694SMarco.Balboni@ARM.com * Copyright (c) 2012-2018 ARM Limited 38949Sandreas.hansson@arm.com * All rights reserved 48949Sandreas.hansson@arm.com * 58949Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall 68949Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual 78949Sandreas.hansson@arm.com * property including but not limited to intellectual property relating 88949Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software 98949Sandreas.hansson@arm.com * licensed hereunder. You may use the software subject to the license 108949Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated 118949Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software, 128949Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form. 138949Sandreas.hansson@arm.com * 142592SN/A * Copyright (c) 2006 The Regents of The University of Michigan 157636Ssteve.reinhardt@amd.com * Copyright (c) 2010,2015 Advanced Micro Devices, Inc. 162381SN/A * All rights reserved. 172381SN/A * 182381SN/A * Redistribution and use in source and binary forms, with or without 192381SN/A * modification, are permitted provided that the following conditions are 202381SN/A * met: redistributions of source code must retain the above copyright 212381SN/A * notice, this list of conditions and the following disclaimer; 222381SN/A * redistributions in binary form must reproduce the above copyright 232381SN/A * notice, this list of conditions and the following disclaimer in the 242381SN/A * documentation and/or other materials provided with the distribution; 252381SN/A * neither the name of the copyright holders nor the names of its 262381SN/A * contributors may be used to endorse or promote products derived from 272381SN/A * this software without specific prior written permission. 282381SN/A * 292381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 302381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 312381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 322381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 332381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 342381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 352381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 362381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 372381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 382381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 392381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 402665Ssaidi@eecs.umich.edu * 412665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski 422665Ssaidi@eecs.umich.edu * Steve Reinhardt 432665Ssaidi@eecs.umich.edu * Ali Saidi 449031Sandreas.hansson@arm.com * Andreas Hansson 452381SN/A * Nikos Nikoleris 462381SN/A */ 472381SN/A 482381SN/A/** 492662Sstever@eecs.umich.edu * @file 502381SN/A * Declaration of the Packet class. 512381SN/A */ 522381SN/A 532381SN/A#ifndef __MEM_PACKET_HH__ 542381SN/A#define __MEM_PACKET_HH__ 558229Snate@binkert.org 563348Sbinkertn@umich.edu#include <bitset> 573348Sbinkertn@umich.edu#include <cassert> 583348Sbinkertn@umich.edu#include <list> 595735Snate@binkert.org 604024Sbinkertn@umich.edu#include "base/cast.hh" 615735Snate@binkert.org#include "base/compiler.hh" 623940Ssaidi@eecs.umich.edu#include "base/flags.hh" 635314Sstever@gmail.com#include "base/logging.hh" 646216Snate@binkert.org#include "base/printable.hh" 652392SN/A#include "base/types.hh" 664167Sbinkertn@umich.edu#include "config/the_isa.hh" 672394SN/A#include "mem/request.hh" 688737Skoansin.tan@gmail.com#include "sim/core.hh" 693349Sbinkertn@umich.edu 702394SN/Aclass Packet; 712812Srdreslin@umich.edutypedef Packet *PacketPtr; 722812Srdreslin@umich.edutypedef uint8_t* PacketDataPtr; 734022Sstever@eecs.umich.edutypedef std::list<PacketPtr> PacketList; 744022Sstever@eecs.umich.edutypedef uint64_t PacketId; 755735Snate@binkert.org 765735Snate@binkert.orgclass MemCmd 774022Sstever@eecs.umich.edu{ 785735Snate@binkert.org friend class Packet; 795735Snate@binkert.org 805735Snate@binkert.org public: 814022Sstever@eecs.umich.edu /** 824022Sstever@eecs.umich.edu * List of all commands associated with a packet. 834022Sstever@eecs.umich.edu */ 844022Sstever@eecs.umich.edu enum Command 854473Sstever@eecs.umich.edu { 865319Sstever@gmail.com InvalidCmd, 874022Sstever@eecs.umich.edu ReadReq, 884022Sstever@eecs.umich.edu ReadResp, 894022Sstever@eecs.umich.edu ReadRespWithInvalidate, 904022Sstever@eecs.umich.edu WriteReq, 914022Sstever@eecs.umich.edu WriteResp, 924022Sstever@eecs.umich.edu WritebackDirty, 934022Sstever@eecs.umich.edu WritebackClean, 944022Sstever@eecs.umich.edu WriteClean, // writes dirty data below without evicting 954022Sstever@eecs.umich.edu CleanEvict, 964022Sstever@eecs.umich.edu SoftPFReq, 977465Ssteve.reinhardt@amd.com HardPFReq, 984628Sstever@eecs.umich.edu SoftPFResp, 997465Ssteve.reinhardt@amd.com HardPFResp, 1007465Ssteve.reinhardt@amd.com WriteLineReq, 1014022Sstever@eecs.umich.edu UpgradeReq, 1024022Sstever@eecs.umich.edu SCUpgradeReq, // Special "weak" upgrade for StoreCond 1034626Sstever@eecs.umich.edu UpgradeResp, 1044626Sstever@eecs.umich.edu SCUpgradeFailReq, // Failed SCUpgradeReq in MSHR (never sent) 1057669Ssteve.reinhardt@amd.com UpgradeFailResp, // Valid for SCUpgradeReq only 1064626Sstever@eecs.umich.edu ReadExReq, 1074040Ssaidi@eecs.umich.edu ReadExResp, 1084040Ssaidi@eecs.umich.edu ReadCleanReq, 1095650Sgblack@eecs.umich.edu ReadSharedReq, 1105650Sgblack@eecs.umich.edu LoadLockedReq, 1114870Sstever@eecs.umich.edu StoreCondReq, 1124870Sstever@eecs.umich.edu StoreCondFailReq, // Failed StoreCondReq in MSHR (never sent) 1134870Sstever@eecs.umich.edu StoreCondResp, 1144870Sstever@eecs.umich.edu SwapReq, 1154870Sstever@eecs.umich.edu SwapResp, 1164870Sstever@eecs.umich.edu MessageReq, 1178436SBrad.Beckmann@amd.com MessageResp, 1188436SBrad.Beckmann@amd.com MemFenceReq, 1195314Sstever@gmail.com MemFenceResp, 1205314Sstever@gmail.com CleanSharedReq, 1218184Ssomayeh@cs.wisc.edu CleanSharedResp, 1228716Snilay@cs.wisc.edu CleanInvalidReq, 1234022Sstever@eecs.umich.edu CleanInvalidResp, 1244022Sstever@eecs.umich.edu // Error responses 1254022Sstever@eecs.umich.edu // @TODO these should be classified as responses rather than 1264022Sstever@eecs.umich.edu // requests; coding them as requests initially for backwards 1275735Snate@binkert.org // compatibility 1285735Snate@binkert.org InvalidDestError, // packet dest field invalid 1295735Snate@binkert.org BadAddressError, // memory address invalid 1304022Sstever@eecs.umich.edu FunctionalReadError, // unable to fulfill functional read 1314022Sstever@eecs.umich.edu FunctionalWriteError, // unable to fulfill functional write 1324626Sstever@eecs.umich.edu // Fake simulator-only commands 1334626Sstever@eecs.umich.edu PrintReq, // Print state matching address 1347465Ssteve.reinhardt@amd.com FlushReq, //request for a cache flush 1354022Sstever@eecs.umich.edu InvalidateReq, // request for address to be invalidated 1364626Sstever@eecs.umich.edu InvalidateResp, 1374626Sstever@eecs.umich.edu NUM_MEM_CMDS 1384626Sstever@eecs.umich.edu }; 1394626Sstever@eecs.umich.edu 1404022Sstever@eecs.umich.edu private: 1414022Sstever@eecs.umich.edu /** 1426076Sgblack@eecs.umich.edu * List of command attributes. 1434626Sstever@eecs.umich.edu */ 1444870Sstever@eecs.umich.edu enum Attribute 1455314Sstever@gmail.com { 1468184Ssomayeh@cs.wisc.edu IsRead, //!< Data flows from responder to requester 1474022Sstever@eecs.umich.edu IsWrite, //!< Data flows from requester to responder 1484022Sstever@eecs.umich.edu IsUpgrade, 1494022Sstever@eecs.umich.edu IsInvalidate, 1505735Snate@binkert.org IsClean, //!< Cleans any existing dirty blocks 1515735Snate@binkert.org NeedsWritable, //!< Requires writable copy to complete in-cache 1525735Snate@binkert.org IsRequest, //!< Issued by requester 1535735Snate@binkert.org IsResponse, //!< Issue by responder 1545735Snate@binkert.org NeedsResponse, //!< Requester needs response from target 1555735Snate@binkert.org IsEviction, 1565735Snate@binkert.org IsSWPrefetch, 1574022Sstever@eecs.umich.edu IsHWPrefetch, 1585735Snate@binkert.org IsLlsc, //!< Alpha/MIPS LL or SC access 1595735Snate@binkert.org HasData, //!< There is an associated payload 1604022Sstever@eecs.umich.edu IsError, //!< Error response 1615735Snate@binkert.org IsPrint, //!< Print state matching address (for debugging) 1624022Sstever@eecs.umich.edu IsFlush, //!< Flush the address from caches 1634022Sstever@eecs.umich.edu FromCache, //!< Request originated from a caching agent 1644022Sstever@eecs.umich.edu NUM_COMMAND_ATTRIBUTES 1655735Snate@binkert.org }; 1664022Sstever@eecs.umich.edu 1674022Sstever@eecs.umich.edu /** 1684022Sstever@eecs.umich.edu * Structure that defines attributes and other data associated 1694022Sstever@eecs.umich.edu * with a Command. 1704022Sstever@eecs.umich.edu */ 1714022Sstever@eecs.umich.edu struct CommandInfo 1725735Snate@binkert.org { 1735735Snate@binkert.org /// Set of attribute flags. 1745735Snate@binkert.org const std::bitset<NUM_COMMAND_ATTRIBUTES> attributes; 1754022Sstever@eecs.umich.edu /// Corresponding response for requests; InvalidCmd if no 1764022Sstever@eecs.umich.edu /// response is applicable. 1774022Sstever@eecs.umich.edu const Command response; 1784022Sstever@eecs.umich.edu /// String representation (for printing) 1794022Sstever@eecs.umich.edu const std::string str; 18010583SCurtis.Dunham@arm.com }; 18110583SCurtis.Dunham@arm.com 18210583SCurtis.Dunham@arm.com /// Array to map Command enum to associated info. 18310583SCurtis.Dunham@arm.com static const CommandInfo commandInfo[]; 18410583SCurtis.Dunham@arm.com 18510583SCurtis.Dunham@arm.com private: 18610583SCurtis.Dunham@arm.com 18710583SCurtis.Dunham@arm.com Command cmd; 18810583SCurtis.Dunham@arm.com 18910583SCurtis.Dunham@arm.com bool 19010570Sandreas.hansson@arm.com testCmdAttrib(MemCmd::Attribute attrib) const 19110570Sandreas.hansson@arm.com { 19210570Sandreas.hansson@arm.com return commandInfo[cmd].attributes[attrib] != 0; 19310570Sandreas.hansson@arm.com } 19410570Sandreas.hansson@arm.com 19510570Sandreas.hansson@arm.com public: 1964022Sstever@eecs.umich.edu 1976102Sgblack@eecs.umich.edu bool isRead() const { return testCmdAttrib(IsRead); } 19810343SCurtis.Dunham@arm.com bool isWrite() const { return testCmdAttrib(IsWrite); } 19910343SCurtis.Dunham@arm.com bool isUpgrade() const { return testCmdAttrib(IsUpgrade); } 20010343SCurtis.Dunham@arm.com bool isRequest() const { return testCmdAttrib(IsRequest); } 20110343SCurtis.Dunham@arm.com bool isResponse() const { return testCmdAttrib(IsResponse); } 2024870Sstever@eecs.umich.edu bool needsWritable() const { return testCmdAttrib(NeedsWritable); } 2035314Sstever@gmail.com bool needsResponse() const { return testCmdAttrib(NeedsResponse); } 2048184Ssomayeh@cs.wisc.edu bool isInvalidate() const { return testCmdAttrib(IsInvalidate); } 2054022Sstever@eecs.umich.edu bool isEviction() const { return testCmdAttrib(IsEviction); } 2065735Snate@binkert.org bool isClean() const { return testCmdAttrib(IsClean); } 2075735Snate@binkert.org bool fromCache() const { return testCmdAttrib(FromCache); } 2085735Snate@binkert.org 2094022Sstever@eecs.umich.edu /** 2104022Sstever@eecs.umich.edu * A writeback is an eviction that carries data. 2114022Sstever@eecs.umich.edu */ 2125735Snate@binkert.org bool isWriteback() const { return testCmdAttrib(IsEviction) && 2135735Snate@binkert.org testCmdAttrib(HasData); } 2144022Sstever@eecs.umich.edu 2154022Sstever@eecs.umich.edu /** 2165735Snate@binkert.org * Check if this particular packet type carries payload data. Note 2175735Snate@binkert.org * that this does not reflect if the data pointer of the packet is 2185735Snate@binkert.org * valid or not. 2194022Sstever@eecs.umich.edu */ 2205735Snate@binkert.org bool hasData() const { return testCmdAttrib(HasData); } 2215735Snate@binkert.org bool isLLSC() const { return testCmdAttrib(IsLlsc); } 2224022Sstever@eecs.umich.edu bool isSWPrefetch() const { return testCmdAttrib(IsSWPrefetch); } 2234022Sstever@eecs.umich.edu bool isHWPrefetch() const { return testCmdAttrib(IsHWPrefetch); } 2242381SN/A bool isPrefetch() const { return testCmdAttrib(IsSWPrefetch) || 2252662Sstever@eecs.umich.edu testCmdAttrib(IsHWPrefetch); } 2262662Sstever@eecs.umich.edu bool isError() const { return testCmdAttrib(IsError); } 2272662Sstever@eecs.umich.edu bool isPrint() const { return testCmdAttrib(IsPrint); } 2282662Sstever@eecs.umich.edu bool isFlush() const { return testCmdAttrib(IsFlush); } 2292662Sstever@eecs.umich.edu 2302381SN/A Command 2319044SAli.Saidi@ARM.com responseCommand() const 2322381SN/A { 2332813Srdreslin@umich.edu return commandInfo[cmd].response; 2345735Snate@binkert.org } 2355735Snate@binkert.org 2364022Sstever@eecs.umich.edu /// Return the string to a cmd given by idx. 2375735Snate@binkert.org const std::string &toString() const { return commandInfo[cmd].str; } 2385735Snate@binkert.org int toInt() const { return (int)cmd; } 2395735Snate@binkert.org 2405735Snate@binkert.org MemCmd(Command _cmd) : cmd(_cmd) { } 2415735Snate@binkert.org MemCmd(int _cmd) : cmd((Command)_cmd) { } 2425735Snate@binkert.org MemCmd() : cmd(InvalidCmd) { } 2435735Snate@binkert.org 2445735Snate@binkert.org bool operator==(MemCmd c2) const { return (cmd == c2.cmd); } 2455735Snate@binkert.org bool operator!=(MemCmd c2) const { return (cmd != c2.cmd); } 2465735Snate@binkert.org}; 2475735Snate@binkert.org 2485735Snate@binkert.org/** 2495735Snate@binkert.org * A Packet is used to encapsulate a transfer between two objects in 2505735Snate@binkert.org * the memory system (e.g., the L1 and L2 cache). (In contrast, a 2515735Snate@binkert.org * single Request travels all the way from the requester to the 2525735Snate@binkert.org * ultimate destination and back, possibly being conveyed by several 2535735Snate@binkert.org * different Packets along the way.) 2545735Snate@binkert.org */ 2555735Snate@binkert.orgclass Packet : public Printable 2565735Snate@binkert.org{ 2575735Snate@binkert.org public: 25810566Sandreas.hansson@arm.com typedef uint32_t FlagsType; 25910566Sandreas.hansson@arm.com typedef ::Flags<FlagsType> Flags; 2605735Snate@binkert.org 2618436SBrad.Beckmann@amd.com private: 2628436SBrad.Beckmann@amd.com 2638436SBrad.Beckmann@amd.com enum : FlagsType { 26410192Smitch.hayenga@arm.com // Flags to transfer across when copying a packet 26510192Smitch.hayenga@arm.com COPY_FLAGS = 0x0000003F, 2665735Snate@binkert.org 2675735Snate@binkert.org // Does this packet have sharers (which means it should not be 2685735Snate@binkert.org // considered writable) or not. See setHasSharers below. 2695735Snate@binkert.org HAS_SHARERS = 0x00000001, 2704022Sstever@eecs.umich.edu 2714022Sstever@eecs.umich.edu // Special control flags 2725735Snate@binkert.org /// Special timing-mode atomic snoop for multi-level coherence. 2734870Sstever@eecs.umich.edu EXPRESS_SNOOP = 0x00000002, 2744870Sstever@eecs.umich.edu 2755735Snate@binkert.org /// Allow a responding cache to inform the cache hierarchy 27610569Sandreas.hansson@arm.com /// that it had a writable copy before responding. See 2774870Sstever@eecs.umich.edu /// setResponderHadWritable below. 2782566SN/A RESPONDER_HAD_WRITABLE = 0x00000004, 2795735Snate@binkert.org 2805735Snate@binkert.org // Snoop co-ordination flag to indicate that a cache is 2815735Snate@binkert.org // responding to a snoop. See setCacheResponding below. 2825735Snate@binkert.org CACHE_RESPONDING = 0x00000008, 2835735Snate@binkert.org 2845735Snate@binkert.org // The writeback/writeclean should be propagated further 2852566SN/A // downstream by the receiver 2862566SN/A WRITE_THROUGH = 0x00000010, 2872566SN/A 2885735Snate@binkert.org // Response co-ordination flag for cache maintenance 2895735Snate@binkert.org // operations 2902381SN/A SATISFIED = 0x00000020, 2912381SN/A 29210028SGiacomo.Gabrielli@arm.com /// Are the 'addr' and 'size' fields valid? 29310028SGiacomo.Gabrielli@arm.com VALID_ADDR = 0x00000100, 29410028SGiacomo.Gabrielli@arm.com VALID_SIZE = 0x00000200, 2955735Snate@binkert.org 2966227Snate@binkert.org /// Is the data pointer set to a value that shouldn't be freed 2972381SN/A /// when the packet is destroyed? 2985735Snate@binkert.org STATIC_DATA = 0x00001000, 2995735Snate@binkert.org /// The data pointer points to a value that should be freed when 3004870Sstever@eecs.umich.edu /// the packet is destroyed. The pointer is assumed to be pointing 3014870Sstever@eecs.umich.edu /// to an array, and delete [] is consequently called 3024870Sstever@eecs.umich.edu DYNAMIC_DATA = 0x00002000, 3034870Sstever@eecs.umich.edu 3044870Sstever@eecs.umich.edu /// suppress the error if this packet encounters a functional 3054870Sstever@eecs.umich.edu /// access failure. 3068668Sgeoffrey.blake@arm.com SUPPRESS_FUNC_ERROR = 0x00008000, 3078668Sgeoffrey.blake@arm.com 3088668Sgeoffrey.blake@arm.com // Signal block present to squash prefetch and cache evict packets 3098668Sgeoffrey.blake@arm.com // through express snoop flag 3108668Sgeoffrey.blake@arm.com BLOCK_CACHED = 0x00010000 3118668Sgeoffrey.blake@arm.com }; 3128668Sgeoffrey.blake@arm.com 3132641Sstever@eecs.umich.edu Flags flags; 3142811Srdreslin@umich.edu 3159547Sandreas.hansson@arm.com public: 31610694SMarco.Balboni@ARM.com typedef MemCmd::Command Command; 31710405Sandreas.hansson@arm.com 31810405Sandreas.hansson@arm.com /// The command field of the packet. 31910405Sandreas.hansson@arm.com MemCmd cmd; 32010405Sandreas.hansson@arm.com 3219547Sandreas.hansson@arm.com const PacketId id; 32210694SMarco.Balboni@ARM.com 3233218Sgblack@eecs.umich.edu /// A pointer to the original request. 3249547Sandreas.hansson@arm.com RequestPtr req; 32510694SMarco.Balboni@ARM.com 32610694SMarco.Balboni@ARM.com private: 32710694SMarco.Balboni@ARM.com /** 32810694SMarco.Balboni@ARM.com * A pointer to the data being transferred. It can be different 32910405Sandreas.hansson@arm.com * sizes at each level of the hierarchy so it belongs to the 33010405Sandreas.hansson@arm.com * packet, not request. This may or may not be populated when a 3319547Sandreas.hansson@arm.com * responder receives the packet. If not populated memory should 33210694SMarco.Balboni@ARM.com * be allocated. 3333218Sgblack@eecs.umich.edu */ 3345735Snate@binkert.org PacketDataPtr data; 3355735Snate@binkert.org 3369542Sandreas.hansson@arm.com /// The address of the request. This address could be virtual or 3379542Sandreas.hansson@arm.com /// physical, depending on the system configuration. 3389542Sandreas.hansson@arm.com Addr addr; 3399542Sandreas.hansson@arm.com 3409542Sandreas.hansson@arm.com /// True if the request targets the secure memory space. 3419542Sandreas.hansson@arm.com bool _isSecure; 3429542Sandreas.hansson@arm.com 3439542Sandreas.hansson@arm.com /// The size of the request or transfer. 3449542Sandreas.hansson@arm.com unsigned size; 3459542Sandreas.hansson@arm.com 3469542Sandreas.hansson@arm.com /** 3479542Sandreas.hansson@arm.com * Track the bytes found that satisfy a functional read. 3489542Sandreas.hansson@arm.com */ 3499542Sandreas.hansson@arm.com std::vector<bool> bytesValid; 3505735Snate@binkert.org 3515735Snate@binkert.org // Quality of Service priority value 3525735Snate@binkert.org uint8_t _qosValue; 3539542Sandreas.hansson@arm.com 3549542Sandreas.hansson@arm.com public: 3552641Sstever@eecs.umich.edu 3562641Sstever@eecs.umich.edu /** 3572641Sstever@eecs.umich.edu * The extra delay from seeing the packet until the header is 3585315Sstever@gmail.com * transmitted. This delay is used to communicate the crossbar 3595315Sstever@gmail.com * forwarding latency to the neighbouring object (e.g. a cache) 3605315Sstever@gmail.com * that actually makes the packet wait. As the delay is relative, 3615315Sstever@gmail.com * a 32-bit unsigned should be sufficient. 3629044SAli.Saidi@ARM.com */ 3635735Snate@binkert.org uint32_t headerDelay; 3645735Snate@binkert.org 3655735Snate@binkert.org /** 3665735Snate@binkert.org * Keep track of the extra delay incurred by snooping upwards 3675735Snate@binkert.org * before sending a request down the memory system. This is used 3685735Snate@binkert.org * by the coherent crossbar to account for the additional request 3695735Snate@binkert.org * delay. 3705314Sstever@gmail.com */ 3715314Sstever@gmail.com uint32_t snoopDelay; 3725314Sstever@gmail.com 3735735Snate@binkert.org /** 3745314Sstever@gmail.com * The extra pipelining delay from seeing the packet until the end of 3755314Sstever@gmail.com * payload is transmitted by the component that provided it (if 3765314Sstever@gmail.com * any). This includes the header delay. Similar to the header 3775314Sstever@gmail.com * delay, this is used to make up for the fact that the 3785314Sstever@gmail.com * crossbar does not make the packet wait. As the delay is 3795314Sstever@gmail.com * relative, a 32-bit unsigned should be sufficient. 3805314Sstever@gmail.com */ 3815314Sstever@gmail.com uint32_t payloadDelay; 3825314Sstever@gmail.com 3835314Sstever@gmail.com /** 3845314Sstever@gmail.com * A virtual base opaque structure used to hold state associated 3855314Sstever@gmail.com * with the packet (e.g., an MSHR), specific to a MemObject that 3865314Sstever@gmail.com * sees the packet. A pointer to this state is returned in the 3875314Sstever@gmail.com * packet's response so that the MemObject in question can quickly 3885735Snate@binkert.org * look up the state needed to process it. A specific subclass 3895735Snate@binkert.org * would be derived from this to carry state specific to a 3905735Snate@binkert.org * particular sending device. 3915314Sstever@gmail.com * 3925315Sstever@gmail.com * As multiple MemObjects may add their SenderState throughout the 3935735Snate@binkert.org * memory system, the SenderStates create a stack, where a 3945735Snate@binkert.org * MemObject can add a new Senderstate, as long as the 3955315Sstever@gmail.com * predecessing SenderState is restored when the response comes 3965735Snate@binkert.org * back. For this reason, the predecessor should always be 3975735Snate@binkert.org * populated with the current SenderState of a packet before 3985314Sstever@gmail.com * modifying the senderState field in the request packet. 3995314Sstever@gmail.com */ 4005735Snate@binkert.org struct SenderState 4015735Snate@binkert.org { 4025735Snate@binkert.org SenderState* predecessor; 4035735Snate@binkert.org SenderState() : predecessor(NULL) {} 4045314Sstever@gmail.com virtual ~SenderState() {} 4055735Snate@binkert.org }; 4065735Snate@binkert.org 4075735Snate@binkert.org /** 4085315Sstever@gmail.com * Object used to maintain state of a PrintReq. The senderState 4095735Snate@binkert.org * field of a PrintReq should always be of this type. 4105735Snate@binkert.org */ 4115314Sstever@gmail.com class PrintReqState : public SenderState 4125735Snate@binkert.org { 4135735Snate@binkert.org private: 4145735Snate@binkert.org /** 4155735Snate@binkert.org * An entry in the label stack. 4165735Snate@binkert.org */ 4175314Sstever@gmail.com struct LabelStackEntry 4185314Sstever@gmail.com { 4195314Sstever@gmail.com const std::string label; 4205735Snate@binkert.org std::string *prefix; 4215735Snate@binkert.org bool labelPrinted; 4225735Snate@binkert.org LabelStackEntry(const std::string &_label, std::string *_prefix); 4235735Snate@binkert.org }; 4249542Sandreas.hansson@arm.com 4255735Snate@binkert.org typedef std::list<LabelStackEntry> LabelStack; 4265735Snate@binkert.org LabelStack labelStack; 4275735Snate@binkert.org 4282662Sstever@eecs.umich.edu std::string *curPrefixPtr; 4292641Sstever@eecs.umich.edu 4309542Sandreas.hansson@arm.com public: 4319542Sandreas.hansson@arm.com std::ostream &os; 4329542Sandreas.hansson@arm.com const int verbosity; 4339542Sandreas.hansson@arm.com 4349542Sandreas.hansson@arm.com PrintReqState(std::ostream &os, int verbosity = 0); 4359542Sandreas.hansson@arm.com ~PrintReqState(); 4369542Sandreas.hansson@arm.com 4379542Sandreas.hansson@arm.com /** 4389542Sandreas.hansson@arm.com * Returns the current line prefix. 4399542Sandreas.hansson@arm.com */ 4409542Sandreas.hansson@arm.com const std::string &curPrefix() { return *curPrefixPtr; } 4419542Sandreas.hansson@arm.com 4429542Sandreas.hansson@arm.com /** 4439542Sandreas.hansson@arm.com * Push a label onto the label stack, and prepend the given 4449542Sandreas.hansson@arm.com * prefix string onto the current prefix. Labels will only be 4459542Sandreas.hansson@arm.com * printed if an object within the label's scope is printed. 4469542Sandreas.hansson@arm.com */ 4479542Sandreas.hansson@arm.com void pushLabel(const std::string &lbl, 4489542Sandreas.hansson@arm.com const std::string &prefix = " "); 4499542Sandreas.hansson@arm.com 4509543Ssascha.bischoff@arm.com /** 4519543Ssascha.bischoff@arm.com * Pop a label off the label stack. 4529543Ssascha.bischoff@arm.com */ 4539543Ssascha.bischoff@arm.com void popLabel(); 4549543Ssascha.bischoff@arm.com 4559543Ssascha.bischoff@arm.com /** 4569543Ssascha.bischoff@arm.com * Print all of the pending unprinted labels on the 4579543Ssascha.bischoff@arm.com * stack. Called by printObj(), so normally not called by 4589543Ssascha.bischoff@arm.com * users unless bypassing printObj(). 4599543Ssascha.bischoff@arm.com */ 4609543Ssascha.bischoff@arm.com void printLabels(); 4619543Ssascha.bischoff@arm.com 4629543Ssascha.bischoff@arm.com /** 4639543Ssascha.bischoff@arm.com * Print a Printable object to os, because it matched the 4649543Ssascha.bischoff@arm.com * address on a PrintReq. 4659543Ssascha.bischoff@arm.com */ 4669543Ssascha.bischoff@arm.com void printObj(Printable *obj); 4679543Ssascha.bischoff@arm.com }; 4689543Ssascha.bischoff@arm.com 4695735Snate@binkert.org /** 4705735Snate@binkert.org * This packet's sender state. Devices should use dynamic_cast<> 4714022Sstever@eecs.umich.edu * to cast to the state appropriate to the sender. The intent of 4722811Srdreslin@umich.edu * this variable is to allow a device to attach extra information 4735735Snate@binkert.org * to a request. A response packet must return the sender state 4744022Sstever@eecs.umich.edu * that was attached to the original request (even if a new packet 4752811Srdreslin@umich.edu * is created). 47610583SCurtis.Dunham@arm.com */ 47710583SCurtis.Dunham@arm.com SenderState *senderState; 47810583SCurtis.Dunham@arm.com 47910583SCurtis.Dunham@arm.com /** 48010583SCurtis.Dunham@arm.com * Push a new sender state to the packet and make the current 48110583SCurtis.Dunham@arm.com * sender state the predecessor of the new one. This should be 48210583SCurtis.Dunham@arm.com * prefered over direct manipulation of the senderState member 48310583SCurtis.Dunham@arm.com * variable. 48410583SCurtis.Dunham@arm.com * 48510583SCurtis.Dunham@arm.com * @param sender_state SenderState to push at the top of the stack 48610583SCurtis.Dunham@arm.com */ 48710583SCurtis.Dunham@arm.com void pushSenderState(SenderState *sender_state); 48810583SCurtis.Dunham@arm.com 48910583SCurtis.Dunham@arm.com /** 4902812Srdreslin@umich.edu * Pop the top of the state stack and return a pointer to it. This 4914870Sstever@eecs.umich.edu * assumes the current sender state is not NULL. This should be 49210567Sandreas.hansson@arm.com * preferred over direct manipulation of the senderState member 49310567Sandreas.hansson@arm.com * variable. 49410567Sandreas.hansson@arm.com * 49510567Sandreas.hansson@arm.com * @return The current top of the stack 49610567Sandreas.hansson@arm.com */ 49710567Sandreas.hansson@arm.com SenderState *popSenderState(); 4989951Sstephan.diestelhorst@arm.com 4999951Sstephan.diestelhorst@arm.com /** 5009951Sstephan.diestelhorst@arm.com * Go through the sender state stack and return the first instance 5014870Sstever@eecs.umich.edu * that is of type T (as determined by a dynamic_cast). If there 5024895Sstever@eecs.umich.edu * is no sender state of type T, NULL is returned. 5039951Sstephan.diestelhorst@arm.com * 5049951Sstephan.diestelhorst@arm.com * @return The topmost state of type T 5059951Sstephan.diestelhorst@arm.com */ 5069951Sstephan.diestelhorst@arm.com template <typename T> 5079951Sstephan.diestelhorst@arm.com T * findNextSenderState() const 5089951Sstephan.diestelhorst@arm.com { 5099951Sstephan.diestelhorst@arm.com T *t = NULL; 51010192Smitch.hayenga@arm.com SenderState* sender_state = senderState; 51110192Smitch.hayenga@arm.com while (t == NULL && sender_state != NULL) { 5124895Sstever@eecs.umich.edu t = dynamic_cast<T*>(sender_state); 5134870Sstever@eecs.umich.edu sender_state = sender_state->predecessor; 5144870Sstever@eecs.umich.edu } 5154870Sstever@eecs.umich.edu return t; 5165735Snate@binkert.org } 5175735Snate@binkert.org 5185735Snate@binkert.org /// Return the string name of the cmd field (for debugging and 5195735Snate@binkert.org /// tracing). 5205735Snate@binkert.org const std::string &cmdString() const { return cmd.toString(); } 5215735Snate@binkert.org 5225735Snate@binkert.org /// Return the index of this command. 5235735Snate@binkert.org inline int cmdToIndex() const { return cmd.toInt(); } 5244986Ssaidi@eecs.umich.edu 5252814Srdreslin@umich.edu bool isRead() const { return cmd.isRead(); } 5265764Snate@binkert.org bool isWrite() const { return cmd.isWrite(); } 5279259SAli.Saidi@ARM.com bool isUpgrade() const { return cmd.isUpgrade(); } 5289259SAli.Saidi@ARM.com bool isRequest() const { return cmd.isRequest(); } 5299259SAli.Saidi@ARM.com bool isResponse() const { return cmd.isResponse(); } 5309259SAli.Saidi@ARM.com bool needsWritable() const 5319259SAli.Saidi@ARM.com { 5329259SAli.Saidi@ARM.com // we should never check if a response needsWritable, the 5339259SAli.Saidi@ARM.com // request has this flag, and for a response we should rather 5349259SAli.Saidi@ARM.com // look at the hasSharers flag (if not set, the response is to 5359259SAli.Saidi@ARM.com // be considered writable) 5366227Snate@binkert.org assert(isRequest()); 5375735Snate@binkert.org return cmd.needsWritable(); 5382549SN/A } 53910028SGiacomo.Gabrielli@arm.com bool needsResponse() const { return cmd.needsResponse(); } 54010028SGiacomo.Gabrielli@arm.com bool isInvalidate() const { return cmd.isInvalidate(); } 54110028SGiacomo.Gabrielli@arm.com bool isEviction() const { return cmd.isEviction(); } 54210028SGiacomo.Gabrielli@arm.com bool isClean() const { return cmd.isClean(); } 54310028SGiacomo.Gabrielli@arm.com bool fromCache() const { return cmd.fromCache(); } 54410028SGiacomo.Gabrielli@arm.com bool isWriteback() const { return cmd.isWriteback(); } 5455735Snate@binkert.org bool hasData() const { return cmd.hasData(); } 5467550SBrad.Beckmann@amd.com bool hasRespData() const 5477550SBrad.Beckmann@amd.com { 5487550SBrad.Beckmann@amd.com MemCmd resp_cmd = cmd.responseCommand(); 5497550SBrad.Beckmann@amd.com return resp_cmd.hasData(); 5507550SBrad.Beckmann@amd.com } 5517550SBrad.Beckmann@amd.com bool isLLSC() const { return cmd.isLLSC(); } 5527550SBrad.Beckmann@amd.com bool isError() const { return cmd.isError(); } 5537550SBrad.Beckmann@amd.com bool isPrint() const { return cmd.isPrint(); } 5547550SBrad.Beckmann@amd.com bool isFlush() const { return cmd.isFlush(); } 5557550SBrad.Beckmann@amd.com 5567550SBrad.Beckmann@amd.com bool isWholeLineWrite(unsigned blk_size) 5577550SBrad.Beckmann@amd.com { 5587550SBrad.Beckmann@amd.com return (cmd == MemCmd::WriteReq || cmd == MemCmd::WriteLineReq) && 5597550SBrad.Beckmann@amd.com getOffset(blk_size) == 0 && getSize() == blk_size; 5607550SBrad.Beckmann@amd.com } 5617550SBrad.Beckmann@amd.com 5627550SBrad.Beckmann@amd.com //@{ 5637550SBrad.Beckmann@amd.com /// Snoop flags 5647550SBrad.Beckmann@amd.com /** 5657550SBrad.Beckmann@amd.com * Set the cacheResponding flag. This is used by the caches to 5667550SBrad.Beckmann@amd.com * signal another cache that they are responding to a request. A 5677550SBrad.Beckmann@amd.com * cache will only respond to snoops if it has the line in either 5687550SBrad.Beckmann@amd.com * Modified or Owned state. Note that on snoop hits we always pass 5697550SBrad.Beckmann@amd.com * the line as Modified and never Owned. In the case of an Owned 5705735Snate@binkert.org * line we proceed to invalidate all other copies. 5715735Snate@binkert.org * 5729030Sandreas.hansson@arm.com * On a cache fill (see Cache::handleFill), we check hasSharers 5735735Snate@binkert.org * first, ignoring the cacheResponding flag if hasSharers is set. 57410569Sandreas.hansson@arm.com * A line is consequently allocated as: 57510360Sandreas.hansson@arm.com * 57610660Sandreas.hansson@arm.com * hasSharers cacheResponding state 57710694SMarco.Balboni@ARM.com * true false Shared 5789546Sandreas.hansson@arm.com * true true Shared 5792641Sstever@eecs.umich.edu * false false Exclusive 5806104Ssteve.reinhardt@amd.com * false true Modified 5816104Ssteve.reinhardt@amd.com */ 5826104Ssteve.reinhardt@amd.com void setCacheResponding() 58310028SGiacomo.Gabrielli@arm.com { 5846104Ssteve.reinhardt@amd.com assert(isRequest()); 5856104Ssteve.reinhardt@amd.com assert(!flags.isSet(CACHE_RESPONDING)); 5866104Ssteve.reinhardt@amd.com flags.set(CACHE_RESPONDING); 5876104Ssteve.reinhardt@amd.com } 5886104Ssteve.reinhardt@amd.com bool cacheResponding() const { return flags.isSet(CACHE_RESPONDING); } 5892813Srdreslin@umich.edu /** 5902813Srdreslin@umich.edu * On fills, the hasSharers flag is used by the caches in 5915735Snate@binkert.org * combination with the cacheResponding flag, as clarified 5925735Snate@binkert.org * above. If the hasSharers flag is not set, the packet is passing 5935735Snate@binkert.org * writable. Thus, a response from a memory passes the line as 5945735Snate@binkert.org * writable by default. 5955735Snate@binkert.org * 59610569Sandreas.hansson@arm.com * The hasSharers flag is also used by upstream caches to inform a 59710360Sandreas.hansson@arm.com * downstream cache that they have the block (by calling 5988949Sandreas.hansson@arm.com * setHasSharers on snoop request packets that hit in upstream 59910694SMarco.Balboni@ARM.com * cachs tags or MSHRs). If the snoop packet has sharers, a 6009546Sandreas.hansson@arm.com * downstream cache is prevented from passing a dirty line upwards 6012813Srdreslin@umich.edu * if it was not explicitly asked for a writable copy. See 6026104Ssteve.reinhardt@amd.com * Cache::satisfyCpuSideRequest. 6036104Ssteve.reinhardt@amd.com * 6046104Ssteve.reinhardt@amd.com * The hasSharers flag is also used on writebacks, in 60510028SGiacomo.Gabrielli@arm.com * combination with the WritbackClean or WritebackDirty commands, 6066104Ssteve.reinhardt@amd.com * to allocate the block downstream either as: 6076104Ssteve.reinhardt@amd.com * 6086104Ssteve.reinhardt@amd.com * command hasSharers state 6094626Sstever@eecs.umich.edu * WritebackDirty false Modified 6104626Sstever@eecs.umich.edu * WritebackDirty true Owned 6115735Snate@binkert.org * WritebackClean false Exclusive 6125735Snate@binkert.org * WritebackClean true Shared 6134887Sstever@eecs.umich.edu */ 6144887Sstever@eecs.umich.edu void setHasSharers() { flags.set(HAS_SHARERS); } 6154887Sstever@eecs.umich.edu bool hasSharers() const { return flags.isSet(HAS_SHARERS); } 6165735Snate@binkert.org //@} 6175735Snate@binkert.org 61810571Sandreas.hansson@arm.com /** 6195735Snate@binkert.org * The express snoop flag is used for two purposes. Firstly, it is 62010571Sandreas.hansson@arm.com * used to bypass flow control for normal (non-snoop) requests 62110028SGiacomo.Gabrielli@arm.com * going downstream in the memory system. In cases where a cache 6229547Sandreas.hansson@arm.com * is responding to a snoop from another cache (it had a dirty 6239547Sandreas.hansson@arm.com * line), but the line is not writable (and there are possibly 62410694SMarco.Balboni@ARM.com * other copies), the express snoop flag is set by the downstream 62510694SMarco.Balboni@ARM.com * cache to invalidate all other copies in zero time. Secondly, 6269546Sandreas.hansson@arm.com * the express snoop flag is also set to be able to distinguish 6274626Sstever@eecs.umich.edu * snoop packets that came from a downstream cache, rather than 62810571Sandreas.hansson@arm.com * snoop packets from neighbouring caches. 6295735Snate@binkert.org */ 6305735Snate@binkert.org void setExpressSnoop() { flags.set(EXPRESS_SNOOP); } 6319031Sandreas.hansson@arm.com bool isExpressSnoop() const { return flags.isSet(EXPRESS_SNOOP); } 63210565Sandreas.hansson@arm.com 63310571Sandreas.hansson@arm.com /** 63410571Sandreas.hansson@arm.com * On responding to a snoop request (which only happens for 63510571Sandreas.hansson@arm.com * Modified or Owned lines), make sure that we can transform an 63610571Sandreas.hansson@arm.com * Owned response to a Modified one. If this flag is not set, the 63710571Sandreas.hansson@arm.com * responding cache had the line in the Owned state, and there are 63810571Sandreas.hansson@arm.com * possibly other Shared copies in the memory system. A downstream 63910571Sandreas.hansson@arm.com * cache helps in orchestrating the invalidation of these copies 64010571Sandreas.hansson@arm.com * by sending out the appropriate express snoops. 64110571Sandreas.hansson@arm.com */ 64210571Sandreas.hansson@arm.com void setResponderHadWritable() 64310571Sandreas.hansson@arm.com { 64410571Sandreas.hansson@arm.com assert(cacheResponding()); 64510571Sandreas.hansson@arm.com assert(!responderHadWritable()); 64610571Sandreas.hansson@arm.com flags.set(RESPONDER_HAD_WRITABLE); 64710571Sandreas.hansson@arm.com } 64810342SCurtis.Dunham@arm.com bool responderHadWritable() const 6498668Sgeoffrey.blake@arm.com { return flags.isSet(RESPONDER_HAD_WRITABLE); } 65010342SCurtis.Dunham@arm.com 65110342SCurtis.Dunham@arm.com /** 65210342SCurtis.Dunham@arm.com * A writeback/writeclean cmd gets propagated further downstream 65310342SCurtis.Dunham@arm.com * by the receiver when the flag is set. 65410342SCurtis.Dunham@arm.com */ 65510342SCurtis.Dunham@arm.com void setWriteThrough() 65610342SCurtis.Dunham@arm.com { 65710342SCurtis.Dunham@arm.com assert(cmd.isWrite() && 65810342SCurtis.Dunham@arm.com (cmd.isEviction() || cmd == MemCmd::WriteClean)); 65910343SCurtis.Dunham@arm.com flags.set(WRITE_THROUGH); 66010343SCurtis.Dunham@arm.com } 66110342SCurtis.Dunham@arm.com void clearWriteThrough() { flags.clear(WRITE_THROUGH); } 66210342SCurtis.Dunham@arm.com bool writeThrough() const { return flags.isSet(WRITE_THROUGH); } 66310342SCurtis.Dunham@arm.com 66410342SCurtis.Dunham@arm.com /** 66510342SCurtis.Dunham@arm.com * Set when a request hits in a cache and the cache is not going 66610342SCurtis.Dunham@arm.com * to respond. This is used by the crossbar to coordinate 66710342SCurtis.Dunham@arm.com * responses for cache maintenance operations. 66810342SCurtis.Dunham@arm.com */ 66910342SCurtis.Dunham@arm.com void setSatisfied() 67010342SCurtis.Dunham@arm.com { 67110342SCurtis.Dunham@arm.com assert(cmd.isClean()); 67210342SCurtis.Dunham@arm.com assert(!flags.isSet(SATISFIED)); 67310342SCurtis.Dunham@arm.com flags.set(SATISFIED); 67410342SCurtis.Dunham@arm.com } 67510342SCurtis.Dunham@arm.com bool satisfied() const { return flags.isSet(SATISFIED); } 67610342SCurtis.Dunham@arm.com 67710569Sandreas.hansson@arm.com void setSuppressFuncError() { flags.set(SUPPRESS_FUNC_ERROR); } 67810342SCurtis.Dunham@arm.com bool suppressFuncError() const { return flags.isSet(SUPPRESS_FUNC_ERROR); } 67910342SCurtis.Dunham@arm.com void setBlockCached() { flags.set(BLOCK_CACHED); } 68010342SCurtis.Dunham@arm.com bool isBlockCached() const { return flags.isSet(BLOCK_CACHED); } 68110342SCurtis.Dunham@arm.com void clearBlockCached() { flags.clear(BLOCK_CACHED); } 68210342SCurtis.Dunham@arm.com 68310342SCurtis.Dunham@arm.com /** 68410342SCurtis.Dunham@arm.com * QoS Value getter 68510569Sandreas.hansson@arm.com * Returns 0 if QoS value was never set (constructor default). 68610342SCurtis.Dunham@arm.com * 68710342SCurtis.Dunham@arm.com * @return QoS priority value of the packet 68810342SCurtis.Dunham@arm.com */ 68910342SCurtis.Dunham@arm.com inline uint8_t qosValue() const { return _qosValue; } 6902641Sstever@eecs.umich.edu 6912549SN/A /** 6925735Snate@binkert.org * QoS Value setter 6935735Snate@binkert.org * Interface for setting QoS priority value of the packet. 6945735Snate@binkert.org * 6952566SN/A * @param qos_value QoS priority value 6965387Sstever@gmail.com */ 6975387Sstever@gmail.com inline void qosValue(const uint8_t qos_value) 6985387Sstever@gmail.com { _qosValue = qos_value; } 6995387Sstever@gmail.com 7005387Sstever@gmail.com inline MasterID masterId() const { return req->masterId(); } 7015387Sstever@gmail.com 7025735Snate@binkert.org // Network error conditions... encapsulate them as methods since 7035387Sstever@gmail.com // their encoding keeps changing (from result field to command 7042566SN/A // field, etc.) 7055735Snate@binkert.org void 7064626Sstever@eecs.umich.edu setBadAddress() 70710660Sandreas.hansson@arm.com { 7084626Sstever@eecs.umich.edu assert(isResponse()); 7095735Snate@binkert.org cmd = MemCmd::BadAddressError; 7105735Snate@binkert.org } 7114626Sstever@eecs.umich.edu 7122662Sstever@eecs.umich.edu void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } 7132855Srdreslin@umich.edu 7144986Ssaidi@eecs.umich.edu Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 7154022Sstever@eecs.umich.edu /** 7165745Snate@binkert.org * Update the address of this packet mid-transaction. This is used 7177464Ssteve.reinhardt@amd.com * by the address mapper to change an already set address to a new 7187464Ssteve.reinhardt@amd.com * one based on the system configuration. It is intended to remap 7197464Ssteve.reinhardt@amd.com * an existing address, so it asserts that the current address is 7202641Sstever@eecs.umich.edu * valid. 7212641Sstever@eecs.umich.edu */ 7225735Snate@binkert.org void setAddr(Addr _addr) { assert(flags.isSet(VALID_ADDR)); addr = _addr; } 7235735Snate@binkert.org 7244870Sstever@eecs.umich.edu unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } 7254870Sstever@eecs.umich.edu 7264870Sstever@eecs.umich.edu Addr getOffset(unsigned int blk_size) const 7274870Sstever@eecs.umich.edu { 7285735Snate@binkert.org return getAddr() & Addr(blk_size - 1); 7295735Snate@binkert.org } 7303348Sbinkertn@umich.edu 7314870Sstever@eecs.umich.edu Addr getBlockAddr(unsigned int blk_size) const 7323135Srdreslin@umich.edu { 7333135Srdreslin@umich.edu return getAddr() & ~(Addr(blk_size - 1)); 7348436SBrad.Beckmann@amd.com } 7358436SBrad.Beckmann@amd.com 7368436SBrad.Beckmann@amd.com bool isSecure() const 7378436SBrad.Beckmann@amd.com { 7388436SBrad.Beckmann@amd.com assert(flags.isSet(VALID_ADDR)); 7398436SBrad.Beckmann@amd.com return _isSecure; 7408436SBrad.Beckmann@amd.com } 7418436SBrad.Beckmann@amd.com 7428436SBrad.Beckmann@amd.com /** 7438436SBrad.Beckmann@amd.com * Accessor function to atomic op. 7448436SBrad.Beckmann@amd.com */ 7458436SBrad.Beckmann@amd.com AtomicOpFunctor *getAtomicOp() const { return req->getAtomicOpFunctor(); } 7467006Snate@binkert.org bool isAtomicOp() const { return req->isAtomic(); } 7477006Snate@binkert.org 7487006Snate@binkert.org /** 7497006Snate@binkert.org * It has been determined that the SC packet should successfully update 7507006Snate@binkert.org * memory. Therefore, convert this SC packet to a normal write. 7517006Snate@binkert.org */ 7527006Snate@binkert.org void 7537006Snate@binkert.org convertScToWrite() 7547006Snate@binkert.org { 7552685Ssaidi@eecs.umich.edu assert(isLLSC()); 7563348Sbinkertn@umich.edu assert(isWrite()); 7573348Sbinkertn@umich.edu cmd = MemCmd::WriteReq; 75810571Sandreas.hansson@arm.com } 75910571Sandreas.hansson@arm.com 76010571Sandreas.hansson@arm.com /** 76110571Sandreas.hansson@arm.com * When ruby is in use, Ruby will monitor the cache line and the 76210571Sandreas.hansson@arm.com * phys memory should treat LL ops as normal reads. 76310571Sandreas.hansson@arm.com */ 76410571Sandreas.hansson@arm.com void 76510571Sandreas.hansson@arm.com convertLlToRead() 7662566SN/A { 7672566SN/A assert(isLLSC()); 7683348Sbinkertn@umich.edu assert(isRead()); 7693348Sbinkertn@umich.edu cmd = MemCmd::ReadReq; 7703348Sbinkertn@umich.edu } 77110566Sandreas.hansson@arm.com 7723348Sbinkertn@umich.edu /** 7735735Snate@binkert.org * Constructor. Note that a Request object must be constructed 7743348Sbinkertn@umich.edu * first, but the Requests's physical address and size fields need 7752566SN/A * not be valid. The command must be supplied. 7763348Sbinkertn@umich.edu */ 77710564Sandreas.hansson@arm.com Packet(const RequestPtr &_req, MemCmd _cmd) 77810564Sandreas.hansson@arm.com : cmd(_cmd), id((PacketId)_req.get()), req(_req), 77910564Sandreas.hansson@arm.com data(nullptr), addr(0), _isSecure(false), size(0), 78010564Sandreas.hansson@arm.com _qosValue(0), headerDelay(0), snoopDelay(0), 78110564Sandreas.hansson@arm.com payloadDelay(0), senderState(NULL) 78210564Sandreas.hansson@arm.com { 78310564Sandreas.hansson@arm.com if (req->hasPaddr()) { 78410564Sandreas.hansson@arm.com addr = req->getPaddr(); 78510564Sandreas.hansson@arm.com flags.set(VALID_ADDR); 78610564Sandreas.hansson@arm.com _isSecure = req->isSecure(); 78710564Sandreas.hansson@arm.com } 78810566Sandreas.hansson@arm.com if (req->hasSize()) { 78910564Sandreas.hansson@arm.com size = req->getSize(); 79010564Sandreas.hansson@arm.com flags.set(VALID_SIZE); 79110564Sandreas.hansson@arm.com } 79210564Sandreas.hansson@arm.com } 79310564Sandreas.hansson@arm.com 7943348Sbinkertn@umich.edu /** 79510571Sandreas.hansson@arm.com * Alternate constructor if you are trying to create a packet with 79610571Sandreas.hansson@arm.com * a request that is for a whole block, not the address from the 79710571Sandreas.hansson@arm.com * req. this allows for overriding the size/addr of the req. 79810571Sandreas.hansson@arm.com */ 79910571Sandreas.hansson@arm.com Packet(const RequestPtr &_req, MemCmd _cmd, int _blkSize, PacketId _id = 0) 80010571Sandreas.hansson@arm.com : cmd(_cmd), id(_id ? _id : (PacketId)_req.get()), req(_req), 80110571Sandreas.hansson@arm.com data(nullptr), addr(0), _isSecure(false), 80210571Sandreas.hansson@arm.com _qosValue(0), headerDelay(0), 80310571Sandreas.hansson@arm.com snoopDelay(0), payloadDelay(0), senderState(NULL) 8043348Sbinkertn@umich.edu { 8052566SN/A if (req->hasPaddr()) { 8063348Sbinkertn@umich.edu addr = req->getPaddr() & ~(_blkSize - 1); 8073348Sbinkertn@umich.edu flags.set(VALID_ADDR); 8083348Sbinkertn@umich.edu _isSecure = req->isSecure(); 80910566Sandreas.hansson@arm.com } 8103348Sbinkertn@umich.edu size = _blkSize; 8115735Snate@binkert.org flags.set(VALID_SIZE); 8123348Sbinkertn@umich.edu } 8133348Sbinkertn@umich.edu 8145735Snate@binkert.org /** 8155735Snate@binkert.org * Alternate constructor for copying a packet. Copy all fields 8165735Snate@binkert.org * *except* if the original packet's data was dynamic, don't copy 8173348Sbinkertn@umich.edu * that, as we can't guarantee that the new packet's lifetime is 8183348Sbinkertn@umich.edu * less than that of the original packet. In this case the new 81910562Sandreas.hansson@arm.com * packet should allocate its own data. 8203348Sbinkertn@umich.edu */ 82110562Sandreas.hansson@arm.com Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data) 8223348Sbinkertn@umich.edu : cmd(pkt->cmd), id(pkt->id), req(pkt->req), 8233348Sbinkertn@umich.edu data(nullptr), 8242566SN/A addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size), 82510563Sandreas.hansson@arm.com bytesValid(pkt->bytesValid), 82610563Sandreas.hansson@arm.com _qosValue(pkt->qosValue()), 82710563Sandreas.hansson@arm.com headerDelay(pkt->headerDelay), 82810563Sandreas.hansson@arm.com snoopDelay(0), 82910563Sandreas.hansson@arm.com payloadDelay(pkt->payloadDelay), 83010563Sandreas.hansson@arm.com senderState(pkt->senderState) 83110563Sandreas.hansson@arm.com { 83210563Sandreas.hansson@arm.com if (!clear_flags) 8335735Snate@binkert.org flags.set(pkt->flags & COPY_FLAGS); 8345735Snate@binkert.org 8355735Snate@binkert.org flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE)); 8362566SN/A 83710563Sandreas.hansson@arm.com // should we allocate space for data, or not, the express 8382566SN/A // snoops do not need to carry any data as they only serve to 8395735Snate@binkert.org // co-ordinate state changes 8405735Snate@binkert.org if (alloc_data) { 8415735Snate@binkert.org // even if asked to allocate data, if the original packet 8422566SN/A // holds static data, then the sender will not be doing 8432592SN/A // any memcpy on receiving the response, thus we simply 8442566SN/A // carry the pointer forward 8453348Sbinkertn@umich.edu if (pkt->flags.isSet(STATIC_DATA)) { 8464626Sstever@eecs.umich.edu data = pkt->data; 8474626Sstever@eecs.umich.edu flags.set(STATIC_DATA); 8485735Snate@binkert.org } else { 84910563Sandreas.hansson@arm.com allocate(); 8504626Sstever@eecs.umich.edu } 85110571Sandreas.hansson@arm.com } 85210571Sandreas.hansson@arm.com } 85310571Sandreas.hansson@arm.com 85410571Sandreas.hansson@arm.com /** 85510571Sandreas.hansson@arm.com * Generate the appropriate read MemCmd based on the Request flags. 8567691SAli.Saidi@ARM.com */ 85710571Sandreas.hansson@arm.com static MemCmd 85810571Sandreas.hansson@arm.com makeReadCmd(const RequestPtr &req) 8597691SAli.Saidi@ARM.com { 8604626Sstever@eecs.umich.edu if (req->isLLSC()) 8614626Sstever@eecs.umich.edu return MemCmd::LoadLockedReq; 8624626Sstever@eecs.umich.edu else if (req->isPrefetch()) 8634626Sstever@eecs.umich.edu return MemCmd::SoftPFReq; 8644626Sstever@eecs.umich.edu else 8654626Sstever@eecs.umich.edu return MemCmd::ReadReq; 8665735Snate@binkert.org } 86710563Sandreas.hansson@arm.com 8684626Sstever@eecs.umich.edu /** 8694626Sstever@eecs.umich.edu * Generate the appropriate write MemCmd based on the Request flags. 8704626Sstever@eecs.umich.edu */ 8714626Sstever@eecs.umich.edu static MemCmd 8724626Sstever@eecs.umich.edu makeWriteCmd(const RequestPtr &req) 8734626Sstever@eecs.umich.edu { 8744626Sstever@eecs.umich.edu if (req->isLLSC()) 8754626Sstever@eecs.umich.edu return MemCmd::StoreCondReq; 8765735Snate@binkert.org else if (req->isSwap() || req->isAtomic()) 87710563Sandreas.hansson@arm.com return MemCmd::SwapReq; 8784626Sstever@eecs.umich.edu else if (req->isCacheInvalidate()) { 87910563Sandreas.hansson@arm.com return req->isCacheClean() ? MemCmd::CleanInvalidReq : 8804626Sstever@eecs.umich.edu MemCmd::InvalidateReq; 8814626Sstever@eecs.umich.edu } else if (req->isCacheClean()) { 8824626Sstever@eecs.umich.edu return MemCmd::CleanSharedReq; 8834626Sstever@eecs.umich.edu } else 8844626Sstever@eecs.umich.edu return MemCmd::WriteReq; 8855735Snate@binkert.org } 88610563Sandreas.hansson@arm.com 8874626Sstever@eecs.umich.edu /** 8884626Sstever@eecs.umich.edu * Constructor-like methods that return Packets based on Request objects. 8894626Sstever@eecs.umich.edu * Fine-tune the MemCmd type if it's not a vanilla read or write. 8904626Sstever@eecs.umich.edu */ 8914626Sstever@eecs.umich.edu static PacketPtr 8923348Sbinkertn@umich.edu createRead(const RequestPtr &req) 8933348Sbinkertn@umich.edu { 8943348Sbinkertn@umich.edu return new Packet(req, makeReadCmd(req)); 8955735Snate@binkert.org } 8965735Snate@binkert.org 8975735Snate@binkert.org static PacketPtr 89810566Sandreas.hansson@arm.com createWrite(const RequestPtr &req) 8995735Snate@binkert.org { 9005735Snate@binkert.org return new Packet(req, makeWriteCmd(req)); 90110566Sandreas.hansson@arm.com } 9025735Snate@binkert.org 9035735Snate@binkert.org /** 9042566SN/A * clean up packet variables 90510565Sandreas.hansson@arm.com */ 9065735Snate@binkert.org ~Packet() 9075735Snate@binkert.org { 9085735Snate@binkert.org deleteData(); 9095764Snate@binkert.org } 91010566Sandreas.hansson@arm.com 9115745Snate@binkert.org /** 9125735Snate@binkert.org * Take a request packet and modify it in place to be suitable for 9135735Snate@binkert.org * returning as a response to that request. 9144626Sstever@eecs.umich.edu */ 91510570Sandreas.hansson@arm.com void 91610570Sandreas.hansson@arm.com makeResponse() 91710570Sandreas.hansson@arm.com { 91810570Sandreas.hansson@arm.com assert(needsResponse()); 91910570Sandreas.hansson@arm.com assert(isRequest()); 92010570Sandreas.hansson@arm.com cmd = cmd.responseCommand(); 92110570Sandreas.hansson@arm.com 92210570Sandreas.hansson@arm.com // responses are never express, even if the snoop that 92310570Sandreas.hansson@arm.com // triggered them was 92410570Sandreas.hansson@arm.com flags.clear(EXPRESS_SNOOP); 92510570Sandreas.hansson@arm.com } 92610570Sandreas.hansson@arm.com 92710570Sandreas.hansson@arm.com void 92810570Sandreas.hansson@arm.com makeAtomicResponse() 92910570Sandreas.hansson@arm.com { 93010570Sandreas.hansson@arm.com makeResponse(); 93110570Sandreas.hansson@arm.com } 93210570Sandreas.hansson@arm.com 93310570Sandreas.hansson@arm.com void 93410570Sandreas.hansson@arm.com makeTimingResponse() 9354626Sstever@eecs.umich.edu { 93610570Sandreas.hansson@arm.com makeResponse(); 93710570Sandreas.hansson@arm.com } 93810570Sandreas.hansson@arm.com 9394626Sstever@eecs.umich.edu void 9404626Sstever@eecs.umich.edu setFunctionalResponseStatus(bool success) 9415735Snate@binkert.org { 94210570Sandreas.hansson@arm.com if (!success) { 94310570Sandreas.hansson@arm.com if (isWrite()) { 9445314Sstever@gmail.com cmd = MemCmd::FunctionalWriteError; 9455315Sstever@gmail.com } else { 9465315Sstever@gmail.com cmd = MemCmd::FunctionalReadError; 9475315Sstever@gmail.com } 9485735Snate@binkert.org } 9495735Snate@binkert.org } 9505735Snate@binkert.org 9515735Snate@binkert.org void 9525735Snate@binkert.org setSize(unsigned size) 9535314Sstever@gmail.com { 9545314Sstever@gmail.com assert(!flags.isSet(VALID_SIZE)); 9555315Sstever@gmail.com 9565315Sstever@gmail.com this->size = size; 9575315Sstever@gmail.com flags.set(VALID_SIZE); 9585735Snate@binkert.org } 9595735Snate@binkert.org 9605735Snate@binkert.org 9615735Snate@binkert.org public: 9625735Snate@binkert.org /** 9635314Sstever@gmail.com * @{ 9645314Sstever@gmail.com * @name Data accessor mehtods 9655314Sstever@gmail.com */ 9665314Sstever@gmail.com 9679663Suri.wiener@arm.com /** 9689663Suri.wiener@arm.com * Set the data pointer to the following value that should not be 9699663Suri.wiener@arm.com * freed. Static data allows us to do a single memcpy even if 9709663Suri.wiener@arm.com * multiple packets are required to get from source to destination 9719663Suri.wiener@arm.com * and back. In essence the pointer is set calling dataStatic on 9729663Suri.wiener@arm.com * the original packet, and whenever this packet is copied and 9739663Suri.wiener@arm.com * forwarded the same pointer is passed on. When a packet 9749663Suri.wiener@arm.com * eventually reaches the destination holding the data, it is 9752381SN/A * copied once into the location originally set. On the way back 9762381SN/A * to the source, no copies are necessary. 9772381SN/A */ 978 template <typename T> 979 void 980 dataStatic(T *p) 981 { 982 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 983 data = (PacketDataPtr)p; 984 flags.set(STATIC_DATA); 985 } 986 987 /** 988 * Set the data pointer to the following value that should not be 989 * freed. This version of the function allows the pointer passed 990 * to us to be const. To avoid issues down the line we cast the 991 * constness away, the alternative would be to keep both a const 992 * and non-const data pointer and cleverly choose between 993 * them. Note that this is only allowed for static data. 994 */ 995 template <typename T> 996 void 997 dataStaticConst(const T *p) 998 { 999 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 1000 data = const_cast<PacketDataPtr>(p); 1001 flags.set(STATIC_DATA); 1002 } 1003 1004 /** 1005 * Set the data pointer to a value that should have delete [] 1006 * called on it. Dynamic data is local to this packet, and as the 1007 * packet travels from source to destination, forwarded packets 1008 * will allocate their own data. When a packet reaches the final 1009 * destination it will populate the dynamic data of that specific 1010 * packet, and on the way back towards the source, memcpy will be 1011 * invoked in every step where a new packet was created e.g. in 1012 * the caches. Ultimately when the response reaches the source a 1013 * final memcpy is needed to extract the data from the packet 1014 * before it is deallocated. 1015 */ 1016 template <typename T> 1017 void 1018 dataDynamic(T *p) 1019 { 1020 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 1021 data = (PacketDataPtr)p; 1022 flags.set(DYNAMIC_DATA); 1023 } 1024 1025 /** 1026 * get a pointer to the data ptr. 1027 */ 1028 template <typename T> 1029 T* 1030 getPtr() 1031 { 1032 assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 1033 return (T*)data; 1034 } 1035 1036 template <typename T> 1037 const T* 1038 getConstPtr() const 1039 { 1040 assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 1041 return (const T*)data; 1042 } 1043 1044 /** 1045 * Get the data in the packet byte swapped from big endian to 1046 * host endian. 1047 */ 1048 template <typename T> 1049 T getBE() const; 1050 1051 /** 1052 * Get the data in the packet byte swapped from little endian to 1053 * host endian. 1054 */ 1055 template <typename T> 1056 T getLE() const; 1057 1058 /** 1059 * Get the data in the packet byte swapped from the specified 1060 * endianness. 1061 */ 1062 template <typename T> 1063 T get(ByteOrder endian) const; 1064 1065#if THE_ISA != NULL_ISA 1066 /** 1067 * Get the data in the packet byte swapped from guest to host 1068 * endian. 1069 */ 1070 template <typename T> 1071 T get() const 1072 M5_DEPRECATED_MSG("The memory system should be ISA independent."); 1073#endif 1074 1075 /** Set the value in the data pointer to v as big endian. */ 1076 template <typename T> 1077 void setBE(T v); 1078 1079 /** Set the value in the data pointer to v as little endian. */ 1080 template <typename T> 1081 void setLE(T v); 1082 1083 /** 1084 * Set the value in the data pointer to v using the specified 1085 * endianness. 1086 */ 1087 template <typename T> 1088 void set(T v, ByteOrder endian); 1089 1090#if THE_ISA != NULL_ISA 1091 /** Set the value in the data pointer to v as guest endian. */ 1092 template <typename T> 1093 void set(T v) 1094 M5_DEPRECATED_MSG("The memory system should be ISA independent."); 1095#endif 1096 1097 /** 1098 * Get the data in the packet byte swapped from the specified 1099 * endianness and zero-extended to 64 bits. 1100 */ 1101 uint64_t getUintX(ByteOrder endian) const; 1102 1103 /** 1104 * Set the value in the word w after truncating it to the length 1105 * of the packet and then byteswapping it to the desired 1106 * endianness. 1107 */ 1108 void setUintX(uint64_t w, ByteOrder endian); 1109 1110 /** 1111 * Copy data into the packet from the provided pointer. 1112 */ 1113 void 1114 setData(const uint8_t *p) 1115 { 1116 // we should never be copying data onto itself, which means we 1117 // must idenfity packets with static data, as they carry the 1118 // same pointer from source to destination and back 1119 assert(p != getPtr<uint8_t>() || flags.isSet(STATIC_DATA)); 1120 1121 if (p != getPtr<uint8_t>()) 1122 // for packet with allocated dynamic data, we copy data from 1123 // one to the other, e.g. a forwarded response to a response 1124 std::memcpy(getPtr<uint8_t>(), p, getSize()); 1125 } 1126 1127 /** 1128 * Copy data into the packet from the provided block pointer, 1129 * which is aligned to the given block size. 1130 */ 1131 void 1132 setDataFromBlock(const uint8_t *blk_data, int blkSize) 1133 { 1134 setData(blk_data + getOffset(blkSize)); 1135 } 1136 1137 /** 1138 * Copy data from the packet to the memory at the provided pointer. 1139 * @param p Pointer to which data will be copied. 1140 */ 1141 void 1142 writeData(uint8_t *p) const 1143 { 1144 std::memcpy(p, getConstPtr<uint8_t>(), getSize()); 1145 } 1146 1147 /** 1148 * Copy data from the packet to the provided block pointer, which 1149 * is aligned to the given block size. 1150 * @param blk_data Pointer to block to which data will be copied. 1151 * @param blkSize Block size in bytes. 1152 */ 1153 void 1154 writeDataToBlock(uint8_t *blk_data, int blkSize) const 1155 { 1156 writeData(blk_data + getOffset(blkSize)); 1157 } 1158 1159 /** 1160 * delete the data pointed to in the data pointer. Ok to call to 1161 * matter how data was allocted. 1162 */ 1163 void 1164 deleteData() 1165 { 1166 if (flags.isSet(DYNAMIC_DATA)) 1167 delete [] data; 1168 1169 flags.clear(STATIC_DATA|DYNAMIC_DATA); 1170 data = NULL; 1171 } 1172 1173 /** Allocate memory for the packet. */ 1174 void 1175 allocate() 1176 { 1177 // if either this command or the response command has a data 1178 // payload, actually allocate space 1179 if (hasData() || hasRespData()) { 1180 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 1181 flags.set(DYNAMIC_DATA); 1182 data = new uint8_t[getSize()]; 1183 } 1184 } 1185 1186 /** @} */ 1187 1188 /** Get the data in the packet without byte swapping. */ 1189 template <typename T> 1190 T getRaw() const; 1191 1192 /** Set the value in the data pointer to v without byte swapping. */ 1193 template <typename T> 1194 void setRaw(T v); 1195 1196 public: 1197 /** 1198 * Check a functional request against a memory value stored in 1199 * another packet (i.e. an in-transit request or 1200 * response). Returns true if the current packet is a read, and 1201 * the other packet provides the data, which is then copied to the 1202 * current packet. If the current packet is a write, and the other 1203 * packet intersects this one, then we update the data 1204 * accordingly. 1205 */ 1206 bool 1207 trySatisfyFunctional(PacketPtr other) 1208 { 1209 // all packets that are carrying a payload should have a valid 1210 // data pointer 1211 return trySatisfyFunctional(other, other->getAddr(), other->isSecure(), 1212 other->getSize(), 1213 other->hasData() ? 1214 other->getPtr<uint8_t>() : NULL); 1215 } 1216 1217 /** 1218 * Does the request need to check for cached copies of the same block 1219 * in the memory hierarchy above. 1220 **/ 1221 bool 1222 mustCheckAbove() const 1223 { 1224 return cmd == MemCmd::HardPFReq || isEviction(); 1225 } 1226 1227 /** 1228 * Is this packet a clean eviction, including both actual clean 1229 * evict packets, but also clean writebacks. 1230 */ 1231 bool 1232 isCleanEviction() const 1233 { 1234 return cmd == MemCmd::CleanEvict || cmd == MemCmd::WritebackClean; 1235 } 1236 1237 /** 1238 * Check a functional request against a memory value represented 1239 * by a base/size pair and an associated data array. If the 1240 * current packet is a read, it may be satisfied by the memory 1241 * value. If the current packet is a write, it may update the 1242 * memory value. 1243 */ 1244 bool 1245 trySatisfyFunctional(Printable *obj, Addr base, bool is_secure, int size, 1246 uint8_t *_data); 1247 1248 /** 1249 * Push label for PrintReq (safe to call unconditionally). 1250 */ 1251 void 1252 pushLabel(const std::string &lbl) 1253 { 1254 if (isPrint()) 1255 safe_cast<PrintReqState*>(senderState)->pushLabel(lbl); 1256 } 1257 1258 /** 1259 * Pop label for PrintReq (safe to call unconditionally). 1260 */ 1261 void 1262 popLabel() 1263 { 1264 if (isPrint()) 1265 safe_cast<PrintReqState*>(senderState)->popLabel(); 1266 } 1267 1268 void print(std::ostream &o, int verbosity = 0, 1269 const std::string &prefix = "") const; 1270 1271 /** 1272 * A no-args wrapper of print(std::ostream...) 1273 * meant to be invoked from DPRINTFs 1274 * avoiding string overheads in fast mode 1275 * @return string with the request's type and start<->end addresses 1276 */ 1277 std::string print() const; 1278}; 1279 1280#endif //__MEM_PACKET_HH 1281