packet.hh (2685:a0821abe7132) | packet.hh (2811:9da12e9830ce) |
---|---|
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; --- 32 unchanged lines hidden (view full) --- 41#include "mem/request.hh" 42#include "arch/isa_traits.hh" 43#include "sim/root.hh" 44 45struct Packet; 46typedef Packet* PacketPtr; 47typedef uint8_t* PacketDataPtr; 48 | 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; --- 32 unchanged lines hidden (view full) --- 41#include "mem/request.hh" 42#include "arch/isa_traits.hh" 43#include "sim/root.hh" 44 45struct Packet; 46typedef Packet* PacketPtr; 47typedef uint8_t* PacketDataPtr; 48 |
49//For statistics we need max number of commands, hard code it at 50//20 for now. @todo fix later 51#define NUM_MEM_CMDS 1 << 9 52 |
|
49/** 50 * A Packet is used to encapsulate a transfer between two objects in 51 * the memory system (e.g., the L1 and L2 cache). (In contrast, a 52 * single Request travels all the way from the requester to the 53 * ultimate destination and back, possibly being conveyed by several 54 * different Packets along the way.) 55 */ 56class Packet --- 40 unchanged lines hidden (view full) --- 97 98 /** Are the 'addr' and 'size' fields valid? */ 99 bool addrSizeValid; 100 /** Is the 'src' field valid? */ 101 bool srcValid; 102 103 public: 104 | 53/** 54 * A Packet is used to encapsulate a transfer between two objects in 55 * the memory system (e.g., the L1 and L2 cache). (In contrast, a 56 * single Request travels all the way from the requester to the 57 * ultimate destination and back, possibly being conveyed by several 58 * different Packets along the way.) 59 */ 60class Packet --- 40 unchanged lines hidden (view full) --- 101 102 /** Are the 'addr' and 'size' fields valid? */ 103 bool addrSizeValid; 104 /** Is the 'src' field valid? */ 105 bool srcValid; 106 107 public: 108 |
109 /** Used to calculate latencies for each packet.*/ 110 Tick time; 111 |
|
105 /** The special destination address indicating that the packet 106 * should be routed based on its address. */ 107 static const short Broadcast = -1; 108 109 /** A pointer to the original request. */ 110 RequestPtr req; 111 112 /** A virtual base opaque structure used to hold coherence-related --- 31 unchanged lines hidden (view full) --- 144 { 145 IsRead = 1 << 0, 146 IsWrite = 1 << 1, 147 IsPrefetch = 1 << 2, 148 IsInvalidate = 1 << 3, 149 IsRequest = 1 << 4, 150 IsResponse = 1 << 5, 151 NeedsResponse = 1 << 6, | 112 /** The special destination address indicating that the packet 113 * should be routed based on its address. */ 114 static const short Broadcast = -1; 115 116 /** A pointer to the original request. */ 117 RequestPtr req; 118 119 /** A virtual base opaque structure used to hold coherence-related --- 31 unchanged lines hidden (view full) --- 151 { 152 IsRead = 1 << 0, 153 IsWrite = 1 << 1, 154 IsPrefetch = 1 << 2, 155 IsInvalidate = 1 << 3, 156 IsRequest = 1 << 4, 157 IsResponse = 1 << 5, 158 NeedsResponse = 1 << 6, |
159 IsSWPrefetch = 1 << 7, 160 IsHWPrefetch = 1 << 8 |
|
152 }; 153 154 public: 155 /** List of all commands associated with a packet. */ 156 enum Command 157 { 158 ReadReq = IsRead | IsRequest | NeedsResponse, 159 WriteReq = IsWrite | IsRequest | NeedsResponse, 160 WriteReqNoAck = IsWrite | IsRequest, 161 ReadResp = IsRead | IsResponse, | 161 }; 162 163 public: 164 /** List of all commands associated with a packet. */ 165 enum Command 166 { 167 ReadReq = IsRead | IsRequest | NeedsResponse, 168 WriteReq = IsWrite | IsRequest | NeedsResponse, 169 WriteReqNoAck = IsWrite | IsRequest, 170 ReadResp = IsRead | IsResponse, |
162 WriteResp = IsWrite | IsResponse | 171 WriteResp = IsWrite | IsResponse, 172 Writeback = IsWrite | IsRequest, 173 SoftPFReq = IsRead | IsRequest | IsSWPrefetch | NeedsResponse, 174 HardPFReq = IsRead | IsRequest | IsHWPrefetch | NeedsResponse, 175 SoftPFResp = IsRead | IsRequest | IsSWPrefetch | IsResponse, 176 HardPFResp = IsRead | IsRequest | IsHWPrefetch | IsResponse |
163 }; 164 165 /** Return the string name of the cmd field (for debugging and 166 * tracing). */ 167 const std::string &cmdString() const; 168 | 177 }; 178 179 /** Return the string name of the cmd field (for debugging and 180 * tracing). */ 181 const std::string &cmdString() const; 182 |
183 /** Reutrn the string to a cmd given by idx. */ 184 const std::string &cmdIdxToString(Command idx); 185 186 /** Return the index of this command. */ 187 inline int cmdToIndex() const { return (int) cmd; } 188 |
|
169 /** The command field of the packet. */ 170 Command cmd; 171 172 bool isRead() { return (cmd & IsRead) != 0; } 173 bool isRequest() { return (cmd & IsRequest) != 0; } 174 bool isResponse() { return (cmd & IsResponse) != 0; } 175 bool needsResponse() { return (cmd & NeedsResponse) != 0; } 176 --- 124 unchanged lines hidden --- | 189 /** The command field of the packet. */ 190 Command cmd; 191 192 bool isRead() { return (cmd & IsRead) != 0; } 193 bool isRequest() { return (cmd & IsRequest) != 0; } 194 bool isResponse() { return (cmd & IsResponse) != 0; } 195 bool needsResponse() { return (cmd & NeedsResponse) != 0; } 196 --- 124 unchanged lines hidden --- |