Answer: 18
In a direct-mapped cache, the physical address is divided into three fields:
[ Tag ] [ Line Index ] [ Block Offset ]
Let's calculate the size of each field based on the given parameters:
-
Total Physical Address Bits:
The main memory is byte-addressable and has a size of 232 bytes.
Physical Address Size=log2(232)=32 bits
-
Block Offset Bits:
The block size is 32 bytes.
Block Offset=log2(32)=5 bits
-
Line Index Bits:
The cache has 512 cache lines.
Line Index=log2(512)=9 bits
Now, we can find the size of the tag field:
Tag Size=Total Physical Address Bits−(Line Index Bits+Block Offset Bits)=32−(9+5)=32−14=18 bits
Thus, the size of the tag field is 18 bits.