packet.hh (4887:a784c507ea84) packet.hh (4895:d36959284fbc)
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;

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

247
248 /** Are the 'addr' and 'size' fields valid? */
249 bool addrSizeValid;
250 /** Is the 'src' field valid? */
251 bool srcValid;
252 bool destValid;
253
254 enum Flag {
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;

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

247
248 /** Are the 'addr' and 'size' fields valid? */
249 bool addrSizeValid;
250 /** Is the 'src' field valid? */
251 bool srcValid;
252 bool destValid;
253
254 enum Flag {
255 // Snoop flags
255 // Snoop response flags
256 MemInhibit,
257 Shared,
256 MemInhibit,
257 Shared,
258 // Special control flags
259 ExpressSnoop,
258 NUM_PACKET_FLAGS
259 };
260
261 /** Status flags */
262 std::bitset<NUM_PACKET_FLAGS> flags;
263
264 public:
265

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

312 bool isError() const { return cmd.isError(); }
313
314 // Snoop flags
315 void assertMemInhibit() { flags[MemInhibit] = true; }
316 void assertShared() { flags[Shared] = true; }
317 bool memInhibitAsserted() { return flags[MemInhibit]; }
318 bool sharedAsserted() { return flags[Shared]; }
319
260 NUM_PACKET_FLAGS
261 };
262
263 /** Status flags */
264 std::bitset<NUM_PACKET_FLAGS> flags;
265
266 public:
267

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

314 bool isError() const { return cmd.isError(); }
315
316 // Snoop flags
317 void assertMemInhibit() { flags[MemInhibit] = true; }
318 void assertShared() { flags[Shared] = true; }
319 bool memInhibitAsserted() { return flags[MemInhibit]; }
320 bool sharedAsserted() { return flags[Shared]; }
321
322 // Special control flags
323 void setExpressSnoop() { flags[ExpressSnoop] = true; }
324 bool isExpressSnoop() { return flags[ExpressSnoop]; }
325
320 // Network error conditions... encapsulate them as methods since
321 // their encoding keeps changing (from result field to command
322 // field, etc.)
323 void setNacked() { origCmd = cmd; cmd = MemCmd::NetworkNackError; }
324 void setBadAddress() { origCmd = cmd; cmd = MemCmd::BadAddressError; }
325 bool wasNacked() { return cmd == MemCmd::NetworkNackError; }
326 bool hadBadAddress() { return cmd == MemCmd::BadAddressError; }
327

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

367 {
368 }
369
370 /** Alternate constructor for copying a packet. Copy all fields
371 * *except* if the original packet's data was dynamic, don't copy
372 * that, as we can't guarantee that the new packet's lifetime is
373 * less than that of the original packet. In this case the new
374 * packet should allocate its own data. */
326 // Network error conditions... encapsulate them as methods since
327 // their encoding keeps changing (from result field to command
328 // field, etc.)
329 void setNacked() { origCmd = cmd; cmd = MemCmd::NetworkNackError; }
330 void setBadAddress() { origCmd = cmd; cmd = MemCmd::BadAddressError; }
331 bool wasNacked() { return cmd == MemCmd::NetworkNackError; }
332 bool hadBadAddress() { return cmd == MemCmd::BadAddressError; }
333

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

373 {
374 }
375
376 /** Alternate constructor for copying a packet. Copy all fields
377 * *except* if the original packet's data was dynamic, don't copy
378 * that, as we can't guarantee that the new packet's lifetime is
379 * less than that of the original packet. In this case the new
380 * packet should allocate its own data. */
375 Packet(Packet *origPkt)
381 Packet(Packet *origPkt, bool clearFlags = false)
376 : cmd(origPkt->cmd), req(origPkt->req),
377 data(origPkt->staticData ? origPkt->data : NULL),
378 staticData(origPkt->staticData),
379 dynamicData(false), arrayData(false),
380 addr(origPkt->addr), size(origPkt->size),
381 src(origPkt->src), dest(origPkt->dest),
382 addrSizeValid(origPkt->addrSizeValid),
383 srcValid(origPkt->srcValid), destValid(origPkt->destValid),
382 : cmd(origPkt->cmd), req(origPkt->req),
383 data(origPkt->staticData ? origPkt->data : NULL),
384 staticData(origPkt->staticData),
385 dynamicData(false), arrayData(false),
386 addr(origPkt->addr), size(origPkt->size),
387 src(origPkt->src), dest(origPkt->dest),
388 addrSizeValid(origPkt->addrSizeValid),
389 srcValid(origPkt->srcValid), destValid(origPkt->destValid),
384 flags(origPkt->flags),
390 flags(clearFlags ? 0 : origPkt->flags),
385 time(curTick), senderState(origPkt->senderState)
386 {
387 }
388
389 /** Destructor. */
390 ~Packet()
391 { if (staticData || dynamicData) deleteData(); }
392

--- 188 unchanged lines hidden ---
391 time(curTick), senderState(origPkt->senderState)
392 {
393 }
394
395 /** Destructor. */
396 ~Packet()
397 { if (staticData || dynamicData) deleteData(); }
398

--- 188 unchanged lines hidden ---