I got this question how on earth do you multiply using logic gates?
Any way that's appropriate. There have been serial bit-by-bit
that did add/carry until the result was complete, there have been
lookup table (like multiplication table) elements that were cascaded
just like children do multiplication in grade school.
Modern solutions often use a table of squares; given A, and B,
form sum/difference, and lookup the squares in a table
C = (A + B) **2
D= (A - B)**2
and note that
C - D = 2 A B
So three addition operations, two table lookups, and a
divide-by-two substitute for a multiplication table.
A table of all the squares for A, B in the range of 1:1,000,000
has 2*10**6 elements, while the table of A*B has 1*10**12
elements (a savings in number of gates used, factor of 500,000).
The multiplication problem thus reduces to addition, subtraction, and
table-of-values lookup. Solve those with gates, and bolt the
For extra credit, can you imagine building a logic circuit that
takes the logarithm of a number?
Wot as in a priority encode (characteristic) and shifter (mantissa) for a
piecewise linear approximation??
No, I can't imagine.