Question

2.19 [10] <§2.6> Find the shortest sequence of LEGv8 instructions that extracts bits 16 down to...

2.19 [10] <§2.6> Find the shortest sequence of LEGv8 instructions that extracts
bits 16 down to 11 from register X10 and uses the value of this field to replace bits 31
down to 26 in register X11 without changing the other bits of registers X10 or X11.
(Be sure to test your code using X10 = 0 and X11 = 0xffffffffffffffff.
Doing so may reveal a common oversight.)

Homework Answers

Answer #1

Here is a solution with a set of 4 instructions. It will extract bits 16 down to 11 from register X10 and uses the value of this field to replace bits 31 down to 26 in register X11 without changing the other bits of registers X10 or X11. This is also the shortest one.

Note that, SRL instruction is used to shift the 32 bits to right in the specified register by operand 1 and SLL shifts the 32 bits to the left.

SRL X22, X10, 11

SLL X22, X22, 26

SRL X11, X11, 6

ADD X22, X22, X10

Know the answer?
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
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT