gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 Queue< Entry >:
Drainable

Public Member Functions

 Queue (const std::string &_label, int num_entries, int reserve)
 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
 
void deallocate (Entry *entry)
 Removes the given entry from the queue. More...
 
DrainState drain () override
 Notify an object that it needs to drain its state. More...
 
- Public Member Functions inherited from Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 

Protected Member Functions

Entry::Iterator addToReadyList (Entry *entry)
 
- Protected Member Functions inherited from 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 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>
Queue< Entry >::Queue ( const std::string &  _label,
int  num_entries,
int  reserve 
)
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.

Member Function Documentation

◆ addToReadyList()

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

Definition at line 104 of file queue.hh.

◆ deallocate()

template<class Entry>
void Queue< Entry >::deallocate ( Entry *  entry)
inline

Removes the given entry from the queue.

This places the entry on the free list.

Parameters
entry

Definition at line 238 of file queue.hh.

Referenced by BaseCache::recvTimingResp().

◆ drain()

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

Notify 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 Drainable.

Definition at line 258 of file queue.hh.

◆ findMatch()

template<class Entry>
Entry* 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 166 of file queue.hh.

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

◆ findPending()

template<class Entry>
Entry* 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 205 of file queue.hh.

Referenced by BaseCache::getNextQueueEntry().

◆ getNext()

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

Returns the WriteQueueEntry at the head of the readyList.

Returns
The next request to service.

Definition at line 219 of file queue.hh.

Referenced by BaseCache::getNextQueueEntry().

◆ isEmpty()

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

Definition at line 143 of file queue.hh.

◆ isFull()

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

◆ nextReadyTime()

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

Definition at line 227 of file queue.hh.

Referenced by BaseCache::nextQueueReadyTime().

◆ numInService()

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

Definition at line 153 of file queue.hh.

◆ trySatisfyFunctional()

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

Definition at line 184 of file queue.hh.

Referenced by BaseCache::functionalAccess().

Member Data Documentation

◆ _numInService

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

The number of entries that are in service.

Definition at line 120 of file queue.hh.

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

◆ allocated

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

◆ allocatedList

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

Holds pointers to all allocated entries.

Definition at line 98 of file queue.hh.

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

◆ entries

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

Actual storage.

Definition at line 96 of file queue.hh.

◆ freeList

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

Holds non allocated entries.

Definition at line 102 of file queue.hh.

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

◆ label

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

Local label (for functional print requests)

Definition at line 73 of file queue.hh.

Referenced by Queue< WriteQueueEntry >::trySatisfyFunctional().

◆ numEntries

template<class Entry>
const int 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 Queue< WriteQueueEntry >::isFull(), and Queue< WriteQueueEntry >::Queue().

◆ numReserve

template<class Entry>
const int 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 Queue< WriteQueueEntry >::isFull().

◆ readyList

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

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

Generated on Fri Feb 28 2020 16:27:14 for gem5 by doxygen 1.8.13