Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A barrel shifter is a specialized digital electronic circuit with the purpose of shifting an entire data word by a specified number of bits by only using combinational logic, with no sequential logic used. The simplest way of achieving this is by using a series of multiplexers where one output is connected to the input of the next multiplexer in the chain, in a specific manner that depends on the amount of shift specified.
Barrel shifters are specialized electronic circuits used to shift the bits of binary data and often employed by embedded digital signal processors and other general-purpose processors in order to manipulate data. Data shifting is required for various low-level data applications such as floating-point arithmetic operations, bit indexing and variable-length coding. A barrel shifter is able to complete the shift in a single clock cycle, giving it a great advantage over a simple shifter which can shift n bits in n clock cycles. It is used in conjunction with a processor’s arithmetic logic unit (ALU) or otherwise embedded in the ALU itself.
A barrel shifter is able to shift the bits of binary data by moving it from one multiplexer to the next, with the supported number of bits dictated by how many multiplexers are used.
The formula for determining how many multiplexers are required is n log2(n) where n is the number of bits supported. So for an 8-bit barrel shifter the calculation is 8 × log2(8) = 8 × 3 = 24.