Question

What are the machine codes for the following MIPS assembly codes?                a. sub   $t0, $s0,...

What are the machine codes for the following MIPS assembly codes?

               a. sub   $t0, $s0, $s1

               b. lw       $t0, 20($s0)

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

a) For above compiled MIPS C code will be as follows

  • a = b - c;
  • a will be stored in $t0, b in $s0, c in $s1

Compiled MIPS code is

  • sub $t0, $s0, $s1
  • where the result of substration is stored in $t0

b) C code for above MIPS code is

  • a = A[5];
  • index 5 requires offset of 20 the value of A[5] will be loaded in variable a.
Add a comment
Know the answer?
Add Answer to:
What are the machine codes for the following MIPS assembly codes?                a. sub   $t0, $s0,...
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