Chapter 3
Chapter 3
Chapter-3
Addition & Subtraction
Overflow conditions for addition &
subtraction
Multiplication
First Version of Multiplication Hardware
Flowchart (First Version of Multiplication)
Refined Version of Multiplication Hardware
Refined Version of Multiplication Hardware
Refined Version of Multiplication Hardware
Signed 2's Complement Multiplication
Booth’s Algorithm
Note 1: The this algorithm is easy to use, but hairy to theoretically prove.
Note 2: All shifting of the product extends the sign bit.
Signed 2's Complement Multiplication
Booth’s Algorithm
Signed 2's Complement Multiplication
Booth’s Algorithm
Signed 2's Complement Multiplication
Booth’s Algorithm
Signed 2's Complement Multiplication
Booth’s Algorithm
Interpretation of New Rule For Booth’s Algorithm
• Now we now are testing 2 bits: LSB of product register and previous
shifted out bit (initialized to 0 at the beginning):
– A way of detecting a run of consecutive ones in the multiplier:
Multiplier being shifted out of the right side of the product register:
end of run middle of run beginning of run
000000000001111111111110000000000000
– 01: End of string of 1’’s, so add the multiplicand to the left half of th product
register (ignore any net carry outs)
– 10: beginning of a string of 1’s, so subtract the multiplicand from the left half of the
product register (ignoring any net carry outs)
• Note that all the “action” (subtract or add) takes place only on “entering” or
leaving a run of ones.
Example of Booth’s Algorithm
• Scientific Notation
4.8 Floating Point
• Normalized numbers:
• A number in scientific notation that has no leading
zeros.
• 1.0 × 10-9
• 0.1 × 10-8
• 10.0 × 10-10 ×
4.8 Floating Point
• 1.0 × 2-1
Binary Point
• 1. xxxxxxxx × 2yyyy
• Computer arithmetic that support such numbers is called
floating point because it represents numbers in which the
binary point is not fixed.
4.8 Floating Point
• (-1)S × (1 + Significand) × 2E
• (-1)S × (1 + (s1 × 2-1) + (s2 × 2-2) + … … ) × 2E
• IEEE 754
31302928272625242322212019181716151413121110 9 8 7 6 5 4 3 2 1 0
s exponent significand
1 bit 11 bits 20 bits
31302928272625242322212019181716151413121110 9 8 7 6 5 4 3 2 1 0
Significand (Continued)
32 bits
Floating Point Representation
• When we want to represent zero (0)
• (-1)S × (1 + Significand) × 2E
• (-1)S × (1 + (s1 × 2-1) + (s2 × 2-2) + … … ) × 2E
31302928272625242322212019181716151413121110 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• 1+0=1
Floating Point Representation
• Biased Notation
• 1.0 × 2-1
31302928272625242322212019181716151413121110 9 8 7 6 5 4 3 2 1 0
0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• 1.0 × 2+1
31302928272625242322212019181716151413121110 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
• -1 -1 + 127 = 126
• +1 +1 + 127 = 128
• (-1)S × (1 + Significand) × 2(Exponent – Bias)
• For Double Precision bias is 1023
Floating Point
Addition
Floating Point Addition
9.999 × 101 + 1.610 × 10-1
• Step 1: (Change the smaller number)
1.610 × 10-1 = 0.1610 × 100 = 0.01610 × 101
• Step 2: (Addition of the significands)
9.999
+ 0.016
10.015
10.015 × 101
Floating Point Addition
• 10.015 × 101
• Step 3: (Find the normalized form)
10.015 × 101 = 1.0015 × 102
Check for overflow and underflow
• Step 4: (Round the number)
1.0015 × 102 = 1.002 × 102
Normalize again if required
Floating Point
Multiplication
Floating Point Multiplication
(1.110 × 1010) × (9.200 × 10-5)
• Step 1: (Find the exponent of the product)
New exponent = 10 + (-5) = 5
• Considering bias
New exponent = (10 + 127) + (-5 + 127)
= 137 +122 = 259 ×
New exponent = 137 + 122 -127
= 132
Floating Point Multiplication
(1.110 × 1010) × (9.200 × 10-5)
New exponent = 5 or 132
• Step 2: (Multiplication of the significands)
1.110
× 9.200
0000
0000
2220
9990
10212000
• 10.212000 × 105 = 10.212 × 105
Floating Point Multiplication
(1.110 × 1010) × (9.200 × 10-5)
New exponent = 5 or 132
New product = 10.212 × 105
• Step 3: (Normalize the product)
10.212 × 105 = 1.0212 × 106
Check for overflow and underflow
• Step 4: (Round the number)
1.0212 × 106 = 1.021 × 106
Floating Point Multiplication
(1.110 × 1010) × (9.200 × 10-5)
New product = 1.021 × 106
• Step 5: (Put the sign of the product)
+1.0212 × 106