You are given the following code in C, a (2,1) global history predictor (hint: here we need four columns that each holds predictors of size 1 bit, and a number of rows…) and a 2-bit predictor (i.e., (0,2) predictor)
for (i=100; i>0; i—-) { // Branch1
if (i mod 2 ==0) { //Branch2
………
} else {
……. }
}
Q 1: Which predictor is the most suitable for Branch1 and why?
Q 2: Which predictor is the most suitable for Branch2 and why?
(1)1-bit branch predictor is the most suitable for Branch1 . Because here next branch situation depends mostly on previous outcome , and 1-bit branch predictor (essentially a flip-flop) records the last outcome of the branch.
(2)2-bit branch predictor is the most suitable for Branch2 . Because here next branch situation is independent from previous branch outcome ,and 2-bit branch predictor does not predict branch on basis of last outcome of the branch.
You are given the following code in C, a (2,1) global history predictor (hint: here we need four columns that each holds predictors of size 1 bit, and a number of rows…) and a 2-bit predictor (i.e., (...