Structure
A typical entry in the reorder buffer can be visualized as:
Busy
|
Instruction
Type
|
Validity
|
Register
Affected
|
Data
|
1 bit
|
2 bit
|
1 bit
|
3 bit
|
16 bits
|
The values shown above are in accordance with the designed mini-superscalar processor. Whenever an instruction is decoded, an entry is allotted to it in the reorder buffer. Index corresponding to this is returned to the corresponding instruction. The busy bit is set to '1' whenever an entry is allotted to an instruction and is cleared to '0' whenever the instruction is declared as completed.
Completion: An instruction is changed to be completed when all of its preceding instructions are completed. To manage this, a register (R_old) is defined which holds the index value to the oldest instruction. If the validity of this is set to '1' by the execute stage, this instruction is marked to be completed and is transferred to the Complete stage, from where it is then retired.
Reorder Buffer is a circular buffer. We also keep another register (R_new) which holds the index value to the newest entered instruction. If and when R_old = R_new, we stall the instruction fetch and decode to stop getting new instructions. The structure of a Re-order buffer can be visualized as:
Control Hardware
The control part of the ROB has to take care of three basic functions:
- Receiving and managing instructions coming from decode
- Updating the ROB on receiving the broadcasts from the execute
- Transferring the completed instructions to the Complete Stage in-order
Adding new Instructions
The following tasks are needed to be performed on receiving new instructions:
- Allot an empty (busy_bit = '0') entry to the new incoming instruction
- Send the entry tag back to the decode
- Set the busy bit of the entry to '1'
- Change the other contents of the entry registers.
The following tasks are needed to be performed on receiving a valid broadcast:
- Set the validity bit to '1' corresponding to the broadcast tag.
- Enter the data (if any) into the data entry corresponding to the tag.
Handling the completed instructions
The following tasks are needed to be performed:
- Finding the top 2 (or 1) instructions that can be transferred to complete stage. Done by using the bottom pointer.
- Transferring the above found instructions.
- Updating the bottom pointer.
- Changing the busy bit of the corresponding entry of the ROB freed
Comments
Post a Comment