Quick viewing(Text Mode)

Boolean Algebra and Combinational Digital Logic © N

Boolean Algebra and Combinational Digital Logic © N

Erik Jonsson School of Engineering and The University of Texas at Dallas Science • Boolean Algebra (named for its developer, George Boole), is the algebra of digital logic circuits that all use. • It is a symbolic representation of logic principles that date back to Greek logic studies (Aristotle, ~384-322 BC). • In the Victorian Age, mathematicians began to apply formal principles to Aristotelian logic, which led to the field of symbolic logic. • Technically, “Boolean Algebra” refers to a family of logic systems, but it is generally used to refer to one system -- and that is how we will use it. • George Boole (1815-1864) was a mathematician and teacher, the self- educated son of a cobbler, who married Mary Everest (niece of Sir George Everest of mountain fame).* • Boole’s thinking was typical of Victorians: All processes (even thinking!) could be represented by formal rules. His intent was to formalize the “rules of thinking” with logic equations – a well-meant but totally impossible task. • Scientists soon began to apply “switching algebra” to logic problems. * His key work was “An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities.”

1 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Boolean Algebra (2)

• Later contributors improved and adapted Boole’s work, slowly evolving it towards computer applications, including William S. Jevons (1869 – “the logic piano,” a rudimentary Boolean algebra computational device), and Claude Shannon (1930’s – a great early data transmission expert, who died in 2001; he invented transmission [“it’s all bits”]). • Despite many contributors Boolean Algebra is mostly unchanged. • Boolean Algebra is “1-0 logic.” Very important – 0 = “off,” “not present,” “false,” “de-asserted.” statement!!!! – 1 = “on,” “present,” “true,” “asserted.” • All computer circuits solve problems by performing Boolean transformations on binary (0-1) variables. It could be said that Boolean algebra is the algebra of binary systems.

2 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Boolean Algebra in the Computer • In a computer, logic levels 1 and 0 correspond to voltages: – “Positive logic” uses a + voltage (e.g., 5 V) for 1 and 0 V for 0. – Sometimes, “negative logic” (1 = 0V, 0 = +V [e.g., 5V]) is used. • There are two classes of digital or computer logic: – – output depends only on the inputs. – Sequential logic – output depends on the inputs, the internal state of the logic, and possibly a clock or timing mechanism (studied later). • We will only cover circuit behavior in terms the manipulation of 1’s and 0’s. You will cover electronics of digital circuits later. • A logic circuit (“gate”), is an electronic device that performs a * on one or more inputs, and provides at least one output. • There are three basic Boolean functions: AND OR NOT * A function is an action that can be performed on a value, state, or number, resulting in a new value, state, or number. 3 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Boolean Functions: Logical Negation

• NOT is the simplest logical function: 1 input and 1 output. • NOT is defined as follows: “The output f of NOT, given an input a, is the complement or opposite of the input.” Or : fa= • Since NOT can have only a 0 or 1 input, the output of NOT is the reverse, or complement, of the input. – If the input of NOT is 1, the output is 0. – If the input of NOT is 0, the output is 1. • The NOT function is called inversion, and the digital circuit which inverts is an inverter. The electronic circuit symbol for NOT is: a a

4 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Truth Tables

• The input/output relationship is easy to show for an inverter (see last slide). • For more complex functions, a Boolean Function Truth Table table of outputs versus inputs is Input x Input y Output f helpful. 0 0 0 • Such a table is called a truth table, since the table indicates the 1 (or 0 1 1 “true”) outputs, although the 1 0 1 table normally shows outputs for all input combinations. 1 1 0 • We will use truth tables to demonstrate many Boolean functions.

5 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Logical AND

AND Truth Table • AND has two or more inputs. a b a AND b • The truth table for a two-input AND with a and b inputs is shown in the chart. 0 0 0 • AND is defined as follows: a AND b = 1 if 0 1 0 and only if (iff) a = 1 and b = 1. 1 0 0 • Mathematically, we represent “a AND b” 1 1 1 as ab ⋅ (an unfortunate choice). • AND may have more than two inputs, i. a a b c d 2-Input AND ab⋅ e.: AND AND AND . b • The electronic circuit symbols for 2- and 4-input AND’s are shown at the right. a ⋅⋅⋅ b abcd • Regardless of the number of inputs, the 4-Input AND c output of AND is 1 iff all inputs are 1. d

6 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Logical OR • OR has two or more inputs. OR Truth Table • The truth table for two inputs a, b is shown a b a OR b in the adjacent chart. 0 0 0 • OR is defined as follows: a OR b = 1 if 0 1 1 either a or b or both a and b = 1. 1 0 1 • Another way to way this is that a OR b = 0 1 1 1 iff a = b = 0. • Mathematically, we represent “a OR b” as a ab+ ab+ (another bad choice). b 2-Input OR • OR may have many inputs, e. g.: a+b+c+d. a • The electronic circuit symbols for 2- and 4- b c abcd+++ input OR’s are shown at the right. d • Regardless of the number of inputs, the 4-Input OR output of OR is 0 iff all inputs are 0.

7 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Illustration of AND and OR with “Goofy Flashlights” a·b a+b Batteries Light Bulb a b a b Switches

AND OR • The AND “goofy flashlight” is a • The OR “goofy flashlight” connects circuit connecting batteries to a batteries to a light bulb via parallel light bulb via series switches, a & b. switches, a & b. • The bulb will be lighted only if both • The bulb will be lighted if either switches are closed. switch is closed. • Thus we say that the “AND light • Thus we say that the “OR light bulb function” = a AND b = a · b. bulb function” = a OR b = a + b. 8 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science NAND and NOR • Both NAND and NOR are composite functions, but we discuss them here, since they are commercially available. • The NAND function is inverted AND; NOR is inverted OR. • Mathematically, we use a horizontal bar to indicate the inversion, i.e.: a NAND b is written as ab ⋅ , and a NOR b is written as ab+ • As NAND is the reverse of AND, the NAND output is 1 unless all inputs are 1. Likewise, NOR outputs 0 unless all inputs are 0.

NAND NAND Truth Table NOR NOR Truth Table a a b a NAND b a a b a NOR b ab⋅ 0 0 1 ab+ 0 0 1 b 0 1 1 b 0 1 0 1 0 1 1 0 0 a 1 1 0 a 1 1 0

⋅ + ab ab b b

9 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Creating Boolean Functions

• As mentioned a few slides ago, digital circuits solve problems by performing Boolean transformations on binary numbers. • Any computer function can be created by combinations of Boolean variables. Boolean functions created in this way are called combinational logic, and they are time-independent (we will discuss sequential, or time-dependent, logic in a few lectures). • When a digital system is being designed, an engineer usually starts with a specification (“spec”), which describes how the system performs (“when the system inputs are this, the output is that”). • We go from “spec” → truth table, from which we can derive a Boolean expression, from which a circuit can be made.

10 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Engineering Design Process Specification Truth Table Boolean Defined (Detailed Expression (Exact description of performance (Equation that how the system parameters) defines system x y z f 0 0 0 1 performs) 0 0 1 0 performance) 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 f= wxyzwxyzwxyzwxyz +++ Sadfaf 1 1 0 1 ghftgyh 1 1 1 0 nbcvbnbv Khgvujm Fgrdtfbsntr Bfrbsed xgfr Se esr gse g Digital Circuit er98790ykiuh

11 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Circuit Derived from Boolean Expression

• We will look at the entire process later: Let’s now examine the 1: Boolean function → circuit design process. • Assume we have some Boolean functions that represent computer circuits that we want to design. 2: How do we go from the Boolean function to the computer circuit? • Consider these functions: 3: f=++ abc f= ab + f=⋅+() ab c 4: (and a bit more complicated one!): f=+⋅+( ab )( cd )

12 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Exercise 1

• Now let’s try a few digital circuit designs from the Boolean expressions:

f=⋅⋅ abc f=+⋅() abc

f=( a +⋅⋅ b )( cd ) f=+⋅+ a() bc d

13 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science

Complex Boolean Functions: “Combinational Logic”

• Any Boolean function f maps a total of n inputs (x1, x2, x3, ...... xn) into one output (0,1). That is, a Boolean function f of n variables produces a single output for each unique combination of inputs. • Remember: – There are only two Boolean variables: 0 or 1. – A Boolean function in which the output f depends only on the input variables is called combinational logic. – No matter how complex, a Boolean function can always be defined by using a truth table, as we have done previously. • Principle: Any combinational logic function may be represented by two levels of logic: a level of AND gates followed by an OR gate, or a level of OR gates followed by an AND gate. Input inversion may also be required, but this is not considered a third level.

14 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science SOP and POS Boolean Representations • If we have AND functions followed by an OR, then we have a “Sum of Products” (SOP) representation, a misnomer from mathematics.* • If we have OR’s followed by an AND, we say that we have a “Product of Sums” (POS) representation (also misnamed). • A “Sum of Products” function looks like this: f =⋅+⋅ ( ab )( cd ) . – The Boolean function f is the OR of two functions, a AND b & c AND d. It is an SOP since the AND’s come first, and then the OR. – Likewise, g =⋅+⋅ ( ab )( cd ) is also SOP, even with inverted inputs.

OR Level SOP Illustration: f=⋅+⋅( ab )( cd ) AND Level

* Remember, AND and OR symbols look like the “times” and “plus” symbols, hence the names SOP and POS. 15 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science SOP and POS (Continued)

• A “Product of Sums” looks like this: f =+⋅+ ( ab )( cd ) . – In this case, f is a Boolean AND of two OR functions, a OR b & c OR d. It is POS since the OR’s come first, and then the AND. – In the same way, g =+⋅+ ( ab )( cd ) is also POS. It is also 2- level, even though there are also two variable inversions.

OR Level POS Illustration: AND Level f=+⋅+( ab )( cd )

16 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Using a Truth Table to Find Boolean Expressions • In digital circuit design, inputs and outputs are normally defined.* • Since computer circuits use only binary numbers, input values will always be only 0 and 1, and the output will always be 0 and 1. • The engineer designs the “stuff in the middle” between input and output by: – Making a truth table to represent the input/output relationship. – Defining a Boolean expression in SOP or POS form that satisfies the truth table. – Constructing a circuit that represents the “stuff in the middle” that performs the Boolean function on the inputs to get the desired output.

Establish Construct Define Boolean Design digital circuit inputs and Truth expression in based on Boolean outputs Table SOP or POS form expression

* Once again, we get this output-versus-input information from a product or performance specification, or a “spec.”

17 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Examples: Sum-of-Products Form • Assume that we have a specification that gives the outputs of function f for the 8 x y z f(x, y, z) AND’s possible combinations of inputs x, y, z. 0 0 0 0 • We can then build the truth table shown. 0 0 1 0 0 1 0 0 • Note that the output is “true” (=1) for 0 1 1 1 ⋅⋅ only two combinations of the inputs. If xyz we make the Boolean expression SOP, 1 0 0 0 the first level (which has the most terms) 1 0 1 1 xyz⋅⋅ will have only two AND terms.* 1 1 0 0 1 1 1 0 • We then define the two AND functions that result in 1’s being output from the For the x, y, z combination (0,1,1), function f for each x, y, z combination. f will only be 1 for f = xyz ⋅⋅ . • Note that the two AND functions are For the x, y, z combination (1,0,1), = ⋅⋅ unique. f will be one for f xyz (only). *Note that AND produces a single, unique output of 1 for only one combination of its inputs! 18 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Sum-of-Products Boolean Form (2)

• Now we wish to complete the x y z f(x, y, z) AND’s SOP Boolean expression for 0 0 0 0 0 0 1 0 the function which will result 0 1 0 0 in 1’s for the two cases shown. 0 1 1 1 xyz⋅⋅ • We know that in SOP form the 1 0 0 0 second level of Boolean 1 0 1 1 xyz⋅⋅ operator will be an OR. 1 1 0 0 1 1 1 0 • Thus we define f as: f =()() xyz ⋅⋅ + xyz ⋅⋅ For f = ()() xyz ⋅⋅ + xyz ⋅⋅ , note • The Boolean expression is fully that f = 1 only for the two cases in the defined. truth table. Try other combinations of x, y, and z to prove this to yourself.

19 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Boolean Notation; Minterms and Maxterms

• In SOP notation, which contain AND terms OR’ed together, the AND and the parentheses are often omitted for simplicity. • Thus, the SOP expression f =⋅⋅+⋅⋅+⋅⋅+⋅⋅( abc )( acd )( abd )( bcd ) could also be written as: f =+++ abc acd abd bcd . • The AND symbols are implied in this representation and are still used when the expression might not be clear if they were left out. • Since SOP is more compact, it is sometimes called the minterm form, and the AND components minterms. Similarly, POS is often referred to as the maxterm form, and the OR’s maxterms, since POS terms are more unwieldy: f =( abc ++ )( ⋅ acd ++ )( ⋅ bcd ++ ) • Since this is a customary terminology, the names minterm and maxterm will be used occasionally in future lectures.

20 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18

Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Product-of-Sums Boolean Form • A POS representation will contain x y z f(x, y, z) OR’s a first level of OR’s. 0 0 0 1 • In the SOP example, we looked 0 0 1 1 for the 1 outputs in f. 0 1 0 0 xyz++ • For POS, we look for outputs that 0 1 1 1 are 0.* 1 0 0 1 • Here, f is 0 only for two 1 0 1 1 combinations of x, y, and z. 1 1 0 0 xyz++ • We represent these conditions in 1 1 1 1 OR form. • Each OR will produce a 0 only for A truth table example, with 0’s the exact OR expression shown. represented by Boolean OR terms. *OR produces a single, unique output of 0 for only one combination of its inputs, just as AND produces a single unique output of 1 for only one combination of inputs. 21 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18

Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science POS Boolean Expressions (2)

x y z f(x, y, z) OR’s • We now complete the Boolean 0 0 0 1 POS expression for the truth 0 0 1 1 table shown. 0 1 0 0 xyz++ 0 1 1 1 • Since in POS, the second level 1 0 0 1 of logic will be an AND, we 1 0 1 1 know that the two OR terms 1 1 0 0 xyz++ must be ANDed together: 1 1 1 1

= ++ ⋅ ++ f=()() xyz ++ ⋅ xyz ++ For f ()() xyz xyz , note that f=0 only for the two cases • The Boolean expression is now in the truth table. Again, try other fully defined. combinations of x, y, and z to prove this to yourself. 22 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science SOP versus POS Representations (1) • Any Boolean expression can be a b f SOP POS represented in SOP or POS form. • Consider the truth table shown. 0 0 0 ab+ • If we represent f in SOP form, 0 1 0 ab+ = + we have f ab ab . 1 0 1 ab • If we represent f in POS form, we have f =+⋅+ ()() ab ab . 1 1 1 ab • Either representation is correct. In general, we pick the representation that is simplest. • The SOP form is used more frequently, simply because the notation is easier, but the POS form can have an advantage by making the Boolean function being represented much simpler to express.

23 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science SOP versus POS Representations (2)

• In the example at x y z f(x, y, z) OR’s AND’s the right (seen 0 0 0 0 xyz++ previously), note 0 0 1 0 xyz++ how the SOP form 0 1 0 0 xyz++ of the Boolean 0 1 1 1 xyz expression is much 1 0 0 0 xyz++ simpler. 1 0 1 1 x yz 1 1 0 0 xyz++ • We could also make 1 1 1 0 xyz++ up a truth table so that the POS form POS: f =()()() xyz ++ ⋅ xyz ++ ⋅ xyz ++ was much simpler ⋅()()()xyz ++ ⋅ xyz ++ ⋅ xyz ++ to use as the representation. SOP: f= xyz + x yz

24 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Exercise 2

• Let’s try our hand at starting with a truth table and developing the Boolean expression:

x y z f AND x y z f OR 0 0 0 1 0 0 0 0 0 0 1 1 SOP 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 POS 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1

25 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18

Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Finding the Truth Table, Given SOP Expression

• We can also go the other way, Boolean x y z f(x, y, z) AND’s expression → truth table. 0 0 0 0 0 0 1 0 • Consider the SOP Boolean expression: 0 1 0 0 f =+++ xyzxyzxyzxyz 0 1 1 1 xyz – The first term will be 1 when x, y, and z 1 0 0 0 1 0 1 1 x yz are 1, the second when x = y = 1, and z = 1 1 0 1 xyz x z y 0, the third when = = 1, and = 0, 1 1 1 1 xyz and the last when y = z = 1, and x = 0. Why would we want to go from Boolean • We insert the 1 outputs in the truth expression first to a truth table second? table at right. By default all the other Maybe we experimented in the lab to values of f must be 0. come up with a Boolean circuit to solve a problem and now we need to try to simplify it. Simplify it? We’ll talk about that in a few slides.

26 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Step-by-Step Logic Circuit Design

• We usually go truth table → circuit, x y f(x, y,) SOP Terms however. Consider this truth table: 0 0 0 • Output f will be 1 when x = 0, y = 1. 0 1 1 xy – The Boolean expression for this term is 1 0 1 xy xy . 1 1 0 • Output f is also 1 when x = 1, y = 0. x – The Boolean expression for this term is y xy xy . • The circuit equivalents of these two x xy AND terms are shown to the right. y

27 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Step-by-Step Logic Circuit Design (2)

• We now add the OR level to our SOP representation to get the circuit which will produce the correct output for all x possible input combinations of the two variables x and y. f • The resulting Boolean expressions is: y

f= xy + xy

28 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Another Boolean Function

• Suppose a specification has given us the following truth table: abc – a b c y a – 0 0 0 0 – 0 0 1 0 abc – 0 1 0 0 b y – 0 1 1 1 abc – 1 0 0 1 c – 1 0 1 1 – 1 1 0 0 The circuit implementation – 1 1 1 0 is shown above. • Then y =++ abc abc abc . Note that this is also in SOP form.

29 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Exercise 3: Specification → Circuit

• Now let’s try a design going from a b f “spec” to circuit. Below are 2 0 0 very simple “specs.” Use each 0 1 set to create (1) a truth table, (2) 1 0 a Boolean expression, and (3) the corresponding digital circuit. 1 1 x y g 1. A function f has inputs a and b. It’s output is true (or 1) only 0 0 when a is 1 and b is 0. 0 1 1 0 2. Function g has inputs x and y. Its output is 1 only when the 1 1 inputs are opposite (i.e., 1-0 or 0-1).

30 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Looking for the Simplest Expression

• Since Boolean expressions represent logical circuit functions that the engineer may want to build, it is always important to get the simplest Boolean circuit representation (simplest = cheapest). • Since we chose the SOP or POS form of Boolean expression to reduce the number of terms, one might think that the resulting circuit would be the simplest possible digital circuit. • Unfortunately, even a SOP or POS Boolean expression may NOT be in the simplest form! • However, it is possible to reduce a Boolean expression to its simplest form using the simple identities and relations that we discussed earlier (in a future lecture, we will study simplification of a circuit using a graphical technique called the Karnaugh Map).

31 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Boolean Theorems: Commutativity

• Boolean relations follow simple rules. We discuss some of these rules or principles before developing more complex functions. The first is commutativity: – The Boolean functions AND and OR are commutative. That is: x · y = y · x, and x + y = y + x – Using logic circuits, we can illustrate this as:

a b a b = = a ·b = a + b b a b a

32 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Distributivity • The AND and OR functions are both distributive: x·(y+z) = (x·y) + (x·z), and x + (y·z) = (x+y) · (x+z) • We can illustrate the AND version of this relation as:

x x x·(y+z) y y = (x·y)+(x·z) z x z • The OR version can be illustrated similarly. If you don’t believe these assertions, make up the two AND truth tables and prove it to yourself! 33 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Other Fundamental Boolean Theorems

• The following Boolean theorems are often useful: OR Form AND Form • x+0=x • x·1 = x • xx += 1 • xx⋅=0 • x+x=x • x·x=x • x+1=1 • x·0=0 • And, finally, we note that: • xx=

34 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science DeMorgan’s Laws

• One other useful relationship in manipulating Boolean expressions is DeMorgan’s Law. There are OR and AND versions of the law. • The OR version of DeMorgan’s law states that the complement of (x OR y) is equal to x-complement AND y-complement, or: x +=⋅ y xy (This may also be stated as: x +=⋅ y xy .) • Likewise, the AND version states that the complement of (x AND y) is equal to x-complement OR y-complement, or: xy ⋅=+ x y (This may also be stated as: xy ⋅=+ x y .)

35 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Simplifying a Boolean Expression

• Consider the following Boolean expression: f = abc + abc . • Is this the simplest possible POS expression? Clearly, the expression is in proper SOP form. However, as stated earlier, even a proper SOP function may not be in the simplest form. • Since Boolean expressions are distributive ([ab+]=a[b+c]), we can express the above as: f = ab () c + c . • Now, from the Boolean identity list, we know that cc += 1 . Substituting, f = ab ( c +=⋅ c ) ab (1) = ab . • Clearly this second Boolean expression, which is equivalent, is much the simpler and therefore, easier and cheaper to build.

36 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science A More Complicated Example • Assume the following expression: f = ((( abc + ab + bc)) ⋅+ a b ⋅ c) + abc a b c f AND • This expression is certainly NOT in 0 0 0 0 proper SOP or POS form. 0 0 1 0 • However, we can input its values in the truth table at the right. Using 0 1 0 0 the truth table, the equivalent SOP 0 1 1 1 abc expression is f = abc + abc . 1 0 0 0 • Using Boolean identity xx += 1 , 1 0 1 0 f = abc + abc =+⋅ () a a bc . 1 1 0 0 • aa+= Since ( )1 , then f = bc is the 1 1 1 1 abc simplified SOP term.

37 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Implementation of Three Forms

a

b f

c

Original circuit a

b f f b c Proper Simplified SOP Form SOP Form c 38 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Exercise 4

• A Boolean expression f x y f has two inputs, x and y. 0 0 • The output is 1 when x 0 1 and y are both 1 or when x = 0 and y = 1. 1 0 • Construct a truth table. 1 1 • Develop an SOP expression. • Simplify if possible. • Draw the circuit.

39 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Summary • Digital circuits are electronic implementations of Boolean expressions. • Computer circuits are all composed of logic gates such as we have discussed: AND, OR, NOT, NAND, NOR, etc. • Logic circuits whose outputs only depend on their inputs are called combinational logic. • Combinational logic with more than two levels of logic may always be simplified into sum of products (SOP) or product of sums (POS) form using a truth table. • An SOP (or POS) expression may not always be in the simplest possible form. We can use De Morgan’s Law or other Boolean identities to simplify an expression, if simplification is possible. • The actual electronic devices that make up logic circuits will not be discussed in EE 2310, but will be covered in future courses.

40 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18 Erik Jonsson School of Engineering and The University of Texas at Dallas Computer Science Design Problem • You have now seen how to go from a requirement to a truth table to a Boolean Expression to a circuit (and even how to simplify the circuit). • You now get to do a design. Do a first try by yourself. Then you may review and complete your design with your EE 2310 lab partner. • Here is the requirement (“spec”): A circuit has three input variables, x, y, and z. Its output is 1 for the conditions x, y, z = 0, x, y = 0; z = 1, and x = 0; y, z = 1. Do the following: – Make a truth table from the requirements. – Devise an SOP Boolean expression from the truth table. Simplify it using the relationships discussed today, but keep in SOP form. (Do not use a Karnaugh map!) – In EE 2310 Lab. 1, build your design (see Lab. 1 instructions). – Using all combinations of the 8 input variables, demonstrate with your partner to the lab TA that your real circuit obeys your truth table. 41 Lecture #4: Boolean Algebra and Combinational Digital Logic © N. B. Dodge 8/18