• edited by
10,132 views
30 30 votes

Consider a computer with a $4$-ways set-associative mapped cache of the following character­istics: a total of $1 \ MB$ of main memory, a word size of $1$ byte, a block size of $128$ words and a cache size of $8 \ KB$.

The number of bits in the TAG, SET and WORD fields, respectively are:

  1. $7, 6, 7$
  2. $8, 5, 7$
  3. $8, 6, 6$
  4. $9, 4, 7$

2 Answers

Best answer
37 37 votes

Number of cache blocks $=\dfrac{8KB}{(128\times 1)} = 64$
 

Number of sets in cache $=\dfrac{\text{Number of cache blocks}}{4\text{ (4-way set)}}
=\dfrac{64}{4}= 16$

So, number of SET bits required $=4 \text{(as $2^4$ = 16, and with 4 bits we can get 16 possible outputs)}$

We can now straight away choose (D) as answer but for confirmation can proceed further. 

Since, only physical memory information is given we can assume cache is physically tagged (which is anyway the common case even in case of virtual memory).

So, we can divide the physical memory into $16$ regions so that, each set maps into only its assigned region.

So, size of a region a set can address $= \dfrac{1MB}{16} = 2^{16} \text{ Bytes}= \dfrac{2^{16}}{128}= 2^9$ cache blocks (as cache block size is $128$ words $= 128$ bytes).

So, when an access comes to a cache entry, it must be able to determine which out of the $2^9$ possible physical block it is. In short, it needs $9$ bits for TAG. 

Now, cache block size is $128$ words and so to identify a word we need $7$ bits for WORD. 

• edited by
3 3 votes

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

Answer:
Position:
Show:

Related questions

44 44 votes
4 answers 4 answers
10.0k
10.0k views
Ishrat Jahan asked Oct 29, 2014
10,037 views
Consider a computer with a $4$-ways set-associative mapped cache of the following character­istics: a total of $1\;\text{MB}$ of main memory, a word size of $1\;\text{byt...
62 62 votes
6 answers 6 answers
22.9k
22.9k views
Ishrat Jahan asked Oct 28, 2014
22,854 views
A non pipelined single cycle processor operating at $100\;\text{MHz}$ is converted into a synchro­nous pipelined processor with five stages requiring $2.5\;\text{nsec}, 1...
67 67 votes
9 answers 9 answers
29.0k
29.0k views
Ishrat Jahan asked Oct 28, 2014
29,021 views
Consider a CPU where all the instructions require $7$ clock cycles to complete execution. There are $140$ instructions in the instruction set. It is found that $125$ cont...
55 55 votes
10 answers 10 answers
15.9k
15.9k views
Ishrat Jahan asked Oct 28, 2014
15,921 views
Assume that EA = (X)+ is the effective address equal to the contents of location X, with X incremented by one word length after the effective address is calculated; EA = ...