Objective: To compare the benefits of various cache organizations while performing matrix… 1 answer below »

ECE 335

Homework 7

Due: November 22, 2019

Objective: To compare the benefits of various cache organizations while performing matrix transpose

operations, where spatial locality is not ideal. You will use test the cache operations using the program

given below:

(The Original problem)

Consider the following transpose routine:

typedef int array [16][16];

void transpose1 (array dst, array src)

{

int i, j;

for(i=0; ifor (j=0; jdst[j][i] = src[i][j];

}

}

}

Assume that this code runs on a machine with the following properties:

• sizeof(int) == 4

• The src array starts at address 0 and the dst array starts at address 1024 (0x400)

• There is a single L1 cache that is direct-mapped, write-through, write-allocate, with a block size

of 16 bytes.

• The cache has a total size of 64 data bytes and is initially empty.

• Accesses to the src and dst arrays are the only sources of read and write misses.

For each row and column, indicate whether the access to src[row][col] and dst[row][col] is a hit (h) or a

miss(m). Reading src[0][0] is a miss and writing dst[0][0] is also a miss.

The programming assignment:

1. Generate a cache simulator program in c, to which addresses are passed, that determines

whether an access of the address results in a cache hit or miss.

2. Your program must include a capability to vary the cache and block sizes. Your code will use bit

operations to determine the set number and block offsets. Your cache implementation will

need to store tag information and time of use information.

Attachments: