My code is something like this :
Code: Select all
main:
ADD #2,R2 ; R2 = counter
AND R3,R1 ; R3 = Address Mask. M: $3FFFF ; S: $C00007FF. Not needed for 16-bit tests
BRA main
MOV.W @R1+,R0 ; R1 = Read Address. M: $26000000 ; S: $C0000000
; Feel free to use MOV.L instead, for testing 32-bits accesses
V_INT_M:
STS.L PR,@-R15
MOV.L R0,@-R15
MOV.W R0,@($16,GBR) ; ACK H_INT
MOV R2,R0
MOV.L R0,@($20,GBR)
MOV #0,R2
MOV.L @R15+,R0
LDS.L @R15+,PR
RTE
NOP
V_INT_S:
STS.L PR,@-R15
MOV.L R0,@-R15
MOV.W R0,@($16,GBR) ; ACK H_INT
MOV R2,R0
MOV.L R0,@($24,GBR)
MOV #0,R2
MOV.L @R15+,R0
LDS.L @R15+,PR
RTE
NOP
With this code, the private RAM is 61% faster than the cache-through SDRAM for 16-bit access,
and more than twice faster for 32-bit access.
NB : the gap between 16-bit and 32-bit cache-through is the "AND R3,R1" instruction.
As you know, once you've read a data from SDRAM, as long as there is room to hold it in cache, this data stays in cache and benefits from the same bandwidth as private RAM. So, for a small array, my advice is to not worry about its location.
But if you want to access a medium size array (let's say, more than 64B, but less than 2kB), and you know you're going to access it a lot, and each access will be fully random, and you want to store 32-bits long integers - eg, a sine table ; then I definitely would recommend to use the private RAM.
Hope it helps.