Question

.text main . la $50, x #get base address of x la $s1, y #get base address of y lw $to, 12 ($50)#get data from memory of x[3]

PC Status = 00400048 EPC = 00000000 Cause = 00000000 BadVAddr=00000000 3000ff10 HI =00000000 LO = 00000000 General Registers

[0x00400024] 3c011001 lui $1. 4097 [x] [0x00400028] 034300000 ori $16. $1. 0 [x] Ox0040002c1 Ox3c011001 lui $1, 4097 yl [0x00

I want to calculate Y[2]=X[3]+X[4]

I'm not sure that I wrote right codes.

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

Your code is perfect.

From your code, x[3] = -4 and x[4] = 6, so y[2] should be 2 after executing the code.

I have shown you 2 screenshots to confirm that it works. The first screen is just after assembling the code before execution. 2nd screen is after execution. Before execution you can see the data segment that y[2] = 0 and after execution y[2] = 2

Screen 1 (After assembling , before execution)

=======

Text Segment Bkpt Address Code Basic Source 3: la $s0, x 0x00400000 0x3c011001 lui $1,4097 0x00400004 0x34300000 ori $16, $1,

Screen2 (After execution)

======

Text Segment Bkpt Address Code Basic Source 0x00400000 0x3c011001 lui $1,4097 3: la $s0, x 0x00400004 0x34300000 ori $16, $1,

Add a comment
Know the answer?
Add Answer to:
I want to calculate Y[2]=X[3]+X[4] I'm not sure that I wrote right codes. .text main ....
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