Wallace tree

Wallace tree

Discussion

Encyclopedia

A Wallace tree is an efficient
Computational complexity theory
Computational complexity theory is a branch of the theory of computation in theoretical computer science and mathematics that focuses on classifying computational problems according to their inherent difficulty, and relating those classes to each other...

hardware
Computer hardware
Personal computer hardware are component devices which are typically installed into or peripheral to a computer case to create a personal computer upon which system software is installed including a firmware interface such as a BIOS and an operating system which supports application software that...

implementation of a digital circuit that multiplies two integers, devised by an Australian Computer Scientist Chris Wallace
Chris Wallace (computer scientist)
Professor Christopher Stewart Wallace was an Australian computer scientist notable for having devised:...

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 results. Depending on position of the multiplied bits, the wires carry different weights, for example wire of bit carrying result of is 32 (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 conventional adder
In electronics, an adder or summer is a digital circuit that performs addition of numbers.In many computers and other kinds of processors, adders are used not only in the arithmetic logic unit, but also in other parts of the processor, where they are used to calculate addresses, table indices, and...

.

The second phase 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 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.

The benefit of the Wallace tree is that there are only reduction layers, and each layer has propagation delay. As making the partial products is and the final addition is , the multiplication is only , not much slower than addition (however, much more expensive in the gate count). Naively adding partial products with regular adders would require time. From a complexity theoretic
Computational complexity theory
Computational complexity theory is a branch of the theory of computation in theoretical computer science and mathematics that focuses on classifying computational problems according to their inherent difficulty, and relating those classes to each other...

perspective, the Wallace tree algorithm puts multiplication in the class NC1
NC (complexity)
In complexity theory, the class NC is the set of decision problems decidable in polylogarithmic time on a parallel computer with a polynomial number of processors. In other words, a problem is in NC if there exist constants c and k such that it can be solved in time O using O parallel processors...

.

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.

Weights explained

The weight of a wire is the radix (to base 2) of the digit that the wire carries. In general, – have indexes of and ; and since the weight of is .

Example

, multiplying by :
1. First we multiply every bit by every bit:
• weight 1 -
• weight 2 - ,
• weight 4 - , ,
• weight 8 - , , ,
• weight 16 - , ,
• weight 32 - ,
• weight 64 -
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 integers and an adder to add them.