Consider the following sequence of instructions:
Assume that every instruction is data-dependent on the instruction just before it and every instruction (except the first ) is data-dependent on the instruction just before it. The defined as follows.
The achieved in executing the given instruction sequence on the pipelined processor (rounded to decimal places) is _____________
View worked solution
Answer: 1.87 : 1.88
To find the speedup, we calculate the total execution cycles for both cases: without operand forwarding and with operand forwarding.
1. Without Operand Forwarding
Since the register read is performed in the stage and register write is in the stage, a dependent instruction can only enter its stage after the preceding instruction completes its stage.
- (ADD): in cycle 3, in cycle 5.
- (MUL): starts in cycle 6 (after completes in cycle 5). takes 2 cycles (6, 7), in cycle 9.
- (ADD): starts in cycle 10, in cycle 12.
- (MUL): in cycles 13–14, in cycle 16.
- (ADD): in cycle 17, in cycle 19.
- (MUL): in cycles 20–21, in cycle 23.
- (ADD): in cycle 24, in cycle 26.
- (MUL): in cycles 27–28, in cycle 29, in cycle 30.
Total execution time without forwarding = 30 cycles.
2. With Operand Forwarding
With forwarding, the result computed at the end of the stage of an instruction is directly forwarded to the start of the stage of the next dependent instruction.
- (ADD): in cycle 3. Result forwarded at the end of cycle 3.
- (MUL): in cycles 4–5. Result forwarded at the end of cycle 5.
- (ADD): in cycle 6. Result forwarded at the end of cycle 6.
- (MUL): in cycles 7–8. Result forwarded at the end of cycle 8.
- (ADD): in cycle 9. Result forwarded at the end of cycle 9.
- (MUL): in cycles 10–11. Result forwarded at the end of cycle 11.
- (ADD): in cycle 12. Result forwarded at the end of cycle 12.
- (MUL): in cycles 13–14, in cycle 15, in cycle 16.
Total execution time with forwarding = 16 cycles.
3. Speedup Calculation
Rounding to two decimal places, we get 1.88 (or 1.87 depending on the rounding method).
Free practice · Your answers on this page are not saved.
