Digital Design CEN 212: Digital Systems and Binary Numbers
Digital Design CEN 212: Digital Systems and Binary Numbers
CEN 212
Chapter 1
Digital Systems and Binary Numbers
1.5 Complements
Complements are used in digital computers to simplify the
subtraction operation and for logical manipulation.
Simplifying operations leads to simpler, less expensive circuits to
implement the operations.
There are two types of complements for each base-r system: the
radix complement and diminished radix complement.
The first is referred to as r’s complement, and the second as (r-
1)’s complement.
For binary the 2’s complement and 1’s complements, and for
decimal the 10’s and the 9’s complement.
Complements
Diminished Radix Complement - (r-1)’s Complement
Given a number N in base r having n digits, the (r–1)’s complement of N
is defined as:
(rn –1) – N
Example for 6-digit decimal numbers:
9’s complement is (rn – 1)–N = (106–1)–N = 999999–N
9’s complement of 546700 is 999999–546700 = 453299
Example for 7-digit binary numbers:
1’s complement is (rn – 1) – N = (27–1)–N = 1111111–N
1’s complement of 1011000 is 1111111–1011000 = 0100111
Observation:
Subtraction from (rn – 1) will never require a borrow
Diminished radix complement can be computed digit-by-digit
For binary: 1 – 0 = 1 and 1 – 1 = 0
Complements
1’s Complement (Diminished Radix Complement)
All ‘0’s become ‘1’s
All ‘1’s become ‘0’s
Example (10110000)2
(01001111)2
If you add a number and its 1’s complement …
10110000
+ 01001111
11111111
Complements
Radix Complement
Example: Base-10
Example: Base-2
Example:
Number:
1’s Comp.:
10110000 10110000
01001111
+ 1
01010000 01010000
Complements
In case N contains radix point, the point should be removed
temporarily in order to form the r’s and (r-1)’s complement. The
radix point is then restored to the complement number in the
same relative position.
Note: The complement of the complement restores the number to
its original value.
Complements
Subtraction with Complements
The direct method of subtraction taught in elementary schools uses
the borrow concept. In this method, we borrow a 1 from a higher
significant position when the minuend digit is smaller than the
subtrahend digit. The method works well when people perform
subtraction with paper and pencil. However when subtraction is
implemented with digital hardware, the method is less efficient
than the method that uses complements.
Complements
The subtraction of two n-digit unsigned numbers M – N in base r can be
done as follows:
Complements
Example 1.5
Using 10's complement, subtract 72532 – 3250.
Example 1.6
Using 10's complement, subtract 3250 – 72532.
There is no end
carry.
Table 1.3 lists all possible four-bit signed binary numbers in the three
representations.
Signed Binary Numbers