Question: Question 2 . [ Loop Unrolling ] [ 3 0 pts ] Consider the following loop in a simple assembly language, which is executed on
Question Loop Unrolling pts
Consider the following loop in a simple assembly language, which is executed on a stage RISC pipeline:
Loop: ld xx # Load value from memory address x into register x
addi x x # Increment x by
sd xx # Store the updated value of x back to memory address x
addi x x # Increment x by to point to the next memory location
sub x x x # Decrement the loop counter x
bnez x Loop # Branch back to Loop if x is not zero
Assume that the loop runs times initially and that the pipeline has full forwardingbypassing hardware, but branches cause a cycle penalty when mispredicted. Additionally, memory references loads and stores take cycle each.
a pts Unroll the loop times. Show the unrolled version of the loop.
b pts Compare the performance number of cycles of the original loop and the unrolled loop, assuming perfect branch prediction after unrolling.
c pts Calculate the speedup achieved as a result of unrolling
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
