You are on page 1of 14

How to design a

multiplier?
TA: R07943123 馬咏治
Contact: R07943123@ntu.edu.tw
How to compute 4*3?
• Easy! Ans = 4+4+4 = 12
• How about 4*5 ?
• Ans = 4+4+4+4+4 = 20
• The result of multiplication is the answer of successive addition.
Software implementation

• To compute a*b
• C++: • Python
• ans = 0; • ans = 0
• for(int i=0;i<b;++i) • for i in range(b):
• ans = ans + a;
• ans = ans + a
Hardware implementation ?
Does it work?

a Adder Adder Adder ans

b times
直式乘法
Multiplication Detail
A3 A2 A1 A0

B3 B2 B1 B0

B0A3 B0A2 B0A1 B0A0

B1A3 B1A2 B1A1 B1A0

B2A3 B2A2 B2A1 B2A0

B3A3 B3A2 B3A1 B3A0

M7 M6 M5 M4 M3 M2 M1 M0
Step 1 compute trivial term
A3 A2 A1 A0

B3 B2 B1 B0

B0A3 B0A2 B0A1 B0A0

B1A3 B1A2 B1A1 B1A0


M0 = B0A0
B2A3 B2A2 B2A1 B2A0

B3A3 B3A2 B3A1 B3A0

M7 M6 M5 M4 M3 M2 M1 M0
Step 2 compute partial sum
A3 A2 A1 A0

0 B0A3 B0A2 B0A1


B3 B2 B1 B0
B1A3 B1A2 B1A1 B1A0

Add 0 here 0 B0A3 B0A2 B0A1 B0A0


FA4_1_2 FA4_1_2 FA4_1_1 M1
B1A3 B1A2 B1A1 B1A0

FA4_1_Co(Carry out)
B2A3 B2A2 B2A1 B2A0

B3A3 B3A2 B3A1 B3A0


M1 is the LSB of
output of adder

M7 M6 M5 M4 M3 M2 M1 M0
Step 2 compute partial sum(cont.)
A3 A2 A1 A0

0 B0A3 B0A2 B0A1


B3 B2 B1 B0
B1A3 B1A2 B1A1 B1A0

FA4_1_2 FA4_1_2 FA4_1_1 M1


Add carry FA4_1_
Co
FA4_1_2 FA4_1_2 FA4_1_1

out here
FA4_1_Co(Carry out)
B2A3 B2A2 B2A1 B2A0

B3A3 B3A2 B3A1 B3A0

M7 M6 M5 M4 M3 M2 M1 M0
Step 2 compute partial sum(cont.)
A3 A2 A1 A0
FA4_1_
FA4_1_2 FA4_1_2 FA4_1_1
Co
B3 B2 B1 B0
B2A3 B2A2 B2A1 B2A0

FA4_2_2 FA4_2_2 FA4_2_1 M2

Add carry FA4_2_


out here
FA4_2_2 FA4_2_2 FA4_2_1 FA4_2_Co(Carry out)
Co

B3A3 B3A2 B3A1 B3A0

M7 M6 M5 M4 M3 M2 M1 M0
Step 2 compute partial sum(cont.)
A3 A2 A1 A0

B3 B2 B1 B0

FA4_2_
FA4_2_2 FA4_2_2 FA4_2_1
Co

B3A3 B3A2 B3A1 B3A0

M6 M5 M4 M3

M7(Carry out)
How to implement
multiplier on Quartus II?
• Step 1 : reuses your 4bits full adder,
create a symbol of it. (FA4.bsf)

It’s just an example, you can


create it by your own way
Then, draw the circuit !!
Question?

You might also like