Question

Using MIPS:

2. Consider the following fragment of C code: for i=0: Id=100; =+1) (a) = b) + c ( Assume that a and bare arrays of words and the base address of a is in Sa0 and the base address of b is in Sa1. Register sto is associated with variable i and register Sso with c. Write the code for MIPS. How many instructions are executed during the running of this code? How many memory data references will be made during execution?

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

for(i=0;i,<=100;i=i=1)

li $t0, 100 //t0 is a constant 100
li $t1,0 //t1 is a our counter
loop:
beq $t1,$t0,end
loop body
add $t1,$t1,1
end

a[i]=b[i]+c;

add $a0,$a1,$s0;

4 byte integer is needed at the time of execution.

add $s0,$s1,$s2

Add a comment
Know the answer?
Add Answer to:
Using MIPS: Consider the following fragment of C code: for i=0: i < = 100: i...
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