35
Basics of Digital Systems Boolean algebra Truth tables Karnaugh maps

Basics of Digital Systems - Illinois Institute of Technology Algebra: Simplifying •Using the properties we can simplify Boolean expressions. For example lets simplify the following

Embed Size (px)

Citation preview

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

m0 m1

m2 m3

0 1

0 x’y’ x’y

1 x y’ x y

y x

• 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.

• 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.

• Then we construct our K-map using the truth table.

x y F

0 0 1

0 1 1

1 0 1

1 1 0

0 1

0 1 1

1 1 0

y x

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.

0 1

0 1 1

1 1 0

y x

Two-Variable Example cont.

• We can do the same thing with m0 and m2.

• Using these highlightings we can reduce the expression to,

F = x’ + y’

0 1

0 1 1

1 1 0

y x

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.

• 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. By having only one bit change between each row/column we are able to use our highlighting method.

00 01 11 10

0 x’y’z’ x’y’z x’y z x’y z’

1 x y’z’ x y’z x y z x y z’

y z x

m0 m1 m3 m2

m4 m5 m7 m6

Three-Variable Example 1

• Lets look are the following example,

F = m2 + m3 + m4 + m5

• When highlighting with a three variable k-map we can highlight pairs of two, lines of four, boxes of four, or all eight. This is because we set up the k-map such that there is only one bit change from column to column or row to row (like gray code).

00 01 11 10

0 0 0 1 1

1 1 1 0 0

y z x

Three-Variable Example 1

• To figure out what the resulting simplification will be, look are each highlighted section and determine which bits don’t change.

• In our example, for the yellow highlighting, we see that x stays at one and y stays at zero. Thus our simplification for that highlighting is,

x’ y

• We do the same thing for the second highlighting and add them together to get,

F = x’y + x y

Three-Variable Example 2

• Now we will look at a more complicated example.

F = m0 + m2 + m4 + m5 + m6

• Before we highlight an important thing to note is that between m0 and m2, there is only a one bit change. This mean that when highlighting we are allowed to wrap around the edges of the table.

00 01 11 10

0 1 0 0 1

1 1 1 0 1

y z x

Three-Variable Example 2

• For our expression we can highlight a box around the edges as well as a pair on the bottom.

• Again we look at the variables that don’t change for each highlighting. For the box, x varies between 1 and 0, y varies between 1 and 0, and z stays at 0. So our expression for the red box is,

z’

00 01 11 10

0 1 0 0 1

1 1 1 0 1

y z x

Three-Variable Example 2

• Doing the same thing with the pair highlighting we get a final answer of,

F = z’ + x y’

Four-Variable K-map

• The four variable k-map functions the same as the three variable k-map, but we must make sure that there is only a one bit change between rows and columns. This means that in addition to the third and four column being switched, the third and fourth row are also switched.

m0 m1 m3 m2

m4 m5 m7 m6

m12 m13 m15 m14

m8 m9 m11 m10

00 01 11 10

00 w’x’y’z’ w’x’y’z w’x’y z w’x’y z’

01 w’x y’z’ w’x y’z w’x y z w’x y z’

11 w x y’z’ w x y’z w x y z w x y z’

10 w x’y’z’ w x’y’z w x’y z w x’y z’

y z wx

Four-Variable K-map

• Just like with the three variable map, we are allowed to wrap around the edges of the map, both on the sides and the top/bottom.

• For the four variable map there are many possible highlightings: a pair, a line of four, a box of four, a 2x4 box of eight (two full columns or rows), or all sixteen. As a special note, the for corners actually create a box of four because you can wrap both horiztontally and vertically.

Four-Variable Example

• Lets use the follow function,

F= m0 + m1 + m2 + m8 + m9 + m10 + m15

• For this example we have two boxes of four and one left over.

00 01 11 10

00 1 1 0 1

01 0 0 0 0

11 0 0 1 0

10 1 1 0 1

y z wx

Four-Variable Example

• We can highlight it as follows.

• By looking at which variables don’t change, we can find the reduced expression for each highlingting.

00 01 11 10

00 1 1 0 1

01 0 0 0 0

11 0 0 1 0

10 1 1 0 1

y z wx

Four-Variable Example

• The red highlighting reduces to,

x’z’

• The blue highlighting reduces to,

x’y’

• The purple highlighting cannot be reduced, it stay as,

w x y z

• Adding everything together we get,

F = x’z’ + x’y’ + w x y z

Sample Problems

• Try making a truth table and k-map to reduce the following expressions.

• 1. F= m3 + m4 + m6 + m7

• 2. F= x’z + x’y + x y’z + y z

• 3. F= Σ(0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14)

• 4. F= m1 + m2 + m4 + m7 + m8 + m10 + m13 + m15

Solutions

• 1. y z + x z’

• 2. z + x’y

• 3. y’ + w’z’ + x z’

• 4. w x z + x y z + w x’z’ +x’y z’ + w’x’y’z + w’x y’z’

Reference

• Digital Design, Fourth Edition

M. Morris Mano, Michael D. Ciletti