Deleted Added
sdiff udiff text old ( 5012:c0a28154d002 ) new ( 5314:e902f12a3af1 )
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;

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

40
41#include <cassert>
42#include <list>
43#include <bitset>
44
45#include "base/compiler.hh"
46#include "base/fast_alloc.hh"
47#include "base/misc.hh"
48#include "mem/request.hh"
49#include "sim/host.hh"
50#include "sim/core.hh"
51
52
53struct Packet;
54typedef Packet *PacketPtr;
55typedef uint8_t* PacketDataPtr;

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

86 SwapResp,
87 // Error responses
88 // @TODO these should be classified as responses rather than
89 // requests; coding them as requests initially for backwards
90 // compatibility
91 NetworkNackError, // nacked at network layer (not by protocol)
92 InvalidDestError, // packet dest field invalid
93 BadAddressError, // memory address invalid
94 NUM_MEM_CMDS
95 };
96
97 private:
98 /** List of command attributes. */
99 enum Attribute
100 {
101 IsRead, //!< Data flows from responder to requester

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

106 IsRequest, //!< Issued by requester
107 IsResponse, //!< Issue by responder
108 NeedsResponse, //!< Requester needs response from target
109 IsSWPrefetch,
110 IsHWPrefetch,
111 IsLocked, //!< Alpha/MIPS LL or SC access
112 HasData, //!< There is an associated payload
113 IsError, //!< Error response
114 NUM_COMMAND_ATTRIBUTES
115 };
116
117 /** Structure that defines attributes and other data associated
118 * with a Command. */
119 struct CommandInfo {
120 /** Set of attribute flags. */
121 const std::bitset<NUM_COMMAND_ATTRIBUTES> attributes;

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

145 bool isResponse() const { return testCmdAttrib(IsResponse); }
146 bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); }
147 bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
148 bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
149 bool hasData() const { return testCmdAttrib(HasData); }
150 bool isReadWrite() const { return isRead() && isWrite(); }
151 bool isLocked() const { return testCmdAttrib(IsLocked); }
152 bool isError() const { return testCmdAttrib(IsError); }
153
154 const Command responseCommand() const {
155 return commandInfo[cmd].response;
156 }
157
158 /** Return the string to a cmd given by idx. */
159 const std::string &toString() const {
160 return commandInfo[cmd].str;

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

182
183/**
184 * A Packet is used to encapsulate a transfer between two objects in
185 * the memory system (e.g., the L1 and L2 cache). (In contrast, a
186 * single Request travels all the way from the requester to the
187 * ultimate destination and back, possibly being conveyed by several
188 * different Packets along the way.)
189 */
190class Packet : public FastAlloc
191{
192 public:
193
194 typedef MemCmd::Command Command;
195
196 /** The command field of the packet. */
197 MemCmd cmd;
198

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

289 * needed to process it. A specific subclass would be derived
290 * from this to carry state specific to a particular sending
291 * device. */
292 class SenderState : public FastAlloc {
293 public:
294 virtual ~SenderState() {}
295 };
296
297 /** This packet's sender state. Devices should use dynamic_cast<>
298 * to cast to the state appropriate to the sender. */
299 SenderState *senderState;
300
301 /** Return the string name of the cmd field (for debugging and
302 * tracing). */
303 const std::string &cmdString() const { return cmd.toString(); }
304

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

311 bool isResponse() const { return cmd.isResponse(); }
312 bool needsExclusive() const { return cmd.needsExclusive(); }
313 bool needsResponse() const { return cmd.needsResponse(); }
314 bool isInvalidate() const { return cmd.isInvalidate(); }
315 bool hasData() const { return cmd.hasData(); }
316 bool isReadWrite() const { return cmd.isReadWrite(); }
317 bool isLocked() const { return cmd.isLocked(); }
318 bool isError() const { return cmd.isError(); }
319
320 // Snoop flags
321 void assertMemInhibit() { flags[MemInhibit] = true; }
322 bool memInhibitAsserted() { return flags[MemInhibit]; }
323 void assertShared() { flags[Shared] = true; }
324 bool sharedAsserted() { return flags[Shared]; }
325
326 // Special control flags

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

568
569 /**
570 * Check a functional request against a memory value represented
571 * by a base/size pair and an associated data array. If the
572 * functional request is a read, it may be satisfied by the memory
573 * value. If the functional request is a write, it may update the
574 * memory value.
575 */
576 bool checkFunctional(Addr base, int size, uint8_t *data);
577
578 /**
579 * Check a functional request against a memory value stored in
580 * another packet (i.e. an in-transit request or response).
581 */
582 bool checkFunctional(PacketPtr otherPkt) {
583 return (otherPkt->hasData() &&
584 checkFunctional(otherPkt->getAddr(), otherPkt->getSize(),
585 otherPkt->getPtr<uint8_t>()));
586 }
587};
588
589std::ostream & operator<<(std::ostream &o, const Packet &p);
590
591#endif //__MEM_PACKET_HH