packet.hh (9259:fc28f3ca5b21) packet.hh (9542:683991c46ac8)
1/*
1/*
2 * Copyright (c) 2012 ARM Limited
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

335 /// The time at which the packet will be fully transmitted
336 Tick finishTime;
337
338 /// The time at which the first chunk of the packet will be transmitted
339 Tick firstWordTime;
340
341 /**
342 * A virtual base opaque structure used to hold state associated
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

335 /// The time at which the packet will be fully transmitted
336 Tick finishTime;
337
338 /// The time at which the first chunk of the packet will be transmitted
339 Tick firstWordTime;
340
341 /**
342 * A virtual base opaque structure used to hold state associated
343 * with the packet but specific to the sending device (e.g., an
344 * MSHR). A pointer to this state is returned in the packet's
345 * response so that the sender can quickly look up the state
346 * needed to process it. A specific subclass would be derived
347 * from this to carry state specific to a particular sending
348 * device.
343 * with the packet (e.g., an MSHR), specific to a MemObject that
344 * sees the packet. A pointer to this state is returned in the
345 * packet's response so that the MemObject in question can quickly
346 * look up the state needed to process it. A specific subclass
347 * would be derived from this to carry state specific to a
348 * particular sending device.
349 *
350 * As multiple MemObjects may add their SenderState throughout the
351 * memory system, the SenderStates create a stack, where a
352 * MemObject can add a new Senderstate, as long as the
353 * predecessing SenderState is restored when the response comes
354 * back. For this reason, the predecessor should always be
355 * populated with the current SenderState of a packet before
356 * modifying the senderState field in the request packet.
349 */
350 struct SenderState
351 {
357 */
358 struct SenderState
359 {
360 SenderState* predecessor;
361 SenderState() : predecessor(NULL) {}
352 virtual ~SenderState() {}
353 };
354
355 /**
356 * Object used to maintain state of a PrintReq. The senderState
357 * field of a PrintReq should always be of this type.
358 */
359 class PrintReqState : public SenderState

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

413 */
414 void printObj(Printable *obj);
415 };
416
417 /**
418 * This packet's sender state. Devices should use dynamic_cast<>
419 * to cast to the state appropriate to the sender. The intent of
420 * this variable is to allow a device to attach extra information
362 virtual ~SenderState() {}
363 };
364
365 /**
366 * Object used to maintain state of a PrintReq. The senderState
367 * field of a PrintReq should always be of this type.
368 */
369 class PrintReqState : public SenderState

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

423 */
424 void printObj(Printable *obj);
425 };
426
427 /**
428 * This packet's sender state. Devices should use dynamic_cast<>
429 * to cast to the state appropriate to the sender. The intent of
430 * this variable is to allow a device to attach extra information
421 * to a request. A response packet must return the sender state
431 * to a request. A response packet must return the sender state
422 * that was attached to the original request (even if a new packet
423 * is created).
424 */
425 SenderState *senderState;
426
432 * that was attached to the original request (even if a new packet
433 * is created).
434 */
435 SenderState *senderState;
436
437 /**
438 * Push a new sender state to the packet and make the current
439 * sender state the predecessor of the new one. This should be
440 * prefered over direct manipulation of the senderState member
441 * variable.
442 *
443 * @param sender_state SenderState to push at the top of the stack
444 */
445 void pushSenderState(SenderState *sender_state);
446
447 /**
448 * Pop the top of the state stack and return a pointer to it. This
449 * assumes the current sender state is not NULL. This should be
450 * preferred over direct manipulation of the senderState member
451 * variable.
452 *
453 * @return The current top of the stack
454 */
455 SenderState *popSenderState();
456
427 /// Return the string name of the cmd field (for debugging and
428 /// tracing).
429 const std::string &cmdString() const { return cmd.toString(); }
430
431 /// Return the index of this command.
432 inline int cmdToIndex() const { return cmd.toInt(); }
433
434 bool isRead() const { return cmd.isRead(); }

--- 424 unchanged lines hidden ---
457 /// Return the string name of the cmd field (for debugging and
458 /// tracing).
459 const std::string &cmdString() const { return cmd.toString(); }
460
461 /// Return the index of this command.
462 inline int cmdToIndex() const { return cmd.toInt(); }
463
464 bool isRead() const { return cmd.isRead(); }

--- 424 unchanged lines hidden ---