Last Updated : 19 Nov, 2018

Consider a machine with a byte addressable main memory of 220 bytes, block size of 16 bytes and a direct mapped cache having 212 cache lines. Let the addresses of two consecutive bytes in main memory be (E201F)16 and (E2020)16. What are the tag and cache line address (in hex) for main memory address (E201F)16?
(A) E, 201
(B) F, 201
(C) E, E20
(D) 2, 01F


Answer: (A)

Explanation:

Block Size = 16 bytes
Block Offset = 4 

No. of sets or cache lines = 212
Number of index bits = 12

Size of main memory = 220
Number of tag bits = 20 - 12 - 4 = 4 

Let us consider the hex address E201F
Tag lines = First 4 bits = E (in hex)
Cache lines = Next 12 bits  = 201 (In Hex) 

Refer http://virtual-labs.ac.in/labs/cse10/dmc.html


Quiz of this Question


Share your thoughts in the comments