in CO and Architecture retagged by
16,166 views
21 votes
21 votes

A computer system with a word length of $32$ bits has a $16$ MB byte- addressable main memory and a $64$ KB, $4$-way set associative cache memory with a block size of $256$ bytes. Consider the following four physical addresses represented in hexadecimal notation.

  • $A1= \textsf{0x42C8A4}$,
  • $A2= \textsf{0x546888}$,
  • $A3= \textsf{0x6A289C}$,
  • $A4=\textsf{0x5E4880}$

Which one of the following is TRUE?

  1. $A1$ and $A4$ are mapped to different cache sets.
  2. $A2$ and $A3$ are mapped to the same cache set.
  3. $A3$ and $A4$ are mapped to the same cache set.
  4. $A1$ and $A3$ are mapped to the same cache set.
in CO and Architecture retagged by
by
16.2k views

4 Comments

If the memory is already byte-addressable why is it mentioned that the computer system has a word length of 32 bits? 

How many bits does each cell of main memory contain 8 bits or 32 bits?

3
3

The memory is already byte-addressable, so there is no use of word length but it is also mentioned that system has a word length of 32 bits. Word length is mentioned so that students get confused and waste their time and mess up their exam. No offense. :)

8
8

@the_psycho_scientist Bro messed in test just bcoz of this 32 bit given thank bro to clarify it !

0
0

3 Answers

23 votes
23 votes
Best answer

Block size is 256 Bytes. Number of sets in cache = $2^6$ so Set offset bits=6 and word offset bits=8.

So check for set, check for the rightmost 4 digits of each physical address.(Last two byte denote the word address)

A1=C8A4 = C8 = 11001000

A2=6888 = 68 = 01101000

A3=289C = 28 = 00101000

A4=4880 = 48 = 01001000

Now look for lowest order 6 bits in the highlighted part of Each physical address(corresponds to set number).
8 and 8 match and 6=0110 and 2=0010 two low order bits of 6 and 2 match,So A2 and A3 go to same set.

So answer-B

edited by

4 Comments

Thanks sir
1
1

Why we don’t convert all units into words as it is given that word size is 32bits.

1
1

    16 MB byte- addressable main memory

Given in question as byte-addressable main memory. Hence we don’t convert to words.

If question has been word-addressable main memory, then we shall have converted into words.

7
7
@Ayush sir,  I have a doubt here that, if the word length is of 32 bit so the physical address given in hexadecimal should be of length 8 (ie 8x4bit= 32bit), but here it is of size 6 (6 numbers of 24 bits), why ?
0
0
32 votes
32 votes
16 MB byte addressable ===> requires 24 bits to represent.

Block size= 256 B ===> 8 bits to represent.

no.of sets = $\frac{64 K}{4*256} = 64 $ ==> 6 bits to represent.

Tag = 24-8-6 = 10 bits.

 

Memory address = tag | set | block

A1 = 0x42C8A4 = (0100 0010 1100 1000 1010 0100)$_2$ ==> set bits = 00 1000

A2 = 0x546888 = (0101 0100 0110 1000 1010 0100)$_2$ ==> set bits = 10 1000

A3 = 0x6A289C = (0110 1010 0010 1000 1010 0100)$_2$ ==> set bits = 10 1000

A4 = 0x5E4880 = (0101 1110 0100 1000 1010 0100)$_2$ ==> set bits = 00 1000

 

A1 and A4 maps to the same set and A2 and A3 maps to same set.

 

Option B is correct

4 Comments

Perfect!
2
2
This is the obvious solution..
2
2
But also A1 and A4 matching why not we also  consider it ?
0
0

@Ashutosh mandal

There is no such option provided in the question to select.

0
0
1 vote
1 vote
Approach should be finding number of bits in the set offset.

Set bits = log(CS/BS/k) = log(64K/256/4) = 6

Now see the addresses, the address that matters to us is C8, 68,28,48

First 6 bits from the LSB side are

001000, 101000, 101000, 001000

clearly A2 and A3 are mapped to same cache sets.
Answer:

Related questions