

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 3
This page cannot be seen from the preview
Don't miss anything!


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.
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.
a) [10 pts] List all the dependences in the code fragment and indicate what kind of dependences they are.