A ROB is an extension to Tomasulo's Algorithm that allows us to:
Tranks to the ROB, instructions can execute out-of-order but commit always in-order.
The structures are similar to what we already know of Tomasulo's Machine. The main differences consist in that a Reorder Buffer is added to temporary store the order and result of instructions. There is no store buffer for memory store operations because the ROB already contains them. Appart from that, the instructions are sent to the Reservation Stations labeled with the ROB entry number, that way, when the result is broadcast through the Commmon Data Bus, all RS, and the ROB itself, can get the result they are waiting for. As you can see, the ROB can be now another source for the operands sent to the Reservation Stations. The Registers and memory are written when an instruction Commits.
ROBMachine.pptx file.
A typical ROB will look like this:
Instruction | Destination | Result |
---|---|---|
flw f1,34(t0) | F1 | null |
fsw f2,45(t1) | Mem[55] | 10 |
fmul.s f3,f2,f4 | F3 | null |
fsub.s f5,f1,f2 | F5 | 34 |
fdiv.s f0,f3,f1 | F0 | null |
fadd.s f1,f5,f2 | F1 | 56 |
If there is a free slot in the ROB and a free Reservation Station, send there the instruction. If the operands of the instruction are available either in the ROB or the registers, copy them too to the R.S.
If all operands are ready, send the instruction to the Functional Units and execute them. Otherwise, wait.
When the result of the operation is available, send it through the Common Data Bus to the ROB and all Reservation Stations waiting for it.
When an operation reaches the head of the ROB and it has its result, write the operation results to the register or memory. In case that what hits the head of the ROB is a mispredicted branch, flush the ROB and restart execution at the right instruction. If prediction was correct, the branch is finished.
I haven't been able to find much information on how the ROB interacts with the integer pipeline, and all texts I've found are vague about it, which is strange considering how tightly related are ROB and branches, but I've managed to pull an example, cycle by cycle, guessing how it would work here:
I recommend you this Computer Architecture course. It's free and has a lot of information you won't find elsewhere.