edited by
270 views
2 votes
2 votes

A byte-addressed computer system has a cache with $512$ blocks, each of which can store $32$ $bytes$ of data.

To which cache line will the memory address $’0\text{x}FBFC’$ map onto if the cache is direct-mapped and is $8$ way set–associative, respectively? 

  1. $DBA, 3C$
  2. $1DA, 1D$
  3. $1DF, 1F$
  4. $1CF, 3E$
edited by

1 Answer

Best answer
2 votes
2 votes

The format for direct mapped cache is :

tag index/set block size

$$\begin{array}{|c|c|c|} \hline \text{tag} & \text{index/set} & \text{block size} \\ \hline  \end{array}$$

now cache lines/blocks $= 512$ which is $2^9$

  block size $= 32$ which is  $2^5$

and memory memory address is of $16$ bits i.e

$FBFC\implies 1111 1011 1111 1100$

11(2bit) 111011111 (9 bit) 11100(5bit)

$$\begin{array}{|c|c|c|} \hline 11\text{(2 bit)} & 111011111\text{(9 bit)} & 11100\text{(5 bit)}  \\ \hline  \end{array}$$

now we can see 9 bit is the cache block number.

       $1 1101 1111\implies1  D F\implies(1DF) $ 

Hence if the cache is direct mapped , that given memory address will map to $1DF$ cache line which is option C .

And in the same way we can show that if it is 8 way set – associative then map to 1F. In 8-way set-associative mapping, number of sets gets reduced by $8$ and hence the number of set bits becomes reduced by $\lg 8 = 3$. These gets added to tag bits as now $8$ times more main memory blocks can go to a single cache block. So, we will have $2+3 = 5$ tag bits and $9-3=6$ index bits. So, the index entry corresponding to $0\text{x}FBFC$ will be $011111 = 1F.$

edited by
Answer:

Related questions

2 votes
2 votes
1 answer
3
1 votes
1 votes
1 answer
4
Bikram asked Feb 9, 2017
252 views
Relative mode addressing is most relevant to writing a/an __________:Co-routinePosition independent codeShareable codeInterrupt handler