120 likes | 278 Views
Exploiting the Memory Hierarchy. Chapter 7 P&H. Introduction. Desire is to have unlimited amounts of fast memory Can exploit locality of reference to appear to have lots of fast memory Two types of locality Temporal Locality Spatial Locality. Memory Hierarchy. Memory Hierarchy.
E N D
Exploiting the Memory Hierarchy Chapter 7 P&H
Introduction • Desire is to have unlimited amounts of fast memory • Can exploit locality of reference to appear to have lots of fast memory • Two types of locality • Temporal Locality • Spatial Locality
Memory Hierarchy • data only copied between two levels at a time • minimum unit is called a block • hit rate is fraction of memory accesses found in upper level • miss rate = (1 – hit rate) • hit time Time to access upper level • miss penality time to replace block in upper level with corresponding block from lower level
Cache Basics • Caches first appear in early 1960’s • following cache has single word sized block • How do we know if the requested item is in the cache? • If it is where isit?
Direct Mapped Cache • cache address = (block address) mod (No blocks in cache) No blocks in cache should be a power of two
A d d r e s s ( s h o w i n g b i t p o s i t i o n s ) 3 1 3 0 1 3 1 2 1 1 2 1 0 B y t e o f f s e t 1 0 2 0 H i t D a t a T a g I n d e x I n d e x V a l i d T a g D a t a 0 1 2 1 0 2 1 1 0 2 2 1 0 2 3 2 0 3 2 Tagged Storage
Example • How many bits in total are required for a direct mapped cache with 64 KB of Data and One word blocks, assuming a 32 bit address?
Handling Misses • No Modifications required to our pipelined data-path to handle hits • On a miss a basic approach is to stall the entire data-path until the value is fetched • Separate controller used for the caches