hw2_solutionc - HW2 Solutions 1. (P5.7) Assume that an...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
HW2 Solutions 1. (P5.7) Assume that an one-bit (history bit) state machine is used as the prediction algorithm for predicting the execution of the two branches in this loop. Indicate the predicted and actual branch directions of the b1 and b2 branch instructions for each iteration of this loop. Assume initial state of 0, i.e., NT, for the predictor. Consider the following code segment within a loop body for problems 5: if (x is even) then b (branch b1) increment a b (b1 taken) if (x is a multiple of 10) then b (branch b2) increment b b (b2 taken) Use this trace instead: 9, 8, 20, 13, 20, 40, 18, 31, 32 9 8 20 13 20 40 18 31 32 b1 predicted: __N____N____T____T____N____T____T____T____N__ b1 actual: __N____T____T____N____T____T____T____N____T__ b2 predicted: __N____N____N____T____N____T____T____N____N__ b2 actual: __N____N____T____N____T____T____N____N____N__
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. (P5.10) Assume a two-level branch prediction scheme is used. In addition to the one-bit pre- dictor, a one-bit global register (g) is used. Register g stores the direction of the last branch executed (which may not be the same branch as the branch currently being predicted) and is used to index into two separate one-bit branch history tables (BHTs) as shown below. Use this trace instead: 9, 8, 20, 13, 20, 40, 18, 31, 32
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

hw2_solutionc - HW2 Solutions 1. (P5.7) Assume that an...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online