All Topics  
Karnaugh map

 

   Email Print
   Bookmark   Link






 

Karnaugh map



 
 
The Karnaugh map, also known as a Veitch diagram (KV-map or K-map for short), is a tool to facilitate the simplification of Boolean algebra integrated circuit
Integrated circuit

In electronics, an integrated circuit is a miniaturized electronic circuit that has been manufactured in the surface of a thin Wafer of semiconductor material....
 expressions. The Karnaugh map reduces the need for extensive calculations by taking advantage of human pattern-recognition and permitting the rapid identification and elimination of potential race hazards.

The Karnaugh map was invented in 1952 by Edward W. Veitch
Edward W. Veitch

Edward W. Veitch was an American mathematician. He invented in 1952 a graphical procedure for the optimization of digital circuits, which was later called Karnaugh map, after Maurice Karnaugh who refined it....
.






Discussion
Ask a question about 'Karnaugh map'
Start a new discussion about 'Karnaugh map'
Answer questions from other users
Full Discussion Forum



Encyclopedia


The Karnaugh map, also known as a Veitch diagram (KV-map or K-map for short), is a tool to facilitate the simplification of Boolean algebra integrated circuit
Integrated circuit

In electronics, an integrated circuit is a miniaturized electronic circuit that has been manufactured in the surface of a thin Wafer of semiconductor material....
 expressions. The Karnaugh map reduces the need for extensive calculations by taking advantage of human pattern-recognition and permitting the rapid identification and elimination of potential race hazards.

The Karnaugh map was invented in 1952 by Edward W. Veitch
Edward W. Veitch

Edward W. Veitch was an American mathematician. He invented in 1952 a graphical procedure for the optimization of digital circuits, which was later called Karnaugh map, after Maurice Karnaugh who refined it....
. It was further developed in 1953 by Maurice Karnaugh
Maurice Karnaugh

Maurice Karnaugh is an American physicist, famous for the Karnaugh map used in Boolean algebra .He studied mathematics and physics at City College of New York and transferred to Yale University to complete his B.Sc....
, a physicist at Bell Labs
Bell Labs

Bell Laboratories is the research organization of Alcatel-Lucent and previously of the American Telephone & Telegraph Company .Bell Laboratories has had its headquarters at Berkeley Heights, New Jersey, and it has research and development facilities throughout the world....
, to help simplify digital electronic circuits.

In a Karnaugh map the boolean
Boolean logic

Boolean algebra is a logical calculus of logical values, developed by George Boole in the late 1830s. It resembles the algebra of real numbers as taught in high school, but with the numeric operations of multiplication xy, addition x + y, and negation −x replaced by the respective logical operations of conjun...
 variables are transferred (generally from a truth table
Truth table

A truth table is a mathematical table used in logic?specifically in connection with Boolean algebra , boolean functions, and propositional calculus?to compute the functional values of logical expression s on each of their functional arguments, that is, on each combination of values taken by their logical variables....
) and ordered according to the principles of Gray code
Gray code

|}The reflected binary code, also known as Gray code after Frank Gray , is a binary numeral system where two successive values differ in only one bit....
 in which only one variable changes in between squares. Once the table is generated and the output possibilities are transcribed, the data
DATA

Debt, AIDS, Trade in Africa is a multinational Non-governmental organization founded in January 2002 in London by U2's Bono along with Robert Sargent Shriver III and activists from the Jubilee 2000 Drop the Debt campaign....
 is arranged into the largest even group possible and the minterm
Canonical form (Boolean algebra)

In Boolean algebra , any Boolean function can be expressed in a canonical form using the dual concepts of minterms and maxterms. Minterms are called products because they are the AND of a set of variables, and maxterms are called sums because they are the OR of a set of variables ....
 is generated through the axiom laws of boolean algebra.

Properties


Procedures

A Karnaugh map may contain any number of boolean
Boolean logic

Boolean algebra is a logical calculus of logical values, developed by George Boole in the late 1830s. It resembles the algebra of real numbers as taught in high school, but with the numeric operations of multiplication xy, addition x + y, and negation −x replaced by the respective logical operations of conjun...
 variables, but is most often used when there are fewer than six variables. Each variable contributes two possibilities: the initial value, and its inverse
Inverse

Inverse or inversion may refer to:* Inverse , a program for solving inverse and optimization problems* Inversion * Inversion , the reversal of the order of a foot's elements...
; it therefore organizes all possibilities of the system. The variables are arranged in Gray code
Gray code

|}The reflected binary code, also known as Gray code after Frank Gray , is a binary numeral system where two successive values differ in only one bit....
 in which only one possibility of one variable changes between two adjacent grid boxes.

Once the variables have been defined, the output possibilities are transcribed according to the grid location provided by the variables. Thus for every possibility of a boolean input or variable the output possibility is defined.

When the Karnaugh map has been completed, to derive a minimized function the "1s" or desired outputs are grouped into the largest possible rectangular
Rectangle

In geometry, a rectangle is a Closed set planar quadrilateral with four right angles. A rectangle with vertices ABCD would be denoted as .A rectangle with adjacent sides of lengths a and b has area ab and diagonals of equal length ....
 groups in which the number of grid boxes
Square (geometry)

In Euclidean geometry, a square is a regular polygon with four equal sides and four equal angles . A square with vertices ABCD would be denoted ....
 (output possibilities) in the groups must be equal to a power of 2. For example, the groups may be 4 boxes in a line, 2 boxes high by 4 boxes long, 2 boxes by 2 boxes, and so on. "Don't care(s)
Don't-care (logic)

In digital logic, a don't-care term is an input-sequence to a function that the designer does not care about, usually because that input would never happen, or because differences in that input would not result in any changes to the output....
" possibilities (generally represented by a "X") are grouped only if the group created is larger than the group with "Don't care" is excluded. The boxes can be used more than once only if it generates the least number of groups. All "1s" or desired output possibilities must be contained within a grouping.

The groups generated are then converted to a boolean expression by: locating and transcribing the variable possibility attributed to the box, and by the axiom laws of boolean algebra—in which if the (initial) variable possibility and its inverse are contained within the same group the variable term is removed. Each group provides a "product" to create a "sum-of-products
Canonical form (Boolean algebra)

In Boolean algebra , any Boolean function can be expressed in a canonical form using the dual concepts of minterms and maxterms. Minterms are called products because they are the AND of a set of variables, and maxterms are called sums because they are the OR of a set of variables ....
" in the boolean expression.

To determine the inverse of the Karnaugh map, the "0s" are grouped instead of the "1s". The two expressions are non-complementary.

Relationships

Each square in a Karnaugh map corresponds to a minterm (and maxterm). The picture to the right shows the location of each minterm on the map. A Venn diagram
Venn diagram

Venn diagrams or set diagrams are diagrams that show all hypothetically possible logical relations between a finite collection of Set . Venn diagrams were invented around 1880 by John Venn....
 of four sets—labeled A, B, C, and D—is shown to the right that corresponds to the 4-variable K-map of minterms just above it:
  • Variable A of the K-map corresponds set A in the Venn diagram; etc.
  • Minterm m0 of the K-map corresponds to area 0 in the Venn diagram; etc.
  • Minterm m9 is ABCD (or 1001) in the K-map corresponds only to where sets A & D intersect in the Venn diagram.


Thus, a specific minterm identifies a unique intersection of all four sets. The Venn diagram can include an infinite number of sets and still correspond to the respective Karnaugh maps. With increasing number of sets and variables, both Venn diagram and Karnaugh map increase in complexity to draw and manage.

Toroidally connected

The grid is toroidally
Torus

In geometry, a torus is a surface of revolution generated by revolving a circle in three dimensional space about an axis coplanar with the circle, which does not touch the circle....
 connected, so the rectangular groups can wrap around edges. For example m9 can be grouped with m1; just as m0, m9, m3, and m10 can be combined into a four-by-four group.

Size of map

The size of the Karnaugh map with n Boolean variables is determined by 2n. The size of the group within a Karnaugh map with n Boolean variables and k number of terms in the resulting Boolean expression is determined by 2nk. Common sized maps are of 2 variables which is a 2×2 map, 3 variables which is a 2×4 map, and 4 variables which is a 4×4 map.

Example

Karnaugh maps are used to facilitate the simplification of Boolean algebra functions. The following is an unsimplified Boolean Algebra function with Boolean variables , , , , and their inverses. They can be represented in two different functions:

  • Note: The values inside are the minterms to map (i.e. which rows have output 1 in the truth table).

Truth table

Using the defined minterms, the truth table can be created:
#
0 0 0 0 0 0
1 0 0 0 1 0
2 0 0 1 0 0
3 0 0 1 1 0
4 0 1 0 0 0
5 0 1 0 1 0
6 0 1 1 0 1
7 0 1 1 1 0
8 1 0 0 0 1
9 1 0 0 1 1
10 1 0 1 0 1
11 1 0 1 1 1
12 1 1 0 0 1
13 1 1 0 1 1
14 1 1 1 0 1
15 1 1 1 1 0


Karnaugh map

The input variables can be combined in 16 different ways, so the Karnaugh map has 16 positions, and therefore is arranged in a 4 × 4 grid.

The binary digits in the map represent the function's output for any given combination of inputs. So 0 is written in the upper leftmost corner of the map because ƒ = 0 when A = 0, B = 0, C = 0, D = 0. Similarly we mark the bottom right corner as 1 because A = 1, B = 0, C = 1, D = 0 gives ƒ = 1. Note that the values are ordered in a Gray code
Gray code

|}The reflected binary code, also known as Gray code after Frank Gray , is a binary numeral system where two successive values differ in only one bit....
, so that precisely one variable changes between any pair of adjacent cells.

After the Karnaugh map has been constructed the next task is to find the minimal terms to use in the final expression. These terms are found by encircling groups of 1s in the map. The groups must be rectangular and must have an area that is a power of two (i.e. 1, 2, 4, 8…). The rectangles should be as large as possible without containing any 0s. The optimal groupings in this map are marked by the green, red and blue lines. Note that groups may overlap. In this example, the red and green groups overlap. The red group is a 2 × 2 square, the green group is a 4 × 1 rectangle, and the overlap area is indicated in brown.

The grid is toroidally
Torus

In geometry, a torus is a surface of revolution generated by revolving a circle in three dimensional space about an axis coplanar with the circle, which does not touch the circle....
 connected, which means that the rectangular groups can wrap around edges, so is a valid term, although not part of the minimal set—this covers Minterms 8, 10, 12, and 14.

Perhaps the hardest-to-visualize wrap-around term is which covers the four corners—this covers minterms 0, 2, 8, 10.

Solution

Once the Karnaugh Map has been constructed and the groups derived, the solution can be found by eliminating extra variables within groups using the axiom laws of boolean algebra. It can be implied that rather than eliminating the variables that change within a grouping, the minimal function can be derived by noting which variables stay the same.

For the Grey grouping:
  • The variable maintains the same state (1) in the whole encircling, therefore it should be included in the term for the red encircling.
  • Variable does not maintain the same state (it shifts from 1 to 0), and should therefore be excluded.
  • does not change: it is always 0.
  • changes.


Thus the first term in the Boolean sum-of-products expression is

For the Green grouping we see that and maintain the same state, but and both change. is 0 and has to be negated before it can be included. Thus the second term is

In the same way, the Blue grouping gives the term

The solutions of each grouping are combined into:

Inverse

The inverse of a function is solved in the same way by grouping the 0s instead.

The three terms to cover the inverse are all shown with grey boxes with different colored borders:
  • brown—
  • gold—
  • blue—


This yields the inverse:

Through the use of De Morgan's laws
De Morgan's laws

In formal logic, De Morgan's laws are rules relating the logical operators 'and' and 'or' in terms of each other via logical negation.History...
, the product of sums can be determined:

Don't cares


Karnaugh maps also allow easy minimizations of functions whose truth tables include "don't care
Don't-care (logic)

In digital logic, a don't-care term is an input-sequence to a function that the designer does not care about, usually because that input would never happen, or because differences in that input would not result in any changes to the output....
" conditions (that is, sets of inputs for which the designer doesn't care what the output is) because "don't care" conditions can be included in a ring to make it larger. They are usually indicated on the map with a dash or X.

The example to the right is the same above example but with minterm 15 dropped and replaced as a don't care. This allows the red term to expand all the way down and, thus, removes the green term completely.

This yields the new minimum equation:

Note that the first term is just not . In this case, the don't care has dropped a term (the green); simplified another (the red); and removed the race hazard (the yellow as shown in a following section).

Also, since the inverse case no longer has to cover minterm 15, minterm 7 can be covered with rather than with similar gains.

Race hazards

Karnaugh maps are useful for detecting and eliminating race hazards. They are very easy to spot using a Karnaugh map, because a race condition may exist when moving between any pair of adjacent, but disjointed, regions circled on the map.

  • In the above example, a potential race condition exists when C is 1 and D is 0, A is 1, and B changes from 1 to 0 (moving from the blue state to the green state). For this case, the output is defined to remain unchanged at 1, but because this transition is not covered by a specific term in the equation, a potential for a glitch (a momentary transition of the output to 0) exists.
  • There is a second glitch in the same example that is more difficult to spot: when D is 0 and A and B are both 1, with C changing from 1 to 0 (moving from the blue state to the red state). In this case the glitch wraps around from the top of the map to the bottom.


Whether these glitches do occur depends on the physical nature of the implementation, and whether we need to worry about it depends on the application.

In this case, an additional term of would eliminate the potential race hazard, bridging between the green and blue output states or blue and red output states: this is shown as the yellow region.

The term is redundant
Logic redundancy

Logic redundancy occurs in a a logic gate network containing circuitry that does not affect the static logic function. There are several reasons why logic redundancy may exist....
 in terms of the static logic of the system, but such redundant, or consensus terms
Consensus theorem

In Boolean algebra , the consensus theorem is a simplification of the following terms:Proof for this theorem is: LHS = xy + x'z + yz= xy + x'z + xyz + x'yz...
, are often needed to assure race-free dynamic performance.

Similarly, an additional term of must be added to the inverse to eliminate another potential race hazard. Applying De Morgan's laws creates another product of sums expression for F, but with a new factor of .

Examples of 2-variable maps

The following are all the possible 2-variable, 2 × 2 Karnaugh maps. Listed with each is the minterms as a function of and the race hazard free (see previous section) minimum equation.

See also

  • Circuit minimization
    Circuit minimization

    In Boolean algebra , circuit minimization is the problem of obtaining the smallest logic circuit that represents a given Boolean function or truth table....
  • Espresso heuristic logic minimizer
    Espresso heuristic logic minimizer

    The Espresso logic minimizer is a widely used computer program using heuristic and specific algorithms for efficiently reducing the complexity of digital electronic gate circuits....
  • List of boolean algebra topics
    List of Boolean algebra topics

    This is a list of topics around Boolean algebra and propositional logic....
  • Quine-McCluskey algorithm
  • Venn diagram
    Venn diagram

    Venn diagrams or set diagrams are diagrams that show all hypothetically possible logical relations between a finite collection of Set . Venn diagrams were invented around 1880 by John Venn....


Further reading



External links

  • , by Herbert Glarner.
  • , Circuit design project to control traffic lights.


Software

Software applications are available to assist with Karnaugh mapping:
  • , freeware application for the Palm OS
    Palm OS

    Palm OS is an embedded operating system operating system initially developed by U.S. Robotics Corp.-owned Palm, Inc. for personal digital assistants in 1996....
    .
  • , free software application at SourceForge.net
    SourceForge.net

    SourceForge.net is a source code repository. It acts as a centralized location for software developers to control and manage open source software development....
    .
  • , Java applet for solving 5-variable Karnaugh maps available only in French
    French language

    French is a Romance language spoken around the world by around 80 million people as first language, by 190 million as second language, and by about another 200 million people as an acquired tongue, with significant speakers in 54 countries....
    .
  • , free software application at SourceForge.net
    SourceForge.net

    SourceForge.net is a source code repository. It acts as a centralized location for software developers to control and manage open source software development....
    .
  • , freeware application available in English
    English language

    English is a West Germanic language that originated in Anglo-Saxon England and has lingua franca status in many parts of the world as a result of the military, economic, scientific, political and cultural influence of the British Empire in the 18th, 19th and early 20th centuries and that of the United States from the mid 20th century onwa...
    , Czech
    Czech language

    Czech is a West Slavic language with about 12 million native speakers; it is the majority language in the Czech Republic and spoken by Czech people worldwide....
    , and German.
  • , Java applet, Java binary application, C binary application from Nangate UFRGS Research Lab.
  • , JavaScript application.
  • freeware application, published 1999.