Nios/cacheset3

From ASMBits

Consider the following cache:

  • 2S sets
  • 2B block size

Write a function that will determine whether an access to one addresses can cause the cache line containing the other address to be evicted from the cache. Your function will be provided S, B, and two addresses. It must return 1 or 0 to indicate whether one address can cause the eviction of the other. 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 15 lines.

Sample Input

cacheblock(8, 4, 0, 2) (256 sets, 16-byte blocks, addresses 0 and 2)

Sample Output

r2=0

Case 13+: The shift instructions cannot shift by 32.

Write your solution here

Upload a source file...