Instructor: Alexander Stoytchev CprE 281: Digital Logic
Multiplication CprE 281: Digital Logic Iowa State University, Ames, IA Copyright © Alexander Stoytchev
Administrative Stuff HW 6 is out It is due next Monday (Oct 14) Wednesday (Oct 16)
Quick Review
The story with floats is more complicated IEEE Standard [
In the example shown above, the sign is zero so s is +1, the exponent is 124 so e is −3, and the significand m is 1.01 (in binary, which is 1.25 in decimal). The represented number is therefore × 2 −3, which is [
Figure IEEE Standard floating-point formats. Sign 32 bits 23 bits of mantissa excess-127 exponent 8-bit 52 bits of mantissa11-bit excess-1023 exponent 64 bits Sign SM SM (a) Single precision (b) Double precision E + E 0 denotes – 1 denotes
On-line IEEE 754 Converters
Decimal Multiplication What happens when we multiply a number by 10? 4 x 10 = ? 542 x 10 = ? 1245 x 10 = ?
Decimal Division What happens when we divide a number by 10? 14 / 10 = ? 540 / 10 = ? 1240 x 10 = ?
Decimal Division What happens when we divide a number by 10? 14 / 10 = ? 540 / 10 = ? 1240 x 10 = ?
Binary Multiplication by 2 What happens when we multiply a number by 2? 011 times 2 = ? 101 times 2 = ? times 2 = ?
Binary Multiplication by 2 What happens when we multiply a number by 2? 011 times 2 = times 2 = times 2 = You simply add a zero as the rightmost number
Binary Multiplication by 4 What happens when we multiply a number by 4? 011 times 4 = ? 101 times 4 = ? times 4 = ?
Binary Multiplication by 4 What happens when we multiply a number by 4? 011 times 4 = times 4 = times 4 = add two zeros in the last two bits and shift everything else to the left
Binary Multiplication by 2 N What happens when we multiply a number by 2 N ? 011 times 2 N = 01100…0 // add N zeros 101 times 4 = 10100…0 // add N zeros times 4 = …0 // add N zeros
Binary Division by 2 What happens when we divide a number by 2? 0110 divided 2 = ? 101 times 2 = ? times 2 = ?
Decimal Multiplication By Hand [
Binary Multiplication By Hand [Figure 3.34a from the textbook]
Binary Multiplication By Hand [Figure 3.34b from the textbook]
Binary Multiplication By Hand [Figure 3.34c from the textbook]
Figure Multiplication of unsigned numbers.
Figure A 4x4 multiplier circuit.
Positive Multiplicand Example Multiplicand M Multiplier Q Product P (+14) (+11) (+154) Partial product 0 Partial product 1 Partial product 2 Partial product 3 x [Figure 3.36a in the textbook]
Negative Multiplicand Example Multiplicand M Multiplier Q Product P ( 14) (+11) ( 154) Partial product 0 Partial product 1 Partial product 2 Partial product 3 – – [Figure 3.36b in the textbook]
Binary Coded Decimal
Table 3.3. Binary-coded decimal digits.
Figure Addition of BCD digits.
Figure Block diagram for a one-digit BCD adder.
modulebcdadd(Cin,X,Y,S, Cout); inputCin; input[3:0] X,Y; outputreg [3:0] S; outputreg Cout; reg[4:0] Z; (X,Y,Cin) begin Z=X+Y+Cin; if(Z<10) {Cout,S}=Z; else {Cout,S}=Z+6; end endmodule Figure Verilog code for a one-digit BCD adder.
Figure Circuit for a one-digit BCD adder.
Questions?
THE END