Documente Academic
Documente Profesional
Documente Cultură
Barrel shifter
A barrel shifter is a digital circuit that can shift a data word by a
specified number of bits without the use of any sequential logic, only
pure combinational logic. One way to implement it is as a sequence of
multiplexers where the output of one multiplexer is connected to the
input of the next multiplexer in a way that depends on the shift
distance. A barrel shifter is often used to shift and rotate n-bits in
modern microprocessors, typically within a single clock cycle.
Contents
Implementation
Cost
Uses
See also
References
External links
Further reading
Implementation
A barrel shifter is often implemented as a cascade of parallel 2×1 multiplexers. 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]:
int1 = IN , if S[2] == 0
= IN << 4, if S[2] == 1
int2 = int1 , if S[1] == 0
= int1 << 2, if S[1] == 1
OUT = int2 , if S[0] == 0
= int2 << 1, if S[0] == 1
Cost
The number of multiplexers required for an n-bit word is .[1] Five common word sizes and the number of
multiplexers needed are listed below:
https://en.wikipedia.org/wiki/Barrel_shifter 1/2
5/31/2019 Barrel shifter - Wikipedia
128-bit —
64-bit —
32-bit —
16-bit —
8-bit —
Uses
A common usage of a barrel shifter is in the hardware implementation of floating-point arithmetic. For a floating-
point add or subtract operation, the significands of the two numbers must be aligned, which requires shifting the
smaller number 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.
See also
Circular shift
References
1. Kroening, Daniel; Strichman, Ofer (2008). Decision Procedures. Springer. p. 159. ISBN 978-3-540-74104-6.
2. Wang, David T. (2002-08-15). "Revisiting the FO4 Metric" (http://www.realworldtech.com/fo4-metric/4/). Retrieved
2016-05-19.
External links
Barrel-shifter (8 bit) (https://tams.informatik.uni-hamburg.de/applets/hades/webdemos/10-gates/60-barrel/shifter8.
html), University of Hamburg
Implementing Barrel Shifters Using Multipliers (http://www.xilinx.com/support/documentation/application_notes/xa
pp195.pdf) (Paul Gigliotti, 2004-08-17)
Further reading
Kroening, Daniel; Strichman, Ofer (2008). Decision Procedures. Springer. ISBN 978-3-540-74104-6.
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.
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using
this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia
Foundation, Inc., a non-profit organization.
https://en.wikipedia.org/wiki/Barrel_shifter 2/2