Memory, Latches, & Registers - Computer Science

59
L13 Memory 1 Comp 411 Memory, Latches, & Registers 1) Structured Logic Arrays 2) Memory Arrays 3) Transparent Latches 4) How to save a few bucks at toll booths 5) Edge-triggered Registers

Transcript of Memory, Latches, & Registers - Computer Science

Page 1: Memory, Latches, & Registers - Computer Science

L13 – Memory 1Comp 411

Memory, Latches, & Registers

1) Structured Logic Arrays2) Memory Arrays3) Transparent Latches

4) How to savea few bucksat toll booths

5) Edge-triggered Registers

Page 2: Memory, Latches, & Registers - Computer Science

L13 – Memory 2Comp 411

General Table Lookup Synthesis

MUXLogic

A B

Fn(A,B)

Generalizing:Remember from a few lectures ago that, in theory, we can build any 1-output combinational logic block with multiplexers.

For an N-input function we need a _____ input multiplexer.

BIG Multiplexers? How about 10-input function? 20-input?

AB Fn(A,B)

00 0

01 1

10 1

11 0

Page 3: Memory, Latches, & Registers - Computer Science

L13 – Memory 3Comp 411

General Table Lookup Synthesis

MUXLogic

A B

Fn(A,B)

Generalizing:Remember from a few lectures ago that, in theory, we can build any 1-output combinational logic block with multiplexers.

For an N-input function we need a _____ input multiplexer.

BIG Multiplexers? How about 10-input function? 20-input?

AB Fn(A,B)

00 0

01 1

10 1

11 0

2N

Page 4: Memory, Latches, & Registers - Computer Science

L13 – Memory 4Comp 411

A Mux’s Guts

Hmmm, by sharing the decoder part of the logic MUXs could be adapted to make lookup tables with any number of outputs

I00

I01

I10

I11

A

B

A

B

A

B

A

B

Y

Decoder Selector Multiplexerscan be partitionedinto two sections.

A DECODER thatidentifies the

desired input,and

a SELECTOR that enables that inputonto the output.

A decodergeneratesall possible

productterms fora set ofinputs

0

1

2

3

Page 5: Memory, Latches, & Registers - Computer Science

L13 – Memory 5Comp 411

A New Combinational Device

k

D1D2

DN

DECODER:

k SELECT inputs,

N = 2k DATA OUTPUTs.

Selected Dj HIGH; all others LOW.

NOW, we are well on our way to building a general purpose table-lookup device.

We can build a 2-dimensional ARRAY of decoders and selectors as follows ...

Have Imentionedthat HIGH

is a synonymfor „1‟ and

LOW meansthe same

as „0‟

Page 6: Memory, Latches, & Registers - Computer Science

L13 – Memory 6Comp 411

Shared Decoding Logic

0 2 3 4 5 6 71

ABCin

S

Cout

Made from PREWIRED connections , and CONFIGURABLEconnections that can be either connected or not connected

We can build a general purpose “table-lookup” device calleda Read-Only Memory (ROM), from which we can implementany truth table and, thus, any combinational device

Decoder

Configurable Selector

Page 7: Memory, Latches, & Registers - Computer Science

L13 – Memory 7Comp 411

Shared Decoding Logic

0 2 3 4 5 6 71

ABCin

S

Cout

These are just“DeMorgan”ized

NOR gates

Made from PREWIRED connections , and CONFIGURABLEconnections that can be either connected or not connected

We can build a general purpose “table-lookup” device calleda Read-Only Memory (ROM), from which we can implementany truth table and, thus, any combinational device

Decoder

Configurable Selector

Page 8: Memory, Latches, & Registers - Computer Science

L13 – Memory 8Comp 411

Shared Decoding Logic

0 2 3 4 5 6 71

ABCin

S

Cout

There‟s anextra level

of inversionthat isn‟tnecessary

in the logic.However,

it reducesthe capacitive

load on themodule driving

this one.

These are just“DeMorgan”ized

NOR gates

Made from PREWIRED connections , and CONFIGURABLEconnections that can be either connected or not connected

We can build a general purpose “table-lookup” device calleda Read-Only Memory (ROM), from which we can implementany truth table and, thus, any combinational device

Decoder

Configurable Selector

Page 9: Memory, Latches, & Registers - Computer Science

L13 – Memory 9Comp 411

Shared Decoding Logic

0 2 3 4 5 6 71

ABCin

S

Cout

There‟s anextra level

of inversionthat isn‟tnecessary

in the logic.However,

it reducesthe capacitive

load on themodule driving

this one.

These are just“DeMorgan”ized

NOR gates

Made from PREWIRED connections , and CONFIGURABLEconnections that can be either connected or not connected

We can build a general purpose “table-lookup” device calleda Read-Only Memory (ROM), from which we can implementany truth table and, thus, any combinational device

Decoder

Configurable Selector

This ROM stores 16 bitsin 8 words of 2 bits.

Page 10: Memory, Latches, & Registers - Computer Science

L13 – Memory 10Comp 411

Logic According to ROMs

ROMs ignore the structure of combinational functions ...• Size, layout, and design are independent of function• Any Truth table can be “programmed” by

minor reconfiguration:

- Metal layer (masked ROMs)- Fuses (Field-programmable PROMs)- Charge on floating gates (EPROMs)... etc.

Model: LOOK UP value of function in truth table...Inputs: “ADDRESS” of a T.T. entryROM SIZE = # TT entries...

... for an N-input boolean function, size = __________

Page 11: Memory, Latches, & Registers - Computer Science

L13 – Memory 11Comp 411

Logic According to ROMs

ROMs ignore the structure of combinational functions ...• Size, layout, and design are independent of function• Any Truth table can be “programmed” by

minor reconfiguration:

- Metal layer (masked ROMs)- Fuses (Field-programmable PROMs)- Charge on floating gates (EPROMs)... etc.

Model: LOOK UP value of function in truth table...Inputs: “ADDRESS” of a T.T. entryROM SIZE = # TT entries...

... for an N-input boolean function, size = __________2N x #outputs

Page 12: Memory, Latches, & Registers - Computer Science

L13 – Memory 12Comp 411

Analog Storage: Using Capacitors

We‟ve chosen to encode information using voltages and we know from physics that we can “store” a voltage as “charge” on a capacitor:

bit line

N-channel FET serves

as an access switch

VREF

Pros:w compact!Cons:w it leaks! refreshw complex interfacew reading a bit, destroys it

(you have to rewrite the value after each read)

w it‟s NOT a digital circuitTo write:

Drive bit line, turn on access fet,force storage cap to new voltage

To read:precharge bit line, turn on access fet,detect (small) change in bit line voltage

word line

This storage circuit is the basis for commodity DRAMs

Page 13: Memory, Latches, & Registers - Computer Science

L13 – Memory 13Comp 411

DRAM Organization

Page 14: Memory, Latches, & Registers - Computer Science

L13 – Memory 14Comp 411

DRAM Errors

Cosmic Ray Flux vs Particle Energy (link)

•Typical RAM cell stores about 75 fC (femtocoulombs) of charge.

•That‟s about ½ million electrons

•Or at 3 Volts about 1.5 MeV (megaelectron volts)

•Sounds like a lot!

•Until you consider other sources.

•Google reports that error rates are 100‟s to 1000‟s of times higher than thought. Over 3700 errors per DIMM per year.

Page 15: Memory, Latches, & Registers - Computer Science

L13 – Memory 15Comp 411

Y

S

B

A “Digital” Storage Element

It‟s also easy to build a settable DIGITAL storage element (called a latch) using a MUX and FEEDBACK:

0

1

A

Page 16: Memory, Latches, & Registers - Computer Science

L13 – Memory 16Comp 411

Y

S

B

A “Digital” Storage Element

It‟s also easy to build a settable DIGITAL storage element (called a latch) using a MUX and FEEDBACK:

0

1

A

Page 17: Memory, Latches, & Registers - Computer Science

L13 – Memory 17Comp 411

Y

S

B

A “Digital” Storage Element

It‟s also easy to build a settable DIGITAL storage element (called a latch) using a MUX and FEEDBACK:

0

1

A

Here‟s a feedback path,so it‟s no longer acombinational circuit.

Page 18: Memory, Latches, & Registers - Computer Science

L13 – Memory 18Comp 411

Y

S

B

A “Digital” Storage Element

It‟s also easy to build a settable DIGITAL storage element (called a latch) using a MUX and FEEDBACK:

0

1

G

0011

D

----01

QIN

01----

QOUT

0101

A

D

G

Q

Here‟s a feedback path,so it‟s no longer acombinational circuit.

Page 19: Memory, Latches, & Registers - Computer Science

L13 – Memory 19Comp 411

Y

S

B

A “Digital” Storage Element

It‟s also easy to build a settable DIGITAL storage element (called a latch) using a MUX and FEEDBACK:

0

1

G

0011

D

----01

QIN

01----

QOUT

0101

“state” signalappears as bothinput and output

A

D

G

Q

Here‟s a feedback path,so it‟s no longer acombinational circuit.

Page 20: Memory, Latches, & Registers - Computer Science

L13 – Memory 20Comp 411

Y

S

B

A “Digital” Storage Element

It‟s also easy to build a settable DIGITAL storage element (called a latch) using a MUX and FEEDBACK:

0

1

G

0011

D

----01

QIN

01----

QOUT

0101

Q follows D

Q stable

“state” signalappears as bothinput and output

A

D

G

Q

Here‟s a feedback path,so it‟s no longer acombinational circuit.

Page 21: Memory, Latches, & Registers - Computer Science

L13 – Memory 21Comp 411

Looking Under the Covers

Let‟s take a quick look at the equivalent circuit for our MUX when the gate is LOW (the feedback path is active)

DG=0

QQ

G=0

D

0

1

1

1Q

This storage circuit is the basis for commodity SRAMs

Advantages: 1) Maintains remembered state for as

long as power is applied.2) State is DIGITAL

Disadvantage:1) Requires more transistors

Page 22: Memory, Latches, & Registers - Computer Science

L13 – Memory 22Comp 411

Why Does Feedback = Storage?

BIG IDEA: use positive feedback to maintain storage indefinitely. Our logic gates are built to restore marginal signal levels, so noise shouldn‟t be a problem!

VINVOUT

Result: a bistable storage element

Page 23: Memory, Latches, & Registers - Computer Science

L13 – Memory 23Comp 411

Why Does Feedback = Storage?

BIG IDEA: use positive feedback to maintain storage indefinitely. Our logic gates are built to restore marginal signal levels, so noise shouldn‟t be a problem!

VINVOUT

Result: a bistable storage element

Waveform for inverter pair

VIN

VOUT

Page 24: Memory, Latches, & Registers - Computer Science

L13 – Memory 24Comp 411

Why Does Feedback = Storage?

BIG IDEA: use positive feedback to maintain storage indefinitely. Our logic gates are built to restore marginal signal levels, so noise shouldn‟t be a problem!

VINVOUT

Result: a bistable storage element

Feedback constraint:VIN = VOUT

Waveform for inverter pair

VIN

VOUT

Page 25: Memory, Latches, & Registers - Computer Science

L13 – Memory 25Comp 411

Why Does Feedback = Storage?

BIG IDEA: use positive feedback to maintain storage indefinitely. Our logic gates are built to restore marginal signal levels, so noise shouldn‟t be a problem!

VINVOUT

Result: a bistable storage element

Feedback constraint:VIN = VOUT

Waveform for inverter pair

VIN

VOUT Three solutions:w two end-points are stablew middle point is unstable

Not affectedby noise

We‟ll get back to this!

Page 26: Memory, Latches, & Registers - Computer Science

L13 – Memory 26Comp 411

Static D Latch

G

D Q

D

G

Q stable

Q follows D

Positive latch

Q

“static” means latch will hold data (i.e., value of Q) while G is inactive, however long that may be.

G

D Q

Negative latch

Q

G

D

1

0

What is thedifference?

Page 27: Memory, Latches, & Registers - Computer Science

L13 – Memory 27Comp 411

A DYNAMIC DisciplineDesign of sequential circuits MUST guarantee that inputs to sequential devices are valid and stable during periods when they may influence state changes. This is assured with additional timing specifications.

G

D

Page 28: Memory, Latches, & Registers - Computer Science

L13 – Memory 28Comp 411

A DYNAMIC DisciplineDesign of sequential circuits MUST guarantee that inputs to sequential devices are valid and stable during periods when they may influence state changes. This is assured with additional timing specifications.

G

D

>tPULSE

tPULSE: minimum pulse widthguarantee G is active for long enough for latch to capture data

Page 29: Memory, Latches, & Registers - Computer Science

L13 – Memory 29Comp 411

A DYNAMIC DisciplineDesign of sequential circuits MUST guarantee that inputs to sequential devices are valid and stable during periods when they may influence state changes. This is assured with additional timing specifications.

G

D

>tPULSE

tPULSE: minimum pulse widthguarantee G is active for long enough for latch to capture data

>tSETUP

tSETUP: setup timeguarantee that D value has propagated through feedback path before latch closes

Page 30: Memory, Latches, & Registers - Computer Science

L13 – Memory 30Comp 411

A DYNAMIC DisciplineDesign of sequential circuits MUST guarantee that inputs to sequential devices are valid and stable during periods when they may influence state changes. This is assured with additional timing specifications.

G

D

>tPULSE

tPULSE: minimum pulse widthguarantee G is active for long enough for latch to capture data

>tSETUP

tSETUP: setup timeguarantee that D value has propagated through feedback path before latch closes

>tHOLD

tHOLD: hold timeguarantee latch is closed and Q is stable before allowing D to change

Page 31: Memory, Latches, & Registers - Computer Science

L13 – Memory 31Comp 411

Flakey Control Systems

Here‟s a strategy for saving 2 bucks the next time you find yourself at a toll booth!

Page 32: Memory, Latches, & Registers - Computer Science

L13 – Memory 32Comp 411

Flakey Control Systems

Here‟s a strategy for saving 2 bucks the next time you find yourself at a toll booth!

Page 33: Memory, Latches, & Registers - Computer Science

L13 – Memory 33Comp 411

Flakey Control Systems

Here‟s a strategy for saving 2 bucks the next time you find yourself at a toll booth!

Page 34: Memory, Latches, & Registers - Computer Science

L13 – Memory 34Comp 411

Flakey Control Systems

WARNING:Professional Drivers Used!

DON‟T try thisAt home!

Here‟s a strategy for saving 2 bucks the next time you find yourself at a toll booth!

Page 35: Memory, Latches, & Registers - Computer Science

L13 – Memory 35Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 36: Memory, Latches, & Registers - Computer Science

L13 – Memory 36Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 37: Memory, Latches, & Registers - Computer Science

L13 – Memory 37Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 38: Memory, Latches, & Registers - Computer Science

L13 – Memory 38Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 39: Memory, Latches, & Registers - Computer Science

L13 – Memory 39Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 40: Memory, Latches, & Registers - Computer Science

L13 – Memory 40Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 41: Memory, Latches, & Registers - Computer Science

L13 – Memory 41Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 42: Memory, Latches, & Registers - Computer Science

L13 – Memory 42Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 43: Memory, Latches, & Registers - Computer Science

L13 – Memory 43Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 44: Memory, Latches, & Registers - Computer Science

L13 – Memory 44Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 45: Memory, Latches, & Registers - Computer Science

L13 – Memory 45Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 46: Memory, Latches, & Registers - Computer Science

L13 – Memory 46Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 47: Memory, Latches, & Registers - Computer Science

L13 – Memory 47Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 48: Memory, Latches, & Registers - Computer Science

L13 – Memory 48Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 49: Memory, Latches, & Registers - Computer Science

L13 – Memory 49Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

Page 50: Memory, Latches, & Registers - Computer Science

L13 – Memory 50Comp 411

Escapement Strategy

The Solution:Add two gatesand only openone at a time.

KEY: At no time is there an open path through both gates…

Page 51: Memory, Latches, & Registers - Computer Science

L13 – Memory 51Comp 411

G

D Q

G

D Q

Edge-triggered Flip Floplogical “escapement”

D QD

CLK

Q D

CLK

Qmaster slave

Observations:w only one latch “transparent” at any time:w master closed when slave is open (CLK is high)w slave closed when master is open (CLK is low) no combinational path through flip flop

w Q only changes shortly after 0 1 transition of CLK, so flip flop appears to be “triggered” by rising edge of CLK

Transitions mark instants, not

intervals

Page 52: Memory, Latches, & Registers - Computer Science

L13 – Memory 52Comp 411

Flip Flop Waveforms

G

D Q

G

D Q D QD

CLK

Q D

CLK

Qmaster slave

D

CLK

Q

master closedslave open

slave closedmaster open

Page 53: Memory, Latches, & Registers - Computer Science

L13 – Memory 53Comp 411

Two Issues

G

D Q

G

D QD Qmaster slave

CLK

• Must allow time for the input‟s value to propagate to the Master‟s output while CLK is LOW.

• This is called “SET-UP” time

• Must keep the input stable, just after CLK transitions to HIGH. This is insurance in case the SLAVE‟s gate opens just before the MASTER‟s gate closes.

• This is called “HOLD-TIME”

• Can be zero (or even negative!)

• Assuring “set-up” and “hold” times is what limits a computer‟s performance

Page 54: Memory, Latches, & Registers - Computer Science

L13 – Memory 54Comp 411

Flip-Flop Timing Specs

CLK

D

QD QD

CLK

Q

Page 55: Memory, Latches, & Registers - Computer Science

L13 – Memory 55Comp 411

Flip-Flop Timing Specs

CLK

D

QD QD

CLK

Q

tPD: maximum propagation delay, CLK Q

Page 56: Memory, Latches, & Registers - Computer Science

L13 – Memory 56Comp 411

Flip-Flop Timing Specs

CLK

D

QD QD

CLK

Q<tPD

tPD: maximum propagation delay, CLK Q

Page 57: Memory, Latches, & Registers - Computer Science

L13 – Memory 57Comp 411

Flip-Flop Timing Specs

CLK

D

QD QD

CLK

Q<tPD

tPD: maximum propagation delay, CLK Q

>tSETUP

tSETUP: setup timeguarantee that D has propagated through feedback path before master closes

Page 58: Memory, Latches, & Registers - Computer Science

L13 – Memory 58Comp 411

Flip-Flop Timing Specs

CLK

D

QD QD

CLK

Q<tPD

tPD: maximum propagation delay, CLK Q

>tSETUP

tSETUP: setup timeguarantee that D has propagated through feedback path before master closes

>tHOLD

tHOLD: hold timeguarantee master is closed and data is stable before allowing D to change

Page 59: Memory, Latches, & Registers - Computer Science

L13 – Memory 59Comp 411

Summary

• Regular Arrays can be used to implement arbitrary logic functions • ROMs decode every input combination (fixed-AND array)

and compute the output for it (customized-OR array) • PLAs decode an minimal set of input combinations

(both AND and OR arrays customized)• Memories

• ROMs are HARDWIRED memories• RAMs include storage elements at each WORD-line

and BIT-line intersection• dynamic memory: compact, only reliable short-term• static memory: controlled use of positive feedback

• Level-sensitive D-latches for static storage• Dynamic discipline (setup and hold times)