Consider the following code segment for a loop: int a = 3, b = 4; int x; if (x is a multiplication of 3) <-- branch b1 increment a <-- b1 taken else <-- b1 not taken increment b Assume that the following list of 10 values of x is processed by 10 iterations of this code: 7, 6, 10, 11, 9, 5, 3, 13, 2, 17 Assume that a two-bit branch prediction scheme is used. For each iteration of the loop, show the prediction and state of the two-bit branch predictor (the predicted direction) and the actual branch direction of the b1 branch instructions. The first iteration has been filled in already. 1 = Taken, 0 = Not Taken. 00 = Strongly Not Taken (Initial state of 2-bit predictor), 01: weakly NT, 10: Strongly Taken, 11: weakly Taken. What is the misprediction rate for branch b1? Iteration 1 2 3 4 5 6 7 8 9 10 b1 (prediction /actual) 00 / /
Important topics Cache addressing; LRU replacement policy; AMAT Defining number of bits needed for PO, VPN, PFN in single/multi-level page tables. Pipeline design; Understanding data/control dependency; being able to draw the space-time diagram with and without forwarding… Single-bit/double-bit branch predictors