The operation that changes the adjacent bit position of the binary values stored in the register is known as shift micro-operation. Shift micro operations are involved in shifting of bits of a register. Shift micro operations are used for serial transfer of data.
Shift Micro-operations are categorized in detail as follows:
Logical shift can be defined as the shift of the bits to the right or left serially. This operation is associated with shift of data bits towards left or right and allowing a serial bit stream to occupy vacated bit positions. Normally a zero occupies the vacated position when every bit gets shifted either leftwards or rightwards. Logical Shift is of two types:
Logical Left Shift: Every bit gets shifted towards left. The left most bit (MSB) gets discarded and a zero fills the vacated LSB position. Mathematically this operation shows that the number is multiplied by 2.
Logical Right Shift: Every bit gets shifted towards right. The right most bit (LSB) gets discarded and a zero fills the vacated MSB position. Mathematically this operation shows that the number is divided by 2.
Circular shift also named as rotate shift circulates the bits among the ends of the register without losing information. We can achieve this by connecting the output terminal to the input terminal of the register. Thus while shift operation (left or right) the data does not get lost. Instead the data moves in a circular fashion. Circular Shift is of two types:
Circular Left Shift: Every bit gets shifted towards left. The left most bit (MSB) extracts and gets appended to the LSB position.
Circular Right Shift: Every bit gets shifted towards right. The right most bit (LSB) extracts and gets appended to the MSB position.
In this operation we shift signed binary numbers left or right. For these operations proper care must be taken. For shift left the content of the register is multiplied by 2 whereas For shift right the content of the register is divided by 2. The arithmetic shift must leave the sign bit unchanged. Arithmetic Shift is of two types:
Arithmetic Left Shift: Every bit gets shifted towards left. The left most bit (MSB) represents the sign hence it doesn't participate in shifting process normally.
Arithmetic Right Shift: Every bit gets shifted towards right. The right most bit (LSB) gets lost and the sign bit is copied to the MSB-1 position. Again in this case, the sign bit remains the same.
NOTE: Every negative number is taken already in 2's compliment representation.