retagged by
17,629 views
50 votes
50 votes
The width of the physical address on a machine is $40$ bits. The width of the tag field in a $512$ KB $8$-way set associative cache is ________ bits.
retagged by

4 Answers

Best answer
112 votes
112 votes

Physical Address $=40$

  •  Tag + Set + Block Offset $=40$
  •  $T + S + B = 40\qquad \to (1)$

We have: Cache Size  =  number of sets $\times$ blocks per set $\times$ Block size

  • $512\ KB$ = number of sets $\times\ 8\ \times$ Block size
  •  Number of sets $\times$ Block size $=\dfrac{512}{8}\ KB = 64\ KB$
  •  $S + B =16 \qquad \to (2)$

From $(1), (2)$ 

T = 24  bits (Ans)


Second way

Cache Size $= 2^{19}$
MM size $=2^{40}$
This means, We need to map $\dfrac{2^{40}}{2^{19}}=2^{21}$ Blocks to one line. And a set contain $2^3$ lines.
Therefore, $2^{24}$ blocks are mapped to one set.
Using Tag field, I need to identify which one block out of $2^{24}$ blocks are present in this set.
Hence, $24$ bits are needed in Tag field.

edited by
71 votes
71 votes
In question block size has not been given,so we can assume  block size  $2^x$ Byte.

Number of Blocks:-   $\dfrac{512\times 2^{10}}{2^x} =\large2^{19-x}$

Number of sets:-    $\dfrac{2^{19-x}}{8 }=\large2^{16-x}$

So number of bits for sets $=16-x$

Let number of bits for Tag $=T$

And we have already assumed block size $2^x$ Byte,therefore number of bits for block size is $x$

And finally,

$T + (16-x) + x = 40$

$T+16 = 40$

$T = 24.$
edited by
12 votes
12 votes
Do not get confused due to missing block size...Assume block size as 2^x byte and solve...Later , it will get cancel and TAG field can be found....
Remember that , block size data is not mandatory :)
2 votes
2 votes

………………………………………………………………………………….

Answer:

Related questions