Calculating number of bits in a cache
Solution 1
using: (2^index bits) * (valid bits + tag bits + (data bits * 2^offset bits))
for the first one i get:
total bits = 2^15 (1+14+(32*2^1)) = 2588672 bits
for the cache with 16 word blocks i get:
total bits = 2^13(1 +13+(32*2^4)) = 4308992
the next smallest cache with 16 word blocks and a 32 bit address works out to be 2158592 bits, smaller than the first cache.
Solution 2
I'm stuck on the same problem too but I have the answer to the first part.
To calculate the total number of bits required
- You need to convert the KB to words and get the index bits.
- Use the answer from part 1 to get your tag bits.
Plug them into this formula.
(2^(index bits)) * ((tag bits)+(valid bits)+(data size))
Hint: data size is 64 bits in this case and valid bit is 1. So just find the index and tag bits.
And I don't think your answer is right. I didn't check but I can see you are multiplying 1+14 and (32x2) instead of adding them.
Related videos on Youtube
user3124081
Updated on June 04, 2022Comments
-
user3124081 almost 2 years
Preface: There are many different design patterns that are important to cache's overall performance. 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
Question: Calculate the 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 that the first cache.
Here's the formula:
Number of bits in a cache 2^n X (block size + tag size + valid field size)Here's what I got:
65536(1+14X(32X2)
..
is this correct? -
Chittolina almost 7 yearsHow did you find
2^15 blocks
on the first part? Since the cache data size is32KiB
and there is2 words/block
,32 * 2^10 bytes / 8 bytes
results in2^12 blocks
. -
Peter Cordes over 3 yearsThe question doesn't specify the word size, but given that address-size is 32-bit, a good guess would be word-size = 32-bit. (So a pointer is 1 word, like a typical 32-bit RISC). More likely than the 16-bit word size you're assuming. A better question would have specified the word size instead of leaving answerers to guess. Perhaps it was implied by some context the OP left out.