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

Solutions to quiz 4 of the cs433ug computer system organization course. It includes the drawing of an equivalent state transition diagram for a branch predictor and the writing of a loop that will be mis-predicted by a one-bit branch prediction scheme. Additionally, it provides answers to questions regarding tomasulo's algorithm, including the identification and elimination of dependencies using the algorithm.

Typology: Quizzes

Pre 2010

Uploaded on 03/10/2009

koofers-user-63t
koofers-user-63t 🇺🇸

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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.