← Back to Labs

Branch Predictor: 2-Bit Saturating Counter

Walk through a loop and watch the predictor learn the taken pattern, then mispredict on the final exit

SNpredict NTWNpredict NTWTpredict TSTpredict Titeration: 1 / 8predictedNOT TAKENactualTAKEN✗ MISPREDICTEDcounter: Weakly Taken (02b)
Step 1 / 8Cold Start (iter 1)

The loop branch is seen for the first time. The 2-bit counter starts at Weakly Not-Taken, so the predictor guesses the branch will NOT be taken. But the loop iterates, so the branch IS taken. Misprediction. The counter moves toward Taken.

Arrow keys · R to reset

Tap dots to jump

Read the full article →Take the quiz →