33

Wallace Tree

 4 years ago
source link: https://en.wikipedia.org/wiki/Wallace_tree
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
220px-Hindu_lattice_2.svg.png

basic principle known from manual multiplication. Image shows a manual example of multiplying 345(top) by 12(side).

220px-Wallace_tree_8x8_%28corrected%29.svg.png

Example of reduction on an 8x8 multiplier.

A Wallace tree is anefficient hardware implementation of a digital circuit that multiplies two integers, devised by Australian Computer ScientistChris Wallace in 1964.

The Wallace tree has three steps:

  1. Multiply (that is – AND) each bit of one of the arguments, by each bit of the other, yielding ac9810bbdafe4a6a8061338db0f74e25b7952620 results. Depending on position of the multiplied bits, the wires carry different weights, for example wire of bit carrying result of d4085ef43e8ac8ad55cec8329438998514301d54 is 128 (see explanation of weights below).
  2. Reduce the number of partial products to two by layers of full and half adders.
  3. Group the wires in two numbers, and add them with a conventionaladder.

The second step works 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 afull 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 ahalf adder.
  • If there is just one wire left, connect it to the next layer.

The benefit of the Wallace tree is that there are only aae0f22048ba6b7c05dbae17b056bfa16e21807d reduction layers, and each layer has e66384bc40452c5452f33563fe0e27e803b0cc21 propagation delay. As making the partial products is e66384bc40452c5452f33563fe0e27e803b0cc21 and the final addition is aae0f22048ba6b7c05dbae17b056bfa16e21807d , the multiplication is only aae0f22048ba6b7c05dbae17b056bfa16e21807d , not much slower than addition (however, much more expensive in the gate count). Naively adding partial products with regular adders would require fffd24c1c4dc51509ec642f02b4b8d2ca1853d8f time. From acomplexity theoretic perspective, the Wallace tree algorithm puts multiplication in the class NC 1 .

These computations only considergate 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 withBooth encoding.

Contents

Weights explained [ edit ]

The weight of a wire is theradix (to base 2) of the digit that the wire carries. In general, 4db5d6ec1802ae54af265ddfb3a7d9c8d9af64e9 – have indexes of a601995d55609f2d9f5e233e36fbe9ea26011b3b and 0a07d98bb302f3856cbabc47b2b9016692e3f7bc ; and since 3283ee1685aea9afc799220fb04fc63fa13fc0c0 the weight of 4db5d6ec1802ae54af265ddfb3a7d9c8d9af64e9 is 4d765604bbe739e52b251ab51de120c031b56bee .

Example [ edit ]

d928ec15aeef83aade867992ee473933adb6139d , multiplying 894bf4e81c14ae3394f7b5b054bb8d3352f1daa7 by 8922d379aee18369ed56079b4b1f135f0bd884fe :

  1. First we multiply every bit by every bit:
    • weight 1 – 319b6c9d12790b25a026a8db45d48c4d9f393a4a
    • weight 2 – 8af845bd1bfaaf94c0055defd56af36547057f69 , fa0a931e81c9672406765149e0357d020d853835
    • weight 4 – 493d5ca90fecb292051bee2c855efe561ce8ee45 , 0ee83774261915284e6c07baa9521652f9a77666 , 5b66cf9babea41e8f50befe45ff697a6861506a6
    • weight 8 – 5843e86079d58c077dce630e9b9933e80f2ce32c , 9cb6e241a806f6bd27ba491fd48650b8606f562e , d8aa5720677fbed4e6a5b967f4031bde2d926299 , 134f52cb030ad9b72bf1241cc6542fb6cc18d6c2
    • weight 16 – 6ada04b99e48123347c8b6c4994aa7c3076fcec4 , ad6b96d72d68bceedd7d55fb2c44e62ff3c60b1a , 187bbad836b41324ef8f9d158980687b35e7fdcc
    • weight 32 – 99ac5d370322c1c456feef45ef9ebdf65a45a8bc , 7839991362f0e95fc40d1c8fdd2ff72c71f30108
    • weight 64 – f4bf0bda4b8f48f7c72ce5488b6259fdf6202946
  2. 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
  3. 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
  4. Reduction layer 2:
    • Add a full adder for weight 8, and half adders for weights 4, 16, 32, 64
  5. 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
  6. Group the wires into a pair of integers and an adder to add them.

See also [ edit ]

References [ edit ]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK