← ⚡ Cache Memory
Subtopic 5 of 9

3.5Address split

The idea

The address is cut into tag | index | offset. Offset picks the byte inside the block, index picks the set, and the tag says which block is stored there.

Think of it like this: A postal address: tag is the city, index is the street, offset is the house number.

Why it exists

This split is exactly what the hardware uses, and it also tells you how big the tag memory must be.

How it works

  1. offset bits = log2(block size).
  2. index bits = log2(number of sets).
  3. tag bits = address bits − index − offset.
  4. Tag directory size = lines × (tag + valid [+ dirty]).

Worked example: 32-bit address, 64 KB cache, 64 B blocks, direct mapped

Lines = 65536 ÷ 64 = 1024. offset = 6, index = 10, tag = 16. Directory = 1024 × (16 + 1) = 17,408 bits.

Now play with it

  • →Change "Ways" from 1 to 4 and watch the index shrink and the tag grow.
  • →Tick "dirty bit" and watch the directory size change.

Total 32 bits. Click a field for details.

Lines1024
Sets256
Tag bits18
Tag directory bits1024 × 19 = 19456

Check yourself

Same cache (32-bit address, 64 KB, 64 B blocks) but 4-way set associative. How many tag bits?

Remember: More ways: fewer index bits, more tag bits.
Exam notes (the dense version)

offset = log₂(block size) · index/set = log₂(#lines or #sets) · tag = the remaining high bits.

Previous year questions: Cache Memory (22)

PYQs are grouped by topic, so this is the full set for Cache Memory; try the ones that match this subtopic. Open all 22 on the topic page.