packet.hh (2662:f24ae2d09e27) packet.hh (2663:c82193ae8467)
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
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 /** Is the 'addr' field valid? */
95 bool addrValid;
96 /** Is the 'size' field valid? */
97 bool sizeValid;
94 /** Are the 'addr' and 'size' fields valid? */
95 bool addrSizeValid;
98 /** Is the 'src' field valid? */
99 bool srcValid;
100
101 public:
102
103 /** The special destination address indicating that the packet
104 * should be routed based on its address. */
105 static const short Broadcast = -1;

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

187 short getSrc() const { assert(srcValid); return src; }
188 void setSrc(short _src) { src = _src; srcValid = true; }
189
190 /** Accessor function that returns the destination index of
191 the packet. */
192 short getDest() const { return dest; }
193 void setDest(short _dest) { dest = _dest; }
194
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
195 Addr getAddr() const { assert(addrValid); return addr; }
196 void setAddr(Addr _addr) { addr = _addr; addrValid = true; }
193 Addr getAddr() const { assert(addrSizeValid); return addr; }
194 int getSize() const { assert(addrSizeValid); return size; }
197
195
198 int getSize() const { assert(sizeValid); return size; }
199 void setSize(int _size) { size = _size; sizeValid = true; }
200
201 /** Constructor. Note that a Request object must be constructed
202 * first, but the Requests's physical address and size fields
203 * need not be valid. The command and destination addresses
204 * must be supplied. */
205 Packet(Request *_req, Command _cmd, short _dest)
206 : data(NULL), staticData(false), dynamicData(false), arrayData(false),
207 addr(_req->paddr), size(_req->size), dest(_dest),
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),
208 addrValid(_req->validPaddr), sizeValid(_req->validSize),
203 addrSizeValid(_req->validPaddr),
209 srcValid(false),
210 req(_req), coherence(NULL), senderState(NULL), cmd(_cmd),
211 result(Unknown)
212 {
213 }
214
215 /** Destructor. */
216 ~Packet()
217 { deleteData(); }
218
219 /** Reinitialize packet address and size from the associated
220 * Request object, and reset other fields that may have been
221 * modified by a previous transaction. Typically called when a
222 * statically allocated Request/Packet pair is reused for
223 * multiple transactions. */
224 void reinitFromRequest() {
225 assert(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);
226 setAddr(req->paddr);
227 assert(req->validSize);
228 setSize(req->size);
221 addr = req->paddr;
222 size = req->size;
223 addrSizeValid = true;
229 result = Unknown;
230 if (dynamicData) {
231 deleteData();
232 dynamicData = false;
233 arrayData = false;
234 }
235 }
236

--- 54 unchanged lines hidden ---
224 result = Unknown;
225 if (dynamicData) {
226 deleteData();
227 dynamicData = false;
228 arrayData = false;
229 }
230 }
231

--- 54 unchanged lines hidden ---