lec4 digital logic

40
Erik Jonsson School of Engineering and Computer Science The University of Texas at Dallas © N. B. Dodge 9/15 1 Lecture #4: Boolean Algebra and Combinational Digital Logic Boolean Algebra Boolean Algebra (named for its developer, George Boole), is the algebra of digital logic circuits that all computers 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.”

Upload: alphabennydelta4468

Post on 11-Jan-2016

255 views

Category:

Documents


0 download

DESCRIPTION

digital logic

TRANSCRIPT

Page 1: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 1 Lecture #4: Boolean Algebra and Combinational Digital Logic

Boolean Algebra • Boolean Algebra (named for its developer, George Boole), is the algebra of

digital logic circuits that all computers 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.”

Page 2: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 2 Lecture #4: Boolean Algebra and Combinational Digital Logic

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 digital data transmission [“it’s all bits”]).

• Despite many contributors Boolean Algebra is mostly unchanged. • Boolean Algebra is “1-0 logic.”

– 0 = “off,” “not present,” “false,” “de-asserted.” – 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.

Very important statement!!!!

Page 3: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 3 Lecture #4: Boolean Algebra and Combinational Digital Logic

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: – Combinational 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 Boolean

function* 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.

Page 4: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 4 Lecture #4: Boolean Algebra and Combinational Digital Logic

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

aa

f a=

Page 5: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 5 Lecture #4: Boolean Algebra and Combinational Digital Logic

Truth Tables • The input/output relationship is

easy to show for an inverter (see last slide).

• For more complex functions, a table of outputs versus inputs is helpful.

• Such a table is called a truth table, since the table indicates the 1 (or “true”) outputs, although the table normally shows outputs for all input combinations.

• We will use truth tables to demonstrate many Boolean functions.

Boolean Function Truth Table Input x Input y Output f

0 0 0

0 1 1

1 0 1

1 1 0

Page 6: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 6 Lecture #4: Boolean Algebra and Combinational Digital Logic

Logical AND

• AND has two or more inputs. • The truth table for a two-input AND with

a and b inputs is shown in the chart. • AND is defined as follows: a AND b = 1 if

and only if (iff) a = 1 and b = 1. • Mathematically, we represent “a AND b”

as (an unfortunate choice). • AND may have more than two inputs, i.

e.: a AND b AND c AND d. • The electronic circuit symbols for 2- and

4-input AND’s are shown at the right. • Regardless of the number of inputs, the

output of AND is 1 iff all inputs are 1.

a b⋅a b

2-Input AND

4-Input AND

a b⋅

a b c d⋅ ⋅ ⋅b c a

d

a b a AND b0 0 00 1 01 0 0

1 1 1

AND Truth Table

Page 7: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 7 Lecture #4: Boolean Algebra and Combinational Digital Logic

Logical OR • OR has two or more inputs. • The truth table for two inputs a, b is shown

in the adjacent chart. • OR is defined as follows: a OR b = 1 if

either a or b or both a and b = 1. • Another way to way this is that a OR b = 0

iff a = b = 0. • Mathematically, we represent “a OR b” as

(another bad choice). • OR may have many inputs, e. g.: a+b+c+d. • The electronic circuit symbols for 2- and 4-

input OR’s are shown at the right. • Regardless of the number of inputs, the

output of OR is 0 iff all inputs are 0.

a b+

a 2-Input OR

4-Input OR

a b

b d c

a b+

a b c d+ + +

a b a OR b0 0 00 1 11 0 1

1 1 1

OR Truth Table

Page 8: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

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

Illustration of AND and OR with “Goofy Flashlights”

• The AND “goofy flashlight” is a circuit connecting batteries to a light bulb via series switches, a & b.

• The bulb will be lighted only if both switches are closed.

• Thus we say that the “AND light bulb function” = a AND b = a · b.

• The OR “goofy flashlight” connects batteries to a light bulb via parallel switches, a & b.

• The bulb will be lighted if either switch is closed.

• Thus we say that the “OR light bulb function” = a OR b = a + b.

Switches

Light Bulb

AND

a·b

a b Batteries

OR

a+b a

b

Page 9: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 9 Lecture #4: Boolean Algebra and Combinational Digital Logic

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 , and a NOR b is written as • 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.

a b

a b

NAND NOR a b a b

a b a NOR b 0 0 1 0 1 0 1 0 0 1 1 0

NOR Truth Table NAND Truth Table a b a NAND b 0 0 1 0 1 1 1 0 1 1 1 0

a b⋅

a b⋅

a b+

a b+

a b⋅ a b+

Page 10: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 10 Lecture #4: Boolean Algebra and Combinational Digital Logic

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.

• We will look at the entire process later: Let’s now examine the Boolean function → circuit design process.

Page 11: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 11 Lecture #4: Boolean Algebra and Combinational Digital Logic

Circuit Derived from Boolean Expression

• Assume we have some Boolean functions that represent computer circuits that we want to design. How do we go from the Boolean function to the computer circuit?

• Consider these functions: (finally, a more complicated one!):

f a b c= + +f a b= +

( )f a b c= ⋅ +

( ) ( )f a b c d= + ⋅ +

1:

2:

3:

4:

Page 12: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 12 Lecture #4: Boolean Algebra and Combinational Digital Logic

Exercise 1 • Now let’s try a few digital

circuit designs from theBoolean expressions:

f a b c= ⋅ ⋅

( )f a b c= + ⋅

( ) ( )f a b c d= + ⋅ ⋅

( )f a b c d= + ⋅ +

Page 13: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 13 Lecture #4: Boolean Algebra and Combinational Digital Logic

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.

Page 14: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 14 Lecture #4: Boolean Algebra and Combinational Digital Logic

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

– 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, is also SOP, even with inverted inputs.

* Remember, AND and OR symbols look like the “times” and “plus” symbols, hence the names SOP and POS.

( ) ( )f a b c d= ⋅ + ⋅

( ) ( )g a b c d= ⋅ + ⋅

AND Level

OR Level SOP Illustration: ( ) ( )f a b c d= ⋅ + ⋅

Page 15: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 15 Lecture #4: Boolean Algebra and Combinational Digital Logic

SOP and POS (Continued)

• A “Product of Sums” looks like this: . – 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, is also POS. It is also 2-

level, even though there are also two variable inversions.

( ) ( )f a b c d= + ⋅ +

( ) ( )g a b c d= + ⋅ +

AND Level

OR Level POS Illustration: ( ) ( )f a b c d= + ⋅ +

Page 16: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 16 Lecture #4: Boolean Algebra and Combinational Digital Logic

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.

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

Establish inputs and

outputs

Construct Truth Table

Define Boolean expression in

SOP or POS form

Design digital circuit based on Boolean

expression

Page 17: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 17 Lecture #4: Boolean Algebra and Combinational Digital Logic

Examples: Sum-of-Products Form • Assume that we have a specification that

gives the outputs of function f for the 8 possible combinations of inputs x, y, z.

• We can then build the truth table shown. • Note that the output is “true” (=1) for

only two combinations of the inputs. If we make the Boolean expression SOP, the first level (which has the most terms) will have only two AND terms.*

• We then define the two AND functions that result in 1’s being output from the function f for each x, y, z combination.

• Note that the two AND functions are unique.

*Note that AND produces a single, unique output of 1 for only one combination of its inputs!

x y z f(x, y, z) AND’s 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0

x y z⋅ ⋅

x y z⋅ ⋅

For the x, y, z combination (0,1,1), f will only be 1 for . For the x, y, z combination (1,0,1), f will be one for (only).

f x y z= ⋅ ⋅

f x y z= ⋅ ⋅

Page 18: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

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

Sum-of-Products Boolean Form (2)

• Now we wish to complete the SOP Boolean expression for the function which will result in 1’s for the two cases shown.

• We know that in SOP form the second level of Boolean operator will be an OR.

• Thus we define f as:

• The Boolean expression is fully defined.

For , note that f = 1 only for the two cases in the truth table. Try other combinations of x, y, and z to prove this to yourself.

x y z f(x, y, z) AND’s 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0

x y z⋅ ⋅

x y z⋅ ⋅

( ) ( )f x y z x y z= ⋅ ⋅ + ⋅ ⋅ ( ) ( )f x y z x y z= ⋅ ⋅ + ⋅ ⋅

Page 19: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 19 Lecture #4: Boolean Algebra and Combinational Digital Logic

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 could also be written as: . • 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:

• Since this is a customary terminology, the names minterm and maxterm will be used occasionally in future lectures.

( ) ( ) ( ) ( )f a b c a c d a b d b c d= ⋅ ⋅ + ⋅ ⋅ + ⋅ ⋅ + ⋅ ⋅f abc acd abd bcd= + + +

( ) ( ) ( )f a b c a c d b c d= + + ⋅ + + ⋅ + +

Page 20: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

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

Product-of-Sums Boolean Form • A POS representation will contain

a first level of OR’s. • In the SOP example, we looked

for the 1 outputs in f. • For POS, we look for outputs that

are 0.* • Here, f is 0 only for two

combinations of x, y, and z. • We represent these conditions in

OR form. • Each OR will produce a 0 only for

the exact OR expression shown. A truth table example, with 0’s 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.

x y z f(x, y, z) OR’s 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1

x y z+ +

x y z+ +

Page 21: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 21 Lecture #4: Boolean Algebra and Combinational Digital Logic

POS Boolean Expressions (2)

• We now complete the Boolean POS expression for the truth table shown.

• Since in POS, the second level of logic will be an AND, we know that the two OR terms must be ANDed together:

• The Boolean expression is now fully defined.

x y z f(x, y, z) OR’s 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1

x y z+ +

x y z+ +

For , note that f=0 only for the two cases in the truth table. Again, try other combinations of x, y, and z to prove this to yourself.

( ) ( )f x y z x y z= + + ⋅ + +( ) ( )f x y z x y z= + + ⋅ + +

Page 22: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 22 Lecture #4: Boolean Algebra and Combinational Digital Logic

SOP versus POS Representations (1) • Any Boolean expression can be represented in SOP or POS form. • Consider the truth table shown. • If we represent f in SOP form, we have . • If we represent f in POS form, we have . • 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.

a b f SOP POS 0 0 0 0 1 0 1 0 1 ab 1 1 1 ab

a b+a b+

f ab ab= +

( ) ( )f a b a b= + ⋅ +

Page 23: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 23 Lecture #4: Boolean Algebra and Combinational Digital Logic

SOP versus POS Representations (2) • In the example at

the right (seen previously), note how the SOP form of the Boolean expression is much simpler.

• We could also make up a truth table so that the POS form was much simpler to use as the representation.

x y z f(x, y, z) OR’s AND’s 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 x y z+ +

x y z+ +

x y z+ +

x y z+ +x y z+ +

x y z+ +

xyz

x yz

POS: SOP:

( ) ( ) ( )

( ) ( ) ( )

f x y z x y z x y z

x y z x y z x y z

= + + ⋅ + + ⋅ + +

⋅ + + ⋅ + + ⋅ + +

f xyz x yz= +

Page 24: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 24 Lecture #4: Boolean Algebra and Combinational Digital Logic

Exercise 2 • Let’s try our hand at starting with a truth table and developing the

Boolean expression:

x y z f AND 0 0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1

x y z f OR 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1

SOP POS

f x yz x yz xyz= + + ( ) ( )f x y z x y z= + + ⋅ + +

Page 25: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

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

Finding the Truth Table, Given SOP Expression • We can also go the other way, Boolean

expression → truth table. • Consider the SOP Boolean expression:

– The first term will be 1 when x, y, and z

are 1, the second when x = y = 1, and z = 0, the third when x = z = 1, and y = 0, and the last when y = z = 1, and x = 0.

• We insert the 1 outputs in the truth table at right. By default all the other values of f must be 0.

Why would we want to go from Boolean expression first to a truth table second? Maybe we experimented in the lab to 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.

f xyz xyz x yz xyz= + + +

x y z f(x, y, z) AND’s 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1

x yz

xyz

xyzxyz

Page 26: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 26 Lecture #4: Boolean Algebra and Combinational Digital Logic

Step-by-Step Logic Circuit Design

• We usually go truth table → circuit, however. Consider this truth table:

• Output f will be 1 when x = 0, y = 1. – The Boolean expression for this term is .

• Output f is also 1 when x = 1, y = 0. – The Boolean expression for this term is .

• The circuit equivalents of these two AND terms are shown to the right.

x y

x y

xy

x y

x y f(x, y,) SOP Terms 0 0 0 0 1 1 1 0 1 1 1 0

xyx y

xy

x y

Page 27: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 27 Lecture #4: Boolean Algebra and Combinational Digital Logic

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 possible input combinations of the two variables x and y.

• The resulting Boolean expressions is:

x

y

f

f xy x y= +

Page 28: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 28 Lecture #4: Boolean Algebra and Combinational Digital Logic

• Then . Note that this is also in SOP form.

Another Boolean Function • Suppose a specification has given

us the following truth table: – a b c y – 0 0 0 0 – 0 0 1 0 – 0 1 0 0 – 0 1 1 1 – 1 0 0 1 – 1 0 1 1 – 1 1 0 0 – 1 1 1 0

The circuit implementation is shown above.

a

b c

y

abc

abc

abc

y abc abc abc= + +

Page 29: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 29 Lecture #4: Boolean Algebra and Combinational Digital Logic

Exercise 3: Specification → Circuit • Now let’s try a design going from

“spec” to circuit. Below are 2 very simple “specs.” Use each set to create (1) a truth table, (2) a Boolean expression, and (3) the corresponding digital circuit.

1. A function f has inputs a and b.

It’s output is true (or 1) only when a is 1 and b is 0.

2. Function g has inputs x and y.

Its output is 1 only when the inputs are opposite (i.e., 1-0 or 0-1).

0 0 0 1 1 0 1 1

a b f

0 0 0 1 1 0 1 1

x y g

0

0

1

0

0

1

1

0

f ab=

( ) ( )g xy x y= +

( ) ( )g x y x y= + ⋅ +

Page 30: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 30 Lecture #4: Boolean Algebra and Combinational Digital Logic

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

Page 31: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 31 Lecture #4: Boolean Algebra and Combinational Digital Logic

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 = b

a = a ·b a b = b

a a + b

Page 32: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 32 Lecture #4: Boolean Algebra and Combinational Digital Logic

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:

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

= x y z

x·(y+z) (x·y)+(x·z)

x y

x z

Page 33: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 33 Lecture #4: Boolean Algebra and Combinational Digital Logic

Other Fundamental Boolean Theorems

• The following Boolean theorems are often useful: OR Form AND Form • x+0=x • x·1 = x • • • x+x=x • x·x=x • x+1=1 • x·0=0

• And, finally, we note that: • x x=

1x x+ = 0x x⋅ =

Page 34: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 34 Lecture #4: Boolean Algebra and Combinational Digital Logic

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:

(This may also be stated as: .)

• Likewise, the AND version states that the complement of (x AND y) is equal to x-complement OR y-complement, or:

(This may also be stated as: .)

x y x y+ = ⋅x y x y+ = ⋅

x y x y⋅ = +x y x y⋅ = +

Page 35: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 35 Lecture #4: Boolean Algebra and Combinational Digital Logic

Simplifying a Boolean Expression

• Consider the following Boolean expression: . • 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+ac]=a[b+c]), we can express the above as: .

• Now, from the Boolean identity list, we know that . Substituting, .

• Clearly this second Boolean expression, which is equivalent, is much the simpler and therefore, easier and cheaper to build.

f abc abc= +

( )f ab c c= +

( ) (1)f ab c c ab ab= + = ⋅ =1c c+ =

Page 36: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 36 Lecture #4: Boolean Algebra and Combinational Digital Logic

A More Complicated Example • Assume the following expression: • This expression is certainly NOT in

proper SOP or POS form. • However, we can input its values in

the truth table at the right. Using the truth table, the equivalent SOP expression is .

• Using Boolean identity (x + x) = 1,

. • Since , then f = bc is the

simplified SOP term.

a b c f AND

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

( )(( ) )f abc ab bc a b c abc= + + ⋅ + ⋅ +

f abc abc= +

( )f abc abc a a bc= + = + ⋅( ) 1a a+ = abc

abc

Page 37: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 37 Lecture #4: Boolean Algebra and Combinational Digital Logic

Implementation of Three Forms

Original circuit

f

a

b

c

Proper SOP Form

b fcSimplified SOP Form

f

c

b

a

Page 38: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 38 Lecture #4: Boolean Algebra and Combinational Digital Logic

Exercise 4 • A Boolean expression f

has two inputs, x and y. • The output is 1 when x

and y are both 1 or when x = 0 and y = 1.

• Construct a truth table. • Develop an SOP

expression. • Simplify if possible. • Draw the circuit.

x y f 0 0 0 1 1 0 1 1

0

1

0

1

y f

f xy xy= +( )f y x x= ⋅ +

f y=

Page 39: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 39 Lecture #4: Boolean Algebra and Combinational Digital Logic

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.

Page 40: lec4 digital logic

Erik Jonsson School of Engineering and Computer Science

The University of Texas at Dallas

© N. B. Dodge 9/15 40 Lecture #4: Boolean Algebra and Combinational Digital Logic

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.