edited by
8,628 views
29 votes
29 votes

Consider a machine with a byte addressable main memory of $2^{20}$ bytes, block size of $16$ bytes and a direct mapped cache having $2^{12}$ cache lines. Let the addresses of two consecutive bytes in main memory be $\textsf{(E201F)}_{16}$ and $\textsf{(E2020)}_{16}$. What are the tag and cache line addresses ( in hex) for main memory address $\textsf{(E201F)}_{16}$?

  1. $\textsf{E, 201}$
  2. $\textsf{F, 201}$
  3. $\textsf{E, E20}$
  4. $\textsf{2, 01F}$
edited by

4 Answers

Best answer
42 votes
42 votes

Block size of $16$ bytes means we need $4$ offset bits. (The lowest $4$ digits of memory address are offset bits)

Number of sets in cache (cache lines) $= 2^{12}$ so the next lower $12$ bits are used for set indexing. 

The top $4\;\text{bits}\; ($out of $20)$ are tag bits.

So, the answer is A. 

edited by
5 votes
5 votes

Let the addresses of two consecutive bytes in main memory be $(E201F)_{16}$ and $(E2020)_{16}$

$E20$ is common to both hex numbers, so ignore it.

$1F=0001 \ 1111=31 \ (decimal)$

$20=0010 \ 0000=32 \ (decimal)$

 

So, difference between two consecutive memory locations = $1 \ B$ Hence, the memory is byte addressable.


First $4$ bits would be tag bits, and next $12$ bits would be index bits.

Tag Line Offset
4 12 4

So, for $(E201F)_{16}$

Tag = $E$; Line = $201$

2 votes
2 votes
Block Size = 16 bytes
Block Offset = 4 


No. of sets or cache lines = 2
12 Number of index bits = 12 Size of main memory = 220 Number of tag bits = 20 - 12 - 4 = 4 Let us consider the hex address E201F Tag lines = First 4 bits = E (in hex) Cache lines = Next 12 bits = 201 (In Hex)
1 votes
1 votes

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

Answer:

Related questions

70 votes
70 votes
5 answers
2
go_editor asked Feb 16, 2015
41,090 views
Consider the following reservation table for a pipeline having three stages $S_1, S_2 \text{ and } S_3$.$$\begin{array}{|ccccc|} \hline \textbf{Time} \rightarrow \\\hline...