1 / 62

Lecture 4 Nand, Nor Gates, Circuit Minimization and Karnaugh Maps

CS147. Lecture 4 Nand, Nor Gates, Circuit Minimization and Karnaugh Maps. Prof. Sin-Min Lee Department of Computer Science. Boolean Algebra to Logic Gates. Logic circuits are built from components called logic gates. The logic gates correspond to Boolean operations +, *, ’.

Télécharger la présentation

Lecture 4 Nand, Nor Gates, Circuit Minimization and Karnaugh Maps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS147 Lecture 4Nand, Nor Gates, Circuit Minimization and Karnaugh Maps Prof. Sin-Min Lee Department of Computer Science

  2. Boolean Algebra to Logic Gates • Logic circuits are built from components called logic gates. • The logic gates correspond to Boolean operations +, *, ’. • Binary operations have two inputs, unary has one OR + AND * NOT ’

  3. A B Y C Logic Circuits ≡ Boolean Expressions A B C • All logic circuits are equivalent to Boolean expressions and any boolean expression can be rendered as a logic circuit. • AND-OR logic circuits are equivalent to sum-of-products form. • Consider the following circuits: A Y=AB*+B*C B ABC C AB*C Y A*B y=ABC+AB*C+A*B

  4. NAND and NOR Gates • NAND and NOR gates can greatly simplify circuit diagrams. As we will see, can you use these gates wherever you could use AND, OR, and NOT. NAND NOR

  5. XOR and XNOR Gates • XOR is used to choose between two mutually exclusive inputs. Unlike OR, XOR is true only when one input or the other is true, not both. XOR XNOR

  6. NAND and NOR as Universal Logic Gates • Any logic circuit can be built using only NAND gates, or only NOR gates. They are the only logic gate needed. • Here are the NAND equivalents:

  7. NAND and NOR as Universal Logic Gates (cont) • Here are the NOR equivalents: • NAND and NOR can be used to reduce the number of required gates in a circuit.

  8. Example Problem • A hall light is controlled by two light switches, one at each end. Find (a) a truth function, (b) a Boolean expression, and (c) a logic network that allows the light to be switched on or off by either switch. • Let x and y be the switches: (What kind of gate has this truth table?

  9. Example (cont) • One possible equation is the complete sum-of-products form: f(X,Y) = XY* + X*Y • Use The Most Complex Machine xLogicCircuit Module to implement the equation.

  10. C A Q B D How to use NAND gates to build an OR gate? Truth Table Hint 1 : Use 3 NAND gates Hint 2 : Use 2 NAND gates to build 2 NOT gates Hint 3 : Put the 3rd NAND gate after the 2 “NOT” gates

  11. How to use NAND gates to build a NOR gate? A C E Q D B Truth Table Hint 1 : Use 4 NAND gates Hint 2 : Use 3 NAND gates to build an OR gate Hint 3 : Use a NOR gate to build a NOT gate Hint 4 : Put the “NOT” gate after “OR” gate

  12. B A Q C Universal Gates How to use NOR gate to build a NOT gate? Truth Table Logic Gates Hint! Link inputs B & C together (to a same source). When A = 0, B = C = A = 0 When A = 1, B = C = A = 1

  13. Universal Gates How to use NOR gates to build an OR gate? Truth Table NOT NOR D A C Q B E Hint 1 : Use 2 NOR gates Hint 2 : From a NOR gate, build a NOT gate Hint 3 : Put this “NOT” gate after a NOR gate

  14. A C Q D B Universal Gates How to use NOR gates to build an AND gate? Truth Table Hint 1 : Use 3 NOR gates Hint 2 : From 2 NOR gates, build 2 NOT gates Hint 3 : Each “NOT” gate is an input to the 3rd NOR gate

  15. A C E Q D B Universal Gates How to use NOR gates to build a NAND gate? Truth Table Hint 1 : Use 4 NOR gates Hint 2 : Use 3 NOR gates to build a NAND gate (previous lesson) Hint 3 : Use the 4th NOR gate to build a NOT gate Hint 4 : Insert “NOT” gate after “NAND” gate Hint 5 : NOT-NAND = AND

  16. B Q A C Universal Gates How to use NAND gates to build a NOT gate? Truth Table Logic Gates Hint! Link inputs B & C together (to a same source). When A = 0, B = C = A = 0 When A = 1, B = C = A = 1

  17. Universal Gates How to use NAND gates to build an AND gate? Truth Table NOT NAND C A Q B Hint 1 : Use 2 NAND gates Logic Gates Hint 2 : From a NAND gate, build a NOT gate Hint 3 : Put this “NOT” gate after a NAND gate Hint 4 : NOT-NAND = AND

  18. C A Q B D Universal Gates How to use NAND gates to build an OR gate? Truth Table Hint 1 : Use 3 NAND gates Logic Gates Hint 2 : Use 2 NAND gates to build 2 NOT gates Hint 3 : Put the 3rd NAND gate after the 2 “NOT” gates

  19. A C E Q D B Universal Gates How to use NAND gates to build a NOR gate? Truth Table Hint 1 : Use 4 NAND gates Logic Gates Hint 2 : Use 3 NAND gates to build an OR gate Hint 3 : Use a NOR gate to build a NOT gate Hint 4 : Put the “NOT” gate after “OR” gate

  20. Since functions can be represented by a sum of product form • of minterms, any function can be shown in the map by • placing each a 1 in each square which represents a minterm • in the function. • EXAMPLE: Draw the map for f = X + Y • 1. Determine which minterms are needed by using truth table. • X Y f = X + Y minterm • 0 0 0 m0 • 0 1 1 m1 • 1 0 1 m2 • 1 1 1 m3

  21. 1 1 1 2. Draw the map and place a 1 in each square for required minterms. Y Y X 1 0 1 X f = X + Y = m1 + m2 + m3 = X´ Y + X Y´ + X Y

  22. Use the 2-Variable Karnaugh Map for Minimization Example: Given f (X,Y) =  (0, 2) Find: Simplified sum of products Y Y X m1 m0 m2 m3 X

  23. 2-Variable Karnaugh Map 1. Place the 1’s corresponding to the minterms on the map. f (X,Y) =  (0, 2) Y Y X 0 1 1 0 X

  24. 2-Variable Karnaugh Map 2. Now group the 1’s into columns or rows; in this case we can group them in the first column. f (X,Y) =  (0, 2) Y Y X 0 1 1 0 X 3. This column is Y´ so the simplified function f (X,Y) = Y´

  25. 2-Variable Karnaugh Map Example 2: Given f (X,Y) =  (0, 2, 3) Find: Simplified sum of products Y Y X m1 m0 m2 m3 X

  26. 2-Variable Karnaugh Map Example 3: Given f (X,Y) =  (0, 1) Find: Simplified sum of products Y Y X m1 m0 m2 m3 X

  27. Three Variable Map m0 m1 m3 m2 m4 m5 m7 m6 Y YZ X 0 0 0 1 1 1 10 X´ Y´ Z´ X´ Y´ Z X´ Y Z X´ YZ´ 0 1 X Y´ Z´ XY´Z X Y Z X Y Z´ X Z

  28. Three Variable Map There are 2N = 23 = 8 squares. The minterms are arranged so that only one variable changes from 0 to 1 or from 1 to 0 as you move from square to square in the vertical or horizontal direction. For any two adjacent squares, only one literal changes from complemented to non-complemented (normal). From this property the left and right ends of the map are “adjacent.”

  29. Y YZ X 0 0 0 1 1 1 10 X´Y´Z´ X´ Y´ Z X´ Y Z X´ Y Z´ 0 X 1 X Y´Z´ X Y´ Z X Y Z X YZ´ Z Using the distributive and complement properties, any two adjacent minterms can be combined and simplified to a single term with one less literal.

  30. Combining terms on the Karnaugh Map simplifies Boolean functions. Example: combine adjacent squares for X´ Y´ Z and XY´Z X´Y´ Z + XY´Z = Y´ Z ( X´ + X) = Y´ Z · 1 = Y´ Z Example: Combine adjacent squares for X Y´Z´ and X YZ´ XY´Z´ + X YZ´ = X Z´ ( Y´ + Y) = X Z´ · 1 = X Z´ Y YZ X 0 0 0 1 1 1 10 X´Y´Z´ X´ Y´ Z X´ Y Z X´ Y Z´ 0 X 1 X Y´Z´ X Y´ Z X Y Z X YZ´ Z

  31. Example: Simplify f = X´Y´ Z´ + X Y Z + X´Y´ Z + X´ Y Z Y YZ X 0 0 0 1 1 1 10 1 1 1 0 1 X 1 Z f = X´Y´ + Y Z

  32. Even if the function is not in its simplest form, we can still use the map to simplify it further. Example: Simplify f = X´ Y´ + Y´ Z + X´ Z + X Y Z Y YZ X 0 0 0 1 1 1 10 1 1 1 0 1 1 X 1 Z f = Z + X´ Y´ (by further grouping of minterms)

  33. 3-Variable Karnaugh Map Example: Given f (X,Y,Z) =  (0, 2, 3, 4, 7) Find: Simplified sum of products Y YZ X m1 m3 m2 m0 m6 m5 m7 m4 X Z

  34. 3-Variable Karnaugh Map Example: Given f (X,Y,Z) =  (0, 2, 3, 4, 7) Simplified sum of products: f = YZ + YZ + XY Y YZ X 0 1 1 1 0 0 1 1 X Z

  35. Truth Table f (X,Y,Z) =  (0, 2, 3, 4, 7) Simplified sum of products: f = Y´Z´ + YZ + X´Y The truth table for f: X Y Z f 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1

  36. f (X,Y,Z) =  (0, 2, 3, 4, 7) = Y´Z´ + YZ + X´Y Y Z f Y Z X Y

  37. 3-Variable Karnaugh Map Example 2: Given f (X,Y,Z) =  (2, 3, 4, 5) Find: Simplified sum of products Y YZ X m1 m3 m2 m0 m6 m5 m7 m4 X Z

  38. 3-Variable Karnaugh Map Example 2: Given f (X,Y,Z) =  (1, 2, 5, 6, 7) Find: Simplified sum of products Y YZ X m1 m3 m2 m0 m6 m5 m7 m4 X Z

  39. 3-Variable Karnaugh Map Example 3: Given f (X,Y,Z) = X´Z + X´Y + XY´Z + YZ Find: “Sum of minterms” expression Y YZ X m1 m3 m2 m0 m6 m5 m7 m4 X Z

  40. Exclusive OR XOR f = X´Y + XY´ = X  Y X Y f 0 0 0 0 1 1 1 0 1 1 1 0

  41. Exclusive OR f (X,Y) =  (1, 2) = X  Y Y Y X 1 0 0 1 X

  42. XOR Truth Table f (X,Y,Z) = X  Y  Z =  (1, 2, 4, 7) The truth table for f: X Y Z f 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1

  43. Exclusive OR X Y f (X,Y,Z) = X  Y  Z Z

  44. Wx´y´z Four Variable Map Y YZ WX 0 0 0 1 1 1 10 m0 m1 m3 m2 m4 m5 m7 m6 00 01 m12 m13 m15 m14 m8 m9 m11 m10 X 11 w x y´z W 10 Z

  45. Four Variable Map N = 4 variables 2N = 24 = 16 square (minterms) Row and column are numbered using a reflected-code sequence. The minterm number can be obtained by concatenation of the row and column number . Example: Row 4 = 10, Column 2 = 01 giving 1001 = 9 decimal for W X´ Y´ Z.

  46. 1 1 wx´y´z´ 1 1 wx´y´z Y YZ 0 0 0 1 1 1 10 wx´y´z´ w´x´y z´ 00 01 X 11 W 10 Z Notice that top and bottom edges and right and left edges are “adjacent.”

More Related