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; --- 77 unchanged lines hidden (view full) --- 86 87 /** Device address (e.g., bus ID) of the destination of the 88 * transaction. The special value Broadcast indicates that the 89 * packet should be routed based on its address. This field is 90 * initialized in the constructor and is thus always valid 91 * (unlike * addr, size, and src). */ 92 short dest; 93 |
94 /** Are the 'addr' and 'size' fields valid? */ 95 bool addrSizeValid; |
96 /** Is the 'src' field valid? */ 97 bool srcValid; 98 99 public: 100 101 /** The special destination address indicating that the packet 102 * should be routed based on its address. */ 103 static const short Broadcast = -1; --- 81 unchanged lines hidden (view full) --- 185 short getSrc() const { assert(srcValid); return src; } 186 void setSrc(short _src) { src = _src; srcValid = true; } 187 188 /** Accessor function that returns the destination index of 189 the packet. */ 190 short getDest() const { return dest; } 191 void setDest(short _dest) { dest = _dest; } 192 |
193 Addr getAddr() const { assert(addrSizeValid); return addr; } 194 int getSize() const { assert(addrSizeValid); return size; } |
195 |
196 /** Constructor. Note that a Request object must be constructed 197 * first, but the Requests's physical address and size fields 198 * need not be valid. The command and destination addresses 199 * must be supplied. */ 200 Packet(Request *_req, Command _cmd, short _dest) 201 : data(NULL), staticData(false), dynamicData(false), arrayData(false), 202 addr(_req->paddr), size(_req->size), dest(_dest), |
203 addrSizeValid(_req->validPaddr), |
204 srcValid(false), 205 req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 206 result(Unknown) 207 { 208 } 209 210 /** Destructor. */ 211 ~Packet() 212 { deleteData(); } 213 214 /** Reinitialize packet address and size from the associated 215 * Request object, and reset other fields that may have been 216 * modified by a previous transaction. Typically called when a 217 * statically allocated Request/Packet pair is reused for 218 * multiple transactions. */ 219 void reinitFromRequest() { 220 assert(req->validPaddr); |
221 addr = req->paddr; 222 size = req->size; 223 addrSizeValid = true; |
224 result = Unknown; 225 if (dynamicData) { 226 deleteData(); 227 dynamicData = false; 228 arrayData = false; 229 } 230 } 231 --- 54 unchanged lines hidden --- |