Data:
1 W = 4 B (word length is 32 bits)
Physical address space (PS) = 4 G B = 230 W
Cache size (CS) = =16 KB = 214 B = 212 W
Block size (BS) = 8 W = 23 W
set associativity = 4
Formula:
number of bits = ⌈log2 n⌉
Number of lines in cache \(= \frac{{{\rm{CS}}}}{{{\rm{BS}}}}\)
Number of sets in cache \(= \frac{{number\;of\;lines}}{{set\;associativity}}\)
PAS = tag + set + block offset .....(in bits)
Calculation:
Number of lines in cache \(= \frac{{{2^{12}}}}{{{2^3}}} = {2^{9}}\)
Number of sets in cache \(= \frac{{{2^{9}}}}{4} = {2^7}\)
Tag
|
Set
|
Block Offset
|
x bits
|
7 bits
|
3 bits
|
30 = x + 7 + 3
x = 20
∴ tag = 20 bits
The number of bits for the TAG field is 20.