SYEN 3330 Digital Systems Chapter 5 – Part 2 SYEN 3330 Digital Systems Jung H. Kim Chapter 5 -2 1
Complements • Subtraction of numbers requires a different algorithm than addition. • Adding a complement of a number is equivalent to subtraction. • We will discuss two complements: Diminished Radix Complement • Subtraction will be accomplished by adding a complement. SYEN 3330 Digital Systems 2
Diminished Radix Complement SYEN 3330 Digital Systems 3
Binary 1's Complement SYEN 3330 Digital Systems 4
Radix Complement SYEN 3330 Digital Systems 5
Binary 2's Complement SYEN 3330 Digital Systems 6
Binary 2's Complement Examples SYEN 3330 Digital Systems 7
Efficient 2’s Complement SYEN 3330 Digital Systems 8
Two's Complement Example SYEN 3330 Digital Systems 9
Subtraction with Radix Complements SYEN 3330 Digital Systems 10
Example: Find 543 SYEN 3330 Digital Systems 10 - 123 10 11
Example: Find 123 SYEN 3330 Digital Systems 10 - 543 10 12
Binary Example SYEN 3330 Digital Systems 13
Another Binary Example SYEN 3330 Digital Systems 14
Subtract: Add 1’s Complement SYEN 3330 Digital Systems 15
1’s Complement Subtraction SYEN 3330 Digital Systems 16
1’s Complement Subtraction SYEN 3330 Digital Systems 17
Signed Integers SYEN 3330 Digital Systems 18
Interpreting the Other Digits SYEN 3330 Digital Systems 19
Example: Given r=2, n=3 SYEN 3330 Digital Systems 20
Addition with Signed Numbers SYEN 3330 Digital Systems 21
Signed-Magnitude Arithmetic SYEN 3330 Digital Systems 22
Sign-Magnitude Examples SYEN 3330 Digital Systems 23
Signed-Complement Arithmetic SYEN 3330 Digital Systems 24
Binary Adder/Subtractor A(3) B(3) C(4) x Co y FA S S(3) SYEN 3330 Digital Systems Ci C(3) A(1) B(1) A(2) B(2) x Co y FA S S(2) Ci C(2) x Co y FA S S(1) Ci C(1) A(0) B(0) x Co y FA S S(0) 25 Ci C(0)