Consider the following matrix transpose routine:
typedef int array[4][4];
void transpose(array dst, array src){
int i,j;
for(i=0;i<4;i++){
for (j=0;j<4;j++){
dst[j][i] = src[i][j];
}
}
}
Assume this code runs on a machine with the following properties
sizeof(int)
= 4- The src array starts at the address of 0 and the dst array starts at the address 64
- There is a single L! data cache that is direct-mapped, write-through, writeallocate, with a block size of 16 bytes
- The cache has a total size of 32 data bytes and the cache is initially empty.
- Access to the src and dst array are the only sources of read and write misses.
I am tasked with determining whether each access to each array is a cache hit or miss
I got for the dst
_____________________________________
| Col 0 Col 1 Col 2 Col 3|
|Row0 m m m m|
|Row1 m m m m|
|Row2 m m m m|
|Row3 m m m m|
______________________________________
and for the src array
_____________________________________
| Col 0 Col 1 Col 2 Col 3|
|Row0 m h h h|
|Row1 m h h h|
|Row2 m h h h|
|Row3 m h h h|
______________________________________
Are these correct? Asking around with other students, everyone seems to have gotten different answers.