Related Articles

# GATE | Gate IT 2008 | Question 77

• Difficulty Level : Medium
• Last Updated : 19 Nov, 2018

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

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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up