HWK13 - HWK #13 Solutions Problem 13.1 (a) Instruction...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
HWK #13 Solutions Problem 13.1 (a) Instruction Comments NOT R2, R3 Calculate R3' (temp register) AND R2, R2, R4 Calculate R3'R4 NOT R5, R4 Calculate R4' (overwrite destination instead of using a temp) AND R5, R5, R3 Calculate R4'R3 ADD R5, R5, R2 Calculate R3'R4 + R4'R3; equivalent to logical OR since both cannot be 1 (b) ADD R5, R5, #-15 ; subtracting +15 is the same as adding -15 (c) Instruction Comments NOT R5, R3 Calculate R3' ADD R5, R5, #1 Calculate R3'+1 = -R3 ADD R5, R2, R5 Calculate R2-R3 (d) ADD R5, R5, R5 ; LSL is equivalent to multiplying by 2 (ignoring overflow) (e) In order to rotate right, we can rotate left 15 times. To rotate left, shift left (implemented in part d) followed by adding 1 if the original number had a 1 in the MSB (this means it was negative); if the original number was positive or zero, shift left but do not add 1. The only difference between a rotate right and an LSR is in the new MSB; for a rotate, the MSB becomes the old LSB, but for an LSR it should always be 0. We can guarantee this
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/26/2010 for the course ECE 290 taught by Professor Brown during the Fall '08 term at University of Illinois at Urbana–Champaign.

Page1 / 10

HWK13 - HWK #13 Solutions Problem 13.1 (a) Instruction...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online