Barrel shifter

It can however in theory also be used to implement unary operations, such as logical shift left, in cases where limited by a fixed amount (e.g. for address generation unit).

A barrel shifter is often used to shift and rotate n-bits in modern microprocessors,[1] typically within a single clock cycle.

For an 8-bit barrel shifter, two intermediate signals are used which shifts by four and two bits, or passes the same data, based on the value of S[2] and S[1].

This signal is then shifted by another multiplexer, which is controlled by S[0]: Larger barrel shifters have additional stages.

This is done by subtracting the exponents and using the barrel shifter to shift the smaller number to the right by the difference, in one cycle.

Schematic of a 4-bit crossbar barrel shifter. 'x' denotes input bits and y denotes output bits.