packet.hh (2813:89d9196456ac) | packet.hh (2814:b723c79f5349) |
---|---|
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; --- 86 unchanged lines hidden (view full) --- 95 96 /** The address of the request. This address could be virtual or 97 * physical, depending on the system configuration. */ 98 Addr addr; 99 100 /** The size of the request or transfer. */ 101 int size; 102 | 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; --- 86 unchanged lines hidden (view full) --- 95 96 /** The address of the request. This address could be virtual or 97 * physical, depending on the system configuration. */ 98 Addr addr; 99 100 /** The size of the request or transfer. */ 101 int size; 102 |
103 /** The offset within the block that represents the data. */ 104 int offset; 105 | |
106 /** Device address (e.g., bus ID) of the source of the 107 * transaction. The source is not responsible for setting this 108 * field; it is set implicitly by the interconnect when the 109 * packet * is first sent. */ 110 short src; 111 112 /** Device address (e.g., bus ID) of the destination of the 113 * transaction. The special value Broadcast indicates that the 114 * packet should be routed based on its address. This field is 115 * initialized in the constructor and is thus always valid 116 * (unlike * addr, size, and src). */ 117 short dest; 118 119 /** Are the 'addr' and 'size' fields valid? */ 120 bool addrSizeValid; 121 /** Is the 'src' field valid? */ 122 bool srcValid; | 103 /** Device address (e.g., bus ID) of the source of the 104 * transaction. The source is not responsible for setting this 105 * field; it is set implicitly by the interconnect when the 106 * packet * is first sent. */ 107 short src; 108 109 /** Device address (e.g., bus ID) of the destination of the 110 * transaction. The special value Broadcast indicates that the 111 * packet should be routed based on its address. This field is 112 * initialized in the constructor and is thus always valid 113 * (unlike * addr, size, and src). */ 114 short dest; 115 116 /** Are the 'addr' and 'size' fields valid? */ 117 bool addrSizeValid; 118 /** Is the 'src' field valid? */ 119 bool srcValid; |
123 /** Is the offset valid. */ 124 bool offsetValid; | |
125 126 127 public: 128 129 /** Used to calculate latencies for each packet.*/ 130 Tick time; 131 132 /** The special destination address indicating that the packet --- 87 unchanged lines hidden (view full) --- 220 bool isWrite() { return (cmd & IsWrite) != 0; } 221 bool isRequest() { return (cmd & IsRequest) != 0; } 222 bool isResponse() { return (cmd & IsResponse) != 0; } 223 bool needsResponse() { return (cmd & NeedsResponse) != 0; } 224 bool isInvalidate() { return (cmd * IsInvalidate) != 0; } 225 226 bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; } 227 bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; } | 120 121 122 public: 123 124 /** Used to calculate latencies for each packet.*/ 125 Tick time; 126 127 /** The special destination address indicating that the packet --- 87 unchanged lines hidden (view full) --- 215 bool isWrite() { return (cmd & IsWrite) != 0; } 216 bool isRequest() { return (cmd & IsRequest) != 0; } 217 bool isResponse() { return (cmd & IsResponse) != 0; } 218 bool needsResponse() { return (cmd & NeedsResponse) != 0; } 219 bool isInvalidate() { return (cmd * IsInvalidate) != 0; } 220 221 bool isCacheFill() { return (flags & CACHE_LINE_FILL) != 0; } 222 bool isNoAllocate() { return (flags & NO_ALLOCATE) != 0; } |
223 bool isCompressed() { return (flags & COMPRESSED) != 0; } |
|
228 | 224 |
225 bool nic_pkt() { assert("Unimplemented\n" && 0); } 226 |
|
229 /** Possible results of a packet's request. */ 230 enum Result 231 { 232 Success, 233 BadAddress, 234 Nacked, 235 Unknown 236 }; --- 7 unchanged lines hidden (view full) --- 244 245 /** Accessor function that returns the destination index of 246 the packet. */ 247 short getDest() const { return dest; } 248 void setDest(short _dest) { dest = _dest; } 249 250 Addr getAddr() const { assert(addrSizeValid); return addr; } 251 int getSize() const { assert(addrSizeValid); return size; } | 227 /** Possible results of a packet's request. */ 228 enum Result 229 { 230 Success, 231 BadAddress, 232 Nacked, 233 Unknown 234 }; --- 7 unchanged lines hidden (view full) --- 242 243 /** Accessor function that returns the destination index of 244 the packet. */ 245 short getDest() const { return dest; } 246 void setDest(short _dest) { dest = _dest; } 247 248 Addr getAddr() const { assert(addrSizeValid); return addr; } 249 int getSize() const { assert(addrSizeValid); return size; } |
252 int getOffset() const { assert(offsetValid); return offset; } | 250 Addr getOffset(int blkSize) const { return req->getPaddr() & (Addr)(blkSize - 1); } |
253 254 void addrOverride(Addr newAddr) { assert(addrSizeValid); addr = newAddr; } 255 void cmdOverride(Command newCmd) { cmd = newCmd; } 256 257 /** Constructor. Note that a Request object must be constructed 258 * first, but the Requests's physical address and size fields 259 * need not be valid. The command and destination addresses 260 * must be supplied. */ 261 Packet(Request *_req, Command _cmd, short _dest) 262 : data(NULL), staticData(false), dynamicData(false), arrayData(false), 263 addr(_req->paddr), size(_req->size), dest(_dest), 264 addrSizeValid(_req->validPaddr), | 251 252 void addrOverride(Addr newAddr) { assert(addrSizeValid); addr = newAddr; } 253 void cmdOverride(Command newCmd) { cmd = newCmd; } 254 255 /** Constructor. Note that a Request object must be constructed 256 * first, but the Requests's physical address and size fields 257 * need not be valid. The command and destination addresses 258 * must be supplied. */ 259 Packet(Request *_req, Command _cmd, short _dest) 260 : data(NULL), staticData(false), dynamicData(false), arrayData(false), 261 addr(_req->paddr), size(_req->size), dest(_dest), 262 addrSizeValid(_req->validPaddr), |
265 srcValid(false), offsetValid(false), | 263 srcValid(false), |
266 req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 267 result(Unknown) 268 { 269 flags = 0; 270 } 271 272 /** Alternate constructor if you are trying to create a packet with 273 * a request that is for a whole block, not the address from the req. 274 * this allows for overriding the size/addr of the req.*/ 275 Packet(Request *_req, Command _cmd, short _dest, int _blkSize) 276 : data(NULL), staticData(false), dynamicData(false), arrayData(false), 277 addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), | 264 req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 265 result(Unknown) 266 { 267 flags = 0; 268 } 269 270 /** Alternate constructor if you are trying to create a packet with 271 * a request that is for a whole block, not the address from the req. 272 * this allows for overriding the size/addr of the req.*/ 273 Packet(Request *_req, Command _cmd, short _dest, int _blkSize) 274 : data(NULL), staticData(false), dynamicData(false), arrayData(false), 275 addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), |
278 offset(_req->paddr & (_blkSize - 1)), dest(_dest), 279 addrSizeValid(_req->validPaddr), srcValid(false), offsetValid(true), | 276 dest(_dest), 277 addrSizeValid(_req->validPaddr), srcValid(false), |
280 req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 281 result(Unknown) 282 { 283 flags = 0; 284 } 285 286 /** Destructor. */ 287 ~Packet() --- 84 unchanged lines hidden --- | 278 req(_req), coherence(NULL), senderState(NULL), cmd(_cmd), 279 result(Unknown) 280 { 281 flags = 0; 282 } 283 284 /** Destructor. */ 285 ~Packet() --- 84 unchanged lines hidden --- |