495 views
A byte-addressable computer has a small data cache capable of holding eight $32$-bit words. Each cache block consists of one $32$-bit word. When a given program is executed, the processor reads data from the following sequence of hex addresses:

$200, \ 204, \ 208, \ 20C, \ 2F4, \ 2F0, \ 200, \ 204, \ 218, \ 21C, \ 24C, \ 2F4$

This pattern is repeated four times. Assume that the cache is initially empty. If a direct-mapped cache is used, then the hit rate is __________ $\%$

Hit rate is (33/48 ) * 100 = 0.69 * 100 = 69 %
by

@rohit

as given address is in hex format so we assume 3*4 = 12 bits are memory mapping

as

32 bit words = 32/8=4 byte = 2^2

8 blocks as given = 2^3

tag bits 7

7 | 3 | 2

@hem chandra joshi

The address given in hex is the starting address of the 32-bit word ie from this address we have to access 4 consecutive bytes to get the data stored, so is it not that we have to take 3 least significant digits to decide the block in which the word has to be replaced.

Suppose the address is 24C then in binary it is 0010 0100 1100, so the highlighted bits should be used to decide the cache block in which the data have to be stored.

This pattern is repeated four times.

So we need to consider 5 such sequences. The answer should be (43/60)*100%.

More Accurate Answer is 68.75% .

### 1 comment

here, 4 times repetition

Total No of misses = 9 + 2 + 2 + 2 = 15

Total possible outcomes(hit+misses) = 4*12 = 48

total no of hits = total possible outcomes - total no of misses

Total no of hits = 48 - 15 = 33

hit ratio % = (33/48) * 100 = 68.75%

1 vote