03 Handout 1 (12) Merged
03 Handout 1 (12) Merged
NAND Implementation
Solution:
NOR Implementation
References:
Karim, M., & Chen, X. (2017). Digital design: Basic concepts and principles. Boca Raton, FL: CRC Press/Taylor & Francis
LaMeres, B. (2019). Introduction to logic circuits & logic design with VHDL (1st ed.). Springer International
Ndjountche, T. (2016). Digital electronics 2: Sequential and arithmetic logic circuits. John Wiley & Sons
The binary value (either in 0s or 1s) for each box is the binary value of the output terms in the corresponding table
row, while the input variables are the cells’ coordinates.
Below is an example of a truth table of the X-OR gate (taken from Logic Gates discussion) and its corresponding
Karnaugh map.
The values inside the squares are copied from the output column of the truth table. Therefore, there is one (1)
square in the map for every row in the truth table. Around the edge of the Karnaugh map are the values of the
two (2) input variables. B is along the top, and A is placed in the left side of the K-map.
In contrast to a truth table, in which the input values typically follow a standard binary sequence (00, 01, 10, 11),
the Karnaugh map's input values are ordered as 00, 01, 11, and 10 such that one bit changes from one cell to the
next. This ordering is known as a Gray code.
Note: Gray code will be discussed further on the Code Conversion topic.
The two (2) adjacent cells in the map are arranged in a way that one variable changes every time it crosses the
horizontal or vertical cell boundaries so that any adjacent cells that are grouped together can eliminate any terms
that form the Postulate 6a, which is 𝐴𝐴 • 𝐴𝐴̅ = 0.
With regards to the grouping together of adjacent cells containing both ones (for SOP) or zeros (for POS), the
Karnaugh map uses the following rules for the simplification of expressions:
• Groups should NOT include cells with different values, as shown below:
B 𝐵𝐵� B B 𝐵𝐵� B B 𝐵𝐵� B B 𝐵𝐵� B
A 0 1 A 0 1 A 0 1 A 0 1
𝐴𝐴̅ 0 0 𝐴𝐴̅ 0 𝐴𝐴̅ 0 1 𝐴𝐴̅ 0
A 1 1 A 1 0 1 A 1 1 A 1 1 1
B 𝐵𝐵� B B 𝐵𝐵� B
A 0 1 A 0 1
𝐴𝐴̅ 0 0 𝐴𝐴̅ 0 0 0
A 1 0 A 1
• Groups should contain 2𝑛𝑛 cells. This implies that if 𝑛𝑛 = 1, a group will contain two 1's since 21 = 2 (as
shown below). If 𝑛𝑛 = 2, a group will contain four 1's since 22 = 4.
BC 𝐵𝐵� C BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅
Group of 2 Group of 3
A 0 1 A 00 01 11 10
𝐴𝐴̅ 0 1 1 𝐴𝐴̅ 0 1 1 1
A 1 A 1
• Groups may overlap, and each group should be as large as possible. The larger the number of 1’s or 0’s
grouped together, the simpler is the product term or the sum term that the group represents.
BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅ Groups not BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅ Groups
A 00 01 11 10 overlapping A 00 01 11 10 overlapping
𝐴𝐴̅ 0 1 1 1 1 𝐴𝐴̅ 0 1 1 1 1
A 1 1 1 A 1 1 1
• Groups may wrap around the table. The leftmost cell in a row may be grouped with the rightmost cell, and
the topmost cell in a column may be grouped with the bottommost cell. Cells occupying the four corners
of the map are also included.
CD 𝐶𝐶̅ 𝐷𝐷
� 𝐶𝐶̅ 𝐷𝐷 �
CD 𝐶𝐶𝐷𝐷
BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅
A 00 01 11 10 AB 00 01 11 10
𝐴𝐴̅ 0 1 1 𝐴𝐴̅𝐵𝐵� 00 1 1 1 1
A 1 1 1 𝐴𝐴̅𝐵𝐵 01
AB 11
𝐴𝐴𝐵𝐵� 10 1 1 1 1
CD 𝐶𝐶̅ 𝐷𝐷
� 𝐶𝐶̅ 𝐷𝐷 �
CD 𝐶𝐶𝐷𝐷
AB 00 01 11 10
𝐴𝐴̅𝐵𝐵� 00 1 1
𝐴𝐴̅𝐵𝐵 01
AB 11
𝐴𝐴𝐵𝐵� 10 1 1
Rules Example
Sample Problem 1: Identify the function which generates the K-map
shown:
B 𝐵𝐵� B
B 𝐵𝐵� B
A 0 1
One (1) square – 2 literals A 0 1
𝐴𝐴̅ 0 1
A 0
A 1
𝐴𝐴̅ 1 0
𝑭𝑭 = � + 𝑩𝑩
𝑨𝑨 �
� 𝑩𝑩
𝑭𝑭 = 𝑨𝑨 �
Sample Problem 2: Simplify the Boolean functions
𝐹𝐹 = 𝐴𝐴𝐵𝐵� + 𝐴𝐴𝐴𝐴 and 𝐹𝐹 = (𝐴𝐴 + 𝐵𝐵)(𝐴𝐴̅ + 𝐵𝐵)
Solution:
� + 𝑨𝑨𝑨𝑨:
For 𝑭𝑭 = 𝑨𝑨𝑩𝑩 For 𝑭𝑭 = (𝑨𝑨 + 𝑩𝑩)(𝑨𝑨’ + 𝑩𝑩):
Two (2) adjacent squares – 1
B 𝐵𝐵� B B B 𝐵𝐵�
literal
A 0 1 0 1 A
𝐴𝐴̅ 0 0 A 0
A 1 1 1 0 𝐴𝐴̅ 1
𝑭𝑭 = 𝑨𝑨 𝑭𝑭 = 𝑩𝑩
Four (4) adjacent squares – logic Sample Problem 3: Identify the function which generates the K-map
1 (SOP); logic 0 (POS) shown:
B 𝐵𝐵� B B B 𝐵𝐵�
A 0 1 A 0 1
𝐴𝐴̅ 0 1 1 A 0 0 0
A 1 1 1 𝐴𝐴̅ 1 0 0
𝑭𝑭 = 𝟏𝟏 𝑭𝑭 = 𝟎𝟎
Three-Variable Map. In the case of 3 variables, we form a map consisting of 23 = 8 cells (2-by-4 or 4-by-2 matrix),
as shown below. 2-by-4 matrix (Minterm (m))
Note: The same table is applied for maxterm (M), except that the literals are in product of sum (POS) form – all
literals in “1’s” are complemented while all literals in “0’s” are not complemented.
Rules Example
Sample Problem 1: Identify the function which generates the K-
map shown:
BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅
One (1) square – 3 literals A 00 01 11 10
𝐴𝐴̅ 0 1
A 1
� 𝑩𝑩𝑩𝑩
𝑭𝑭 = 𝑨𝑨
Sample Problem 2: Simplify the Boolean function
𝐹𝐹 = 𝐴𝐴𝐴𝐴’𝐶𝐶 + 𝐴𝐴𝐴𝐴𝐴𝐴 + 𝐴𝐴𝐴𝐴𝐴𝐴’
Solution:
For 𝑭𝑭 = 𝑨𝑨𝑩𝑩� 𝑪𝑪 + 𝑨𝑨𝑨𝑨𝑨𝑨 + 𝑨𝑨𝑨𝑨𝑪𝑪
�
BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅
A 00 01 11 10
𝐴𝐴̅ 0
Two (2) adjacent squares – 2 literals A 1 1 1 1
𝑭𝑭 = 𝑨𝑨𝑨𝑨 + 𝑨𝑨𝑨𝑨;
Note: 2 literals per array
Simplifying further:
Postulate 5a (Distributive):
(𝐴𝐴 • 𝐵𝐵) + (𝐴𝐴 • 𝐶𝐶) = 𝐴𝐴 • (𝐵𝐵 + 𝐶𝐶)
= 𝑭𝑭 = 𝑨𝑨(𝑪𝑪 + 𝑩𝑩)
Sample Problem 3: Simplify the Boolean function
Four (4) adjacent squares – 1 literal
𝐹𝐹 = (𝐴𝐴 + 𝐵𝐵 + 𝐶𝐶̅ )(𝐴𝐴̅ + 𝐵𝐵 + 𝐶𝐶)(𝐴𝐴̅ + 𝐵𝐵 + 𝐶𝐶̅ )
Solution:
� )(𝑨𝑨
For 𝑭𝑭 = (𝑨𝑨 + 𝑩𝑩 + 𝑪𝑪 � + 𝑩𝑩 + 𝑪𝑪
� )(𝑨𝑨 + 𝑩𝑩� + 𝑪𝑪’)(𝑨𝑨� + 𝑩𝑩� + 𝑪𝑪’)
BC 𝐵𝐵 + 𝐶𝐶 𝐵𝐵 + 𝐶𝐶̅ 𝐵𝐵� + 𝐶𝐶̅ 𝐵𝐵� + 𝐶𝐶
A 00 01 11 10
A 0 0 0
𝐴𝐴̅ 1 0 0
�
𝑭𝑭 = 𝑪𝑪
Sample Problem 4: Identify the function which generates the K-
map shown:
BC 𝐵𝐵�𝐶𝐶̅ 𝐵𝐵�𝐶𝐶 BC 𝐵𝐵𝐶𝐶̅
Eight (8) adjacent squares – logic 1
A 00 01 11 10
(SOP); logic 0 (POS)
̅
𝐴𝐴 0 1 1 1 1
A 1 1 1 1 1
𝑭𝑭 = 𝟏𝟏
Four-Variable Map
In the case of 4 variables, we form a map consisting of 24 = 16 cells (4-by-4 matrix), as shown below.
For Minterm (m): For Minterm (m):
CD 𝐶𝐶̅ 𝐷𝐷
� 𝐶𝐶̅ 𝐷𝐷 CD �
𝐶𝐶𝐷𝐷 CD 𝐶𝐶̅ 𝐷𝐷
� 𝐶𝐶̅ 𝐷𝐷 CD �
𝐶𝐶𝐷𝐷
AB 00 01 11 10 AB 00 01 11 10
Row # Row # Row # Row # Row # Row # Row # Row #
𝐴𝐴̅𝐵𝐵� 00 0 1 3 2 𝐴𝐴̅𝐵𝐵� 00 0 1 3 2
0000 0001 0011 0010 𝐴𝐴̅𝐵𝐵� 𝐶𝐶̅ 𝐷𝐷
� 𝐴𝐴̅𝐵𝐵� 𝐶𝐶̅ 𝐷𝐷 𝐴𝐴̅𝐵𝐵�𝐶𝐶𝐶𝐶 𝐴𝐴̅𝐵𝐵� 𝐶𝐶𝐷𝐷
�
Row # Row # Row # Row # Row # Row # Row # Row #
𝐴𝐴̅𝐵𝐵 01 4 5 7 6 𝐴𝐴̅𝐵𝐵 01 4 5 7 6
0100 0101 0111 0110 𝐴𝐴𝐵𝐵 𝐶𝐶̅ 𝐷𝐷
̅ � 𝐴𝐴𝐵𝐵 𝐶𝐶̅ 𝐷𝐷
̅ ̅
𝐴𝐴𝐵𝐵𝐵𝐵𝐵𝐵 ̅
𝐴𝐴𝐵𝐵𝐵𝐵𝐷𝐷 �
Row # Row # Row # Row # Row # Row # Row # Row #
AB 11 12 13 15 14 AB 11 12 13 15 14
1100 1101 1111 1110 𝐴𝐴𝐴𝐴𝐶𝐶̅ 𝐷𝐷 � 𝐴𝐴𝐴𝐴𝐶𝐶̅ 𝐷𝐷 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴 𝐴𝐴𝐴𝐴𝐴𝐴𝐷𝐷 �
Row # Row # Row # Row # Row # Row # Row # Row #
𝐴𝐴𝐵𝐵� 10 8 9 11 10 𝐴𝐴𝐵𝐵� 10 8 9 11 10
1000 1001 1011 1010 𝐴𝐴𝐵𝐵 𝐶𝐶̅ 𝐷𝐷
� � 𝐴𝐴𝐵𝐵 𝐶𝐶̅ 𝐷𝐷
� 𝐴𝐴𝐵𝐵�𝐶𝐶𝐶𝐶 �
𝐴𝐴𝐵𝐵 𝐶𝐶𝐷𝐷�
Note: The same table is applied for maxterm (M), except that the literals are in product of sum (POS) form – all
literals in “1’s” are complemented while all literals in “0’s” are not complemented.
Rules Example
Sample Problem 1: Identify the function which generates the K-
map shown:
CD 𝐶𝐶̅ 𝐷𝐷
� 𝐶𝐶̅ 𝐷𝐷 CD �
𝐶𝐶𝐷𝐷
AB 00 01 11 10
One (1) square – 4 literals 𝐴𝐴̅𝐵𝐵� 00
𝐴𝐴̅𝐵𝐵 01 1
AB 11
𝐴𝐴𝐵𝐵� 10
� 𝑩𝑩𝑩𝑩𝑫𝑫
𝑭𝑭 = 𝑨𝑨 �
Two (2) adjacent squares – 3 literals Sample Problem 2: Simplify the Boolean functions
The “don’t care” condition (which is often represented with an “X” in a K-map) can either be 0 or 1. It does not
affect the result of the expression, since it is assumed that the combinations of the inputs leading to this condition
will never occur.
With don’t care conditions, further simplification of the K-map is often guaranteed.
Note: Don’t care conditions are further covered in the Code Conversion topic.
Solution:
CD 𝐶𝐶 + 𝐷𝐷 �
𝐶𝐶 + 𝐷𝐷 𝐶𝐶̅ + 𝐷𝐷
� 𝐶𝐶̅ + 𝐷𝐷
AB 0+0 0+1 1+1 1+0
0 1 3 2
Sample Problem: Simplify the Boolean function 𝐴𝐴 + 𝐵𝐵 0+0 X X
𝐹𝐹 (𝐴𝐴, 𝐵𝐵, 𝐶𝐶, 𝐷𝐷) = 𝛱𝛱𝑀𝑀(6,7,10,11,12,14,15) with
4 5 7 6
the don’t care conditions described by the 𝐴𝐴 + 𝐵𝐵� 0+1
0 0
function: 𝑑𝑑(𝐴𝐴, 𝐵𝐵, 𝐶𝐶, 𝐷𝐷) = 𝛱𝛱𝑀𝑀 (0,3,13).
12 13 15 14
𝐴𝐴̅ + 𝐵𝐵� 1+1 X 0
0 0
8 9 11 10
𝐴𝐴̅ + 𝐵𝐵 1+0
0 0
� + 𝑩𝑩
𝑭𝑭 = (𝑨𝑨 � )(𝑩𝑩
� + 𝑪𝑪
� )(𝑨𝑨
� + 𝑪𝑪
�)
References:
Karim, M., & Chen, X. (2017). Digital design: Basic concepts and principles. Boca Raton, FL: CRC Press/Taylor & Francis.
LaMeres, B. (2019). Introduction to logic circuits & logic design with VHDL (1st ed.). Springer International.
Ndjountche, T. (2016). Digital electronics 2: Sequential and arithmetic logic circuits. John Wiley & Sons.