Beruflich Dokumente
Kultur Dokumente
This 20-pin IC provides inputs for two 4-bit numbers A3..A0 and
B3..B0 and a 4-bit output F3..F0
= 1001 + 100100
= 101101 + 1001000
= 1110101
Binary Multiplication
Binary Multiplication Circuit
How many bits do we need to multiply 2 4-bit numbers.
15 x 15 = 225
1 1 1 1 x 1 1 1 1 =1 1 1 0 0 0 0 1
8-Bit System
Binary Multiplication
Binary Multiplication Circuit
A circuit that will perform binary multiplication is shown
on the next slide.
This circuit contains three registers X, B, A
The X register stores the multiplier bits
The B register stores the multiplicand bits
The A register (accumulator) stores the partial products
X and B are shift registers (X shifts right, B shifts left).
ADD X0
Common CLK inputs
transfer
Clock
D D D D D D D D
CLK CLK CLK CLK CLK CLK CLK CLK
Accumulator
A7 A A5 A4 A3 A2 A1 A0
6 C0 = 0
To S4
FFs To
A4 -A 7 S5 FFs
8-bit parallel adder
S6 A0 -A3
D inputs S7 D inputs
B7 B6 B5 B 4 B3 B 2 B 1 B0 D
Multiplicand D D D D D CLK
D D
CLK CLK CLK CLK CLK CLK CLK
Multiplier
D X3 D X2 D X1 D X0
A triggers B and X
shift CLK CLK CLK CLK
Clock
Pulses
4) On the PGT of the second clock pulse, the clock signal does not pass through
the AND gate as the value from the X register is 0. Hence the A register is
unchanged. On the NGT, the X and B registers are shifted as before.
Binary Multiplication
Binary Multiplication Circuit - Operation
5) On the PGT of the third clock pulse, as X = 1, the output of the AND gate
becomes 1 and thus the A registers are clocked. The output of the adder
(101101) is transferred to the A register. On the NGT of this clock pulse, the
contents of the X register again shift to the right, while the contents of the B
register shift to the left.
6) On the PGT of the fourth clock pulse, as X is again 1, the output of the AND
gate becomes 1 and thus the A registers are clocked. The output of the adder
(1110101) is transferred to the A register. On the NGT of this clock pulse, the
contents of the X register again shift to the right, while the contents of the B
register shift to the left. The X register bits are now all zero, and the process is
complete.
The similarities between the process described above and the way we perform
multiplication manually should be noted.
Binary Multiplication - AHDL
Fortunately for us, AHDL has a megafunction for multiplication too.
It is used as follows:
INCLUDE "lpm_mult.inc";
SUBDESIGN multiply
(
a[3..0], b[3..0] : INPUT;
s[7..0] : OUTPUT;
)
BEGIN
(s[]) = lpm_mult (a[], b[],,,)
WITH (LPM_WIDTHA = 4, LPM_WIDTHB = 4, LPM_WIDTHP = 8,
LPM_WIDTHS = 4)
END;