in CO and Architecture retagged by
17,771 views
23 votes
23 votes

A certain processor uses a fully associative cache of size $16$ kB, The cache block size is $16$ bytes. Assume that the main memory is byte addressable and uses a $32$-bit address. How many bits are required for the Tag and the Index fields respectively in the addresses generated by the processor?

  1. $24$ bits and $0$ bits
  2. $28$ bits and $4$ bits
  3. $24$ bits and $4$ bits
  4. $28$ bits and $0$ bits
in CO and Architecture retagged by
by
17.8k views

4 Comments

I think a is the correct answer. As fully Associative cahce do not have index bits. Its address structure is < TAG, WO>
1
1
As 32 bits physical address, 4 bits are for block offset and so there are 28 bits remaining for Tag
2
2
option D) as there are no index in fully associative cache.
0
0

8 Answers

55 votes
55 votes
Best answer

Given that cache is Fully Associative.
$$\begin{array}{|c|c|} \hline
\textbf{Tag Bits}&\textbf{Block Offset}\\ \hline
28 & 4\\ \hline
\end{array}$$ There are no index bits in fully associative cache because every main memory block can go to any location in the cache $\implies$ Index bits $= 0.$

Given that memory is byte addressable and uses $32$-bit address.

Cache Block size is $16$ Bytes $\implies$  Number of bits required for Block Offset  $=⌈\log_216⌉ = 4 \text{ bits}$

$\therefore $ Number of Tag bits $= 32 - 4 = 28.$

Answer is (D).

edited by

4 Comments

@Rish9799 Bhai, please share some references to learn these architecture-related questions.
0
0
1
1
You can think #sets = 1 in case of fully associative cache. Hence no. of bits reqd. for Index (set offset) = $log(1) = log(2^0) = 0 bits$
0
0
8 votes
8 votes

In associative mapping there is no index field.

edited by
5 votes
5 votes

Fully Associative Cache has fields: Tag, Offset.

Direct Mapped Cache has fields: Tag, Line No., Offset

Set associative cache has fields: Tag, Set No., Offset

 

As you can see, in fully associative cache, there's no index field. Hence index bits = $0$.

Now, Offset = $4$ bits.

=> Tag $= 32 - 4 = 28$ bits.

 

Option D

2 votes
2 votes
In fully associative cache, the cache is organized into a single cache set and all cache lines are part of this set. Hence, we need 0 bits for set number field (index field) as there is only one set.

The address can therefore be effectively broken down into two fields only : tag bits field and offset field.

Since block size is 16 Bytes,

offset field  = $log_{2} (16)$ = 4 bits

Tag bits = Total address bits - offset bits

               = 32 - 4

               = 28 bits

So tag field bits = 28 and index field bits = 0

Option D is correct
edited by
Answer:

Related questions