GATE | Gate IT 2008 | Question 77

Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 1 MB of main memory, a word size of 1 byte, a block size of 128 words and a cache size of 8 KB.

The number of bits in the TAG, SET and WORD fields, respectively are:
(A) 7, 6, 7
(B) 8, 5, 7
(C) 8, 6, 6
(D) 9, 4, 7


Answer: (D)

Explanation:  

According to the question it is given that
No. of bytes in a word= 1byte
No. of words per block of memory= 128 words
Total size of the cache memory= 8 KB
So the total number of block can be calculated as under Cache size/(no. words per block* size of 1 word)
= 8KB/( 128*1)
=64

Since, it is given that the computer has a 4 way set associative memory. Therefore, Total number of sets in the cache memory given = number of cache blocks given/4 = 64/4 = 16
So, the number of SET bits required = 4 as 16= power(2, 4).
Thus, with 4 bits we will be able to get 16 possible output bits
As per the question only physical memory information is given we can assume that cache memory is
physically tagged. So, the memory can be divided into 16 regions or blocks.
Size of the region a single set can address = 1MB/ 16 = power(2, 16 )Bytes = power(2, 16) / 128 = power(2, 9) cache blocks
Thus, to uniquely identify these power(2, 9) blocks we will need 9 bits to tag these blocks.
Thus, TAG= 9 Cache block is 128 words so for indicating any particular block we will need 7 bits as 128=power(2,7). Thus, WORD = 7. Hence the answer will be (TAG, SET, WORD) = (9,4,7).

 

This solution is contributed by Namita Singh.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.