Computer Organisation and Architecture · Set Associative and Fully Associative Cache
Tag Bits in Associative Mapping
Overview
In fully associative mapping any block of main memory can be placed in any cache line, so a line cannot infer which block it holds from the address.
Each line must therefore store the entire block number as its tag, which removes conflict misses but makes every access search all tags.
Key concepts
- Fully associative mapping: any block of main memory can be placed in any line of the cache; the position of a block is completely unrestricted.
- Tag in fully associative mapping: the tag is the entire block number, because the line cannot rely on the address to tell it which block it holds.
- Tag size: with 16 blocks in main memory, the tag needs 4 bits, since and 4 bits can encode any of the 16 block numbers.
- Contrast with direct mapping: in direct mapping a block can go into only one particular line, so the line information is implied by the address and is not stored; only the remaining (upper) bits are kept as the tag.
Hence tag bits are more in fully associative mapping than in direct mapping. - Advantage — no conflict miss: as long as there is some empty space in the cache, a block will never be replaced, so cache capacity is used completely.
- Disadvantage — larger tags: the size of the tags increases (tolerable).
- Disadvantage — search cost (the main problem): when a memory address is presented, there is no known place to go and search, so all the tags must be examined. In direct mapping, only one particular tag was selected (using a multiplexer), only those tag bits were read, and only one comparator was used.

How it works
- Main memory has some number of blocks (for example, 16), and any of them may reside in any cache line.
- Each line must therefore be able to distinguish among all possible blocks (all 16).
- The number of tag bits equals the number of bits in the block number: .
- The tag field stores the entire block number (4 bits for 16 blocks).
- On an access, since the target line is unknown, all tags are examined and compared against the presented address.
Formulas
-
-
number of blocks in main memory: total blocks that any cache line may hold.
-
-
the line portion is implied by the address and is not stored.
Worked examples
Main memory = 16 blocks, fully associative cache:
- Any of the 16 blocks may reside in any line.
- Each line must distinguish among all 16 blocks.
- Bits needed = bits.
- So the tag field = the entire block number (4 bits).
Comparison
| Feature | Direct mapping (earlier scheme) | Fully associative mapping |
|---|---|---|
| Block placement | A block goes to exactly one line | Any block in any line |
| Tag contents | Only the remaining (upper) bits; line part implied | Entire block number |
| Tag size | Smaller | Larger (4 bits for 16 blocks) |
| Search on an address | Select one tag via multiplexer, read it, one comparator | Must examine all tags |
| Conflict misses | Possible | None (as long as free space exists) |
| Cache utilization | Limited by fixed mapping | Complete use of capacity |
Revision summary
- In fully associative mapping the tag is the whole block number; for 16 blocks that is 4 bits.
- Placement is unrestricted, so the line cannot infer the block from the address — the full block number must be stored.
- No conflict misses occur as long as empty space exists; capacity is fully used.
- Tags are larger than in direct mapping.
- Every access must search all tags, because the target line is unknown.
- Direct mapping needs only a multiplexer to select one tag and a single comparator; fully associative mapping cannot do this.