Simulated instruction re-order buffer. More...
#include <ReorderBuffer.h>
Public Member Functions | |
| ReorderBuffer (unsigned int numSlots, unsigned int numRetireablePerCycle, bool fake=false) | |
| Constructor: create and clear data. | |
| ~ReorderBuffer () | |
| Destructor: report stats. | |
| bool | dispatch (Token *token, CycleCount atCycle) |
| Dispatch an instruction to the reorder buffer. | |
| bool | isFull () |
| True if buffer is currently full. | |
| void | incFullStall () |
| int | updateStatus (CycleCount currentCycle) |
| Update: retire instructions in order, or cancel instructions. | |
| InstructionCount | retiredCount () |
Simulated instruction re-order buffer.
This class is responsible for retiring instructions in order and for canceling all outstanding instructions in case of a branch mispredict. It was expected to be a singleton class, but we are currently instantiating a second object which acts as a "fake" retirement buffer for fake LEA instructions that are created for FP instructions that have a memop on them. This way the fake LEAs are not counted, but are retired and cleaned up properly (ooh, except for mispredicted branches! -- does it matter?)
| ReorderBuffer::ReorderBuffer | ( | unsigned int | numSlots, | |
| unsigned int | numRetireablePerCycle, | |||
| bool | fake = false | |||
| ) |
Constructor: create and clear data.
| numSlots | is the total number of instruction slots in the buffer | |
| numRetireablePerCycle | is the maximum # of instructions retireable per cycle |
| bool ReorderBuffer::dispatch | ( | Token * | token, | |
| CycleCount | atCycle | |||
| ) |
Dispatch an instruction to the reorder buffer.
This assumes that isFull() was already checked; it will silently fail to add the instruction if the buffer is full.
| token | is the instruction to add to the buffer | |
| atCycle | is the cycle count at which it is being added |
| int ReorderBuffer::updateStatus | ( | CycleCount | currentCycle | ) |
Update: retire instructions in order, or cancel instructions.
This retires instructions in order, only up to numPerCycle per cycle, and if it hits a mispredicted branch instruction, it cancels all instructions behind it. The counter 'retireSlot' is an index that is always pointing to the next instruction in-order that should retire.
| currentCycle | is the current cycle count |
References Token::cancelInstruction(), and Token::retireInstruction().
Referenced by McOpteron::simCycle().
1.7.1