Shifting Operation

Discussion in 'Homework Help' started by th1unleasged, Jul 8, 2011.

  1. th1unleasged

    Thread Starter New Member

    Jul 8, 2011
    5
    0
    Hi everyone :)
    I was wondering about the difference between the logical shift through carry flag and circular shift through carry flag for example:
    If my guess about the whole thing is right then:
    if we have 1001 and we shift it right logical shift through carry flag won't it be (the carry flag from previous shift)100 and the carry flag would be 1
    and in circular right through carry won't it be the same?????
     
  2. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Are you referring to a particular microprocessor? There are differences from system to system.
     
  3. th1unleasged

    Thread Starter New Member

    Jul 8, 2011
    5
    0
    no but can you give me some useful links to know about the shifting operations through carry flag it is my very first project and i just want the general about it also i don't much about Microprocessor xD.
    thanks so much for your reply i appreciate your help :)
     
  4. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Ok, let's take an example: The AVR. Read its manual here:
    http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf

    In page 14, the LSL instruction is for Logical Shift Left through carry. Notice that the Rd(0) bit is filled with zeroes.
    In contrast the ROL, ROtate Left through carry, instruction will fill the Rd(0) with the previous carry value.

    I 'm pretty sure that other microprocessors allow you to control whether you want to feed zeroes or ones in the logical shift.
     
  5. th1unleasged

    Thread Starter New Member

    Jul 8, 2011
    5
    0
    So you mean that in LSL through Carry Flag we always Fill Rd(0) with zeroes and the difference between it and the LSL With Carry Flag that we Fill Rd(0) with either Zeroes or Ones(Serial In)?????
    Thanks So much for replies.
     
  6. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    There is no LSL through carry and LSL with carry. The instruction LSL is explicit and just one.
    I don't know why you got that impression.

    What there is, is LSL and ROL.
    In the Logical Shift Left we always feed the Rd(0) with 0.
    In the ROtate Left we feed the carry back in Rd(0).

    Is that clear?
     
  7. th1unleasged

    Thread Starter New Member

    Jul 8, 2011
    5
    0
    Ok thanks so much for your Help :)))
     
Loading...