0
$\begingroup$

I have an online homework assignment that is asking me for the tag and index in a direct-mapped cache, for a series of memory addresses. The cache is specified to have 16 one word blocks.

One of the first memory addresses given is 134.

My attempt goes as follows:

134 = 10000110

16 = 2^4

so, I get that:

index = 10000110 mod 16 = 0110

and

tag = 1000 (the leftover part)

Apparently this is wrong. Could someone please help me to see why?

$\endgroup$
  • $\begingroup$ I believe the memory address is in hex format. Double check your assignment. If that is the case, binary form of 0x134 is 1 0011 0100. $\endgroup$ – Isu May 22 '18 at 9:12
  • $\begingroup$ Thank you, but the assignment does specify decimal. Sorry, I should have mentioned that. $\endgroup$ – Stack User May 22 '18 at 14:11
  • $\begingroup$ In that case check the addressing format of the memory. Is it byte addressable or word addressable? If its byte addressable, you need to mask off the last two bits of the address to get the word address. Use that to isolate the tag and the index. $\endgroup$ – Isu May 22 '18 at 16:57
  • $\begingroup$ It looks like that was exactly my problem! Thank You! $\endgroup$ – Stack User May 23 '18 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.