0
$\begingroup$

I've looked through all the other similar questions, but I don't feel like I understood exactly what I'm supposed to do with my case, so I'm hoping I'm not the only one.

In an exercise I'm doing, I'm told to consider a computational system with a direct mapping cache, that can store 16 blocks of 4 bytes, and 32-bit addresses.

I'm then given 8 addresses in hexadecimal, and I'm supposed to say what will be the content of the 16 blocks.

One of the adresses in question is: 0xC4001234 I've calculated the tag as 21 bits, set being 4 bits, and offset being 5 bits. Yet, I'm not sure how I'm supposed to know in which block it will be. My teacher's Powerpoint said that the "set" is used to locate the block in the memory, but I'm not sure how. I thought I'd convert the address into binary and use the 4 bits to calculate where the block will be, but then I have some adresses that match in the same block.

I was wondering if anyone could show me how to do this one address, so I can do this exercise and hopefully pass my exam. Thanks.

$\endgroup$
  • $\begingroup$ By the way, 4 bits corresponds to one hex digit so you don't need to use binary as an intermediate representation in that case. $\endgroup$ – David Richerby Feb 1 '15 at 17:48
1
$\begingroup$

Your cache is direct mapped so there are no sets. Those are set associative caches.

In your example the tag is 26 bit, block 4 bit and byte offset is 2 bit.

To get that just break your 32 bits into tag, block and byte fields. 16 blocks means 4 bits to address a block. 4 byte blocks means 2 bits to address bytes within blocks. Rest of the bits are 26, which is the tag. When you convert 0xC4001234 to binary and remove first 26 bits and the last 2 bits that gives you the 4 block bits.

In your case it is 1101 or block 13 of 0-15.

$\endgroup$
  • $\begingroup$ Thank you for your help, but I still have a problem. What should I do if 2 of the hex numbers I'm working with have the same block? e.g. 0xC4000120 and 0xC4000123 $\endgroup$ – Manoel Feb 1 '15 at 19:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.