|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Managing cache |
|
|
|
|
|
|
|
How to manage cache
efficiently? |
|
|
|
Temporal locality |
|
|
|
|
copy data into cache when
accessed |
|
|
|
Spatial locality |
|
|
|
|
copy 2k block of data including accessed data item |
|
|
|
|
How to choose range of
addresses to copy? |
|
|
|
|
Might choose data from
addr - delta to addr + delta |
|
|
|
|
where delta is 2k-1 |
|
|
|
|
However, this is not so
convenient to manage |
|
|
|
|
Instead, use all
addresses with same upper n-k bits |
|
|
|
|
Example: |
|
|
|
|
Want to access data with
address A31-0. |
|
|
|
|
Copy 32 bytes with
addresses: |
|
|
|
|
A31-5
00000 |
|
|
|
|
A31-5
00001 |
|
|
|
|
A31-5
00010 |
|
|
|
|
. . . |
|
|
|
|
A31-5
11111 |
|
|
|
|
These 32 bytes are called
a cache line. |
|
|
|
|
The upper 27 bits are the tag. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|