HOW TO DECOMPOSE ADDRESSES In the case of fully associative, you can use the full address in the address field, if you wish. In the case of direct-mapped, you will need to decompose the 32-bit address from the CPU into: (tag, index, offset) The offset will be a value from 0 up to the size of the data block. The index will be a value from 0 up to the maximum index in the cache. The tag will be whatever is left over. As an example, suppose we have a data block of size 4 bytes, and suppose we have 8 cache lines. We first need to decompose the address into (tag+index, offset). Let's assume an example where the offset is 56. The offset is less than 4. So, we do: 56 mod 4 = 0 [ This is the offset, and it is less than 4. ] 56 / 4 = 14 [ This is the tag+index. ] Next, we need to decompose the tag+index into (tag, index). The maximum index of a cache line is 8. So, we do: 14 mod 8 = 6 [ This is the index, and it is less than 8. ] 14 / 8 = 1 [ This is the tag. ] So, we can summarize: 56 = (tag, index, offset) = (1, 6, 0) ==== Note that in the homework, all addresses are a multiple of 4. This is because in assembly language, a word should start on a word boundary, which is a multiple of 4. * So, in the special case that the data block is of size 4 bytes, * then you will always have offset = 0.