Question: Consider the following loop. LOOP: LDUR X 1 0 , [ X 1 , # 0 ] LDUR x 1 1 , [ x 1

Consider the following loop.
LOOP: LDUR X10,[X1, #0]
LDUR x11,[x1,#8]
ADD 12,x10,x11
STUR x12,[x1,#-8]
SUBI X1, X1, #16
CBNZ X12, LOOP
(a) Assume that data and control hazards are handled by simply stalling the pipeline (i.e. inserting NOP instructions where necessary). Show the pipeline timing diagram of the code execution.
\table[[Cycle number:,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[LOOP: LDUR X10,[X1, #0],IF,ID,EX,ME,WB,,,,,,,,,,,,,,,],[LDUR X11,[X1, #8],,IF,,,,,,,,,,,,,,,,,,],[ADD X12, X10, X11,,,,,,,,,,,,,,,,,,,,],[STUR X12,x1,#-8,,,,,,,,,,,,,,,,,,,,],[SUBI X1, X1, #16,,,,,,,,,,,,,,,,,,,,],[CBNZ X12, LOOP,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,],[2nd iteration: LDUR X10,[X1, #0],,,,,,,,,,,,,,,,,,,,]]
(b) Can you reorder the code to reduce the number of stalls? If yes, show the reordered code.
(c) Show the pipeline timing diagram of the code execution with data forwarding and assume that the branch is handled by predicting it as taken and the branch target address is calculated at the ID stage.
\table[[Cycle number:,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],[LOOP: LDUR X10,[X1, #0],IF,ID,EX,ME WW,,,,,,,,,,,,,,,,],[LDUR X11,[X1, #8],,IF,,,,,,,,,,,,,,,,,,],[ADD X12, X10, X11,,,,,,,,,,,,,,,,,,,,],[STUR X12,[X1, #-8],,,,,,,,,,,,,,,,,,,,],[SUBI X1, X1, #16,,,,,,,,,,,,,,,,,,,,],[CBNZ X12, LOOP,,,,,,,,,,,,,,,,,,,,],[,,,,,,,,,,,,,,,,,,,,],[2nd iteration: LDUR X10,[X1, #0],,,,,,,,,,,,,,,,,,,,]]
(d) What is the speedup for the execution of (c) over (a)?
 Consider the following loop. LOOP: LDUR X10,[X1, #0] LDUR x11,[x1,#8] ADD

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!