Basics of Digital Systems Boolean Algebra Truth Tables Karnaugh Maps Boolean Algebra
Total Page:16
File Type:pdf, Size:1020Kb
Basics of Digital Systems Boolean algebra Truth tables Karnaugh maps Boolean Algebra • In digital systems we deal with the binary number system. This means that the value of an element can be either 0 or 1. • The elements can also be referred to as false or true for 0 or 1 respectively. • There are three operators in Boolean algebra: • AND • OR • NOT Boolean Algebra: AND • The AND operator is by a dot between the two elements or nothing between the two elements at all. It is also know as the product of elements. x∙y or x y • The AND operator requires that all elements have a value 1 (or true) for the result to be 1 (or true). Thus if we had two elements x, y, both x AND y need to be 1 for the result to be one. x y x ∙ y 0 0 0 0 1 0 1 0 0 1 1 1 Boolean Algebra: OR • The OR operator is represented the same as addition in regular algebra, with a plus sign. It is also known as the sum of elements. x + y • The OR operator requires that either of the two elements be 1 for the result to be 1. So if we had two element x, y, then x OR y has to have a value of 1 for the result to have a value of 1. x y x + y 0 0 0 0 1 1 1 0 1 1 1 1 Boolean Algebra: NOT • The NOT operator is represented with an apostrophe after the element. It is also known as the complement of an element. x’ • The NOT operator give the opposite of the element’s value as the result. So for an element x with a value of 1, the NOT of x is equal to 0. x x’ 0 1 1 0 Boolean Algebra: Properties • Boolean algebra is governed by several key properties. • Commutative x + y = y + x x y = y x • Associative x + (y + z) = (x + y) + z x (y z) = (x y) z • Distributive x (y + z) = x y + x z x + y z = (x +y)(x + z) • Absorption x + x y = x x (x + y) = x • Involution (x’)’ = x • DeMorgan (x + y)’ = x’y’ (x y)’ = x’ + y’ Boolean Algebra: Properties • Using the previous properties and the knowledge of the different operators, we can find a few more important properties of Boolean algebra. • x + 0 = x x ∙ 1 = x • x + x’ = 1 x ∙ x’ = 0 • x + x = x x ∙ x = x • x + 1 = 1 x ∙ 0 = 0 Boolean Algebra: Simplifying • Using the properties we can simplify Boolean expressions. For example lets simplify the following expression. F = x’y’z + x’y z + x y’ • First we can see the use of the distributive property. We can apply is to simplify the expression to: F = x’z (y’ + y) + x y’ • Next we can apply one of our derived properties. (x + x’) = 1. This gives us a final simplification of: F = x’z + x y’ • This simplification process can be much easier through the use of Truth Tables and Karnaugh Maps. Minterms and Maxterms • In addition to simplifying a boolean expression we can also expand them. There are two ways of expanding a boolean expression: a sum of minterms or a product of maxterms. • The minterms are the products of each of the elements in the expression in every combination (the elemnts can be complmented or not. Ex. x y’z’). Each minterm has a designation starting with m0. • The maxterms are the sums of each of the elements in the expression in every expression (the elements can be complements or not. Ex. x’ + y + z’). Each maxterm has a designation starting with M0. Minterms and Maxterms cont. • The minterms and maxterms for an expression with 3 elements are as follows. Minterms Maxterms Term Designation Term Designation x’y’z’ m0 x + y + z M0 x’y’z m1 x + y + z’ M1 x’y z’ m2 x + y’ + z M2 x’y z m3 x + y’ + z’ M3 x y’z’ m4 x’ + y + z M4 z y’z m5 x’ + y + z’ M5 x y z’ m6 x’ + y’ + z M6 x y z m7 x’ + y’ + z’ M7 Minterms and Maxterms Example • If we look at the simplified version of the previous example we can expand it to a sum of minterms or a product of maxterm. F = x’z + x y’ • To have a sum of minterms, we need to make each term have all three element (x, y and z). We know that, (x’z)(1) = x’z • And we know that, (y + y’) = 1 • So we can add the y element into that term. x’z = x’z(y + y’) Minterms and Maxterms: Example cont. • We can multiply the term out to get: x’z = x’y z + x’y’z • By using this same method we can expand the second term. x y’ = x y’z + x y’z’ • So we find that, F = x’z + x y’ = x’y z + x’y’z + x y’z + x y’z’ • We can express this as a sum of minterm designations. F = m1 + m3 + m4 + m5 Minterms and Maxterms: Example cont. • Now we will expand our function to a product of maxterms. F = x’z + x y’ • This is easiest to do by taking the complement of the sum of minterms. F’ = (m1 + m3 + m4 + m5)’ F’ = m1‘ m3‘ m4‘ m5‘ F’ = (x’y’z)’ (x’yz)’ (x y’z)’ (x y’z’)’ F’ = (x + y + z’)(x + y’ + z’)(x’ + y + z’)(x’ + y + z) F’ = M1 M3 M4 M5 • We now have our two expansions of our function. As a sum of minterms and as a product of maxterms. Truth Tables • A truth tables is a method of setting up and testing a boolean expression for every possible input. The truth table is set up with a column for each different element in the expression and an additional column for the fuction its self. For example: F = x + y’z x y z F Truth Tables cont. • We then want to fill in the columns with our elements x, y and z to allow for every possible combination of inputs. As you may notice, each row corresponds to one minterm starting with m0 and ending with m7. x y z F 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Truth Tables cont. • Next we input each of these cases into the function and calculate what the output will be. The output goes under the function’s column. x y z F 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1 Karnaugh Map • The truth table is great for visualizing for which inputs you get a 0 or 1, however it may not be easy to use it to simplify a boolean expression. For that we use the Karnaugh map. • The Karnaugh map or K-map is a table setup in such a way to make simplifying expressions really easy. It works with minterms like the truth tables, this makes going from one to the other fairly simple. • We’ll start my looking at a two variable map. Two-Variable K-map • The first K-map shows the layout for an expression with two elements. • In the second K-map we can see the relation between the minterms and the elements. y x 0 1 0 x’y’ x’y m0 m1 m2 m3 1 x y’ x y • Once we have the K-map drawn, we can look at our truth table and in each box we place the output we found corresponding to each minterm. Two-Variable Example • Lets look at the the following function. F = x’y + x y’ + x’y’ • We start by making a truth table. x y F 0 0 1 0 1 1 1 0 1 1 1 0 • Then we construct our K-map using the truth table. y x 0 1 0 1 1 1 1 0 Two-Variable Example cont. • In order to use this K-map to reduce our expression we need to remember one of our properties of boolean algebra: (y + y’) = 1 • If we use this with our minterms we see that, x’ y’ + x’ y = x’(y’ + y) = x’ or m0 + m1 = x’ • We can show this in our K-map but highlighting those given boxes. y x 0 1 0 1 1 1 1 0 Two-Variable Example cont. • We can do the same thing with m0 and m2. y x 0 1 0 1 1 1 1 0 • Using these highlightings we can reduce the expression to, F = x’ + y’ Three-Variable K-map • The three variable map can be extended from the two variable map. Instead of having only y along the top we put yz. y z x 00 01 11 10 m0 m1 m3 m2 0 x’y’z’ x’y’z x’y z x’y z’ m m m m 4 5 7 6 1 x y’z’ x y’z x y z x y z’ • It is important to note that the minterms are NOT placed in ascending order. The third and fourth column are switched. If we look at the k-map with the elements, we can see that the columns are labeled like gray code.