A Barrel Shifter is a digital circuit that can shift a data word by a specified number of bits in a single clock cycle. Unlike a standard shift register which shifts one bit per clock cycle, a barrel shifter uses purely combinational logic (Multiplexers) to shift data instantly.
It is a critical component in ALUs (Arithmetic Logic Units) for operations like multiplication, division, and floating-point arithmetic.
Sequential shift registers require $N$ clock cycles to shift $N$ bits. A Barrel Shifter accomplishes this in essentially zero time (gate propagation delay only) by routing the input bits to the correct output positions using a network of multiplexers.
A standard $N$-bit barrel shifter is constructed using $\log_2(N)$ stages of multiplexers. For a 4-bit shifter:
By combining these stages, any shift from 0 to 3 positions can be achieved (e.g., Shift 3 = Shift 2 + Shift 1).
Left (LSL): Bits move left. Zeros fill in from the right.
Right (LSR): Bits move right. Zeros fill in from the left.
Rotate Left (ROL): Bits shifted out from the left wrap around to the right.
Rotate Right (ROR): Bits shifted out from the right wrap around to the left.