# Shift microoperations and examples.

Shift micro operations are involved in shifting of bits of a register. These operations are categorized into three groups, `logical` shift, `circular` shift and `arithmetic` shift.

Logical shift micro-operationsThese operations are associated with shift of data bits towards left or right and allowing a serial bit stream to occupy vacated bit positions.

So an example of shift left microoperations on register A = 1001 is shown below: (Reverse of below will give shift right) LTE - 4G Wireless Technology

Digital fundamentals.

Interview Questions.

Circular shift micro-operations.

In this shift operation the MSB bit of the register are virtually connected to the LSB bit of the same register. So in case of shift operation (left or right) the data does not get lost. Instead the data moves in a circular fashion.

Arithmetic shift microoperations

In this operation we shift signed binary numbers left or right. For these operations proper care must be taken. Lets discuss this shift operation in three sections.

Arithmetic shift right, Arithmetic shift left, Arithmetic shift left overflow:
Discussion on Arithmetic shift microoperations -

Arithmetic shift right:
Shift right for signed numbers is same as dividing the bin number by 2.

Arithmetic shift left:
Shift left for signed numbers is same as multiplying the bin number by 2.

Arithmetic shift left overflow:
For shift left operations the overflow condition needs to be decided based on the following check:

Amsb and Amsb-1 are two MSB bits of the register.

The overflow is detected based on following equation.

OF = Amsb XOR Amsb-1

If OF = 0 then no overflow detected.

Else overflow and a sign reversal needs to be done after left shift.

Verilog code examples for shift micro-operations are at links below:-
Logical Shift Right (LSR) verilog code,
Logical Shift left (LSL) verilog code,
Circular Shift Right (CSR) verilog code,
Circular Shift Left (CSL). Verilog code.

Arithmetic microoperations discussion,
Logical microoperations discussion,
Shift microoperations discussion,
Overflow conditions and discussion.

Tutorials `@fullchipdesign.com`

Verilog Tutorial.

LTE Tutorial.

Memory Tutorial.

Hope you liked! this page. Don't forgot to access relevant `previous and next sections ` with links below.