Cache Memory Sheet and Model Answer: Solution
Cache Memory Sheet and Model Answer: Solution
Cache Memory Sheet and Model Answer: Solution
Given the 16-bit memory address references below, as BYTE addresses in hex format:
0020, 0022, 00C8, 00C9, 0032, 0023, 004A, 0062, 0020, 0021
b) Given a cache with a total of 16 words organized as 1 word/block, identify the tag, and the index
for each reference using direct mapping. List if each reference is a hit or miss. How many bits in
total does the cache has?
c) Repeat (b), but with 2 words/block for a cache with a total of 16 words.
d) Repeat (b) for a two-way set associative cache with 2 words/block, and a total size of 16 words.
e) Repeat (b) for a fully associative cache with 1 word/block, and a total size of 16 words.
f) Assume the given memory references are called in a loop of 100 times. Recalculate the number
of hits and misses for all cases: (b), (c), (d) and (e).
For set associative and fully associative caches, use Least Recently Used (LRU) replacement.
Solution:
b) Given a cache with a total of 16 words organized as 1 word/block, identify the tag, and the index
for each reference using direct mapping. List if each reference is a hit or miss
c) Repeat (b), but with 2 words/block for a cache with a total of 16 words.
Total bits in the Cache = 8 *(1 + 10+ 32*2) = 8*75 = 600 bits
d) Repeat (b) for a two-way set associative cache with 2 words/block, and a total size of 16 words
Total bits in the Cache = 8 *(1 + 11+ 32*2) = 8*76 = 608 bits
e) Repeat (b) for a fully associative cache with 1 word/block, and a total size of 16 words.
No index. A word is written into the first available space in the cache.
Total bits in the Cache = 16 *(1 + 14+ 32) = 16*47 = 752 bits
f) Assume the given memory references are called in a loop of 100 times. Recalculate the number
of hits and misses for all cases: (b), (c), (d) and (e).
Misses Hits
For case b: 6+99*4= 402 4+99*6=598
For case c: 6+99*6= 402 4+99*4=598
For case d: 5+99*0= 5 5+99*10=995
For case e: 5+99*0= 5 5+99*10=995