gem5  v20.1.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
ROB< Impl > Class Template Reference

ROB class. More...

#include <rob.hh>

Classes

struct  ROBStats
 

Public Types

enum  Status { Running, Idle, ROBSquashing }
 Possible ROB statuses. More...
 
typedef Impl::O3CPU O3CPU
 
typedef Impl::DynInstPtr DynInstPtr
 
typedef std::pair< RegIndex, PhysRegIndexUnmapInfo
 
typedef std::list< DynInstPtr >::iterator InstIt
 

Public Member Functions

 ROB (O3CPU *_cpu, DerivO3CPUParams *params)
 ROB constructor. More...
 
std::string name () const
 
void setActiveThreads (std::list< ThreadID > *at_ptr)
 Sets pointer to the list of active threads. More...
 
void drainSanityCheck () const
 Perform sanity checks after a drain. More...
 
void takeOverFrom ()
 Takes over another CPU's thread. More...
 
void insertInst (const DynInstPtr &inst)
 Function to insert an instruction into the ROB. More...
 
const DynInstPtrreadHeadInst (ThreadID tid)
 Returns pointer to the head instruction within the ROB. More...
 
DynInstPtr findInst (ThreadID tid, InstSeqNum squash_inst)
 Returns a pointer to the instruction with the given sequence if it is in the ROB. More...
 
DynInstPtr readTailInst (ThreadID tid)
 Returns pointer to the tail instruction within the ROB. More...
 
void retireHead (ThreadID tid)
 Retires the head instruction, removing it from the ROB. More...
 
bool isHeadReady (ThreadID tid)
 Is the oldest instruction across all threads ready. More...
 
bool canCommit ()
 Is there any commitable head instruction across all threads ready. More...
 
void resetEntries ()
 Re-adjust ROB partitioning. More...
 
int entryAmount (ThreadID num_threads)
 Number of entries needed For 'num_threads' amount of threads. More...
 
unsigned numFreeEntries ()
 Returns the number of total free entries in the ROB. More...
 
unsigned numFreeEntries (ThreadID tid)
 Returns the number of free entries in a specific ROB paritition. More...
 
unsigned getMaxEntries (ThreadID tid)
 Returns the maximum number of entries for a specific thread. More...
 
unsigned getThreadEntries (ThreadID tid)
 Returns the number of entries being used by a specific thread. More...
 
bool isFull ()
 Returns if the ROB is full. More...
 
bool isFull (ThreadID tid)
 Returns if a specific thread's partition is full. More...
 
bool isEmpty () const
 Returns if the ROB is empty. More...
 
bool isEmpty (ThreadID tid) const
 Returns if a specific thread's partition is empty. More...
 
void doSquash (ThreadID tid)
 Executes the squash, marking squashed instructions. More...
 
void squash (InstSeqNum squash_num, ThreadID tid)
 Squashes all instructions younger than the given sequence number for the specific thread. More...
 
void updateHead ()
 Updates the head instruction with the new oldest instruction. More...
 
void updateTail ()
 Updates the tail instruction with the new youngest instruction. More...
 
bool isDoneSquashing (ThreadID tid) const
 Reads the PC of the oldest head instruction. More...
 
bool isDoneSquashing ()
 Checks if the ROB is still in the process of squashing instructions for any thread. More...
 
int countInsts ()
 This is more of a debugging function than anything. More...
 
size_t countInsts (ThreadID tid)
 This is more of a debugging function than anything. More...
 

Public Attributes

InstIt tail
 Iterator pointing to the instruction which is the last instruction in the ROB. More...
 
InstIt head
 Iterator pointing to the instruction which is the first instruction in in the ROB. More...
 
int numInstsInROB
 Number of instructions in the ROB. More...
 
DynInstPtr dummyInst
 Dummy instruction returned if there are no insts left. More...
 

Private Member Functions

void resetState ()
 Reset the ROB state. More...
 

Private Attributes

Status robStatus [Impl::MaxThreads]
 Per-thread ROB status. More...
 
SMTQueuePolicy robPolicy
 ROB resource sharing policy for SMT mode. More...
 
O3CPUcpu
 Pointer to the CPU. More...
 
std::list< ThreadID > * activeThreads
 Active Threads in CPU. More...
 
unsigned numEntries
 Number of instructions in the ROB. More...
 
unsigned threadEntries [Impl::MaxThreads]
 Entries Per Thread. More...
 
unsigned maxEntries [Impl::MaxThreads]
 Max Insts a Thread Can Have in the ROB. More...
 
std::list< DynInstPtrinstList [Impl::MaxThreads]
 ROB List of Instructions. More...
 
unsigned squashWidth
 Number of instructions that can be squashed in a single cycle. More...
 
InstIt squashIt [Impl::MaxThreads]
 Iterator used for walking through the list of instructions when squashing. More...
 
InstSeqNum squashedSeqNum [Impl::MaxThreads]
 The sequence number of the squashed instruction. More...
 
bool doneSquashing [Impl::MaxThreads]
 Is the ROB done squashing. More...
 
ThreadID numThreads
 Number of active threads. More...
 
ROB::ROBStats stats
 

Detailed Description

template<class Impl>
class ROB< Impl >

ROB class.

The ROB is largely what drives squashing.

Definition at line 59 of file rob.hh.

Member Typedef Documentation

◆ DynInstPtr

template<class Impl >
typedef Impl::DynInstPtr ROB< Impl >::DynInstPtr

Definition at line 64 of file rob.hh.

◆ InstIt

template<class Impl >
typedef std::list<DynInstPtr>::iterator ROB< Impl >::InstIt

Definition at line 67 of file rob.hh.

◆ O3CPU

template<class Impl >
typedef Impl::O3CPU ROB< Impl >::O3CPU

Definition at line 63 of file rob.hh.

◆ UnmapInfo

template<class Impl >
typedef std::pair<RegIndex, PhysRegIndex> ROB< Impl >::UnmapInfo

Definition at line 66 of file rob.hh.

Member Enumeration Documentation

◆ Status

template<class Impl >
enum ROB::Status

Possible ROB statuses.

Enumerator
Running 
Idle 
ROBSquashing 

Definition at line 70 of file rob.hh.

Constructor & Destructor Documentation

◆ ROB()

template<class Impl >
ROB< Impl >::ROB ( O3CPU _cpu,
DerivO3CPUParams *  params 
)

ROB constructor.

Parameters
_cpuThe cpu object pointer.
paramsThe cpu params including several ROB-specific parameters.

Definition at line 55 of file rob_impl.hh.

References DPRINTF, ROB< Impl >::maxEntries, ROB< Impl >::numEntries, ROB< Impl >::numThreads, ROB< Impl >::resetState(), and ROB< Impl >::robPolicy.

Member Function Documentation

◆ canCommit()

template<class Impl >
bool ROB< Impl >::canCommit

Is there any commitable head instruction across all threads ready.

Definition at line 288 of file rob_impl.hh.

◆ countInsts() [1/2]

template<class Impl >
int ROB< Impl >::countInsts

This is more of a debugging function than anything.

Use numInstsInROB to get the instructions in the ROB unless you are double checking that variable.

Definition at line 185 of file rob_impl.hh.

References Stats::total.

Referenced by DefaultCommit< Impl >::tick().

◆ countInsts() [2/2]

template<class Impl >
size_t ROB< Impl >::countInsts ( ThreadID  tid)

This is more of a debugging function than anything.

Use threadEntries to get the instructions in the ROB unless you are double checking that variable.

Definition at line 197 of file rob_impl.hh.

◆ doSquash()

template<class Impl >
void ROB< Impl >::doSquash ( ThreadID  tid)

Executes the squash, marking squashed instructions.

Definition at line 321 of file rob_impl.hh.

References DPRINTF.

Referenced by DefaultCommit< Impl >::tick().

◆ drainSanityCheck()

template<class Impl >
void ROB< Impl >::drainSanityCheck

Perform sanity checks after a drain.

Definition at line 135 of file rob_impl.hh.

Referenced by DefaultCommit< Impl >::drainSanityCheck().

◆ entryAmount()

template<class Impl >
int ROB< Impl >::entryAmount ( ThreadID  num_threads)

Number of entries needed For 'num_threads' amount of threads.

Definition at line 174 of file rob_impl.hh.

◆ findInst()

template<class Impl >
Impl::DynInstPtr ROB< Impl >::findInst ( ThreadID  tid,
InstSeqNum  squash_inst 
)

Returns a pointer to the instruction with the given sequence if it is in the ROB.

Definition at line 541 of file rob_impl.hh.

References ROB< Impl >::instList.

Referenced by DefaultCommit< Impl >::commit().

◆ getMaxEntries()

template<class Impl >
unsigned ROB< Impl >::getMaxEntries ( ThreadID  tid)
inline

Returns the maximum number of entries for a specific thread.

Definition at line 169 of file rob.hh.

References ROB< Impl >::maxEntries.

Referenced by DefaultCommit< Impl >::getInsts().

◆ getThreadEntries()

template<class Impl >
unsigned ROB< Impl >::getThreadEntries ( ThreadID  tid)
inline

Returns the number of entries being used by a specific thread.

Definition at line 173 of file rob.hh.

References ROB< Impl >::threadEntries.

Referenced by DefaultCommit< Impl >::getInsts().

◆ insertInst()

template<class Impl >
void ROB< Impl >::insertInst ( const DynInstPtr inst)

Function to insert an instruction into the ROB.

Note that whatever calls this function must ensure that there is enough space within the ROB for the new instruction.

Parameters
instThe instruction being inserted into the ROB.

Definition at line 204 of file rob_impl.hh.

References DPRINTF.

Referenced by DefaultCommit< Impl >::getInsts().

◆ isDoneSquashing() [1/2]

template<class Impl >
bool ROB< Impl >::isDoneSquashing ( )

Checks if the ROB is still in the process of squashing instructions for any thread.

◆ isDoneSquashing() [2/2]

template<class Impl >
bool ROB< Impl >::isDoneSquashing ( ThreadID  tid) const
inline

Reads the PC of the oldest head instruction.

Reads the PC of the head instruction of a specific thread. Reads the next PC of the oldest head instruction. Reads the next PC of the head instruction of a specific thread. Reads the sequence number of the oldest head instruction. Reads the sequence number of the head instruction of a specific thread. Reads the PC of the youngest tail instruction. Reads the PC of the tail instruction of a specific thread. Reads the sequence number of the youngest tail instruction. Reads the sequence number of tail instruction of a specific thread. Checks if the ROB is still in the process of squashing instructions.

Return values
Whetheror not the ROB is done squashing.

Definition at line 240 of file rob.hh.

References ROB< Impl >::doneSquashing.

Referenced by DefaultCommit< Impl >::tick().

◆ isEmpty() [1/2]

template<class Impl >
bool ROB< Impl >::isEmpty ( ) const
inline

◆ isEmpty() [2/2]

template<class Impl >
bool ROB< Impl >::isEmpty ( ThreadID  tid) const
inline

Returns if a specific thread's partition is empty.

Definition at line 189 of file rob.hh.

References ROB< Impl >::threadEntries.

◆ isFull() [1/2]

template<class Impl >
bool ROB< Impl >::isFull ( )
inline

Returns if the ROB is full.

Definition at line 177 of file rob.hh.

References ROB< Impl >::numEntries, and ROB< Impl >::numInstsInROB.

◆ isFull() [2/2]

template<class Impl >
bool ROB< Impl >::isFull ( ThreadID  tid)
inline

Returns if a specific thread's partition is full.

Definition at line 181 of file rob.hh.

References ROB< Impl >::numEntries, and ROB< Impl >::threadEntries.

◆ isHeadReady()

template<class Impl >
bool ROB< Impl >::isHeadReady ( ThreadID  tid)

Is the oldest instruction across all threads ready.

Is the oldest instruction across a particular thread ready.

Definition at line 276 of file rob_impl.hh.

Referenced by DefaultCommit< Impl >::commitInsts(), DefaultCommit< Impl >::oldestReady(), and DefaultCommit< Impl >::roundRobin().

◆ name()

template<class Impl >
std::string ROB< Impl >::name

Definition at line 120 of file rob_impl.hh.

◆ numFreeEntries() [1/2]

template<class Impl >
unsigned ROB< Impl >::numFreeEntries

Returns the number of total free entries in the ROB.

Definition at line 307 of file rob_impl.hh.

Referenced by DefaultCommit< Impl >::commit(), DefaultCommit< Impl >::numROBFreeEntries(), DefaultCommit< Impl >::startupStage(), and DefaultCommit< Impl >::tick().

◆ numFreeEntries() [2/2]

template<class Impl >
unsigned ROB< Impl >::numFreeEntries ( ThreadID  tid)

Returns the number of free entries in a specific ROB paritition.

Definition at line 314 of file rob_impl.hh.

◆ readHeadInst()

template<class Impl >
const Impl::DynInstPtr & ROB< Impl >::readHeadInst ( ThreadID  tid)

Returns pointer to the head instruction within the ROB.

There is no guarantee as to the return value if the ROB is empty.

Return values
Pointerto the DynInst that is at the head of the ROB. Returns a pointer to the head instruction of a specific thread within the ROB.
Returns
Pointer to the DynInst that is at the head of the ROB.

Definition at line 508 of file rob_impl.hh.

Referenced by DefaultCommit< Impl >::commitInsts(), DefaultCommit< Impl >::oldestReady(), DefaultCommit< Impl >::squashAll(), and DefaultCommit< Impl >::tick().

◆ readTailInst()

template<class Impl >
Impl::DynInstPtr ROB< Impl >::readTailInst ( ThreadID  tid)

Returns pointer to the tail instruction within the ROB.

There is no guarantee as to the return value if the ROB is empty.

Return values
Pointerto the DynInst that is at the tail of the ROB. Returns a pointer to the tail instruction of a specific thread within the ROB.
Returns
Pointer to the DynInst that is at the tail of the ROB.

Definition at line 523 of file rob_impl.hh.

◆ resetEntries()

template<class Impl >
void ROB< Impl >::resetEntries

Re-adjust ROB partitioning.

Definition at line 151 of file rob_impl.hh.

Referenced by DefaultCommit< Impl >::startupStage().

◆ resetState()

template<class Impl >
void ROB< Impl >::resetState
private

Reset the ROB state.

Definition at line 102 of file rob_impl.hh.

Referenced by ROB< Impl >::ROB().

◆ retireHead()

template<class Impl >
void ROB< Impl >::retireHead ( ThreadID  tid)

Retires the head instruction, removing it from the ROB.

Retires the head instruction of a specific thread, removing it from the ROB.

Definition at line 241 of file rob_impl.hh.

References DPRINTF.

Referenced by DefaultCommit< Impl >::commitHead(), and DefaultCommit< Impl >::commitInsts().

◆ setActiveThreads()

template<class Impl >
void ROB< Impl >::setActiveThreads ( std::list< ThreadID > *  at_ptr)

Sets pointer to the list of active threads.

Parameters
at_ptrPointer to the list of active threads.

Definition at line 127 of file rob_impl.hh.

References DPRINTF.

Referenced by DefaultCommit< Impl >::startupStage().

◆ squash()

template<class Impl >
void ROB< Impl >::squash ( InstSeqNum  squash_num,
ThreadID  tid 
)

Squashes all instructions younger than the given sequence number for the specific thread.

Definition at line 478 of file rob_impl.hh.

References DPRINTF.

Referenced by DefaultCommit< Impl >::commit(), and DefaultCommit< Impl >::squashAll().

◆ takeOverFrom()

template<class Impl >
void ROB< Impl >::takeOverFrom

Takes over another CPU's thread.

Definition at line 144 of file rob_impl.hh.

Referenced by DefaultCommit< Impl >::takeOverFrom().

◆ updateHead()

template<class Impl >
void ROB< Impl >::updateHead

Updates the head instruction with the new oldest instruction.

Definition at line 398 of file rob_impl.hh.

◆ updateTail()

template<class Impl >
void ROB< Impl >::updateTail

Updates the tail instruction with the new youngest instruction.

Definition at line 440 of file rob_impl.hh.

Member Data Documentation

◆ activeThreads

template<class Impl >
std::list<ThreadID>* ROB< Impl >::activeThreads
private

Active Threads in CPU.

Definition at line 268 of file rob.hh.

◆ cpu

template<class Impl >
O3CPU* ROB< Impl >::cpu
private

Pointer to the CPU.

Definition at line 265 of file rob.hh.

◆ doneSquashing

template<class Impl >
bool ROB< Impl >::doneSquashing[Impl::MaxThreads]
private

Is the ROB done squashing.

Definition at line 318 of file rob.hh.

Referenced by ROB< Impl >::isDoneSquashing().

◆ dummyInst

template<class Impl >
DynInstPtr ROB< Impl >::dummyInst

Dummy instruction returned if there are no insts left.

Definition at line 311 of file rob.hh.

◆ head

template<class Impl >
InstIt ROB< Impl >::head

Iterator pointing to the instruction which is the first instruction in in the ROB.

Definition at line 294 of file rob.hh.

◆ instList

template<class Impl >
std::list<DynInstPtr> ROB< Impl >::instList[Impl::MaxThreads]
private

ROB List of Instructions.

Definition at line 280 of file rob.hh.

Referenced by ROB< Impl >::findInst().

◆ maxEntries

template<class Impl >
unsigned ROB< Impl >::maxEntries[Impl::MaxThreads]
private

Max Insts a Thread Can Have in the ROB.

Definition at line 277 of file rob.hh.

Referenced by ROB< Impl >::getMaxEntries(), and ROB< Impl >::ROB().

◆ numEntries

template<class Impl >
unsigned ROB< Impl >::numEntries
private

Number of instructions in the ROB.

Definition at line 271 of file rob.hh.

Referenced by ROB< Impl >::isFull(), and ROB< Impl >::ROB().

◆ numInstsInROB

template<class Impl >
int ROB< Impl >::numInstsInROB

Number of instructions in the ROB.

Definition at line 308 of file rob.hh.

Referenced by ROB< Impl >::isEmpty(), and ROB< Impl >::isFull().

◆ numThreads

template<class Impl >
ThreadID ROB< Impl >::numThreads
private

Number of active threads.

Definition at line 321 of file rob.hh.

Referenced by ROB< Impl >::ROB().

◆ robPolicy

template<class Impl >
SMTQueuePolicy ROB< Impl >::robPolicy
private

ROB resource sharing policy for SMT mode.

Definition at line 81 of file rob.hh.

Referenced by ROB< Impl >::ROB().

◆ robStatus

template<class Impl >
Status ROB< Impl >::robStatus[Impl::MaxThreads]
private

Per-thread ROB status.

Definition at line 78 of file rob.hh.

◆ squashedSeqNum

template<class Impl >
InstSeqNum ROB< Impl >::squashedSeqNum[Impl::MaxThreads]
private

The sequence number of the squashed instruction.

Definition at line 315 of file rob.hh.

◆ squashIt

template<class Impl >
InstIt ROB< Impl >::squashIt[Impl::MaxThreads]
private

Iterator used for walking through the list of instructions when squashing.

Used so that there is persistent state between cycles; when squashing, the instructions are marked as squashed but not immediately removed, meaning the tail iterator remains the same before and after a squash. This will always be set to cpu->instList.end() if it is invalid.

Definition at line 304 of file rob.hh.

◆ squashWidth

template<class Impl >
unsigned ROB< Impl >::squashWidth
private

Number of instructions that can be squashed in a single cycle.

Definition at line 283 of file rob.hh.

◆ stats

template<class Impl >
ROB::ROBStats ROB< Impl >::stats
private

◆ tail

template<class Impl >
InstIt ROB< Impl >::tail

Iterator pointing to the instruction which is the last instruction in the ROB.

This may at times be invalid (ie when the ROB is empty), however it should never be incorrect.

Definition at line 290 of file rob.hh.

◆ threadEntries

template<class Impl >
unsigned ROB< Impl >::threadEntries[Impl::MaxThreads]
private

Entries Per Thread.

Definition at line 274 of file rob.hh.

Referenced by ROB< Impl >::getThreadEntries(), ROB< Impl >::isEmpty(), and ROB< Impl >::isFull().


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

Generated on Wed Sep 30 2020 14:02:30 for gem5 by doxygen 1.8.17