Implementation
A barrel shifter is often implemented as a cascade of parallel 2×1 multiplexers. For a four-bit barrel shifter, an intermediate signal is used which shifts by two bits, or passes the same data, based on the value of S. This signal is then shifted by another multiplexer, which is controlled by S:
im = IN, if S == 0 = IN << 2, if S == 1 OUT = im, if S == 0 = im << 1, if S == 1Larger barrel shifters have additional stages.
Read more about this topic: Barrel Shifter