Question

16 Points) 7. Implement the following loop using MIPS assembly instructions. Assume that r,s, and t are stored in registers $s3, $s4, and Ss5 respectively. while (sct) -s+s
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Sample Code:

.data

#add or initialize registers values here for r, s and t
#r: .word 1
#s: .word 10
#t: .word 20

.text

main:

la $s3, r    #load system call code into register $s3
la $s4, s   #load system call code into register $s4
la $s5, t   #load system call code into register $s5

syscall       #call system to print operation

Loop1: bgt $s4, $s5, EXIT #It will check whether s is greater than t s>t, if so exit or else proceed further.
   add $s3, $s3, $s4   # add r and s then assign the result to r
   add $s4, $s4, $s4   # add s with s and reassign the result to s
  
   j Loop1               # if s<t then call the loop and proceed futher or else exit.
EXIT:

Add a comment
Know the answer?
Add Answer to:
Implement the following loop using MIPS assembly instructions. Assume that r, s, and t are stored...
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