Question

Consider the following RISC-V loop: (i) LOOP: beq x6, XO, DONE (ii) addi x6, x6, -1 addi x5, x5, 2 (iv) slli x7, x5, 1 (iv) b

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

a) Value of x5 at the end of execution = 2

b) Value of x7 at the end of execution = 4

c) Total 5 number of instruction executed

Explanation:

At the start x6 = 5 is not equal to 0 hence branching will not take place.

In second line, x6 = x6 - 1 = 5-1 = 4

In third line x5 = x5+2 = 2

In fourth line x7 = 010 << 1 = 100 = (4)10

In fifth line branching will take place as x5>=0 ( 2>0) hence the code will branch to DONE.

Add a comment
Know the answer?
Add Answer to:
Consider the following RISC-V loop: (i) LOOP: beq x6, XO, DONE (ii) addi x6, x6, -1...
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