You are on page 1of 50

Gate level minimization:

Binary Logic: Binary logic deals with variables that take on two discrete values and with operations that assume logic meaning. The two values taken by these variables may be called by different names: true and false, yes and no, zero (0) and one (1) etc. But, here in our case, that is for Gate Level Minimization we will assume these variables to have either zero or one. Binary logic is a mathematical way of manipulation and processing of binary information. It is particularly suited for the analysis and design of digital systems. Logic Gates: Binary Logic consists of binary variables and logical operations. These variables are designated by letters of the alphabet such as A,B,C,x,y,z, etc., with each variable having two and only two distinct possible values: 1 and 0. There are three basic operations: AND, OR, and NOT. There are three other Gates of pretty much importance which are the combination of the above three Gates, these are NAND, NOR, and EXNOR. Binary logic resembles binary arithmetic, and the operations AND and OR have similarities to multiplication and addition respectively to some extent. In fact, the symbols used for AND and OR are the same as those used for multiplication and addition. However, binary logic should not be confused with binary arithmetic. For each combination of the values of x and y, there is a value of z specified by the definition of the logical operation. These definitions may be listed in a compact form using truth tables. A truth table is a table of all possible combinations of the

variables showing the relation between the values that the variable may take and the result of the operation.

AND GATE: The operation of AND GATE resembles to that of arithmetic multiplication, i.e., the output of the GATE will be HIGH or 1 only when all the inputs to the GATE are HIGH(1), and will be LOW(0) in all other cases.

OUTPUT= (A.B) Graphical Representation:

AND GATE TRUTH TABLE: INPUT A 0 0 1 1 INPUT B 0 1 0 1 OUTPUT(A.B) 0 0 0 1

OR GATE: The operation of OR GATE resembles to that of arithmetic addition, i.e., the output of the GATE will be HIGH or 1 when any of the inputs to the GATE is HIGH(1), and will be LOW(0) in all other cases.

OUTPUT= (A+B)

Graphical Representation:

OR GATE

TRUTH TABLE: INPUT A 0 0 1 1 INPUT B 0 1 0 1 OUTPUT(A+B) 0 1 1 1

NOT GATE: The OUTPUT of the NOT GATE is complemented of the INPUT, i.e., NOT GATE acts as an inverter, hence for every 1 output is 0 and vice-versa. OUTPUT=! A

Graphical Representation:

NOT GATE

TRUTH TABLE: INPUT(A) 0 1 OUTPUT() 1 0

The Six Elementary Logic Operations: When you look at a catalog of digital electronics chips, you are going to discover that they are built from ANDs, ORs and NOTs as well as three other elementary gates. Two of these gates are critically important to understand because they are actually the basis of digital logic while the third is required for adding numbers together. NAND GATE: TTL logic is based on the NAND gate which can be considered a NOTed ANDthe output of AND gate is inverted by using a NOT gate. Instead of drawing the NAND gate as an AND gate and NOT gate connected together they are constructed into the one symbol as shown below,

OUTPUT=! (A.B)

Graphical Representation:

NAND gate made from AND and NOT gates.

NAND gate

TRUTH TABLE: INPUT A 0 0 1 1 INPUT B 0 1 0 1 OUTPUT !(A.B) 1 1 1 0

NOR Gate: The NOR gate can be considered a NOTed OR- the output of OR gate is inverted by using a NOT gate. The NOR gate can be considered to be a contraction of the OR and NOT gates and operates in the opposite manner as the OR gate. OUTPUT=! (A+B) Graphical Representation:

NOR Gate

Truth Table: INPUT A 0 0 1 1 INPUT B 0 1 0 1 OUTPUT !(A+B) 1 0 0 0

The NAND and NOR gates are extensively used as standard logic gates and are in fact far more popular than the AND and OR gates. This is because NAND and NOR gates are easily constructed with transistor circuits and because Boolean functions can be easily implemented with them.

XOR Gate: Exclusive OR only returns a True OUTPUT if only one of its INPUTS is true. If both of its INPUTs are the same, then the Exclusive OR outputs false. The Boollean arithmetic symbol for XOR is often a caret (^) asis used in computer programming languages or a circle with an x character in it OUTPUT= (A Graphical Representation: B)

Truth Table: INPUT A 0 0 1 1 INPUT B 0 1 0 1 OUTPUT !(A+B) 0 1 0 1

Boolean algebra:
Basic Definitions Like any other deductive mathematical system, Boolean algebra, may be defined with a set of elements, a set of operators, and a number of unproved axioms or postulates. A set of elements is any collection of objects having a common property. A set with denumerable number of elements is specified by braces: A= {1, 2, 3, 4}, i.e., the elements of A are the numbers 1, 2, 3, and 4. A binary operator defined on a set S of elements is a rule that assigns to each pair of elements from S a unique element from S. As an example, consider the relation a*b= c. We say that * is a binary operator if it specifies a rule for finding c from the pair (a, b) and also if a, b, c S. However, * is not a binary operator if a, b S and c

The Axioms of Boolean algebra


There are nineteen generally accepted laws or axioms of Boolean algebra. Eighteen of these laws are generally presented in pairs: one is the AND form and the other, its mathematical dual, in OR form. A nineteenth law, often called the double negation law does not have a dual form of representation. The laws, which can be demon-strably proved using truth tables are presented now with the AND form on the left and the OR form on the right. Identity Laws 1A= A 0+A = A

These two laws appear to be identical to those in arithmetic in that the variable on the left side of each equation remains unchanged by the operation. In logic terms, 1 and-ed with anything yields whatever the value of anything was; 0 or-ed with anything does not change the value of whatever anything was. These are the two identity laws.

Null Laws 0A = 0 1+A = 1

These two laws only have a partial counterpart in arithmetic, essentially defining conditions when the values of variables are suborned to 0 for and-ing and 1 for or-ing purposes. In logic terms, 0 and-ed with anything is zero while 1 or-ed with anything is 1.

Idempotent Laws AA = A A+A = A

The term idempotent is made up of two words: idem meaning that which has come before and potent meaning strong. In essence, these are overemphasis laws, basically implying that you can and or or a variable with itself as many times as you like but you will not change the value of the variable. These laws have no arithmetic counterparts. Inverse Laws
A A 0 A A 1

In arithmetic, there is an additive inverse law which states that a number added to its inverse sums to zero; there is no multiplicative inverse law. In Boolean algebra, any variable and-ed with its inverse yields zero (one of the two must always be zero) and any variable or-ed with its inverse must yield a sum of 1. Double Negation Law
AA

This is the two nos make a yes law. A second negation cancels the effect of a first negation. In arithmetic, a double unary minus [unary minus reverses the sign of a constant or variable] serves as the equivalent operation. Commutative Laws AB = BA

A+B = B+A

These two laws are identical to their arithmetic counterparts. Boolean algebra terms are commutative with respect to both multiplication (and) and addition (or).

Associative Laws (A B) C = A (B C) (A + B) +C = A + (B + C)

These two laws are likewise identical to their arithmetic counterparts with respect to multiplication (and) and addition (or). Distributive Laws A + (B C) = (A + B) (A + C) A (B + C) = A B + A C

The OR form resembles the distributive law of multiplication with respect to addition that we know well from arithmetic. In Boolean algebra, this law

becomes the distributive law of AND with respect to OR. Not that there is a dual form that seems to interchange the + and signs. There is no such counterpart in arithmetic. Absorption Laws A (A + B) = A A+AB = A

This is where Boolean algebra takes off in a direction unfamiliar to many. In both equation forms, it appears the variable B serves no useful purpose. Indeed, B is absorbed by the more dominant A in these arrangements of terms. This is commonplace when all variables must be either 0 or 1 in value. A more complex form of this law is A B + A C + B C = A B + A C in which the entire B C term is absorbed. DeMorgans Laws
AB A B A B A B

DeMorgans two laws make it possible to rearrange Boolean expressions into more simplified forms. Since each Boolean expression can be used as the basis for a digital logic circuit, the more simplified forms lead to the design of more

simplified circuits thereby reducing both cost and the physical size of the components. DeMorgans Laws also point out the existence of NAND (Not AND) and NOR (Not OR) functions. In truth, NAND gates and NOR gates not only exist, but they figure prominently in the design of digital logic circuits. A NAND gates output is always on unless both of its inputs are in an on state; likewise, a NOR gate is on only when both inputs are in an off state. Every Boolean expression made up of AND, OR and NOT logic can be transformed directly into an equivalent expression consisting solely of NAND and NOR logic. The latter two gates require fewer transistors to build, consume less space and power, and therefore, are preferable as design features. But their use is counter-intuitive. Kind of like walking into a room and turning the light switch off in order to make the light bulbs illuminate!

Canonical and standard forms


Minterms and Maxterms: A binary variable may appear either in its normal form (x) or in its complement form (x). Now consider two binary values x and y combined with an AND operation. Since each variable may appear in either form, there are four possible combinations: xy, xy, xy, and xy. Each of these four AND terms represent one of the different possible states and is called a minterm, or a standard product. In a similar anner, n variables can be combined to form 2n minterms. The 2n different minterms may be determined by a method similar to one shown in figure below

for three variables. Each minterm is obtained from an AND term of the n variables, with each variable being primed if the corresponding bit of the binary number is a 0 and unprimed if a 1. A symbol for each minterm is also shown in the table and is of the form mj , where j denotes the decimal equivalent of the binary number of the minterm designated. In a similar fashion, n variables forming an OR term, with each variable being primed or unprimed, provide 2n possible combinations, called maxterms, or standard sums. Any 2n maxterms for n variables may be determined similarly. Each maxterm is obtained from an OR term of the n variables, with each variable being unprimed if the corresponding bit is a 0 and primed if a 1. Note that each minterm is the complement of its corresponding maxterm and vice-versa. Minterms x y z Term xyz 1 0 1 0 1 0 1 xyz xyz xyz xyz xyz xyz xyz Designation m0 m1 m2 m3 m4 m5 m6 m7 Maxterms Term x+y+z x+y+z x+y+z x+y+z x+y+z x+y+z x+y+z x+y+z Designation M0 M1 M2 M3 M4 M5 M6 M7

0 0 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1

A Boolean function may be expressed algebraically from a given truth table by forming a minterm for each combination of the variable that produces a 1 in the function, and then taking OR of all those terms. For example, the function f1 in the

tale given below is determined by expressing combinations 001, 100, and 111 as xyz, xyz, and xyz, respectively. Since each of these minterms result in f1= 1, we should have f1 = xyz + xyz + xyz = m1 + m4 + m7

This example shows that any Boolean function can be expressed as a sum of minterms. Function of three variable x y z Function f1 0 1 0 0 1 0 0 1

1 0 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1

Now consider the complement of a Boolean function. It may be read from the truth table by forming a minterm for each combination that produces a 0 in the function and then ORing those terms. The complement of f1 is read as f1 = xyz + xyz + xyz + xyz + xyz

If we take the complement of f1, we obtain the function f1: f1 = (x + y + z) (x + y + z) (x + y + z) (x + y + z) (x + y + z) = M0M1M2M4 Sum of Minterms It was previously that for n binary variables, one can obtain 2n distinct minterms, nd that Boolean function can be expressed as a sum of minterms. The minterms whose sum defines the Boolean function are those that give the 1s of the function in a truth table. Since the function can be either 1 or 0 for each minterm, and since there are 2n minterms, one can calculate the possible functions that can be formed with n variables to be 22n. It is sometimes convenient to express the Boolean function in its sum of minterms form. If not in this form, it can be made so by first expanding the expression into a sum of AND terms. Each term is then inspected to see if it contains all the variables. If it misses one or more variables, it is ANDed with an expression such as x + x, where x is one of the missing variables. Example: Express the Boolean function F = A +BC in sum of minterms. The function has three variables, A, B, and C. The first term A is missing two variables; therefore: A = A (B + B) = AB + AB This is still missing one variable: A = AB (C + C) + AB(C + C)

ABC + ABC + ABC + ABC The second term BC is missing one variable: BC = BC (A + A) = ABC + ABC Combining all terms, we get F = A + BC = ABC + ABC + ABC + ABC + ABC + ABC But ABC appears twice, and according to theorem (x + x = x), it is possible to remove one of them. Hence finally we obtain, F = ABC + ABC + ABC + ABC + ABC Product of maxterms: Page-62

Karnaugh Map
The Karnaugh Map or K-Map provides another way to view a table of combinations that represents a Boolean function. It provides us with a simpler and more efficient method of simplifying circuits than attempting an uncertain formula manipulation of Boolean algebra expressions in a quest for a simplified version. A Karnaugh map fan-folds a table of combinations into a smaller area for a more compact look at the function. The cells contain the function values for various input values; variable labels in the upper left corner identify row and column headings, and binary labels on each row and column provide the specific input variable values. In a 3-variable Map, the binary labels along the vertical (row) axis of the Map display all of the possible value combinations for A and B, whereas the binary labels on the horizontal (column) axis show the possible values for the variable C. If we examine the first row of the Table of Combinations (TOC), we see the values for AB\C = 00\0, which corresponds to the first cell of the Karnaugh Map. The next cell of the TOC lists the value of AB\C = 00\1. This corresponds to the 2nd cell in row 1 of the Karnaugh Map, where the C value = 1. Proceeding down the table for each of the remaining three rows will yield the remaining six function values. The circled numbers have been added to show the relationship between the TOC function output values and the Karnaugh Map cells as the shape of the grid transforms. If you follow the circled numbers, you can see how each F (output) value from the TOC finds its place onto the appropriate cell of the Karnaugh Map. Did you notice that the third and fourth rows are out of sequence? This

happens because in the Karnaugh Map, only one variable may change its value when we advance from row to row. The reason for this is that the Map

implements a fundamental simplification formula in Boolean algebra:


A B A B A (B B ) A 1 A

Table of Combinations A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F

Karnaugh Map C AB 00 01 11 10 0 1

We begin by filling in the 1s that correspond between the two grids and fill in the remaining cells with 0s. For example, a three-variable equation such as
ABC ABC ABC F would produce the following TOC and Karnaugh Map matrix:

Table of Combinations A 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 C 0 1 0 1 0 1 0 1 F 0 0 0 1 0 1 1 0

Karnaugh Map

C AB 00 01 11 10

0 0 0 1 0

1 0 1 0 1

We can also have 2-variable Karnaugh Maps. They are much easier to grasp! The equation: AB AB AB F would produce the following TOC and Karnaugh Map matrix:

Table of Combinations A 0 0 1 1 B 0 1 0 1 F 0 1 1 1 B A 0 1

Karnaugh Map

0 0 1

1 1 1

Now lets now look at a 4-variable equation. The basic rules apply that were used with the 3-variable Map, except that the top part of the Map now represents the 3rd and 4th variables (C and D) and their input values follow the same pattern that was used for the A and B variables. Consider the following 4-variable equation: ABCD ABD ABCD F . Note that when a variable is missing from a term, we must assume that the term can be expanded to include the addition of the missing variable in either its on or off state. The second term would result in a 1 for the rows containing 1011 and 1001 where the missing C variable is either a one or a zero. Follow the numbers (in place of zeros) for the first row to see the new pattern!

Table of Combinations A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 B 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 F 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0

Karnaugh Map

AB 00 01 11 10

CD 00 0 0 0

01 1 1 1

11 0 0 1

10 0 0 0

How Would You Simplify a Boolean Expression by Drawing Circles on a Karnaugh Map? Circle drawing enables us to simplify any 2-, 3- or 4-variable Boolean expression by highlighting unnecessary terms, thus potentially reducing the number of terms included in the expression. Each circle represents one Boolean term in the final and most-simplified version of the expression. There are a few rules to keep in mind when drawing circles on a Karnaugh Map:

Circle Rules: 1. Circles are drawn around groups of cells containing 1s of sizes 1, 2, 4, 8, and 16 (powers of 2). 2. Circles must enclose cell groupings that are rectangular (no diagonals) horizontal and vertical patterns only. 3. Each circle is drawn as large as possible to enclose the greatest number of 1s. 4. Every 1 must be included in at least one circle. 5. Drawing a circle around 1s that are ALL already circled introduces redundant terms and is a practice to be avoided. 6. It is proper to overlap circles when the one being drawn incorporates at least one previously uncircled 1. 7. Identify cells containing ones that cannot be included in more than one circle draw such circles first. 8. Top and bottom rows and left and right columns are considered adjacent for the purposes of drawing circles around groups of adjacent ones.

Two circles of 4 and 1 circle of 2:

AB 00 01 11 10

CD 00 1 1 1 0

01 1 0 0 0

11 0 0 0 0

10 1 1 1 0

Two circles of 4 and 2 circles of 2:

AB 00 01 11 10

CD 00 1 1 1 0

01 1 0 0 0

11 0 0 1 1

10 1 1 1 0

4 circles, not 5! Always do the lone rangers (shaded cells) first; middle circle of 4 is unnecessary:

AB 00 01 11 10

CD 00 0 1 0 0

01 0 1 1 1

11 1 1 1 0

10 0 0 1 0

Most people lose the 4 corners because the bottom two are an optical illusion:

AB 00 01 11 10

CD 00 1 1 0 1

01 1 1 1 0

11 1 1 1 0

10 1 1 0 1

How Do You Write the Terms for Each Circle Drawn on a Karnaugh Map? Circles enable us to identify the most simplified version of a group of terms. Realize that every cell corresponds to a separate Boolean term. In a 4-variable map, a group of four circles originated with four separate 4-variable terms. It turns out that those four terms can be replaced by a single 2-variable term! That is quite a savings in logic components and complexity. In general, circles

containing a single 1 result in no simplification; circles containing two 1s will enable a single variable to be factored out; circles containing four 1s will permit two variables to be factored out; circles containing eight 1s will result in three variables being factored out; finally, a circle of sixteen ones eliminates all four variables in a 4-variable system resulting in an output equation of F = 1 which essentially says that the output is always on never mind why such a circuit might be of importance.

Circle Size 1 2 4 8 16

# Terms Eliminated 0 1 2 3 4

To write the term for any circle that has been drawn on the map, first examine the values of the variables for each 1 within the circle. The basic rule is this: If the value of a variable changes as we move from one 1 to the next, then that variable will not appear in the most simplified term. On the other hand, if the value of the variable remains constant for each 1 in the circle, then that variable appears in the most simplified term; and if the value of the variable equals 1, the variable is written in its true (or positive) form, while if the value of the variable is 0, then that variable is written in its inverted or false form. Lets look at several examples that were used in the previous lesson on circle drawing and apply the simplification rules to reduce the equations. First, lets examine the blue circle of two. Notice how the variables A, B, and C do not change when we move from the first cell to the second. Because of this, record each of them in their current form, which happens to be false. The variable D, however, changes from 0 in the first cell to 1 in the second. Because of this change, we omit this variable form our simplified equation. Next, lets look at the red circle of four. As we move from the first cell to the one below it, the variable A remains unchanged (0), but the variable B changes from 0

to 1. This allows us to omit it from the second simplified term below. Notice that the variable C changes from the 1st column to the 4th column, so well omit it from the simplified equation. The D variable, on the other hand, does not change, so well record D in its false form. The same logic should be used for the green circle of four as the red circle of four. Original Equation: ABCD ABCD ABCD ABCD ABCD ABC D ABC D F AB 00 01 11 10 CD 00 1 1 1 0 01 1 0 0 0 11 0 0 0 0 10 1 1 1 0

Simplified Equation: ABC AD BD F

Now, lets look at the next example as an additional circle of two is added to the Map. Notice how large the original equation grew! Each term equates to a 1, so with another circle of two added there are 2 additional terms in our original equation and 1 additional term added to our simplified equation.

Original Equation:
ABCD ABCD ABCD ABCD ABCD ABCD ABCD ABC D ABC D F

AB 00 01 11 10

CD 00 1 1 1 0

01 1 0 0 0

11 0 0 1 1

10 1 1 1 0

Simplified Equation: ABC AD ACD BD F

K-Maps for Sum of Products (SOP)


Consider the Canonical SOP expression F(X, Y, Z) = XYZ + XYZ + XYZ + XYZ. The first step in using K-Maps to simplify this expression is to use the SOP numbering to represent these as 0s and 1s. The negated variable is written as a 0, the plain as a 1. Thus, this function is represented as 011, 101, 110, and 111.

Place a 1 in each of the squares with the coordinates given in the list above. In the K-Map at left, the entry in the top row corresponds to 110 and the entries in the bottom row correspond to 011, 111, and 101 respectively. Remember that we do not write the 0s when we are simplifying expressions in SOP form.

The next step is to notice the physical adjacencies. We group adjacent 1s into rectangular groupings of 2, 4, or 8 boxes. Here there are no groupings of 4 boxes in the form or a rectangle, so we group by twos. There are three such groupings, labeled A, B, and C.

The

grouping

labeled

represents the product term XY. The B group represents the product term YZ and the C group represents the product term XZ. Examine the B

grouping: it has 011 and 111. In this we have Y and Z staying the same and X having both values; thus the product term YZ. This function is XY + XZ + YZ.

The next example is to simplify F(A, B, C) = (3, 5). We shall consider use of KMaps to simplify POS expressions, but for now the solution is to convert the expression to the SOP form F(A, B, C) = (0, 1, 2, 4, 6, 7). We could write each of the six product terms, but the easiest solution is to write the numbers as binary: 000, 001, 010, 100, 110, and 111.

The

top

row

of

the

K-Map

corresponds to the entries 000, 010,

100, and 110, arranged in the order 000, 010, 110, and 100 to preserver logical adjacency. The bottom row corresponds to the entries 001 and 111. The top row simplifies to C. The first column simplifies to AB and the third column to AB. Thus we have F (A, B, C) = AB + AB + C.

We next consider a somewhat offbeat example not in a canonical form. F (W, X, Y, Z) = WXYZ + WXYZ + WXY. The trouble with K-Maps is that the technique is designed to be used only with expressions in canonical form. In order to use the K-Map method we need to convert the term WXY to its equivalent WXYZ + WXYZ, thus obtaining a four-term canonical SOP. Before actually doing the K-Map, we first apply simple algebraic simplification to F. F(W, X, Y, Z) = WXYZ + WXYZ + WXY = WXY(Z + Z) + WXY = WXY + WXY = (W + W)XY = XY

Now that we see where we need to go with the tool, we draw the four-variable KMap.

F(W, X, Y, Z) = WXYZ + WXYZ + WXYZ + WXYZ. Using the SOP encoding method, these are terms 0000, 0001, 1000, and 1001. The K-Map is

The first row in the K-Map represents the entries 0000 and 1000. The second row in the K-Map represents the entries 0001 and 1001. The trick here is to see that the last column is adjacent to the first column. The four cells in the K-Map are thus adjacent and can be grouped into a square. We simplify by noting the values that are constant in the square: X = 0 and Y = 0. Thus, the expression simplifies to XY, as required.

We close the discussion of SOP K-Maps with the example at right, which shows that the four corners of the square are adjacent and can be grouped into a 2 by 2 square. This KMap represents the terms 0000, 0010, 1000, 1010 or WXYZ + WXYZ +

WXYZ + WXYZ. The values in the square that are constant are X = 0 and Z = 0, thus the expression simplifies to XZ.

K-Maps for POS K-Maps for Product of Sums simplification are constructed similarly to those for Sum of Products simplification, except that the POS copy rule must be enforced: 1 for a negated variable and 0 for a non-negated (plain) variable.

As our first example we consider F(A, B, C) = (3, 5) = (A + B + C)(A + B + C). Recall that the term (A + B + C) corresponds to 011 and that (A + B + C) to 101.

This is really somewhat of a trick question used only to illustrate placing of the terms for POS. Place a 0 at each location, rather than the 1 placed for SOP. Note that the two 0s placed are not adjacent, so we cannot simplify the expression.

For the next example consider F2 = (A + B + C)(A + B + C)(A + B + C)(A + B + C). Using the POS copy rule, we translate this to 000, 001, 010, and 100. Before we attempt to simplify F2, we note that it is a very good candidate for simplification. Compare the first term 000 to each of the following three terms. The term 000 differs from the term 001 in exactly one position. The same applies for comparison to the other two terms. Any two terms that differ in exactly one position can be combined in a simplification.

We begin the K-Map for POS simplification by placing a 0 in each of the four positions 000, 001, 010, 100. Noting that 000 is adjacent to 001, just below it, we combine to get 00 or

(A + B). The term 000 is adjacent to 010 to its right to get 00 or (A + C). The term 000 is adjacent to 100 to its left to get 00 or (B + C). As a result, we get the simplified form. F2 = (A + B)(A + C)(B + C)

Just for fun, we simplify this expression algebraically, using the derived Boolean identity XXX = X for any Boolean expression X. F2 = (A + B + C)(A + B + C)(A + B + C)(A + B + C) = (A + B + C)(A + B + C)(A + B + C)(A + B + C)(A + B + C)(A + B + C) = (A + B)(A + C)(B + C)

It is encouraging that we get the same answer.

Simplification with Dont-Care Conditions We now consider the use of K-Maps to simplify expressions that include the d or Dont-Care condition often generated when considering digital designs using flip-flops. We give a number of examples related to our previous designs of sequential circuits. X=0 Y1Y0 0 0 0 1 1 0 1 1 J1 0 1 d d X=1 J1 1 0 d d The general rule in considering a simplification with the Dont-Care conditions is to count the number of 0s and number of 1s in the table and to use SOP simplification when the number of 1s is greater and POS simplification when the number of 0s is greater. Again we admit that most students prefer the SOP simplification. With a twotwo split, we try SOP simplification.

Y1 0 0 0 0 1

Y0 0 0 1 1 0

X 0 1 0 1 0

J1 0 1 d d 1

First we should explain the above table in some detail. The first thing to say about it is that we shall see similar tables again when we study flip-flops. For the moment, we call it a folded over truth table, equivalent to the full truth table at right. The function to be represented is J1.

1 1 1

0 1 1

1 0 1

0 d d

Lines 0, 1, 4, and 5 of the truth table seem to be standard, but what of the other rows in which J1 has a value of d. This indicates that in these rows it is equally acceptable to have J1 = 0 or J1 = 1. We have four Dont-Cares or d in this table; each can be a 0 or 1 independently of the others in other words we are not setting the value of d as a variable.

Introduction The Quine-McCluskey method is an exact algorithm which finds a minimum-cost sum-of-products implementation of a Boolean function.

There are 4 main steps in the Quine-McCluskey algorithm: 1. Generate Prime Implicants 2. Construct Prime Implicant Table 3. Reduce Prime Implicant Table (a) Remove Essential Prime Implicants (b) Row Dominance (c) Column Dominance 4. Solve Prime Implicant Table In Step #1, the prime implicants of a function are generated using an iterative procedure. In Step #2, a prime implicant table is constructed. The columns of the table are the prime implicants of the function. The rows are minterms of where the function is 1, called ON-set minterms. The goal of the method is to cover all the rows using a minimum-cost cover of prime implicants. In particular, minimum-cost for this handout means to have fewest prime implicants (i.e. AND gates) in the final solution. However, the algorithm has been extended to consider more complex cost functions, such as minimizing the total number of gate inputs, power optimization, and so on. The reduction step (Step #3) is used to reduce the size of the table. This step has three sub-steps which are iterated until no further table reduction is possible. At this point, the reduced table is either (i) empty or (ii) non-empty. If the reduced table is empty, the removed essential prime implicants form a minimum-cost solution. However, if the reduced table is not empty, the table must be solved (Step #4). #1 is fairly straightforward, Examples #2 is more involved, and Example #3 applies the method to a function with dont-cares. But first, we motivate the need for column dominance and row dominance. 00 01 11 10 00

01 11 10 AB CD 11 11 11 0 0 00 0 00 0 00 Karnaugh map with set of prime implicants: illustrating "column dominance" essential essential Column Dominance Consider the following Karnaugh map of a 4-input Boolean function: There are 5 prime implicants, each of which covers 2 ON-set minterms. First, we note that two implicants are essential prime implicants: ACD and ACD. These implicants must be added to the final cover. There are 3 remaining prime implicants. We must pick a minimum subset of these to cover the uncovered ON-set minterms. Here is the prime implicant table for the Karnaugh map. The 5 prime implicants are listed as columns, and the 6 ON-set minterms are listed as rows. ACD ABC BCD ABD ACD (0,4) (4,5) (5,13) (13,15) (11,15) 0X 4XX 5XX 11 X

13 X X 15 X X We cross out columns ACD and ACD and mark them with asterisks, to indicate that these are essential. Each row intersected by one of these columns is also crossed out, because that minterm is now covered. At this point, prime implicant BCD covers 2 remaining ON-set minterms (5 and 13). However, prime implicant ABC covers only one of these (namely, 5), as does ABD (namely, 13). Therefore we can always use BCD instead of either ABC or ABD, since it covers the same minterms. That is, BCD column-dominates ABC, and BCD column-dominates ABD. The dominated prime implicants can be crossed out, and only column BCD remains. 2 00 01 11 10 00 01 11 10 AB CD 1 00 00 Karnaugh map with set of prime implicants: illustrating "row dominance" 0 1 1100 1 no essential prime implicants Row Dominance Consider the following Karnaugh map of a 4-input Boolean function:

There are 4 prime implicants: AB, CD, AD and AC. None of these is an essential prime implicant. We must pick a minimum subset of these to cover the 5 ON-set minterms. Here is the prime implicant table for the Karnaugh map. The 4 prime implicants are listed as columns, and the 5 ON-set minterms are listed as rows. AB CD AD AC (1,2,3) (1,5) (1,3,5,7) (2,3,7) 1XXX 2XX 3XXX 5XX 7XX Note that row 3 is contained in three columns: AB, AD, and AC. Row 2 is covered by two of these three columns: AB and AC, and row 7 is also covered by two of these three columns: AD and AC. In this case, any prime implicant which contains row 2 also contains row 3. Similarly, any prime implicant which contains row 7 also contains row 3. Therefore, we can ignore the covering of row 3: it will always be covered as long as we cover row 2 or row 7. To see this, note that row 3 row dominates row 2, and row 3 row dominates row 7. The situation is now the reverse of column dominance: we cross out the dominating (larger) row. In this case, row 3 can be crossed out; it no longer needs to be considered. Similarly, row 1 row dominates row 5. Therefore row 1 can be crossed out. We are guaranteed that row 1 will still be covered, since any prime implicant which covers row 5 will also cover row 1. 3 Example #1: F(A,B,C,D) = _m(0, 2, 5, 6, 7, 8, 10, 12, 13, 14, 15) The Notation. The above notation is a shorthand to describe the Karnaugh map for F. First, it indicates

that F is a Boolean function of 4 variables: A, B, C, and D. Second, each ON-set minterm of F is listed above, that is, minterms where the function is 1: 0, 2, 5, . . .. Each of these numbers corresponds to one entry (or square) in the Karnaugh map. For example, the decimal number 2 corresponds to the minterm ABCD = 0010, (0010 is the binary representation of 2). That is, ABCD = 0010 is an ON-set minterm of F; i.e., it is a 1 entry. All remaining minterms, not listed above, are assumed to be 0. Step 1: Generate Prime Implicants. Note: You should learn this basic method for generating prime implicants (Step #1), but I will not ask you to reproduce it. See Roth book on reserve for more details. (Instead, you will soon learn the more advanced fast recursive algorithm for prime generation.) List Minterms Column I 0 0000 2 0010 8 1000 5 0101 6 0110 10 1010 12 1100 7 0111 13 1101 14 1110 15 1111 Combine Pairs of Minterms from Column I A check () is written next to every minterm which can combined with another minterm. 4 Column I Column II 0 0000 (0,2) 00-0 2 0010 (0,8) -000 8 1000 (2,6) 0-10

5 0101 (2,10) -010 6 0110 (8,10) 10-0 10 1010 (8,12) 1-00 12 1100 (5,7) 01-1 7 0111 (5,13) -101 13 1101 (6,7) 01114 1110 (6,14) -110 15 1111 (10,14) 1-10 (12,13) 110(12,14) 11-0 (7,15) -111 (13,15) 11-1 (14,15) 111Combine Pairs of Products from Column II A check () is written next to every product which can combined with another product. Column I Column II Column III 0 0000 (0,2) 00-0 (0,2,8,10) -0-0 2 0010 (0,8) -000 (0,8,2,10) -0-0 8 1000 (2,6) 0-10 (2,6,10,14) 10 5 0101 (2,10) -010 (2,10,6,14) 10 6 0110 (8,10) 10-0 (8,10,12,14) 10 10 1010 (8,12) 1-00 (8,12,10,14) 10 12 1100 (5,7) 01-1 (5,7,13,15) -1-1 7 0111 (5,13) -101 (5,13,7,15) -1-1 13 1101 (6,7) 011- (6,7,14,15) -1114 1110 (6,14) -110 (6,14,7,15) -1115 1111 (10,14) 1-10 (12,13,14,15) 11 (12,13) 110- (12,14,13,15) 11 (12,14) 11-0 (7,15) -111 (13,15) 11-1 (14,15) 111- Column III contains a number of duplicate entries, e.g. (0,2,8,10) and (0,8,2,10). Duplicate entries appear because a product in Column III can be formed in several ways. For example, (0,2,8,10) is formed by combining

products (0,2) and (8,10) from Column II, and (0,8,2,10) (the same product) is formed by combining products (0,8) and (2,10). Duplicate entries should be crossed out. The remaining unchecked products cannot be combined with other products. These are the prime implicants: (0,2,8,10), (2,6,10,14), (5,7,13,15), (6,7,14,15), (8,10,12,14) and 5 (12,13,14,15); or, using the usual product notation: BD, CD, BD, BC, AD and AB. Step 2: Construct Prime Implicant Table. BD CD BD BC AD AB (0,2,8,10) (2,6,10,14) (5,7,13,15) (6,7,14,15) (8,10,12,14) (12,13,14,15) 0X 2XX 5X 6XX 7XX 8XX 10 X X X 12 X X 13 X X 14 X X X X 15 X X X Step 3: Reduce Prime Implicant Table. Iteration #1. (i) Remove Primary Essential Prime Implicants BD() CD BD() BC AD AB (0,2,8,10) (2,6,10,14) (5,7,13,15) (6,7,14,15) (8,10,12,14) (12,13,14,15) ()0 X 2XX ()5 X 6XX 7XX 8XX 10 X X X 12 X X 13 X X

14 X X X X 15 X X X * indicates an essential prime implicant indicates a distinguished row, i.e. a row covered by only 1 prime implicant In step #1, primary essential prime implicants are identified. These are implicants which will appear in any solution. A row which is covered by only 1 prime implicant is called a distinguished row. The prime implicant which covers it is an essential prime implicant. In this step, essential prime implicants are identified 6 and removed. The corresponding column is crossed out. Also, each row where the column contains an X is completely crossed out, since these minterms are now covered. These essential implicants will be added to the final solution. In this example, BD and BD are both primary essentials. (ii) Row Dominance The table is simplified by removing rows and columns which were crossed out in step (i). (Note: you do not need to do this, but it makes the table easier to read. Instead, you can continue to mark up the original table.) CD BC AD AB (2,6,10,14) (6,7,14,15) (8,10,12,14) (12,13,14,15) 6XX 12 X X 14 X X X X Row 14 dominates both row 6 and row 12. That is, row 14 has an X in every column where row 6 has an X (and, in fact, row 14 has Xs in other columns as well). Similarly, row 14 has in X in every column where row 12 has an X. Rows 6 and 12 are said to be dominated by row 14. A dominating row can always be eliminated. To see this, note that every product which covers row 6 also covers row 14. That is, if some product covers row 6, row 14 is guaranteed to be covered. Similarly, any

product which covers row 12 will also cover row 14. Therefore, row 14 can be crossed out. (iii) Column Dominance CD BC AD AB (2,6,10,14) (6,7,14,15) (8,10,12,14) (12,13,14,15) 6XX 12 X X Column CD dominates column BC. That is, column CD has an X in every row where column BC has an X. In fact, in this example, column BC also dominates column CD, so each is dominated by the other. (Such columns are said to co-dominate each other.) Similarly, columns AD and AB dominate each other, and each is dominated by the other. A dominated column can always be eliminated. To see this, note that every row covered by the dominated column is also covered by the dominating column. For example, CD covers every row which BC covers. Therefore, the dominating column can always replace the dominated column, so the dominated column is crossed out. In this example, CD and BC dominate each other, so either column can be crossed out (but not both). Similarly, AD and AB dominate each other, so either column can be crossed out. 7 Iteration #2. (i) Remove Secondary Essential Prime Implicants CD() AD() (2,6,10,14) (8,10,12,14) ()6 X ()12 X ** indicates a secondary essential prime implicant indicates a distinguished row In iteration #2 and beyond, secondary essential prime implicants are identified. These are implicants which will appear in any solution, given the choice of column-dominance used in the previous steps (if 2 columns

co-dominated each other in a previous step, the choice of which was deleted can affect what is an essential at this step). As before, a row which is covered by only 1 prime implicant is called a distinguished row. The prime implicant which covers it is a (secondary) essential prime implicant. Secondary essential prime implicants are identified and removed. The corresponding columns are crossed out. Also, each row where the column contains an X is completely crossed out, since these minterms are now covered. These essential implicants will be added to the final solution. In this example, both CD and AD are secondary essentials. Step 4: Solve Prime Implicant Table. No other rows remain to be covered, so no further steps are required. Therefore, the minimum-cost solution consists of the primary and secondary essential prime implicants BD, BD, CD and AD: F = BD + BD + CD + AD 8 Example #2: F(A,B,C,D) = _m(0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13) Step 1: Generate Prime Implicants. Use the method described in Example #1. Step 2: Construct Prime Implicant Table. AD BD CD AC BC AB BC AB AC 0XXX 2XXXX 3XX 4XXXX 5XX 6XXX 7XX 8XXXX 9XX 10 X X X 11 X X 12 X X X

13 X X Step 3: Reduce Prime Implicant Table. Iteration #1. (i) Remove Primary Essential Prime Implicants There are no primary essential prime implicants: each row is covered by at least two products. 9 (ii) Row Dominance AD BD CD AC BC AB BC AB AC 0XXX 2XXXX 3XX 4XXXX 5XX 6XXX 7XX 8XXXX 9XX 10 X X X 11 X X 12 X X X 13 X X There are many instances of row dominance. Row 2 dominates 3, 4 dominates 5, 6 dominates 7, 8 dominates 9, 10 dominates 11, 12 dominates 13. Dominating rows are removed. (iii) Column Dominance AD BD CD AC BC AB BC AB AC 0XXX 3XX 5XX 7XX 9XX 11 X X 13 X X Columns AD, BD and CD each dominate one another. We can remove any two of them. Iteration #2.

(i) Remove Secondary Essential Prime Implicants AD() AC BC AB BC AB AC ()0 X 3XX 5XX 7XX 9XX 11 X X 13 X X ** indicates a secondary essential prime implicant indicates a distinguished row Product AD is a secondary essential prime implicant; it is removed from the table. 10 (ii) Row Dominance No further row dominance is possible. (iii) Column Dominance No further column dominance is possible. Step 4: Solve Prime Implicant Table. AC BC AB BC AB AC 3XX 5XX 7XX 9XX 11 X X 13 X X There are no additional secondary essential prime implicants, and no further rowor column-dominance is possible. The remaining covering problem is called a cyclic covering problem. A solution can be obtained using one of two methods: (i) Petricks method or (ii) the branching method. We use Petricks method below; see Devadas et al. and Hachtel/Somenzi books for a discussion of the branching method. Petricks Method In Petricks method, a Boolean expression P is formed which describes all possible solutions of the table.

The prime implicants in the table are numbered in order, from 1 to 6: p1 = AC, p2 = BC, p3 = AB, p4 = BC, p5 = AB, p6 = AC. For each prime implicant pi, a Boolean variable Pi is used which is true whenever prime implicant pi is included in the solution. Note the difference!: pi is an implicant, while Pi is a corresponding Boolean proposition (i.e., true/false statement) which has a true (1) or false (0) value. Pi = 1 means I select prime implicant pi for inclusion in the cover, while Pi = 0 means I do not select prime implicant pi for inclusion in the cover. Using these Pi variables, a larger Boolean expression P can be formed, which captures the precise conditions for every row in the table to be covered. Each clause in P is a disjunction (OR) of several possible column selections to cover a particular row. The conjunction (AND) of all of these clauses is the Boolean expression P, which describes precisely the conditions to be satisfied for all rows are covered. For the above prime implicant table, the covering requirements can be captured by the Boolean equation: P = (P1 + P2)(P3 + P4)(P1 + P3)(P5 + P6)(P2 + P5)(P4 + P6) If Boolean variable P = 1, each of the disjunctive clauses is satisfied (1), and all rows are covered. In this case, the set of P i s which are 1 indicate a valid cover using the corresponding selection of primes p is 11 (columns). If P = 0, then at least one disjunctive clause is not satisfied (0), meaning that at least one row is not covered. In this case, the set of P i s which are 1 correspond to a set of selected primes pi which do not form a valid cover. Note that the above equation is simply a rewriting of the prime implicant table as a Boolean formula: the clauses correspond to the rows. In the right expression, the sum (P1 + P2) describes the covering requirement for row 3: product p1 or

p2 must be included in the solution, in order to cover row 3. Similarly, the sum (P3 + P4) describes the covering requirement for row 5: product p3 or p4 must be included to cover row 5. Each sum corresponds to a different row of the table. These sums are ANDed together, since all such requirements must be satisfied. Since P is a Boolean expression, it can be multiplied out into sum-of-products form: P = P1P4P5 + P1P3P5P6 + P2P3P4P5 + P2P3P5P6 +P1P2P4P6 + P1P2P3P6 + P2P3P4P6 + P2P3P6 Each product describes a solution for the table. Only two products have 3 Boolean variables; the remainder have 4 variables. These two products, P1P4P5 and P2P3P6, describe two minimal solutions. The first product describes a solution which includes prime implicants p1, p4 and p5; that is, AC, BC and AB. The second product describes a solution using prime implicants p2, p3 and p6; that is, BC, AB and AC. Both solutions have a minimal number of prime implicants, so either can be used. With either choice, we must include the secondary essential prime implicant, AD, identified earlier. Therefore, the two minimumcost solutions are: F = AD + AC + BC + AB F = AD + BC + AB + AC 12 Example #3: Dont-Cares (Roth example, pp. 163-4). F(A,B,C,D) = _m(2, 3, 7, 9, 11, 13) + _d(1, 10, 15) Step 1: Generate Prime Implicants. The dont-cares are included when generating prime implicants. Note: As indicated earlier, you should learn this basic method for generating prime implicants (Step #1), but I will not ask you to reproduce it. See Roth book on reserve for more details. (Instead, you will soon learn the more advanced fast recursive algorithm for prime generation.) List Minterms Column I

1 0001 2 0010 3 0011 9 1001 10 1010 7 0111 11 1011 13 1101 15 1111 Combine Pairs of Minterms from Column I A check () is written next to every minterm which can combined with another minterm. Column I Column II 1 0001 (1,3) 00-1 2 0010 (1,9) -001 3 0011 (2,3) 0019 1001 (2,10) -010 10 1010 (3,7) 0-11 7 0111 (3,11) -011 11 1011 (9,11) 10-1 13 1101 (9,13) 1-01 15 1111 (10,11) 101(7,15) -111 (11,15) 1-11 (13,15) 11-1 13 Combine Pairs of Products from Column II A check () is written next to every product which can combined with another product. Column I Column II Column III 1 0001 (1,3) 00-1 (1,3,9,11) -0-1 2 0010 (1,9) -001 (2,3,10,11) -013 0011 (2,3) 001- (3,7,11,15) 11 9 1001 (2,10) -010 (9,11,13,15) 11 10 1010 (3,7) 0-11 7 0111 (3,11) -011 11 1011 (9,11) 10-1

13 1101 (9,13) 1-01 15 1111 (10,11) 101- (7,15) -111 (11,15) 1-11 (13,15) 11-1 The unchecked products cannot be combined with other products. These are the prime implicants: (1,3,9,11), (2,3,10,11), (3,7,11,15) and (9,11,13,15); or, using the usual product notation: BD, BC, CD and AD. Step 2: Construct Prime Implicant Table. The dont-cares are omitted when constructing the prime implicant table, since they do not need to be covered. BD BC CD AD (1,3,9,11) (2,3,10,11) (3,7,11,15) (9,11,13,15) 2X 3XXX 7X 9XX 11 X X X X 13 X 14 Step 3: Reduce Prime Implicant Table. (i) Remove Essential Prime Implicants BD BC() CD() AD( ) (1,3,9,11) (2,3,10,11) (3,7,11,15) (9,11,13,15) 2X 3XXX ()7 X 9XX 11 X X X X ()13 X * indicates an essential prime implicant indicates a distinguished row Step 4: Solve Prime Implicant Table. The essential prime implicants cover all the rows, so no further steps are required. Therefore, the minimumcost

solution consists of the essential prime implicants BC, CD and AD: F = BC + CD + AD 15

You might also like