Shift Microoperations

🔄 Introduction to Shift Microoperations

Shift microoperations are fundamental operations used for serial transfer of data within digital computers. They are frequently employed in conjunction with arithmetic, logical, and other data-processing tasks. These operations manipulate the bits within a register by moving them to the left or right.

⚡

Serial Data Transfer

Efficient movement of data bits within registers

🔧

Data Processing

Used with arithmetic and logical operations

🎯

Bit Manipulation

Precise control over individual bit positions

📊 Types of Shift Microoperations

1. Logical Shift

Transfers a 0 (zero) into the serial input of the register. Used for basic left or right shifting of binary data.

R ← shl R //Shift left
R ← shr R //Shift right

Key Feature: Always inserts zeros from the shifting end.

2. Circular Shift (Rotate)

Circulates bits around the two ends of the register. Bits shifted out from one end are reinserted into the other end, ensuring no loss of information.

//Circular shift left
R ← cil R
// Circular shift right
R ← cir R

Key Feature: No data loss - bits wrap around.

3. Arithmetic Shift

Shifts signed binary numbers while preserving the sign. Left shifts multiply by 2, right shifts divide by 2.

//Arithmetic shift left
R ← ashl R
//Arithmetic shift right
R ← ashr R

Key Feature: Sign bit preservation for signed numbers.

🎮 Interactive Shift Demonstration

8-bit Register Shift Simulator

Click the buttons below to see different shift operations in action!

Register Value:
1 0 1 1 0 1 0 1
Binary: 10110101 | Decimal: 181

⚠️ Arithmetic Shift Details

Arithmetic Shift Right

The sign bit (leftmost bit) remains unchanged and is also transferred to the next position, preserving the sign of signed numbers.

┌─────┐
│     │
│ ┌───────┬───────┬───────────┬───────┬───────┐
└→│ Rn-1  │ Rn-2  │     →     │  R1   │  R0   │
  └───────┴───────┴───────────┴───────┴───────┘
   ↑
   │
   └── Sign bit (feedback)

Arithmetic Shift Left

A 0 (zero) is inserted into the rightmost position. This operation effectively multiplies the number by 2, but overflow must be monitored.

Overflow Detection in Arithmetic Shift Left

An overflow occurs when the sign bit changes value after the shift. This can be detected using an Exclusive-OR operation on the two most significant bits before the shift: Vs = Rn-1 ⊕ Rn-2

🔧 Hardware Implementation

Shift microoperations are commonly implemented using:

🎛️

Combinational Shifter

Built with multiplexers for high-speed operations

Bidirectional Shifter>

Combinational Shifter Function Table:
S = 0 (Shift Right): IR → H0, A0 → H1, A1 → H2, A2 → H3
S = 1 (Shift Left): IL → H3, A1 → H0, A2 → H1, A3 → H2
Start Learning Arithmetic Logical Shift Unit