gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
58namespace gem5
59{
60
65class PacketQueue : public Drainable
66{
67 private:
70 {
71 public:
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
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
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__
Interface for objects that might require draining before checkpointing.
Definition drain.hh:235
A deferred packet, buffered to transmit later.
DeferredPacket(Tick t, PacketPtr p)
PacketPtr pkt
Pointer to the packet to transmit.
Tick tick
The tick when the packet is ready to transmit.
A packet queue is a class that holds deferred packets and later sends them using the associated CPU-s...
size_t size() const
Get the size of the queue.
bool waitingOnRetry
Remember whether we're awaiting a retry.
bool forceOrder
if true, inserted packets have to be unconditionally scheduled after the last packet in the queue tha...
void disableSanityCheck()
This allows a user to explicitly disable the sanity check on the size of the transmitList,...
EventManager & em
The manager which is used for the event queue.
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
void processSendEvent()
Used to schedule sending of deferred packets.
bool deferredPacketReady() const
Check whether we have a packet ready to go on the transmit list.
DeferredPacketList transmitList
A list of outgoing packets.
const std::string label
Label to use for print request packets label stack.
EventFunctionWrapper sendEvent
Event used to call processSendEvent.
void retry()
Retry sending a packet from the queue.
virtual bool sendTiming(PacketPtr pkt)=0
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
void schedSendTiming(PacketPtr pkt, Tick when)
Add a packet to the transmit list, and schedule a send event.
virtual const std::string name() const =0
Provide a name to simplify debugging.
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...
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
bool checkConflict(const PacketPtr pkt, const int blk_size) const
Check if a packet corresponding to the same address exists in the queue.
virtual void sendDeferredPacket()
Attempt to send a packet.
void schedSendEvent(Tick when)
Schedule a send event if we are not already waiting for a retry.
std::list< DeferredPacket > DeferredPacketList
virtual ~PacketQueue()
Virtual desctructor since the class may be used as a base class.
Tick deferredPacketReadyTime() const
Get the next packet ready time.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
const std::string name() const
Return port name (for DPRINTF).
Definition port.hh:111
static const std::string name(const RequestPort &memSidePort, const std::string &label)
const std::string name() const
Provide a name to simplify debugging.
bool sendTiming(PacketPtr pkt)
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
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 ...
RequestPort & memSidePort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
static const std::string name(const ResponsePort &cpuSidePort, const std::string &label)
const std::string name() const
Provide a name to simplify debugging.
bool sendTiming(PacketPtr pkt)
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
ResponsePort & cpuSidePort
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...
A ResponsePort is a specialization of a port.
Definition port.hh:349
const std::string name() const
Provide a name to simplify debugging.
static const std::string name(const RequestPort &memSidePort, const std::string &label)
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,...
bool sendTiming(PacketPtr pkt)
Send a packet using the appropriate method for the specific subclass (request, response or snoop resp...
STL list class.
Definition stl.hh:51
DrainState
Object drain/handover states.
Definition drain.hh:75
Port Object Declaration.
Bitfield< 5 > t
Definition misc_types.hh:71
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
uint64_t Tick
Tick count type.
Definition types.hh:58
const Tick MaxTick
Definition types.hh:60

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0