kevin walsh cs 3410, spring 2010 computer science cornell university gates and logic see: p&h...

27
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74/

Post on 19-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

Kevin WalshCS 3410, Spring 2010

Computer ScienceCornell University

Gates and Logic

See: P&H Appendix C.2, C.3

xkcd.com/74/

Page 2: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

2

A switch

• Acts as a conductor or insulator

• Can be used to build amazing things…

Page 3: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

3

Better Switch

• One current controls another (larger) current

• Static Power:– Keeps consuming power

when in the ON state• Dynamic Power:– Jump in power consumption

when switching

Page 4: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

4

e

NP

NP

NPN

PN

PNP

NP

ee

e

e

e

e

e

e

e

e

e

e

ehole

Atoms

Page 5: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

5

Be

e

e

e Sie

e

e

Silicon PhosphorusBoron

e Pe

e

e

e

Elements

Page 6: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

6

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

e Sie

e

e

SiliconSilicon Crystal

Page 7: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

7

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

N-Type: Silicon + Phosphorus

e Pe

e

e

e

e Pe

e

e

e

e Pe

e

e

e

e Pe

e

e e

Phosphorus Doping

Page 8: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

8

Be

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

ee

e

e

P-Type: Silicon + Boron

Be

e

e

Be

e

e

Be

e

e

Boron Doping

Page 9: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

9

Semiconductors

Insulator

n-type (Si+Phosphorus)has mobile electrons:

p-type (Si+Boron)has mobile holes:

low voltage (mobile electrons) → conductorhigh voltage (depleted) → insulator

low voltage (depleted) → insulatorhigh voltage (mobile holes) → conductor

Page 10: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

10

P-Type N-Type

e

e

e

e

ee

e

ee

e

e

e

e

e

Bipolar Junction

low v → conductorhigh v → insulator

low v → insulatorhigh v → conductor

Page 11: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

11

P-Type N-Type

e

e

e

e

ee

e

e

e

e

e

e

e +–

Reverse Bias

low v → conductorhigh v → insulator

low v → insulatorhigh v → conductor

e

Page 12: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

12

P-Type N-Type

e

e

e

e

ee

e

ee

e

e

e

e

e e

e

e

e

e

e

e

e

–+

Forward Bias

low v → conductorhigh v → insulator

low v → insulatorhigh v → conductor

Page 13: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

13

Diodes

p-type n-type

PN Junction “Diode”

Conventions:vdd = vcc = +1.2v = +5v = hivss = vee = 0v = gnd

Page 14: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

14

PNP Junction

p-type p-typen-type

Page 15: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

15

Bipolar Junction Transistors

• Solid-state switch: The most amazing invention of the 1900s

Emitter = “input”, Base = “switch”, Collector = “output”

p n pC E=vdd

B

E

C

B

vdd

pnvss=E C

B

C

E

B

vss

n

PNP Transistor NPN Transistor

Page 16: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

16

Field Effect Transistors

P-type FET

• Connect Source to Drain when Gate = lo

• Drain must be vdd, or connected to source of another P-type transistor

N-type FET

• Connect Source to Drain when Gate = hi

• Source must be vss, or connected to drain of another N-type transistor

Drain = vdd

Source

Gate

Drain

Source = vss

Gate

Page 17: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

17

Multiple Transistors

In Out

voltage

Gate delay• transistor switching time• voltage, propagation,

fanout, temperature, …CMOS design

(complementary-symmetry metal–oxide–semiconductor)

Power consumption = dynamic + leakage

in out

Vdd

Vsst

0v

+5v

Page 18: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

18

Digital Logic

In Out+5v 0v

0v +5v

voltage

in out

Vdd

Vss t0v

+5v

+2v+0.5v

In Out

truth tableConventions:vdd = vcc = +1.2v = +5v = hi = true = 1vss = vee = 0v = gnd = false = 0

Page 19: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

19

NOT Gate (Inverter)

In Out0 11 0

in out

Truth table

Function: NOT Symbol:

in out

Vdd

Vss

Page 20: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

20

NAND Gate

A B out0 0 10 1 11 0 11 1 0

ba out

A

out

Vdd

Vss

B

BA

Vdd Function: NAND Symbol:

Page 21: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

21

NOR Gate

ba out

A

out

Vss

Vdd

B

BA

Vss

Function: NOR Symbol:

A B out

0 0 10 1 01 0 01 1 0

Page 22: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

22

Building Functions

• AND:

• OR:

• NOT:

Page 23: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

23

Universal Gates

NAND is universal (so is NOR)• Can implement any function with just NAND gates

– De Morgan’s laws are helpful (pushing bubbles)

• useful for manufacturing

E.g.: XOR (A, B) = A or B but not both (“exclusive or”)

Proof: ?

Page 24: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

24

Logic Equations

Some notation:• constants: true = 1, false = 0• variables: a, b, out, …• operators:

• AND(a, b) = a b = a & b = a b• OR(a, b) = a + b = a | b = a b• NOT(a) = ā = !a = a

Page 25: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

25

Identities

Identities useful for manipulating logic equations– For optimization & ease of implementation

a + 0 = a + 1 = a + ā = a 0 = a 1 = a ā = (a + b) = (a b) = a + a b = a(b+c) = a(b+c) =

a 1 1

0 a 0

a b a + b

a ab + ac a + bc

Page 26: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

26

Logic Manipulation

• functions: gates ↔ truth tables ↔ equations• Example: (a+b)(a+c) = a + bc

a b c

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

a+b a+c LHS

0 0 0

0 1 0

1 0 0

1 1 1

1 1 1

1 1 1

1 1 1

1 1 1

bc RHS

0 0

0 0

0 0

1 1

0 1

0 1

0 1

1 1

Page 27: Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Gates and Logic See: P&H Appendix C.2, C.3 xkcd.com/74

27