31
From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Embed Size (px)

Citation preview

Page 1: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

From Switches to Transistors and Gates

Prof. Sirer

CS 316

Cornell University

Page 2: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Origins

The most amazing and likely to be most long-lived invention of the 1800’s was…

Page 3: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Origins

The most amazing and likely to be most long-lived invention of the 1800’s was…

The steam engine? The lightning rod? The carbonated beverage?

Page 4: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Origins

The most amazing and likely to be most long-lived invention of the 1800’s was…

THE ELECTRIC SWITCH

Page 5: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

A switchA switch is a simple device that can act as a conductor or isolator

Can be used for amazing things…

Page 6: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Switches

Either (OR)

Both (AND)

+

-

-

One can build basic devices, but operation requires mechanical force

Page 7: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

TransistorsWhat happens when switches are replaced with solid-state devices The most amazing invention

of the 1900s Can be used for purposes

other than switching (e.g. radios)

Two types, PNP and NPNbase

collector

emitter

NP Pcollector emitter- +

PNP base

collector

PN N

emitter

+ - NPN

Page 8: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

NPN Transistor

Connect E to C whenbase = 1

P and N Transistors

PNP Transistor

Connect E to C whenbase = 0

E

C

E

C

B B

Can be used to build primitives from which electronic machines can be constructed

Page 9: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Then and Now

The first transistor, on a workbench at AT&T Bell Laboratories in 1947

An Intel Pentium has approximately 125 million transistors

Page 10: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Inverter

in out

+

gnd

In Out

0 1

1 0

Function: NOT

Called an inverter

Symbol:

Useful for taking the inverse of an input

in out

Truth table

Page 11: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

NAND Gate

a

out

+

gnd

b

A B out

0 0 1

1 0 1

0 1 1

1 1 0

Function: NAND

Symbol:

ba out

Page 12: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

NOR Gate

a

out

+

gnd

b

A B out

0 0 1

1

0 0

0 1 0

1 1 0

Function: NOR

Symbol:

Page 13: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Building FunctionsNOT:

AND:

OR:

NAND and NOR are universal, can implement any function using just NAND or just NOR gates

useful for manufacturing

Can specify functions by describing gates, truth tables or logic equations

ba

ba

Page 14: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Logic Equations

AND out = ab

OR out = a + b

NOT out = a

Page 15: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Identities

Identities are useful for manipulating logic equations

For purposes of optimization & ease of implementation a + a = 1 a + 0 = a a + 1 = 1 aa = 0 a0 = 0 a1 = a a(b+c) = ab + ac (a + b) = a b (a b) = a + b a + a b = a + b

Page 16: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Logic Manipulation

a b c a+b a+c LHS bc RHS

0 0 0 0 0 0 0 0

0 0 1 0 1 0 0 0

0 1 0 1 0 0 0 0

0 1 1 1 1 1 1 1

1 0 0 1 1 1 0 1

1 0 1 1 1 1 0 1

1 1 0 1 1 1 0 1

1 1 1 1 1 1 1 1

Can manipulate logic equations algebraicallyCan also use a truth table to prove equivalenceExample: (a+b)(a+c) = a + bc

(a+b)(a+c)= aa + ab + ac + bc= a + a(b+c) + bc= a(1 + (b+c)) + bc= a + bc

Page 17: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Logic MinimizationA common problem is how to implement a desired function most efficiently

One can derive the equation from the truth table

How does one find the most efficient equation? Manipulate algebraically until satisfied Use Karnaugh maps

a b c minterm

0 0 0 abc

0 0 1 abc

0 1 0 abc

0 1 1 abc

1 0 0 abc

1 0 1 abc

1 1 0 abc

1 1 1 abc

for all outputs that are 1,take the correspondingminterm,OR the minterms toobtain the result in “sum of products” form

Page 18: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Karnaugh maps

Encoding of the truth table where adjacent cells differ in only one bit

a b out

0 0 0

0 1 0

1 0 0

1 1 1

0 0 1 0

00 01 11 10

truth tablefor AND

Corresponding Karnaugh map

ab

Page 19: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Bigger Karnaugh Maps

3-inputfunc

a

b

c

y

00 01 11 10

0

1

abc

4-inputfunc

abc y

00 01 11 10

00

01

abcd

d

1110

Page 20: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Minimization with Karnaugh maps (1)

a b c out

0 0 0 0

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 0

Sum of minterms yields abc + abc + abc + abc

Page 21: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Minimization with Karnaugh maps (2)

a b c out

0 0 0 0

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 0

Sum of minterms yields abc + abc + abc + abc

Karnaugh maps identify which inputs are (ir)relevant to the output

0 0 0 1

1 1 0 1

00 01 11 10

0

1

c ab

Page 22: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Minimization with Karnaugh maps (2)

a b c out

0 0 0 0

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 0

Sum of minterms yields abc + abc + abc + abc

Karnaugh map minimization Cover all 1’s Group adjacent blocks of 2n 1’s

that yield a rectangular shape Encode the common features

of the rectangle out = ab + ac0 0 0 1

1 1 0 1

00 01 11 10

0

1

c ab

Page 23: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Karnaugh Minimization Tricks (1)

Minterms can overlap out = bc + ac + ab

Minterms can span 2, 4, 8 or more cells out = c + ab

0 1 1 1

0 0 1 0

00 01 11 10

0

1

c ab

1 1 1 1

0 0 1 0

00 01 11 10

0

1

cab

Page 24: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Karnaugh Minimization Tricks (2)

The map wraps around out = bd

out = bd

1 0 0 1

0 0 0 0

0 0 0 0

1 0 0 1

00 01 11 10

00

01

ab

cd

1110

0 0 0 0

1 0 0 1

1 0 0 1

0 0 0 0

00 01 11 10

00

01

ab

cd

1110

Page 25: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Karnaugh Minimization Tricks (3)

“Don’t care” values can be interpreted individually in whatever way is convenient

assume all x’s = 1 out = d

assume middle x’s = 0 assume 4th column x = 1 out = bd

1 0 0 x

0 x x 0

0 x x 0

1 0 0 1

00 01 11 10

00

01

ab

cd

1110

0 0 0 0

1 x x x

1 x x 1

0 0 0 0

00 01 11 10

00

01

ab

cd

1110

Page 26: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Multiplexors

A multiplexor selects between multiple inputs out = a, if d = 0 out = b, if d = 1

Build truth table

Build Karnaugh map

Derive logic diagram

a

b

d

0

Page 27: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Multiplexor Implementation

a b d out

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 1

Build a truth tablea

b

d

0

Page 28: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Multiplexor Implementation

a b d out

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 1

Build the Karnaugh mapa

b

d

0

0 0 1 1

0 1 1 0

00 01 11 10

0

1

d ab

Page 29: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Multiplexor Implementation

a b d out

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 1

a

b

d

0

0 0 1 1

0 1 1 0

00 01 11 10

0

1

d ab

Page 30: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Multiplexor Implementation

a b d out

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 0

1 1 0 1

1 1 1 1

a

b

d

0

0 0 1 1

0 1 1 0

00 01 11 10

0

1

d ab

d out

b

a

Page 31: From Switches to Transistors and Gates Prof. Sirer CS 316 Cornell University

Summary

We can now implement any logic circuit Can do it efficiently, using Karnaugh maps to

find the minimal terms required Can use either NAND or NOR gates to

implement the logic circuit Can use P- and N-transistors to implement

NAND or NOR gates