Question

I nililai e ilu, following C eode i o MIPS :ritannlly et Kle. Nillne that the valles of a aud j are ill rypim; $s0 and $s1, respectively. Also, assume that register $s2 holds the base address of the array D. Assume that you want to use register $s3 to store the constant 10. for(1-0; 1 < 10 ; 1++){ j=0; while ( j < a ) D[j] = 1 + j + D[j];

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

MIPS GCC 5.4 Code:

main:

addiu $sp,$sp,-72

sw $fp,68($sp)

move $fp,$sp

sw $0,8($fp)

$L5:

lw $2,8($fp)

nop

slt $2,$2,10

beq $2,$0,$L2

nop

sw $0,12($fp)

$L4:

lw $3,12($fp)

lw $2,16($fp)

nop

slt $2,$3,$2

beq $2,$0,$L3

nop

lw $3,8($fp)

lw $2,12($fp)

nop

addu $3,$3,$2

lw $2,12($fp)

nop

sll $2,$2,2

addiu $4,$fp,8

addu $2,$4,$2

lw $2,12($2)

nop

addu $3,$3,$2

lw $2,12($fp)

nop

sll $2,$2,2

addiu $4,$fp,8

addu $2,$4,$2

sw $3,12($2)

lw $2,12($fp)

nop

addiu $2,$2,1

sw $2,12($fp)

b $L4

nop

$L3:

lw $2,8($fp)

nop

addiu $2,$2,1

sw $2,8($fp)

b $L5

nop

$L2:

move $2,$0

move $sp,$fp

lw $fp,68($sp)

addiu $sp,$sp,72

j $31

nop

Add a comment
Know the answer?
Add Answer to:
'I nililai e ilu, following C eode i o MIPS :ritannlly et Kle. Nillne that the...
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