1
play

1 Problem: Problem: 7-Segment LED Display 7-Segment LED Display - PDF document

snick Outline snack Learning Goals Problems and Discussion CPSC 121: Models of Computation Side note: numbers from Booleans 2016W2 Expressiveness of Propositional Logic Propositional Logic, Continued Next Lecture Notes


  1. snick  Outline snack • Learning Goals • Problems and Discussion CPSC 121: Models of Computation – Side note: numbers from Booleans 2016W2 • Expressiveness of Propositional Logic Propositional Logic, Continued • Next Lecture Notes Steve Wolfman, based on notes by Patrice Belleville and others 1 2 This work is licensed under a Creative Commons Attribution 3.0 Unported License. Where We Are in Learning Goals: In-Class The Big Stories By the end of this unit, you should be able Theory Hardware to: How do we model How do we build devices to computational systems? compute? – Build combinational computational systems using propositional logic expressions and Now : learning the Now : establishing equivalent digital logic circuits that solve real underpinnings of all our our baseline tool problems, e.g., our 7- or 4-segment LED models (formal logical (gates), briefly displays (using a “DNF” or any other reasoning with Boolean justifying these as successful approach). values). baselines, and designing complex functions from gates. 3 4 Problem: Outline 7-Segment LED Display • Learning Goals Problem : Design a circuit that displays the • Problems and Discussion numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. – Side note: numbers from Booleans • Expressiveness of Propositional Logic • Next Lecture Notes 5 6 1

  2. Problem: Problem: 7-Segment LED Display 7-Segment LED Display Problem : Design a circuit that displays the Problem : Design a circuit that displays the numbers 0 through 9 using seven LEDs numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. (lights) in the shape illustrated above. First: what’s the circuit’s job? Understanding the story: How many inputs to our circuit are there? a. One b. Seven c. Ten d. Sixteen e. None of these 7 8 Problem: 7-Segment LED Display Problem: 7-Segment LED Display “Input Symbols ” “Input Lines ” Problem : Design a circuit that displays the Problem : Design a circuit that displays the numbers 0 through 9 using seven LEDs numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. (lights) in the shape illustrated above. How many different messages (values) must the circuit How many different wires carry those messages? understand? a. One a. One b. Seven b. Seven c. Ten c. Ten d. Sixteen d. Sixteen e. None of these e. None of these A bit like a parameter like in CPSC 110, 9 10 but we only get 1/0 parameters (Booleans). Side Note: Representing Positive Integers Truth Tables and Numbers This is the convention we use for the positive integers If we agree on a convention for the rows of a 0-9, which requires (at least) 4 variables: truth table, we can assign a number to # a b c d each row… # a b c 0 F F F F 0 F F F 1 F F F T 1 F F T 2 F F T F 2 F T F 3 F F T T 3 F T T 4 F T F F 4 T F F 5 F T F T 5 T F T 6 F T T F 6 T T F 7 F T T T 8 T F F F 7 T T T 9 T F F T Of course, as Epp says, we could 11 12 ... Notice the order: Fs first. agree on a different convention. 2

  3. Problem: Exercise: 7-Segment LED Display Human Circuit Let’s simulate the display with people. Problem : Design a circuit that displays the numbers 0 through 9 using seven LEDs (lights) in the shape illustrated above. If you’re not at the front, pick one person and Understanding the story: think about what their How many outputs from our circuit are there? algorithm is. a. One b. Seven c. Ten d. Sixteen BEFORE we answer it: e. None of these 13 14 Is that a good question? Exercise: Analyzing One Segment Human Circuit Which other people’s algorithms does your What’s the truth table for the lower -left segment? person need to know about? a. b. c. d. e. None of these. a. No one else’s out out out out # a b c d F 0 T F 0 F F F F b. Only their neighbours’ 1 F F F T T 2 F T 2 F F T F c. Everyone else’s F 6 T F 3 F F T T T 8 F T d. Some other group 4 F T F F F F T 5 F T F T T F T 6 F T T F F T F 7 F T T T T F T 8 T F F F F T F 15 16 9 T F F T T F T Analyzing One Segment Analyzing One Segment From the truth table, we can make an expression From the truth table, we can make an expression for each true row and OR them together. for each true row and OR them together. # a b c d out # a b c d out Which logical statement is true 0 F F F F T 0 F F F F T only in this row? 1 F F F T F 1 F F F T F 2 F F T F T 2 F F T F T a. ~a  ~b  c  ~d (??)  3 F F T T F 3 F F T T F b. a  b  c  d Let’s try one! (??)  4 F T F F F 4 F T F F F c. ~a  ~b  c  ~d (??)  5 F T F T F 5 F T F T F d. a  b  ~c  d (??) 6 F T T F T 6 F T T F T e. None of these 7 F T T T F 7 F T T T F See Epp (4 th ed) Example 2.4.5! 8 T F F F T 8 T F F F T 17 18 9 T F F T F (3 rd ed Example 1.4.5) 9 T F F T F 3

  4. Designing the Expression Analyzing One Segment with Many Ts Let’s try another LED: the upper -right. From the truth table, we can make an expression for each true row and OR them together. With eight Ts, we’d need eight expressions! # a b c d out # a b c d out 0 F F F F T 0 F F F F T Too bad we can’t 1 F F F T F 1 F F F T T 2 F F T F T 2 F F T F T model Fs rather (~ a  ~ b  ~ c  ~ d )  3 F F T T F 3 F F T T T (~ a  ~ b  c  ~ d )  than Ts! 4 F T F F F 4 F T F F T (~ a  b  c  ~ d )  5 F T F T F 5 F T F T F ( a  ~ b  ~ c  ~ d ) 6 F T T F T 6 F T T F F 7 F T T T F 7 F T T T T 8 T F F F T 8 T F F F T 19 20 9 T F F T F 9 T F F T T Designing the Expression Problem: with Many Ts 7-Segment LED Display Problem : Design the seven LED display circuit. We can by negating statement we construct! (Instead of building out , we build ~out and Approach : Solve each of the seven outputs then negate it.) # a b c d out separately and put the whole thing together. 0 F F F F T Which of these correctly models the LED? 1 F F F T T 2 F F T F T ~(~a  b  ~c  d)  ~(~a  b  c  ~d) a. Here’s the two LEDs we’ve solved, simplified: 3 F F T T T ~(a  ~b  c  ~d)  ~(a  ~b  ~c  d) b. 4 F T F F T ~[(~a  b  ~c  d)  (~a  b  c  ~d)] c. 5 F T F T F ~[(a  ~b  c  ~d)  (a  ~b  ~c  d)] d. 6 F T T F F e. None of these 7 F T T T T 8 T F F F T 21 22 9 T F F T T PRACTICE Exercise PRACTICE Exercise for NEXT UNIT (logical equiv) for Circuit Design Prove that our solution for the upper-right LED is Finish the problem! logically equivalent to the corresponding circuit on the previous slide. Prove that our solution for the lower-left LED is not logically equivalent to the corresponding circuit on the previous slide, and explain why not. Note: to disprove a logical equivalence, you must give truth values for the inputs that yield different outputs. 23 24 4

  5. Concept Q: 7-Segment LED Outline Imagine we were solving for an LED in a display for • Prereqs, Learning Goals, and Quiz Notes “ Brahmi ” numerals. Which of these is most likely • Problems and Discussion to make our problem easier ? a. More entries in that LED’s column of the truth – Side note: numbers from Booleans table that are true (turn some Fs into Ts). • Expressiveness of Propositional Logic b. Fewer entries in that LED’s column of the truth • Next Lecture Notes table that are true (turn some Ts into Fs). c. More legal input symbols (e.g., 0-15 instead of 0-9). d. Fewer legal input symbols (e.g., 0-4 instead of 0-9). e. None of these will make the problem easier . 25 26 Expressiveness of Propositional Logic Expressiveness of Propositional Logic Problem : Is propositional logic (and Problem : Is propositional logic universal for combinational circuits) universal for Boolean functions? Boolean functions — able to implement a truth table with any number of columns Yes! We’ve already given an algorithm to and list of T and F in the output? turn any truth table into a corresponding a b c d out propositional logic statement. Universality ? F F F F F is a pretty cool result for our very first F F F T T F F T F T model! F F T T F F T F F T ... 27 28 Outline Learning Goals: In-Class • Prereqs, Learning Goals, and Quiz Notes By the end of this unit, you should be able • Problems and Discussion to: – Build combinational computational systems – Side note: numbers from Booleans using propositional logic expressions and • Expressiveness of Propositional Logic equivalent digital logic circuits that solve real • Next Lecture Notes problems, e.g., our 7- or 4-segment LED displays. 29 30 5

Recommend


More recommend