gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::PacketQueue Class Referenceabstract

A packet queue is a class that holds deferred packets and later sends them using the associated CPU-side port or memory-side port. More...

#include <packet_queue.hh>

Inheritance diagram for gem5::PacketQueue:
gem5::Drainable gem5::ReqPacketQueue gem5::RespPacketQueue gem5::SnoopRespPacketQueue gem5::BaseCache::CacheReqPacketQueue

Classes

class  DeferredPacket
 A deferred packet, buffered to transmit later. More...
 

Public Member Functions

virtual const std::string name () const =0
 Provide a name to simplify debugging.
 
size_t size () const
 Get the size of the queue.
 
Tick deferredPacketReadyTime () const
 Get the next packet ready time.
 
bool checkConflict (const PacketPtr pkt, const int blk_size) const
 Check if a packet corresponding to the same address exists in the queue.
 
bool trySatisfyFunctional (PacketPtr pkt)
 Check the list of buffered packets against the supplied functional request.
 
void schedSendEvent (Tick when)
 Schedule a send event if we are not already waiting for a retry.
 
void schedSendTiming (PacketPtr pkt, Tick when)
 Add a packet to the transmit list, and schedule a send event.
 
void retry ()
 Retry sending a packet from the queue.
 
void disableSanityCheck ()
 This allows a user to explicitly disable the sanity check on the size of the transmitList, which is enabled by default.
 
DrainState drain () override
 Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 

Protected Member Functions

bool deferredPacketReady () const
 Check whether we have a packet ready to go on the transmit list.
 
virtual void sendDeferredPacket ()
 Attempt to send a packet.
 
virtual bool sendTiming (PacketPtr pkt)=0
 Send a packet using the appropriate method for the specific subclass (request, response or snoop response).
 
 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 request packets.
 
virtual ~PacketQueue ()
 Virtual desctructor since the class may be used as a base class.
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain.
 
void signalDrainDone () const
 Signal that an object is drained.
 

Protected Attributes

const std::string label
 Label to use for print request packets label stack.
 
bool waitingOnRetry
 Remember whether we're awaiting a retry.
 

Private Types

typedef std::list< DeferredPacketDeferredPacketList
 

Private Member Functions

void processSendEvent ()
 Used to schedule sending of deferred packets.
 

Private Attributes

DeferredPacketList transmitList
 A list of outgoing packets.
 
EventManagerem
 The manager which is used for the event queue.
 
EventFunctionWrapper sendEvent
 Event used to call processSendEvent.
 
bool _disableSanityCheck
 
bool forceOrder
 if true, inserted packets have to be unconditionally scheduled after the last packet in the queue that references the same address
 

Detailed Description

A packet queue is a class that holds deferred packets and later sends them using the associated CPU-side port or memory-side port.

Definition at line 65 of file packet_queue.hh.

Member Typedef Documentation

◆ DeferredPacketList

Constructor & Destructor Documentation

◆ PacketQueue()

gem5::PacketQueue::PacketQueue ( EventManager & _em,
const std::string & _label,
const std::string & _sendEventName,
bool force_order = false,
bool disable_sanity_check = false )
protected

Create a packet queue, linked to an event manager, and a label that will be used for functional print request packets.

Parameters
_emEvent manager used for scheduling this queue
_labelLabel to push on the label stack for print request packets
force_orderForce insertion order for packets with same address
disable_sanity_checkFlag used to disable the sanity check on the size of the transmitList. The check is enabled by default.

Definition at line 50 of file packet_queue.cc.

References processSendEvent().

◆ ~PacketQueue()

gem5::PacketQueue::~PacketQueue ( )
protectedvirtual

Virtual desctructor since the class may be used as a base class.

Definition at line 61 of file packet_queue.cc.

Member Function Documentation

◆ checkConflict()

bool gem5::PacketQueue::checkConflict ( const PacketPtr pkt,
const int blk_size ) const

Check if a packet corresponding to the same address exists in the queue.

Parameters
pktThe packet to compare against.
blk_sizeBlock size in bytes.
Returns
Whether a corresponding packet is found.

Definition at line 75 of file packet_queue.cc.

References gem5::MipsISA::p, and transmitList.

Referenced by gem5::BaseCache::CacheReqPacketQueue::checkConflictingSnoop().

◆ deferredPacketReady()

bool gem5::PacketQueue::deferredPacketReady ( ) const
inlineprotected

Check whether we have a packet ready to go on the transmit list.

Definition at line 116 of file packet_queue.hh.

References gem5::curTick(), and transmitList.

Referenced by sendDeferredPacket().

◆ deferredPacketReadyTime()

Tick gem5::PacketQueue::deferredPacketReadyTime ( ) const
inline

Get the next packet ready time.

Definition at line 172 of file packet_queue.hh.

References gem5::MaxTick, and transmitList.

Referenced by gem5::BaseCache::CacheReqPacketQueue::checkConflictingSnoop(), and sendDeferredPacket().

◆ disableSanityCheck()

void gem5::PacketQueue::disableSanityCheck ( )
inline

This allows a user to explicitly disable the sanity check on the size of the transmitList, which is enabled by default.

Users must use this function to explicitly disable the sanity check.

Definition at line 221 of file packet_queue.hh.

References _disableSanityCheck.

◆ drain()

DrainState gem5::PacketQueue::drain ( )
overridevirtual

Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.

Draining is mostly used before forking and creating a check point.

This function notifies an object that it needs to drain its state.

If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.

Note
An object that has entered the Drained state can be disturbed by other objects in the system and consequently stop being drained. These perturbations are not visible in the drain state. The simulator therefore repeats the draining process until all objects return DrainState::Drained on the first call to drain().
Returns
DrainState::Drained if the object is drained at this point in time, DrainState::Draining if it needs further simulation.

Implements gem5::Drainable.

Definition at line 228 of file packet_queue.cc.

References DPRINTF, gem5::Drained, gem5::Draining, and transmitList.

◆ name()

virtual const std::string gem5::PacketQueue::name ( ) const
pure virtual

Provide a name to simplify debugging.

Returns
A complete name, appended to module and port

Implemented in gem5::ReqPacketQueue, gem5::RespPacketQueue, and gem5::SnoopRespPacketQueue.

Referenced by retry(), and schedSendTiming().

◆ processSendEvent()

void gem5::PacketQueue::processSendEvent ( )
private

Used to schedule sending of deferred packets.

Definition at line 221 of file packet_queue.cc.

References sendDeferredPacket(), and waitingOnRetry.

Referenced by PacketQueue().

◆ retry()

void gem5::PacketQueue::retry ( )

Retry sending a packet from the queue.

Note that this is not necessarily the same packet if something has been added with an earlier time stamp.

Definition at line 66 of file packet_queue.cc.

References DPRINTF, name(), sendDeferredPacket(), and waitingOnRetry.

Referenced by gem5::QueuedRequestPort::recvReqRetry(), gem5::QueuedResponsePort::recvRespRetry(), and gem5::QueuedRequestPort::recvRetrySnoopResp().

◆ schedSendEvent()

void gem5::PacketQueue::schedSendEvent ( Tick when)

Schedule a send event if we are not already waiting for a retry.

If the requested time is before an already scheduled send event, the event will be rescheduled. If MaxTick is passed, no event is scheduled. Instead, if we are idle and asked to drain then check and signal drained.

Parameters
whentime to schedule an event

Definition at line 155 of file packet_queue.cc.

References gem5::curTick(), DPRINTF, gem5::Draining, gem5::Drainable::drainState(), em, gem5::MaxTick, gem5::EventManager::reschedule(), gem5::EventManager::schedule(), gem5::Event::scheduled(), sendEvent, gem5::Drainable::signalDrainDone(), transmitList, waitingOnRetry, and gem5::Event::when().

Referenced by gem5::BaseCache::CacheReqPacketQueue::checkConflictingSnoop(), gem5::BaseCache::CacheRequestPort::schedSendEvent(), schedSendTiming(), and sendDeferredPacket().

◆ schedSendTiming()

void gem5::PacketQueue::schedSendTiming ( PacketPtr pkt,
Tick when )

◆ sendDeferredPacket()

void gem5::PacketQueue::sendDeferredPacket ( )
protectedvirtual

Attempt to send a packet.

Note that a subclass of the PacketQueue can override this method and thus change the behaviour (as done by the cache for the request queue). The default implementation sends the head of the transmit list. The caller must guarantee that the list is non-empty and that the head packet is scheduled for curTick() (or earlier).

Reimplemented in gem5::BaseCache::CacheReqPacketQueue.

Definition at line 191 of file packet_queue.cc.

References deferredPacketReady(), deferredPacketReadyTime(), gem5::ArmISA::dp, schedSendEvent(), sendTiming(), transmitList, and waitingOnRetry.

Referenced by processSendEvent(), and retry().

◆ sendTiming()

virtual bool gem5::PacketQueue::sendTiming ( PacketPtr pkt)
protectedpure virtual

Send a packet using the appropriate method for the specific subclass (request, response or snoop response).

Implemented in gem5::ReqPacketQueue, gem5::RespPacketQueue, and gem5::SnoopRespPacketQueue.

Referenced by sendDeferredPacket().

◆ size()

size_t gem5::PacketQueue::size ( ) const
inline

Get the size of the queue.

Definition at line 167 of file packet_queue.hh.

References transmitList.

◆ trySatisfyFunctional()

Member Data Documentation

◆ _disableSanityCheck

bool gem5::PacketQueue::_disableSanityCheck
private

Definition at line 98 of file packet_queue.hh.

Referenced by disableSanityCheck(), and schedSendTiming().

◆ em

EventManager& gem5::PacketQueue::em
private

The manager which is used for the event queue.

Definition at line 85 of file packet_queue.hh.

Referenced by schedSendEvent().

◆ forceOrder

bool gem5::PacketQueue::forceOrder
private

if true, inserted packets have to be unconditionally scheduled after the last packet in the queue that references the same address

Definition at line 105 of file packet_queue.hh.

Referenced by schedSendTiming().

◆ label

const std::string gem5::PacketQueue::label
protected

◆ sendEvent

EventFunctionWrapper gem5::PacketQueue::sendEvent
private

Event used to call processSendEvent.

Definition at line 91 of file packet_queue.hh.

Referenced by schedSendEvent().

◆ transmitList

DeferredPacketList gem5::PacketQueue::transmitList
private

◆ waitingOnRetry

bool gem5::PacketQueue::waitingOnRetry
protected

Remember whether we're awaiting a retry.

Definition at line 113 of file packet_queue.hh.

Referenced by processSendEvent(), retry(), schedSendEvent(), and sendDeferredPacket().


The documentation for this class was generated from the following files:

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