The Memory Wall

- Processors get faster more quickly than memory
- Processor speed improvement: 35% - 55%
- Memory latency improvement 7%
Motivation
Locality
- Temporal locality: recently referenced data is likely to be referenced soon
- Spatial locality: more likely to reference data near referenced data
- Proactive: fetching data in large chunks to include nearby data
- Holds for data and instructions
Concrete Memory Hierarchy

1st level: primary caches
- Split instruction (l$) and data (D$)
- TYpically 8-64KB each, access 1-2 cycles
2nd Level: Second-level cache (L2$)
- On chip
- Made of SRAM
- Typically 512KB - 16MB, access 5-10 cycles
3rd level: main memory
- Made of DRAM
- Typically 1GB = 64GB for PCs, access > 100 cycles
4th level: disk (swap and files)
- TBs-PBs, access millions of cycles, made of magnetic iron oxide disks
- Goal is to optimize average access time:
Cache Organization
Basic Memory Array Struction
Number of entries: $2^n$ where n is the number of address bits (1024 entries to 10 bit address)
- Decoder change n-bit address into $2^n$ one-hot signals
- One bit address travel on word line
Size of entries
- Width of data accessed
- Data travels on “bitlines

Address Breakdown
Doubilng the ways at fixed capacity halves the number of sets, that removes 1 index bit and adds 1 tag bit
Set-Way Associative
$$
\#\text{sets} = \frac{C}{B \cdot A} \qquad (C=\text{capacity},\ B=\text{block size},\ A=\text{ways}) \newline \text{offset} = \log_2 B \qquad \text{index} = \log_2(\#\text{sets}) \qquad \text{tag} = n_{\text{addr}} - \text{index} - \text{offset} \newline \underbrace{\text{tag}}{[31:15]}\;\big|\;\underbrace{\text{index}}{[14:5]}\;\big|\;\underbrace{\text{offset}}_{[4:0]} \quad\text{(32KB, 32B blocks, direct-mapped)}
$$
One-way associative