Upload
dilum-bandara
View
155
Download
2
Embed Size (px)
DESCRIPTION
Introduction to digital logic, fundamental logic gates, Boolean algebra & simplifications, 3-6 input Kanaugh Maps
Citation preview
Digital Logic
CS2052 Computer Architecture
Computer Science & Engineering
University of Moratuwa
Dilum [email protected]
Outline
Logic gates
Boolean Algebra
Kanaugh Maps
2
Logic Gates
Every digital device is based on a set of chips
designed to store & process information
Basic building blocks of these chips are logic
gates
Implementation of gates can be different
Different materials & fabrication technologies
Different operating voltages
e.g., 5v vs. 0v, 3+v vs. 0.5v
Today, they go as low as 1.9 - 2.1v
But their logical behavior is consistent across all
computers3
Common Logic Gates
NOT/inverter
AND
4
Truth table
Algebraic function
Common Logic Gates (Cont.)
OR
NAND
5
Common Logic Gates (Cont.)
NOR
XOR/EXOR (Exclusive OR)
6
Common Logic Gates (Cont.)
NXOR/EXNOR (Exclusive NOR)
7
Exercise
Implement 3-input AND using 2-inputs ANDs
Implement a NOT gate using a NAND
8
Fundamental Logic Gate
2-input NAND gate can be used to build any
other gate
9
Exercise
Implement AND using NANDs
Homework
Implement following gates using NANDs
OR
XOR
10
Boolean Algebra
Boolean variable
Takes only 2 values – either TRUE (1) or FALSE (0)
Boolean function
Mapping from Boolean variables to a Boolean value
Application
Can represent complex relationships in a digital circuit
Boolean algebra
Deals with binary variables & logic operations
operating on those variables
Application
Can simplify a relationship among multiple inputs in a digital
circuit 11
Basic Identities of Boolean Algebra
Basic operations
AND (.), OR (+), NOT (– or /)
0 – FALSE
1 – TRUE
x + 0 = x x + x = x
x · 0 = 0 x . x = x
x + 1 = 1 x + x/ = 1
x · 1 = x x · x / = 0
12
Basic Identities (Cont.)
Commutativity
x + y = y + x
xy = yx
Associativity
x + ( y + z ) = ( x + y ) + z
x (yz) = (xy) z
Distributivity
x ( y + z ) = xy + xz
x + yz = ( x + y )( x + z)
13
Textbook has a typo
Basic Identities (Cont.)
DeMorgan’s Theorem
( x + y )/ = x/ y/
( xy )/ = x/ + y/
Generalized DeMorgan's Theorem
(a + b + … z) / = a / b / … z /
(a.b … z) / = a / + b / + … z /
Involution
(x /) / = x
14
Exercise
Simplify following functions using Boolean Algebra
a + ab
a(a + b)
a(a / + b)
a + a/ b
(a + b.c) /
a + ab = a(1+b)=a
a(a + b) = a.a +ab=a+ab=a(1+b)=a
a + a'b = (a + a')(a + b)=1(a + b) =a+b
a(a' + b) = a.a' +ab=0+ab=ab
(a + b.c)' = a'.b' + a'.c' 15
Homework
Show steps for following simplifications
(a + b)(a + b') = a
ab + ab'c = ab + ac
(a + b)(a + b' + c) = a + bc
(a(b + z(x + a')))' = a' + b' (z' + x')
(a(b + c) + a'b)'=b'(a' + c')
(a + b)(a' + c)(b + c) = (a + b)(a' + c)
No need to submit answers
16
Minterms
Minterm
Each combination of variables in a truth table
As no of digital inputs (Boolean variables)
increase no of minterms increase
2n minterms for n inputs
As n increases
Large truth tables
Long Boolean functions
Easier to represent using decimal equivalent of
sum of minterms
F(a, b, c) = Σ (2, 4, 5, 7) 17
Exercise
Represent all odd numbers between 0 – 7 as a sum of
minterms
F(a, b, c) = Σ (1, 3, 5, 7)
Use Boolean Algebra to simplify above function
Σ (1, 3, 5, 7) = a‘b‘c + a‘bc + ab‘c + abc
= a‘c(b‘ + b) + ac (b‘ + b)
= a‘c + ac = c (a‘+ a) = c
18
Sum of Products
Karnaugh Map (K-Map)
Pictorial representation of a truth table
Map of squares – each square for each minterm
Adjacent squares change in minterm only by one
variable
19
bc
a
00 01 11 10
0 0 1 3 2
1 4 5 7 6
Decimal equivalent
of minterm
Example – 3 Variable K-Map
Simplify represent of all odd numbers between 0 – 7
F(a, b, c) = Σ (1, 3, 5, 7)
20
ab
c
00
01
11
10
0 1
1
1
1
1
0
0
0
0
= c
Exercise – 3 Variable K-Map
Simplify following expression using a K-map
21
ab
c
00
01
11
10
0 1
1
0
0
0
1
1
0
0
= a’c’ + a’b’
Kanaugh Map – Simplification
Squares containing 1’s are grouped to get sum-
of-product expression
Group size must be 2n
Group must be in rectangular shape
Each group represents an algebraic term
Its OK for groups to overlap
OR of all those terms is the final expression
Maximum group size better simplification
A don’t care (X) can be interpreted as either 0 or 1
when needed, only if it contributes to simplification
Don’t group Xs together!
22
4 Variable K-Map
23
Example – 4 Variable K-Map
24
Exercise – 4 Variable K-Map
What would be a Boolean expression of a circuit
that detects all even numbers between 0 – 15?
Present as a sum of minterms
25
5 Variable K-Map – Option 1
26
BC
DE
A1/0
00 01 11 10
00
01
11
10
0
5
3
1
8124
2
20
11
106
7
14
16
13 9
15
19
18
17
28 24
31
2921
23
3022 26
25
27
Example – 5 Variable K-Map
What would be a Boolean expression of a circuit
to detect all prime numbers between 0 & 31?
27
BC
DE
A1/0
00 01 11 10
00
01
11
10
0
5
3
1
8124
2
20
11
106
7
14
16
13 9
15
19
18
17
28 24
31
2921
23
3022 26
25
27
5 Variable K-Map – Option 2
28
Example – 5 Variable K-Map – Option 2
29
6 Variable K-Map
30
Simplification as Product of Sum
Some times it is useful to obtain the algebraic
expression as a product of sums
Can be obtained by finding sum of products for
F/ & converting it to F
To find F/ Group 0s in a K-map
F(a, b, c) = Σ (1, 3, 5, 7) = Π (1, 3, 5, 7)
31
Exercise – Product of Sum
Find sum-of-product & product-of-sum
representation of following K-map
32
ab
c
00
01
11
10
0 1
1
x
1
1
0
0
0
1
F(a, b, c) = ab’ + c
F/(a, b, c) = a’c’ + bc’
(F/(a, b, c)) / = (a + c)(b’ + c)
= F(a, b, c)