Docsity

CS433ug Quiz 4: Computer System Organization - Branch Prediction and Tomasulo's Algorithm, Quizzes of Computer Architecture and Organization

Toggle sidebar
bg1
CS433ug: Computer System Organization
Quiz 4
Show all of your work.
If you believe a problem is incorrectly or incompletely specified, make a reasonable
assumption and solve the problem. The assumption should not result in a trivial
solution. In all cases, clearly state any assumptions that you make in your answers.
1. [15 pts] Branch Prediction
a) [5 pts] The figure shows the state transition diagram of a branch predictor. Please draw a
smallest state transition diagram (with the smallest number of states) that is equivalent to this
figure.
Solution:
pf3

Partial preview of the text

Download CS433ug Quiz 4: Computer System Organization - Branch Prediction and Tomasulo's Algorithm and more Quizzes Computer Architecture and Organization in PDF only on Docsity!

CS433ug: Computer System Organization

Quiz 4

Show all of your work. If you believe a problem is incorrectly or incompletely specified, make a reasonable assumption and solve the problem. The assumption should not result in a trivial solution. In all cases, clearly state any assumptions that you make in your answers.

1. [15 pts] Branch Prediction

a) [5 pts] The figure shows the state transition diagram of a branch predictor. Please draw a smallest state transition diagram (with the smallest number of states) that is equivalent to this figure.

Solution:

b) [10 pts] Write a loop which contains a branch that will be completely mis-predicted by a one-bit branch prediction scheme (i.e. the loop should contain an if statement which the one-bit predictor will always mis-predict).

Solution:

Here’s one example of such a loop: for (i=0; i<100; i++) { if ( (i % 2) ==0 ) { printf(“even \n”); } else { printf(“odd \n”)‘ } } The one-bit predictor predicts that the branch in the “if” statement will go the same direction it did the last time. By creating a statement which alternates between taken and not taken, we cause the one-bit predictor to mis-predict every time.

2 [15 pts] Tomasulo’s Algorithm

DIVD F1, F2, F

MULTD F1, F4, F

ADDD F4, F5, F

ADDD F5, F4, F

STORE F5, 8(R1)

a) [10 pts] List all the dependences in the code fragment and indicate what kind of dependences they are.