Quiz2 Sol
Quiz2 Sol
Assume that the current state of the global history register is: ghist[5:0] = 101010 and the current
branch PC is PC[31:0]= 00000000000000001000011101010100. You are asked to predict and
update (if needed) a perceptron branch predictor that has a threshold of value θ=3 and has the
following predictor table.
address w5 w4 w3 w2 w1 w0
000 1 3 3 3 -1 1
001 2 -1 0 6 -4 2
010 7 4 -5 -2 -4 7
011 6 -4 1 -2 7 6
100 -2 6 -5 6 2 -2
101 -3 1 6 -7 -2 -3
110 -4 6 6 -2 -4 -4
111 -5 -7 3 1 -2 5
Here is a copy of the perceptron branch predictor slide taught in class for your reference.
(Quiz 2 continued)
Answer the following questions using the information we provided:
Hash function:
b) Assume the branch is not taken, how will you update the predictor state, if any? Enter the
updated weights in the table below and show your steps.
addres w w w w w w
s 5 4 3 2 1 0
000 1 3 3 3 -1 1
001 2 -1 0 6 -4 2
010 7 4 -5 -2 -4 7
011 6 -4 1 -2 7 6
100 -2 6 -5 6 2 -2
101 -3 1 6 -7 -2 -3
110 -4 6 6 -2 -4 -4
111 -5 -7 3 1 -2 5
Update:
wi = wi+t*xi
wi = wi+t*xi = wi - ghist[i-1]
w0 = w0 -1 = 7-1 = 6
w1 = w1 +1 = -4 +1 = -3
w2 = w2 -1 = -2 - 1 = -3
w3 = w3 +1 = -5 + 1 = -4
w4 = w4 -1 = 4 - 1 = 3
w5 = w5 +1 = 7 + 1 = 8