Question

In the class, we have shown how to maximize performance on our pipelined datapath with forwarding...

In the class, we have shown how to maximize performance on our pipelined datapath with forwarding and stalls on a use following a load. Rewrite the following code to minimize performance on this datapath – that is, reorder the instructions so that this sequence takes the most clock cycles to execute while still obtaining the same result:

lw $3, 0($5)


lw $4, 4($5)


add $7, $7, $3

add $8, $8, $4

add $10, $7, $8

sw $6, 0($5)


beq $10, $11, loop

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The only stalls occur when loads are followed by uses. There are two occurrences of this in this code fragment. So, reorder as follows:

lw $3,0($5)
add $7, $7, $3
lw $4, 4($5)
add $8, $8, $4
add $10, $7, $8
sw $6, 0($5)
beq $10, $11, Loop

Add a comment
Know the answer?
Add Answer to:
In the class, we have shown how to maximize performance on our pipelined datapath with forwarding...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT