In: Computer Science
How many total bits are required for a 1-way set associative cache with 16 KB of data and 8-word blocks, assuming a 32-bit address?
Given that 1-way set associative cache with 16 Kb of data and 8-word blocks, and 32 but address.
assuming each word is 1 byte, that implies 8-words means 8 bytes of data, therefore each block size is 8 bytes.
To refer 8 bytes of information we need 3 bits (i.e, 23 = 8).
Therefore word offset = 3 bits.
cache size is 16 Kilo bytes,
The number of blocks in the cache = cache size / block size = 16 Kb / 8 bytes = (16*1024 bytes) / 8 bytes = 2*1024 blocks = 2048 blocks, and the cache is 1-way set associative which means we have to refer each block as an independent. Which means we have 2048 sets.
To refer these 2048 sets we need 11 bits (i.e, 211 = 2048)
Therefore set index = 11 bits.
Therefore total number of bits required to refer the cache is = set index + word offset = 11 bits + 3 bits = 14 bits.
Note:
tag bits = total memory width - (set index + word offset) = 32 - (11+3) = 32 -14 = 18 bits.