The re-order buffer used in the Tomasulo's algorithm for out-of-order execution and branch speculation has 2 pointers.
- Head pointer: Points to the oldest instruction. This will be the next instruction to be committed.
- Tail pointer: Points where the newest instruction will be added.
Each ROB entry has 4 fields: instruction type, destination, value and ready field.
I've seen many sources teaching it this way. The ROB entry doesn't need a committed bit or busy bit.
For a ROB of size N.
- If the ROB is empty or flushed, then TAIL=HEAD.
- If the ROB has one free slot and HEAD=0, then TAIL=N-1.
- If the ROB is full and HEAD=0, then TAIL=?
If TAIL=HEAD how do we know if the ROB is full or empty?