edited by
4,283 views
7 votes
7 votes

A two-way set associative cache memory uses blocks of four words. The cache can accommodate a total of 2048 words from main memory. The main memory size is 128K $\times$ 32. What is the size of the cache memory?

  1. 1024*32
  2. 1024*78
  3. 1024*64
  4. 1024*96
edited by

1 Answer

Best answer
7 votes
7 votes

What is the size of cache memory? This should be the size required for physical implementation of cache and not the actual usable memory in the cache. i.e., this must include the tag bits, LRU/Valid bits etc.

Cache size = 2048 words.

No. of blocks in a set = 2 (2-way associativity).

So, no. of sets = 2048/(2 * block size) = 2048/(2*4) = 256.

Memory is word addressed (128K * 32 means 32 bits are taken at a time or word size is 4 bytes).

No. of unique main memory blocks that can come to a set entry $= \frac{\text{No. of main memory blocks}}{\text{no. of sets}} \\= \frac{\text{Main memory size} \ \text{Block size} }{256} \\=\frac{128K /4 }{256} \\= 128.$

So, number of tag bits $= \lg 128 = 7.$

So, now every block entry of a cache must have these tag bits (tag bits are compared and whichever block that matches in a set is multiplexed to the data line). We do not need this per word.

Since Valid/LRU bits are not mentioned, ignoring them.

Total cache size = 2048 words + Size of tag memory

$= 2048 \times 32 + \text{No. of blocks} \times 7\; bits$

$= 2048 \times 32 + 512 \times 7$

$= 512 \times (128 + 7)$

$= 512 \times 135$

$\approx 68 Kb$

selected by

Related questions