Subject Computer Architecture
1. Suppose the following loop iterates 89 times. Assume a 1-bit predictor is used. Calculate the prediction accuracy of this predictor. Assume the buffer contains 0 initially.
1000 Loop: fld f1, 0(x1)
1004 ......
1008 ......
1012 bne x2, x0, -16
2. Answer Problem 3 using a 2-bit predictor. Assume the buffer contains 00 initially.
3. Consider the code in Example 4, Chapter 3 slides. Assume a ten entry Branch History Table of 2-bit predictor used with initial values of 01, 10, 10. Show the prediction behavior if the following are read into the code via a loop:
aa=2 and bb=3, followed by aa=2 and bb=2, followed by aa=4 and bb=2
Calculate the overall prediction accuracy.
4. a) Display a Branch Target Buffer for the code in Example 6. Assume 2- bits predictor for branches are initially 00, 10, 11.
b) Now assume you execute the code again and this time all three branches are taken. Display the new BTB.
5. State what takes place when each of the following instructions reach the top of ROB and their operands are all available:
a) fld f2, 0(x6)
b) fadd f2, f4, f6
c) fsd f2, 0(x2)
d) addwi x3, x3, #-8
e) bne x3, x0, target (Mispredicted)
f) beq x3, x0, Loop (Predicted Correctly)