I need some clarity on how a direct mapped cache in MIPS works for an array. For example, for an array of ten items a[0] to a[9], and the following direct mapped cache configuration: Direct mapped cache with total cache size of 32 bytes and block size of 16 bytes. Each memory address is 32 bits.
Which would yield: 4 bits offset, 1 bit index, 27 bits tag
My cache would look like this:
| Index | Valid | Tag | W0 | W1 | W2 | W3 |
| 0 | 0 | | | | | |
| 1 | 0 | | | | | |
My question is, on my first load for a[0], I understand that in each cache index, we can store 4 words. Does this mean a[0]
, a[1]
, a[2]
, a[3]
all gets loaded into the cache on load access for a[0]
? So a[1]
, a[2]
, and a[3]
will be a hit.
Or am I understanding it wrongly?