Question: Consider the following code: The processor has a five-stage pipeline F O E M S; that is, instruction fetch, operand fetch, operand execute, memory, and
Consider the following code:
![LDR r1, [16] ADD r1, r1, #1 LDR ADD ADD r2, [r6, #4] r2, r2, #1 r3, rl, r2 ADD r8, r8 , #4 STR r2, [r6, #8]](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1705/7/4/8/25765aba721eea321705748257628.jpg)
The processor has a five-stage pipeline F O E M S; that is, instruction fetch, operand fetch, operand execute, memory, and operand write back to register file.
a. How many cycles does this code take to execute assuming internal forwarding is not used?
b. How many cycles does this code take to execute assuming internal forwarding is used?
c. How many cycles does the code take to execute assuming that it is reordered (no internal forwarding)?
d. How many cycles does the code take to execute assuming reordering and internal forwarding?
LDR r1, [16] ADD LDR ADD ADD r1, r1, #1 r2, [r6 , #4] r2, r2, #1 r3, rl, r2 ADD r8, r8, #4 STR r2, [r6, #8] SUB r2, r2, #64 ; Load r1 from memory. r6 is a pointer ; Increment r1 by 1 ;Load r2 from memory ; Increment r2 by 1 ; Add r1 and r2 with total in r3 ; Increment r8 by 4 ;Store r2 in memory ; Subtract 64 from r2
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
No forwarding Cycle 1 LDR r1 16 2 ADD rl rl 1 3 LDR a 4 ADD 5 ADD 6 ADD 7 STR 8 SUB b Forwarding Cyc... View full answer
Get step-by-step solutions from verified subject matter experts
