58
PHY 201 (Blum) 1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

Embed Size (px)

Citation preview

Page 1: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 1

MEMORY

Digital Principles, Roger Tokheim Chapter 9

Page 2: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 2

Combinatorial Logic vs. Sequential Logic

A circuit is said to be “combinatorial” if its output is determined solely by its inputs.

Such a circuit can be realized in terms of logical gates (ANDs, ORs and NOTs).

A circuit is said to be “sequential” if its output is in part determined by its history.

History dependence here means bits (high or low states) that were previously stored by the circuit.

If the sole purpose of the circuit is to store values, it is called memory.

Page 3: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 3

Flip-flops and Registers

A circuit that can store a single bit is known as a flip-flop.

A group of flip-flops working in parallel as a unit to hold a “word” is known as a register.

A group of addressable registers (done with a decoder) is known as memory.

Page 4: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 4

Memory Address Register

The Memory Address Register is for holding the address of the memory that is currently being processed.

It is the input to the decoder. The decoder in turn connects to a series of registers.

At this lowest level, addresses are absolute but at a higher level addresses may be relative or absolute.

Page 5: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 5

Like an Array

Address Value

0000 AB

0001 34

0002 73

0003 84

0004 CC

… …

Page 6: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 6

Reading and WritingThe action of placing a value in a memory circuit (a.k.a. a cell) is called writing.

Putting a high value into a cell is referred to as “setting.”Putting a low value into a cell is referred to as “resetting.”

Accessing the value in a memory cell without affecting it is called reading.Grammatically, the CPU is the subject; the memory is the object

The CPU writes to memory.The CPU reads from memory.

Page 7: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 7

The ClockThe timing of these actions, especially the “write” are controlled by the clock. One can think of a computer’s clock as something that steadily oscillates betweens the values 0 and 1Units of memory (flip flops) will can have three types of input:

Control: whether or not to writeTiming: when to write Data: what to write

Sometimes control and timing are combined.

Page 8: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 8

ROM

Read Only Memory

As the name suggests the user only reads this type of memory; the writing is typically done by the manufacturer.

ROM is nonvolatile, that is, a supply of energy is not required to keep the data intact.

That is, ROM is not lost when the computer is turned off.

Page 9: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 9

Using ROM

Most personal computers contain a small amount of ROM that stores critical programs such as the program that boots the computer. In addition, ROMs are used extensively in calculators and peripheral devices such as laser printers, whose fonts are often stored in ROMs.

Page 10: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 10

Types of ROM

ROM: data is written by manufacturer

PROM: programmable read-only memory, data is written by user

PROMs are manufactured as blank chips on which data can be written with a special device called a PROM programmer (a.k.a. burner)

Like burning a CD-R

Page 11: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 11

Types of PROM

PROM usually implies “write once”

EPROM erasable programmable read only memory data can be erased and rewritten

Some use ultraviolet (UV) light, requires removing it from the computer

EEPROM, electrically erasable programmable read-only memory, is erased by electronic means

Does not have to be removed from computer

Page 12: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 12

Uses Of ROMMicrocode portion of CPU

The lowest-level instructions that directly control a microprocessor. A “plus” instruction will be stored in a program in RAM; the code that tells the hardware what to do when it encounters a plus is in ROM

Basic Input/Output System (BIOS)Code burned into motherboard’s ROM; it handles interfacing between the operating system and peripherals (IO).

Page 13: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 13

RAMRAM Random Access MemoryData can be accessed (read)

Sequentially: you start at the beginning and go through the sequence of locations

• Like a cassette or video tape

Randomly: you can jump to any location without proceeding through all previous locations

• Like a CD or DVD (no need for fast-forwarding, rewinding, etc.)

ROM is also random access, but the term RAM refers to volatile memory, memory requiring an energy source.

Page 14: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 14

Types of RAM

SRAM: Static RAMThe objective of memory is to hold a value, so being static is good. The value is held without the need for “refreshing.” Fast but expensive.

DRAM: Dynamic RAMThe value must be “refreshed” or it will become lost or corrupted. Slow but cheap.

Page 15: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 15

Types of DRAMSynchronous DRAM (SDRAM) actually synchronizes itself with the CPU's bus

Deals with data in “bursts” so it doesn’t have to go through the addressing process of successive data locations

DDR SDRAM – Double Data Rate SDRAM Double data refers to the number of times that data can be sent along the bus connecting processor and memoryAlso DDR2 and DDR3

Page 16: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 16

Blurring the distinction between RAM and ROM

NVRAM: Non-Volatile Random Access Memory, is RAM that does not lose its data when the power goes off.

A separate power source such as a battery allows the RAM to hold onto its information until it can be written to more permanent form: to EEPROM or to storage (disk)Some modems use it to keep phone numbers and/or modem profiles.

Page 17: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 17

Blurring the Distinction II

Flash memory: A version of EEPROM that can be erased and reprogrammed in blocks rather than one byte at a time. This makes writing (burning) easier/faster.

Many PCs use flash memory for their BIOS – a flash BIOS. Flash memory is often used in modems, as it allows the manufacturer to support new protocols as they become standardized.

Page 18: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 18

Cache A generic term used to describe guessing what data will be used next and placing it where it can be accessed more quickly

A cache hit is a correct guessA cache miss is an incorrect guess

Memory Cache uses SRAM which is faster than DRAML1: SRAM that is right on the microprocessor chipL2: (originally) not on the chip

Page 19: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 19

Cache

When writing to cache, there are different scenarios

Write back: updates cache first and memory later (faster)

Write through: updates cache and memory together (slower but maintains consistency)

Page 20: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 20

SRAM Pros

SpeedSRAM is faster than DRAM, because DRAM requires refreshing which takes time

Simplicity SRAM is simpler to use than DRAM, again because DRAM requires refreshing

Page 21: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 21

SRAM ConsSize

SRAM is a more complicated circuit, it involves more transistors than DRAM, and hence it is larger

CostAgain SRAM is more transistors and so it costs more

PowerSince SRAM involves a constant current, it uses more power than DRAM

HeatAgain since SRAM involves a constant current, it produces more heat

Page 22: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 22

Error Detection Parity

Odd parity: add an extra bit to a word and insist that the total number of 1’s be odd

Even parity, ditto but number of 1’s even

Example of odd parity

0 0 0 0 0 0 0 0 1

0 0 0 0 0 0 0 1 0

0 0 0 0 0 0 1 0 0

0 0 0 0 0 0 1 1 1

Page 23: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 23

Vertical parity

0 0 0 0 0 0 0 0 1

0 1 0 1 0 0 0 1 0

0 0 0 0 0 1 1 0 1

0 1 0 1 0 0 1 1 1

0 0 1 0 0 1 0 0 1

0 0 0 0 0 1 0 1 1

0 0 0 0 0 1 1 0 1

0 0 0 0 1 1 0 1 0

1 1 0 1 0 0 0 1 1

Page 24: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 201 (Blum) 24

Error Detection and Error Correction Code

If a parity check reveals a parity error, one can request data be resent

ParityCRC (cyclic redundancy check)checksum

Error Correction Code: in addition to detecting a mistake can help fix it

Hamming code

Page 25: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 25

Capacitance

Page 26: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 26

What is a capacitor?

A capacitor is an electronic component that stores electric charge (and electric energy)

A simple version of a capacitor is the parallel-plate capacitor; it consists of two conducting plates separated by an insulating material

The insulating material is called a dielectric in this context.

Page 27: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 27

Parallel-plate capacitor

dielectric

+

+

+

+

+

+

+

-

-

-

-

-

-

-

I I

conducting plates

2. Positive charges accumulates on first plate; dielectric does not let them through

1. Battery (not shown) pushes charges out

3. Neutral atoms on other plate are made up positive and negative charges

4. Negative charges are attracted and stay behind, while positive charges are repelled and move out giving rise to the current on other side

Page 28: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 28

We can’t go on like this

dielectric

+

+

+

+

+

+

+

-

-

-

-

-

-

-

I I

conducting plates

2. There are positive charges on the first plate. Like charges repel.

1. There are positive charges coming from the battery

3. When the push from the battery is equal to the push back from the plate, the capacitor stops charging

4. The bigger the push from the battery (i.e. voltage), the more charge goes onto the plate. The voltage and charge are proportional.

Page 29: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 29

Q = VC

When we talk about the charge on a capacitor, we mean the charge on one of the plates.The charge is proportional to the voltage: Q V.The proportionality constant C is called the capacitance.Solving for V, the equation becomes

V =Q

C

Page 30: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 30

Farad

The standard unit of capacitance is the farad (F).

A farad is quite large, usually you see millifarad mF (1 mF = 10-3 F)

microfarad F (1 F = 10-6 F)

nanofarad nF (1 nF = 10-9 F)

picofarad pF (1 pF = 10-12 F)

Page 31: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 31

Capacitance Q=VC

The capacitance is a measure of how easy it is to put charge on the plates, it is

directly proportional to the surface area of the plates, bigger plates can hold more charge

inversely proportional to the distance between the plates, the interaction between the positive and negative charges is greater when they are closer

dependent on the material (dielectric) separating the plates, having a good insulator between them is like their being further apart

Page 32: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 32

Capacitive keyboardsCapacitive keyboards detect which key was pressed by looking at changes in capacitance.

Under each key are two oppositely charged plates ( a capacitor).

Pressing a key moves its upper plate closer to its lower plate, changing its capacitance, and hence changes the amount of charge the plates can hold for a given voltage.

The keyboard circuitry detects this change and sends the appropriate information (interrupt request and ASCII code) to the CPU.

Page 33: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 33

DRAMCapacitors can be put on integrated circuit (IC) chips. Together with transistors, they are used in dynamic random access memory (D-RAM). The charge or lack thereof of the capacitor corresponds to a stored bit. Since these capacitors are small, their capacitance is pretty low. DRAM has to be recharged (refreshed) thousands of times per second or it loses its data.

Page 34: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 34

Power Supply

Large capacitors are used in the power supplies of computers and peripherals.

The capacitors (along with diodes) are used in rectifying: turning the alternating current (AC) into smoothed out direct current (DC).

Capacitors do the smoothing part.

Page 35: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 35

Monitors

Monitors (CRT’s) are another place that large capacitors are found.

Since capacitors store charge, monitors and power supplies can be dangerous even when the power is off.

If you don’t know what you’re doing, don’t even open them up.

Page 36: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 36

Equivalent Capacitance

When a combination of capacitors can be replaced by a single capacitor, which has the same effect as the combination, the capacitance of the single capacitor is called the equivalent capacitance.

Having the same effect means that same voltage results in the same amount of charge being stored.

Page 37: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 37

Capacitors in parallelRecall that things in parallel have the same voltage

And the charge is split between the capacitors. The charge has a choice, some will go onto one capacitor, the rest on the other.

V C1

C2

Page 38: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 38

Capacitors in parallel Individual capacitors obey basic equation

Q1 = C1 V and Q2 = C2 V

Equivalent capacitor obeys basic equation Qtotal = Ceq V

The total charge is the sum of the individual charges Qtotal = Q1 + Q2

Solve basic equations for Q’s and substitute Ceq V = C1 V + C2 V

Divide by common factor V

Ceq = C1 + C2

Page 39: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 39

Capacitors in series

Capacitors in series have the same chargeWhen the capacitors are uncharged, the region including the lower plate of C1 and the upper plate of C2 is electrically neutral. This region is isolated and so this remains true; the negative charge on the lower plate of C1 when added to the positive charge on the upper plate of C2 would give zero

The voltage is split between them

VC1

C2

Page 40: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 40

Capacitors in seriesIndividual capacitors obey basic equation

V1 = Q1 / C1 and V2 = Q2 / C2

Equivalent capacitor obeys basic equation

Vtotal = Qtotal / Ceq

The total voltage is the sum of the individual voltages

Vtotal = V1 + V2 Substitute basic equations into voltage equation

Qtotal / Ceq = Q1 / C1 + Q2 / C2

All of the charges are the same (Qtotal = Q1 = Q2 = Q), divide out the common factor

1 / Ceq = 1 / C1 + 1 / C2

Page 41: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 41

Example

Page 42: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 42

Example (Cont.)

Something must take the brunt of the voltage when the battery is first connected, that’s why the 0.2-k resistor is there.

The 2.5-F and 1.5-F are in parallel, so they can be replaced with one 4.0-F capacitor.

Page 43: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 43

Example (Cont.)

The 3.5-F and 4.0-F capacitors are in series, so they can be replaced with one 1.87-F capacitor.

The charge on it Q=CV would be 9.33 C

Page 44: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 44

Example (Cont.)

Going back to the 3.5-F and 4.0-F capacitors are in series, capacitors in series have the same charge, so Q3.5 = 9.33 C

Then V3.5 = Q3.5 / C3.5 or V3.5 = 2.67 V

And V4.0 = Q4.0 / C4.0 or V4.0 = 2.33 V

(Note that V3.5 + V4.0 = 5)

Page 45: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 45

Example (Cont.)

The 4.0-F capacitor was really a 1.5-F and a 2.5-F in parallelThings in parallel have the same voltage, so V1.5 = V2.5 = 2.33 V

Since Q1.5 = V1.5 C1.5, Q1.5 = 3.50 C

Similarly, Q2.5 = 5.83 C

(Note Q1.5 + Q2.5 = 9.33 C)

Page 46: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 46

Testing in Electronics Workbench

Page 47: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 47

Two Cautions

When the switches are closed, there is an easy path from one side of the capacitor to another, this makes sure that the capacitors are discharged.

Even when the switches are open there is a path from one side to another for the upper capacitors, it is through the voltmeter. The voltmeter must be made extremely ideal (very high resistance) to get agreement with theory.

Page 48: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 48

RC circuits: Charging

Page 49: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 49

What happensWhen you connect an uncharged capacitor and a resistor in series to a battery, the voltage drop is initially all across the resistor.

Because the voltage drop across a capacitor is proportional to the charge on it and there is not charge on it at the beginning.

But charge starts to build up on the capacitor, so some voltage is dropped across the capacitor now.

Capacitors have a gap and while current gets all the way around the circuit, individual charges are trapped on one side of the capacitor.

Page 50: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 50

What happens (Cont.)Since some voltage is dropped across the capacitor, less voltage (than before) is dropped across resistor. With less voltage being dropped across the resistor, the current drops off.

V = IR (smaller V smaller I)With less current, the rate at which charge goes onto the capacitor decreases. The charge continues to build up, but the rate of the build up continues to decrease. In mathematical language, the charge as a function of time Q(t) increases but its slope decreases. Theory says the charge obeys Q(t) = C V (1 - e- t / )

Page 51: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 51

Time Constant

Q(t) = C V (1 - e- t / )

in that equation is known as the “time constant” and is given by = RC

Note that since R = V / I , resistance has units volt/ampere

Since C = Q / V, capacitance has units coulomb/volt

RC = (V / I) (Q / V) = Q / I

Then RC has units coulomb/ampere but an ampere is coulomb/second

RC = Q / (Q / T) = T

So RC has units of second

Page 52: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 52

Charging Capacitor

RC Circuit (Charging)

Time

Ch

arg

e o

n c

apac

ito

r

1

63%

3

95%

Page 53: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 53

Voltage is similar

If the charge on the capacitor varies according to the expression

Q(t) = C V (1 - e- t / )

then since the voltage across a capacitor is V=Q/C the voltage is

V(t) = V (1 - e- t / )the voltage approaches its “saturation” value, which in a simple RC circuit in the battery’s voltage.

Page 54: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 54

Time ConstantThe time constant ( = RC) is the time required for a certain percentage (63%) of the saturation charge (the charge after a very long time) to be put on the capacitor. If the resistance is large, the currents are small, even from the start and it requires more time to charge up the capacitor ( R)If the capacitance is large, the capacitor can take a lot of charge and again it requires more time to charge up the capacitor ( C)

Page 55: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 55

RC circuits: Discharging

Page 56: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 56

What happensThis time we imagine that there are already charges on the capacitor, but there is no battery.With no battery to "push" the charges around, the opposite charges on the two capacitor plates would prefer to be together. They must pass through the resistor before they can reunite. With all those like charges on one plate, there is a strong incentive for charges to leave the plate.

Page 57: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 57

What happens (Cont.)However, as charges leave the plate, the voltage across the capacitor decreases (V = Q C) and the incentive for charges to leave the capacitor decreases, thus the rate at which charges leave decreases as well. In mathematical language, this time the charge as a function of time Q(t) decreases and its slope decreases.

Theory says the charge obeys Q(t) = Q0 e- t / .Same time constant as before.

Page 58: PHY 201 (Blum)1 MEMORY Digital Principles, Roger Tokheim Chapter 9

PHY 202 (Blum) 58

Discharging Capacitor

RC Circuit (Discharging)

Time

Ch

arg

e o

n t

he

cap

acit

or

1 3

37%

5%