CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops...

49
1 CSC258 Week 1 1 Instructors Larry Zhang (coordinator) Office: DH-3070 Email: [email protected] Andrew Petersen Office: DH-3096 Email: [email protected] 2

Transcript of CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops...

Page 1: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

1

CSC258 Week 1

1

Instructors

Larry Zhang (coordinator)

Office: DH-3070Email: [email protected]

Andrew Petersen

Office: DH-3096Email: [email protected]

2

Page 2: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

2

Today’s outline

§ WhyCSC258§ What is in CSC258§ How to do well in CSC258

§ Start learning

3

Why takeCSC258?

4

Page 3: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

3

Learning the Magic

5

magic magic

CSC258 CSC369

magic

CSC358

More specifically…

§ How do we express 1’s and 0’s using a piece of silicon?

§ How does the computer do everything with just 1’s and 0’s?

§ What is stored in that “fortnite.exe” file, what exactly happens when I double-click on it?

§ How does the CPU run an if-statement, or for loop, or recursion?

CSC258 has all the answers!

6

Page 4: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

4

After learning CSC258…

§ You’ll know everything about how a computer is physically built, and you can build one if you want.

§ With your hardware knowledge, you will be able to engineer the performance of your software like never before.

7

People who are really serious about software should make their own hardware.

-- Alan Kay

What’s inCSC258?

8

Page 5: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

5

The architecture of a computer hardware, level by level, bottom-up

Assembly Language

Processors

Finite State Machines

Arithmetic Logic Units

Devices Flip-flops

Circuits

Gates

Transistors

compute stuffremember stuff

9

We learn the whole real deal

§ Computing from the ground up: ú from atom level to assembly level

§ Above the assembly level is the Operating System, which virtualizes the hardware

§ Almost everything you learn from CS courses are virtualizations/illusions, except for CSC258

10

Page 6: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

6

We learn how to handle abstractions

§ At each level, we see how the previous layer is abstracted

§ In the end, we want to know how the underlying hardware affects us as programmers … so we can ignore the detail.

11

How to do well in CSC258

12

Page 7: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

7

First of all …

Be interested

13

Course website

https://mcs.utm.utoronto.ca/~258/

All course materials are here.

14

Page 8: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

8

Marking scheme

15

Labs (starting from Week 2)

§ Hands-on exercises in which you will build real pieces of hardware.

§ Prelabs are done individually, in-lab work is done in pairs.

§ ONLY go to the lab section that you are registered to on ACORN. If you want to switch lab section, find someone who is willing to switch and get permission from Larry/Andrew.

§ On the discussion board, use “Search Teammates” for finding a partner.

16

Page 9: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

9

Prelab Reports

§ For most of the labs, you will be required to submit a prelab report (a PDF file) to MarkUs before the labs start.

§ Must be completed individually

§ Submission deadline is typically Tuesday 6pm

§ To get the mark for the prelab report

ú do your work and submit something meaningful

ú don’t plagiarize

ú not submitting anything would be much better than plagiarizing

17

18

Page 10: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

10

Lab software

§ We will use Logisim-Evolution§ The reference of the software has been posted on the course

website.§ Task for this week: download the software, read the reference,

and familiarize yourself with it.§ Note: I must be Logisim-Evolution downloaded at the link in

the reference. Do NOT use the original Logisim or its other variations.

19

Weekly Quizzes

§ We will use Quercus for online quizzes

§ Starting in Week 2

§ Useful practices for tests and exams.

§ Deadline for quizzes is every Sunday 10:00pm.

§ You’ll be told whether your answer is correct immediately, and you can try up to three times. We will record your highest score.

20

Page 11: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

11

New: Assembly Programming Project

§ This year, we’ll ask you to write a larger project in assembly than in prior years

§ The project will be due on the last day of class

§ You will be asked to write assembly code to build a gameú Memory (storing game state)ú Syscalls (to access input/output)

Tests

§ Midterm§ outside class!§ Mon, Feb 24, 7:10pm~8:40pm (90 minutes)§ Let Larry know by Jan 31 if you have a conflict.

§ Final exam§ Some time in April§ Must get >= 40%

22

Page 12: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

12

Discussion board

https://mcsapps.utm.utoronto.ca/forum/c/csc258-spring-2020/11

§ All course announcements will be posted here.

§ Daily reading is required.

23

Office hours

Larry: Tuesday 5:10-6:10, Thursday 11:10-12:40Andrew: Monday 10:00-12:00, Wednesday 10:00-12:00

24

Office hours are helpful!

Page 13: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

13

Student Feedback

§ Give us frequent (e.g., every week) feedbacks on how things are going. It is very useful for improving your learning experience in a timely manner.

§ Anonymous feedback form:ú link on the course website

§ Or even better, just drop by my office and have a chat.

2-25

Textbook: DDCA

Digital Design and Computer Architecture, 2nd edition, 2012by David Harris, Sarah Harris (1st edition also fine)

Available online at UofTlibrary (link in course info sheet)

26

Page 14: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

14

A typical week of CSC258

§ Monday/Tuesday/Thursday: go the lectures.

§ By Tuesday 6pm: submit prelab report.§ Tuesday/Wednesday: labs.

§ Thursday: Quiz released on Quercus. Start studying for it.

§ Thursday: next week’s lab handout released, start working on the prelab.

§ Friday/Saturday: keep studying…§ Sunday by 10pm: complete the quiz.

27

It will be a lot of work, and a lot of fun!

28

Page 15: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

15

29

§ In-class pop quizzes. To participate, you’ll need:ú be in the lectureú have access to a browser (on a

phone, tablet or a laptop), or the Kahoot app

§ has nothing (directly) to do with your course grade

2-30

Page 16: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

16

Let the learning begin

31

Basic Logic Gates

32

Page 17: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

17

You already know something…

33

Logic from math course

§ Create an expression that is true iff the variables A and B are true, or C and D are true.

G = (A & B) | (C & D)

34

Page 18: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

18

G = (A & B) | (C & D)

AB A&B

AND Gate

AB A|B

OR GateAB

CD

G

You just designed your first circuit in CSC258!35

Gates = Boolean logic

§ If we know the logical expression, we already know how to put logic gates together to form a circuit.

§ Just need to know which logic operations are represented by which gate!

Let’s meet all the gates.

36

Page 19: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

19

A B Y

0 0 00 1 01 0 01 1 1

AB

Y

AND Gates

Truth table

37

A B Y

0 0 00 1 11 0 11 1 1

OR Gates

AB

Y

38

Page 20: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

20

A Y

0 11 0

NOT Gates

A Y

39

A B Y

0 0 00 1 11 0 11 1 0

XOR Gates

AB

Y

40

Page 21: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

21

Bill Gates

41

A B Y

0 0 10 1 11 0 11 1 0

AB

Y

NAND Gates

42

Page 22: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

22

A B Y

0 0 10 1 01 0 01 1 0

AB

Y

NOR Gates

43

A Y

0 01 1

A Y

Buffer

This is not as silly as you might think now, as we’ll see later…

44

Page 23: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

23

AB

YAND Gate

This is just a symbol...What does it really look like, inside?How does it work, physically?

Y

+-

BA

R

Ground: low voltage (0V)

Power: high voltage (5V)

Resistor

What are these?

45

Y

+-

RBA

Switches

When and only when both A are B are switched ON, Y has high voltage.

46

Page 24: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

24

Y

+- R

BA Gates

• Gate is like a switch, but controlled by the voltage of the input signal, instead of by a finger.

• Gate A is switched ON when signal A is of high voltage.• When and only when both A and B have high voltage,

Y has high voltage.• High voltage is 1 (True), low voltage is 0 (False).• Y is True iff both A and B are True (Y = A & B).

47

A Gate is switched ON when signal A is of

high voltage …

Why?

How? What does the inside of a gate look like?

Answer: There are transistors.48

Page 25: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

25

Transistors

49

One of the greatest inventions of the 20th century

§ Invented by William Shockley, John Bardeen and Walter Brattain in 1947, replacing previous vacuum-tube technology.ú Nobel Prize for Physics in

1956.

Building block for the hardware of all your computers and electronic devices.

50

Page 26: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

26

What do transistors do?§ Transistors connect Point A to Point B, based on

the value at Point C.ú If the value at Point C is high, A and B are connected.

ú And if the value at Point C is low, A and B are not.

ú Need to know a little about electricity now….

A B

C = 1

A B

C = 0

A B

A B

51

52

Page 27: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

27

Outline of the story

• Electricity, basic concepts

• Insulators, conductors, in between …, Semiconductors

• Impure semiconductors, p-type / n-type

• Put p-type and n-type together -- pn-junction

• Apply voltage to a pn-junction – principle of transistors

• A real-world manufacturing of transistor -- MOSFET

53

Electricity Basics

54

Page 28: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

28

Everything is made out of atoms …

• Protons are big (hardly move) and positively charged.• Electrons are small

(easily move) and negatively changed.• Neutrons are big and

of course, neutral.• Overall, an atom is

neutral.55

What is Electricity?

§ Electricity is the flow of charged particles (usually electrons) through a material.

56

Page 29: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

29

How do electrons flow?

They flow …

57

How do electrons flow?

§ Electrons want to flow from regions of high electricalpotential (many electrons) to regions of low electrical potential (fewer electrons).ú Like water flows from high to low.

§ This potential is referred to as voltage (V).§ The rate of this flow is called the current (I).§ Resistance (I = V / R) is like how narrow the water pipe is.

58

Page 30: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

30

Note

The direction of the current is opposite to the direction of the electron movement, because electrons are negatively charged.

59

More on Resistance§ Electrical resistance indicates how well a

material allows electricity to flow through it:ú High resistance (aka insulators) don’t conduct

electricity at all.ú Low resistance (aka conductors) conduct

electricity well, and are generally used for wires.

§ Semiconductors are somewhere in between conductors and insulators, which makes it interesting…

60

Page 31: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

31

Outline of the story

• Electricity, basic concepts• Insulators, conductors, in between …,

Semiconductors• Impure semiconductors, p-type / n-type• Put p-type and n-type together -- pn-

junction• Apply voltage to a pn-junction – principle

of transistors• A real-world manufacturing of transistor --

MOSFET61

Semiconductors

62

Page 32: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

32

Here comes the chemistry

63

silicon

Germanium

64

Page 33: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

33

Conductivity of Semiconductors

§ Semiconductor materials (e.g., silicon and germanium) straddle the boundary between conductors and insulators, behaving like one or the other, depending on factors like temperature and impurities in the material.

65

Impurity

66

Page 34: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

34

Pure semiconductor is pretty stable

§ Each atom has 4 valence electrons, forming bondswith other atoms, and the structure is pretty stable.

§ At room temperature, very close to insulator.

67

Encourage semiconductor’s conductivity

N-type:Add some atoms with 5valence electrons, such as Phosphorus.

An extra electron!P-type:Add some atoms with 3valence electrons, such as Boron. A missing electron, a.k.a., a

“hole”, like a positive electron!68

Page 35: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

35

Encourage semiconductor’s conductivity

The extra electrons and the holes are charge carriers, which can move freely through the materials.

Thus the conductivity is encouraged.

This process of adding stuff is called doping, (n or p type).

69

Free electrons move like

Free holes move like

70

Page 36: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

36

Outline of the story

• Electricity, basic concepts• Insulators, conductors, in between …,

Semiconductors• Impure semiconductors, p-type / n-type• Put p-type and n-type together -- pn-

junction• Apply voltage to a pn-junction – principle

of transistors• A real-world manufacturing of transistor --

MOSFET71

PN-junctions

72

Page 37: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

37

Bringing p and n together

§ What happens if you brought some p-type material into contact with some n-type material?

§ The electrons at the surface of the n-type material are drawn to the holes in the p-type.

Si Si

Si P

Si Si

Si Si

Si Si

Si Si

Si Si

B Si

Si

Si Si

Si

Si Si

Si

Si Si

Si Si

Si

Si Si

Si Si

Si

Si Si

Si

Si

Si Si

Si

P P P

P

B

B

B

B

-

----

--

--

-p-type

n-type

73

p-n Junctions

§ When left alone, the electrons from the nsection of the junctionwill fill the holes of the p section, cancelling each other and create a section with no free carriers called the depletion layer.

§ Once this depletion layer is wide enough, the doping atoms that remain will create an electric field in that region.

74

Page 38: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

38

Si Si

Si P

Si Si

Si Si

Si Si

Si Si

Si Si

B Si

Si

Si Si

Si

Si Si

Si

Si Si

Si Si

Si

Si Si

Si Si

Si

Si Si

Si

Si

Si Si

Si

P P P

P

B

B

B

B

-

----

--

--

-

p-type

n-typeBecause lost electron

Because gained electron

Electrons’ initial movement (attracted by holes)

75

p-type

n-typeElectrons’ initial movement

(attracted by holes)

Electric field

Electron’s movement drawn by the electric field

“Diffusion”

“Drift”

Diffusion increases the width of depletion layer, and drift draws it back. An equilibrium is reached, when the depletion layer is of a certain width.

76

Page 39: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

39

Analogy: Spring with weight

“Diffusion” “Drift”

Attracted by gravity (hole)

Drawn by spring force field

An equilibrium is reached when the spring is stretched by a certain length.

77

Summary of pn-junction

When we put p and n together, they will form a depletion layer with electric field in it.

The depletion layer grows up to a certain width, until equilibrium is reached.

NP

78

Page 40: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

40

Outline of the story

• Electricity, basic concepts• Insulators, conductors, in between …,

Semiconductors• Impure semiconductors, p-type / n-type• Put p-type and n-type together -- pn-

junction• Apply voltage to a pn-junction – principle

of transistors• A real-world manufacturing of transistor --

MOSFET79

Apply voltage to a PN-junction

It could be applied in two possible directions

• Positive voltage to the P side

• Positive voltage to the N side

80

Page 41: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

41

Forward Bias (Positive voltage to P)

P NNegative charges sucked

out of depletion layerPositive charges sucked

out of depletion layer

Depletion layer becomes narrower.81

Reverse Bias (Positive voltage to N)

P NNegative charges injected

into depletion layerPositive charges injected

into depletion layer

Depletion layer becomes wider.82

Page 42: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

42

Apply forward bias• Depletion layer narrower• Easier to travel through• Better conductivity• Like switch connected

Apply reverse bias• Depletion layer wider• Harder to travel through• Worse conductivity• Like switch disconnected

That’s how transistors work!83

Outline of the story

• Electricity, basic concepts• Insulators, conductors, in between …,

Semiconductors• Impure semiconductors, p-type / n-type• Put p-type and n-type together -- pn-

junction• Apply voltage to a pn-junction – principle

of transistors• A real-world manufacturing of transistor --

MOSFET84

Page 43: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

43

Creating transistors§ Transistors use the characteristics of p-n

junctions to create more interesting behaviour.

§ Three main types:ú Bipolar Junction Transistors (BJTs)ú Metal Oxide Semiconductor Field Effect Transistor

(MOSFET)ú Junction Field Effect Transistor (JFET)

§ The last two are part of the same family, but we’ll only look at the MOSFET for now.

85

Metal Oxide Semiconductor Field Effect Transistor

86

Page 44: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

44

Source Drain

Gate

87

Metal Oxide

N-type P-type

GateSource Drain

InsulatorConductor, can apply electric charge to it

Semiconductors, doped

88

Page 45: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

45

Put a MOSFET into a circuitGate

Source Drain

+ -- +or

Power: high voltage can be applied to

source or drain

89

Put it into a circuitGate

Source Drain

+ -- +

Metal Oxide N-type P-type

Two PN-junctions back-to-back, i.e, N-P-N. So, either source or drain has high voltage, one of the PN-junction must be reverse biased (circuit disconnected).

90

Page 46: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

46

But things change if we apply high voltage to Gate

Gate

Metal Oxide N-type P-type

Attract negative charges from p-substrate

Create n-type channel between source and drain, CIRCUIT CONNECTED

The wider the channel, the higher the current91

Two types of MOSFET

• nMOS (what we just describe)• N-P-N• Gate high, connected• Gate low, disconnected

• pMOS (opposite to nMOS)• P-N-P• Gate low, connected• Gate high, disconnected

92

Page 47: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

47

Outline of the story• Electricity, basic concepts• Insulators, conductors, in between …,

Semiconductors• Impure semiconductors, p-type / n-type• Put p-type and n-type together -- pn-

junction• Apply voltage to a pn-junction – principle

of transistors• A real-world manufacturing of transistor –

MOSFET• Use transistors build Logic Gates

93

Transistors to Logic Gates

94

Page 48: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

48

Create gates using a combination of transistors

A Y

A Y

NOT Gate

Physical data:ú “High” input = 5V

ú “Low” input = 0V

ú Switching time: ~20 picoseconds

ú Switching interval ~10 ns

95

Transistors into gates

Y

A

B

A

B

A

B

A

B

Vcc Vcc

A

B

Y

Vcc

A B

A B

A

Y

Vcc Vcc

B

AND ORXOR

96

Page 49: CSC258 Week 1 - mcs.utm.utoronto.ca258/files/larry/lec01print.pdf · Logic Units Devices Flip-flops Circuits Gates Transistors compute stuff remember stuff 9 We learn the whole real

49

NAND is the most awesome logic gate• It’s cheaper to build• All other logic functions (AND,

OR, …) can be implemented using only NAND, i.e., it is functionally complete.

Challenge for home: implement AND, OR, NOT, XOR using only NAND.

97

Next week:• Circuit creation

98