Answer: 19
In a set-associative cache, the physical address is divided into three fields:
Address Width=TAG+INDEX+BLOCK OFFSET
Let us express the number of bits for each field:
- Let the block size be B bytes. The number of bits required for the BLOCK OFFSET is:
BLOCK OFFSET=log2(B)
- The number of sets in an N-way set-associative cache is given by:
Number of Sets=N×BCache Size
Therefore, the number of bits for the INDEX is:
INDEX=log2(N×BCache Size)=log2(NCache Size)−log2(B)
Now, we sum the INDEX and BLOCK OFFSET bits:
INDEX+BLOCK OFFSET=[log2(NCache Size)−log2(B)]+log2(B)
INDEX+BLOCK OFFSET=log2(NCache Size)
Notice that the block size B cancels out completely. This means the sum of the index and block offset bits is independent of the block size.
Given:
- Cache Size=64 KB=216 bytes
- Associativity (N)=8=23
- Address Width=32 bits
Substituting these values into our equation:
INDEX+BLOCK OFFSET=log2(23216)=log2(213)=13 bits
Finally, we calculate the number of bits in the TAG field:
TAG=Address Width−(INDEX+BLOCK OFFSET)
TAG=32−13=19 bits