gem5 v24.0.0.0
|
#include <rob.hh>
Classes | |
struct | ROBStats |
Public Types | |
enum | Status { Running , Idle , ROBSquashing } |
Possible ROB statuses. More... | |
typedef std::pair< RegIndex, RegIndex > | UnmapInfo |
typedef std::list< DynInstPtr >::iterator | InstIt |
Public Member Functions | |
ROB (CPU *_cpu, const BaseO3CPUParams ¶ms) | |
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 DynInstPtr & | readHeadInst (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. | |
CPU * | cpu |
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< DynInstPtr > | instList [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 |
typedef std::list<DynInstPtr>::iterator gem5::o3::ROB::InstIt |
typedef std::pair<RegIndex, RegIndex> gem5::o3::ROB::UnmapInfo |
gem5::o3::ROB::ROB | ( | CPU * | _cpu, |
const BaseO3CPUParams & | params ) |
ROB constructor.
_cpu | The cpu object pointer. |
params | The 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.
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().
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().
size_t gem5::o3::ROB::countInsts | ( | ThreadID | tid | ) |
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().
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().
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.
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().
|
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().
|
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().
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.
inst | The 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().
bool gem5::o3::ROB::isDoneSquashing | ( | ) |
Checks if the ROB is still in the process of squashing instructions for any thread.
|
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.
Whether | or not the ROB is done squashing. |
Definition at line 249 of file rob.hh.
References doneSquashing.
Referenced by gem5::o3::Commit::tick().
|
inline |
Returns if the ROB is empty.
Definition at line 194 of file rob.hh.
References numInstsInROB.
Referenced by gem5::o3::Commit::commit(), drainSanityCheck(), gem5::o3::Commit::getCommittingThread(), gem5::o3::Commit::isDrained(), gem5::o3::Commit::oldestReady(), gem5::o3::CPU::removeInstsNotInROB(), gem5::o3::CPU::removeThread(), squash(), gem5::o3::Commit::squashAll(), and gem5::o3::Commit::tick().
|
inline |
Returns if a specific thread's partition is empty.
Definition at line 198 of file rob.hh.
References threadEntries.
|
inline |
Returns if the ROB is full.
Definition at line 186 of file rob.hh.
References numEntries, and numInstsInROB.
|
inline |
Returns if a specific thread's partition is full.
Definition at line 190 of file rob.hh.
References numEntries, and threadEntries.
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().
std::string gem5::o3::ROB::name | ( | ) | const |
Definition at line 121 of file rob.cc.
References cpu, and gem5::Named::name().
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().
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.
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.
Pointer | to the DynInst that is at the head of the ROB. Returns a pointer to the head instruction of a specific thread within 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().
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.
Pointer | to the DynInst that is at the tail of the ROB. Returns a pointer to the tail instruction of a specific thread within the ROB. |
Definition at line 516 of file rob.cc.
References instList.
Referenced by gem5::o3::CPU::removeInstsNotInROB().
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().
|
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().
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().
Sets pointer to the list of active threads.
at_ptr | Pointer to the list of active threads. |
Definition at line 127 of file rob.cc.
References activeThreads, and DPRINTF.
Referenced by gem5::o3::Commit::startupStage().
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().
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().
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().
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().
Active Threads in CPU.
Definition at line 277 of file rob.hh.
Referenced by canCommit(), resetEntries(), setActiveThreads(), updateHead(), and updateTail().
|
private |
Pointer to the CPU.
Definition at line 274 of file rob.hh.
Referenced by doSquash(), name(), and retireHead().
|
private |
Is the ROB done squashing.
Definition at line 327 of file rob.hh.
Referenced by doSquash(), isDoneSquashing(), resetState(), and squash().
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().
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().
|
private |
ROB List of Instructions.
Definition at line 289 of file rob.hh.
Referenced by countInsts(), doSquash(), drainSanityCheck(), findInst(), insertInst(), isHeadReady(), readHeadInst(), readTailInst(), resetState(), retireHead(), squash(), updateHead(), and updateTail().
|
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().
|
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().
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().
|
private |
Number of active threads.
Definition at line 330 of file rob.hh.
Referenced by countInsts(), drainSanityCheck(), resetEntries(), and ROB().
|
private |
ROB resource sharing policy for SMT mode.
Definition at line 90 of file rob.hh.
Referenced by entryAmount(), resetEntries(), and ROB().
|
private |
|
private |
The sequence number of the squashed instruction.
Definition at line 324 of file rob.hh.
Referenced by doSquash(), resetState(), and squash().
|
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().
|
private |
Number of instructions that can be squashed in a single cycle.
Definition at line 292 of file rob.hh.
Referenced by doSquash().
|
private |
Referenced by doSquash(), insertInst(), isHeadReady(), and retireHead().
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().
|
private |
Entries Per Thread.
Definition at line 283 of file rob.hh.
Referenced by getThreadEntries(), insertInst(), isEmpty(), isFull(), isHeadReady(), numFreeEntries(), readHeadInst(), resetState(), and retireHead().