gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::o3::ROB Class Reference

ROB class. More...

#include <rob.hh>

Classes

struct  ROBStats
 

Public Types

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

Public Member Functions

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

Public Attributes

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

Private Member Functions

void resetState ()
 Reset the ROB state.
 

Private Attributes

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

Detailed Description

ROB class.

The ROB is largely what drives squashing.

Definition at line 71 of file rob.hh.

Member Typedef Documentation

◆ InstIt

Definition at line 75 of file rob.hh.

◆ UnmapInfo

Definition at line 74 of file rob.hh.

Member Enumeration Documentation

◆ Status

Possible ROB statuses.

Enumerator
Running 
Idle 
ROBSquashing 

Definition at line 78 of file rob.hh.

Constructor & Destructor Documentation

◆ ROB()

gem5::o3::ROB::ROB ( CPU * _cpu,
const BaseO3CPUParams & params )

ROB constructor.

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

Definition at line 58 of file rob.cc.

References DPRINTF, maxEntries, gem5::o3::MaxThreads, numEntries, numThreads, resetState(), and robPolicy.

Member Function Documentation

◆ canCommit()

bool gem5::o3::ROB::canCommit ( )

Is there any commitable head instruction across all threads ready.

Definition at line 279 of file rob.cc.

References activeThreads, and isHeadReady().

◆ countInsts() [1/2]

int gem5::o3::ROB::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 180 of file rob.cc.

References countInsts(), numThreads, and gem5::statistics::total.

Referenced by countInsts(), and gem5::o3::Commit::tick().

◆ countInsts() [2/2]

size_t gem5::o3::ROB::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 191 of file rob.cc.

References instList.

◆ doSquash()

void gem5::o3::ROB::doSquash ( ThreadID tid)

Executes the squash, marking squashed instructions.

Definition at line 309 of file rob.cc.

References cpu, doneSquashing, DPRINTF, instList, gem5::o3::CPU::isThreadExiting(), numEntries, squashedSeqNum, squashIt, squashWidth, stats, updateTail(), and gem5::o3::ROB::ROBStats::writes.

Referenced by squash(), and gem5::o3::Commit::tick().

◆ drainSanityCheck()

void gem5::o3::ROB::drainSanityCheck ( ) const

Perform sanity checks after a drain.

Definition at line 134 of file rob.cc.

References instList, isEmpty(), and numThreads.

Referenced by gem5::o3::Commit::drainSanityCheck().

◆ entryAmount()

int gem5::o3::ROB::entryAmount ( ThreadID num_threads)

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

Definition at line 170 of file rob.cc.

References numEntries, and robPolicy.

◆ findInst()

DynInstPtr gem5::o3::ROB::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 534 of file rob.cc.

References instList.

Referenced by gem5::o3::Commit::commit().

◆ getMaxEntries()

unsigned gem5::o3::ROB::getMaxEntries ( ThreadID tid)
inline

Returns the maximum number of entries for a specific thread.

Definition at line 178 of file rob.hh.

References maxEntries.

Referenced by gem5::o3::Commit::getInsts().

◆ getThreadEntries()

unsigned gem5::o3::ROB::getThreadEntries ( ThreadID tid)
inline

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

Definition at line 182 of file rob.hh.

References threadEntries.

Referenced by gem5::o3::Commit::getInsts().

◆ insertInst()

void gem5::o3::ROB::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 197 of file rob.cc.

References DPRINTF, head, instList, numEntries, numInstsInROB, stats, tail, threadEntries, and gem5::o3::ROB::ROBStats::writes.

Referenced by gem5::o3::Commit::getInsts().

◆ isDoneSquashing() [1/2]

bool gem5::o3::ROB::isDoneSquashing ( )

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

◆ isDoneSquashing() [2/2]

bool gem5::o3::ROB::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 249 of file rob.hh.

References doneSquashing.

Referenced by gem5::o3::Commit::tick().

◆ isEmpty() [1/2]

◆ isEmpty() [2/2]

bool gem5::o3::ROB::isEmpty ( ThreadID tid) const
inline

Returns if a specific thread's partition is empty.

Definition at line 198 of file rob.hh.

References threadEntries.

◆ isFull() [1/2]

bool gem5::o3::ROB::isFull ( )
inline

Returns if the ROB is full.

Definition at line 186 of file rob.hh.

References numEntries, and numInstsInROB.

◆ isFull() [2/2]

bool gem5::o3::ROB::isFull ( ThreadID tid)
inline

Returns if a specific thread's partition is full.

Definition at line 190 of file rob.hh.

References numEntries, and threadEntries.

◆ isHeadReady()

bool gem5::o3::ROB::isHeadReady ( ThreadID tid)

Is the oldest instruction across all threads ready.

Is the oldest instruction across a particular thread ready.

Definition at line 268 of file rob.cc.

References instList, gem5::o3::ROB::ROBStats::reads, stats, and threadEntries.

Referenced by canCommit(), gem5::o3::Commit::commitInsts(), gem5::o3::Commit::getCommittingThread(), gem5::o3::Commit::oldestReady(), and gem5::o3::Commit::roundRobin().

◆ name()

std::string gem5::o3::ROB::name ( ) const

Definition at line 121 of file rob.cc.

References cpu, and gem5::Named::name().

◆ numFreeEntries() [1/2]

unsigned gem5::o3::ROB::numFreeEntries ( )

Returns the number of total free entries in the ROB.

Definition at line 297 of file rob.cc.

References numEntries, and numInstsInROB.

Referenced by gem5::o3::Commit::commit(), gem5::o3::Commit::numROBFreeEntries(), gem5::o3::Commit::startupStage(), and gem5::o3::Commit::tick().

◆ numFreeEntries() [2/2]

unsigned gem5::o3::ROB::numFreeEntries ( ThreadID tid)

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

Definition at line 303 of file rob.cc.

References maxEntries, and threadEntries.

◆ readHeadInst()

const DynInstPtr & gem5::o3::ROB::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 502 of file rob.cc.

References dummyInst, instList, and threadEntries.

Referenced by gem5::o3::Commit::commitInsts(), gem5::o3::Commit::getCommittingThread(), gem5::o3::Commit::oldestReady(), gem5::o3::Commit::squashAll(), and gem5::o3::Commit::tick().

◆ readTailInst()

DynInstPtr gem5::o3::ROB::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 516 of file rob.cc.

References instList.

Referenced by gem5::o3::CPU::removeInstsNotInROB().

◆ resetEntries()

void gem5::o3::ROB::resetEntries ( )

Re-adjust ROB partitioning.

Definition at line 148 of file rob.cc.

References activeThreads, maxEntries, numEntries, numThreads, and robPolicy.

Referenced by gem5::o3::CPU::insertThread(), and gem5::o3::Commit::startupStage().

◆ resetState()

void gem5::o3::ROB::resetState ( )
private

Reset the ROB state.

Definition at line 104 of file rob.cc.

References doneSquashing, head, instList, gem5::o3::MaxThreads, numInstsInROB, squashedSeqNum, squashIt, tail, and threadEntries.

Referenced by ROB(), and takeOverFrom().

◆ retireHead()

void gem5::o3::ROB::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 234 of file rob.cc.

References cpu, DPRINTF, instList, numInstsInROB, gem5::o3::CPU::removeFrontInst(), stats, threadEntries, updateHead(), and gem5::o3::ROB::ROBStats::writes.

Referenced by gem5::o3::Commit::commitHead(), and gem5::o3::Commit::commitInsts().

◆ setActiveThreads()

void gem5::o3::ROB::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.cc.

References activeThreads, and DPRINTF.

Referenced by gem5::o3::Commit::startupStage().

◆ squash()

void gem5::o3::ROB::squash ( InstSeqNum squash_num,
ThreadID tid )

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

Definition at line 473 of file rob.cc.

References doneSquashing, doSquash(), DPRINTF, instList, isEmpty(), ROBSquashing, robStatus, squashedSeqNum, and squashIt.

Referenced by gem5::o3::Commit::commit(), and gem5::o3::Commit::squashAll().

◆ takeOverFrom()

void gem5::o3::ROB::takeOverFrom ( )

Takes over another CPU's thread.

Definition at line 142 of file rob.cc.

References resetState().

Referenced by gem5::o3::Commit::takeOverFrom().

◆ updateHead()

void gem5::o3::ROB::updateHead ( )

Updates the head instruction with the new oldest instruction.

Definition at line 395 of file rob.cc.

References activeThreads, head, and instList.

Referenced by retireHead().

◆ updateTail()

void gem5::o3::ROB::updateTail ( )

Updates the tail instruction with the new youngest instruction.

Definition at line 436 of file rob.cc.

References activeThreads, instList, and tail.

Referenced by doSquash().

Member Data Documentation

◆ activeThreads

std::list<ThreadID>* gem5::o3::ROB::activeThreads
private

Active Threads in CPU.

Definition at line 277 of file rob.hh.

Referenced by canCommit(), resetEntries(), setActiveThreads(), updateHead(), and updateTail().

◆ cpu

CPU* gem5::o3::ROB::cpu
private

Pointer to the CPU.

Definition at line 274 of file rob.hh.

Referenced by doSquash(), name(), and retireHead().

◆ doneSquashing

bool gem5::o3::ROB::doneSquashing[MaxThreads]
private

Is the ROB done squashing.

Definition at line 327 of file rob.hh.

Referenced by doSquash(), isDoneSquashing(), resetState(), and squash().

◆ dummyInst

DynInstPtr gem5::o3::ROB::dummyInst

Dummy instruction returned if there are no insts left.

Definition at line 320 of file rob.hh.

Referenced by readHeadInst().

◆ head

InstIt gem5::o3::ROB::head

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

Definition at line 303 of file rob.hh.

Referenced by insertInst(), resetState(), and updateHead().

◆ instList

std::list<DynInstPtr> gem5::o3::ROB::instList[MaxThreads]
private

◆ maxEntries

unsigned gem5::o3::ROB::maxEntries[MaxThreads]
private

Max Insts a Thread Can Have in the ROB.

Definition at line 286 of file rob.hh.

Referenced by getMaxEntries(), numFreeEntries(), resetEntries(), and ROB().

◆ numEntries

unsigned gem5::o3::ROB::numEntries
private

Number of instructions in the ROB.

Definition at line 280 of file rob.hh.

Referenced by doSquash(), entryAmount(), insertInst(), isFull(), isFull(), numFreeEntries(), resetEntries(), and ROB().

◆ numInstsInROB

int gem5::o3::ROB::numInstsInROB

Number of instructions in the ROB.

Definition at line 317 of file rob.hh.

Referenced by insertInst(), isEmpty(), isFull(), numFreeEntries(), resetState(), and retireHead().

◆ numThreads

ThreadID gem5::o3::ROB::numThreads
private

Number of active threads.

Definition at line 330 of file rob.hh.

Referenced by countInsts(), drainSanityCheck(), resetEntries(), and ROB().

◆ robPolicy

SMTQueuePolicy gem5::o3::ROB::robPolicy
private

ROB resource sharing policy for SMT mode.

Definition at line 90 of file rob.hh.

Referenced by entryAmount(), resetEntries(), and ROB().

◆ robStatus

Status gem5::o3::ROB::robStatus[MaxThreads]
private

Per-thread ROB status.

Definition at line 87 of file rob.hh.

Referenced by squash().

◆ squashedSeqNum

InstSeqNum gem5::o3::ROB::squashedSeqNum[MaxThreads]
private

The sequence number of the squashed instruction.

Definition at line 324 of file rob.hh.

Referenced by doSquash(), resetState(), and squash().

◆ squashIt

InstIt gem5::o3::ROB::squashIt[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 313 of file rob.hh.

Referenced by doSquash(), resetState(), and squash().

◆ squashWidth

unsigned gem5::o3::ROB::squashWidth
private

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

Definition at line 292 of file rob.hh.

Referenced by doSquash().

◆ stats

gem5::o3::ROB::ROBStats gem5::o3::ROB::stats
private

◆ tail

InstIt gem5::o3::ROB::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 299 of file rob.hh.

Referenced by insertInst(), resetState(), and updateTail().

◆ threadEntries

unsigned gem5::o3::ROB::threadEntries[MaxThreads]
private

Entries Per Thread.

Definition at line 283 of file rob.hh.

Referenced by getThreadEntries(), insertInst(), isEmpty(), isFull(), isHeadReady(), numFreeEntries(), readHeadInst(), resetState(), and retireHead().


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

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