packet_queue.hh (8948:e95ee70f876c) | packet_queue.hh (8975:7f36d4436074) |
---|---|
1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 72 unchanged lines hidden (view full) --- 81 82 /** A list of outgoing timing response packets that haven't been 83 * serviced yet. */ 84 DeferredPacketList transmitList; 85 86 /** The manager which is used for the event queue */ 87 EventManager& em; 88 | 1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 72 unchanged lines hidden (view full) --- 81 82 /** A list of outgoing timing response packets that haven't been 83 * serviced yet. */ 84 DeferredPacketList transmitList; 85 86 /** The manager which is used for the event queue */ 87 EventManager& em; 88 |
89 /** Label to use for print request packets label stack. */ 90 const std::string label; 91 | |
92 /** This function attempts to send deferred packets. Scheduled to 93 * be called in the future via SendEvent. */ 94 void processSendEvent(); 95 96 /** 97 * Event used to call processSendEvent. 98 **/ 99 EventWrapper<PacketQueue, &PacketQueue::processSendEvent> sendEvent; 100 101 /** If we need to drain, keep the drain event around until we're done 102 * here.*/ 103 Event *drainEvent; 104 105 protected: 106 | 89 /** This function attempts to send deferred packets. Scheduled to 90 * be called in the future via SendEvent. */ 91 void processSendEvent(); 92 93 /** 94 * Event used to call processSendEvent. 95 **/ 96 EventWrapper<PacketQueue, &PacketQueue::processSendEvent> sendEvent; 97 98 /** If we need to drain, keep the drain event around until we're done 99 * here.*/ 100 Event *drainEvent; 101 102 protected: 103 |
107 /** The port used to send the packets. */ 108 Port& port; | 104 /** Label to use for print request packets label stack. */ 105 const std::string label; |
109 110 /** Remember whether we're awaiting a retry from the bus. */ 111 bool waitingOnRetry; 112 113 /** Check whether we have a packet ready to go on the transmit list. */ 114 bool deferredPacketReady() 115 { return !transmitList.empty() && transmitList.front().tick <= curTick(); } 116 --- 13 unchanged lines hidden (view full) --- 130 * Attempt to send the packet at the front of the transmit list, 131 * and set waitingOnRetry accordingly. The packet is temporarily 132 * taken off the list, but put back at the front if not 133 * successfully sent. 134 */ 135 void trySendTiming(); 136 137 /** | 106 107 /** Remember whether we're awaiting a retry from the bus. */ 108 bool waitingOnRetry; 109 110 /** Check whether we have a packet ready to go on the transmit list. */ 111 bool deferredPacketReady() 112 { return !transmitList.empty() && transmitList.front().tick <= curTick(); } 113 --- 13 unchanged lines hidden (view full) --- 127 * Attempt to send the packet at the front of the transmit list, 128 * and set waitingOnRetry accordingly. The packet is temporarily 129 * taken off the list, but put back at the front if not 130 * successfully sent. 131 */ 132 void trySendTiming(); 133 134 /** |
135 * 136 */ 137 virtual bool sendTiming(PacketPtr pkt, bool send_as_snoop) = 0; 138 139 /** |
|
138 * Based on the transmit list, or the provided time, schedule a 139 * send event if there are packets to send. If we are idle and 140 * asked to drain then do so. 141 * 142 * @param time an alternative time for the next send event 143 */ 144 void scheduleSend(Tick time = MaxTick); 145 146 /** 147 * Simple ports are generally used as slave ports (i.e. the 148 * respond to requests) and thus do not expect to receive any 149 * range changes (as the neighbouring port has a master role and 150 * do not have any address ranges. A subclass can override the 151 * default behaviuor if needed. 152 */ 153 virtual void recvRangeChange() { } 154 | 140 * Based on the transmit list, or the provided time, schedule a 141 * send event if there are packets to send. If we are idle and 142 * asked to drain then do so. 143 * 144 * @param time an alternative time for the next send event 145 */ 146 void scheduleSend(Tick time = MaxTick); 147 148 /** 149 * Simple ports are generally used as slave ports (i.e. the 150 * respond to requests) and thus do not expect to receive any 151 * range changes (as the neighbouring port has a master role and 152 * do not have any address ranges. A subclass can override the 153 * default behaviuor if needed. 154 */ 155 virtual void recvRangeChange() { } 156 |
155 public: 156 | |
157 /** | 157 /** |
158 * Create a packet queue, linked to an event manager, a port used 159 * to send the packets, and potentially give it a label that will 160 * be used for functional print request packets. | 158 * Create a packet queue, linked to an event manager, and a label 159 * that will be used for functional print request packets. |
161 * 162 * @param _em Event manager used for scheduling this queue | 160 * 161 * @param _em Event manager used for scheduling this queue |
163 * @param _port Port used to send the packets | |
164 * @param _label Label to push on the label stack for print request packets 165 */ | 162 * @param _label Label to push on the label stack for print request packets 163 */ |
166 PacketQueue(EventManager& _em, Port& _port, 167 const std::string _label = "PacketQueue"); | 164 PacketQueue(EventManager& _em, const std::string& _label); |
168 169 /** 170 * Virtual desctructor since the class may be used as a base class. 171 */ 172 virtual ~PacketQueue(); 173 | 165 166 /** 167 * Virtual desctructor since the class may be used as a base class. 168 */ 169 virtual ~PacketQueue(); 170 |
171 public: 172 |
|
174 /** | 173 /** |
175 * Provide a name to simplify debugging. Base it on the port. | 174 * Provide a name to simplify debugging. |
176 * 177 * @return A complete name, appended to module and port 178 */ | 175 * 176 * @return A complete name, appended to module and port 177 */ |
179 const std::string name() const { return port.name() + "-queue"; } | 178 virtual const std::string name() const = 0; |
180 181 /** Check the list of buffered packets against the supplied 182 * functional request. */ 183 bool checkFunctional(PacketPtr pkt); 184 185 /** 186 * Schedule a send even if not already waiting for a retry. If the 187 * requested time is before an already scheduled send event it --- 24 unchanged lines hidden (view full) --- 212 * Hook for draining the packet queue. 213 * 214 * @param de An event which is used to signal back to the caller 215 * @return A number indicating how many times process will be called 216 */ 217 unsigned int drain(Event *de); 218}; 219 | 179 180 /** Check the list of buffered packets against the supplied 181 * functional request. */ 182 bool checkFunctional(PacketPtr pkt); 183 184 /** 185 * Schedule a send even if not already waiting for a retry. If the 186 * requested time is before an already scheduled send event it --- 24 unchanged lines hidden (view full) --- 211 * Hook for draining the packet queue. 212 * 213 * @param de An event which is used to signal back to the caller 214 * @return A number indicating how many times process will be called 215 */ 216 unsigned int drain(Event *de); 217}; 218 |
219class MasterPacketQueue : public PacketQueue 220{ 221 222 protected: 223 224 MasterPort& masterPort; 225 226 public: 227 228 /** 229 * Create a master packet queue, linked to an event manager, a 230 * master port, and a label that will be used for functional print 231 * request packets. 232 * 233 * @param _em Event manager used for scheduling this queue 234 * @param _masterPort Master port used to send the packets 235 * @param _label Label to push on the label stack for print request packets 236 */ 237 MasterPacketQueue(EventManager& _em, MasterPort& _masterPort, 238 const std::string _label = "MasterPacketQueue"); 239 240 virtual ~MasterPacketQueue() { } 241 242 const std::string name() const 243 { return masterPort.name() + "-" + label; } 244 245 bool sendTiming(PacketPtr pkt, bool send_as_snoop); 246}; 247 248class SlavePacketQueue : public PacketQueue 249{ 250 251 protected: 252 253 SlavePort& slavePort; 254 255 public: 256 257 /** 258 * Create a slave packet queue, linked to an event manager, a 259 * slave port, and a label that will be used for functional print 260 * request packets. 261 * 262 * @param _em Event manager used for scheduling this queue 263 * @param _slavePort Slave port used to send the packets 264 * @param _label Label to push on the label stack for print request packets 265 */ 266 SlavePacketQueue(EventManager& _em, SlavePort& _slavePort, 267 const std::string _label = "SlavePacketQueue"); 268 269 virtual ~SlavePacketQueue() { } 270 271 const std::string name() const 272 { return slavePort.name() + "-" + label; } 273 274 bool sendTiming(PacketPtr pkt, bool send_as_snoop); 275 276}; 277 |
|
220#endif // __MEM_PACKET_QUEUE_HH__ | 278#endif // __MEM_PACKET_QUEUE_HH__ |