Truth Tables Logic Expressions Digital Electronics Truth Table
Truth Tables & Logic Expressions Digital Electronics
Truth Table & Logic Expressions This presentation will demonstrate how to: • Properly construct a truth table. • Write a Sum-Of-Products (SOP) logic expression from a truth table. EQUALS Design Specifications X Y OUT 0 0 1 0 1 1 1 0 Truth Table EQUALS Logic Expression 2
Truth Table & Logic Expressions This presentation will demonstrate how to… • Create a truth table given a SOP logic expression. • Create a truth table from a set of design specifications (i. e. , word problem). EQUALS Design Specifications X Y OUT 0 0 1 0 1 1 1 0 Truth Table EQUALS Logic Expression 3
Constructing a Truth Table • A truth table shows how a logic design’s output responds to ALL combinations of possible inputs. • A logic design with N inputs will have 2 N input combinations. Example: A design with 4 inputs will have ? (or ? ) input combination possibilities! 4
Constructing a Truth Table • A truth table shows how a logic design’s output responds to ALL combinations of possible inputs. • A logic design with N inputs will have 2 N input combinations. Example: A design with 4 inputs will have 24 (or 16) input combination possibilities! 5
Constructing A Truth Table The input are listed in binary order (i. e. , counting order) in the columns to the left. The output(s) are listed in the column(s) to the right. (Note some logic circuits can have more than one output. ) 6
Creating a Truth Table Starting with the input on the right, fill in alternate 0’s and 1’s. Do NOT fill in the output column! Truth Table A B C Output 0 1 0 1 7
Creating a Truth Table Moving to the left, repeat this process, but this time alternate with two 0’s and two 1’s! Truth Table A B C 0 0 0 1 1 Output 8
Creating a Truth Table For the third - and last input – alternate with four 0’s and four 1’s! Truth Table A B C 0 0 0 1 1 1 0 0 1 1 1 Output 9
Constructing A Truth Table Inputs Output Input Combinations 3 – Inputs 8 – Combinations (8 = 23) X Y Z F 1 0 0 0 1 1 0 0 1 1 1 1 0 Outputs for Each Input Combination 10
Constructing A Truth Table Based on the number of inputs, we can determine how many input combinations are possible: # of INPUTS # of INPUT COMBINATIONS 1 1 2 4 3 8 4 16 5 32 11
Constructing A Truth Table Inputs Output Input Combinations 3 – Inputs 8 – Combinations (8 = 23) 0002 = 010 X Y Z F 1 0 0 0 1 1 0 0 1 1 1 1 0 Outputs for Each Input Combination 0012 = 110 0102 = 210 0112 = 310 1002 = 410 1012 = 510 1102 = 610 1112 = 710 Truth tables start at “ 0” in base 10 and count up in order from there! 12
Sample Truth Tables 2 Inputs 3 Inputs 4 Inputs 22 = 4 Combinations 23 = 8 Combinations 24 = 16 Combinations A 0 0 1 1 B 0 1 F 2 0 0 0 1 X Y Z F 3 0 0 0 1 1 0 0 0 1 1 1 1 0 0 1 1 1 0 R S T U F 4 0 0 0 0 1 1 1 0 0 1 0 1 0 0 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 13
Logic Expression From Truth Table • Write the Minterm adjacent to every row in the truth table that contains a one in the output column. • Write the Sum-Of-Products (SOP) logic expression by summing together all of the Minterms. 14
Logic Expression From Truth Table Example Write the SOP logic expression for the output F 5 in the truth table below. X Y Z F 5 0 0 0 1 1 0 0 1 1 1 1 0 Minterms 15
Logic Expression From Truth Table Example Write the SOP logic expression for the output F 5 in the truth table below. X Y Z F 5 0 0 0 1 1 0 0 1 1 1 1 0 SOP Logic Expression Minterms 16
Example #1: T/T→Logic Expression Example: Write the SOP logic expression for the output F 6 in the truth table below. A B C D F 6 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 17
Example #1: T/T→Logic Expression Example: Write the SOP logic expression for the output F 6 in the truth table below. A B C D F 6 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 Step 1: For all “ 1” outputs, write out the minterm for the corresponding outputs. 18
Example #1: T/T→Logic Expression Example: Write the SOP logic expression for the output F 6 in the truth table below. A B C D F 6 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 Step 2: Using the minterms from step 1, write out the SOP logic expression. 19
Example #1: T/T→Logic Expression Example: Write the SOP logic expression for the output F 6 in the truth table below. A B C D F 6 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 20
Example #1: T/T→Logic Expression Example: Write the SOP logic expression for the output F 6 in the truth table below. A B C D F 6 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 21
Example #1: T/T→Logic Expression Example: Write the SOP logic expression for the output F 6 in the truth table below. A B C D F 6 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 SOP Logic Expression 22
Truth Table From Logic Expression • For each term in the logic expression, place a one in the output column for the input condition that matches the term. • Some terms may match more than one input condition! 23
Truth Table From Logic Expression Example: Create the truth table for the following logic expression: 24
Truth Table From Logic Expression X Y Z 0 0 0 1 1 1 0 0 1 1 1 F 7 Create truth table 25
Truth Table From Logic Expression X Y Z 0 0 0 1 1 1 0 0 1 1 1 F 7 26
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 1 0 0 1 1 1 0 1 1 1 27
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 1 1 0 0 1 1 1 28
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 0 1 1 1 29
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 0 1 1 1 30
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 0 1 1 1 31
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 32
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 1 0 0 1 1 1 33
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 1 0 0 1 1 34
Truth Table From Logic Expression X Y Z F 7 0 0 0 1 0 0 0 1 1 1 1 0 0 1 1 35
Example #2: Logic Expression→T/T Example: Create a truth table for the following SOP logic expression: 36
Example #2: Logic Expression→T/T A B C D 0 0 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 F 8 Create truth table 37
Example #2: Logic Expression→T/T A B C D 0 0 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 F 8 38
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 39
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 40
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 41
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 42
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 43
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 44
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 45
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 46
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 47
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 48
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 1 1 49
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 50
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 51
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 52
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 53
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 0 54
Example #2: Logic Expression→T/T A B C D F 8 0 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 0 55
Truth Table from Design Specs • Identify the number of input variables. • Assign variable names and establish the assignment condition for each variable… (what does a 0 or 1 mean for that input? ). • Create a truth table. 56
Truth Table from Design Specs Example: A large fuel tank has sensors that monitor temperature and pressure. Both sensors output a logic LOW if they are within the safety range. An alarm will sound if either sensor indicates an unsafe condition is present. Create a truth table for this logic design. 57
Truth Table from Design Specs Assign Parameters: Inputs: • P: Pressure Sensor → 0=Safe / 1=Unsafe • T: Temperature Sensor → 0=Safe / 1=Unsafe Outputs: • A: Alarm → 0=Alarm Off / 1=Alarm On 58
Truth Table from Design Specs Assignments: • Input P: Pressure Sensor → 0=Safe / 1=Unsafe • Input T: Temperature Sensor → 0=Safe / 1=Unsafe • Output A: Alarm → 0=Alarm Off / 1=Alarm On P T 0 0 0 1 1 A Create truth table 59
Truth Table from Design Specs Assignments: • Input P: Pressure Sensor → 0=Safe / 1=Unsafe • Input T: Temperature Sensor → 0=Safe / 1=Unsafe • Output A: Alarm → 0=Alarm Off / 1=Alarm On P T 0 0 0 1 1 A 60
Truth Table from Design Specs Assignments: • Input P: Pressure Sensor → 0=Safe / 1=Unsafe • Input T: Temperature Sensor → 0=Safe / 1=Unsafe • Output A: Alarm → 0=Alarm Off / 1=Alarm On P T A 0 0 1 1 61
Truth Table from Design Specs Assignments: • Input P: Pressure Sensor → 0=Safe / 1=Unsafe • Input T: Temperature Sensor → 0=Safe / 1=Unsafe • Output A: Alarm → 0=Alarm Off / 1=Alarm On P T A 0 0 1 1 1 0 1 1 62
Truth Table from Design Specs Assignments: • Input P: Pressure Sensor → 0=Safe / 1=Unsafe • Input T: Temperature Sensor → 0=Safe / 1=Unsafe • Output A: Alarm → 0=Alarm Off / 1=Alarm On P T A 0 0 1 1 1 63
Truth Table from Design Specs Assignments: • Input P: Pressure Sensor → 0=Safe / 1=Unsafe • Input T: Temperature Sensor → 0=Safe / 1=Unsafe • Output A: Alarm → 0=Alarm Off / 1=Alarm On P T A 0 0 1 1 1 0 1 1 64
Truth Table from Design Specs P T A 0 0 1 1 1 0 1 1 What logic gate has a truth table identical to this table? 65
Truth Table from Design Specs P T A 0 0 1 1 1 0 1 1 What logic gate has a truth table identical to this table? An OR gate! 66
Example #3: Design Spec →T/T Example: Your teacher keeps her final exams in her office. For security reasons, she would like you to design an alarm system for her office. The office has a window and door that are equipped with sensors that output a one when they are closed. When the alarm system is turned on with a key, the siren should sound if either the window or door is opened. 67
Example #3: Design Spec →T/T What are the inputs and what is the output? 68
Example #3: Design Spec →T/T What are the inputs and what is the output? Inputs: 69
Example #3: Design Spec →T/T What are the inputs and what is the output? Inputs: Key Door Window 70
Example #3: Design Spec →T/T What are the inputs and what is the output? Inputs: Key Door Window Output: 71
Example #3: Design Spec →T/T What are the inputs and what is the output? Inputs: Key Door Window Output: Alarm/Siren 72
Example #3: Truth Table Solution Assign Parameters: • K : Key → 0=System Off / 1=System On • D : Door Sensor → 0=Open / 1=Closed • W : Window Sensor → 0=Open / 1=Closed • S : Siren/Alarm → 1=On / 0=Off 73
Example #3: Truth Table Create Truth Table S • K : Key → 0=System Off / 1=System On K D W 0 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 74
Example #3: Truth Table Create Truth Table S • K : Key → 0=System Off / 1=System On K D W 0 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 75
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 1 1 0 0 1 1 1 • W : Window Sensor → 0=Open / 1=Closed • S : Siren/Alarm → 1=On / 0=Off 76
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 77
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 0 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 78
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 0 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 79
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 0 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 80
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 0 1 1 1 1 0 1 1 1 • S : Siren/Alarm → 1=On / 0=Off 81
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 0 1 1 1 1 0 1 1 • S : Siren/Alarm → 1=On / 0=Off 82
Example #3: Truth Table Create Truth Table K D W S • K : Key → 0=System Off / 1=System On 0 0 • D : Door Sensor → 0=Open / 1=Closed 0 0 1 0 • W : Window Sensor → 0=Open / 1=Closed 0 1 0 0 0 1 1 1 1 0 • S : Siren/Alarm → 1=On / 0=Off 83
The End! 84
- Slides: 84