A direct mapped cache memory of 1 MB has a block size of 256 bytes. The cache has an access time of 3 ns and a hit rate of 94%. During a cache miss, it takes 20 ns to bring the first word of a block from the main memory, while each subsequent word takes 5 ns. The word size is 64 bits. The average memory access time in ns (round off to 1 decimal place) is______.
13.5
Given:
Block size = 256 bytes
Word size = 64 bits = 8 bytes
Hit rate = 94% = 0.94
Cache access time = 3ns
Time taken to fetch the first word from main memory to cache = 20ns
Time taken for subsequent words to be fetched = 5ns
No. off words per block=
Time to fetch a word from main memory to cache = Time to fetch first word + Time to fetch subsequent words
Time to fetch a word from main memory = 20 + (5 × 31) = 175ns
Average memory access time = Hit Time + miss rate x miss penalty
= 0.94 × 3 + 0.06 (3 + 175)
= 2.82 + 10.68
Average memory access time = 13.5 ns