The Gateway to Computer Science Excellence
+25 votes
5.1k views

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 by
retagged by | 5.1k views
0

"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 Answer

+34 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}$$

by
edited by
+3

TAG size is number of address in each set

What is the mistake , if I calculate =MMblock size/ cache set size=214/25=29

+4
You meant #main memory blocks/no. of sets in cache? Yes, that is correct.
0

@Bikram sir 

As per question,block contains 256 eight bit words

it means block contain 256 words and each size of 8 bit so tatal block size will be (256*8)

by this main memory size=number of block* block size

16,384*256*8= 2^25

physical address should be 25 bits ?

0
yes correct..
0
So what is the correct answer 25 bits /22 bits
+5
@bikram sir i think 22 is the right answer not 25

block contain 256 word of 8 bit means

1 word=8bit(1byte )

if system word addressable then

physical address=22

set bit=5

tag bit=9

word =8

same for byte addressable becoz 1 word =1 byte
0
@srestha,For the block field,why have we not taken word field of the cache instead of main memory word?Could you please elaborate here?
+1
block size must be in bit or Byte
0
@Srestha,I see that. Okay. So suppose if we would have been given Cache block size along side MM block size,so in that situation what to consider?Why the block size of MM and not cache?This is the point. A big Thanks again.
+1
MM block size and cache memory block size is same always
0
@Srestha,I see that. Thanks for clearing this doubt. :)
0
How is main memory size 2^14
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

@kirti singh

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

Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,497 answers
201,858 comments
95,314 users