QUESTION 2 20 Cache size 2 Consider a direct-mapped cache with 32-bit addresses.
ID: 3720442 • Letter: Q
Question
QUESTION 2 20 Cache size 2 Consider a direct-mapped cache with 32-bit addresses. The bits in an address are used in the following way when accessing cache Index 5 bits Offset: 4 bits Fill in the following blanks with integers The block size of the cache is The cache has The data size of the cache is The total number of bits for storing tags is bytes blocks bytes QUESTION 3 20 Cache operation Suppose we are using the cache in Problem 2. Starting from power on, the following byte addresses (in decimal) are recorded in cache references 1, 4, 16, 132, 232, 128, 1024, 30, 140, 3100, 228, 2180 First, construct on paper a table like following one. Then answer the questions Address Binary Addr Ta IndexMiss/Hit Cache update Block 0 : bvtes 0.. 15 16 Fill in the following blanks with integers After accessing address 1 bvtes from address 0 to address 15 are loaded in cache block QExplanation / Answer
Solution :
2)
Here offset is 4 bits.
Hence block size = 2^4 = 16 bytes
Number of blocks in cache = 2^5 = 32 blocks
data size of cache = 32 blocks * 16 bytes per block = 512 bytes
TOtal number of bits used for tag field = number of blocks * number of tag bits per block
= 2^5 * (32-(5+4))= 32 * 23 = 736 bits
3)
After accessing block 16 address 00000000 00000000 00000000 00010000 to 00000000 00000000 00000000 00011111 are loaded in cache block 0.
After accessing block 132 address 00000000 00000000 00000000 10000000 to 00000000 00000000 00000000 10001111 are loaded in cache block 8.
After accessing block 232 address 00000000 00000000 00000000 11100000 to 00000000 00000000 00000000 11101111 are loaded in cache block 14.
There are 5 hits out of the 12 memory accesses. hit rate = (5/12)*100
if you have any doubts then you can ask in commenet section. if you find the solution helpful then upvote the answer. Thank you.
Address Binaray add tag index hit/miss cache update 1 00000000 00000000 00000000 00000001 00000000 00000000 0000000 0 0000 Miss block 0. 4 00000000 00000000 00000000 00000100 00000000 00000000 0000000 0 0000 Hit 16 00000000 00000000 00000000 00010000 00000000 00000000 0000000 0 0001 miss block 1 132 00000000 00000000 00000000 10000100 00000000 00000000 0000000 0 1000 miss block 8 232 00000000 00000000 00000000 11101000 00000000 00000000 0000000 0 1110 miss block 14 128 00000000 00000000 00000000 10000000 00000000 00000000 0000000 0 1000 hit 1024 00000000 00000000 00000100 00000000 00000000 00000000 0000010 0 0000 miss block 0. 30 00000000 00000000 00000000 00011110 00000000 00000000 0000000 0 0001 hit 140 00000000 00000000 00000000 10001100 00000000 00000000 0000000 0 1000 hit 3100 00000000 00000000 00001100 00011100 00000000 00000000 0000110 0 0001 miss block 1 228 00000000 00000000 00000000 11100100 00000000 00000000 0000000 0 1110 hit 2180 00000000 00000000 00001000 10000100 00000000 00000000 0000100 0 1000 miss block 8