Question

In: Computer Science

2. Caches are commonly implemented in SRAM, and the cache layout impacts the total amount of...

2. Caches are commonly implemented in SRAM, and the cache layout impacts
the total amount of SRAM required to implement the cache. For the following
two problems, assume the caches are byte addressable and addresses and
data words are both 32 bits.


a. How many total bits are required to implement a 128 KiB direct-mapped
cache with 4-word blocks? [25 points]


b. How many total bits are required to implement a 128 KiB direct-mapped
cache with 32-word blocks? [25 points]

Solutions

Expert Solution

1.

The number of bits in cache= 2n x (block size + tag size + valid field size)

  • Cache size is 2n blocks
  • Block size is 2m words (2m+2 words)
  • Size of tag field 32 – (n + m + 2)

Therefore,

2n x (2m x 32 + 32 – (n + m + 2) + 1)

= 2n x (2m x 32 + 31 – n - m)

in the given question,

   Cache size = 128 KB = 217 bytes = 215 words = 213 blocks

Cache entry size = block data bits + tag bits + valid bit

                   = 128 + (32 – 13 – 2 – 2) + 1 = 144 bits

Therefore, cache size = 213´ 144 bits = 213´ (1.25 ´ 128) bits = 1.25 ´ 220 bits = 1.25 Mbits

2.

Cache size = 128 KB = 217 bytes = 215 words = 213 blocks

Cache entry size = block data bits + tag bits + valid bit

                   = 128 + (32 – 10 – 2 – 2) + 1 = 147 bits

Therefore, cache size = 213´ 147 bits


Related Solutions

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT