Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I kinda took a guess at this and I need help verifying that i came up with the r

ID: 3568062 • Letter: I

Question

I kinda took a guess at this and I need help verifying that i came up with the right solution or if not if you can show me how to solve it correctly. Thanks.

Suppose a computer using set associative cache has 221 words of main memory and a cache of 64 blocks, where each cache block contains 4 words.

a.    If this cache is 2-way set associative, what is the format of a memory address as seen by the cache, that is, what are the sizes of the tag, set, and word fields?

Answer i came up with:

2^5, set field = 5 bits,            21-(2+5) = 14 tag field = 14 bits, 2^2 word field = 2 bits

Tag

Set

Word

14 bits

5 bits

2 bits

b.    If this cache is 4-way set associative, what is the format of a memory address as seen by the cache?

Answer i came up with:

2^4 set field = 4 bits,            21-(2+4) = 15 tag field = 15 bits 2^2word field = 2 bits

Tag

Set

Word

15 bits

4 bits

2 bits

Tag

Set

Word

14 bits

5 bits

2 bits

Explanation / Answer

Bravo! You are doing it correctly.

Still let me explain the first case for you:-

As each block of the cache has 4 words, we need 2 bits to identify a word. [2^2=4]

We have a 2-way set associative cache and thus we have 64/2 = 32 sets.Hence we need 5 bits to identify a set.[2^5=32]

We have 2^21 words in main memory, So an address sent by the processor would be having 21 bits.

Remaining tag bits = 21-(5+2) = 21- 7 =14.