| |||||||||
In digital design, a multiplier or multiplication ALU is a hardware circuit dedicated to multiplying two binary values.
A variety of computer arithmetic techniques can be used to implement a digital multiplier. Most techniques involve computing a set of partial products, and then summing the partial products together. This process is similar to the method taught to primary schoolchildren for conducting long multiplication on base-10 integers, but has been modified here for application to a base-2 (binary) number system.
For example, suppose we want to multiply two unsigned eight bit integers together: a[7:0] and b[7:0]. We can product eight partial products by performing eight one-bit multiplications, one for each bit in multiplicand a:
To produce our product, we then need to add up all eight of our partial products, as shown here:
In other words, P[15:0] is produced by summing p0, p1 << 1, p2 << 2, and so forth, to produce our final unsigned 16-bit product.
If b had been a signed integer instead of an unsigned integer, then the partial products would need to have been sign-extended up to the width of the product before summing. If a had been a signed integer, then partial product p7 would need to be subtracted from the final sum, rather than added to it.
Older multiplier architectures employed a shifter and accumulator to sum each partial product, often one partial product per cycle. Modern multiplier architectures use something similar to a Wallace tree to add the partial products together in a single cycle. The performance of the Wallace tree implementation is sometimes improved by FPGAs