Switching Theory and Logic Circuits
Switching Theory and Logic Circuits
Switching Theory and Logic Circuits
LOGIC CIRCUITS
COURSE OBJECTIVES
1. To understand the concepts and techniques associated with the
number systems and codes
2. To understand the simplification methods (Boolean algebra &
postulates, k-map method and tabular method) to simplify the
given Boolean function.
3. To understand the fundamentals of digital logic and to design
various combinational and sequential circuits.
4. To understand the concepts of programmable logic
devices(PLDs)
5. To understand formal procedure for the analysis and design of
synchronous and asynchronous sequential logic
COURSE OUTCOMES
After completion of the course the student will be able to
1. Understand the concepts and techniques of number systems
and codes in representing numerical values in various number
systems and perform number conversions between different
number systems and codes.
2. Apply the simplification methods to simplify the given Boolean
function (Boolean algebra, k-map and Tabular method).
3. Implement given Boolean function using logic gates, MSI
circuits and/ or PLDs.
COURSE OUTCOMES
After completion of the course the student will be able to
4. Design and analyze various combinational circuits like
decoders, encoders, multiplexers, and de-multiplexers,
arithmetic circuits (half adder, full adder, multiplier etc).
5. Design and analyze various sequential circuits like flip-flops,
registers, counters etc.
6. Analyze and Design synchronous and asynchronous sequential
circuits.
UNIT-I
Introductory Concepts
(Number systems, Base conversions)
Digital Systems
1
AND Gate 0
0
Conversion Between Number Bases
Octal
(base 8)
Decimal Binary
(base 10) (base 2)
Hexadecimal
(base 16)
Convert an Integer from Decimal to Another Base
MSB LSB
Convert a Fraction from Decimal to Another Base
MSB LSB
The Growth of Binary Numbers
n 2n n 2n
0 20=1 8 28=256
1 21=2 9 29=512
2 22=4 10 210=1024 Kilo
3 23=8 11 211=2048
4 24=16 12 212=4096
5 25=32 20 220=1M Mega
175/8 = 21 + 7 a0 = 7
21/8 = 2 + 5 a1 = 5
2/8 = 0 + 2 a2 = 2
Conversion is easy!
Determine the 4-bit binary value for each hex digit
Note that there are 16 different values of four bits
Easier to read and write in hexadecimal
Representations are equivalent!
1 1 1 1 1 1 carries
11 1 1 0 1 = 61
+ 1 0 1 1 1 = 23
---------------------
1 0 1 0 1 0 0 = 84
Binary Subtraction
1 10
0 10 10 0 0 10 borrows
1 0 0 1 1 0 1 = 77
- 1 0 1 1 1 = 23
------------------------
1 1 0 1 1 0 = 54
Binary Multiplication
1
0 1 1 1
X 1 0 1 0
-----------------------
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
Summary
000011002 = 1210
100011002 = 1210
7 0111
4 bits 6 0110
. .
16 combinations . .
1 0001
0 0000
0 1111
1 1110
. .
. .
6 1001
7 1000
Twos Complement Representation
7 0111
4 bits 6 0110
. .
16 combinations . .
1 0001
0 0000
1 1111
2 1110
. .
. .
7 1001
8 1000
Finite-Precision Number Representation
Ignore
Carry
2s Complement Subtraction
ASCII Codes
A Z (26 codes), a z (26 codes)
0 9 (10 codes), others (@#$%^&*.)
Transmission susceptible to noise
Typical transmission rates (1500 Kbps, 56.6 Kbps)
How to keep data transmission accurate?
Parity Codes
P Information Bits
1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1
Added even parity bit Added odd parity bit
Parity Code Example
0 0 1 0 1 0 1 1
Binary Cell
Register Transfer
Register A Register B
Digital Logic
Circuits
Register C
Transfer of Information
We need processing
We need storage
We need communication
Analysis problem:
. Logic .
Inputs Outputs
Circuit
. .
An input of 0 is inverted to a 1 A Y
An input of 1 is inverted to a 0 0 1
1 0
A Y
Input Output
Symbol
The AND Gate
A A B
Y
B
The OR Gate
This is an OR gate
A B Y
If either of the two
0 0 0
input signals is
0 1 1
asserted, or both of
1 0 1
them are, the output
1 1 1
will be asserted
A
A B
Y
B
Describing Circuit Functionality: Waveforms
AND Gate
x y f
0 0 0
0 1 0
1 0 0
1 1 1
Consider three-input gates
3 Input OR Gate
Ordering Boolean Functions
How to interpret A B + C?
Is it A B ORed with C ?
Is it A ANDed with B + C ?
Order of precedence for Boolean algebra: AND
before OR
Note that parentheses are needed here:
Boolean Algebra
Commutative Property:
For every a and b in K,
a+b=b+a
ab=ba
Associative Property:
For every a, b, and c in K,
a + (b + c) = (a + b) + c
a (b c) = (a b) c
Distributivity of the Operators and Complements
Distributive Property:
For every a, b, and c in K,
a+(bc)=(a+b)(a+c)
a(b+c)=(ab)+(ac)
x y z xy yz G
0 0 0 0 0 0
0 0 1 0 0 0 x xy
0 1 0 0 0 0 y
0 1 1 0 1 1 G = xy +yz
1 0 0 0 0 0 z
yz
1 0 1 0 0 0
1 1 0 1 0 1 How to transit between an equation, a
1 1 1 1 1 1 circuit, and a truth table?
Representation Conversion
Circuit Boolean
Expression
Truth
Table
Truth Table to Expression
x y z G
0 0 0 0 Any Boolean Expression can be
0 0 1 0 represented in sum of products form!
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
xyz + xyz + xyz
Equivalent Representations of Circuits
x y z
G = xyz + xyz + xyz
Reducing Boolean Expressions
x y z
G = xyz + xyz + xyz = xy + yz
Minterms and Maxterms
x y z Minterm x y z Maxterm
0 0 0 xyz m0 0 0 0 x+y+z M0
0 0 1 xyz m1 0 0 1 x+y+z M1
1 0 0 xyz m4 1 0 0 x+y+z M4
1 1 1 xyz m7 1 1 1 x+y+z M7
Representing Functions with Minterms
x y z G
0 0 0 0 G = xyz + xyz + xyz
0 0 1 0
0 1 0 0
0 1 1 1 G = m7 + m6 + m3 = (3, 6, 7)
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
Complementing Functions
x y z G G
0 0 0 0 1 G = xyz + xyz + xyz
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0 G = (xyz + xyz + xyz) = ?
1 0 0 0 1
1 0 1 0 1
1 1 0 1 0 Can we find a simpler representation?
1 1 1 1 0
Complementing Functions
Find complement of F = xz + yz
F = (xz + yz)
DeMorgans
F = (xz) (yz)
DeMorgans
F = (x+z) (y+z)
Reduction eliminate double negation on x
F = (x+z) (y+z)
x y z F
0 0 0 0
0 0 1 0 x
0 1 0 0 y
0 1 1 0 F = x(y+z)
z y+z
1 0 0 1 z
1 0 1 0
1 1 0 1
1 1 1 1 F = x(y+z)
Logic functions of N variables
A B Y
A
Y 0 0 1
B 0 1 1
1 0 1
Y=AB 1 1 0
The NAND Gate
NOT Gate A
B Y
A AND Gate
Y
B
OR Gate
The NOR Gate
0 0 1
A
Y 0 1 0
B
1 0 0
Y=A+B 1 1 0
Functionally Complete Gates
NOT Gate A
B Y
A OR Gate
Y
B
AND Gate
The XOR Gate (Exclusive-OR)
A
Y=AB Y
B
The XNOR Gate
DeMorgans Theorem
Interpretation of the two OR gate symbols
DeMorgans Theorem
Summary
x y F
y
x 0 1 0 0 1
0 1 1 0 1 1
y
1 0 0 1 0 0
y
x 0 1 1 1 0
0 xy xy
x
1 xy xy F = (m0,m1) = xy + xy
Karnaugh Maps
bc bc
a 00 01 11 10 a 00 01 11 10
0 0 0 1 0 0 0 0 1 1
1 0 1 1 1 1 0 0 1 1
cout = ac+bc + ab f=b
0
Now we have to cover all the 1s in the
0 1 0 1 Karnaugh Map using the largest
1
rectangles and as few rectangles
A 1 0 1 0 as we can.
C S = A B Cin + ABCin + A B Cin+A BCin
No Possible Reduction!
Karnaugh Map for S
Summary
1 0 1 1
0 1 1 1
0 0 1 1
1 0 1 1
F = C + ABD + BD
Design Examples
K-map for LT
0 1 1 1
0 0 1 1
0 0 0 0
0 0 1 0
F = AC + ABD + BCD
Design Examples
K-map for EQ
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
K-map for GT
0 0 0 0
1 0 0 0
1 1 0 1
1 1 0 0
F = AC + BCD + ABD
Physical Implementation
1 0 0 0
EQ
EQ
0 1 0 0
0 0 1 0
0 0 0 1
B
Karnaugh Maps: Dont Cares
1 0 0 0 0
A 1 0 0 1 1
10 0 1 0 0
1 0 1 0 0
D 1 0 1 1 0
1 1 0 0 X
1 1 0 1 X
1 1 1 0 0
F=AD + BCD Without dont cares 1 1 1 1 0
f = A'D + B'C'D
F=AD + CD
without don't cares
With dont cares
Dont Care Conditions
CD
00 01 11 10
AB
00 0 1 0 0
01 x x x 1 F=ACD+B +AC
11 1 1 1 x
10 x 0 1 1
CD
00 01 11 10
AB
00 0 1 0 0
01 x x x 1
11 1 1 1 x F= ABCD +BC +AC+ABC
10 x 0 1 1
Alternative covering:
Karnaugh Maps: Product of Sums
F(A,B,C,D) = (2,3,9,11,13) + d(6,14)
CD
AB 00 01 11 10
00 0 0 1 1
01 0 0 0 x
11 0 1 0 x
00 01 11
10 0 1 1 0
CD
AB 00 01 11 10
00 1 1 0 0
01 1 1 1 x
11 1 0 1 x
00 01 11
10 1 0 0 1
G = AD + AC + BC
Karnaugh Maps: Product of Sums
F(A,B,C,D) = (2,3,9,11,13) + d(6,14)
CD
AB 00 01 11 10
00 0 0 1 1
01 0 0 0 x
11 0 1 0 x
00 01 11
10 0 1 1 0
F = ACD + ABC+
ABC ABD (A+C)(A+D)
F= (B+C) (A+C)
Prime Implicants
CD C
AB 00 01 11 10
00 0 X 1 0 AD, AC, ABC, CD, BC'D'
01 1 1 1 0
B essential
11 1 0 1 1
A minimum cover: AC + AD + BC'D'
10 0 0 1 1
D
Examples to Illustrate Terms
CD C
AB 00 01 11 10 5 prime implicants:
00 0 0 1 0 BD, ABC,
ABC AC'D, A'BC'
A'BC, A'CD
01 1 1 1 0
B
11 0 1 1 1
A
10 0 1 0 0
minimum cover: 4 essential implicants
D
Summary
DeMorgans Law:
(a + b) = a b (a b) = a + b
a+b = ab ab =a +b
a + b = (a b) (a b) = (a + b)
a+b = a b ab = a +b
Sum-of-products
AND gates to form product terms
(minterms)
OR gate to form sum
Product-of-sums
OR gates to form sum terms
(maxterms)
AND gates to form product
Two-level Logic using NAND Gates
A A
NAND
B B
Z NAND Z
C C
NAND
D D
x = (A + B + C) (D + E) F + G
Factored form not written as two-level S-o-P
1 x 3-input OR gate, 2 x 2-input OR gates, 1 x 3-input AND gate
10 wires (7 literals plus 3 internal wires)
A
B
C
X
D
E
F
G
Conversion of Multi-level Logic to NAND Gates
F = A (B + C D) + B C'
Exclusive-OR Circuits
A
B
C
Out
A
B
C
Label Gate Outputs
A R
B
C
Out
S T
A
B
C
Approach 1: Create Intermediate Equations
C
Approach 1: Substitute in subexpressions
A R
B
C
Out
S T
A
B
C
Approach 1: Substitute in subexpressions
A
B
C
Out
A
C
B
C
Approach 2: Truth Table
C
Approach 2: Truth Table
C
Approach 2: Truth Table
C
More Difficult Example