Lectures‎ > ‎

Week10

Cache Memory

Basic idea: a small, fast memory that holds recently used values.

What we need:
- A way to see if a value is in the cache.
- A way to remove a value if there is a conflict

Caches can be unified or split. Unified means the cache holds both instructions and data, split means you have a separate cache for instructions and a separate cache for data.

Caches usually have a block size, for now we will assume the block size is one word (4 bytes) and a total number of blocks.

Three basic types of caches:
- Direct Mapped
- Fully Associative
- Set Associative

Direct Mapped

Consider an 4 block direct mapped cache.

Parts: tag, index number, byte offset

The byte offset is 2 bits
The index number is dependent on the size of the cache
If the cache has 4 blocks, then we need 2 bits for the index
Similarly, if the the cache has 8 blocks, then we need 3 bits for the index and so on.

The size of the tag is 32 - (byte_offset_bits + index_bits).
If we have a cache with 8 blocks, then we have tag size of (32 - (2 + 3)) = 27 bits.

Cache implementation: valid bit, tag, data value.

Lookup.
Replacement.
Metrics.


Fully Associative


No index bits.



Set Associative


Some Additional Cache Considerations


Comments