Question

1. What would be the output of the following MIPS code? .globl main main addu $s7, $0, $ra add $s3, $0,$0 addi $s4, $0, 1 $s5

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

Note :- the output is written in BOLD format

Before start of Loop :-
$s7 = $ra
$s3 = 0 # index
$s4 = 1   #increment counter
$s5 = 0
$s6 = save = base address of array

In loop (it continues for each element of array untill) :-
$s3 = index of the array
$t8 = element address in loop
$t9 = value of the element pointed
if the value of $t9 is not equal zero then loop breakp and prints the value of index i.e $s3

So, the program prints the index of first non zero value element in the array

Output :-
The value of i is 7

Add a comment
Know the answer?
Add Answer to:
1. What would be the output of the following MIPS code? .globl main main addu $s7, $0, $ra add $s3, $0,$0 addi $s4, $0,...
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