Question: Consider the following code segment within a loop body: if ( n % 2 == 0 ) // branch 1 a++; if ( n %

Consider the following code segment within a loop body: if ( n % 2 == 0 ) // branch 1

a++;

if ( n % 10 == 0 ) // branch 2

b++; Assume that the following list of 10 values of n is to be processed by 10 iterations of this loop:

18, 29, 30, 41, 52, 60, 79, 80, 91, 100 List the predictions for the following branch prediction schemes and calculate the prediction accuracies for each scheme. (a) Always taken.

(b) Always not taken.

(a) 1-bit predictor, initialized to predict taken.

(b) 2-bit predictor, initialized to weakly predict taken.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!