Deleted Added
sdiff udiff text old ( 5735:a88e8e7dec75 ) new ( 5745:6b0f8306704b )
full compact
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;

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

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 : cmd(_cmd), req(_req), data(NULL), addr(_req->paddr),
465 size(_req->size), dest(_dest), time(curTick), senderState(NULL)
466 {
467 }
468
469 /**
470 * Alternate constructor if you are trying to create a packet with
471 * a request that is for a whole block, not the address from the
472 * req. this allows for overriding the size/addr of the req.
473 */
474 Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize)
475 : cmd(_cmd), req(_req), data(NULL),
476 addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest),
477 time(curTick), senderState(NULL)
478 {
479 }
480
481 /**
482 * Alternate constructor for copying a packet. Copy all fields
483 * *except* if the original packet's data was dynamic, don't copy
484 * that, as we can't guarantee that the new packet's lifetime is
485 * less than that of the original packet. In this case the new
486 * packet should allocate its own data.

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

539 */
540 void
541 makeResponse()
542 {
543 assert(needsResponse());
544 assert(isRequest());
545 origCmd = cmd;
546 cmd = cmd.responseCommand();
547 if (flags.any(VALID_SRC)) {
548 dest = src;
549 flags.set(VALID_DST);
550 flags.clear(VALID_SRC);
551 } else {
552 flags.clear(VALID_DST);
553 }
554 }
555
556 void
557 makeAtomicResponse()
558 {
559 makeResponse();
560 }
561

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

685 * matter how data was allocted.
686 */
687 void
688 deleteData()
689 {
690 if (flags.any(ARRAY_DATA))
691 delete [] data;
692 else if (flags.any(DYNAMIC_DATA))
693
694 delete data;
695
696 flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA);
697 data = NULL;
698 }
699
700 /** If there isn't data in the packet, allocate some. */
701 void
702 allocate()
703 {
704 if (data) {
705 assert(flags.none(STATIC_DATA|DYNAMIC_DATA));
706 } else {
707 flags.set(DYNAMIC_DATA|ARRAY_DATA);
708 data = new uint8_t[getSize()];
709 }
710 }
711
712
713 /**
714 * Check a functional request against a memory value represented
715 * by a base/size pair and an associated data array. If the
716 * functional request is a read, it may be satisfied by the memory
717 * value. If the functional request is a write, it may update the

--- 41 unchanged lines hidden ---