Barrel shifter: Difference between revisions
Revert vandalism from 39.32.234.244 |
cite web used & completed (say no to linkrot!); weblink cleanup |
||
Line 20: | Line 20: | ||
== Cost == |
== Cost == |
||
The number of multiplexers required for an ''n''-bit word is <math>\scriptstyle n\log_2n</math>.<ref>{{cite book |
The number of multiplexers required for an ''n''-bit word is <math>\scriptstyle n\log_2n</math>.<ref>{{cite book |
||
| title=Decision Procedures |
|||
| first=Daniel |
|||
| last=Kroening |
|||
| first2=Ofer |
|||
| last2=Strichman |
|||
| publisher=[[Springer]] |
|||
| year=2008 |
|||
| page=159 |
|||
| isbn=978-3-540-74104-6}}</ref> Five common [[word size]]s and the number of multiplexers needed are listed below: |
|||
* 128-bit — <math>\scriptstyle 128\times\log_2(128) = 128\times7 = 896</math> |
* 128-bit — <math>\scriptstyle 128\times\log_2(128) = 128\times7 = 896</math> |
||
Line 29: | Line 38: | ||
Cost of critical path in [[FO4]] (estimated, without wire delay): |
Cost of critical path in [[FO4]] (estimated, without wire delay): |
||
* 32-bit: from 18 FO4 to 14 FO4<ref> |
* 32-bit: from 18 FO4 to 14 FO4<ref>{{cite web |
||
| url=http://www.realworldtech.com/fo4-metric/4/ |
|||
| title=Revisiting the FO4 Metric |
|||
| first=David T. |
|||
| last=Wang |
|||
| date=2002-08-15 |
|||
| accessdate=2016-05-19}}</ref> |
|||
== Uses == |
== Uses == |
||
Line 43: | Line 58: | ||
==External links== |
==External links== |
||
<!--*[http://answers.google.com/answers/threadview?id=388350 Google Answers] has a good explanation, and collection of links--> |
|||
*[ |
* [https://tams.informatik.uni-hamburg.de/applets/hades/webdemos/10-gates/60-barrel/shifter8.html Barrel-shifter (8 bit)], [[University of Hamburg]] |
||
*[http://www.xilinx.com/support/documentation/application_notes/xapp195.pdf |
* [http://www.xilinx.com/support/documentation/application_notes/xapp195.pdf Implementing Barrel Shifters Using Multipliers] (Paul Gigliotti, 2004-08-17) |
||
==Further reading== |
==Further reading== |
||
* {{cite book |
|||
*{{cite book |first=Daniel |last=Kroening |first2=Ofer |last2=Strichman |title=Decision Procedures |location= |publisher=Springer |year=2008 |isbn=978-3-540-74104-6 }} |
|||
| title=Decision Procedures |
|||
| first=Daniel |
|||
| last=Kroening |
|||
| first2=Ofer |
|||
| last2=Strichman |
|||
| publisher=[[Springer]] |
|||
| year=2008 |
|||
| isbn=978-3-540-74104-6}} |
|||
{{FOLDOC}} |
{{FOLDOC}} |
Revision as of 01:37, 20 May 2016
A barrel shifter is a digital circuit that can shift a data word by a specified number of bits in one clock cycle. It can be implemented as a sequence of multiplexers (mux.), and in such an implementation the output of one mux is connected to the input of the next mux in a way that depends on the shift distance.
For example, take a four-bit barrel shifter, with inputs A, B, C and D. The shifter can cycle the order of the bits ABCD as DABC, CDAB, or BCDA; in this case, no bits are lost. 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 useful component in microprocessors (alongside the ALU).
Implementation
A barrel shifter is often implemented as a cascade of parallel 2×1 multiplexers. For a 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
Larger barrel shifters have additional stages.
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:
- 128-bit —
- 64-bit —
- 32-bit —
- 16-bit —
- 8-bit —
Cost of critical path in FO4 (estimated, without wire delay):
- 32-bit: from 18 FO4 to 14 FO4[2]
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
References
- ^ Kroening, Daniel; Strichman, Ofer (2008). Decision Procedures. Springer. p. 159. ISBN 978-3-540-74104-6.
- ^ Wang, David T. (2002-08-15). "Revisiting the FO4 Metric". Retrieved 2016-05-19.
External links
- Barrel-shifter (8 bit), University of Hamburg
- Implementing Barrel Shifters Using Multipliers (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.