Wallace tree: Difference between revisions
No edit summary |
No edit summary |
||
(40 intermediate revisions by 29 users not shown) | |||
Line 1: | Line 1: | ||
{{short description|Efficient hardware implementation of a digital multiplier}} |
|||
{{Refimprove|date=December 2009}} |
{{Refimprove|date=December 2009}} |
||
[[File:Hindu lattice 2.svg|thumb |basic principle known from manual multiplication]] |
|||
<!-- [[Image:Binary tree.svg|thumb | Would be used in reverse order]] |
<!-- [[Image:Binary tree.svg|thumb | Would be used in reverse order]] |
||
[[Image:Full-adder.svg|thumb | Full adder, would in this case use only XOR]] --> |
[[Image:Full-adder.svg|thumb | Full adder, would in this case use only XOR]] -->[[File:Wallace tree 8x8 (corrected).svg|alt=|thumb|4 layer Wallace reduction of an 8x8 partial product matrix, using 15 [[Half adder|half adders]] (two dots) and 38 [[Full adder|full adders]] (three dots). The dots in each column are bits of equal weight. ]] |
||
A '''Wallace multiplier''' is a [[Computer hardware|hardware]] implementation of a [[binary multiplier]], a digital circuit that multiplies two integers. It uses a selection of full and half [[Adder (electronics)|adders]] (the '''Wallace tree''' or '''Wallace reduction''') to sum partial products in stages until two numbers are left. Wallace multipliers reduce as much as possible on each layer, whereas [[Dadda multiplier|Dadda multipliers]] try to minimize the required number of gates by postponing the reduction to the upper layers.<ref>{{Cite journal|last1=Townsend|first1=Whitney J.|last2=Swartzlander|first2=Earl E.|last3=Abraham|first3=Jacob A.|editor-first1=Franklin T. |editor-last1=Luk |date=2003|title=A comparison of Dadda and Wallace multiplier delays|url=https://ui.adsabs.harvard.edu/abs/2003SPIE.5205..552T/abstract|journal=Advanced Signal Processing Algorithms, Architectures, and Implementations XIII|language=en|volume=5205|pages=552–560|doi=10.1117/12.507012|bibcode=2003SPIE.5205..552T |s2cid=121437680 |issn=0277-786X}}</ref> |
|||
[[Image:wallace tree 8x8.svg|thumb | Example of reduction on an 8x8 multiplier.]] |
|||
Wallace multipliers were devised by the Australian computer scientist [[Chris Wallace (computer scientist)|Chris Wallace]] in 1964.<ref name="Wallace_1964" /> |
|||
A '''Wallace tree''' is an [[Computational complexity theory|efficient]] [[Computer hardware|hardware]] implementation of a digital circuit that multiplies two integers, devised by a team of computer scientists and an undergraduate researcher in 2018.<ref> |
|||
C. S. Wallace, A suggestion for a fast multiplier, IEEE Trans. on Electronic Comp. EC-13(1): 14–17 (1964)</ref> |
|||
The Wallace tree has three steps: |
The Wallace tree has three steps: |
||
# Multiply |
# Multiply each bit of one of the arguments, by each bit of the other. |
||
# Reduce the number of partial products to two by layers of full and half adders. |
# Reduce the number of partial products to two by layers of full and half [[adder (electronics)|adders]]. |
||
# Group the wires in two numbers, and add them with a conventional |
# Group the wires in two numbers, and add them with a conventional adder.<ref name="Bohsali_2010"/> |
||
Compared to naively adding partial products with regular adders, the benefit of the Wallace tree is its faster speed. It has <math>O(\log n)</math> reduction layers, but each layer has only <math>O(1)</math> propagation delay. A naive addition of partial products would require <math>O(\log^2n)</math> time. |
|||
⚫ | |||
⚫ | As making the partial products is <math>O(1)</math> and the final addition is <math>O(\log n)</math>, the total multiplication is <math>O(\log n)</math>, not much slower than addition. From a [[computational complexity theory|complexity theoretic]] perspective, the Wallace tree algorithm puts multiplication in the class [[NC (complexity)|NC<sup>1</sup>]]. |
||
⚫ | |||
The downside of the Wallace tree, compared to naive addition of partial products, is its much higher gate count. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
These computations only consider [[gate delay]]s and don't deal with wire delays, which can also be very substantial. |
These computations only consider [[gate delay]]s and don't deal with wire delays, which can also be very substantial. |
||
Line 24: | Line 20: | ||
The Wallace tree can be also represented by a tree of 3/2 or 4/2 adders. |
The Wallace tree can be also represented by a tree of 3/2 or 4/2 adders. |
||
It is sometimes combined with [[Booth encoding]].<ref name="tufts_2007"/><ref name="Weems_2001"/> |
|||
It is sometimes combined with [[Booth encoding]].<ref>[http://www.eecs.tufts.edu/~ryun01/vlsi/design.htm Tufts university] {{webarchive |url=https://web.archive.org/web/20100617044555/http://www.eecs.tufts.edu/~ryun01/vlsi/design.htm |date=June 17, 2010 }}</ref><ref>[http://www.cs.umass.edu/~weems/CmpSci535/Discussion7.html University of Massachusetts, Amherst] {{webarchive |url=https://web.archive.org/web/20110206142109/http://www.cs.umass.edu/~weems/CmpSci535/Discussion7.html |date=February 6, 2011 }}</ref> |
|||
== |
==Detailed explanation== |
||
The Wallace tree is a variant of [[long multiplication]]. The first step is to multiply each digit (each bit) of one factor by each digit of the other. Each of these partial products has weight equal to the product of its factors. The final product is calculated by the weighted sum of all these partial products. |
|||
The weight of a wire is the [[radix]] (to base 2) of the digit that the wire carries. In general, <math>a_nb_m</math> – have indexes of <math>n</math> and <math>m</math>; and since <math>2^n 2^m = 2^{n + m}</math> the weight of <math>a_n b_m</math> is <math>2^{n + m}</math>. |
|||
The first step, as said above, is to multiply each bit of one number by each bit of the other, which is accomplished as a simple AND gate, resulting in <math>n^2</math> bits; the partial product of bits <math>a_m</math> by <math>b_n</math> has weight <math>2^{(m+n)}</math> |
|||
In the second step, the resulting bits are reduced to two numbers; this is accomplished as follows: |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
In the third and final step, the two resulting numbers are fed to an adder, obtaining the final product. |
|||
==Example== |
==Example== |
||
Line 70: | Line 76: | ||
==See also== |
==See also== |
||
*[[Dadda tree]] |
* [[Dadda tree]] |
||
==References== |
==References== |
||
{{Reflist |
{{Reflist|refs= |
||
<ref name="Wallace_1964">{{cite journal |author-first=Christopher Stewart |author-last=Wallace |author-link=Chris Wallace (computer scientist) |title=A suggestion for a fast multiplier |journal=[[IEEE Transactions on Electronic Computers]] |volume=EC-13 |number=1 |pages=14–17 |date=February 1964 |doi=10.1109/PGEC.1964.263830 |s2cid=34688264 }}</ref> |
|||
<ref name="Bohsali_2010">{{cite web |title=Rectangular Styled Wallace Tree Multipliers |author-first1=Mounir |author-last1=Bohsali |author-first2=Michael |author-last2=Doan |date=2010 |url=http://www.veech.com/index_files/Wallace%20Tree.pdf |url-status=dead |archive-url=https://web.archive.org/web/20100215152142/http://www.veech.com/index_files/Wallace%20Tree.pdf |archive-date=2010-02-15}}</ref> |
|||
<ref name="tufts_2007">{{cite web |title=Introduction |work=8x8 Booth Encoded Wallace-tree multiplier |date=2007 |publisher=Tufts university |url=http://www.eecs.tufts.edu/~ryun01/vlsi/design.htm |url-status=live |archive-url=https://web.archive.org/web/20100617044555/http://www.eecs.tufts.edu/~ryun01/vlsi/design.htm |archive-date=2010-06-17}}</ref> |
|||
<ref name="Weems_2001">{{cite web |title=CmpSci 535 Discussion 7: Number Representations |date=2001 |orig-year=1995 |author-first=Charles C. |author-last=Weems Jr. |publisher=University of Massachusetts |location=Amherst |url=http://www.cs.umass.edu/~weems/CmpSci535/Discussion7.html |url-status=dead |archive-url=https://web.archive.org/web/20110206142109/http://www.cs.umass.edu/~weems/CmpSci535/Discussion7.html |archive-date=2011-02-06}}</ref> |
|||
}} |
|||
==Further reading== |
|||
* {{cite web |title=Advanced Arithmetic Techniques |author-first=John J. G. |author-last=Savard |date=2018 |orig-year=2006 |work=quadibloc |url=http://www.quadibloc.com/comp/cp0202.htm |access-date=2018-07-16 |url-status=live |archive-url=https://web.archive.org/web/20180703001722/http://www.quadibloc.com/comp/cp0202.htm |archive-date=2018-07-03}} |
|||
== External links == |
== External links == |
||
Line 78: | Line 93: | ||
{{DEFAULTSORT:Wallace Tree}} |
{{DEFAULTSORT:Wallace Tree}} |
||
[[Category: |
[[Category:Arithmetic logic circuits]] |
||
[[Category:Computer arithmetic]] |
[[Category:Computer arithmetic]] |
||
[[Category:Multiplication]] |
|||
[[Category:1964 introductions]] |
|||
[[Category:1964 in science]] |
Latest revision as of 07:20, 3 April 2024
This article needs additional citations for verification. (December 2009) |
A Wallace multiplier is a hardware implementation of a binary multiplier, a digital circuit that multiplies two integers. It uses a selection of full and half adders (the Wallace tree or Wallace reduction) to sum partial products in stages until two numbers are left. Wallace multipliers reduce as much as possible on each layer, whereas Dadda multipliers try to minimize the required number of gates by postponing the reduction to the upper layers.[1]
Wallace multipliers were devised by the Australian computer scientist Chris Wallace in 1964.[2]
The Wallace tree has three steps:
- Multiply each bit of one of the arguments, by each bit of the other.
- Reduce the number of partial products to two by layers of full and half adders.
- Group the wires in two numbers, and add them with a conventional adder.[3]
Compared to naively adding partial products with regular adders, the benefit of the Wallace tree is its faster speed. It has reduction layers, but each layer has only propagation delay. A naive addition of partial products would require time. As making the partial products is and the final addition is , the total multiplication is , not much slower than addition. From a complexity theoretic perspective, the Wallace tree algorithm puts multiplication in the class NC1. The downside of the Wallace tree, compared to naive addition of partial products, is its much higher gate count.
These computations only consider gate delays and don't deal with wire delays, which can also be very substantial.
The Wallace tree can be also represented by a tree of 3/2 or 4/2 adders.
It is sometimes combined with Booth encoding.[4][5]
Detailed explanation
[edit]The Wallace tree is a variant of long multiplication. The first step is to multiply each digit (each bit) of one factor by each digit of the other. Each of these partial products has weight equal to the product of its factors. The final product is calculated by the weighted sum of all these partial products.
The first step, as said above, is to multiply each bit of one number by each bit of the other, which is accomplished as a simple AND gate, resulting in bits; the partial product of bits by has weight
In the second step, the resulting bits are reduced to two numbers; this is accomplished as follows: As long as there are three or more wires with the same weight add a following layer:-
- Take any three wires with the same weights and input them into a full adder. The result will be an output wire of the same weight and an output wire with a higher weight for each three input wires.
- If there are two wires of the same weight left, input them into a half adder.
- If there is just one wire left, connect it to the next layer.
In the third and final step, the two resulting numbers are fed to an adder, obtaining the final product.
Example
[edit], multiplying by :
- First we multiply every bit by every bit:
- weight 1 –
- weight 2 – ,
- weight 4 – , ,
- weight 8 – , , ,
- weight 16 – , ,
- weight 32 – ,
- weight 64 –
- Reduction layer 1:
- Pass the only weight-1 wire through, output: 1 weight-1 wire
- Add a half adder for weight 2, outputs: 1 weight-2 wire, 1 weight-4 wire
- Add a full adder for weight 4, outputs: 1 weight-4 wire, 1 weight-8 wire
- Add a full adder for weight 8, and pass the remaining wire through, outputs: 2 weight-8 wires, 1 weight-16 wire
- Add a full adder for weight 16, outputs: 1 weight-16 wire, 1 weight-32 wire
- Add a half adder for weight 32, outputs: 1 weight-32 wire, 1 weight-64 wire
- Pass the only weight-64 wire through, output: 1 weight-64 wire
- Wires at the output of reduction layer 1:
- weight 1 – 1
- weight 2 – 1
- weight 4 – 2
- weight 8 – 3
- weight 16 – 2
- weight 32 – 2
- weight 64 – 2
- Reduction layer 2:
- Add a full adder for weight 8, and half adders for weights 4, 16, 32, 64
- Outputs:
- weight 1 – 1
- weight 2 – 1
- weight 4 – 1
- weight 8 – 2
- weight 16 – 2
- weight 32 – 2
- weight 64 – 2
- weight 128 – 1
- Group the wires into a pair of integers and an adder to add them.
See also
[edit]References
[edit]- ^ Townsend, Whitney J.; Swartzlander, Earl E.; Abraham, Jacob A. (2003). Luk, Franklin T. (ed.). "A comparison of Dadda and Wallace multiplier delays". Advanced Signal Processing Algorithms, Architectures, and Implementations XIII. 5205: 552–560. Bibcode:2003SPIE.5205..552T. doi:10.1117/12.507012. ISSN 0277-786X. S2CID 121437680.
- ^ Wallace, Christopher Stewart (February 1964). "A suggestion for a fast multiplier". IEEE Transactions on Electronic Computers. EC-13 (1): 14–17. doi:10.1109/PGEC.1964.263830. S2CID 34688264.
- ^ Bohsali, Mounir; Doan, Michael (2010). "Rectangular Styled Wallace Tree Multipliers" (PDF). Archived from the original (PDF) on 2010-02-15.
- ^ "Introduction". 8x8 Booth Encoded Wallace-tree multiplier. Tufts university. 2007. Archived from the original on 2010-06-17.
- ^ Weems Jr., Charles C. (2001) [1995]. "CmpSci 535 Discussion 7: Number Representations". Amherst: University of Massachusetts. Archived from the original on 2011-02-06.
Further reading
[edit]- Savard, John J. G. (2018) [2006]. "Advanced Arithmetic Techniques". quadibloc. Archived from the original on 2018-07-03. Retrieved 2018-07-16.