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: 0xC4001234I'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.
Direct Cache Mapping - Addressing
computer architecture;cpu cache
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.