boolean algebra and logic gates - gimmenotes.co.za · section 3: basic rules of boolean algebra 5...

25
Basic Engineering Boolean Algebra and Logic Gates F Hamer, M Lavelle & D McMullan The aim of this document is to provide a short, self assessment programme for students who wish to understand the basic techniques of logic gates. c 2005 Email: chamer, mlavelle, [email protected] Last Revision Date: August 31, 2006 Version 1.0

Upload: others

Post on 18-Jun-2020

14 views

Category:

Documents


1 download

TRANSCRIPT

  • Basic Engineering

    Boolean Algebra and Logic Gates

    F Hamer, M Lavelle & D McMullan

    The aim of this document is to provide a short,self assessment programme for students who wishto understand the basic techniques of logic gates.

    c© 2005 Email: chamer, mlavelle, [email protected] Revision Date: August 31, 2006 Version 1.0

    http://www.plymouth.ac.uk/mathsmailto:protect �egingroup catcode ` active def { }catcode `%active let %%let %%catcode `#active def mailto:[email protected],mailto:[email protected], mailto:[email protected]:protect �egingroup catcode ` active def { }catcode `%active let %%let %%catcode `#active def

  • Table of Contents

    1. Logic Gates (Introduction)2. Truth Tables3. Basic Rules of Boolean Algebra4. Boolean Algebra5. Final Quiz

    Solutions to ExercisesSolutions to Quizzes

    The full range of these packages and some instructions,should they be required, can be obtained from our webpage Mathematics Support Materials.

    http://www.plymouth.ac.uk/mathaid

  • Section 1: Logic Gates (Introduction) 3

    1. Logic Gates (Introduction)The package Truth Tables and Boolean Algebra set out the basicprinciples of logic. Any Boolean algebra operation can be associatedwith an electronic circuit in which the inputs and outputs representthe statements of Boolean algebra. Although these circuits may becomplex, they may all be constructed from three basic devices. Theseare the AND gate, the OR gate and the NOT gate.

    x

    yx · y

    AND gate

    x

    yx + y

    OR gate

    x x′

    NOT gate

    In the case of logic gates, a different notation is used:x ∧ y, the logical AND operation, is replaced by x · y, or xy.x ∨ y, the logical OR operation, is replaced by x + y.¬x, the logical NEGATION operation, is replaced by x′ or x.

    The truth value TRUE is written as 1 (and corresponds to a highvoltage), and FALSE is written as 0 (low voltage).

  • Section 2: Truth Tables 4

    2. Truth Tables

    x

    yx · y

    x y x · y0 0 00 1 01 0 01 1 1

    Summary of AND gate

    x y x + y0 0 00 1 11 0 11 1 1

    Summary of OR gate

    x

    yx + y

    x x′

    x x′

    0 11 0

    Summary of NOT gate

  • Section 3: Basic Rules of Boolean Algebra 5

    3. Basic Rules of Boolean AlgebraThe basic rules for simplifying and combining logic gates are calledBoolean algebra in honour of George Boole (1815 – 1864) who was aself-educated English mathematician who developed many of the keyideas. The following set of exercises will allow you to rediscover thebasic rules:

    Example 1 x

    1

    Consider the AND gate where one of the inputs is 1. By using thetruth table, investigate the possible outputs and hence simplify theexpression x · 1.Solution From the truth table for AND, we see that if x is 1 then1 · 1 = 1, while if x is 0 then 0 · 1 = 0. This can be summarised in therule that x · 1 = x, i.e.,

    x

    1x

  • Section 3: Basic Rules of Boolean Algebra 6

    Example 2

    x

    0

    Consider the AND gate where one of the inputs is 0. By using thetruth table, investigate the possible outputs and hence simplify theexpression x · 0.

    Solution From the truth table for AND, we see that if x is 1 then1 · 0 = 0, while if x is 0 then 0 · 0 = 0. This can be summarised in therule that x · 0 = 0

    x

    00

  • Section 3: Basic Rules of Boolean Algebra 7

    Exercise 1. (Click on the green letters for the solutions.) Obtainthe rules for simplifying the logical expressions

    (a) x + 0 which corresponds to the logic gatex

    0

    (b) x + 1 which corresponds to the logic gatex

    1

    Exercise 2. (Click on the green letters for the solutions.) Obtainthe rules for simplifying the logical expressions:

    (a) x + x which corresponds to the logic gatex

    (b) x · x which corresponds to the logic gatex

  • Section 3: Basic Rules of Boolean Algebra 8

    Exercise 3. (Click on the green letters for the solutions.) Obtainthe rules for simplifying the logical expressions:

    (a) x + x′ which corresponds to the logic gatex

    (b) x · x′ which corresponds to the logic gatex

    Quiz Simplify the logical expression (x′)′ represented by the followingcircuit diagram.

    x

    (a) x (b) x′ (c) 1 (d) 0

  • Section 3: Basic Rules of Boolean Algebra 9

    Exercise 4. (Click on the green letters for the solutions.) Investi-gate the relationship between the following circuits. Summarise yourconclusions using Boolean expressions for the circuits.

    (a)x

    y

    x

    y

    (b)x

    y

    x

    y

    The important relations developed in the above exercise are called DeMorgan’s theorems and are widely used in simplifying circuits. Thesecorrespond to rules (8a) and (8b) in the table of Boolean identities onthe next page.

  • Section 4: Boolean Algebra 10

    4. Boolean Algebra

    (1a) x · y = y · x(1b) x + y = y + x(2a) x · (y · z) = (x · y) · z(2b) x + (y + z) = (x + y) + z(3a) x · (y + z) = (x · y) + (x · z)(3b) x + (y · z) = (x + y) · (x + z)(4a) x · x = x(4b) x + x = x(5a) x · (x + y) = x(5b) x + (x · y) = x(6a) x · x′ = 0(6b) x + x′ = 1(7) (x′)′ = x(8a) (x · y)′ = x′ + y′(8b) (x + y)′ = x′ · y′

  • Section 4: Boolean Algebra 11

    These rules are a direct translation into the notation of logic gatesof the rules derived in the package Truth Tables and BooleanAlgebra. We have seen that they can all be checked by investigatingthe corresponding truth tables. Alternatively, some of these rules canbe derived from simpler identities derived in this package.

    Example 3 Show how rule (5a) can be derived from the basic iden-tities derived earlier.

    Solutionx · (x + y) = x · x + x · y using (3a)

    = x + x · y using (4a)= x · (1 + y) using (3a)= x · 1 using Exercise 1= x as required.

    Exercise 5. (Click on the green letter for the solution.)(a) Show how rule (5b) can be derived in a similar fashion.

  • Section 4: Boolean Algebra 12

    The examples above have all involved at most two inputs. However,logic gates can be put together to join an arbitrary number of inputs.The Boolean algebra rules of the table are essential to understandwhen these circuits are equivalent and how they may be simplified.

    Example 4 Let us consider the circuits which combine three inputsvia AND gates. Two different ways of combining them are

    x

    y

    z

    (x · y) · z

    andx

    y

    z

    x · (y · z)

  • Section 4: Boolean Algebra 13

    However, rule (2a) states that these gates are equivalent. The orderof taking AND gates is not important. This is sometimes drawn as athree (or more!) input AND gate

    xyz

    x · y · z

    but really this just means repeated use of AND gates as shown above.

    Exercise 6. (Click on the green letter for the solution.)(a) Show two different ways of combining three inputs via OR gates

    and explain why they are equivalent.

    This equivalence is summarised as a three (or more!) input OR gate

    xyz

    x + y + z

    this just means repeated use of OR gates as shown in the exercise.

  • Section 5: Final Quiz 14

    5. Final Quiz

    Begin Quiz

    1. Select the Boolean expression that is not equivalent to x ·x+x ·x′(a) x · (x + x′) (b) (x + x′) · x (c) x′ (d) x

    2. Select the expression which is equivalent to x · y + x · y · z(a) x · y (b) x · z (c) y · z (d) x · y · z

    3. Select the expression which is equivalent to (x + y) · (x + y′)(a) y (b) y′ (c) x (d) x′

    4. Select the expression that is not equivalent to x · (x′ + y) + y(a) x · x′ + y · (1 + x) (b) 0 + x · y + y (c) x · y (d) y

    End Quiz

  • Solutions to Exercises 15

    Solutions to ExercisesExercise 1(a) From the truth table for OR, we see that if x is 1 then1 + 0 = 1, while if x is 0 then 0 + 0 = 0. This can be summarised inthe rule that x + 0 = x

    x

    0x

    Click on the green square to return �

  • Solutions to Exercises 16

    Exercise 1(b) From the truth table for OR we see that if x is 1 then1 + 1 = 1, while if x is 0 then 0 + 1 = 1. This can be summarised inthe rule that x + 1 = 1

    x

    11

    Click on the green square to return �

  • Solutions to Exercises 17

    Exercise 2(a) From the truth table for OR, we see that if x is 1 thenx + x = 1 + 1 = 1, while if x is 0 then x + x = 0 + 0 = 0. This can besummarised in the rule that x + x = x

    xx

    Click on the green square to return �

  • Solutions to Exercises 18

    Exercise 2(b) From the truth table for AND, we see that if x is 1then x · x = 1 · 1 = 1, while if x is 0 then x · x = 0 · 0 = 0. This canbe summarised in the rule that x · x = x

    xx

    Click on the green square to return �

  • Solutions to Exercises 19

    Exercise 3(a) From the truth table for OR, we see that if x is 1 thenx + x′ = 1 + 0 = 1, while if x is 0 then x + x′ = 0 + 1 = 1. This canbe summarised in the rule that x + x′ = 1

    x1

    Click on the green square to return �

  • Solutions to Exercises 20

    Exercise 3(b) From the truth table for AND, we see that if x is 1then x · x′ = 1 · 0 = 0, while if x is 0 then x · x′ = 0 · 1 = 0. This canbe summarised in the rule that x · x′ = 0

    x0

    Click on the green square to return �

  • Solutions to Exercises 21

    Exercise 4(a) The truth tables are:

    x

    y

    x y x + y (x + y)′

    0 0 0 10 1 1 01 0 1 01 1 1 0

    x

    y

    x y x′ y′ x′ · y′

    0 0 1 1 10 1 1 0 01 0 0 1 01 1 0 0 0

    From these we deduce the identity

    x

    y(x + y)′ =

    x

    yx′ · y′

    Click on the green square to return �

  • Solutions to Exercises 22

    Exercise 4(b) The truth tables are:

    x

    y

    x y x · y (x · y)′

    0 0 0 10 1 0 11 0 0 11 1 1 0

    x

    y

    x y x′ y′ x′ + y′

    0 0 1 1 10 1 1 0 11 0 0 1 11 1 0 0 0

    From these we deduce the identity

    x

    y(x · y)′ =

    x

    yx′ + y′

    Click on the green square to return �

  • Solutions to Exercises 23

    Exercise 5(a)

    x + x · y = x · (1 + y) using (3a)= x · 1 using Exercise 1= x as required.

  • Solutions to Exercises 24

    Exercise 6(a) Two different ways of combining them are

    x

    y

    z

    (x + y) + z

    andx

    y

    z

    x + (y + z)

    However, rule (2b) states that these gates are equivalent. The orderof taking OR gates is not important. �

  • Solutions to Quizzes 25

    Solutions to QuizzesSolution to Quiz: From the truth table for NOT we see that if xis 1 then (x′)′ = (1′)′ = (0)′ = 1, while if x is 0 then (x′)′ = (0′)′ =(1)′ = 0. This can be summarised in the rule that (x′)′ = x

    x x

    End Quiz

    Table of Contents1 Logic Gates (Introduction)2 Truth Tables3 Basic Rules of Boolean Algebra4 Boolean Algebra5 Final Quiz Solutions to Exercises Solutions to Quizzes