RightShift

RightShift - Notice the 1-bit in the Test Mask is at index...

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

View Full Document Right Arrow Icon
Right Shift Algorithm Original Data X 1 5 X 1 4 X 1 3 X 1 2 X 1 1 X 1 0 X 9 X 8 X 7 X 6 X 5 X 4 X 3 X 2 X 1 X 0 Shifted Data 0 X 1 5 X 1 4 X 1 3 X 1 2 X 1 1 X 1 0 X 9 X 8 X 7 X 6 X 5 X 4 X 3 X 2 X 1 ==================================== Algorithm Test Mask 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 Original Data X 1 5 X 1 4 X 1 3 X 1 2 X 1 1 X 1 0 X 9 X 8 X 7 X 6 X 5 X 4 X 3 X 2 X 1 X 0 Shifted Data 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Set Mask 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 The Original Data is given in R0. The algorithm builds the Shifted Data in R1 (or any other register) The Test Mask is used to test a single bit of the Original Data at a time The Set Mask is used to set a single bit of the Shifted Data at a time Initialization : Clear the Shifted Data register and initialize the two masks as shown.
Background image of page 1

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

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

Unformatted text preview: Notice the 1-bit in the Test Mask is at index 1 higher than the 1-bit in the Set Mask. Why? Repeat the following the required number of times : Test a bit of the Original Data using the Test Mask. If the tested bit is 1, set the next lower bit of the Shifted Data by adding the Set Mask. Perform a left-shift on both test Mask and Set Mask....
View Full Document

This note was uploaded on 01/04/2012 for the course CDA 3103 taught by Professor Normanpestaina during the Fall '11 term at FIU.

Page1 / 2

RightShift - Notice the 1-bit in the Test Mask is at index...

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