Static Branch Prediction Flashcards
Control Hazards
Can also be called branch hazards. When the pipeline makes a wrong decisions when predicting branch taken or not taken and has the wrong instructions in the pipeleine.
Structural Hazard
Two instructions in the pipeline access the same resource. Resolve by executing in series, done by stalling.
Every instruction has a unique PC. True or False?
True. That is why we can use the PC to index in the predictor table
1 and 2 bit saturating counter
You update the prediction after every outcome. When it hits 0 and 1 OR 00 and 11, it cannot go higher. So it stays the same.
Branch prediction buffer
indexed by some sort of address
Branch target buffer
has a tag and partial data of target location for instructions. Use tag to find matching PC address with same tag bits.
Aliasing
When two or more branches with different PC mapped/access the same row in the predictor table
Return Address Stack
A FIFO stack. Before a branch instruction branches/jumps, the PC+4 address is saved to the RAS stack. When an instruction returns, the top value of the stack is taken
Interrupts and Exceptions can occur at any stage of the pipeline. True or false?
True. The program can trigger an interrupt at any instruction and the program might get set an interrupt by the computer anytime.
Precise State/Precise Interrupts
When the OS saves the current processor state including the architecture register values and current PC in order to return to the right state. The instructions following the i that caused the interrupt are turned to NOPs.
History bits
history bits means it can predict the outcome based on previous sets of outcomes
1 bit state machine with 1 history bit
able to learn the outcome if the previous outcome was 0 or 1. Learns the outcome when the history is 1 or 0.
2 level predictor with 2 history bits
able to learn the outcome based on two previous outcomes.
Size of pattern history table
if size of pattern history table»_space; no. of instructions in program, there will be no aliasing. Every 2^n instructions will index to the same entry.
Gap
global history register (so it includes history for all branches) + private predictor tables (the state of every branch is seperate)