Shifting Operation

Thread Starter

th1unleasged

Joined Jul 8, 2011
5
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?????
 

Thread Starter

th1unleasged

Joined Jul 8, 2011
5
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 :)
 

Georacer

Joined Nov 25, 2009
5,182
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.
 

Thread Starter

th1unleasged

Joined Jul 8, 2011
5
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.
 

Georacer

Joined Nov 25, 2009
5,182
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?
 
Top