Hierarchical Memory Systems

62
Hierarchical Memory Systems Prof. Sin-Min Lee Department of Computer Science

description

Hierarchical Memory Systems. Prof. Sin-Min Lee Department of Computer Science. CS147 Lecture 12. Implementing JK Flip-Flop using only a T Flip-Flop. Note how the areas marked off with a blue box behave like a T flip-flop, while the area within the purple box behave like a D flip-flop. - PowerPoint PPT Presentation

Transcript of Hierarchical Memory Systems

Page 1: Hierarchical Memory Systems

Hierarchical Memory Systems

Prof. Sin-Min Lee

Department of Computer Science

Page 2: Hierarchical Memory Systems
Page 3: Hierarchical Memory Systems
Page 4: Hierarchical Memory Systems
Page 5: Hierarchical Memory Systems
Page 6: Hierarchical Memory Systems
Page 7: Hierarchical Memory Systems
Page 8: Hierarchical Memory Systems

Implementing JK Flip-Flop using only a T Flip-Flop

Note how the areas marked off with a blue box behave like a T flip-flop, while the area within the purple box behave like a D flip-flop.

From this last chart, we can derive the following chart:

Page 9: Hierarchical Memory Systems

Implementing JK Flip-Flop using only a T Flip-Flop

To derive the next chart, we work in reverse, asking, “What is the input into the T (toggle) function that will result in the output shown in the previous chart?” In this case, the first column of Q is 0 and our circled value is a 0; a 0 will give this result.

The input that will give us a 1, when Q is 1, is also 0. Refer back to the T flip-flop chart to see that on 0, there is no change; 1 “toggles”.

Page 10: Hierarchical Memory Systems

Implementing JK Flip-Flop using only a T Flip-Flop

This is the final Karnaugh map and the associated equation for T.

Page 11: Hierarchical Memory Systems

Implementing T Flip-Flop using only a JK Flip-Flop

This time, we are doing the reverse again, asking what values of J and K will give us the corresponding values in the T chart above.

00 or 01 will give 0, so weenter “0X”. X is our “don't care” value; it can be 0 or 1.

Page 12: Hierarchical Memory Systems

Implementing T Flip-Flop using only a JK Flip-Flop

Once we derive all the values, we have to split this into two, in order to get an equation that defines J and another than defines K.

Page 13: Hierarchical Memory Systems

Implementing T Flip-Flop using only a JK Flip-Flop

Here is the final implementation.

Page 14: Hierarchical Memory Systems

Implementing this FSM using a T Flip-Flop

Using the values from the first chart, we can get this second chart.

Then, we apply the same reverse method to determine what input values we would need to arrive at the ones listed in this second chart.

Page 15: Hierarchical Memory Systems

Implementing this FSM using a T Flip-Flop

T = XQ' + X'Q

Page 16: Hierarchical Memory Systems

Implementing this FSM using a D Flip-Flop

This time we use the same FSM and same initial chart, but now derive an equation for D.

Page 17: Hierarchical Memory Systems

Implementing this FSM using a D Flip-Flop

Since this is a delay, the corresponding chart is the same.

Page 18: Hierarchical Memory Systems

Implementing this FSM using a D Flip-Flop

Finally, here is our graph.

Page 19: Hierarchical Memory Systems

Implementing Flip-Flop

Page 20: Hierarchical Memory Systems

How can we create a flip-flop using another flip-flop?

Say we have a flip-flop BG with the following properties:

Let’s try to implement this flip-flop using a T flip-flop

BG Q+

00 Q’

01 Q

10 1

11 0

Page 21: Hierarchical Memory Systems

Step 1:Create Table

The first step is to draw a table with created flip-flop first (in this case BG), Q, Q+, and the creator flip-flop (in this case T)

-Look at Q, Q+ to determine value of T

BG Q Q+ T

00 0 1 1

00 1 0 1

01 0 0 0

01 1 1 0

10 0 1 1

10 1 1 0

11 0 0 0

11 1 0 1

Page 22: Hierarchical Memory Systems

Step 2:Karnaugh Map

Draw a Karnaugh Map, based on when T is a 1

BG Q Q+ T

00 0 1 1

00 1 0 1

01 0 0 0

01 1 1 0

10 0 1 1

10 1 1 0

11 0 0 0

11 1 0 1

1 1

0 0

0 1

1 0

BGQ

00

01

10

11

0 1

T=B’G’+BGQ+G’Q’

Page 23: Hierarchical Memory Systems

Step 3: Draw DiagramT=B’Q’+ BGQ+G’Q’

B G

Q

Q’

Page 24: Hierarchical Memory Systems
Page 25: Hierarchical Memory Systems
Page 26: Hierarchical Memory Systems
Page 27: Hierarchical Memory Systems
Page 28: Hierarchical Memory Systems
Page 29: Hierarchical Memory Systems
Page 30: Hierarchical Memory Systems

The Root of the Problem:Economics

Fast memory is possible, but to run at full speed, it needs to be located on the same chip as the CPU Very expensive Limits the size of the memory

Do we choose: A small amount of fast memory? A large amount of slow memory?

Page 31: Hierarchical Memory Systems

Memory Hierarchy Design (2)

It is a tradeoff between size, speed and cost and exploits the principle of locality.

Register Fastest memory element; but small storage; very expensive

Cache Fast and small compared to main memory; acts as a buffer between the CPU

and main memory: it contains the most recent used memory locations (address and contents are recorded here)

Main memory is the RAM of the system Disk storage - HDD

Registers(CPU)

Cache (one ormore levels)

MainMemory

DiskStorage

Specialized bus(internal or external

to CPU)

Memory bus I/O bus

Page 32: Hierarchical Memory Systems

Memory Hierarchy Design (3)

Comparison between different types of memory

size:speed:$/Mbyte:

32 - 256 B2 ns

Register Cache Memory

32KB - 4MB4 ns$100/MB

128 MB60 ns$1.50/MB

20 GB8 ms$0.05/MB

larger, slower, cheaper

HDD

Page 33: Hierarchical Memory Systems
Page 34: Hierarchical Memory Systems
Page 35: Hierarchical Memory Systems
Page 36: Hierarchical Memory Systems
Page 37: Hierarchical Memory Systems
Page 38: Hierarchical Memory Systems
Page 39: Hierarchical Memory Systems

Memory Hierarchy

Can only do useful work at the top 90-10 rule: 90% of time is spent of 10% of program Take advantage of locality temporal locality keep recently accessed memory locations in cache spatial locality keep memory locations nearby accessed memory

locations in cache

Page 40: Hierarchical Memory Systems
Page 41: Hierarchical Memory Systems
Page 42: Hierarchical Memory Systems
Page 43: Hierarchical Memory Systems
Page 44: Hierarchical Memory Systems
Page 45: Hierarchical Memory Systems

The connection between the CPU and cache is very fast; the connection between the CPU and memory is slower

Page 46: Hierarchical Memory Systems
Page 47: Hierarchical Memory Systems
Page 48: Hierarchical Memory Systems
Page 49: Hierarchical Memory Systems
Page 50: Hierarchical Memory Systems
Page 51: Hierarchical Memory Systems
Page 52: Hierarchical Memory Systems
Page 53: Hierarchical Memory Systems

The Cache Hit Ratio

How often is a word found in the cache? Suppose a word is accessed k times in a short

interval 1 reference to main memory (k-1) references to the cache

The cache hit ratio h is then

kk

h1-

=

Page 54: Hierarchical Memory Systems

Reasons why we use cache

• Cache memory is made of STATIC RAM – a transistor based RAM that has very low access times (fast)

• STATIC RAM is however, very bulky and very expensive

• Main Memory is made of DYNAMIC RAM – a capacitor based RAM that has very high access times because it has to be constantly refreshed (slow)

• DYNAMIC RAM is much smaller and cheaper

Page 55: Hierarchical Memory Systems

Performance (Speed) Access time

Time between presenting the address and getting the valid data (memory or other storage)

Memory cycle time Some time may be required for the memory to

“recover” before next access cycle time = access + recovery

Transfer rate rate at which data can be moved for random access memory = 1 / cycle time

(cycle time)-1

Page 56: Hierarchical Memory Systems
Page 57: Hierarchical Memory Systems

Memory Hierarchy

size ? speed ? cost ? registers

in CPU

internal may include one or more levels of cache

external memory backing store

smallest, fastest, most expensive, most frequently accessed

medium, quick, price varies

largest, slowest, cheapest, least frequently accessed

Page 58: Hierarchical Memory Systems
Page 59: Hierarchical Memory Systems
Page 60: Hierarchical Memory Systems
Page 61: Hierarchical Memory Systems
Page 62: Hierarchical Memory Systems