A processor executes all non?branch instructions in one cycle. This processor implements branch prediction, which incurs an additional penalty of 2 cycles if the prediction is correct and 4 cycles if the prediction is incorrect.
a. If conditional branch instructions occupy 15% of the instruction stream, and the probability of an incorrect
branch prediction is 20%, what is the average number of cycles per instruction?
b. If the same processor is to run no less than 28% slower than a machine with a zero branch penalty when up
to 20% of the instructions are conditional branches, what level of accuracy must the branch prediction
achieve on average?
a. CPI = non?branch cycles + branch cycles (correct prediction) + branch cycles (incorrect prediction)
= 0.85 × 1 + 0.15(0.80 × 2 + 0.20 × 4) = 0.85 + 0.15(2.4) = 0.85 + 0.36 = 1.21 CPI
b. A machine with a zero branch penalty runs at 1.0 CPI.
CPI = 0.80 + 0.20(Pc × 2 + (1 ? Pc) × 4) = 0.8 + 0.20(4 ? 2Pc) = 0.85 + 0.80 ? 0.4Pc = 1.65 ? 0.4Pc.
This must not be 28% less than a machine with no branch penalties; that is 1.65 ? 0.4Pc = 1.28 and Pc = (1.65 ?
1.28)/0.40 = 0.925; that is the branch prediction must be about 93% accurate.
You might also like to view...
Which of the following stream manipulators causes an outputted number’s sign to be left justified, its magnitude to be right justified and the center space to be filled with fill characters?
a. left b. right c. internal d. showpos
An exception should be
a) Used within a function b) Thrown outside a try block c) Listed in an exception specification for the function where the exception is thrown d) Thrown in a different function than it is caught in. (If you select this, tell how are these functions related?) e) Reserved for a situation where the way an exception should be handled depends on how and where the function is used
Flowing text (also known as ____________________text) into text boxes can be compared to pouring a pitcher of water into a series of water glasses until there is no more water to pour.
Fill in the blank(s) with the appropriate word(s).
A(n) ________ is a vertical line that separates columns of text
Fill in the blank(s) with correct word