packet.hh revision 6102:7fbf97dc6540
1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Ron Dreslinski 29 * Steve Reinhardt 30 * Ali Saidi 31 */ 32 33/** 34 * @file 35 * Declaration of the Packet class. 36 */ 37 38#ifndef __MEM_PACKET_HH__ 39#define __MEM_PACKET_HH__ 40 41#include <cassert> 42#include <list> 43#include <bitset> 44 45#include "base/cast.hh" 46#include "base/compiler.hh" 47#include "base/fast_alloc.hh" 48#include "base/flags.hh" 49#include "base/misc.hh" 50#include "base/printable.hh" 51#include "mem/request.hh" 52#include "sim/host.hh" 53#include "sim/core.hh" 54 55 56struct Packet; 57typedef Packet *PacketPtr; 58typedef uint8_t* PacketDataPtr; 59typedef std::list<PacketPtr> PacketList; 60 61class MemCmd 62{ 63 friend class Packet; 64 65 public: 66 /** 67 * List of all commands associated with a packet. 68 */ 69 enum Command 70 { 71 InvalidCmd, 72 ReadReq, 73 ReadResp, 74 ReadRespWithInvalidate, 75 WriteReq, 76 WriteResp, 77 Writeback, 78 SoftPFReq, 79 HardPFReq, 80 SoftPFResp, 81 HardPFResp, 82 WriteInvalidateReq, 83 WriteInvalidateResp, 84 UpgradeReq, 85 UpgradeResp, 86 ReadExReq, 87 ReadExResp, 88 LoadLockedReq, 89 StoreCondReq, 90 StoreCondResp, 91 SwapReq, 92 SwapResp, 93 MessageReq, 94 MessageResp, 95 // Error responses 96 // @TODO these should be classified as responses rather than 97 // requests; coding them as requests initially for backwards 98 // compatibility 99 NetworkNackError, // nacked at network layer (not by protocol) 100 InvalidDestError, // packet dest field invalid 101 BadAddressError, // memory address invalid 102 // Fake simulator-only commands 103 PrintReq, // Print state matching address 104 NUM_MEM_CMDS 105 }; 106 107 private: 108 /** 109 * List of command attributes. 110 */ 111 enum Attribute 112 { 113 IsRead, //!< Data flows from responder to requester 114 IsWrite, //!< Data flows from requester to responder 115 IsPrefetch, //!< Not a demand access 116 IsInvalidate, 117 NeedsExclusive, //!< Requires exclusive copy to complete in-cache 118 IsRequest, //!< Issued by requester 119 IsResponse, //!< Issue by responder 120 NeedsResponse, //!< Requester needs response from target 121 IsSWPrefetch, 122 IsHWPrefetch, 123 IsLlsc, //!< Alpha/MIPS LL or SC access 124 HasData, //!< There is an associated payload 125 IsError, //!< Error response 126 IsPrint, //!< Print state matching address (for debugging) 127 NUM_COMMAND_ATTRIBUTES 128 }; 129 130 /** 131 * Structure that defines attributes and other data associated 132 * with a Command. 133 */ 134 struct CommandInfo 135 { 136 /// Set of attribute flags. 137 const std::bitset<NUM_COMMAND_ATTRIBUTES> attributes; 138 /// Corresponding response for requests; InvalidCmd if no 139 /// response is applicable. 140 const Command response; 141 /// String representation (for printing) 142 const std::string str; 143 }; 144 145 /// Array to map Command enum to associated info. 146 static const CommandInfo commandInfo[]; 147 148 private: 149 150 Command cmd; 151 152 bool 153 testCmdAttrib(MemCmd::Attribute attrib) const 154 { 155 return commandInfo[cmd].attributes[attrib] != 0; 156 } 157 158 public: 159 160 bool isRead() const { return testCmdAttrib(IsRead); } 161 bool isWrite() const { return testCmdAttrib(IsWrite); } 162 bool isRequest() const { return testCmdAttrib(IsRequest); } 163 bool isResponse() const { return testCmdAttrib(IsResponse); } 164 bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); } 165 bool needsResponse() const { return testCmdAttrib(NeedsResponse); } 166 bool isInvalidate() const { return testCmdAttrib(IsInvalidate); } 167 bool hasData() const { return testCmdAttrib(HasData); } 168 bool isReadWrite() const { return isRead() && isWrite(); } 169 bool isLLSC() const { return testCmdAttrib(IsLlsc); } 170 bool isError() const { return testCmdAttrib(IsError); } 171 bool isPrint() const { return testCmdAttrib(IsPrint); } 172 173 const Command 174 responseCommand() const 175 { 176 return commandInfo[cmd].response; 177 } 178 179 /// Return the string to a cmd given by idx. 180 const std::string &toString() const { return commandInfo[cmd].str; } 181 int toInt() const { return (int)cmd; } 182 183 MemCmd(Command _cmd) : cmd(_cmd) { } 184 MemCmd(int _cmd) : cmd((Command)_cmd) { } 185 MemCmd() : cmd(InvalidCmd) { } 186 187 bool operator==(MemCmd c2) const { return (cmd == c2.cmd); } 188 bool operator!=(MemCmd c2) const { return (cmd != c2.cmd); } 189}; 190 191/** 192 * A Packet is used to encapsulate a transfer between two objects in 193 * the memory system (e.g., the L1 and L2 cache). (In contrast, a 194 * single Request travels all the way from the requester to the 195 * ultimate destination and back, possibly being conveyed by several 196 * different Packets along the way.) 197 */ 198class Packet : public FastAlloc, public Printable 199{ 200 public: 201 typedef uint32_t FlagsType; 202 typedef ::Flags<FlagsType> Flags; 203 typedef short NodeID; 204 205 private: 206 static const FlagsType PUBLIC_FLAGS = 0x00000000; 207 static const FlagsType PRIVATE_FLAGS = 0x00007F0F; 208 static const FlagsType COPY_FLAGS = 0x0000000F; 209 210 static const FlagsType SHARED = 0x00000001; 211 // Special control flags 212 /// Special timing-mode atomic snoop for multi-level coherence. 213 static const FlagsType EXPRESS_SNOOP = 0x00000002; 214 /// Does supplier have exclusive copy? 215 /// Useful for multi-level coherence. 216 static const FlagsType SUPPLY_EXCLUSIVE = 0x00000004; 217 // Snoop response flags 218 static const FlagsType MEM_INHIBIT = 0x00000008; 219 /// Are the 'addr' and 'size' fields valid? 220 static const FlagsType VALID_ADDR = 0x00000100; 221 static const FlagsType VALID_SIZE = 0x00000200; 222 /// Is the 'src' field valid? 223 static const FlagsType VALID_SRC = 0x00000400; 224 static const FlagsType VALID_DST = 0x00000800; 225 /// Is the data pointer set to a value that shouldn't be freed 226 /// when the packet is destroyed? 227 static const FlagsType STATIC_DATA = 0x00001000; 228 /// The data pointer points to a value that should be freed when 229 /// the packet is destroyed. 230 static const FlagsType DYNAMIC_DATA = 0x00002000; 231 /// the data pointer points to an array (thus delete []) needs to 232 /// be called on it rather than simply delete. 233 static const FlagsType ARRAY_DATA = 0x00004000; 234 235 Flags flags; 236 237 public: 238 typedef MemCmd::Command Command; 239 240 /// The command field of the packet. 241 MemCmd cmd; 242 243 /// A pointer to the original request. 244 RequestPtr req; 245 246 private: 247 /** 248 * A pointer to the data being transfered. It can be differnt 249 * sizes at each level of the heirarchy so it belongs in the 250 * packet, not request. This may or may not be populated when a 251 * responder recieves the packet. If not populated it memory should 252 * be allocated. 253 */ 254 PacketDataPtr data; 255 256 /// The address of the request. This address could be virtual or 257 /// physical, depending on the system configuration. 258 Addr addr; 259 260 /// The size of the request or transfer. 261 int size; 262 263 /** 264 * Device address (e.g., bus ID) of the source of the 265 * transaction. The source is not responsible for setting this 266 * field; it is set implicitly by the interconnect when the packet 267 * is first sent. 268 */ 269 NodeID src; 270 271 /** 272 * Device address (e.g., bus ID) of the destination of the 273 * transaction. The special value Broadcast indicates that the 274 * packet should be routed based on its address. This field is 275 * initialized in the constructor and is thus always valid (unlike 276 * addr, size, and src). 277 */ 278 NodeID dest; 279 280 /** 281 * The original value of the command field. Only valid when the 282 * current command field is an error condition; in that case, the 283 * previous contents of the command field are copied here. This 284 * field is *not* set on non-error responses. 285 */ 286 MemCmd origCmd; 287 288 public: 289 /// Used to calculate latencies for each packet. 290 Tick time; 291 292 /// The time at which the packet will be fully transmitted 293 Tick finishTime; 294 295 /// The time at which the first chunk of the packet will be transmitted 296 Tick firstWordTime; 297 298 /// The special destination address indicating that the packet 299 /// should be routed based on its address. 300 static const NodeID Broadcast = -1; 301 302 /** 303 * A virtual base opaque structure used to hold state associated 304 * with the packet but specific to the sending device (e.g., an 305 * MSHR). A pointer to this state is returned in the packet's 306 * response so that the sender can quickly look up the state 307 * needed to process it. A specific subclass would be derived 308 * from this to carry state specific to a particular sending 309 * device. 310 */ 311 struct SenderState 312 { 313 virtual ~SenderState() {} 314 }; 315 316 /** 317 * Object used to maintain state of a PrintReq. The senderState 318 * field of a PrintReq should always be of this type. 319 */ 320 class PrintReqState : public SenderState, public FastAlloc 321 { 322 private: 323 /** 324 * An entry in the label stack. 325 */ 326 struct LabelStackEntry 327 { 328 const std::string label; 329 std::string *prefix; 330 bool labelPrinted; 331 LabelStackEntry(const std::string &_label, std::string *_prefix); 332 }; 333 334 typedef std::list<LabelStackEntry> LabelStack; 335 LabelStack labelStack; 336 337 std::string *curPrefixPtr; 338 339 public: 340 std::ostream &os; 341 const int verbosity; 342 343 PrintReqState(std::ostream &os, int verbosity = 0); 344 ~PrintReqState(); 345 346 /** 347 * Returns the current line prefix. 348 */ 349 const std::string &curPrefix() { return *curPrefixPtr; } 350 351 /** 352 * Push a label onto the label stack, and prepend the given 353 * prefix string onto the current prefix. Labels will only be 354 * printed if an object within the label's scope is printed. 355 */ 356 void pushLabel(const std::string &lbl, 357 const std::string &prefix = " "); 358 359 /** 360 * Pop a label off the label stack. 361 */ 362 void popLabel(); 363 364 /** 365 * Print all of the pending unprinted labels on the 366 * stack. Called by printObj(), so normally not called by 367 * users unless bypassing printObj(). 368 */ 369 void printLabels(); 370 371 /** 372 * Print a Printable object to os, because it matched the 373 * address on a PrintReq. 374 */ 375 void printObj(Printable *obj); 376 }; 377 378 /** 379 * This packet's sender state. Devices should use dynamic_cast<> 380 * to cast to the state appropriate to the sender. The intent of 381 * this variable is to allow a device to attach extra information 382 * to a request. A response packet must return the sender state 383 * that was attached to the original request (even if a new packet 384 * is created). 385 */ 386 SenderState *senderState; 387 388 /// Return the string name of the cmd field (for debugging and 389 /// tracing). 390 const std::string &cmdString() const { return cmd.toString(); } 391 392 /// Return the index of this command. 393 inline int cmdToIndex() const { return cmd.toInt(); } 394 395 bool isRead() const { return cmd.isRead(); } 396 bool isWrite() const { return cmd.isWrite(); } 397 bool isRequest() const { return cmd.isRequest(); } 398 bool isResponse() const { return cmd.isResponse(); } 399 bool needsExclusive() const { return cmd.needsExclusive(); } 400 bool needsResponse() const { return cmd.needsResponse(); } 401 bool isInvalidate() const { return cmd.isInvalidate(); } 402 bool hasData() const { return cmd.hasData(); } 403 bool isReadWrite() const { return cmd.isReadWrite(); } 404 bool isLLSC() const { return cmd.isLLSC(); } 405 bool isError() const { return cmd.isError(); } 406 bool isPrint() const { return cmd.isPrint(); } 407 408 // Snoop flags 409 void assertMemInhibit() { flags.set(MEM_INHIBIT); } 410 bool memInhibitAsserted() { return flags.isSet(MEM_INHIBIT); } 411 void assertShared() { flags.set(SHARED); } 412 bool sharedAsserted() { return flags.isSet(SHARED); } 413 414 // Special control flags 415 void setExpressSnoop() { flags.set(EXPRESS_SNOOP); } 416 bool isExpressSnoop() { return flags.isSet(EXPRESS_SNOOP); } 417 void setSupplyExclusive() { flags.set(SUPPLY_EXCLUSIVE); } 418 bool isSupplyExclusive() { return flags.isSet(SUPPLY_EXCLUSIVE); } 419 420 // Network error conditions... encapsulate them as methods since 421 // their encoding keeps changing (from result field to command 422 // field, etc.) 423 void 424 setNacked() 425 { 426 assert(isResponse()); 427 cmd = MemCmd::NetworkNackError; 428 } 429 430 void 431 setBadAddress() 432 { 433 assert(isResponse()); 434 cmd = MemCmd::BadAddressError; 435 } 436 437 bool wasNacked() const { return cmd == MemCmd::NetworkNackError; } 438 bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; } 439 void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } 440 441 /// Accessor function to get the source index of the packet. 442 NodeID getSrc() const { assert(flags.isSet(VALID_SRC)); return src; } 443 /// Accessor function to set the source index of the packet. 444 void setSrc(NodeID _src) { src = _src; flags.set(VALID_SRC); } 445 /// Reset source field, e.g. to retransmit packet on different bus. 446 void clearSrc() { flags.clear(VALID_SRC); } 447 448 /// Accessor function for the destination index of the packet. 449 NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; } 450 /// Accessor function to set the destination index of the packet. 451 void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); } 452 453 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 454 int getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } 455 Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); } 456 457 /** 458 * Constructor. Note that a Request object must be constructed 459 * first, but the Requests's physical address and size fields need 460 * not be valid. The command and destination addresses must be 461 * supplied. 462 */ 463 Packet(Request *_req, MemCmd _cmd, NodeID _dest) 464 : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 465 addr(_req->paddr), size(_req->size), dest(_dest), time(curTick), 466 senderState(NULL) 467 { 468 if (req->flags.isSet(Request::VALID_PADDR)) 469 flags.set(VALID_ADDR|VALID_SIZE); 470 } 471 472 /** 473 * Alternate constructor if you are trying to create a packet with 474 * a request that is for a whole block, not the address from the 475 * req. this allows for overriding the size/addr of the req. 476 */ 477 Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize) 478 : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 479 addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest), 480 time(curTick), senderState(NULL) 481 { 482 if (req->flags.isSet(Request::VALID_PADDR)) 483 flags.set(VALID_ADDR|VALID_SIZE); 484 } 485 486 /** 487 * Alternate constructor for copying a packet. Copy all fields 488 * *except* if the original packet's data was dynamic, don't copy 489 * that, as we can't guarantee that the new packet's lifetime is 490 * less than that of the original packet. In this case the new 491 * packet should allocate its own data. 492 */ 493 Packet(Packet *pkt, bool clearFlags = false) 494 : cmd(pkt->cmd), req(pkt->req), 495 data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL), 496 addr(pkt->addr), size(pkt->size), src(pkt->src), dest(pkt->dest), 497 time(curTick), senderState(pkt->senderState) 498 { 499 if (!clearFlags) 500 flags.set(pkt->flags & COPY_FLAGS); 501 502 flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE|VALID_SRC|VALID_DST)); 503 flags.set(pkt->flags & STATIC_DATA); 504 } 505 506 /** 507 * clean up packet variables 508 */ 509 ~Packet() 510 { 511 // If this is a request packet for which there's no response, 512 // delete the request object here, since the requester will 513 // never get the chance. 514 if (req && isRequest() && !needsResponse()) 515 delete req; 516 deleteData(); 517 } 518 519 /** 520 * Reinitialize packet address and size from the associated 521 * Request object, and reset other fields that may have been 522 * modified by a previous transaction. Typically called when a 523 * statically allocated Request/Packet pair is reused for multiple 524 * transactions. 525 */ 526 void 527 reinitFromRequest() 528 { 529 assert(req->flags.isSet(Request::VALID_PADDR)); 530 flags = 0; 531 addr = req->paddr; 532 size = req->size; 533 time = req->time; 534 535 flags.set(VALID_ADDR|VALID_SIZE); 536 deleteData(); 537 } 538 539 /** 540 * Take a request packet and modify it in place to be suitable for 541 * returning as a response to that request. The source and 542 * destination fields are *not* modified, as is appropriate for 543 * atomic accesses. 544 */ 545 void 546 makeResponse() 547 { 548 assert(needsResponse()); 549 assert(isRequest()); 550 origCmd = cmd; 551 cmd = cmd.responseCommand(); 552 553 dest = src; 554 flags.set(VALID_DST, flags.isSet(VALID_SRC)); 555 flags.clear(VALID_SRC); 556 } 557 558 void 559 makeAtomicResponse() 560 { 561 makeResponse(); 562 } 563 564 void 565 makeTimingResponse() 566 { 567 makeResponse(); 568 } 569 570 /** 571 * Take a request packet that has been returned as NACKED and 572 * modify it so that it can be sent out again. Only packets that 573 * need a response can be NACKED, so verify that that is true. 574 */ 575 void 576 reinitNacked() 577 { 578 assert(wasNacked()); 579 cmd = origCmd; 580 assert(needsResponse()); 581 setDest(Broadcast); 582 } 583 584 585 /** 586 * Set the data pointer to the following value that should not be 587 * freed. 588 */ 589 template <typename T> 590 void 591 dataStatic(T *p) 592 { 593 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 594 data = (PacketDataPtr)p; 595 flags.set(STATIC_DATA); 596 } 597 598 /** 599 * Set the data pointer to a value that should have delete [] 600 * called on it. 601 */ 602 template <typename T> 603 void 604 dataDynamicArray(T *p) 605 { 606 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 607 data = (PacketDataPtr)p; 608 flags.set(DYNAMIC_DATA|ARRAY_DATA); 609 } 610 611 /** 612 * set the data pointer to a value that should have delete called 613 * on it. 614 */ 615 template <typename T> 616 void 617 dataDynamic(T *p) 618 { 619 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA)); 620 data = (PacketDataPtr)p; 621 flags.set(DYNAMIC_DATA); 622 } 623 624 /** 625 * get a pointer to the data ptr. 626 */ 627 template <typename T> 628 T* 629 getPtr() 630 { 631 assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 632 return (T*)data; 633 } 634 635 /** 636 * return the value of what is pointed to in the packet. 637 */ 638 template <typename T> 639 T get(); 640 641 /** 642 * set the value in the data pointer to v. 643 */ 644 template <typename T> 645 void set(T v); 646 647 /** 648 * Copy data into the packet from the provided pointer. 649 */ 650 void 651 setData(uint8_t *p) 652 { 653 std::memcpy(getPtr<uint8_t>(), p, getSize()); 654 } 655 656 /** 657 * Copy data into the packet from the provided block pointer, 658 * which is aligned to the given block size. 659 */ 660 void 661 setDataFromBlock(uint8_t *blk_data, int blkSize) 662 { 663 setData(blk_data + getOffset(blkSize)); 664 } 665 666 /** 667 * Copy data from the packet to the provided block pointer, which 668 * is aligned to the given block size. 669 */ 670 void 671 writeData(uint8_t *p) 672 { 673 std::memcpy(p, getPtr<uint8_t>(), getSize()); 674 } 675 676 /** 677 * Copy data from the packet to the memory at the provided pointer. 678 */ 679 void 680 writeDataToBlock(uint8_t *blk_data, int blkSize) 681 { 682 writeData(blk_data + getOffset(blkSize)); 683 } 684 685 /** 686 * delete the data pointed to in the data pointer. Ok to call to 687 * matter how data was allocted. 688 */ 689 void 690 deleteData() 691 { 692 if (flags.isSet(ARRAY_DATA)) 693 delete [] data; 694 else if (flags.isSet(DYNAMIC_DATA)) 695 delete data; 696 697 flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA); 698 data = NULL; 699 } 700 701 /** If there isn't data in the packet, allocate some. */ 702 void 703 allocate() 704 { 705 if (data) { 706 assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 707 return; 708 } 709 710 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 711 flags.set(DYNAMIC_DATA|ARRAY_DATA); 712 data = new uint8_t[getSize()]; 713 } 714 715 716 /** 717 * Check a functional request against a memory value represented 718 * by a base/size pair and an associated data array. If the 719 * functional request is a read, it may be satisfied by the memory 720 * value. If the functional request is a write, it may update the 721 * memory value. 722 */ 723 bool checkFunctional(Printable *obj, Addr base, int size, uint8_t *data); 724 725 /** 726 * Check a functional request against a memory value stored in 727 * another packet (i.e. an in-transit request or response). 728 */ 729 bool 730 checkFunctional(PacketPtr other) 731 { 732 uint8_t *data = other->hasData() ? other->getPtr<uint8_t>() : NULL; 733 return checkFunctional(other, other->getAddr(), other->getSize(), 734 data); 735 } 736 737 /** 738 * Push label for PrintReq (safe to call unconditionally). 739 */ 740 void 741 pushLabel(const std::string &lbl) 742 { 743 if (isPrint()) 744 safe_cast<PrintReqState*>(senderState)->pushLabel(lbl); 745 } 746 747 /** 748 * Pop label for PrintReq (safe to call unconditionally). 749 */ 750 void 751 popLabel() 752 { 753 if (isPrint()) 754 safe_cast<PrintReqState*>(senderState)->popLabel(); 755 } 756 757 void print(std::ostream &o, int verbosity = 0, 758 const std::string &prefix = "") const; 759}; 760 761#endif //__MEM_PACKET_HH 762