75
CHAPTER 2 Logic Circuits

1200 Chapter 2

Embed Size (px)

DESCRIPTION

micro

Citation preview

  • CHAPTER 2Logic Circuits

  • Chapter ObjectivesIn this chapter you will be introduced to:Logic functions and circuitsBoolean algebra for dealing with logic circuitsLogic gates and synthesis of simple circuitsCAD tools and the VHDL hardware description language

  • x 1 = x 0 = (a) Two states of a switchS x (b) Symbol for a switch Binary Switch

  • (a) Simple connection to a batteryS (b) Using a ground connection as the return pathBattery Light Power supplyS Light xxLight Controlled by a Switch

  • (a) The logical AND function (series connection)S Power supplyS S Power supplyS (b) The logical OR function (parallel connection) Light Light x1x2x1x2AND and OR Logic Functions

  • Series-Parallel Connection

  • Inverting Circuit

  • Truth Table for Two Input Variables

  • Truth Table for Three Input Variables

  • x 1 x 2 x 1 x 2 + x 1 x 2 x 1 x 2 (a) AND gate (b) OR gatex x (c) NOT gateThe Basic Gates

  • Inverter (NOT Circuit)Performs a basic logic function called inversion or complementationChanges one logic level (HIGH / LOW) to the opposite logic levelIn terms of bits, it changes a 1 to a 0 and vice versa

    INPUTOUTPUTAA0110

  • The AND GateComposed of two or more inputs and a single outputPerforms logical multiplication.The logical operation of the AND gate is such that the output is HIGH (1) when all the inputs are HIGH, otherwise it is LOW (0)

    INPUT

    OUTPUT

    A

    B

    A.B

    0

    0

    0

    0

    1

    0

    1

    0

    0

    1

    1

    1

  • The OR GateComposed of two or more inputs and a single outputPerforms logical additionThe logical operation of the OR gate is such that the output is HIGH (1) when any of the inputs are HIGH, otherwise it is LOW (0)

    INPUT

    OUTPUT

    A

    B

    A + B

    0

    0

    0

    0

    1

    1

    1

    0

    1

    1

    1

    1

  • X = AB + A

    INPUT

    OUTPUT

    A

    B

    X = AB + A

    0

    0

    0

    0

    1

    0

    1

    0

    1

    1

    1

    1

  • x 1 x 2 x 3 f x 1 x 2 + ( ) x 3 . = What is the Truth Table?

  • x 1 x 2 1 1 00 f 0 0 0 1 1 1 0 1 0 0 1 1 0 1 0 1 (a) Network that implementsf x 1 x 1 x 2 + = A B 1 0 1 0 1 0 1 0 1 0 x 1 x 2 A B f Time(c) Timing diagramLogic Network Example

  • Boolean AlgebraA mathematical system for formulating logical statements with symbols so that problems can be solved in a manner similar to ordinary algebra.Boolean algebra is the mathematics of digital systems.

  • Axioms of Boolean Algebra

    Multiplication Rules

    Addition Rules

    1a. 0 . 0 = 0

    1b. 1 + 1 = 1

    2a. 1 . 1 = 1

    2 b. 0 + 0 = 0

    3a. 0 . 1 = 1 . 0 = 0

    3b. 0 + 1 = 1 + 0= 1

    4a. If x=0, then x' = 1

    4a. If x=1, then x' = 0

  • Commutative Laws of Boolean AlgebraThe commutative law of addition for two variables is algebraically expressed as:x + y = y + xThe commutative law of multiplication for two variables is expressed as:xy = yxIn summary, the order in which the variables are ORed or ANDed make no difference.

  • Associative Laws of Boolean AlgebraThe associative law of addition of three variables is expressed as:x + (y + z) = (x + y) + zThe associative law of multiplication of three variables is expressed as:x(yz) = (xy)zIn summary, ORing or ANDing a grouping of variables produces the same result regardless of the grouping of the variables.

  • Distributive Law of Boolean AlgebraThe distributive law of three variables is expressed as follows:x (y+z) = xy + xzThis law states that ORing several variables and ANDing the result is equivalent of ANDing the single variable with each of the variables in the grouping, then ORing the result.

  • Single Variable Theorems

    Rule NumberBoolean Expression5 a.x * 0 = 0 5 b. x + 1 = 1 6 a.x * 1= x 6 b.x + 0 = x 7 a.x * x = x 7 b.x + x = x 8 a. x * x =0 8 b.x + x =1 9.(x) = x

  • DualityTo reflect the principle of duality, the axioms and single-variable theorems are listed in pairs.For example, see 5a and 3a. When x =0, by 5a, the result is 0.When x =1, by 5a, the result is 0, which is also proved by 3a.

  • Two- and Three-Variable Properties

    Property Boolean Expression10 a. Commutative10 b. Commutativex * y = y *x x + y = y + x 11 a. Associative11 b. Associativex * (y * z) = (x * y) * zx + (y + z) = (x + y) + z12 a. Distributive12 b. Distributivex * (y + z) = x * y + x * zx + (y * z) = (x + y) * (x + z)13 a. Absorption13 b. Absorption x + x * y = x x * ( x + y) = x

  • Two- and Three-Variable Properties

    Property Boolean Expression14 a. Combining14 b. Combiningx * y + x * y= x(x + y ) * ( x + y) = x15 a. DeMorgans Theorem15 b. DeMorgans Theorem(x * y)= (x+ y) (x + y)= x * y 16 a. 16 b. x + x * y = x + yx * (x + y) = x * y17 a. Consensus17 b. Consensus x * y + x * z + y * z = x * y + x * z(x + y ) * (x + z) * (y + z ) = (x + y) * (x+ z)

  • Boolean SimplificationExample 1:F = AB + CD + AB + CD = AB + CD (by identity 5)Example 2:F = ABC + ABC + AC = AB(C + C) + AC (by identity 13) = AB(1) + AC (by identity 7) = AB +AC (by identity 4)

  • Logic Circuit Implementation

  • DeMorgans Theorem(A B) = A + B(1)That is, the complement of the product is equivalent to the sum of the complements.This is true for any number of variables.(A B C Z) = A + B + C + + Z(A + B) = A B(2)Similarly, the complement of the sum is equivalent to the product of the complements.Similarly, (A + B + C + + Z) = A * B * C * * Z

  • Proof of DeMorgans Theorem

  • Methods to Complement a FunctionInterchange 1s and 0s for the values of F in the truth table.Use DeMorgans theorem on algebraic functionChange F to F, and F to FChange OR to ANDChange AND to ORComplement each individual variableExample 1:F = AB+ CD + BDApplying DeMorgans theorem,F = (A + B)(C + D)(B + D)

  • Methods to Complement a FunctionExample 2:Simplify F = (x1 + x3) . (x1+ x3)F = x1 x1+ x1 x3 + x3 x1+ x3 x3 (Distributive Property)x1 x1 and x3 x3 = 0 ( Identity 8)F = x1 x3 + x1 x3Example 3:F = xyz + xyz +xz= xy(z + z ) + xz (Factoring out)= xy .1 + xz ( By Identity 6)= xy + xz ( By Identity 4)

  • Practice ProblemsFind the complement: (xyz)Expand: x + yzSimplify:xy +xy + xyxy + xz + xy + yzwy + wyz + wxy + wxy

  • Venn Diagram Representationx x x (a) Constant 1(b) Constant 0(c) Variablex (d) x x

  • Venn Diagram Representationx y z x x y x y (e) (f) (g) (h) x y *x y + x y z + * x y * y

  • Verification of the Distributive Propertyx y z x y z x y z x y z x y z x y z x x y * x y * x + z * x y z + ( ) * (a) (d) (c) (f) x z * y z + (b) (e)

  • Verify xy + xz + yz = xy + xzx y z y x z x y z x y * y z * x z * x y z x y *

  • Boolean FunctionsExample 1:Prove: (A + B) (A + B) = AB + ABLHS = AA + AB + BA + BB (by distributive property)= O + AB + BA + O = AB + AB = RHSExample 2:Prove: AC + B C + AC + BC = AB + AB + ABLHS = A(C+C) + B(C+C) = A*1 + B*1 = A + BRHS = AB + AB + AB = AB + A(B + B) = A B + A = A + B (by identity 11)LHS = RHS

  • Precedence of OperationsNOT, AND, and then ORExample: A*B + A*B 1. Complements2. AND operations3. OR operation

  • f = m0 * 1 + m1 * 1 + m2 * 0 + m3 *1 Synthesis Using Gates

  • f (a) Canonical sum-of-products f (b) Minimal-cost realizationx 2 x 1 x 1 x 2 Two Implementations

  • Terms and DefinitionsSynthesisThe designing of a new system that implements a desired functional behavior.AnalysisThe task of determining the function performed by a system.

  • Terms and DefinitionsSum-of-Products (SOP)Product-of-Sums (POS)Canonical SOPCanonical POSMintermA product term with all n variables in asserted or negated form.MaxtermThe complement of a minterm

  • Three-Variable Minterms and Maxterms

  • A Three-Variable Function

  • A Three-Variable FunctionCanonical Sum-of-Productsf(x1, x2, x3) = x1x2x3 + x1x2x3 + x1x2x3 + x1x2x3= (m1, m4, m5, m6)= m(1, 4, 5, 6)Canonical Product-of-Sumsf(x1, x2, x3) = x1x2x3 + x1x2x3 + x1x2x3 + x1x2x3f(x1, x2, x3) = (x1+x2+x3)(x1+x2+x3)(x1+x2+x3)(x1+x2+x3)= (M0, M2, M3, M7)= M(0, 2, 3, 7)

  • Practice ProblemsShow that the minimal Sum-of-Products is:f(x1, x2, x3) = x2x3 + x1x3Show that the minimal Product of Sums is:f(x1, x2, x3) = (x1 + x3)(x2 + x3)

  • (b) A minimal product-of-sums realizationMinimal Realizations

  • More Practice ProblemsDetermine the canonical Sum-of-Products expressions for the following functions:f(x1, x2, x3) = m(2, 3, 4, 6, 7)f(x1, x2, x3, x4) = m(3, 7, 9, 12, 13, 14, 15)Now determine the minimized SOPs for these two functions.Find the canonical Product of Sums expression for:f(x1, x2, x) = M(0, 1, 5)

  • Four More Logic GatesNANDNORExclusive OR (XOR)Exclusive NOR (XNOR)

  • The NAND GateThe NAND, which is composed of two or more inputs and a single output, is a very popular logic element because it may be used as a universal function.It may be employed to construct an inverter, an AND gate, an OR gate, or any combination of these functions.The term NAND is formed by the concatenation NOT-AND and implies an AND function with an inverted output.The logical operation of the NAND gate is such that the output is LOW (0) only when all the inputs are HIGH (1).

    INPUT

    OUTPUT

    A

    B

    X = (AB)

    0

    0

    1

    0

    1

    1

    1

    0

    1

    1

    1

    0

  • The NOR gateThe NOR gate, which is composed of two or more inputs and a single output, also has a universal property.The term NOR is formed by the concatenation NOT-OR and implies an OR function with an inverted output.The logical operation of the NOR gate is such that the output is HIGH (1) only when all the inputs are LOW.

    INPUT

    OUTPUT

    A

    B

    (A + B)

    0

    0

    1

    0

    1

    0

    1

    0

    0

    1

    1

    0

  • The Exclusive-OR (XOR) and Exclusive NOR (XNOR) GatesThese gates are usually formed from the combination of the other logic gates already discussed.

    Because of their functional importance, these gates are treated as basic gates with their own unique symbols.

    The Exclusive-OR is an "inequality" function and the output is HIGH (1) when the inputs are not equal to each other.

    The Exclusive-NOR is an "equality" function and the output is HIGH (0) when the inputs are equal to each other.

    INPUT

    XOR OUTPUT

    XNOR OUTPUT

    A

    B

    A(B

    (A(B)

    0

    0

    0

    1

    0

    1

    1

    0

    1

    0

    1

    0

    1

    1

    0

    1

  • NAND and NOR Gates

  • DeMorgans Theorem in Terms of Logic Gates

  • Using NAND Gates to Implement a Sum-of-Products

  • Using NOR Gates to Implement a Product-of-Sums

  • x1 f (a) POS implementation(b) NOR implementationf x3 x2 x1 x3 x2 NOR Gate Realization of an Example Function

  • f f (a) SOP implementation(b) NAND implementation x1 x3 x2 x3 x2 x1 NAND Gate Realization of an Example Function

  • Truth Table for a Three-Way Light Control

  • SOP and POS Realizations

  • Implementation of a Multiplexer0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 (a) Truth table sx1x2f (s, x1, x2)f x 1 x 2 s (b) Circuit f s x 1 x 2 0 1 (c) Graphical symbol0 1 (d) Morecompact truth-table representationf (s, x1, x2)sx1x2

  • A Typical CAD SystemSee Figure 2.29, page 61, in your textbook.

  • fx3x1x2A Simple Logic Function

  • VHDLVHSIC Hardware Description LanguageVery High Speed Integrated CircuitEntity DeclarationDescribes PortsInputOutputArchitecture DeclarationDescribes Functions

  • ENTITY example1 IS PORT ( x1, x2, x3 : IN BIT ; f : OUT BIT ) ; END example1 ;

    VHDL Entity Declaration

  • ARCHITECTURE LogicFunc OF example1 IS BEGIN f

  • Complete VHDL Code for the Circuit

  • VHDL Code for a Four-Input Function

  • Logic Circuit for the VHDL Code

  • Example 2.10A circuit that controls a given digital system has three inputs: x1, x2, and x3.It has to recognize three different conditions:Condition A is true if x3 is true and either x1 is true or x2 is false.Condition B is true if x1 is true and either x2 or x3 is false.Condition C is true if x2 is true and either x1 is true or x3 is false.The control circuit must produce an output of 1 if at least two of the conditions A, B, and C are true.Design the simplest circuit that can be used for this purpose.

  • Solution to Example 2.10Using 1 for true and 0 for false, express the three conditions A, B, and C as:A = x3(x1 + x2) = x3x1 + x3x2B = x1(x2 + x3) = x1x2 + x1x3C = x2(x1 + x3) = x2x1 + x2x3The desired output can be expressed as:f(x1, x2, x3) = AB + AC + BC

  • Solution to Example 2.10Determine the product term AB:= (x3x1 + x3x2)(x1x2 + x1x3)= x3x1x1x2 + x3x1x1x3 + x3x2x1x2 + x3x2x1x3= x3x1x2 + O + x3x2x1 + O= x1x2x3Determine the product term AC = x1x2x3Determine the product term BC = x1x2x3

  • Solution to Example 2.10f(x1, x2, x3 ) = AB + AC + BC= x1x2x3 + x1x2x3 + x1x2x3= x1(x2 + x2)x3 + x1x2(x3 + x3)= x1x3 + x1x2=x1(x3 + x2)

  • Example 2.11Solve Example 2.10 using Venn Diagrams

  • (a) FunctionA (b) FunctionB (c) FunctionC (d) Functionf x1 x3 x2 x1 x2 x1 x2 x1 x2 x3 x3 x3 Solution to Example 2.11

    ***************************************************************************