packet.hh (6102:7fbf97dc6540) packet.hh (6104:ca0915f8d86d)
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;

--- 448 unchanged lines hidden (view full) ---

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),
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;

--- 448 unchanged lines hidden (view full) ---

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)
465 dest(_dest), time(curTick), senderState(NULL)
467 {
466 {
468 if (req->flags.isSet(Request::VALID_PADDR))
469 flags.set(VALID_ADDR|VALID_SIZE);
467 if (req->hasPaddr()) {
468 addr = req->getPaddr();
469 flags.set(VALID_ADDR);
470 }
471 if (req->hasSize()) {
472 size = req->getSize();
473 flags.set(VALID_SIZE);
474 }
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),
475 }
476
477 /**
478 * Alternate constructor if you are trying to create a packet with
479 * a request that is for a whole block, not the address from the
480 * req. this allows for overriding the size/addr of the req.
481 */
482 Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize)
483 : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL),
479 addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest),
480 time(curTick), senderState(NULL)
484 dest(_dest), time(curTick), senderState(NULL)
481 {
485 {
482 if (req->flags.isSet(Request::VALID_PADDR))
483 flags.set(VALID_ADDR|VALID_SIZE);
486 if (req->hasPaddr()) {
487 addr = req->getPaddr() & ~(_blkSize - 1);
488 flags.set(VALID_ADDR);
489 }
490 size = _blkSize;
491 flags.set(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.

--- 29 unchanged lines hidden (view full) ---

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 {
492 }
493
494 /**
495 * Alternate constructor for copying a packet. Copy all fields
496 * *except* if the original packet's data was dynamic, don't copy
497 * that, as we can't guarantee that the new packet's lifetime is
498 * less than that of the original packet. In this case the new
499 * packet should allocate its own data.

--- 29 unchanged lines hidden (view full) ---

529 * Request object, and reset other fields that may have been
530 * modified by a previous transaction. Typically called when a
531 * statically allocated Request/Packet pair is reused for multiple
532 * transactions.
533 */
534 void
535 reinitFromRequest()
536 {
529 assert(req->flags.isSet(Request::VALID_PADDR));
537 assert(req->hasPaddr());
530 flags = 0;
538 flags = 0;
531 addr = req->paddr;
532 size = req->size;
533 time = req->time;
539 addr = req->getPaddr();
540 size = req->getSize();
541 time = req->getTime();
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

--- 220 unchanged lines hidden ---
542
543 flags.set(VALID_ADDR|VALID_SIZE);
544 deleteData();
545 }
546
547 /**
548 * Take a request packet and modify it in place to be suitable for
549 * returning as a response to that request. The source and

--- 220 unchanged lines hidden ---