Binary Multiplication Magnitude Comparison Section 4.5, 4.7 and 4.8
Two-Bit Binary Multiplier (multiplicand) (multiplier)
Use an AND gate to multiply A 0 and B 0
Hardware Correlation
G0G1 G2G3 W[0] W[1] W[2] W[3]
two_bit_multiplier.v
two_bit_multiplier_top.v
A Four-Bit Adder
Four-bit by three-bit Binary Multiplier B3B2B1B0 A2A1A0 0A0B3A0B2A0B1A0B0 A1B3A1B2A1B1A1B0 C14S13S12S11S10 A2B3A2B2A2B1A2B0 C6C5C4C3C2C1C0 S10=A0B1+A1B0 S11=A0B2+A1B1+C11 S12=A0B3+A1B2+C12 S13=0+A1B3+C13 (S1X/C1X, where 1 is the first 4-bit adder)
Four-bit by three-bit Binary Multiplier
Magnitude Comparison Given A and B where – A=A 3 A 2 A 1 A 0 – B=B 3 B 2 B 1 B 0 Three possibilities: – A=B – A>B – A<B
A=B A=B, if all pairs of significant digits are equal – A 3 =B 3 – A 2 =B 2 – A 1 =B 1 – A 0 =B 0 Each pair can be equal if they are either 0s or 1s – X i =A i B i +A’ i B’ i
Magnitude Comparator Circuit
Equality Check X i =A i B i +A’ i B’ i (Identical?)
A>B Start from the most significant bit – A=1*** >B=0*** Work toward less significant bits – A=11**>B=10**
Interpretation Comments: If any of the terms gives rise to a 1 A>B. 1 if A 3 =1 and B 3 =0 x 3 can only be a 1 if A 3 =B 3. x 2 can only be a 1 if A 2 =B 2. X 1 can only be a 1 if A 1 =B 1. Interpretation: 1 is only possible if A3=B3 and A2=1 and B2=0.
A>B
(Does this equation make sense?)
Verilog Operator
Verilog
Greater than
Less than
Equal