The Memory Wall

image.png

Motivation

Locality

Concrete Memory Hierarchy

image.png

1st level: primary caches

2nd Level: Second-level cache (L2$)

3rd level: main memory

4th level: disk (swap and files)

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)

Size of entries

image.png

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