Jump to content

Barrel shifter: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 3: Line 3:
Take for example a four-bit barrel shifter, with inputs A, B, C and D. The shifter can cyclically alter the order of the bits ABCD. That is, it can 'shift' all of the outputs up to three positions to the right (and thus make any cyclic combination of A, B, C and D). The barrel shifter has a variety of applications, including being a vital component in [[microprocessor]]s (alongside the [[ALU]]).
Take for example a four-bit barrel shifter, with inputs A, B, C and D. The shifter can cyclically alter the order of the bits ABCD. That is, it can 'shift' all of the outputs up to three positions to the right (and thus make any cyclic combination of A, B, C and D). The barrel shifter has a variety of applications, including being a vital component in [[microprocessor]]s (alongside the [[ALU]]).


The barrel shifter is used in floating-point arithmetic hardware. For a floating-point add or subtract operation, the fractions of the numbers must be aligned, which requires shifting the smaller number (in magnitude) to the right, increasing its exponent, until it matches the exponent of the larger number. This is done be subtracting the exponents, and using the barrel shifter to shift the smaller number to the right by the difference, in one cycle. If a simple shifter were used, shifting by ''n'' bit positions would require ''n'' clock cycles.
The barrel shifter is used in floating-point arithmetic hardware. For a floating-point add or subtract operation, the fractions of the numbers must be aligned, which requires shifting the smaller number (in magnitude) to the right, increasing its exponent, until it matches the exponent of the larger number. 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. If a simple shifter were used, shifting by ''n'' bit positions would require ''n'' clock cycles.


==External links==
==External links==

Revision as of 19:08, 19 September 2006

A barrel shifter is a digital circuit that can shift a data word by any number of bits in a single cycle. It is implemented as a sequence of multiplexors: the output of one MUX is connected to the input of the next MUX in a way that depends on the shift distance. The number of multiplexors required is log2(n), where n is the computer's register size.

Take for example a four-bit barrel shifter, with inputs A, B, C and D. The shifter can cyclically alter the order of the bits ABCD. That is, it can 'shift' all of the outputs up to three positions to the right (and thus make any cyclic combination of A, B, C and D). The barrel shifter has a variety of applications, including being a vital component in microprocessors (alongside the ALU).

The barrel shifter is used in floating-point arithmetic hardware. For a floating-point add or subtract operation, the fractions of the numbers must be aligned, which requires shifting the smaller number (in magnitude) to the right, increasing its exponent, until it matches the exponent of the larger number. 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. If a simple shifter were used, shifting by n bit positions would require n clock cycles.

References

This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.