packet.hh (3261:e3ca644e51d4) packet.hh (3286:21d9d32ab8ab)
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;

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

166 SenderState *senderState;
167
168 private:
169 /** List of command attributes. */
170 // If you add a new CommandAttribute, make sure to increase NUM_MEM_CMDS
171 // as well.
172 enum CommandAttribute
173 {
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;

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

166 SenderState *senderState;
167
168 private:
169 /** List of command attributes. */
170 // If you add a new CommandAttribute, make sure to increase NUM_MEM_CMDS
171 // as well.
172 enum CommandAttribute
173 {
174 IsRead = 1 << 0,
175 IsWrite = 1 << 1,
176 IsPrefetch = 1 << 2,
177 IsInvalidate = 1 << 3,
178 IsRequest = 1 << 4,
179 IsResponse = 1 << 5,
180 NeedsResponse = 1 << 6,
174 IsRead = 1 << 0,
175 IsWrite = 1 << 1,
176 IsPrefetch = 1 << 2,
177 IsInvalidate = 1 << 3,
178 IsRequest = 1 << 4,
179 IsResponse = 1 << 5,
180 NeedsResponse = 1 << 6,
181 IsSWPrefetch = 1 << 7,
182 IsHWPrefetch = 1 << 8,
183 IsUpgrade = 1 << 9,
181 IsSWPrefetch = 1 << 7,
182 IsHWPrefetch = 1 << 8,
183 IsUpgrade = 1 << 9,
184 HasData = 1 << 10
184 HasData = 1 << 10
185 };
186
187 public:
188 /** List of all commands associated with a packet. */
189 enum Command
190 {
191 InvalidCmd = 0,
185 };
186
187 public:
188 /** List of all commands associated with a packet. */
189 enum Command
190 {
191 InvalidCmd = 0,
192 ReadReq = IsRead | IsRequest | NeedsResponse,
193 WriteReq = IsWrite | IsRequest | NeedsResponse | HasData,
194 WriteReqNoAck = IsWrite | IsRequest | HasData,
195 ReadResp = IsRead | IsResponse | NeedsResponse | HasData,
196 WriteResp = IsWrite | IsResponse | NeedsResponse,
192 ReadReq = IsRead | IsRequest | NeedsResponse,
193 WriteReq = IsWrite | IsRequest | NeedsResponse | HasData,
194 WriteReqNoAck = IsWrite | IsRequest | HasData,
195 ReadResp = IsRead | IsResponse | NeedsResponse | HasData,
196 WriteResp = IsWrite | IsResponse | NeedsResponse,
197 Writeback = IsWrite | IsRequest | HasData,
198 SoftPFReq = IsRead | IsRequest | IsSWPrefetch | NeedsResponse,
199 HardPFReq = IsRead | IsRequest | IsHWPrefetch | NeedsResponse,
200 SoftPFResp = IsRead | IsResponse | IsSWPrefetch
201 | NeedsResponse | HasData,
202 HardPFResp = IsRead | IsResponse | IsHWPrefetch
197 Writeback = IsWrite | IsRequest | HasData,
198 SoftPFReq = IsRead | IsRequest | IsSWPrefetch | NeedsResponse,
199 HardPFReq = IsRead | IsRequest | IsHWPrefetch | NeedsResponse,
200 SoftPFResp = IsRead | IsResponse | IsSWPrefetch
201 | NeedsResponse | HasData,
202 HardPFResp = IsRead | IsResponse | IsHWPrefetch
203 | NeedsResponse | HasData,
203 | NeedsResponse | HasData,
204 InvalidateReq = IsInvalidate | IsRequest,
205 WriteInvalidateReq = IsWrite | IsInvalidate | IsRequest | HasData,
206 UpgradeReq = IsInvalidate | IsRequest | IsUpgrade,
207 ReadExReq = IsRead | IsInvalidate | IsRequest | NeedsResponse,
208 ReadExResp = IsRead | IsInvalidate | IsResponse
209 | NeedsResponse | HasData
210 };
211

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

217 const std::string &cmdIdxToString(Command idx);
218
219 /** Return the index of this command. */
220 inline int cmdToIndex() const { return (int) cmd; }
221
222 /** The command field of the packet. */
223 Command cmd;
224
204 InvalidateReq = IsInvalidate | IsRequest,
205 WriteInvalidateReq = IsWrite | IsInvalidate | IsRequest | HasData,
206 UpgradeReq = IsInvalidate | IsRequest | IsUpgrade,
207 ReadExReq = IsRead | IsInvalidate | IsRequest | NeedsResponse,
208 ReadExResp = IsRead | IsInvalidate | IsResponse
209 | NeedsResponse | HasData
210 };
211

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

217 const std::string &cmdIdxToString(Command idx);
218
219 /** Return the index of this command. */
220 inline int cmdToIndex() const { return (int) cmd; }
221
222 /** The command field of the packet. */
223 Command cmd;
224
225 bool isRead() { return (cmd & IsRead) != 0; }
226 bool isWrite() { return (cmd & IsWrite) != 0; }
227 bool isRequest() { return (cmd & IsRequest) != 0; }
228 bool isResponse() { return (cmd & IsResponse) != 0; }
229 bool needsResponse() { return (cmd & NeedsResponse) != 0; }
230 bool isInvalidate() { return (cmd & IsInvalidate) != 0; }
231 bool hasData() { return (cmd & HasData) != 0; }
225 bool isRead() const { return (cmd & IsRead) != 0; }
226 bool isWrite() const { return (cmd & IsWrite) != 0; }
227 bool isRequest() const { return (cmd & IsRequest) != 0; }
228 bool isResponse() const { return (cmd & IsResponse) != 0; }
229 bool needsResponse() const { return (cmd & NeedsResponse) != 0; }
230 bool isInvalidate() const { return (cmd & IsInvalidate) != 0; }
231 bool hasData() const { return (cmd & HasData) != 0; }
232
232
233 bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; }
234 bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; }
235 bool isCompressed() { return (flags & COMPRESSED) != 0; }
233 bool isCacheFill() const { return (flags & CACHE_LINE_FILL) != 0; }
234 bool isNoAllocate() const { return (flags & NO_ALLOCATE) != 0; }
235 bool isCompressed() const { return (flags & COMPRESSED) != 0; }
236
237 bool nic_pkt() { assert("Unimplemented\n" && 0); return false; }
238
239 /** Possible results of a packet's request. */
240 enum Result
241 {
242 Success,
243 BadAddress,

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

396
397 /** If there isn't data in the packet, allocate some. */
398 void allocate();
399
400 /** Do the packet modify the same addresses. */
401 bool intersect(Packet *p);
402};
403
236
237 bool nic_pkt() { assert("Unimplemented\n" && 0); return false; }
238
239 /** Possible results of a packet's request. */
240 enum Result
241 {
242 Success,
243 BadAddress,

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

396
397 /** If there isn't data in the packet, allocate some. */
398 void allocate();
399
400 /** Do the packet modify the same addresses. */
401 bool intersect(Packet *p);
402};
403
404
405/** This function given a functional packet and a timing packet either satisfies
406 * the timing packet, or updates the timing packet to reflect the updated state
407 * in the timing packet. It returns if the functional packet should continue to
408 * traverse the memory hierarchy or not.
409 */
404bool fixPacket(Packet *func, Packet *timing);
410bool fixPacket(Packet *func, Packet *timing);
411
412std::ostream & operator<<(std::ostream &o, const Packet &p);
413
405#endif //__MEM_PACKET_HH
414#endif //__MEM_PACKET_HH