in CO and Architecture edited by
13,096 views
22 votes
22 votes

Consider a $4$-way set associative cache consisting of $128$ lines with a line size of $64$ words. The CPU generates a $20-bit$ address of a word in main memory. The number of bits in the TAG, LINE and WORD fields are respectively:

  1. $9, 6, 5$
  2. $7, 7, 6$
  3. $7, 5, 8$
  4. $9, 5, 6$
in CO and Architecture edited by
13.1k views

3 Comments

@Arjun Sir, I guess the correct answer is not in option.  Answer is 9,7,6 ... Because middle one is LINE , not SET ...  for SET we need 5 bits.... but for LINE we need 7 bits.
11
11
I think "LINE" term in question refers to "index bits". (Index bits are 5 because number of sets is 2^5 i.e 32, so 5 bits are needed to identify each set uniquely) . Based on this assumption we chosen option D as correct option.
1
1

 ,Sir, but 9+7+6!=20 which is the PA given in question. And according to me, answer should be B as for LINES 7 bits required and they clearly CAPITALISED the words specifically.

0
0

1 Answer

29 votes
29 votes
Best answer

Number of sets $=\dfrac{\text{cache size}}{\text{(size of a block * No. of blocks in a set)}}$

$=\dfrac{128 * 64}{(64 * 4)}\text{ (4 way set associative means 4 blocks in a set)}$

$= 32.$

So, number of index (LINE) bits $= 5$ and number of WORD bits $= 6$ since cache block (line) size is $64.$

So, number of TAG bits $= 20 - 6 - 5 = 9.$

Answer is (D) choice

edited by
by

4 Comments

Thanks Anuj sir ,was really helpful in clearing my mis-conception about cache lines
0
0
This question is simply checking our common sense.

In k way set associative mapping calculation,

line number is not calculated, only tag, set and line offset is calulated
0
0
1)128 lines

2)number of bit in LINE

They should have used the word SET instead of LINE as they can either refer lines as total cache lines or can refer it as sets but not both at the same time :P
1
1
Answer:

Related questions