📖 Explanation
The main memory address is 20 bits long since the memory size is 220 bytes. The block size is 16 bytes (24 bytes), so the block offset requires 4 bits. The cache has 212 lines, so the cache line address (index) requires 12 bits. For a direct mapped cache, the remaining bits are for the tag.
Tag bits = Total address bits - Line bits - Offset bits = 20−12−4=4 bits.
The 20-bit physical address is structured as: [Tag (4 bits) | Line (12 bits) | Offset (4 bits)].
The given main memory address is (E201F)16. Let's convert this to a 20-bit binary number:
(E201F)16=(1110 0010 0000 0001 1111)2.
Now, we partition the binary address according to the structure:
Tag = First 4 bits = (1110)2=(E)16.
Cache Line Address = Next 12 bits = (0010 0000 0001)2=(201)16.
Offset = Last 4 bits = (1111)2=(F)16.
Thus, the tag is (E)16 and the cache line address is (201)16.