packet.hh (3260:d9ef6d4cbe2a) | packet.hh (3261:e3ca644e51d4) |
---|---|
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() 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; } | 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; } |
232 | 232 |
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; } | 233 bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; } 234 bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; } 235 bool isCompressed() { 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, --- 99 unchanged lines hidden (view full) --- 343 * for returning as a response to that request. 344 */ 345 void makeAtomicResponse() { 346 assert(needsResponse()); 347 assert(isRequest()); 348 int icmd = (int)cmd; 349 icmd &= ~(IsRequest); 350 icmd |= IsResponse; | 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, --- 99 unchanged lines hidden (view full) --- 343 * for returning as a response to that request. 344 */ 345 void makeAtomicResponse() { 346 assert(needsResponse()); 347 assert(isRequest()); 348 int icmd = (int)cmd; 349 icmd &= ~(IsRequest); 350 icmd |= IsResponse; |
351 if (isRead()) 352 icmd |= HasData; 353 if (isWrite()) 354 icmd &= ~HasData; |
|
351 cmd = (Command)icmd; 352 } 353 354 /** Take a request packet that has been returned as NACKED and modify it so 355 * that it can be sent out again. Only packets that need a response can be 356 * NACKED, so verify that that is true. */ 357 void reinitNacked() { 358 assert(needsResponse() && result == Nacked); --- 33 unchanged lines hidden (view full) --- 392 393 /** If there isn't data in the packet, allocate some. */ 394 void allocate(); 395 396 /** Do the packet modify the same addresses. */ 397 bool intersect(Packet *p); 398}; 399 | 355 cmd = (Command)icmd; 356 } 357 358 /** Take a request packet that has been returned as NACKED and modify it so 359 * that it can be sent out again. Only packets that need a response can be 360 * NACKED, so verify that that is true. */ 361 void reinitNacked() { 362 assert(needsResponse() && result == Nacked); --- 33 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 |
400 401/** This function given a functional packet and a timing packet either satisfies 402 * the timing packet, or updates the timing packet to reflect the updated state 403 * in the timing packet. It returns if the functional packet should continue to 404 * traverse the memory hierarchy or not. 405 */ | |
406bool fixPacket(Packet *func, Packet *timing); | 404bool fixPacket(Packet *func, Packet *timing); |
407 408std::ostream & operator<<(std::ostream &o, const Packet &p); 409 | |
410#endif //__MEM_PACKET_HH | 405#endif //__MEM_PACKET_HH |