In: Electrical Engineering
Below are listed parameters for different direct-mapped cache designs.
Cache Data Size: 32 KiB
Cache Block Size: 2 words
Cache Access Time: 1 cycle
Word: 4 bytes.
Calculate the total number of bits required for the cache listed above, assuming a 32-bit address. Given that total size, find the total size of the closest direct-mapped cache with 16-word blocks of equal size or greater. Explain why the second cache, despite its larger data size, might provide slower performance than the first cache.
A. Calculate the total number of bits required for the cache :
First we require the number of cache bl0cks during the initial cache c0nfiguration.
So we lets compute the number of cache bl0cks in the initial cache c0nfiguration,thereby
we divide 32 KiB by 4 (since given that the number of bytes per w0rd = 4 )
and again by 2 (since we als0 know that the number of words per bl0ck = 2 ).
The answer yields 4o96 bl0cks
and
a resulting index field width of 12 bits.
We also have a w0rd 0ffset size of 1 bit and a byte 0f set size 0f 2 bits.
This yields a tag field size 0f 32 - 15 = 17 bits.
These tag bits, provided that its al0ng with 0ne valid bit per bl0ck, will require 18 x 4o96 = 73728 bits or 9216 bytes.
The total cache size is thus 9216 + 32768 = 41984 bytes.
The Size of the t0tal chache is generalized as,
totalsize = datasize + (validbitsize + tagsize) x bl0cks
We have,
totalsize = 41984
datasize = bl0cks x bl0cksize x wordsize
where,
wordsize = 4
therefore,
tagsize = 32 - log2(bl0cks) - log2(bl0cksize) - log2(w0rdsize)
we have already been pr0vided that,
valid bit size = 1
While Increasing bl0ck size from from 2-word bl0cks to 16-word bl0cks will definitely reduce the size of the tag from 17 bits to 14 bits.
In order to determine the number of bl0cks, we s0lve the inequality:
41984<= 64 blocks + 15 x blocks
solving this inequality equation will give 531 bl0cks, and then rounding it to the next power of 2 will give 1o24-bl0ck cache.
Conclusion:
Therefore we can say that,
larger the bl0ck size here will be an equivalent increase in the hit time and also an increase in the miss penalty when compared to the 0riginal cache.
But also fewer the number of the bl0cks may lead to a higher c0nflict miss rate when compared to the 0riginal cache.