packet.hh (8737:770ccf3af571) | packet.hh (8949:3fa1ee293096) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * |
|
2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * Copyright (c) 2010 Advanced Micro Devices, Inc. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer; --- 302 unchanged lines hidden (view full) --- 312 Tick time; 313 314 /// The time at which the packet will be fully transmitted 315 Tick finishTime; 316 317 /// The time at which the first chunk of the packet will be transmitted 318 Tick firstWordTime; 319 | 14 * Copyright (c) 2006 The Regents of The University of Michigan 15 * Copyright (c) 2010 Advanced Micro Devices, Inc. 16 * All rights reserved. 17 * 18 * Redistribution and use in source and binary forms, with or without 19 * modification, are permitted provided that the following conditions are 20 * met: redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer; --- 302 unchanged lines hidden (view full) --- 324 Tick time; 325 326 /// The time at which the packet will be fully transmitted 327 Tick finishTime; 328 329 /// The time at which the first chunk of the packet will be transmitted 330 Tick firstWordTime; 331 |
320 /// The special destination address indicating that the packet 321 /// should be routed based on its address. 322 static const NodeID Broadcast = -1; 323 | |
324 /** 325 * A virtual base opaque structure used to hold state associated 326 * with the packet but specific to the sending device (e.g., an 327 * MSHR). A pointer to this state is returned in the packet's 328 * response so that the sender can quickly look up the state 329 * needed to process it. A specific subclass would be derived 330 * from this to carry state specific to a particular sending 331 * device. --- 141 unchanged lines hidden (view full) --- 473 /// Reset source field, e.g. to retransmit packet on different bus. 474 void clearSrc() { flags.clear(VALID_SRC); } 475 476 bool isDestValid() { return flags.isSet(VALID_DST); } 477 /// Accessor function for the destination index of the packet. 478 NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; } 479 /// Accessor function to set the destination index of the packet. 480 void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); } | 332 /** 333 * A virtual base opaque structure used to hold state associated 334 * with the packet but specific to the sending device (e.g., an 335 * MSHR). A pointer to this state is returned in the packet's 336 * response so that the sender can quickly look up the state 337 * needed to process it. A specific subclass would be derived 338 * from this to carry state specific to a particular sending 339 * device. --- 141 unchanged lines hidden (view full) --- 481 /// Reset source field, e.g. to retransmit packet on different bus. 482 void clearSrc() { flags.clear(VALID_SRC); } 483 484 bool isDestValid() { return flags.isSet(VALID_DST); } 485 /// Accessor function for the destination index of the packet. 486 NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; } 487 /// Accessor function to set the destination index of the packet. 488 void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); } |
489 /// Reset destination field, e.g. to turn a response into a request again. 490 void clearDest() { flags.clear(VALID_DST); } |
|
481 482 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 483 unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } 484 Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); } 485 486 /** 487 * It has been determined that the SC packet should successfully update 488 * memory. Therefore, convert this SC packet to a normal write. --- 19 unchanged lines hidden (view full) --- 508 } 509 510 /** 511 * Constructor. Note that a Request object must be constructed 512 * first, but the Requests's physical address and size fields need 513 * not be valid. The command and destination addresses must be 514 * supplied. 515 */ | 491 492 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 493 unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } 494 Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); } 495 496 /** 497 * It has been determined that the SC packet should successfully update 498 * memory. Therefore, convert this SC packet to a normal write. --- 19 unchanged lines hidden (view full) --- 518 } 519 520 /** 521 * Constructor. Note that a Request object must be constructed 522 * first, but the Requests's physical address and size fields need 523 * not be valid. The command and destination addresses must be 524 * supplied. 525 */ |
516 Packet(Request *_req, MemCmd _cmd, NodeID _dest) 517 : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 518 dest(_dest), bytesValidStart(0), bytesValidEnd(0), | 526 Packet(Request *_req, MemCmd _cmd) 527 : cmd(_cmd), req(_req), data(NULL), 528 bytesValidStart(0), bytesValidEnd(0), |
519 time(curTick()), senderState(NULL) 520 { 521 if (req->hasPaddr()) { 522 addr = req->getPaddr(); 523 flags.set(VALID_ADDR); 524 } 525 if (req->hasSize()) { 526 size = req->getSize(); 527 flags.set(VALID_SIZE); 528 } 529 } 530 531 /** 532 * Alternate constructor if you are trying to create a packet with 533 * a request that is for a whole block, not the address from the 534 * req. this allows for overriding the size/addr of the req. 535 */ | 529 time(curTick()), senderState(NULL) 530 { 531 if (req->hasPaddr()) { 532 addr = req->getPaddr(); 533 flags.set(VALID_ADDR); 534 } 535 if (req->hasSize()) { 536 size = req->getSize(); 537 flags.set(VALID_SIZE); 538 } 539 } 540 541 /** 542 * Alternate constructor if you are trying to create a packet with 543 * a request that is for a whole block, not the address from the 544 * req. this allows for overriding the size/addr of the req. 545 */ |
536 Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize) 537 : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL), 538 dest(_dest), bytesValidStart(0), bytesValidEnd(0), | 546 Packet(Request *_req, MemCmd _cmd, int _blkSize) 547 : cmd(_cmd), req(_req), data(NULL), 548 bytesValidStart(0), bytesValidEnd(0), |
539 time(curTick()), senderState(NULL) 540 { 541 if (req->hasPaddr()) { 542 addr = req->getPaddr() & ~(_blkSize - 1); 543 flags.set(VALID_ADDR); 544 } 545 size = _blkSize; 546 flags.set(VALID_SIZE); --- 107 unchanged lines hidden (view full) --- 654 * need a response can be NACKED, so verify that that is true. 655 */ 656 void 657 reinitNacked() 658 { 659 assert(wasNacked()); 660 cmd = origCmd; 661 assert(needsResponse()); | 549 time(curTick()), senderState(NULL) 550 { 551 if (req->hasPaddr()) { 552 addr = req->getPaddr() & ~(_blkSize - 1); 553 flags.set(VALID_ADDR); 554 } 555 size = _blkSize; 556 flags.set(VALID_SIZE); --- 107 unchanged lines hidden (view full) --- 664 * need a response can be NACKED, so verify that that is true. 665 */ 666 void 667 reinitNacked() 668 { 669 assert(wasNacked()); 670 cmd = origCmd; 671 assert(needsResponse()); |
662 setDest(Broadcast); | 672 clearDest(); |
663 } 664 665 void 666 setSize(unsigned size) 667 { 668 assert(!flags.isSet(VALID_SIZE)); 669 670 this->size = size; --- 181 unchanged lines hidden --- | 673 } 674 675 void 676 setSize(unsigned size) 677 { 678 assert(!flags.isSet(VALID_SIZE)); 679 680 this->size = size; --- 181 unchanged lines hidden --- |