gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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) const
 Find the first WriteQueueEntry that matches the provided address. More...
 
bool checkFunctional (PacketPtr pkt, Addr blk_addr)
 
Entry * findPending (Addr blk_addr, bool is_secure) const
 Find any pending requests that overlap the given request. 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 64 of file queue.hh.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Definition at line 95 of file queue.hh.

template<class Entry>
bool Queue< Entry >::checkFunctional ( PacketPtr  pkt,
Addr  blk_addr 
)
inline

Definition at line 173 of file queue.hh.

Referenced by Cache::functionalAccess().

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

Referenced by Cache::recvTimingResp().

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

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

Find the first WriteQueueEntry that matches the provided address.

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

Definition at line 156 of file queue.hh.

Referenced by Cache::access(), Cache::allocateBlock(), BaseCache::allocateWriteBuffer(), Cache::functionalAccess(), Cache::getNextQueueEntry(), Cache::handleFill(), Cache::inMissQueue(), Cache::recvTimingReq(), and Cache::recvTimingSnoopReq().

template<class Entry>
Entry* Queue< Entry >::findPending ( Addr  blk_addr,
bool  is_secure 
) const
inline

Find any pending requests that overlap the given request.

Parameters
blk_addrBlock address.
is_secureTrue if the target memory space is secure.
Returns
A pointer to the earliest matching WriteQueueEntry.

Definition at line 192 of file queue.hh.

Referenced by Cache::getNextQueueEntry().

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

Referenced by Cache::getNextQueueEntry().

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

Definition at line 135 of file queue.hh.

Referenced by Cache::outstandingMisses().

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

Definition at line 214 of file queue.hh.

Referenced by Cache::nextQueueReadyTime().

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

Definition at line 145 of file queue.hh.

Member Data Documentation

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

The number of entries that are in service.

Definition at line 112 of file queue.hh.

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

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

Holds pointers to all allocated entries.

Definition at line 89 of file queue.hh.

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

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

Actual storage.

Definition at line 87 of file queue.hh.

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

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

Holds non allocated entries.

Definition at line 93 of file queue.hh.

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

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

Local label (for functional print requests)

Definition at line 68 of file queue.hh.

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

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

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

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

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

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

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

Generated on Fri Jun 9 2017 13:04:17 for gem5 by doxygen 1.8.6