# Explain Shift micro operations in computer architecture

## Shift Micro Operations

Shift micro operations are those micro operations that are used for serial transmission of information.

Shift micro operation are also used in combination with arithmetical, logical, and other data processing tasks.

In shift micro operation The contents of a register can be shifted left or right.

As the bits are shiftted, the first flip-flop gets its binary information through the serial input.

The serial input is slightly shifted to the rightmost position during shift-left operation.

The serial input is shifted slightly to the leftmost position during shift-right operation.

## Types of shift micro operations

The information transferred from a serial input determines the type of shift. In shift micro operation There are three types of shifts.

1. Logical shift
2. The Circular Shift
3. Arithmetic shift operation

## Logical shift

A logical shift is one which moves zero through the serial input. The shl symbol is used for logical shift-left and the shr symbol is used for shift-right

There are two ways to move zero in logical shift.

• Logical Shift Left
• Right Logical Shift

### Logical Shift Left

In the Logical shift left single (1) position through single (1) moves every bit to the left. The least significant bit (LSB) is filled with zeros (ie - serial input), and the most significant bit (MSB) is discarded.

shl symbol is used for logical shift left.

We can easily understand this by the example given below

R1 ← shl R1

There are an microoperations that define a 1-bit shift to the left of the contents of register R1

The bit shifted to the last position via the serial input is assumed to be 0 during a logical shift.

The register sign should be the same on both sides of the arrow.

## Logical Shift Right

In logical shift right one position moves each bit one by one to the right and the least significant bit (LSB) is discarded and the empty MSB is filled with zeros.

shr symbol is used for logical shift right.

We can easily understand this by the example given below

R2 ← shr R2

There are an microoperations that specify a 1-bit shift to the right of the contents of register R2.

The bit shifted to the last position via the serial input is assumed to be 0 during a logical shift.

The register sign should be the same on both sides of the arrow.

## The circular shift

The circular shift transmits the bits in the order of the register around both ends without any loss of information.

The Circular Shift is also known as Rotate Operation.

Circular shift is complished via connecting a serial output of the shift register to its serial input.

There are two types of circular shift operation

• Left circular Shift
• Right circular Shift

### Left circular Shift

We will use the symbol cil for the circular shift to the left.

cil symbol is used for Left circular Shift.

We can easily understand this by the example given below

R1 ← cil R1

### Right circular Shift

cir symbol is used for Right circular Shift.

We can easily understand this by the example given below

R2 ← cir R2.

## Arithmetic shift operation

Arithmetic shift operation is the type of shift micro operation which shifts a signed binary number to the right or left.

An arithmetic shift-left multiplies a signed binary number by 2.

An arithmetic shift-right divides the number by two (2).

There are two types of arithmetic shift operation.

• Left Arithmetic Shift
• Right Arithmetic Shift

### Left Arithmetic Shift

In this one position moves each bit one by one to the left. Similar to Left Logical Shift.

ashl symbol is used for Left Arithmetic Shift.

We can easily understand this by the example given below

R1 ← ashl R1.

### Right Arithmetic Shift

In this a position is moved each bit one by one to the right and the least significant bit is discarded and the empty MSB is filled with the value of the previous MSB.

ashr symbol is used for Right Arithmetic Shift.

We can easily understand this by the example given below.

R2 ← shr R2.

When it is multiplied or divided by 2 (two). The sign bit is 0 for positive and 1 for negative. Negative numbers are in 2's complement form. Figure 4-11 shows a typical register of n bits. Bit Rn- 1 places the sign bit in the leftmost position.

Rn-2 is the most significant bit of the number and Ro is the least significant bit. Thus Rn-1 remains just the same, Rn-2 receives bits from Rn-1 and so on for the another bits in a register. The bit is lost in RO.

The starting bit of Rn-1 is lost and replaced by the bit from Rn-2. A sign is reversed if the bit in rn-1 changes in value after the shift. This is what happens when multiplying by 2 causes an overflow. Through an arithmetic shifts overflow is followed if initially, before the shifts, Rn-1 isn't equal to Rn-2.

Vs = Rn-1 + Rn-2

If Vs = 0, there is no overflow, but if Vs = I, the shift is followed by an overflow and a signal reversal.