+ All Categories
Home > Documents > Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital...

Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital...

Date post: 18-Mar-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
25
Lecture 26: Boolean algebra and digital logic DANIEL WELLER THURSDAY, APRIL 25, 2019
Transcript
Page 1: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Lecture 26: Boolean algebra and digital logicDANIEL WELLER

THURSDAY, APRIL 25, 2019

Page 2: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

AgendaBoolean algebra and logical operations

Truth tables

Digital computation

Integrated circuits

An integrated circuit or computer chip contains large quantities of transistors that enable digital computation via logical operations governed by Boolean algebra.

2

Page 3: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Boolean algebra and digital logicComputers, smartphones, and digital technology are composed of millions (even billions) of tiny computational units called logic gates. These logic gates perform very simple operations on data, which can be organized to carry out more complicated computations.

Boolean algebra is the branch of mathematics that describes the logical operations these gates perform.

Today, we’ll briefly introduce these basic operations and discuss how gates can be used together to perform computation.

Next time, we’ll wrap up our discussion of digital logic and computation and review for the final exam.

3

Page 4: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Boolean algebraBoolean algebra’s name comes from the mathematician George Boole, who constructed a way to manipulate Boolean variables (true or false) using logic.

The binary nature of these variables makes this algebra the ideal tool to describe operations on binary data found in computers (even when these variables don’t have any direct logical interpretation).

4

Page 5: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Boolean algebra and digital logicBoole originally constructed his system of logic and Boolean algebra as an algebraic expression of philosophical logic, as a more mathematical means of constructing arguments.

The employment of Boolean algebra in digital computation was not until Claude Shannon (remember him?) had a revolutionary idea that he could use logic to construct a computer.

5

Image credit: user:Autopilot/Wikipedia.

Page 6: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Logical operations: building blocksFor a single bit, Boole described several simple operations:

◦ Identity: output the same bit that was input; x x

◦ Not or negation: output the opposite of what was input; x ~x

◦ Set false: output a zero regardless of the input; x 0

◦ Set true: output a one regardless of the input; x 1

6

𝑿 ID0 01 1

𝑿 NOT0 11 0

𝑿 SET00 01 0

𝑿 SET10 11 1

(Circuit symbol) (Circuit symbol)

Note the circle indicates negation

Page 7: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Logical operations: building blocksFor a function of two binary inputs, there are sixteen possible functions:

The more commonly used ones have circuit symbols as well:

7

𝑿 𝒀

SET0

AN

D

XO

R

OR

NO

R

XN

OR

NO

T

NO

T

NA

ND

SET10 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 10 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Page 8: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Brief quizLet’s identify the following logical operations based on their circuit symbols:

8

Page 9: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Universal operatorsIt turns out that we don’t need all these different gates to implement digital logic. In fact, some operations are capable of constructing all the other operators by themselves.

◦ These are called universal operators.

Two common universal operators are the NAND and NOR gates. All the other logical operations can be expressed using just one type of logic gate.

The NAND gate with its inputs connected together becomes a NOT gate. So a cascade of two NAND gates becomes an AND gate. Similarly, NAND gates on each input becomes an OR gate:

9

= =

Page 10: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Universal operatorsThis universality is a consequence of DeMorgan’s Laws:

𝑁𝑂𝑇 𝑥 𝐴𝑁𝐷 𝑦 = 𝑁𝑂𝑇 𝑥 𝑂𝑅 𝑁𝑂𝑇 𝑦𝑁𝑂𝑇 𝑥 𝑂𝑅 𝑦 = 𝑁𝑂𝑇 𝑥 𝐴𝑁𝐷 𝑁𝑂𝑇 𝑦

This way, NAND gates (NOT (x AND y)) and NOR gates (NOT (x OR y)) can be used to substitute for any of the other logic gates.

In fact, we will see how to construct arbitrary logical operations with many inputs from building blocks like these!

10

Page 11: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Truth tablesA truth table consists of a set of inputs and a set of outputs, arranged as a series of table columns. Each row of the table contains specific values for each of the inputs and the corresponding output values.

For instance, here is the truth table again for all possible two-input Boolean operations:

11

𝑿 𝒀

SET0

AN

D

XO

R

OR

NO

R

XN

OR

NO

T

NO

T

NA

ND

SET1

0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 10 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Page 12: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Truth tablesUnfortunately, more general logic operations don’t have simple names and designs. However, a truth table can help us discover how to implement them using logic gates:

12

X Y Z OUT

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 0

1 0 1 1

1 1 0 0

1 1 1 1

𝑂𝑈𝑇 = ~𝑋 ~𝑌 𝑍 + ~𝑋 𝑌 ~𝑍 + 𝑋 ~𝑌 𝑍 + 𝑋𝑌𝑍

Boolean algebra enables us to compact and simplify these expressions using commutativity, associativity, distributivity, and similar properties.

For example:

𝑂𝑈𝑇 = ~𝑋 ~𝑌 𝑍 + ~𝑋 𝑌 ~𝑍 + 𝑋 ~𝑌 + 𝑌 𝑍

𝑂𝑈𝑇 = ~𝑋 ~𝑌 𝑍 + ~𝑋 𝑌 ~𝑍 + 𝑋𝑍

Page 13: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Boolean algebraAs in normal arithmetic, Boolean algebra operations have an order of precedence:

◦ Parentheses (overrides other order of operations)

◦ NOT (think negation)

◦ AND (think multiplication)

◦ OR/XOR (think addition)

Boolean operators also follow commutativity, associativity, and distributive properties:◦ Commutativity: AB = BA, A+B = B+A

◦ Associativity: ABC = (AB)C = A(BC), A+B+C = (A+B)+C = A+(B+C)

◦ Distributivity: A(B+C) = AB+AC, A+BC = A+AB+AC+BC = (A+B)(A+C)

13

Consider this last one carefully…

Page 14: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Boolean algebraSimplify the following expressions:

𝐴𝐶 + 𝐴𝐵 + 𝐴 ~𝐶

𝑋 + 𝑌 ~𝑋 + ~𝑌

14

Page 15: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Logic and computationWhile digital logic design deserves (and is) a full course on its own, let’s get a taste of how digital computation can be expressed in terms of logic through a simple “adder” circuit.

First, we’ll design a circuit that adds two single-digit binary numbers (the “half adder”). Then, we’ll expand this circuit to allow a “carry in” from a previous addition. This “full adder” can be used to perform addition of binary numbers with many digits.

Let’s start with the truth table for the half adder:

15

A

0

0

1

1

B

0

1

0

1

Sum

0

1

1

0

Carry

0

0

0

1

Page 16: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

The half adderFrom this truth table, we can write and simplify Boolean expressions for the two outputs:

Sum = A(~B) + B(~A)

Carry = AB

From these, we construct a circuit diagram:

◦ The connected wire paths are known as nets.

16

A

0

0

1

1

B

0

1

0

1

Sum

0

1

1

0

Carry

0

0

0

1

Net 1

Net 2

A

B

CARR Y

SUM

Page 17: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

The full adderThe full adder introduces a third input, the “carry in”, that would be the output of an earlier adder circuit (e.g., for a lower order digit in a multi-bit binary number).

◦ The new truth table has 8 rows (23 = 8)

From this, we can construct expressions for both outputs:

Sum = (~A)(~B)Cin + (~A)B(~Cin) + A(~B)(~Cin) + AB Cin

Cout = (~A)B Cin + A(~B)Cin + AB(~Cin) + AB Cin

17

A 0 0 0 0 1 1 1 1

B 0 0 1 1 0 0 1 1

C in 0 1 0 1 0 1 0 1

S um 0 1 1 0 1 0 0 1

C out 0 0 0 1 0 1 1 1

Page 18: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

The full adderWe could construct a full adder directly from AND, OR, and NOT gates.

Or, we could construct it from a pair of half adders. This is why the half adder is a half adder.◦ We also need an OR gate at the end…

◦ This is like addition the handwritten way. If we carry a “1” in, addition is with three numbers, two at a time.

18

Sum

Cout

A

B

Cin

A

B

Sum

Carry

HA A

B

Sum

Carry

HA

Page 19: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Full addersWe can chain multiple full adders together to do addition with many bits…

How do we do subtraction?◦ Remember two’s complement binary representations?

◦ Answer: we flip the input bits and carry-in the one.

19

Image credit: circuitstoday.com

Page 20: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Your turnHere’s a truth table. Describe and draw out the digital circuit for implementing this design:

20

X Y Z OUT1 OUT2

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 1

1 0 0 0 1

1 0 1 1 1

1 1 0 1 1

1 1 1 1 0 What does this circuit do?

Page 21: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Integrated circuitsThe cornerstone of modern digital devices is the integrated circuit (IC, chip) that can store and process data. Computers, iPhones, automobiles, airplanes all contain large numbers of IC’s.

But what is it?

An IC is composed of lots of transistors all fabricated on a single material or substrate. These transistors are circuit elements with special properties that make them useful for building logic gates.

Since they are all fabricated and wired together, we say the resulting circuit is integrated.◦ This integration distinguished IC’s from discrete circuits, where the individual elements are on separate

substrates, wired together.

21

Page 22: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

What is a transistor?A transistor is a three-terminal circuit element that allows or impedes the flow of current between the Source and Drain terminals, depending on the voltage of the Gate input.

In common silicon devices, we find complimentary metal-oxide-semiconductor (CMOS) transistor designs, which pair up two opposite forms of transistors: the pMOS and the nMOS.

22

Logic 0 (low voltage) on gate,

Source and Drain connected

Gate

Source Drain

Gate

Source Drain

nMOS Transistor

pMOS Transistor

Logic 1 (high voltage) on gate,

Source and Drain connected

Page 23: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

What is a transistor?Such a transistor is composed of three different kinds of materials:

◦ Semiconductor, whose conductivity can change between an insulator and a conductor

◦ Metal, which serves as a conductor

◦ Oxide, which serves as an insulator

The particular arrangement of these materials allows the presence or absence of voltage at a gate terminal to control the flow of current, or the voltage connection, between the source and drain.

The pMOS and nMOS types use different chemicals added to the silicon to produce the desired effect. Electrical engineering courses on solid state devices and electronics provide a thorough study of these.

23

Page 24: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

Transistors through the ages…Transistors began as relatively crude designs and have been refined and miniaturized until we can now fit billions on a single computer chip!

24

Image credit: https://www.techspot.com/news/60418-50-years-moore-law-fun-facts-timeline-infographic.html

Page 25: Lecture 26: Boolean algebra and digital logicffh8x/d/soi19S/Lecture26.pdfBoolean algebra and digital logic Computers, smartphones, and digital technology are composed of millions (even

AnnouncementsNext class: Digital computing, final exam review

Homework 8 due today.

ECE 2066: Lab 8 due on Tuesday; no lab on April 30

25


Recommended