in CO and Architecture retagged by
28,081 views
39 votes
39 votes

A block-set associative cache memory consists of $128$ blocks divided into four block sets. The main memory consists of $16, 384$ blocks and each block contains $256$ eight bit words.

  1. How many bits are required for addressing the main memory?
  2. How many bits are needed to represent the TAG, SET and WORD fields?
in CO and Architecture retagged by
28.1k views

3 Comments

"four block sets" phrase can be interpreted as 

  • four-block sets: Each set has 4 blocks.
  • four block-sets: Number of sets are four.

How can one know the correct interpretation? 

1
1

@commenter commenterfour block sets means  each set has four block

0
0
here in question some thing need to notice :-

1) here word is of 8bit  as they have written in question. means 1word=1bytes

2)here each set contain 4 block
---------------------------------------------------------------------------------------------------------------------------------------------------------
question 1) here main memory contain no of block =>16384=>2^14

and each block size is 256 word which is 256 bytes

 

means main memory size is 2^14*2^4=>2^22

so totol 22 bit required for adressing
-------------------------------------------------------------------------------------------------------------------------------------------
for question 2)

totol 22 bit for main memory and if direct associative  then division will happen like this => 7||7||8

now if each set contain 4 block then from direct mapped index no 2 bit will shift toward tag bit so

final adress division wil be like this =>9||5||8
0
0

1 Answer

59 votes
59 votes
Best answer

For main memory, there are $2^{14}$ blocks and each block size is $2^8$ bytes (A byte is an eight-bit word)

  1. Size of main memory $=2^{14}\times 2^8=4MB$ ( $22-\text{bits}$ required for addressing the main memory).
  2. For WORD field, we require $8-\text{bits}$, as each block contains $2^8 $ words.

As there are $4$ blocks in $1$ set, $32$ sets will be needed for $128$ blocks. Thus SET field requires $5- \text{bits}$.

Then, TAG field requires $22-(5+8)= 9- \text{bits}$

$$\begin{array}{|c|c|c|} \hline \text {9-bits (for tag)} &  \text{5- bits (for set)}& \text{8-bits (for word)} \\\hline  \end{array}$$

edited by

4 Comments

How is main memory size 2^14
0
0
@bts1jimin,If you could see in the question it is clearly mentioned above 16,384 can be written as 2^14. That's how we derive the size as 2^14. Take like this:- 1024*16=2^10*2^4. I hope this now helps u. If haven't understood still,please comment. Yeah. :)
0
0

@kirti singh

Word field will have 8bits cuz block size is 2^8 words , not for cache memory having 128 blocks.

1
1
Answer:

Related questions