1 / 53

Boolean Logic and Circuits

Boolean Logic and Circuits. Professor James T. Williams, Jr. HONP112 Week 2 Lesson. George Boole (1815-1864). George Boole developed the mathematics that made modern computing possible, almost a century before the first computers were actually developed. . Boolean Logic.

varden
Download Presentation

Boolean Logic and Circuits

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. Boolean Logic and Circuits Professor James T. Williams, Jr. HONP112 Week 2 Lesson

  2. George Boole (1815-1864) • George Boole developed the mathematics that made modern computing possible, almost a century before the first computers were actually developed.

  3. Boolean Logic • A special kind of mathematics where there are only 2 possible values. • These values are true and false. • Special operators are used with these values to create expressions. • A boolean expression will evaluate to either true or false in its entirety.

  4. Boolean Operators • There are three Boolean operators: • AND • OR • NOT

  5. Order of Operations • First, any expression in parenthesis • Then the AND • Then the OR

  6. The AND Operator • The AND operator is a BINARY operator (i.e. it acts on two variables or expressions – “binary” in this context does not mean “base-2”) • Example expression: A AND B • Also can be written as A * B • The resulting value of the expression depends on the values of A and B.

  7. Evaluating AND expressions • An AND expression only evaluates to true if BOTH of the sub-expressions also evaluate to true. Otherwise, it evaluates to false. • false AND false = false • false AND true = false • true AND false = false • true AND true = true

  8. AND – Truth Table • We can look at all the possibilities for the value of A*B as a truth table:

  9. AND - Example • Assume: A is true and B is false • What does the expression A * B evaluate to? • What if A is true and B is true?

  10. AND – More examples • Assume: A is true, B is false, C is true, D is true • What does the expression A * B evaluate to? • What does the expression C * D evaluate to? • What does (A*B) * (C*D) evaluate to?

  11. The OR Operator • The OR operator is a BINARY operator (i.e. it acts on two variables or expressions) • Example expression: A OR B • Also can be written as A +B (Careful – the plus sign does not mean “and”!!) • The resulting value of the expression depends on the values of A and B.

  12. Evaluating OR expressions • An OR expression only evaluates to true if EITHER of the sub-expressions also evaluate to true. Otherwise, it evaluates to false. • false OR false = false • false OR true = true • true OR false = true • true OR true = true

  13. OR – Truth Table • We can look at all the possibilities for the value of A+B as a truth table:

  14. OR - Example • Assume: A is true and B is false • What does the expression A + B evaluate to? • What if A is true and B is true? • What if A is false and B is false?

  15. OR – More examples • Assume: A is true, B is false, C is true, D is true • What does the expression A + B evaluate to? • What does the expression C + D evaluate to? • What does (A+B) + (C+D) evaluate to?

  16. The NOT Operator • The NOT operator is a UNARY operator (i.e. it acts on one variable or expressions) • Example expression: NOT A • Also can be written as -A • The resulting value of the expression depends on the value of A

  17. Evaluating NOT expressions • An NOT expression simply evaluates to the inverse value of the expression. • NOT false = true • NOT true = false

  18. NOT – Truth Table • We can look at all the possibilities for the value of -A as a truth table:

  19. NOT - Example • Assume: A is true and B is false • What does the expression -A evaluate to? • What does the expression -B evaluate to?

  20. Evaluating Boolean Expressions • Consider (B AND NOT A) OR (NOT D OR C). • Assume A=1, B=1, C=1, and D=0 • Put in the variable values and simplify as below: • (1 AND NOT 1) OR (NOT 0 OR 1) • (1 AND 0) OR (1 OR 1) • 0 OR 1 • 1

  21. More Boolean Expressions • Some more examples to work out in class or on your own time. Remember the order of operations. • Assume A=1, B=1, C=1, and D=0 • A OR D AND B = x • (NOT B AND C) AND (A OR C) = x • (B AND NOT D OR C) OR (NOT B AND B) = x • (A AND B AND C) OR (B AND D) = x • (A*B*C) + (B*D) = x [alt. version of above]

  22. What does this have to do with computers? • All computer/digital circuits are constructed from various combinations of Boolean expressions. • These are implemented in the computer by very tiny electronic components, built into chips, called “gates.” • Depending on the values going into the gates, the end result will be either a logical 0 or 1. This corresponds with false or true.

  23. Technically speaking… • The gates in a computer understand the state 0 or 1 based on electrical voltage. • Very generally speaking, for our purposes only, a 1 is about 5 volts, and a 0 is 0 volts or close to it. • In real life these values may vary, but the idea is the same. • It is more accurate to refer to the 1 and 0 in computer circuits as “high” or “low”.

  24. The Logisim simulator • In case you wonder where the following screen shots are coming from... • There is a free logic circuit simulator called Logisim. • http://ozark.hendrix.edu/~burch/logisim/ • Dark green is low, bright green is high • Let’s see what happens with our logic gates.

  25. The AND gate • The AND gate is represented using the symbol below. • It takes two inputs and produces a single output. For the output to be high, both inputs must be high.

  26. The AND gate • Let’s change one of the inputs to high. • Because both are not high, the output is still low.

  27. The AND gate • Now let’s make both inputs high. • Notice that now the output is high.

  28. The OR gate • The OR gate is represented using the symbol below. • It takes two inputs and produces a single output. For the output to be high, only one of the inputs must be high.

  29. The OR gate • Let’s change one of the inputs to high. • Notice that the output went high just by making one of the inputs high.

  30. The NOT gate • The symbol below represents the NOT gate. This is also called an “inverter.” • Notice that the output is high when the input is low.

  31. The NOT gate • Changing the input to high makes the output low.

  32. Consider This Boolean Expression • (A AND NOT B) OR (C OR D) = x • What is x? It depends on the values assigned to A, B, C, and D. • Remember the values can only be true or false.

  33. Our Example as a Circuit • (A AND NOT B) OR (C OR D) = x • Assume A=true, B=false, C = false, D=true.

  34. Let’s make a change • (A AND NOT B) OR (C OR D) = x • Assume A=false, B=false, C = false, D=true.

  35. Let’s make another change • (A AND NOT B) OR (C OR D) = x • Assume A=false, B=true, C = false, D=false.

  36. Some more examples … • Maybe in class, or on your own time … try to visualize them as circuits this time around. • (A AND NOT B) AND (C OR D) • (A * -B) * (C + D) [alt. version of above] • (D + -B + C) * C • -A * B * (C + A) • Substitute different values for the variables. • Try some with more or less variables. Experiment. Learn by doing.

  37. Special Gates • In circuit design, there are some special gates that are commonly used. • The purpose of these gates is to make circuits simpler to build (less hardware = less effort = less cost). • The gates we will discuss are not standard boolean operators, but are actually single circuits constructed from the standard boolean gates.

  38. Three Special Gates • NAND: “Not And” (AND gate followed by a NOT gate) • NOR: “Not Or” (OR gate followed by a NOT gate) • XOR: “Exclusive OR” (means that you only get a high output if EITHER of the inputs is high, not both. The circuit for XOR is more complex than for NAND or NOR)

  39. The NAND gate • Same as AND followed by a NOT. Notice that we only draw the bubble part of the NOT gate on a NAND symbol (short-cut)

  40. The NOR gate • Same as OR followed by a NOT. Notice that we only draw the bubble part of the NOT gate on a NOR symbol (short-cut)

  41. The XOR gate • This means that only one of the two inputs can be high to get a high output. Notice how XOR symbols are drawn, and see the two simulations below. (The XOR circuit itself is not shown).

  42. NAND – Truth Table • Remember our earlier AND truth table. Just invert the output values and that is the NAND truth table. • Let’s use 1 and 0 to represent true/high and false/low.

  43. NOR – Truth Table • Remember our earlier OR truth table. Just invert the output values and that is the NOR truth table. • Let’s use 1 and 0 to represent true/high and false/low.

  44. XOR – Truth Table • Remember our earlier OR truth table. XOR is the same except that we get low when both inputs are high. • Let’s use 1 and 0 to represent true/high and false/low.

  45. Let’s stop and review • Know the truth tables for the six gates we have discussed. • Know the various ways to represent the logical values of true/false. • Be able to evaluate a boolean expression using the three simple operators. • Be able to evaluate a circuit using any of the six logic gates.

  46. Boolean circuits in action… • At this point, trying to imagine what the computer can do with these types of circuits may be a bit abstract. • So let’s look at a concrete example of a real circuit that is used by every computer. • You will not have to memorize this circuit but hopefully it will help illustrate a real-life application of a boolean logic circuit.

  47. This is a real circuit • This circuit (a “full adder”) is used by computers to add one column of two whole numbers (in base-2 of course). • Again … You do not have to memorize this circuit, but just try to understand what it does.

  48. The Full Adder - analysis • Imagine you are adding a single column of numbers. • Notice there are three inputs. These are the first addend, the second addend, and the current value of the carry. • There are two outputs. One is the result value that gets placed in the result column, and the other is the new carry value. • We already know the addition algorithm … so let’s test the circuit to make sure it works correctly. • Important: in the following slides, the “+” symbol will mean “plus” !

  49. Full adder – one test • Assume the carry is 0, the first addend is 1, the second addend is 0. • 0+1+0 = 1. 1 is not >= the base, so we set the result to 1, and the carry stays zero.

  50. Full adder – another test • Now, assume the carry is 0, the first addend is 1, the second addend is also 1. • 0+1+1= 2. 2 is >= the base, so we subtract the base from the result, and set the carry to 1.

More Related