gem5  v22.1.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gem5::Queue< Entry > Class Template Reference

A high-level queue interface, to be used by both the MSHR queue and the write buffer. More...

#include <queue.hh>

Inheritance diagram for gem5::Queue< Entry >:
gem5::Drainable gem5::Named

Public Member Functions

 Queue (const std::string &_label, int num_entries, int reserve, const std::string &name)
 Create a queue with a given number of entries. More...
 
bool isEmpty () const
 
bool isFull () const
 
int numInService () const
 
Entry * findMatch (Addr blk_addr, bool is_secure, bool ignore_uncacheable=true) const
 Find the first entry that matches the provided address. More...
 
bool trySatisfyFunctional (PacketPtr pkt)
 
Entry * findPending (const QueueEntry *entry) const
 Find any pending requests that overlap the given request of a different queue. More...
 
Entry * getNext () const
 Returns the WriteQueueEntry at the head of the readyList. More...
 
Tick nextReadyTime () const
 
virtual void deallocate (Entry *entry)
 Removes the given entry from the queue. More...
 
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. More...
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 

Protected Member Functions

Entry::Iterator addToReadyList (Entry *entry)
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 

Protected Attributes

const std::string label
 Local label (for functional print requests) More...
 
const int numEntries
 The total number of entries in this queue. More...
 
const int numReserve
 The number of entries to hold as a temporary overflow space. More...
 
std::vector< Entry > entries
 Actual storage. More...
 
Entry::List allocatedList
 Holds pointers to all allocated entries. More...
 
Entry::List readyList
 Holds pointers to entries that haven't been sent downstream. More...
 
Entry::List freeList
 Holds non allocated entries. More...
 
int _numInService
 The number of entries that are in service. More...
 
int allocated
 The number of currently allocated entries. More...
 

Detailed Description

template<class Entry>
class gem5::Queue< Entry >

A high-level queue interface, to be used by both the MSHR queue and the write buffer.

Definition at line 70 of file queue.hh.

Constructor & Destructor Documentation

◆ Queue()

template<class Entry >
gem5::Queue< Entry >::Queue ( const std::string &  _label,
int  num_entries,
int  reserve,
const std::string &  name 
)
inline

Create a queue with a given number of entries.

Parameters
num_entriesThe number of entries in this queue.
reserveThe extra overflow entries needed.

Definition at line 133 of file queue.hh.

References gem5::Queue< Entry >::entries, gem5::Queue< Entry >::freeList, gem5::ArmISA::i, and gem5::Queue< Entry >::numEntries.

Member Function Documentation

◆ addToReadyList()

template<class Entry >
Entry::Iterator gem5::Queue< Entry >::addToReadyList ( Entry *  entry)
inlineprotected

Definition at line 104 of file queue.hh.

References gem5::ArmISA::i, panic, and gem5::Queue< Entry >::readyList.

◆ deallocate()

template<class Entry >
virtual void gem5::Queue< Entry >::deallocate ( Entry *  entry)
inlinevirtual

◆ drain()

template<class Entry >
DrainState gem5::Queue< Entry >::drain ( )
inlineoverridevirtual

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 261 of file queue.hh.

References gem5::Queue< Entry >::allocated, gem5::Drained, and gem5::Draining.

◆ findMatch()

template<class Entry >
Entry* gem5::Queue< Entry >::findMatch ( Addr  blk_addr,
bool  is_secure,
bool  ignore_uncacheable = true 
) const
inline

Find the first entry that matches the provided address.

Parameters
blk_addrThe block address to find.
is_secureTrue if the target memory space is secure.
ignore_uncacheableShould uncacheables be ignored or not
Returns
Pointer to the matching WriteQueueEntry, null if not found.

Definition at line 168 of file queue.hh.

References gem5::Queue< Entry >::allocatedList.

Referenced by gem5::BaseCache::access(), gem5::BaseCache::allocateWriteBuffer(), gem5::BaseCache::functionalAccess(), gem5::BaseCache::getNextQueueEntry(), gem5::BaseCache::handleEvictions(), gem5::BaseCache::handleFill(), gem5::BaseCache::handleTimingReqHit(), gem5::Cache::handleTimingReqMiss(), gem5::NoncoherentCache::handleTimingReqMiss(), gem5::BaseCache::inMissQueue(), and gem5::Cache::recvTimingSnoopReq().

◆ findPending()

template<class Entry >
Entry* gem5::Queue< Entry >::findPending ( const QueueEntry entry) const
inline

Find any pending requests that overlap the given request of a different queue.

Parameters
entryThe entry to be compared against.
Returns
A pointer to the earliest matching entry.

Definition at line 207 of file queue.hh.

References gem5::Queue< Entry >::readyList.

Referenced by gem5::BaseCache::getNextQueueEntry().

◆ getNext()

template<class Entry >
Entry* gem5::Queue< Entry >::getNext ( ) const
inline

Returns the WriteQueueEntry at the head of the readyList.

Returns
The next request to service.

Definition at line 221 of file queue.hh.

References gem5::curTick(), and gem5::Queue< Entry >::readyList.

Referenced by gem5::BaseCache::getNextQueueEntry().

◆ isEmpty()

template<class Entry >
bool gem5::Queue< Entry >::isEmpty ( ) const
inline

Definition at line 145 of file queue.hh.

References gem5::Queue< Entry >::allocated.

◆ isFull()

template<class Entry >
bool gem5::Queue< Entry >::isFull ( ) const
inline

◆ nextReadyTime()

template<class Entry >
Tick gem5::Queue< Entry >::nextReadyTime ( ) const
inline

Definition at line 229 of file queue.hh.

References gem5::MaxTick, and gem5::Queue< Entry >::readyList.

Referenced by gem5::BaseCache::nextQueueReadyTime().

◆ numInService()

template<class Entry >
int gem5::Queue< Entry >::numInService ( ) const
inline

Definition at line 155 of file queue.hh.

References gem5::Queue< Entry >::_numInService.

◆ trySatisfyFunctional()

template<class Entry >
bool gem5::Queue< Entry >::trySatisfyFunctional ( PacketPtr  pkt)
inline

Member Data Documentation

◆ _numInService

template<class Entry >
int gem5::Queue< Entry >::_numInService
protected

The number of entries that are in service.

Definition at line 120 of file queue.hh.

Referenced by gem5::Queue< Entry >::deallocate(), and gem5::Queue< Entry >::numInService().

◆ allocated

template<class Entry >
int gem5::Queue< Entry >::allocated
protected

The number of currently allocated entries.

Definition at line 123 of file queue.hh.

Referenced by gem5::Queue< Entry >::deallocate(), gem5::Queue< Entry >::drain(), gem5::Queue< Entry >::isEmpty(), and gem5::Queue< Entry >::isFull().

◆ allocatedList

template<class Entry >
Entry::List gem5::Queue< Entry >::allocatedList
protected

Holds pointers to all allocated entries.

Definition at line 98 of file queue.hh.

Referenced by gem5::Queue< Entry >::deallocate(), gem5::Queue< Entry >::findMatch(), and gem5::Queue< Entry >::trySatisfyFunctional().

◆ entries

template<class Entry >
std::vector<Entry> gem5::Queue< Entry >::entries
protected

Actual storage.

Definition at line 96 of file queue.hh.

Referenced by gem5::Queue< Entry >::Queue().

◆ freeList

template<class Entry >
Entry::List gem5::Queue< Entry >::freeList
protected

Holds non allocated entries.

Definition at line 102 of file queue.hh.

Referenced by gem5::Queue< Entry >::deallocate(), and gem5::Queue< Entry >::Queue().

◆ label

template<class Entry >
const std::string gem5::Queue< Entry >::label
protected

Local label (for functional print requests)

Definition at line 77 of file queue.hh.

Referenced by gem5::Queue< Entry >::trySatisfyFunctional().

◆ numEntries

template<class Entry >
const int gem5::Queue< Entry >::numEntries
protected

The total number of entries in this queue.

This number is set as the number of entries requested plus any reserve. This allows for the same number of effective entries while still maintaining an overflow reserve.

Definition at line 85 of file queue.hh.

Referenced by gem5::Queue< Entry >::isFull(), and gem5::Queue< Entry >::Queue().

◆ numReserve

template<class Entry >
const int gem5::Queue< Entry >::numReserve
protected

The number of entries to hold as a temporary overflow space.

This is used to allow temporary overflow of the number of entries as we only check the full condition under certain conditions.

Definition at line 93 of file queue.hh.

Referenced by gem5::Queue< Entry >::isFull().

◆ readyList

template<class Entry >
Entry::List gem5::Queue< Entry >::readyList
protected

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

Generated on Wed Dec 21 2022 10:23:26 for gem5 by doxygen 1.9.1