15
Sum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws 1. Converting ANDs and Ors to NANDs and NORs. Why? The circuits are easier to build! Note that these circuits are in my Logisim Circuits folder: DeMorgan'sLaws.circ. Link to the circuits, load the circuits, and test them with all four combinations of A and B. Converting an OR to a NAND: A' + B' => (AB)' Converting an AND to a NOR: A'B' => (A + B)' 2. Another application is negating compound conditions in a programming language. Note that ORs are usually easier to understand. NOT (A and B) NOT A OR NOT B NOT (A and B and C and D) NOT A OR NOT B OR NOT C OR NOT D NOT (A OR B) NOT A AND NOT B NOT (A OR B OR C OR D) NOT A AND NOT B AND NOT C AND NOT D NOT (A AND B OR C) NOT (A AND B) AND NOT C (NOT A OR NOT B) AND NOT C Note in the last example that A AND B is treated as a single term because ANDs have a higher priority than ORs. Sum of Products Consider the following digital network (function): A B C F(A, B, C) 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 0

Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

Sum of Products, Products of Sums, Normal FormApplication of DeMorgan's Laws1. Converting ANDs and Ors to NANDs and NORs. Why? The circuits are easier to build!

Note that these circuits are in my Logisim Circuits folder: DeMorgan'sLaws.circ. Link to the circuits, load the circuits, and test them with all four combinations of A and B.Converting an OR to a NAND: A' + B' => (AB)'Converting an AND to a NOR: A'B' => (A + B)'

2. Another application is negating compound conditions in a programming language. Note that ORs are usually easier to understand.

NOT (A and B) NOT A OR NOT BNOT (A and B and C and D) NOT A OR NOT B OR NOT C OR NOT DNOT (A OR B) NOT A AND NOT BNOT (A OR B OR C OR D) NOT A AND NOT B AND NOT C AND NOT DNOT (A AND B OR C) NOT (A AND B) AND NOT C (NOT A OR NOT B) AND NOT C

Note in the last example that A AND B is treated as a single term because ANDs have a higher priority than ORs.

Sum of ProductsConsider the following digital network (function):

A B C F(A, B, C)0 0 0 00 0 1 00 1 0 10 1 1 11 0 0 11 0 1 01 1 0 01 1 1 1

This can be converted into the following algebraic expression:F(A,B,C) = A'BC' + A'BC + AB'C' + ABC

Page 2: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

This form of an equation—a series of AND terms (products) connected into an OR (added) is referred to as a SUM OF PRODUCTS equation. This equation can easily be drawn. It is NOT necessarily the simplest circuit but it is the easiest to derive from the truth table.A Sum of Products equation in which each AND term contains ALL input variables is said to be in Normal Form (or canonical form) and each term is called a minterm.Minterm: an AND term that contains all input variables.A function equivalent to the previous one:

F(A, B, C) = A'B + AB'C' + BCTo convert it into normal form, multiply terms with missing variables by 1:

F(A, B, C) = (A'B)*1 + AB'C' + (1)BC(A'B)(C+C') + AB'C' + (A+A')BCA'BC + A'BC' + AB'C' + ABC + A'BC

Note that the first and last terms above are the same! So we can eliminate one of them.

Product of SumsEvery Sum of Products equation can also be represented as a Product of Sums.Consider our previous truth table again:

A B C F(A, B, C) Minterms

0 0 0 0 A'B'C' m00 0 1 0 A'B'C m10 1 0 1 A'BC' m20 1 1 1 A'BC m31 0 0 1 AB'C' m41 0 1 0 AB'C m51 1 0 0 ABC' m61 1 1 1 ABC m7

This function is: A'BC' + A'BC + AB'C' + ABC.What we are saying is that the function is 1 if m2 OR m3 OR m4 OR m7.Another way to look at the function is:

F= m2 OR m3 OR m4 OR m7

The complement of the function is (to get the complement, change all output 0s to 1s and all 1s to 0s):

F' = m0 + m1 + m5 + m6

Now take the complement of the complement (which is the original function!):

Page 3: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

F'' = (m0 + m1 + m5 + m6)'

Using DeMorgan's Law:F'' = F = m0' AND m1' AND m5' AND m6'

Substitute the original terms in for the minterms:F = (A'B'C')' * (A'B'C)' * (AB'C)' * (ABC')'

Use DeMorgan's law again:F = (A + B + C) (A + B + C') (A' + B + C') (A' + B' + C)

This (Product of Sums) can also be derived directly from the table by Looking at the zero minterms, Complementing each input variable, ORing them together. Then AND each of these terms together.

Another example

A B C F(A, B, C) Minterms

0 0 0 0 A'B'C' m00 0 1 1 A'B'C m10 1 0 1 A'BC' m20 1 1 0 A'BC m31 0 0 1 AB'C' m41 0 1 1 AB'C m51 1 0 0 ABC' m61 1 1 1 ABC m7

Sum of Products: A'B'C + A'BC' + AB'C' + AB'C + ABC

Product of Sums:(A + B + C) (A + B' + C') (A' + B' + C)

Page 4: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

Converting ANDS and ORS to NORS and NANDSIt is easy to write these functions as sums of products. However, our next lab assignment must be done using NAND gates only!How do you convert a SOP expression that feeds AND outputs to an OR gate into an expression that uses only NANDs?

Example

Function:A B F(A, B)

0 0 10 1 01 0 01 1 1

The sum of products for this is:A'B' + AB

Download this file (DigitalLogic-Day03-XNOR.circ) and load it into Logisim:

AND gates can easily be made into NANDs by complementing their outputs (add a bubble to each AND gate):

But they must be complemented again before getting to the OR gate (add another bubble to the inputs to the OR gate).

Page 5: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

We have not changed the function at all!So now what we have is this (looking only at the OR gate—disregard the two AND gates and call the inputs to the OR gate X' and Y'. The function that the OR gate represents is now:

X' + Y'

But, according to DeMorgan's Law, this is:X' + Y' = (XY)'

So we can get rid of the inverters coming into the OR gate (replace X' and Y' with X and Y), change the OR gate to an AND gate, and complement the result (which really means that we are replacing the OR gate with a NAND gate!):

So you can simply generate the sum of products circuit, and then change everything to NANDS!!!

Converting a Product of Sums to all NORsExample

Function:A B F(A, B)

0 0 10 1 01 0 01 1 1

Page 6: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

The product of sums for this is:(A + B')(A' + B)

And the circuit diagram is:

ORs can easily be converted into NORs by inverting their outputs:

But to keep the function from changing, we must invert them again:

We have not changed the function at all!So now what we have is this (looking only at the AND gate—disregard the two NOR gates and call the inputs to the AND gate X' and Y'). The function that the AND gate represents is now:

X'Y'

But, according to DeMorgan's Law, this is:X'Y' = (X + Y)'

So we can get rid of the inverters coming into the AND gate (replace X' and Y' with X and Y), change the AND gate to an OR gate, and complement the result (which really means that we are replacing the AND gate with a NOR gate!):

Page 7: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

So you can simply generate the product of sums circuit, and then change everything to NORS!!!

Page 8: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

Karnaugh mapsKarnaugh map: a graphic display of a truth table arranged so that adjacent terms differ by only one constant.A 2-variable truth table:

A B F(A,B)0 0 A'B'0 1 A'B1 0 AB'1 1 AB

The truth table rearranged as a 2-variable Karnaugh map:B

0 1A 0 A'B' A'B

1 AB' ABA Karnaugh map makes it easy to use factoring to simplify digital functions. To use a Karnaugh map to simplify an expression, look for rectangles whose sides are lengths that are powers of 2.The green is A, and the white is A'

B

0 1A 0 A'B' A'B

1 AB' AB

The green is B, and the white is B':B

0 1A 0 A'B' A'B

1 AB' AB

Page 9: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

Example

B0 1

A 0 1 11 0 0

This is A'B' + A'B, which is A'.

Example

B0 1

A 0 1 11 1 0

This is (A'B' + A'B + AB').Simplify:

1. A'(B'+B) + AB'2. A'(1) + AB'3. A' + AB'4. (A' + A)(A' + B') //distributive property

5. 1(A'+B')6. A' + B'

Note that I could have avoided the use of the distributive property if I had used the A'B' term twice (once for each circle that it was in). Like this:

A'B' + A'B + A'B' + AB'Note that combining pairs on a Karnaugh map is a graphic simplification of the following:

AB + AB' = A

Page 10: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

Three-variable Karnaugh mapsThis is a 3-variable Karnaugh map:

ABC 00 01 11 10

0 A'B'C' A'BC' ABC' AB'C'1 A'B'C A'BC ABC AB'C

A is the green; A' is the white:AB

C 00 01 11 100 A'B'C' A'BC' ABC' AB'C'1 A'B'C A'BC ABC AB'C

B is the green; B' is the white:AB

C 00 01 11 10

0 A'B'C' A'BC' ABC' AB'C'1 A'B'C A'BC ABC AB'C

C is the green; C' is the white:AB

C 00 01 11 100 A'B'C' A'BC' ABC' AB'C'1 A'B'C A'BC ABC AB'C

Example:

F(A,B,C) = A'B'C' + A'BC' + ABC' + AB'C'Here is the corresponding Karnaugh map:

ABC 00 01 11 10

0 1 1 1 11 0 0 0 0

This is the row where C is 0. Note that it doesn't matter what A and B are! The function is C'.

Example

F(A,B,C) = A'B'C' + A'B'C + AB'C' + AB'C

Page 11: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

AB

C 00 01 11 100 1 0 0 11 1 0 0 1

This is the columns where B is 0. Note that it doesn't matter what A and C are! The function is B'. Note also that the first column and the last column differ by 1 term (A is 0 in the first column and A is 1 in the last column) so they can "wrap around" and be considered adjacent to each other.

Example

F(A,B, C) = A'BC' + ABC' + ABCAB

C 00 01 11 100 0 1 1 01 0 0 1 0

Always circle the largest rectangles whose sides are powers of 2: 1, 2, or 4. You cannot circle a rectangle with a side whose length is 3!And, it is ok to circle a square more than once, as we have done above.

Four-variable Karnaugh mapsThis is a 4-variable Karnaugh map:

AB

CD 00 01 11 1000 A'B'C'D' A'BC'D' ABC'D' AB'C'D'01 A'B'C'D A'BC'D ABC'D AB'C'D11 A'B'CD A'BCD ABCD AB'CD10 A'B'CD' A'BCD' ABCD' AB'CD'

A is the green; A' is the white:AB

CD 00 01 11 10

00 A'B'C'D' A'BC'D' ABC'D' AB'C'D'01 A'B'C'D A'BC'D ABC'D AB'C'D11 A'B'CD A'BCD ABCD AB'CD10 A'B'CD' A'BCD' ABCD' AB'CD'

B is the green; B' is the white:

Page 12: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

AB

CD 00 01 11 1000 A'B'C'D' A'BC'D' ABC'D' AB'C'D'01 A'B'C'D A'BC'D ABC'D AB'C'D11 A'B'CD A'BCD ABCD AB'CD10 A'B'CD' A'BCD' ABCD' AB'CD'

C is the green; C' is the white:AB

CD 00 01 11 10

00 A'B'C'D' A'BC'D' ABC'D' AB'C'D'01 A'B'C'D A'BC'D ABC'D AB'C'D11 A'B'CD A'BCD ABCD AB'CD10 A'B'CD' A'BCD' ABCD' AB'CD'

Page 13: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

D is the green; D' is the white:AB

CD 00 01 11 10

00 A'B'C'D' A'BC'D' ABC'D' AB'C'D'01 A'B'C'D A'BC'D ABC'D AB'C'D11 A'B'CD A'BCD ABCD AB'CD10 A'B'CD' A'BCD' ABCD' AB'CD'

A Karnaugh map can be "wrapped" bottom to top and left to right.On a 4-variable map, we can combine pairs such as ABCD + ABCD' = ABC

Example

F(A, B, C, D) = ABC'D + AB'C'D + ABCD + AB'CDAB

CD 00 01 11 10

00 0 0 0 001 0 0 1 111 0 0 1 110 0 0 0 0

This is the columns where A is 1 (A) and the rows where D is 1 (D). So the function is: AD.

Example

F(A, B, C, D) = A'B'CD + A'BCD + ABCD + AB'CDAB

CD 00 01 11 1000 0 0 0 001 0 0 0 011 1 1 1 110 0 0 0 0

This is the row where C is 1 and D is 1. So the function is CD.

Page 14: Application of DeMorgan's Laws - Tom Kleentomkleen.com/CSCI280/Notes/09-SOP-and-POS.docx · Web viewSum of Products, Products of Sums, Normal Form Application of DeMorgan's Laws Converting

Example

F(A, B, C, D) = A'B'C'D' + A'BC'D' + ABC'D' + AB'C'D' + A'B'C'D + A'BC'DAB

CD 00 01 11 1000 1 1 1 101 1 1 0 011 0 0 0 010 0 0 0 0

The long rectangle is C'D' and the square is A'C'. So the function is A'C' + C'DHere's a fun one:F(A, B, C, D) = A'B'C'D' + A'BC'D' + ABC'D' + AB'C'D' + A'B'CD' + AB'CD'

ABCD 00 01 11 10

00 1 1 1 101 0 0 0 011 0 0 0 010 1 0 0 1

Since the top and bottom "wrap around" and the left and right "wrap around", the four corners can be a single "rectangle". Note that the four corners represent the intersection of the two columns where B is 0 and the two rows where D is 0. So that part of the function is B'D'. The other (easy) rectangle corresponds to the row where C is 0 and D is 0, so that part of the function is C'D'. The overall function can then be reduced to B'D' + C'D'Hand out and go over lab #4.