Question

4. What will be in $8 after execution? Assume $9 contains a valid RAM address. .data...

4.

What will be in $8 after execution?

Assume $9 contains a valid RAM address.

.data

A: 5 10 15

.text

Main:

la $9, A

addi $10, $0, 5

sw $10, 8($9)

addi $9, $9, 8

lw $8, 0($9)

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

SOLUTION-

For this assembly code , $8 will contain 5.

la $9, A --->    ; $9 will contain base address of array A

addi $10, $0, 5 --->    ; $10 = 0 + 5 = 5

sw $10, 8($9) --->     ;8($9) that is A[2] = $10 = 5 that is 15 would be replaced by 5

addi $9, $9, 8 ----->    ; adding 8 to the base address of the array A that is $9 = A[2]

lw $8, 0($9) -----> ; $8 = base of $9 that is A[2] so would store 5

IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANSWER-----------THANK YOU!!!!!!!!----------

Add a comment
Know the answer?
Add Answer to:
4. What will be in $8 after execution? Assume $9 contains a valid RAM address. .data...
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