Download presentation
Presentation is loading. Please wait.
1
Fundamentals of Computer Systems
Boolean Logic & Truth Tables
2
Logic Gates Computers (and us) use logic on a daily bases
Do I want to eat something? Should I wear my coat? Logic is something that computers are great at We boil logic down to two possible results: true and false Just like binary Computers use this logic via logic gates Meaning x y I am hungry True False I am not hungry Meaning x I am hungry 1 I am not hungry
3
Logic Gates: NOT NOT acts as an inverse logic For example:
Anything that is true, is now false Anything that is false, is now true For example: “I will go outside if it is not raining” Here, raining is either true or false We only go outside if it is false Also known as an inverter Input Output 1
4
Logic Gates: OR OR combines two or more inputs into one output
The output is true if either of the inputs is true Simply put, as long as one is true, the output is true Input A Input B Output 1
5
Logic Gates: AND AND combines two or more inputs into one output
The output is true if both of the inputs is true AND is more restrictive than OR Input A Input B Output 1
6
Logic Gates: XOR XOR combines two or more inputs into one output
This is a more specific form of OR The output is true only if one of the inputs is true The output is false if both the inputs are the same Input A Input B Output 1
7
Logic Gates: NOR and NAND
NOR and NAND are inverse the OR and AND gates Simply reverse their usual output to get the new outputs Input A Input B Output 1 Input A Input B Output 1 NOR NAND
8
Combining Logic We create larger electrical components/systems by combining lots of logic gates So we’ll usually see diagrams with lots of symbols Questions may involve: Naming the logic gates Writing the algebraic expression (which we’ll see later) Completing/creating truth tables
9
Combining Logic When it comes to more complex circuit diagrams, we can break our truth tables up a bit A B C B OR C Output 1
10
Create the truth table for the following circuit diagrams
11
Create the truth table for the following circuit diagrams
12
Create the truth table for the following circuit diagrams
13
Boolean Algebra All logic gates can be represented using algebraic expressions They use different notations to simplify logic circuit diagrams Here, we use: Letters for the inputs Symbols for operations (like AND/OR)
14
Boolean Algebra: NOT Uses a simple bar over the section being ‘notted’ (inverted) Anything under the bar is inverted Can include letters and symbols NOT A 𝐴
15
Boolean Algebra: OR Uses the ‘+’ symbol to represent OR
Works a bit like statistics/probability in mathematics We ‘add’ probabilities together if it’s one or the other A OR B 𝐴+𝐵
16
Boolean Algebra: AND Uses the ‘.’ symbol to represent AND
Represents ‘multiplication’ Works a bit like statistics/probability in mathematics We ‘multiply’ probabilities together if it’s one and the other A AND B 𝐴 .𝐵
17
Boolean Algebra: NOR and NAND
We simply add a bar over whole expressions (where needed) Thus more complicated circuits can be written as a single expression NOT (A AND B) 𝐴 . 𝐵 NOT (A OR B) 𝐴+𝐵 𝐴 . 𝐵 + 𝐴 . 𝐵
18
Create the Boolean expression for this circuit diagram
19
For the following boolean expressions, draw the circuit diagram and create a truth table
𝑨 . 𝑩+𝑪 𝑨 . 𝑩 + 𝑨 +𝑩
20
Draw a Logic Gate Circuit for:
Q = A·B + B·C A A·B B A·B+ B·C Q = B·C Here is a set of Boolean Notation for an equation. Q equals A AND B, OR, NOT B AND C, all NOTted. Can you separate out the elements in order to describe the logical layout of a logic gate diagram? B C Q = A·B + B·C
21
Algebraic Laws Commutative Associative Distributive
Order of input not important Associative Order that sum is calculated not important Distributive Conjunction can always be rewritten as disjunction of two other conjunctions A+B = B+A A.B = B.A (A+B)+C = A+(B+C) (A.B).C = A.(B.C) There are a number of Laws or Identities that Boolean Algebra prescribes to, where Boolean Algebra is an equation between two Boolean terms. Commutative laws state that the order that variables are put together are not important. We could say either A OR B, or we could say B OR A. It doesn’t matter in Boolean Algebra which one comes first. Similarly, we could say A AND B, or we could say B and A. Associative laws apply to Boolean Algebra in the form that their order is not important when they are calculated. Although we aren’t technically adding, or multiplying with Boolean Algebra the equation is still considered a sum. Here we have A OR B in brackets, with a third variable, C, added by another OR: A OR B, OR C. It could be expressed as A OR, B OR C. The same is true for AND. While we could say A AND B, AND C. We can also describe the relationship in the form A AND, B AND C. Distributive laws regards the relationships of AND and OR. If AND is a conjunction and OR is a disjunction we can join or separate the elements as we deem necessary. In this case we have A AND, B OR C. If we think of the AND as multiplication and we remember quadratic equations from Mathematics, we can “multiply” the A to both variables sitting within the brackets, or in other words multiply A by B and multiply A by C. This allows us to separate the direct OR relationship between B and C. So, from A AND, B OR C, we now have A AND B, OR, A AND C. Distributive laws state that a conjunction can be expressed as the disjunction of two other conjunctions. A.(B + C) = (A.B) + (A.C)
22
Algebraic Laws Identity Boolean Algebra = Only 2 possible outcomes
2 True outcomes = True A+0 = A A+1 = 1 A+A = A A+A = 1 A.0 = 0 A.1 = A A.A = A A.A = 0 A + AB = A A + AB = A(1+(1.B)) A(1+(1.B)) = A.(1+B) A.(1+B) = A.1 A.1 = A Identities in Boolean Algebra hold the following two truths. Two true outcomes will always result in another true. In other words a 1 and a 1 will always result in a value of 1. There are only two possible outcomes in Boolean Algebra (true or false, or as we prefer to call them: 1 and 0) Here are the given identities that should be memorised: If an OR function takes as its input the following two values: We can make the following assumptions The value 0 The contents of variable A If the second input value is 0, we know we cannot rely upon it to give us a possible 1. The 0 will always be a 0 We know that an OR function relies on only 1 of two inputs having a value of 1 Therefore, given the equation A OR 0, we can say A OR 0 equals A, because of our reliance upon A for a value of 1. We don’t know the value in the variable A. It could be a 0 or it could be a 1. We don’t know. What we do know is that we are reliant upon the variable A to complete the equation and give us an answer. The reverse is true if the OR function takes as its input the following two values: In this instance it doesn’t matter what the contents of A are, because we already have a value of 1. Since we know that an OR function is reliant on just one of our two values being a 1, we know it is achieved with the given input value of 1. The value 1 Therefore, given the equation A OR 1, we can say A OR 1 equals 1, because we don’t need to rely upon the value of A. Given an A OR A equation, we don’t know what the output value will be and we are therefore reliant upon the value within A. A OR A equals A. Finally, provided A OR NOT A, is going to always give us a value of 1, because if A equals 1, then we have our 1, and NOT A being 0 is irrelevant under the function of OR. Also, were A to equal 0, then the NOT A would reverse the value to a 1, and again under the OR function we would be putting a value of 1 through to the output. A OR 0 = A. A OR 1 = 1. A OR A = A. And A OR NOT A = 1. The AND function is just as straight forward. If an AND function takes as its input the following two values: The value in variable A is irrelevant. It could be a 0 or it could be a 1. It doesn’t matter as we are reliant, in an AND function on that 0 value. If the second input value is 0, we know that the need for both inputs to be 1s means that we cannot rely upon the value of A. The 0 value prevents this We know that an AND function relies on both of the two inputs having a value of 1 Therefore, given the equation A AND 0, we have to say A OR 0 equals 0, because of our reliance upon the 0 value. Where we are reliant upon the value of A, is in A AND 1. Given that we already know that the second input value is 1, leaves us reliant upon the value placed within the variable A. If the value of A is 0, the AND function can only output a 0 value. Whereas, if the A is 1, then the two values of 1 will return a value of 1. Therefore, given the equation A AND 1, we have to say A AND 1 equals 1, because of our reliance upon A. This is also true when A AND A are presented. We don’t know what the value of A is, but we do know that if it is a 0, the output will be 0. We are reliant upon the value in A, and therefore, given the equation A AND A, we have to say A AND A equals A. The truth of A AND NOT A, however, is that it can never result in a 1 value. If A is the value 1, then NOT A reverses it to 0, and the output, requiring both to be 1, is a 0. Also then, if A is the value 0, then NOT A will be 1, but the output will still be 0. A AND 0 = 0. A AND 1 = A. A AND A = A. And A AND NOT A = A. This is how we break down the equation to prove this truth. Using those standard identities we can state the following truth: A OR A AND B equals A. A OR A AND B equals A AND (1 OR (1 AND B) We come to this conclusion based upon our knowledge of Maths equations. By extracting a variable from both sides of that OR function (A OR AB), we leave a value of 1 behind. A AND (1 OR (1 AND B)) equals A AND (1 OR B) From our AND identities we know that given a value of 1 and a variable B, we are reliant upon the B in order to return a value of 1. Since the 1 is a given, we are no longer reliant upon it. Only the B is important A AND (1 OR B) equals A AND 1 We return to our basic identities to prove that in an OR function, we looking for only one value to return a value of 1. That is already provided by the value 1. So the B is irrelevant and can be ignored. A AND 1 equals A Because, given our identities, we know that with an AND function, it no longer matters what the value 1 is, because it’s a given. We are dependent upon the value in A. The output A is all that’s important Knowing that we can apply the same calculations to the reverse equation of A AND (A OR B). Have a go yourself, by making A AND (A OR B) equal A. A.(A+B) = A.A + A.B A.A + A.B = A.(1+B) A.(1+B) = A.1 A.1 = A
23
De Morgan’s Laws De Morgan’s Laws Modern processor chips
Simplified Logic Simplified Circuits Modern processor chips Millions of logic gates All circuits can be reduced to combinations of one type NOR A + B NAND A.B The final law which applies to Boolean Algebra is the logic of De Morgan’s law. The two laws De Morgan proposed were designed to simplify logic as a whole. The by-product of which was that he simplified the design of logic circuits and circuit boards.
24
De Morgan’s Law English Mathematician Developed theories
Father, a Colonel in East India Company Moved to England from India in the 19th Century Has a Moon crater named after him Developed theories Trigonometry Algebra De Morgan’s Laws Augustus De Morgan was a Victorian mathematician. Born in India whilst his father was in the service of the East India Trading Company he moved to England during the 1800s and has a crater on the Moon named after him. De Morgan’s life was largely focused on developing theories in Trigonometry and Algebra and through this work he developed a set of laws specifically aimed at Boolean Algebra: De Morgan’s Laws.
25
De Morgan’s Law Simplifying Boolean algebra Laws of Negatives
Create any logic gate circuit, using either: OR & NOT AND & NOT NOR A + B NAND A.B Augustus De Morgan was a Victorian mathematician. Born in India whilst his father was in the service of the East India Trading Company he moved to England during the 1800s and has a crater on the Moon named after him. De Morgan’s life was largely focused on developing theories in Trigonometry and Algebra and through this work he developed a set of laws specifically aimed at Boolean Algebra: De Morgan’s Laws.
26
De Morgan’s Law A · B = A + B A · B = A + B
The negation of a conjunction is the disjunction of the negations Substitution Form: A · B = A + B Augustus De Morgan was a Victorian mathematician. Born in India whilst his father was in the service of the East India Trading Company he moved to England during the 1800s and has a crater on the Moon named after him. De Morgan’s life was largely focused on developing theories in Trigonometry and Algebra and through this work he developed a set of laws specifically aimed at Boolean Algebra: De Morgan’s Laws. A · B = A + B
27
De Morgan’s Law A + B = A · B A + B = A · B
The negation of a disjunction is the conjunction of the negations Substitution Form: A + B = A · B Augustus De Morgan was a Victorian mathematician. Born in India whilst his father was in the service of the East India Trading Company he moved to England during the 1800s and has a crater on the Moon named after him. De Morgan’s life was largely focused on developing theories in Trigonometry and Algebra and through this work he developed a set of laws specifically aimed at Boolean Algebra: De Morgan’s Laws. A + B = A · B
28
De Morgan’s First Law A + B = A · B equals A B A+B 1 A B A.B 1 1 1 1 1
1 A B A.B 1 1 1 1 A + B = A · B 1 1 1 1 1 1 1 1 equals A B Augustus De Morgan was a Victorian mathematician. Born in India whilst his father was in the service of the East India Trading Company he moved to England during the 1800s and has a crater on the Moon named after him. De Morgan’s life was largely focused on developing theories in Trigonometry and Algebra and through this work he developed a set of laws specifically aimed at Boolean Algebra: De Morgan’s Laws.
29
De Morgan’s Second Law A · B = A + B equals A B A.B 1 A B A+B 1 1 1 1
1 A B A+B 1 1 1 1 A · B = A + B 1 1 1 1 1 1 equals A B Augustus De Morgan was a Victorian mathematician. Born in India whilst his father was in the service of the East India Trading Company he moved to England during the 1800s and has a crater on the Moon named after him. De Morgan’s life was largely focused on developing theories in Trigonometry and Algebra and through this work he developed a set of laws specifically aimed at Boolean Algebra: De Morgan’s Laws.
30
Memorising De Morgan’s Laws
De Morgan’s Laws may be written Swap logical connection between the variables Change logical state of each variable Change logical state of the whole expression A.B A + B A+B A . B Both of De Morgan’s laws are proved through the simple substitution process that we touched upon earlier, but which may be written as follows: Start with the given notation of either A AND B or A OR B Swap the logical connection between the two variables, so that A AND B becomes A OR B, and A OR B becomes A AND B The act of swapping the logical connection also changes the logical state of each variable. In every case therefore, A and B become NOT A, and NOT B Finally, think about the procedures in standard Maths equations when elements on one side of the equation are substituted across to the other side of the equals sign. This process usually means an added variables becomes subtracted from both sides, and a multiplied variable is divided from each side. Therefore, by doing this with our given equation, by moving NOT A AND NOT B, or NOT A OR NOT B, to the other side of the equation we negate the whole expression.
31
De Morgan’s NAND Gates NAND Gates are self-sufficient
Can build any circuit with it Implement AND / OR / NOT A B A.B 1 A B C AND A B C OR A B A+B 1 We’ve proved that in De Morgan’s two laws only two gates are necessary to represent the different structures of logical diagrams and subsequently, circuits. Those two gates are NAND and NOR. Here’s the first, the NAND gate. An entire circuit comprised of only NAND gates is sufficient because of the self-sufficiency of the NAND gate. It implements AND, OR, and NOT functions as can be seen from the three diagrams. By doubling the outputs in various instances enables the representation of our previous basic logic operators. A C NOT A 1
32
De Morgan’s NAND Gates NOR Gates are self-sufficient
Can build any circuit with it Implement AND / OR / NOT A B A.B 1 A B C AND A B C OR A B A+B 1 A C NOT We’ve proved that in De Morgan’s two laws only two gates are necessary to represent the different structures of logical diagrams and subsequently, circuits. Those two gates are NAND and NOR. Here’s the first, the NAND gate. An entire circuit comprised of only NAND gates is sufficient because of the self-sufficiency of the NAND gate. It implements AND, OR, and NOT functions as can be seen from the three diagrams. By doubling the outputs in various instances enables the representation of our previous basic logic operators. A 1
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.