For a direct-mapped cache design with a 32-bit address, the following bits of th
ID: 3683768 • Letter: F
Question
For a direct-mapped cache design with a 32-bit address, the following bits of the address are used to access the cache. What is the cache block size (in words)? How many entries does the cache have? What is the ratio between total bits required for such a cache implementation over the data storage bits? Starting from power on, the following byte-addressed cache references are recorded. How many blocks are replaced? What is the hit ratio? List the final state of the cache, with each valid entry represented as a record of .Explanation / Answer
Solution :
5.3.1 :
Here offset is 5 bits. Hence there are 2^5 words in a cache block.
Answer : 2^5 = 32
5.3.2 :
Here there are 5 bits used for index.
So there are 2^5 blocks inside the cache.
Hence cache has 2^5 = 32 entries.
5.3.3 :
Total bits required for such cache implementation = number of cache entries * bits used for each cache entry
= 32 * tag bits
= 32 * 32
= 1024 bits
Data storage bits in cache = number of blocks * size of block
= 32 * 32 * 8 bits
= 1024 * 8 bits
ratio = 1024/(1024*8) = 1/8
-----------------------------------------
-0 : miss
will be placed in cache line 0
-4 : hit (already in cache line 0).
-16: hit (already in cache line 0)
-132 : miss
132 = 100 00100
will be placed in cache line 4.
-232 = 111 01000 : miss
will be placed in cache line 7.
-160 = 101 00000 : miss
will be placed in cache line 5.
-1024 = 1 00000 00000 : miss
will be placed in cache line 0.
-30 = 11110 : miss
will be placed in cache line 0.
-140 = 100 01100: hit
Block is already in cache line 4.
-3100 : miss
will be placed in cache line 0.
-180 : 101 10100 : hit
Already in cache line 5.
-2180 : miss
will be placed in cache line 4.
--------------------------------------------
5.3.4 : 4 blocks are replaced.
for request 1024, 30, 3100, 2180 the old blocks are replaced with new blocks.
5.3.5 : Hit ratio = 4/12 = 1/3
5.3.6 :
<0,0000000000000000000011,block which has word 3100>
<4,0000000000000000000010,block which has word 2180>
<5,0000000000000000000000,block which has word 180>
<7,0000000000000000000000, block which has address 232>
all other blocks are empty.
if you have any doubts then you can ask in comment section if you find the solution helpful then upvote the answer. Thank you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.