Arm/cacheset

From ASMBits

Consider the following cache:

  • 12 KB (12,288 bytes)
  • 3-way set-associative
  • 256 sets

Write a function that will determine whether two addresses will map to the same cache set in this cache. Your function must return 1 or 0.


Expected solution length: Around 6 lines.

Sample Input

cacheblock(0, 2)

Sample Output

r0=1

Write your solution here

x
 
1
.global _start
2
_start:
3
    ldr r0, =0
4
    ldr r1, =2
5
    bl cacheset
6
1:  b 1b    // Done
7
8
cacheset:
9
    
10
    
Upload a source file...