I've a question on how blocks are mapped from memory to a set-associative cache.
Let's say, the instructions in memory are all 32 bits long, the I-cache (16kByte) is 2-way set-associative and the each cache line is 256 bits wide (so each line can hold 8 instructions).
How will the instructions be mapped into the sets? Let's say the first8 instructions from memory are mapped into the first line of the first set. Will the next 8 instructions (assume they are allocated contiguously in memory) be placed in the second line of the first set (and thus completely fill this set) or will the go into another set (leaving the second line of the first set free)?