Answer: 24
In a set-associative cache, the physical address is divided into three fields:
Physical Address=Tag+Set Index+Block Offset
Let:
- s be the number of bits for the Set Index.
- b be the number of bits for the Block Offset.
The total number of bytes in one way of the cache (or the size of each set's capacity contribution) is given by:
Number of Sets×Block Size=AssociativityCache Size
Taking the base-2 logarithm on both sides gives the combined bits for the Set Index and Block Offset:
s+b=log2(AssociativityCache Size)
Given:
- Cache Size=512 KB=219 bytes
- Associativity=8=23
Substituting these values:
s+b=log2(23219)=log2(216)=16 bits
Since the total physical address width is 40 bits, the width of the tag field is:
Tag bits=Physical Address Width−(s+b)
Tag bits=40−16=24 bits