In this method, each successive cache entry is mapped to successive entries in the main memory. Once all cache lines are mapped to one memory address, they start looping again.
For a cache with k
lines, when an m
bit address is received from the CPU:
m - k
bits) are the same, then its a hit.In this method, any address from the main memory can be stored in any cache line.
The entire address is used as a tag for the cache line.
So, each cache line must end up having a comparator to check tag bits with a given address, so it is more expensive.
In k-way set associative mapping, every k successive blocks in the cache are grouped into a set. Then we will use set number instead of block number in the address. Because each set has k blocks, we differentiate using tag.