Nios/cacheset2
From ASMBits
nios/cachesetPrevious
Nextnios/cacheset3
Consider the following cache:
- 2S sets
- 2B block size
Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether the two addresses map to the same cache set. S and B will be valid values for a 32-bit address.
int cacheset(unsigned int S, unsigned int B, unsigned int addr1, unsigned int addr2);
Expected solution length: Around 10 lines.
Sample Input
cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2)
Sample Output
r2=1
nios/cachesetPrevious
Nextnios/cacheset3