# How do I get the index of these word addresses? [closed]

We are given 32 bit memory address references.

For example:

180, 43,2.

We are asked to find the index "given a direct-mapped cache with two-word blocks and a total size of 8 blocks". Mind you have I have the answers. I am looking to HOW to get those answers.

The index for 180, 43 and 2 are 2, 5 and 1. For other questions, I used the address mod the number of blocks. But modding those three numbers by 8 or 16 is not working.

• I don't understand the wording of your question. Can you provide more detail? – Majenko Dec 16 '14 at 19:18
• Your question makes little sense. What "index" exactly? The cache block number, the word offset within a block, word offset within whole cache, something else? Without a definition of "index" in this context, this question is meaningless and needs to be closed in its current form. – Olin Lathrop Dec 16 '14 at 19:24

int(180/2) mod 8 = 2