in CO and Architecture retagged by
17,735 views
50 votes
50 votes
The width of the physical address on a machine is $40$ bits. The width of the tag field in a $512$ KB $8$-way set associative cache is ________ bits.
in CO and Architecture retagged by
17.7k views

1 comment

Best and Easy way to understand. Please forgive me for my handwriting if need any clarification please comment.

0
0

4 Answers

112 votes
112 votes
Best answer

Physical Address $=40$

  •  Tag + Set + Block Offset $=40$
  •  $T + S + B = 40\qquad \to (1)$

We have: Cache Size  =  number of sets $\times$ blocks per set $\times$ Block size

  • $512\ KB$ = number of sets $\times\ 8\ \times$ Block size
  •  Number of sets $\times$ Block size $=\dfrac{512}{8}\ KB = 64\ KB$
  •  $S + B =16 \qquad \to (2)$

From $(1), (2)$ 

T = 24  bits (Ans)


Second way

Cache Size $= 2^{19}$
MM size $=2^{40}$
This means, We need to map $\dfrac{2^{40}}{2^{19}}=2^{21}$ Blocks to one line. And a set contain $2^3$ lines.
Therefore, $2^{24}$ blocks are mapped to one set.
Using Tag field, I need to identify which one block out of $2^{24}$ blocks are present in this set.
Hence, $24$ bits are needed in Tag field.

edited by

22 Comments

moved by
Simplest one.

even block size is not given but can be solved directly.

log((2^40) / (2^19/2^3))

ans should be..24
2
2
but it is not given that cache  memory is byte addresable....

you have calculated result ....after assuming ...cache memory is byte addresable
1
1
If not mentioned , by default we take byte addressable
3
3
ok thanku
1
1
edited by
ok
1
1
I don't think it will be mentioned such anywhere. We have two options- word addressing and byte addressing. When word size is not given, it is common to assume byte addressing.
8
8
edited by
ok
–1
–1

Some things are supposed to be taken for Granted, Like by default word address is 1 byte (You don't address every bit cheeky , that is insanity , this is not told anywhere , but If you go in Memory interfacing, you will see that by Default 1 Byte is taken as word size ) Or by default, all tracks in disk have same memory capacity or by default, sector size in disk is 512 bytes ! You should contest this answer in answer debate ! Though I promise to you, you are going to lose 500 RS laugh (Got 500 Rs reference from -> http://jam.iitm.ac.in/jam2016/)

4
4
Also yes, one more thing. You can't just go there & say, hey Prof, GIve me proof why by Default it is BYTE addressable or give marks to me. It wont be 2 way communication, You will have to disprove that 24 is answer, with your own reference that by default it is not BYTE addressable with credible reference of your own, saying that By Default it is not Byte addressable (Which you can not find, I can promise you that !)
0
0
edited by
ok
0
0
edited by
ok
0
0

1) You are the one with the issue with by default it is byte addressable. So go on & disprove it with references in answer debate (Not here !) . I've do not have interest nor time to in this issue, because it is considered the same way I said everywhere, that memory is by default byte addressable if not mentioned otherwise. Also don't expect others to lose their hard earned money on your mistake, either accept that you did not know enough of CO, so you made mistake or do the answer challenge. 10000 people challenging or 1 challenging is not gonna make any difference as far as answer key challenge is considered. So rest assured if you have any valid point (Which you don't) , they will award marks to all !

2) Now wait for answer key, if the question is really ambigious as you think it is (I'm sure it is not !) , they will give marks to all. This time they will be very careful with answers, so even if you have little bit of point (I know you don't have it) they will give marks to all already !

1
1
edited by
ok
1
1
edited by
In previous years GATE questions, you would have seen..  whenever nothing is given, byte addressability is taken..
Arjun and Akash are perfectly right here..
1
1
edited by
ok
1
1
edited by
Please dont get personal here..
All that you were said is if you feel you are right.. you must go ahead for answer debate.. and then IISC will decide what is right or not..
Also, Akash and Arjun are much knowledgeable than any person you will find on this site..
I am not saying believe in them blindly, but yes what they say do have some basis..
If i said something wrong, i am really sorry.. I would edit my comment..
I aplologise again if I did something wrong. sorry.. and best of luck with your answer debate..
0
0
Actually I do hate the "default" option and wish GATE people mention everything in question. May be they do this intentionally to ensure a candidate uses his aptitude. For this question there are two option- byte addressing and word addressing and for word addressing we need word size which is not given in question and hence we do byte addressing, As a candidate one can ask for "Mark to All" but if GATE gives mark to all, then those who wasted some minutes and got the correct answer would be at disadvantage. And many previous year questions were like this though GATE never mentions anywhere that a candidate should practice previous year questions.
8
8
@Arjun, one more thing, no candidate can really ask IISC for Proof. Looking at http://jam.iitm.ac.in/jam2016/ they are just giving keys as of now, not the proofs (That is not feasible too , I think, consider no of papers & no of answers, it'll delay result further for making sure proof are bug free) .

So in short, no body can go to IISc and say, Please prove why this is correct. One has to write entire argument in Answer debate with disproving answer for getting considered seriously ! Anyone who needs to prove that 1 byte is not default, must go there with written proof with  some reputed references, otherwise IISc wont consider it !
1
1
@Arjun sir, plz verify !

Here is a simple way-
Cache Size = $2^{19}$
MM size = $2^{40}$
This means, We need to map $\frac{2^{40}}{2^{19}}= 2^{21}$ Blocks to one line. And a set contain $2^3$ lines.
Therefore $2^{24}$ blocks are mapped to one set.
Using Tag field, I need to identify which one block out of $2^{24}$ blocks are present in this set.
Hence $24$ bits are needed in Tag field.
37
37
yes, thats the better way..
1
1
Very good explained
0
0
This is the only explaination I could understand out of all.
0
0
71 votes
71 votes
In question block size has not been given,so we can assume  block size  $2^x$ Byte.

Number of Blocks:-   $\dfrac{512\times 2^{10}}{2^x} =\large2^{19-x}$

Number of sets:-    $\dfrac{2^{19-x}}{8 }=\large2^{16-x}$

So number of bits for sets $=16-x$

Let number of bits for Tag $=T$

And we have already assumed block size $2^x$ Byte,therefore number of bits for block size is $x$

And finally,

$T + (16-x) + x = 40$

$T+16 = 40$

$T = 24.$
edited by
by

3 Comments

brilliant!!! thanks a lot
0
0
Awesome !! Bingo
0
0
NICE .
0
0
12 votes
12 votes
Do not get confused due to missing block size...Assume block size as 2^x byte and solve...Later , it will get cancel and TAG field can be found....
Remember that , block size data is not mandatory :)
2 votes
2 votes

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

Answer:

Related questions