# What are Shift Micro operations?

## Introduction

Shift microoperations are those microoperations that are used for the serial transfer of data/information. These microoperations are used in association with other microoperations like arithmetic micro-operations, logical microoperations, and other data processing microoperations. The contents of the register can be shifted in diverse ways using shift microoperations. The data transferred through the serial input determines the type of serial input.

There are three types of shift:

- Logical Shift
- Circular Shift
- Arithmetic Shift

## 1. Logical Shift

In Logical shift 0 is transferred through the serial input. There are two types of logical shifts. They are Logical shift-right:

**Logical shift-right:**

In this shift operation, each bit is shifted to the right one by one starting from MSB. The LSB is rejected and the empty MSB is filled with 0.

`R1<- shr R1`

We use the symbol *shr* for shift-right operation. The above microoperation specifies a 1-bit shift to the right of the content of register R1.

** 2.Logical shift-left:**

In this shift operation, each bit is shifted to the left one by one starting from LSB. The MSB is rejected and the empty LSB is filled with 0.

`R2 <- shl R2`

We use the symbol *shl* for shift-right operation. The above microoperation specifies a 1-bit shift to the left of the content of register R2. /

## 2. Circular Shift

The circular shift, also known as *rotate operation* circulates the bits of the register around the two ends without the loss of information. Like logical shifts, there are two variations of circular shifts. They are:

- Circular Shift Right
- Circular Shift Left

**Circular Shift Right:**

In this shift, each bit of the register is shifted right and the rightmost bit ( i.e LSB) is shifted to the first position (i.e MSB).

`R <- cir R`

We use the symbol *cir* for circular shift-right operation. The above microoperation specifies a 1-bit circular shift to the right of the content of register R.

2.** Circular Shift Left:**

In this shift, each bit of the register is shifted left and the leftmost bit ( i.e MSB) is shifted to the last position (i.e LSB).

`R <- cil R`

We use the symbol *cil* for circular shift-right operation. The above microoperation specifies a 1-bit circular shift to the left of the content of register R.

## 3. Arithmetic Shift

An arithmetic shift is a micro-operation that shifts a signed binary number to the left or right. Like other shift microoperations, there are two variations of arithmetic shifts. They are:

- Arithmetic Shift Right
- Arithmetic Shift Left

**Arithmetic Shift Right:**

An arithmetic shift-right divides the number by 2. This shift is similar to logical shift-right except the MSB is replaced by its own bit insted of 0.

`R <- ashr R`

We use the symbol* ashr* for the arithmetic shift-right operation. The above microoperation specifies a 1-bit arithmetic shift to the right of the content of register R.

2. **Arithmetic Shift Left:**

An arithmetic shift-right multiplies the number by 2. The movement of the bits of the register is the same as the logical shift left( i.e. each bit shifted to the left position).

`R <- ashl R`

We use the symbol *ashl* for the arithmetic shift-left operation. The above microoperation specifies a 1-bit arithmetic shift to the left of the content of register R.

Read more on Computer Architecture: https://codewithsudeep.com/category/csit/computer-architecture/