gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
packet_queue.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012,2015,2018 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
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2006 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __MEM_PACKET_QUEUE_HH__
42 #define __MEM_PACKET_QUEUE_HH__
43 
52 #include <list>
53 
54 #include "mem/port.hh"
55 #include "sim/drain.hh"
56 #include "sim/eventq.hh"
57 
58 namespace gem5
59 {
60 
65 class PacketQueue : public Drainable
66 {
67  private:
70  {
71  public:
75  : tick(t), pkt(p)
76  {}
77  };
78 
80 
83 
86 
88  void processSendEvent();
89 
92 
93  /*
94  * Optionally disable the sanity check
95  * on the size of the transmitList. The
96  * sanity check will be enabled by default.
97  */
99 
106 
107  protected:
108 
110  const std::string label;
111 
114 
116  bool deferredPacketReady() const
117  { return !transmitList.empty() && transmitList.front().tick <= curTick(); }
118 
127  virtual void sendDeferredPacket();
128 
133  virtual bool sendTiming(PacketPtr pkt) = 0;
134 
145  PacketQueue(EventManager& _em, const std::string& _label,
146  const std::string& _sendEventName,
147  bool force_order = false,
148  bool disable_sanity_check = false);
149 
153  virtual ~PacketQueue();
154 
155  public:
156 
162  virtual const std::string name() const = 0;
163 
167  size_t size() const { return transmitList.size(); }
168 
173  { return transmitList.empty() ? MaxTick : transmitList.front().tick; }
174 
183  bool checkConflict(const PacketPtr pkt, const int blk_size) const;
184 
188 
198  void schedSendEvent(Tick when);
199 
206  void schedSendTiming(PacketPtr pkt, Tick when);
207 
213  void retry();
214 
222 
223  DrainState drain() override;
224 };
225 
227 {
228 
229  protected:
230 
232 
233  // Static definition so it can be called when constructing the parent
234  // without us being completely initialized.
235  static const std::string name(const RequestPort& memSidePort,
236  const std::string& label)
237  { return memSidePort.name() + "-" + label; }
238 
239  public:
240 
250  ReqPacketQueue(EventManager& _em, RequestPort& _mem_side_port,
251  const std::string _label = "ReqPacketQueue");
252 
253  virtual ~ReqPacketQueue() { }
254 
255  const std::string name() const
256  { return name(memSidePort, label); }
257 
258  bool sendTiming(PacketPtr pkt);
259 
260 };
261 
263 {
264 
265  protected:
266 
268 
269  // Static definition so it can be called when constructing the parent
270  // without us being completely initialized.
271  static const std::string name(const RequestPort& memSidePort,
272  const std::string& label)
273  { return memSidePort.name() + "-" + label; }
274 
275  public:
276 
287  SnoopRespPacketQueue(EventManager& _em, RequestPort& _mem_side_port,
288  bool force_order = false,
289  const std::string _label = "SnoopRespPacketQueue");
290 
291  virtual ~SnoopRespPacketQueue() { }
292 
293  const std::string name() const
294  { return name(memSidePort, label); }
295 
296  bool sendTiming(PacketPtr pkt);
297 
298 };
299 
301 {
302 
303  protected:
304 
306 
307  // Static definition so it can be called when constructing the parent
308  // without us being completely initialized.
309  static const std::string name(const ResponsePort& cpuSidePort,
310  const std::string& label)
311  { return cpuSidePort.name() + "-" + label; }
312 
313  public:
314 
325  RespPacketQueue(EventManager& _em, ResponsePort& _cpu_side_port,
326  bool force_order = false,
327  const std::string _label = "RespPacketQueue");
328 
329  virtual ~RespPacketQueue() { }
330 
331  const std::string name() const
332  { return name(cpuSidePort, label); }
333 
334  bool sendTiming(PacketPtr pkt);
335 
336 };
337 
338 } // namespace gem5
339 
340 #endif // __MEM_PACKET_QUEUE_HH__
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::PacketQueue::deferredPacketReadyTime
Tick deferredPacketReadyTime() const
Get the next packet ready time.
Definition: packet_queue.hh:172
gem5::Port::name
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:111
gem5::RespPacketQueue
Definition: packet_queue.hh:300
gem5::ReqPacketQueue::name
const std::string name() const
Provide a name to simplify debugging.
Definition: packet_queue.hh:255
gem5::PacketQueue::deferredPacketReady
bool deferredPacketReady() const
Check whether we have a packet ready to go on the transmit list.
Definition: packet_queue.hh:116
gem5::PacketQueue::DeferredPacket::DeferredPacket
DeferredPacket(Tick t, PacketPtr p)
Definition: packet_queue.hh:74
gem5::ReqPacketQueue::name
static const std::string name(const RequestPort &memSidePort, const std::string &label)
Definition: packet_queue.hh:235
gem5::RespPacketQueue::RespPacketQueue
RespPacketQueue(EventManager &_em, ResponsePort &_cpu_side_port, bool force_order=false, const std::string _label="RespPacketQueue")
Create a response packet queue, linked to an event manager, a CPU-side port, and a label that will be...
Definition: packet_queue.cc:266
gem5::ReqPacketQueue::sendTiming
bool sendTiming(PacketPtr pkt)
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
Definition: packet_queue.cc:246
gem5::PacketQueue::sendDeferredPacket
virtual void sendDeferredPacket()
Attempt to send a packet.
Definition: packet_queue.cc:191
gem5::PacketQueue::retry
void retry()
Retry sending a packet from the queue.
Definition: packet_queue.cc:66
gem5::MaxTick
const Tick MaxTick
Definition: types.hh:60
gem5::SnoopRespPacketQueue::memSidePort
RequestPort & memSidePort
Definition: packet_queue.hh:267
gem5::RespPacketQueue::~RespPacketQueue
virtual ~RespPacketQueue()
Definition: packet_queue.hh:329
gem5::PacketQueue::sendEvent
EventFunctionWrapper sendEvent
Event used to call processSendEvent.
Definition: packet_queue.hh:91
gem5::PacketQueue::DeferredPacket
A deferred packet, buffered to transmit later.
Definition: packet_queue.hh:69
gem5::RespPacketQueue::sendTiming
bool sendTiming(PacketPtr pkt)
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
Definition: packet_queue.cc:276
gem5::SnoopRespPacketQueue::sendTiming
bool sendTiming(PacketPtr pkt)
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
Definition: packet_queue.cc:261
gem5::RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:118
gem5::PacketQueue::name
virtual const std::string name() const =0
Provide a name to simplify debugging.
gem5::PacketQueue::size
size_t size() const
Get the size of the queue.
Definition: packet_queue.hh:167
gem5::PacketQueue::DeferredPacket::pkt
PacketPtr pkt
Pointer to the packet to transmit.
Definition: packet_queue.hh:73
gem5::EventManager
Definition: eventq.hh:980
gem5::PacketQueue::DeferredPacketList
std::list< DeferredPacket > DeferredPacketList
Definition: packet_queue.hh:79
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::PacketQueue::trySatisfyFunctional
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
Definition: packet_queue.cc:87
gem5::PacketQueue::DeferredPacket::tick
Tick tick
The tick when the packet is ready to transmit.
Definition: packet_queue.hh:72
gem5::PacketQueue::checkConflict
bool checkConflict(const PacketPtr pkt, const int blk_size) const
Check if a packet corresponding to the same address exists in the queue.
Definition: packet_queue.cc:75
gem5::SnoopRespPacketQueue::name
static const std::string name(const RequestPort &memSidePort, const std::string &label)
Definition: packet_queue.hh:271
gem5::VegaISA::t
Bitfield< 51 > t
Definition: pagetable.hh:56
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::PacketQueue::forceOrder
bool forceOrder
if true, inserted packets have to be unconditionally scheduled after the last packet in the queue tha...
Definition: packet_queue.hh:105
gem5::PacketQueue::transmitList
DeferredPacketList transmitList
A list of outgoing packets.
Definition: packet_queue.hh:82
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ReqPacketQueue::ReqPacketQueue
ReqPacketQueue(EventManager &_em, RequestPort &_mem_side_port, const std::string _label="ReqPacketQueue")
Create a request packet queue, linked to an event manager, a memory-side port, and a label that will ...
Definition: packet_queue.cc:238
gem5::PacketQueue::schedSendEvent
void schedSendEvent(Tick when)
Schedule a send event if we are not already waiting for a retry.
Definition: packet_queue.cc:155
gem5::RespPacketQueue::cpuSidePort
ResponsePort & cpuSidePort
Definition: packet_queue.hh:305
port.hh
gem5::PacketQueue::~PacketQueue
virtual ~PacketQueue()
Virtual desctructor since the class may be used as a base class.
Definition: packet_queue.cc:61
gem5::PacketQueue
A packet queue is a class that holds deferred packets and later sends them using the associated CPU-s...
Definition: packet_queue.hh:65
gem5::PacketQueue::processSendEvent
void processSendEvent()
Used to schedule sending of deferred packets.
Definition: packet_queue.cc:221
gem5::PacketQueue::waitingOnRetry
bool waitingOnRetry
Remember whether we're awaiting a retry.
Definition: packet_queue.hh:113
gem5::ReqPacketQueue::~ReqPacketQueue
virtual ~ReqPacketQueue()
Definition: packet_queue.hh:253
gem5::PacketQueue::sendTiming
virtual bool sendTiming(PacketPtr pkt)=0
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
gem5::RespPacketQueue::name
static const std::string name(const ResponsePort &cpuSidePort, const std::string &label)
Definition: packet_queue.hh:309
gem5::EventFunctionWrapper
Definition: eventq.hh:1136
gem5::ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:331
gem5::PacketQueue::_disableSanityCheck
bool _disableSanityCheck
Definition: packet_queue.hh:98
gem5::RespPacketQueue::name
const std::string name() const
Provide a name to simplify debugging.
Definition: packet_queue.hh:331
gem5::PacketQueue::drain
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: packet_queue.cc:228
gem5::SnoopRespPacketQueue::name
const std::string name() const
Provide a name to simplify debugging.
Definition: packet_queue.hh:293
gem5::PacketQueue::schedSendTiming
void schedSendTiming(PacketPtr pkt, Tick when)
Add a packet to the transmit list, and schedule a send event.
Definition: packet_queue.cc:107
gem5::Drainable
Interface for objects that might require draining before checkpointing.
Definition: drain.hh:234
gem5::ReqPacketQueue
Definition: packet_queue.hh:226
gem5::PacketQueue::em
EventManager & em
The manager which is used for the event queue.
Definition: packet_queue.hh:85
drain.hh
gem5::PacketQueue::label
const std::string label
Label to use for print request packets label stack.
Definition: packet_queue.hh:110
std::list< DeferredPacket >
gem5::ReqPacketQueue::memSidePort
RequestPort & memSidePort
Definition: packet_queue.hh:231
gem5::SnoopRespPacketQueue
Definition: packet_queue.hh:262
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::SnoopRespPacketQueue::SnoopRespPacketQueue
SnoopRespPacketQueue(EventManager &_em, RequestPort &_mem_side_port, bool force_order=false, const std::string _label="SnoopRespPacketQueue")
Create a snoop response packet queue, linked to an event manager, a memory-side port,...
Definition: packet_queue.cc:251
gem5::PacketQueue::PacketQueue
PacketQueue(EventManager &_em, const std::string &_label, const std::string &_sendEventName, bool force_order=false, bool disable_sanity_check=false)
Create a packet queue, linked to an event manager, and a label that will be used for functional print...
Definition: packet_queue.cc:50
gem5::SnoopRespPacketQueue::~SnoopRespPacketQueue
virtual ~SnoopRespPacketQueue()
Definition: packet_queue.hh:291
eventq.hh
gem5::PacketQueue::disableSanityCheck
void disableSanityCheck()
This allows a user to explicitly disable the sanity check on the size of the transmitList,...
Definition: packet_queue.hh:221

Generated on Sun Jul 30 2023 01:56:58 for gem5 by doxygen 1.8.17