Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1Learning Outcomes

Given a cache, where do we place new lines from memory? We first discuss the most flexible policy, which is also the most challenging to implement in hardware.

2Tag and Offset

Recall from earlier:

How do we keep track of address(es) associated with data in a cache line? We note that because the bytes in each line of data are from the same part of memory, their address will share a common set of upper bits (called a tag) and vary in their lower bits.

We therefore store tags with each line in our fully associative cache. In Figure 1, the bytes in the first cache line share the same upper 0x10F tag as the byte with address 0x43F.

"TODO"

Figure 1:Cache tag and offset in a fully associative cache. Different addressable bytes in the same cache line share the same tag.

For all caches:

3Fully Associative Caches: Determining Cache Hit

For fully associative caches[1]:

To summarize, for fully associative caches, we can check for a cache hit for a given address as follows:

  1. Build tag and offset from the memory address by splitting it into two fields:

    • Tag: upper bits of address

    • Offset: byte offset within cache line

  2. In a fully associative cache, check the tag of every line.

  3. Cache Hit If a cache tag matches the provided tag, retrieve the byte with the given offset.

Footnotes
  1. We discuss alternatives later.