Lecture-6.2: Direct Mapping Math Problem Solution, Part-2 (COA)


                            Practice Problems Based on Direct Mapping

 Question-03: Consider a direct mapped cache with block size 4 KB. The size of main memory is 16 GB and there are 10 bits in the tag. Find-

1)     Size of cache memory

2)     Tag directory Size

Solution:

Given-

Block size = Frame size = Line size = 4 KB

Size of main memory = 16 GB

Number of bits in tag = 10 bits

We consider that the memory is byte addressable.

Number of Bits in Physical Address-

We have,

Size of main memory

= 16 GB

= 234 bytes

Thus, Number of bits in physical address = 34 bits



Number of Bits in Block Offset-

We have,

Block size

= 4 KB

= 212 bytes

Thus, Number of bits in block offset = 12 bits




Number of Bits in Line Number-

Number of bits in line number

= Number of bits in physical address – (Number of bits in tag + Number of bits in block offset)

= 34 bits – (10 bits + 12 bits)

= 34 bits – 22 bits

= 12 bits

Thus, Number of bits in line number = 12 bits



Number of Lines in Cache-

We have-

Number of bits in line number = 12 bits

Thus, Total number of lines in cache = 212 lines

 

Size of Cache Memory-

Size of cache memory

= Total number of lines in cache x Line size

= 212 × 4 KB

= 214 KB

= 16 MB

Thus, Size of cache memory = 16 MB

Tag Directory Size-

Tag directory size

= Number of tags × Tag size

= Number of lines in cache × Number of bits in tag

= 212 × 10 bits

= 40960 bits

= 5120 bytes

Thus, size of tag directory = 5120 bytes

Post a Comment

0 Comments