(→5-variable K-map) |
(Fix typo) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{title|Karnaugh Map (K-map)}} | {{title|Karnaugh Map (K-map)}} | ||
− | <div style="float: right; text-align: center; margin: 20px; width: 250px"> | + | <div style="float: right; text-align: center; margin: 20px; width: 250px">[[File:3-input MAJ gate kmap.svg|200px]]<br />3-input [[MAJ]] gate<br /><math> |
− | [[File:3-input MAJ gate kmap.svg|200px]]<br /> | ||
− | 3-input [[MAJ]] gate<br /> | ||
− | <math> | ||
\begin{align} | \begin{align} | ||
f(a,b,c) =& AB+AC+BC \\ | f(a,b,c) =& AB+AC+BC \\ | ||
Line 114: | Line 111: | ||
\end{align} | \end{align} | ||
</math> | </math> | ||
− | Each minterm in the equation is | + | Each minterm in the equation is then transferred into the K-map where each variable in the minterm represents a 1 and each complemented variable represents a 0. |
[[File:kmap example color coded (expression).svg|400px]] | [[File:kmap example color coded (expression).svg|400px]] | ||
=== from truth table === | === from truth table === | ||
Line 152: | Line 149: | ||
[[File:kmap example 2.svg|right|100px]] | [[File:kmap example 2.svg|right|100px]] | ||
− | The Karnaugh map on the | + | The Karnaugh map on the right on the other hand has two groups. One group spans both <math>B = 0</math> and <math>B = 1</math> and another that spans <math>A = 0</math> and <math>A = 1</math>. In the expression for the group that spans vertically, <math>B</math> changes yielding the expression <math>A</math>. Likewise in the expression that spans horizontally, <math>A</math> changes, yielding the expression <math>B</math>. The simplified equation for this K-map is the ORing of all the individual term - <math>f(A,B) = \sum m(1,2,3) = A+B</math>. |
Line 182: | Line 179: | ||
[[File:kmap (don't care example).svg|left|200px]] | [[File:kmap (don't care example).svg|left|200px]] | ||
− | The [[truth table]] to the Karnaugh map below is on the right and represents an [[incompletely specified function]]. Note the don't care values for two of the outputs. I.e. <math>f(0,0,0)</math> and <math>f(0,0,1)</math> should never happen. In this example, the two don't care values can be used to make the 2-cell group be a 4-cell group allowing us to eliminate a whole variable: <math>A</math>. The Boolean expression is therefore <math>f(a,b,c) = \bar B + | + | The [[truth table]] to the Karnaugh map below is on the right and represents an [[incompletely specified function]]. Note the don't care values for two of the outputs. I.e. <math>f(0,0,0)</math> and <math>f(0,0,1)</math> should never happen. In this example, the two don't care values can be used to make the 2-cell group be a 4-cell group allowing us to eliminate a whole variable: <math>A</math>. The Boolean expression is therefore <math>f(a,b,c) = \bar B + AC</math>. |
{{clear}} | {{clear}} | ||
+ | |||
== Product of Sum (PoS)== | == Product of Sum (PoS)== | ||
[[File:kmap pos example.svg|200px|right]] | [[File:kmap pos example.svg|200px|right]] |
Latest revision as of 23:21, 5 September 2019
Karnaugh Map (K-map) (pronounced car-no map) is a graphical tool that provides a simple and straightforward method of minimizing Boolean expressions. The K-map method was introduced in 1953 by Maurice Karnaugh as an enhancement to Veitch diagram.
Contents
Map Construction[edit]
Map Formats[edit]
A K-map is a square or rectangle divided into a number of smaller squares called cells. Each cell on the K-Map corresponds directly to a line in a truth table. There are always cells in a K-Map where is the number of variables in the function. Below are the usual formats for 1-4 variable k-maps (larges k-maps are discussed later on).
1-Variable K-map | 2-Variables K-map |
---|---|
3-Variables K-map | 4-Variables K-map |
Map Labeling[edit]
The coordinates of the cells in a K-map are the input value combinations from the truth table. There are a number of common ways to label a K-map. The two most common methods are numerically and by variables and their complements. There are advantages to both. Regardless of which way you choose, the coordinates of two adjacent cells differ by only one variable - i.e. only one 0 can switch to a 1 and vice versa between two adjacent cells. For example, consider a function with 2 variables, the order by which you list them would be . Note how 11 and 10 were switched so that only one value is different.
Numerically | Variables |
---|---|
1-Variable K-map | |
2-Variables K-map | |
3-Variables K-map | |
4-Variables K-map | |
Map Cell Numbering[edit]
Inputs | Minterms | Maxterms | ||||
---|---|---|---|---|---|---|
A | B | Minterms | Index | Maxterms | Index | |
0 | 0 | |||||
0 | 1 | |||||
1 | 0 | |||||
1 | 1 | |||||
A | B | C | Minterms | Index | Maxterms | Index |
0 | 0 | 0 | ||||
0 | 0 | 1 | ||||
0 | 1 | 0 | ||||
0 | 1 | 1 | ||||
1 | 0 | 0 | ||||
1 | 0 | 1 | ||||
1 | 1 | 0 | ||||
1 | 1 | 1 |
Sometimes the individual cells are numbered in accordance with their minterm and maxterm indices. Strictly speaking this is unnecessary, but it may be useful in various situations when working with minterms and maxterms. Cell numbering are usually written in one of the cell corners.
1-Variable K-map | 2-Variables K-map |
---|---|
3-Variables K-map | 4-Variables K-map |
Populating a K-map[edit]
Populating a K-map can be done with a Boolean expression or a truth table.
from Boolean expression[edit]
Because each cell on the K-map represents a particular minterm (or maxterm). Converting the desired Boolean function into sum of minterms form can help considerably.
Consider the following Boolean function.
To make it easier to transfer the data to a K-map, the equation can be manipulated a bit so that it's in sum of minterms canonical form.
Each minterm in the equation is then transferred into the K-map where each variable in the minterm represents a 1 and each complemented variable represents a 0.
from truth table[edit]
Transferring the data from a truth table to a K-map is slightly more straightforward since each cell corresponds directly to each row in the table. A cell on the K-map is labeled 1 when the row they represent in the truth table results in a 1; otherwise the cell is labeled 0. Often times if the cell is 0, the 0 itself is simply omitted and is understood to mean that.
Simplification[edit]
Generating simplified equations for a Karnaugh map involves two simple steps:
- finding largest groups of 1s
- generating an equation from the identified groups
Groups[edit]
An implicant is the individual product term in the sum of product expression. On a K-map implicants are represented as one or more adjacent cells of 1s. A group is a loose term for the enclosure containing adjacent squares of 1s. When a group contains the most adjacent 1 cells it possibly can, it is called a prime implicant. When a group encloses cells of 1s that are not shared with any other group, it is called an essential prime implicant. Likewise, when a group encloses cells of 1s that are all shared with other groups, it is called a non-essential prime implicant.
Rules[edit]
When grouping implicants together, there is a set of rules that must be followed:
- Groups are made of power of 2 number of cells (e.g. 1, 2, 4, 8, 16)
- Groups consists of one or more cells of 1s only - i.e. no cells of 0s
- Every cell of 1 must be in at lest one group
- Overlapping groups are allowed
- Wrapping around is allowed
- Groups can be made of cells that are adjacent to one another. I.e. cells must be alongside, above or below one another
- Groups may not go diagonally
- Groups should be large as possible.
Simplified Equation[edit]
After all the maximum groups have been marked in the K-map, a simplified Boolean expression may be obtained by ORing together the individual expressions for each of the groups. The expression for a group is the variables or the complement of the variables that do not change between cells.
For example, consider the example to the left. This Karnaugh map has a single group that covers both and . Because changes, it is dropped from our expression, living us with just . Therefore the Boolean expression for this K-map is simply .
The Karnaugh map on the right on the other hand has two groups. One group spans both and and another that spans and . In the expression for the group that spans vertically, changes yielding the expression . Likewise in the expression that spans horizontally, changes, yielding the expression . The simplified equation for this K-map is the ORing of all the individual term - .
In this K-map, cells 0 and 4 are considered adjacent as well as cells 3 and 7. For the group involving cells 0 and 4, changes, therefore it is dropped from the expression. Because is always 0 and is always 0 as well, the equation for that group is . For the second group involving cells 3 and 7, changes once again. In this group is always 1 and is always 1 as well. The equation for this group is . The final simplified equation for this K-map is the ORing of all the terms - .
Don't cares[edit]
- Further information: don't care
A | B | C | Q |
---|---|---|---|
0 | 0 | 0 | X |
0 | 0 | 1 | X |
0 | 1 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
Incompletely specified function are functions with combination of inputs that should never occur. Those unspecified minterms are called don't care values. Don't care values open opportunities for further simplification of the Boolean expression. When it comes to Karnaugh maps, don't care values, which are represented with X's are considered either a 0 or 1, whichever results in the biggest group - i.e. the simplest expression.
The truth table to the Karnaugh map below is on the right and represents an incompletely specified function. Note the don't care values for two of the outputs. I.e. and should never happen. In this example, the two don't care values can be used to make the 2-cell group be a 4-cell group allowing us to eliminate a whole variable: . The Boolean expression is therefore .
Product of Sum (PoS)[edit]
While usually used to generate sum of products, Karnaugh maps can be used to generate product of sum just as easily by applying the same rules we designed above, but for 0 cells instead. Remember that when working with maxterms instead of minterms, when a variable is 1, it is complemented instead of when it's 0.
For example consider the K-map on the right. In this case the 0 cells are grouped. The Boolean function for this Karnaugh map is
- .
Hazard analysis[edit]
This section is empty; you can help add the missing info by editing this page. |
Larger Karnaugh Maps[edit]
This section is empty; you can help add the missing info by editing this page. |
5-variable K-map[edit]
This section is empty; you can help add the missing info by editing this page. |
6-variable K-map[edit]
This section is empty; you can help add the missing info by editing this page. |
Examples[edit]
This section is empty; you can help add the missing info by editing this page. |