{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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.
Image of page 1

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

View Full Document Right Arrow Icon
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern