2nd-4th Lecture - Logic Gates, Boolean Algebra, K-Maps, Adders
2nd-4th Lecture - Logic Gates, Boolean Algebra, K-Maps, Adders
2nd-4th Lecture - Logic Gates, Boolean Algebra, K-Maps, Adders
2
Computer Organization
Computer Architecture
Computer Design
is concerned with the
is concerned with the way that hardware
is concerned with the
structure and behavior components operate
hardware design of the
of the computer from and the way they are
computer.
the user’s point of view. connected to form the
computer. It is concerned with
It is the external view of
decisions like which
the computer that It is the internal view of
hardware should be
anyone who is likely to the computer and the
used and how they
program a computer roles various internal
should be connected.
should understand. components play during
program execution.
3
In this lecture, we will study
i. Logic gates
5
Logic Gates
6
AND
OR
Buffer
Types of
Logic Gates
NAND
NOR
Exclusive OR (XOR)
A B x
x=A*B
AND or 0 0 0
x=AB 0 1 0
1 0 0
1 1 1
A B x
OR x=A+B 0 0 0
0 1 1
1 0 1
1 1 1 8
Logic Gates
Name Symbol Algebraic Truth Table
Function
A x
Inverter
(aka NOT) x x=A’ 0 1
1 0
A x
Buffer x x=A 0 0
1 1
9
Logic Gates
Name Symbol Algebraic Truth Table
Function
A B x
NAND 0 0 1
(Not AND) x=(AB)’ 0 1 1
1 0 1
1 1 0
A B x
NOR x=(A+B)’ 0 0 1
(Not OR) 0 1 0
1 0 0
1 1 0 10
Logic Gates
Name Symbol Algebraic Truth Table
Function
A B x
Exclusive OR x=A+B 0 0 0
(XOR) or 0 1 1
x= A’B+AB’ 1 0 1
1 1 0
A B x
F=AB+A’C
12
Exercise
F=AB+A’C
A AB
A AC
13
Exercise
F=AB+A’C
A AB
A’C
C
14
Exercise
A AB
B
F=AB+A’C
A’
A’C
C
15
Boolean Algebra
16
Boolean algebra is the algebra that deals with binary variables
and logic operations.
17
A boolean function is expressed using binary varibles, ogic operation
symbols, paratheses, and an equal sign (=).
For instance,
F = x+y’z
is a boolean function, where the function F is equal to 1 if x is 1
or if both y’ and z are equal to 1, and 0 otherwise.
18
Other Representations of a Boolean Function
Algebraic Logic Diagram Truth Table
Expression
x y z F
0 0 0 0
0 0 1 1
F = x + y’ z 0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
19
Identities and DeMorgan’s Theorem
20
Identities
21
22
F= ABC+ABC’+A’C
F= AB(C+C’)+A’C
F= AB(1)+A’C
F= AB+A’C
23
DeMorgan’s Theorem is crucial for dealing with NAND and NOR gates.
For this reason, NOR and NAND gates haves two distinct graphical
symbols.
24
Two graphical symbols for NOR gate
26
Why K-Maps?
27
Minterms
A B C F
In this sample truth table, we have five
0 0 0 0 minterms, namely:
0 0 1 1 A’B’C, AB’C’, AB’C, ABC’, and ABC
0 1 0 0 (because for F= A’B’C, F=AB’C’,
0 1 1 0 F=AB’C, F=ABC’, and F=ABC , the
1 0 0 1
output is 1, and for all other Boolean
1 0 1 1
1 1 0 1 expressions, the output is 0).
1 1 1 1
28
Representing Truth Tables as Minterms
A B C F
0 0 0 0
0 0 1 1
0
0
1
1
1
0
0
1
0
0
0
1
= F(A, B, C) = Σ (1, 4, 5, 6, 7)
1 0 1 1
1 1 0 1 Here, the cells 1, 4, 5, 6, and 7
1 1 1 1 represent the minterms.
29
K-Maps
A B C F
0 0 0 0
0
0
0
0
1
1
1
0
1
1
0
0
= F(A, B, C) = Σ (1, 4, 5, 6, 7)
1 0 0 1 B, C
1 0 1 1 A 00 01 11 10
1 1 0 1 0 1 3 2
0
1 1 1 1 0 1 0 0
1 4 5 7 6
1 1 1 1
30
K-Maps for 2, 3, and 4 variable functions
B
A B, C
0 1
A 00 01 11 10
0 0 1
0 0 1 3 2
1 2 3
1 4 5 7 6
C, D
A, B 00 01 11 10
00 0 1 3 2
01 4 5 7 6
11 12 13 15 14
10 8 9 11 10
31
K-Map Simplification
F(A, B, C) = Σ (3, 4, 6, 7)
B, C
A 00 01 11 10
0 1 3 2
0
0 0 1 0
1 4 5 7 6
1 0 1 1
32
K-Map Simplification
F(A, B, C) = Σ (3, 4, 6, 7)
B, C
A 00 01 11 10
0
0 0 1 0
1
1 0 1 1
33
K-Map Simplification
B, C
A 00 01 11 10
0
0 0 1 0
1 1 0 1 1
F= BC+ AC’
34
K-Map Simplification
B, C
A 00 01 11 10
0
0 0 1 0
1 1 0 1 1
35
K-Map Simplification
C, D
A, B 00 01 11 10
00 1 0 0 1
01 0 1 1 0
11 0 1 1 0
10 1 0 0 1
36
K-Map Simplification
C, D
A, B 00 01 11 10
00 1 0 0 1
01 0 1 1 0
11 0 1 1 0
10
1 0 0 1
37
K-Map Simplification
C, D
A, B 00 01 11 10
00 1 0 0 1
01 0 1 1 0
11 0 1 1 0
10 1 0 0 1
F= BD+ B’D’
(other solutions are also possible) 38
Exercise
39
Exercise
C, D
A, B 00 01 11 10
00 0 1 1 0
01 1 1 0 1
11 1 1 0 1
10
0 1 1 0
40
Exercise
C, D
A, B 00 01 11 10
00 0 1 1 0
01 1 1 0 1
11 1 1 0 1
10
0 1 1 0
41
Exercise
C, D
A, B 00 01 11 10
00 0 1 1 0
01 1 1 0 1
11 1 1 0 1
10
0 1 1 0
F= BC+B’D+BCD’
42
The maps we have seen so far can also be referred to as the
‘SUM OF PRODUCTS’ form of K-Maps
C, D
A, B 00 01 11 10
00 0 1 1 0
01
1 1 0 1
1 1 0 1
F= BC+B’D+BCD’
11 (other solutions are also possible)
10 0 1 1 0
A B C F
0 0 0 0
0 0 1 1
0
0
1
1
1
0
0
1
0
0
0
1
= F(A, B, C) = Π (0, 2, 3)
1 0 1 1
1 1 0 1
1 1 1 1
44
Maxterms
A B C F
In this sample truth table, we have
0 0 0 0 three maxterms, namely:
0 0 1 1 A’+B’+C’, A’+B+C’, and A’+B+C
0 1 0 0 (because for F= A’+B’+C’, F=A’+B+C’,
0 1 1 0 and F=A’+B+C , the output is 0, and for
1 0 0 1
all other Boolean expressions, the
1 0 1 1
1 1 0 1 output is 1).
1 1 1 1
45
Representing Truth Tables as Maxterms
A B C F
0 0 0 0
0 0 1 1
0
0
1
1
1
0
0
1
0
0
0
1
= F(A, B, C) = Π (0, 2, 3)
46
C, D
A, B 00 01 11 10
00 0 1 1 0
01 1 1 0 1
11 1 1 0 1
SUM OF PRODUCTS PRODUCT of SUMS
10
0 1 1 0
C, D
A, B 00 01 11 10
00 1 1 0 1
01 1 1 0 0
11 0 0 0 0
10
1 1 0 1
48
POS Simplification
C, D
A, B 00 01 11 10
00 1 1 0 1
01 1 1 0 0
11 0 0 0 0
10
1 1 0 1
49
POS Simplification
C, D
A, B 00 01 11 10
00 1 1 0 1
01 1 1 0 0
11 0 0 0 0
10
1 1 0 1
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 3 2 00 16 17 19 18
00
01 4 5 7 6 01 20 21 23 22
11 12 13 15 14 11 28 29 31 30
10 8 9 11 10 10 24 25 27 26
Cell 0 can be considered to be ‘adjacent’ to cell 16, cell 1 can be considered to be adjacent to cell 17, and so on.
51
Simplification of 5-Variable K-Maps
Or
F(A, B, C, D, E)= m1, m2, m3, m5, m7, m11, m13, m17, m19, m23, m29, m31
52
Simplification of 5-Variable K-Maps: Step 1
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
53
Simplification of 5-Variable K-Maps: Step 2
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
A’B’E 54
Simplification of 5-Variable K-Maps: Step 3
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
A’B’E+ A’B’C’D 55
Simplification of 5-Variable K-Maps: Step 4
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
A’B’E+ A’B’C’D+A’CD’E 56
Simplification of 5-Variable K-Maps: Step 5
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
A’B’E+ A’B’C’D+A’CD’E+A’C’DE 57
Simplification of 5-Variable K-Maps: Step 6
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
0 1 1 1 00 0 1 1 0
00
01 0 1 1 0 01 0 0 1 0
11 0 1 0 0 11 0 1 1 0
10 0 0 1 0 10 0 0 0 0
F = A’B’E+ A’B’C’D+A’CD’E+A’C’DE+B’C’E+AB’DE+ABCE
61
Alternative Representations
of 5-Variable K-Maps
Reflection Maps
Overlay Maps
62
5-Variable Reflection K-Map
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 3 2 6 7 5 4
01 8 9 11 10 14 15 13 12
11 24 25 27 26 30 31 29 28
10 16 17 19 18 22 23 21 20
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
64
Simplification of Reflection Map: Step 2
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E
65
Simplification of Reflection Map: Step 3
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E+A’B’C’D
66
Simplification of Reflection Map: Step 4
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E+A’B’C’D+A’C’DE
67
Simplification of Reflection Map: Step 5
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E+A’B’C’D+A’C’DE+ABCE
68
Simplification of Reflection Map: Step 6
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E+A’B’C’D+A’C’DE+ABCE+A’B’E
69
Simplification of Reflection Map: Step 7
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E+A’B’C’D+A’C’DE+ABCE+A’B’E+A’CD’E
70
Simplification of Reflection Map: Step 8
F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
C, D, E
A, B 000 001 011 010 110 111 101 100
00 0 1 1 1 0 1 1 0
01 0 0 1 0 0 0 1 0
11 0 0 0 0 0 1 1 0
10 0 1 1 0 0 1 0 0
B’C’E+A’B’C’D+A’C’DE+ABCE+A’B’E+A’CD’E+AB’DE
71
Overlay Maps?
72
5-Variable Overlay K-Map
C, D, E
A, B 000 001 011 010 100 101 111 110
00 0 1 3 2 4 5 7 6
01 8 9 11 10 12 13 15 14
11 24 25 27 26 28 29 31 30
10 16 17 19 18 20 21 23 22
73
5-Variable Reflection K-Map 5-Variable Overlay K-Map
C, D, E C, D, E
000 001 011 010 110 111 101 100 000 001 011 010 100 101 111 110
A, B A, B
00 0 1 3 2 6 7 5 4 0 1 3 2 4 5 7 6
00
01 8 9 11 10 14 15 13 12 8 9 11 10 12 13 15 14
01
11 24 25 27 26 30 31 29 28 24 25 27 26 28 29 31 30
11
10 16 17 19 18 22 23 21 20 16 17 19 18 20 21 23 22
10
01 0 1 1 1 1 1 0 1
11 1 1 0 1 1 0 0 0
10 0 1 1 1 1 1 0 1
75
Simplification of Overlay Map
F(A, B, C, D, E) = Σ (3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28)
C, D, E
A, B 000 001 011 010 100 101 111 110
00 0 0 1 0 0 1 1 1
01 0 1 1 1 1 1 0 1
11 1 1 0 1 1 0 0 0
10 0 1 1 1 1 1 0 1
76
5-Variable K-Map with Don’t Care Conditions
F(A, B, C, D, E)= Σ(1, 2, 3, 8, 9, 10, 12, 15, 16, 17, 18, 22, 26, 27)
+d(0, 4, 11, 19, 28, 30, 31)
A=0 A=1
D, E D, E
00 01 11 10 B, C 00 01 11 10
B, C
x 1 1 1 00 1 1 x 1
00
01 x 0 0 0 01 0 0 0 1
11 1 0 1 0 11 x 0 x x
10 1 1 x 1 10 0 0 1 1
77
Homework
F(A,B,C,D,E)=Σ(0, 1, 2, 3, 8, 12, 15, 16, 17, 18, 19, 22, 28, 31)
78
K-Maps with Don’t Care Conditions
B, C
A 00 01 11 10
0 1 x x 1
F(A, B, C)= Σ(0, 2, 7)+d(1, 3, 5 )
1
0 x 1 0
79
Map Simplification in the Presence of
Don’t Care Conditions
B, C
A 00 01 11 10
0
1 x x 1
F= A’+A’C
1 0 x 1 0
80
Combinational Circuits
81
Combinational Circuits
Combinational Circuits
82
Adders
and
the one that adds three bits (i.e., two significant bits
and a previous carry) is called a FULL-ADDER.
83
Half-Adder
S (sum)= A+B+Cin
Cout (carry)= AB+(A+B)Cin
85
86
Homework 1
87
Homework 2
88
Boolean Function Truth Table
x y x’ y’ x’y’ x+x’y’
(=F)
F = x + x’ y’
89
In the next lecture, we will study…
i. Flip – Flops
iii. Decoders
iv. Multiplexers
v. Registers