# Branch Predictor Animations Bi-modal, Local, Global CS450/650 Andrew Morton.

## Presentation on theme: "Branch Predictor Animations Bi-modal, Local, Global CS450/650 Andrew Morton."— Presentation transcript:

Branch Predictor Animations Bi-modal, Local, Global CS450/650 Andrew Morton

Code Example 1 int i=0, j=3; 2 do { 3 j += 3; 4 b1: if(i == 0) 5 j %= 5; 6 b2: if(j < 2) 7 j++; 8 i++; 9 b3: } while(i<2); lineijb1b2b3 103 lineijb1b2b3 103 36 lineijb1b2b3 103 36 4NT lineijb1b2b3 103 36 4NT 51 lineijb1b2b3 103 36 4NT 51 6 lineijb1b2b3 103 36 4NT 51 6 72 lineijb1b2b3 103 36 4NT 51 6 72 81 lineijb1b2b3 103 36 4NT 51 6 72 81 9T lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T 6T lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T 6T 82 lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T 6T 82 9

Bimodal Predictor (b2) individual 2-bit up/down counter – initial state = 10 lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T 6T 82 9 xx 10 xx counters PC 0110

Local Predictor (b2) shared 2-bit up/down counters – initial states = 10 individual local histories – initialized to 11 lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T 6T 82 9 counters PC10 local histories 11 xx 01 10 11 01

Global Predictor (b1,b2,b3) shared 2-bit up/down counters – initial states = 10 one global history – initialized to 11 lineijb1b2b3 103 36 4NT 51 6 72 81 9T 35 4T 6T 82 9 counters PC10 global history 11 01 10 01 00 11 01