in CO and Architecture edited by
19,482 views
62 votes
62 votes
A cache memory unit with capacity of $N$ words and block size of $B$ words is to be designed. If it is designed as a direct mapped cache, the length of the $\textsf{TAG}$ field is $10$ bits. If the cache unit is now designed as a $16$-way set-associative cache, the length of the $\textsf{TAG}$ field is ____________ bits.
in CO and Architecture edited by
by
19.5k views

2 Comments

Length of the TAG field in k-way set associative = Length of TAG field in Direct Mapping + log base2(k)

                    = 10+log base2(16) =14

 

6
6

$Direct-mapped:$

$Tag$ $Line-offset$ $Word-offset$
$10-bits$ $(log_{2}N-log_{2}B)-bits$ $(log_{2}B)-bits$

$16-way\ set\ associative\ cache:$

$Tag$ $Line-offset$ $Word-offset$
$x-bits$ $(log_{2}N-log_{2}B-4)-bits$ $(log_{2}B)-bits$

$10+(log_{2}N-log_{2}B)+(log_{2}B)=x+(log_{2}N-log_{2}B-4)+(log_{2}B)$

$x=14-bits$

15
15

10 Answers

87 votes
87 votes
Best answer

In set-associative 1 set = 16 lines. So the number of index bits will be $4$ less than the direct mapped case.

So, Tag bits increased to $14$ bits.

edited by
by

2 Comments

In direct mapped cache. TAG field = 10 bits so 210 MM can be mapped to 1 cache line. Now we have 16 lines in 1 cache set so 24*210 = 214 MM blocks can be mapped to 1 cache set. So in a 16-way set-associative cache, the length of the TAG field is 14 bits.

34
34
New concept i learned
9
9
79 votes
79 votes

hope it helps!!!

edited by

3 Comments

Very good explaination thanks.
2
2
Yes it does !

Explained as simple as it could be.

Thank you.
2
2
This is the explanation I was searching for, Thanks :)
0
0
47 votes
47 votes

Cache capacity =N words

Block size= B words,bits for block offset=log(B)

No of lines in Direct  Mapped cache =N/B,bits for no. of lines=log(N/B)

No of Sets in 16-way set associative cache=N/16B,,bits for no. of sets=log(N/16B)

In direct mapped length of tag =10 bits

Length of PHYSICAL ADDRESSES :-

DIRECT-MAPPED
TAG-10 LINE.NO:-LOG(N/B) BLOCK OFFSET:-LOG(B)
16-WAY SET ASSOCIATIVE
TAG-X SET.NO-LOG(N/16B) BLOCK OFFSET:-LOG(B)

As Physical address is same for both cache mappings,

10+LOG(N/B)+LOG(B)=X+LOG(N/16B)+LOG(B)

10+LOG(N/B)=X+LOG(N/16B)                              //AFTER CANCELLING LOG(B) 

2^(10+LOG(N/B))=2^(X+LOG(N/16B))                 //EXPONENTIATION WITH 2 ,BOTH SIDES

(2^10) *(N/B)=(2^X) *(N/16B)

(2^10) =(2^X) *(1/2^4)

2^14=2^X

X=14                                                                 //APPLYING LOG TO BOTH SIDES

13 votes
13 votes
in Direct mapping length is 10 bits that means at each index of cache 2^10 lines can be mapped

after 16 way set associative....16*(2^10) lines can be mapped in each set so total 2^14 lines hence tag bit must be able to address these many lines so 14 bits required

answer is 14 bits
Answer:

Related questions