31
1011011 + 1001101 ----------- 10101000 At the bottom, all data is binary

1011011 + 1001101 ----------- 10101000 At the bottom, all data is binary

Embed Size (px)

Citation preview

1011011+ 1001101-----------10101000

At the bottom, all data is binary

If 0’s and 1’s are the fundamental “atoms” of information, what are the mechanisms via which they interact?

How does information “get processed”, or computation on information occur?

What are the basic operations?

Key QuestionsKey Questions

Gates and CircuitsGates and Circuits

GoalsGoals

Learn function of basic logic gates AND, Learn function of basic logic gates AND, OR, NOT, XOR, NAND, NOROR, NOT, XOR, NAND, NOR

Learn how gates can be combined into Learn how gates can be combined into simple circuits.simple circuits.

Given a circuit, a truth-table, or a Given a circuit, a truth-table, or a Boolean formula, construct the other Boolean formula, construct the other two.two.

Explain the concept of universality of a Explain the concept of universality of a collection of gates.collection of gates.

Explain how transistors can act as logic Explain how transistors can act as logic gates.gates.

““OR” gateOR” gate

AA BB A+BA+B

00 00 00

00 11 11

11 00 11

11 11 11

truth table

outputinputs

inputs

output

““AND” gateAND” gate

AA BB A·BA·B

00 00 00

00 11 00

11 00 00

11 11 11

“truth table”

outputinputs

inputs

output

““NOT” gateNOT” gate

AA ~A, A’, ~A, A’, A,¬AA,¬A

00 11

11 00

truth table

outputinputinput

output

Another view: Another view: arithmeticarithmetic

++

00 11

00 00 11

11 11 11

A

B

··

00 11

00 00 00

11 00 11

A

B

AND = MultiplicationOR = Addition

Elwood the Electronic Watchdog

Elwood the Electronic Watchdog

dd pp ss woowooff

00 00 00

00 00 11

00 11 00

00 11 11

11 00 00

11 00 11

11 11 00

11 11 11

output w = d+ps

Use boolean arithmetic to evaluate!

Elwood the Electronic Watchdog

dd pp ss woowooff

00 00 00

00 00 11

00 11 00

00 11 11

11 00 00

11 00 11

11 11 00

11 11 11

output w = d+ps

-example: 010

0 + 10= 0 + 0= 0

0

-example: 011 ?

1

CHALLENGECHALLENGE

A’BA’B1.Draw Circuit2.Give Truth Table

AA BB A’BA’B

00 00

00 11

11 00

11 11

CHALLENGE: CHALLENGE: circuit to circuit to truth tabletruth table

What is truth table?What is truth table?

- Use the labeling method- Use the labeling method

A

B

C

AA BB CC outpuoutputt

00 00 00

00 00 11

00 11 00

00 11 11

11 00 00

11 00 11

11 11 00

11 11 11

and

and not

not

or

CHALLENGE: CHALLENGE: circuit to circuit to formulaformula

What is formula?What is formula?

- Use the labeling method- Use the labeling method

A

B

C

and

and not

not

or

CHALLENGE: CHALLENGE: formula to formula to circuitcircuit

Construct circuitConstruct circuit

A(B+C’)(C+D) + BC(A’+D)

TOP-DOWN APPROACH

CHALLENGE: CHALLENGE: formula to formula to truth tabletruth table

Simply plug in values and simplify!Simply plug in values and simplify!

A(B+C’)(C+D) + BC(A’+D)

Example: Find value if A=1, B=0, C=0, D=1

1(0+1)(0+1) + 00(0+1)= 1(1)(1) + 00(1)= 1 + 0= 1

Formula

Circuit Truth Table

w = d+ps

?

?

Circuit DesignCircuit DesignWe can now do the following:We can now do the following:• From formula or circuit, get From formula or circuit, get the otherthe other• From formula or circuit, get From formula or circuit, get the truth tablethe truth table

Given truth table (desired Given truth table (desired behavior), how can you behavior), how can you construct a formula?construct a formula?

Given truth table (desired Given truth table (desired behavior), how can you behavior), how can you construct a circuit?construct a circuit?

Important QuestionImportant Question

Are there circuits and formulas Are there circuits and formulas

for for every every possible Truth Table?possible Truth Table?

In other words, if I tell you what In other words, if I tell you what output behavior I want, for all output behavior I want, for all combinations of input values, can combinations of input values, can you create a formula and circuit you create a formula and circuit which realizes that behavior? which realizes that behavior?

Sum-of-Products methodSum-of-Products method

AA BB CC outpuoutputt

00 00 00 00

00 00 11 11

00 11 00 00

00 11 11 11

11 00 00 00

11 00 11 00

11 11 00 00

11 11 11 11

A’B’C

A’BC

ABC

A’B’C + A’BC + ABC

Expression is giant Expression is giant “OR” (+), with terms “OR” (+), with terms corresponding to each corresponding to each row of truth table row of truth table with a “1” output.with a “1” output.

The term for a row is The term for a row is a product of a product of variables, one for variables, one for each input, and each input, and either negated (if 0) either negated (if 0) or unnegated (if 1). or unnegated (if 1).

Sum-of-Products methodSum-of-Products method

AA BB CC outpuoutputt

00 00 00

00 00 11

00 11 00

00 11 11

11 00 00

11 00 11

11 11 00

11 11 11

EXAMPLE 2: (you do it)

UniversalityUniversality

The sum-of-products method shows The sum-of-products method shows that that no matter what no matter what truth table we truth table we start with, we can create a circuit start with, we can create a circuit from AND, OR, NOTfrom AND, OR, NOT

This means that {AND, OR, NOT} are This means that {AND, OR, NOT} are UniversalUniversal: they can be used to : they can be used to make a circuit for make a circuit for any behavior any behavior desireddesired

That’s why all we need to build a That’s why all we need to build a computer are AND, OR, NOT gates.computer are AND, OR, NOT gates.

Other GatesOther Gates XORXOR NAND NAND NOR NOR

AA BB OuOutt

00 00 00

00 11 11

11 00 11

11 11 00

AA BB OuOutt

00 00 11

00 11 11

11 00 11

11 11 00

AA BB OuOutt

00 00 11

00 11 00

11 00 00

11 11 00Amazing Fact: {NAND} is universal all by itself!!

More complex circuitsMore complex circuits

Two-bit adderTwo-bit adder

(“XOR” is 1 when exactly one of inputs is 1)(“XOR” is 1 when exactly one of inputs is 1)

Play with the actual circuit in SimCir

Boolean AlgebraBoolean Algebra

Can simplify complex expressions, Can simplify complex expressions, just like arithmetic simplificationjust like arithmetic simplification– Example: distributive: A(B+C) = AB+ACExample: distributive: A(B+C) = AB+AC

but also but also A+BC = A+BC = (A+B)(A+C)(A+B)(A+C)

Can show some expressions Can show some expressions equivalent to others.equivalent to others.

Entire industry… circuit Entire industry… circuit simplification/minimization.simplification/minimization.

TransistorsTransistors

Transistors to gates: Sec 4.3 Transistors to gates: Sec 4.3 in textin text

Reading and Demo:Reading and Demo:– http://fac-web.spsu.edu/cs/faculty/bbrown/web_lectures/circ

uits/– http://fac-web.spsu.edu/cs/faculty/bbrown/web_lectures/tran

sistors/

1 micron = 1/250000 inch1 micron = 1/250000 inch.13 micron feature resolution on .13 micron feature resolution on chipschips

~1 billion gates on chip.~1 billion gates on chip.

Incredible complexity - how could Incredible complexity - how could such a thing be built ??!!such a thing be built ??!!

(ultimately, we’ll grow them?!)(ultimately, we’ll grow them?!)

How did we get from {0,1,and/or/not} to TODAY ??!!

How is it possible to build a car, or a skyscraper?

You don’t think about a bunch of steel, wires, etc.

Complexity, difficult problems, are attacked bybreaking them up into subproblems, subsystems, often in different “layers” hierarchically.

CS not only has benefited from this method, butit in fact studies methods for such organization.

SummarySummary Simple functional units called gates are made Simple functional units called gates are made from transistors, and manipulate 0’s and 1’s.from transistors, and manipulate 0’s and 1’s.

AND, OR, NOT, plus othersAND, OR, NOT, plus others Equivalence between circuits, formulas, and Equivalence between circuits, formulas, and truth tablestruth tables

Sum-of-products method to build formula and Sum-of-products method to build formula and circuit from a given truth-table specificationcircuit from a given truth-table specification

Set of gates is universal - can realize any Set of gates is universal - can realize any truth table or formula we care to specifytruth table or formula we care to specify

Complex circuits (we’ll see more later) built Complex circuits (we’ll see more later) built out of simple gates to do interesting thingsout of simple gates to do interesting things