Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume a processor that always predicts that conditional branches are not taken.

ID: 3822064 • Letter: A

Question

Assume a processor that always predicts that conditional branches are not taken. What percentage of the time would it predict correctly for the following block of code? li $r0, 10 topOfLoop: beq $r0, $zero, endLoop add $r1, $r0, $r1 addi $r0, $r0, -1 br topOfLoop endLoop: Percentage Correct: _____ If we modify the hardware so that the first time it encounters a conditional branch it predicts that it is not taken but after that it predicts it will do whatever it did on the previous time it executed the loop what will be the percentage of the time it will predict correctly? Modified Percentage Correct _____

Explanation / Answer

given code is:

lo $r0,10
topOfLoop:
beq $r0,$zero,endLoop
add $r1,$r0,$r1
addi $r0,$r0,-1
br topOfLoop
endLoop:


Then percentage correct ie equal to 83%

Hence ans: 83


If we modify the hardware so that the first time it encounters a conditional branch it predicts that it is not taken but after that it predicts it will do whatever it did on the previous time it executed the loop what will be the percentage of time it will predict correctly?


IN this situation modified percentage is: 66.7%

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote