U13 DPSD - Arithmetic Operations
U13 DPSD - Arithmetic Operations
1 1 1 1 1 1 carries
1
1 1 1 0 1 Augend
+ 1 0 1 1 1 Addend
---------------------
1 0 1 0 1 0 0 Sum
Binary Subtraction
° We can also perform subtraction (with borrows in place of carries).
° Let’s subtract (10111)2 from (1001101)2…
1 10 borrows
0 10 10 0 0 10
Minuend
1 0
0 1 1 0 1
- 1 0 1 1 1 Subtrahend
------------------------
Difference
1 1 0 1 1 0
Binary Multiplication
Binary multiplication is much the same as decimal multiplication, except
that the multiplication operations are much simpler…
1
0 1 1 1 Multiplicand
X 1 0 1 0 Multiplier
-----------------------
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
-----------------------
1 1 1 0 0 1 1 0 Product
Complements
• Used to simplifying the subtraction
• Simplification lead to simpler and less expensive circuits
to implement
Radix / Base r 2 10
Radix complement r 2 10
Diminished radix complement r-1 1 9
Complements
999999
– 9’s complement -546700
• Subtract each digit from 9
453299
– 10’s complement
• Subtract each digit from 9 and add 1 to the result
• Subtract the first non zero from 10 and all others from 9
• Count the number of digit and subtract from 10n
999999
-546700 9 9 9 10 - -
1000000
453299 -5 4 6 7 0 0
- 546700
+ 1 453 3 00
453300
453300
Complements
– 1’s complement 1111111
– Find the inverse of the given number 1011000
0100111
– 2’s complement
– Find the inverse of the given number and add 1 to the result
– Keep the first non zero as such and then complement the others
– Count the number of digit and subtract from 2n
1111111
1011000 1112 - - -
10000000
0100111 -1 0 1 1 0 0 0
-1011000
+ 1 0 101000
0101000
0101000
Subtraction with r’s Complement
+ 52532
9’s comp 96749 + 52532
149281 10’s comp 96750
(carry Positive , 9’s comp so add
149282
carry) 1
(carry Positive , 10’s comp so
49282
discard carry)
49282
Subtraction with Complement
• 3250 - 52532
Radix 52532 3250
R-1 47467 96749
R 47468 96750
+ 03250 + 03250
9’s comp 47467 10’s comp 47468
50717 50718
(No carry , negative (No carry , negative
Find 9’s complement ) Find 10’s complement )
- 49282 -49282
Subtraction with Complement
• 1010100 – 1000011
Radix 1010100 1000011
R-1 0101011 0111100
R 0101100 0111101
+ 1010100
1’s comp 0111100
10010000 + 1010100
(carry Positive , 1’s comp so add carry) 2’s comp 0111101
1
10010001
0010001
(carry Positive , 2’s comp so discard
carry)
0010001
Subtraction with Complement
• 1000011 – 1010100
Radix 1010100 1000011
R-1 0101011 0111100
R 0101100 0111101
+1000011 +1000011
1’s comp 0101011 2’s comp 0101100
1101110
1101111
(No carry , negative
Find 1’s complement ) (No carry , negative
-0010001 Find 2’s complement )
-0010001
Signed Binary Numbers
Sign Magnitude
bit
Number : 10101
Signed: 10101 = -5
Unsigned : 10101 = 21
Signed Binary Numbers
• Representation:
Signed Binary Numbers
September 5, 2003
Signed Binary Numbers
■ Arithmetic Addition
signed-magnitude Addition
The addition of two numbers in the signed-magnitude system follows the rules
of ordinary arithmetic.
If the signs are the same, we add the two magnitudes and give the sum the
common sign.
If the signs are different, we subtract the smaller magnitude from the larger
and give the difference the sign of the larger magnitude.
Negative numbers are changed into positive numbers using r’s complement
+6 00000110
-13 11110011
-6 11111010
-7 11111001 -6 11111010
+13 00001101
sign bit 1 so find 2’s comp. -13 11110011
+7 100000111
-19 111101101
Discard carry, sign bit 0
Discard Carry
sign bit 1 so find 2’s comp.