Barrel Shifters

A barrel shifter is a logic circuit for shifting a word by a varying amount. Its has a control input that specifies the number of bit positions that it shifts by.

A barrel shifter is implemented with a sequence of shift multiplexers, each shifting a word by 2k bit positions for different values of k. The diagram below shows a right-shifting barrel shifter for 32-bit words.

With more complex multiplexers and some extra circuitry for dealing with end fill options, a barrel shifter can handle all of the standard bit shift instruction in a processor's instruction set.