Sei sulla pagina 1di 5

Discrete Mathematics 2003

Lecture 33, 10-October-2003

Karnaugh Maps
Last lecture: We introduced disjunctive normal form (dnf) as a standard way to write Boolean expressions Example: f (x, y, z) = xy'z + xy'z' + x'y'z is in dnf Starting with an expression in dnf, well look at a systematic method to simplify the expression This systematic method is based on the use of Karnaugh maps
1

Karnaugh Maps (cont)


A Karnaugh map is a pictorial way to represent a Boolean expression in dnf It is similar to the way that a Venn diagram is a pictorial device for representing sets Karnaugh maps were introduced in 1953 by Maurice Karnaugh (an American) in a paper The map method for synthesis of combinatorial logic circuits Well start by looking at Boolean functions f (x, y) of 2 variables, where the expression for f is in dnf later well look at functions of 3 & 4 variables
2

Karnaugh Maps with 2 Variables


Suppose f (x, y) = xy + x'y + xy' (which is in dnf) To simplify this expression using Karnaugh maps, start by drawing a table Now obtain the Karnaugh map by placing 1 in cells where the minterm is present in the expression
3

Discrete Mathematics 2003

Lecture 33, 10-October-2003

Using Loops on Karnaugh Maps


If there are 2 ones in the same row or column, the corresponding minterms have a common factor e.g. The entries in the 1st row represent xy & xy', which have a common factor of x (& the entries in the 1st column have a common factor of y) It is the presence of common factors that enables the expression to be simplified The presence of the common factors is indicated by drawing loops about the 1s
4

What is the Purpose of the Loops?


The horizontal loop represents xy + xy', which simplifies to just x (by laws of Boolean algebra) Similarly, the vertical loop represents xy + x'y, which simplifies to y (again by the laws) However, the helpful property of Karnaugh maps is that we dont actually have to use the laws Instead, all we need to say is that the common factor in the horizontal loop is x, & in the vertical loop is y Thus the original expression simplifies to f (x, y) = x + y 5

What about the Double Counting?


Note: In the previous discussion, it is reasonable to query the apparent double-counting of the xy term, which has been included in both loops In fact, this is justified by the idempotent law, which tells us that xy + xy = xy Thus a 2nd copy of xy can be legitimately included in the expression for f (x, y), which means that it is okay to include xy in both loops
6

Discrete Mathematics 2003

Lecture 33, 10-October-2003

More on Karnaugh Maps with 2 Variables


If there are no complete rows or columns of 1s in the Karnaugh map, no simplification of the expression is possible If there is a 1 for all entries in the table, draw a loop around all four 1s The only common factor of all entries enclosed by the loop is 1, so the Boolean expression simplifies to just 1 7

Karnaugh Maps for 3 or more Variables


Exercise: Use Karnaugh maps to simplify the Boolean expressions (1): x'y + x'y' (2): x'y' + x'y + xy' (3): x'y + xy' In fact, expressions with 2 variables are easy to simplify without Karnaugh maps (use the laws) It is for expressions with 3 or 4 variables that the technique of Karnaugh maps is most useful For 5 or more variables, the Karnaugh maps are harder to visualize, & more mechanical approaches are used to simplify expressions 8

Karnaugh Maps for 3 Variables


Now look at Karnaugh maps for Boolean expressions of 3 variables in dnf If the variables are x, y & z, the table for the Karnaugh map has 8 cells N.B. In order for the method to work, the columns must be labelled in the given order As before, 1 is placed in a cell if the minterm is present in the dnf; otherwise the cell is left blank
9

Discrete Mathematics 2003

Lecture 33, 10-October-2003

What Loops Can be Drawn?


Various loops can be drawn, corresponding to the ways minterms can be combined & simplified: All eight 1s (so the expression simplifies to 1) Four 1s in a row Four 1s in a square including the broken square of 1st & 4th columns, b/c the right & left edges of the table are regarded as joined (think of the table as drawn on the outside of a cylinder) Two adjacent 1s in a row or column including broken pairs such as top left & top right A single 1 10

What Loops Should be Drawn?


The larger the loop, the greater the resulting simplification of the Boolean expression Assume we dont have all 1s Then start by drawing as many loops containing four 1s as possible, followed by loops with two 1s, then loops with a single 1 Loops are allowed to overlap Every 1 must be included in at least one loop Within these rules, the number of loops should be kept as small as possible 11

Example of a Map with 3 Variables


Example 1: Simplify the Boolean expression xy'z' + xyz' + x'y'z' + x'yz' + x'y'z Solution: Firstly, note the expression is in dnf. The Karnaugh map is

Draw a loop around the four 1s in a square, then a loop around the two adjacent 1s (next slide)
12

Discrete Mathematics 2003

Lecture 33, 10-October-2003

Examples (continued)

The common factor in the square is z' & in the pair is x'y', so xy'z' + xyz' + x'y'z' + x'yz' + x'y'z = x'y' + z' Example 2: Simplify the Boolean expression xyz + x'yz + xy'z' + x'yz' Answer: xy'z' + x'y + yz
13

Examples (continued)
Exercise: Simplify the Boolean expression xyz + x'yz + x'yz' + xy'z' + xyz' + xy'z Answer: x + y The next example shows an expression may have more than 1 most simplified form Example 3: Simplify the Boolean expression xyz + xy'z + xyz' + x'y'z + x'y'z' Answer: The 1s can be covered according to the rules in 2 different ways (each way uses 3 loops around pairs), leading to 2 equivalent answers of xy + xz + x'y' and xy + y'z + x'y'
14

Potrebbero piacerti anche