Complements: Department of Electronics Engineering
Complements: Department of Electronics Engineering
COMPLEMENTS
- this is used in digital computers to simplify subtraction operations
TWO TYPES
a. Radix Complement
- defined as rn-N for N≠0 where r is the base, n is the number of characters in the given number N
DECIMAL : 10’s complement or 10’s KPL
BINARY : 2’s complement or 2’s KPL
Examples:
Obtain the 10’s KPL and 9’s KPL of the following decimal numbers.
a. 76510 c. 103610
10’s KPL: d. 892010
rn-N = 103-765 e. 3561210
= 1000-765
= 235
9’s KPL
(rn-1)-N = (103-1)-765
= 999-765
= 234
b. 348210
10’s KPL:
rn-N = 104-3482
= 10000-3482
= 6518
9’s KPL
(rn-1)-N = (104-1)-3482
= 9999-3482
= 6517
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 1
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
Examples:
Obtain the 2’s KPL and 1’s KPL of the following binary numbers.
a. 10112 c. 11002
2’s KPL: d. 100011112
rn-N = 24-1011 e. 110011012
= 10000-1011
= 0101
1’s KPL
(rn-1)-N = (24-1)-1011
= 1111-1011
= 0100
b. 100112
2’s KPL:
rn-N = 105-10011
= 100000-10011
= 01101
1’s KPL
(rn-1)-N = (105-1)-10011
= 011111-10011
= 01100
Example:
1. 1510 2. 1010
-610 -310
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 2
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
Example.
1. 5810 2. 810
-8910 -1510
Example.
+5210 0 | 110 100
-5210 1 | 110 100
Sign| Magnitude
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 3
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
BINARY CODES
- These are codes that make use of combinations of 0 and 1 to represent a value or character.
(invalid codes)
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 4
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
PARITY BIT
- An extra bit included by or with a message to make the total number of 1s transmitted
either odd or even.
MESSAGE ODD PARITY EVEN PARITY
0000 1 0
0001 0 1
0010 0 1
0011 1 0
0100 0 1
0101 1 0
0110 1 0
0111 0 1
1000 0 1
1001 1 0
1010 1 0
1011 0 1
1100 1 0
1101 0 1
1110 0 1
1111 1 0
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 5
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
GRAY CODE
- This code is conveniently used to represent digital data when it is converted from analog
data.
- The advantage of the gray code over binary numbers is that only one bit in the code group
changes when going from one number to the next.
Graphic Characters
26 Upper case
26 Lower case
10 Numerals
32 Special Characters
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 6
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
BINARY LOGIC
- It deals with variables that take on the two discrete values and with operations that assume
logical meaning
- It is used to describe, in a mathematical way, the manipulation and processing of binary
information
- Binary Logic is equivalent to an algebra called BOOLEAN ALGEBRA
TRUTH TABLE
- this is a table of all possible combinations of the input variables showing the relation between
the values that the variables may take as the result of the operation.
AND OR NOT
X Y X·Y X Y X·Y X ̅
𝑿
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 7
ECE311
LOGIC CIRCUITS AND SWITCHING THEORY
Department of Electronics Engineering
LOGIC GATES
- these are electronic digital circuits that perform the logical operations
- they consist of semiconductor components (diodes/transistors) that produce a logic 0 or 1
BOOLEAN ALGEBRA
Basic Theorems and Postulates
Engr. VMGabon
Reference: Digital Design, Morris Mano Page 8