2nd-4th Lecture - Logic Gates, Boolean Algebra, K-Maps, Adders

Download as pdf or txt
Download as pdf or txt
You are on page 1of 90

Digital Logic Circuits

Homework from Previous Lecture

What is the difference between Computer Organization,


Computer Design, and Computer Architecture?

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

ii. Boolean algebra

iii. K-maps and K-map simplification

iv. Combinational circuits (half adder, full adder)


Logic Gates

5
Logic Gates

In order to manipulate binary information,


logic circuits called gates are required.

Gates are blocks of hardware that produce an output of either 0 or 1,


depending on the given inputs.

6
AND

OR

Inverter (aka NOT)

Buffer
Types of
Logic Gates
NAND

NOR

Exclusive OR (XOR)

Exclusive NOR (XNOR)


7
Logic Gates
Name Symbol Algebraic Truth Table
Function

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

Exclusive NOR x=(A+B)’ 0 0 1


(XNOR) or 0 1 0
x=A’B’+AB 1 0 0
1 1 1 11
Exercise

Draw a logic diagram for the following Boolean expression:

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.

Binary Varibles: A, B, x, y, etc.


Basic Logic Operation: AND, OR, Complement

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.

NOR gate: The function (x+y)’ is equivalent to (x’y’).


NAND gate: The function (xy)’ is equivalent to (x’+y’).

For this reason, NOR and NAND gates haves two distinct graphical
symbols.

24
Two graphical symbols for NOR gate

Two graphical symbols for NAND gate

Both NOR and NAND gates are called UNIVERSAL GATES


25
K-Maps

26
Why K-Maps?

Increase in complexity Increase in complexity


of algebraic expression of logic diagram

Complexity can be reduced by simplifying the


algebraic expression
with the help of Karnaugh Map or K-Map.

27
Minterms

A minterm is a Boolean expression resulting in 1 for the output of a single cell,


and 0s for all other cells in a Karnaugh map or a truth table.

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

F= BC+ AC’ + AB Additional term

35
K-Map Simplification

F(A, B, C, D) = Σ (0, 2, 5, 7, 8, 10, 13, 15)

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

F(A, B, C, D) = Σ (0, 2, 5, 7, 8, 10, 13, 15)

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

F(A, B, C, D) = Σ (1, 3, 4, 5, 6, 9, 11, 12, 13, 14)

39
Exercise

F(A, B, C, D) = Σ (1, 3, 4, 5, 6, 9, 11, 12, 13, 14)

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

F(A, B, C, D) = Σ (1, 3, 4, 5, 6, 9, 11, 12, 13, 14)

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

F(A, B, C, D) = Σ (1, 3, 4, 5, 6, 9, 11, 12, 13, 14)


43
Another Representation of K-Maps:

Product of Sums (POS)

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 maxterm is a Boolean expression resulting in 0 for the output of a single cell,


and 1s for all other cells in a Karnaugh map or a truth table.

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)

1 0 1 1 Here, the cells 0, 2, and 3


1 1 0 1 represent the maxterms.
1 1 1 1

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

F(A, B, C, D) = Σ (1, 3, 4, 5, 6, 9 F(A, B, C, D) = Π (0, 2, 7, 8, 10, 15)


11, 12, 13, 14)
47
POS Simplification

F(A, B, C, D) = Π (3, 6, 7, 11, 12, 13, 14, 15)

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

F(A, B, C, D) = Π (3, 6, 7, 11, 12, 13, 14, 15)

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

F= (C’+D’) (A’+B’) (B’+C’)


(other solutions are also possible) 50
5-Variable K-Maps

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

F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)

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’B’E+ A’B’C’D+A’CD’E+A’C’DE AB’DE 58


Simplification of 5-Variable K-Maps: Step 7
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 AB’DE+ABCE 59


Simplification of 5-Variable K-Maps: Step 8
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 B’C’E AB’DE+ABCE 60


Simplification of 5-Variable K-Maps: Solution

F(A, B, C, D, E) = Σ (1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)

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

Think of this line as a mirror


63
Simplification of Reflection Map: Step 1
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

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

Reflection maps use the ‘Gray Code’


74
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

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

Simplify the following Boolean function:

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

Sometimes, we have function where it doesn’t matter whether the


output is 0 or 1; it can be either.
These are known as ‘DON’T CARE CONDITIONS’. Such conditions are
marked with an ‘x’ in the map.

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

A combinational circuit is a connected arrangement of logic gates with


a set of inputs and outputs.

Combinational Circuits

Half Adder Full Adder

82
Adders

Addition is the most basic digital arithmetic operation.

A combinational circuit that adds two bits is called a


HALF-ADDER

and

the one that adds three bits (i.e., two significant bits
and a previous carry) is called a FULL-ADDER.
83
Half-Adder

Truth Table Logic Diagram

S (sum)= A’B+AB’= A+B


C (carry)= AB
84
Full-Adder

Truth Table Logic Diagram

S (sum)= A+B+Cin
Cout (carry)= AB+(A+B)Cin
85
86
Homework 1

Simplify the following Boolean functions:

1. F(A,B,C,D)=Σ(1, 3, 7, 8, 9, 12, 13, 14, 15)


2. F(A,B,C,D)=Π(0, 2, 4, 5, 8, 10, 12, 13)

87
Homework 2

Given the following Boolean function:


F=x+x’y’

1. List the truth table


2. Draw the logic circuit

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

ii. Sequential circuits

iii. Decoders

iv. Multiplexers

v. Registers

You might also like