0% found this document useful (0 votes)
58 views

Complements: Department of Electronics Engineering

This document discusses binary codes and logic circuits. It covers topics like complements, binary codes including binary-coded decimal and excess-3 code, Gray code, ASCII characters, and binary logic operations. Examples are provided to illustrate radix complements, subtraction using complements, representation of signed numbers, and the Gray code. An overview of logic circuits and switching theory is also presented.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

Complements: Department of Electronics Engineering

This document discusses binary codes and logic circuits. It covers topics like complements, binary codes including binary-coded decimal and excess-3 code, Gray code, ASCII characters, and binary logic operations. Examples are provided to illustrate radix complements, subtraction using complements, representation of signed numbers, and the Gray code. An overview of logic circuits and switching theory is also presented.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

ECE311

LOGIC CIRCUITS AND SWITCHING THEORY


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

b. Diminished Radix Complement or (r-1)’s complement


- defined as (rn-1)-N
DECIMAL : 9’s complement or 9’s KPL
BINARY : 1’s complement or 1’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

SUBTRACTION USING THE DIMINISHED RADIX KPL


A. When Minuend>Subtrahend
Steps:
1. Convert [–] operation to [+] by obtaining the DRC of the subtrahend
2. Add the results
3. Disregard the carry 1 (this means that the result is a positive difference)

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

SUBTRACTION USING THE RADIX KPL


B. When Minuend<Subtrahend
Steps:
1. Convert the subtraction operation to addition by getting the radix complement of the subtrahend.
2. Add the minuend to the result of step 1.
*note that this condition should result to a sum & carry of 0
3. To get the correct difference, obtain the radix complement of the sum.

Example.
1. 5810 2. 810
-8910 -1510

REPRESENTING SIGNED NUMBERS


- the sign of a binary number (+ or -) is represented by a bit called a sign bit such that
0 represents +
1 represents -

Example.
+5210 0 | 110 100
-5210 1 | 110 100
Sign| Magnitude

REPRESENTING SIGNED NUMBERS USING 2’S KPL


- if the number is (+), the magnitude is represented in its true binary form and a 0 is placed in
front of the MSB.
- If the number is (-), the magnitude is represented in its 2’s KPL with a sign bit of 1 in front of
the MSB

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.

BINARY-CODE DECIMAL (BCD)


- This is a code where each decimal digit is represented by 4 bits in binary

(valid codes) Example.


Example.
0 0000 76510 : ( )2 ( )BCD
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

(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

OTHER BINARY CODES FOR THE DECIMAL DIGITS

DECIMAL BCD(8421) EXCESS (3) 84-2-1 2421 BIQUINARY (5043210)


0 0000 0011 0000 0000 0100001
1 0001 0100 0111 0001 0100010
2 0010 0101 0110 0010 0100100
3 0011 0110 0101 0011 0101000
4 0100 0111 0100 0100 0110000
5 0101 1000 1011 1011 1000001
6 0110 1001 1010 1100 1000010
7 0111 1010 1001 1101 1000100
8 1000 1011 1000 1110 1001000
9 1001 1100 1111 1111 1010000

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.

DECIMAL EQUIVALENT GRAY CODE


0 0000
1 0001
2 0011
3 0010
4 0110
5 0111
6 0101
7 0100
8 1100
9 1101
10 1111
11 1110
12 1010
13 1011
14 1001
15 1000

ASCII CHARACTER CODES


- American Standard Code for Information Interchange
- It is the standard binary code for the alphanumeric character
- It uses 7 bits designated as b1 through b7 with b7 as the MSB
- It contains 94 graphic character that can be printed and 34 non-printing characters.

Graphic Characters
26 Upper case
26 Lower case
10 Numerals
32 Special Characters

**secure a copy of ASCII Table

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

BINARY LOGIC OPERATIONS


1. AND - represented by a dot or the absence of an operator.

𝑥 ∙ 𝑦 = 𝑧 𝑜𝑟 𝑥𝑦 = 𝑧 (read as “X and Y” is equal to Z)

- this means that z=1 if and only if x=1 & y=1

2. OR - represented by a plus sign

𝑥+𝑦 =𝑧 (read as “X or Y” is equal to Z)

- this means that z=1 if x or y or both is equal to 1

3. NOT - represented by a prime or a bar on top of the variable

𝑥 ′ = 𝑧 𝑜𝑟 𝑥̅ = 𝑧 (read as “X Prime”, “Prime X”, “Bar X”, “X Bar”)

- this means that z is what x is not

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

Postulate 2 𝑥+0=𝑥 𝑥∙1=𝑥


Postulate 5 𝑥 + 𝑥̅ = 1 𝑥 ∙ 𝑥̅ = 0
Theorem 1 𝑥+𝑥 =𝑥 𝑥∙𝑥 =𝑥
Theorem 2 𝑥+1=1 𝑥∙0=0
Theorem 3: Involution (𝑥 ′ )′ = 𝑥
Postulate 3: Commutative 𝑥+𝑦 = 𝑦+𝑥 𝑥𝑦 = 𝑦𝑥
Theorem 4: Associative 𝑥 + (𝑦 + 𝑧) = (𝑥 + 𝑦) + 𝑧 𝑥(𝑦𝑧) = (𝑥𝑦)𝑧
Postulate 4: Distributive 𝑥(𝑦 + 𝑧) = 𝑥𝑦 + 𝑥𝑧 𝑥 + 𝑦𝑧 = (𝑥 + 𝑦)(𝑥 + 𝑧)
Theorem 5: De Morgan’s (𝑥 + 𝑦)′ = 𝑥′𝑦′ (𝑥𝑦)′ = 𝑥 ′ + 𝑦′
Theorem 6: Absorption 𝑥 + 𝑥𝑦 = 𝑥 𝑥(𝑥 + 𝑦) = 𝑥

Simplify the Boolean functions using Boolean Algebra


1. 𝑥𝑦 + 𝑥𝑦̅
2. 𝑥𝑦𝑧 + 𝑥̅ 𝑦 + 𝑥𝑦𝑧̅
3. (𝐴̅ + 𝐵)(𝐴 + 𝐵 + 𝐷)𝐷 ̅

Engr. VMGabon
Reference: Digital Design, Morris Mano Page 8

You might also like