|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The basic idea is to treat branch predictions as if they are correct, and speculatively execute the resulting instructions. The speculations are verified, and if there is a branch misprediction something special happens to get rid of the mis-speculated instructions.
We do this all in the context of dynamic scheduling, i.e., out-of-order execution. However, now, there is an extra phase in the algorithm, the commit phase. Instructions are committed when we are sure they were supposed to execute, i.e., we know there is no misprediction. Results are held in the reorder buffer (ROB) until they are ready to be committed. The ROB can be thought of as a queue where instructions are dequeued in order, i.e., instructions are fetched in-order, processed out-of-order and placed into the ROB, and then "graduate" in-order again from the ROB. The entries in the reorder buffer now form the virtual register file that physical registers are renamed into (along with results at reservation stations).
Here are the four phases: