How do I map a memory address to a block when there is an offset in a direct-mapped cache?
<p>To start off, the first cache has 16 one-word blocks. As an example I will use 0x03 memory reference. The index has 4 bits (0011). It is clear that the bits equal <strong>3mod16</strong> (0011 = 0x03 = 3). However I am getting confused using this mod equation to determine block location in a cache with offset bits.</p>

<p>The second cache has a total size of eight two-word blocks. This means that there is 1 offset bit. Since there are now 8 blocks, there are only 3 index bits. As an example, I will take the same memory reference of 0x03. However now I am having trouble mapping to the block using the mod equation I used before. I try <strong>3mod8</strong> which is 3, however in this case, since there is an offset bit, the index bits are 001. 001 is not equal to 3 so what did I do wrong? Does mod not work when there are offset bits? I was under the impression that the mod equation would always equal the index bits.</p>