ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 9, 2007 11:06:16 GMT -5
Hi you all. I've started developing for the 32X and try to use the SH2 cache. Here's my code :
mov #1,R0 mov.l REG_CCR,R1 MOV.B R0, @R1 ; Cache enable mov @R1,R1 mov RAM_START,R8 test: mov @R8,R7 ; read SDRAM add #1,R10 bra test nop
REG_CCR: dc.l $FFFFFE92 RAM_START: dc.l $06000000
By reading SDRAM (mov@R8,R7), the cache should be filled. And it's not. Idea anyone ?
|
|
|
Post by jlf65 on Mar 9, 2007 14:54:32 GMT -5
You should be incrementing R8, not R10.
|
|
ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 9, 2007 17:44:44 GMT -5
Thank you for your answer jlf65.
R10 is here just to check the SH2 is actually running. I'm not trying to read the whole SDRAM. Moreover, if I increment R8 each time, the cache will be useless. Anyway, I guess that by just fetching the instruction, the cache should be filled, shouldn't it ? Unless my tools are wrong ... Or my knowledge too short.
I use GensKMod 0.7, available at gendev.spritesmind.net
|
|
ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 9, 2007 17:59:55 GMT -5
The Hitachi SH7604 Hardware Manual states "When the cache is disabled, the area H'C0000000 to H'C0000FFF can be used as 4 kbytes of on-chip RAM." Has anyone already tried it ?
|
|
|
Post by jlf65 on Mar 10, 2007 2:50:46 GMT -5
Thank you for your answer jlf65. R10 is here just to check the SH2 is actually running. I'm not trying to read the whole SDRAM. Moreover, if I increment R8 each time, the cache will be useless. Anyway, I guess that by just fetching the instruction, the cache should be filled, shouldn't it ? Uh, no. Just that location you're reading. When a cache miss occurs, it's doesn't fill the WHOLE cache. That would be silly and counterproductive. It fills one LINE of the cache... which is 16 bytes according to the SH2 manual.
|
|
ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 10, 2007 5:30:18 GMT -5
My english is not as good as what I've thought I mean, doing mov @r8,r7, when r8 = 0600 0000h, r7 should get the content of $0600 0000 and, somewhere in the cache, there should be 1 line of content : (0600 0000), (0600 0002), (0600 0004), ... (0600 000E) where (0600 0002) is the content of 0600 0002h. Shouldn't it ?
|
|
ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 10, 2007 16:37:18 GMT -5
Maybe I should check the cache directly (data array access) at C600 0120h.
|
|
|
Post by jlf65 on Mar 10, 2007 20:06:05 GMT -5
My english is not as good as what I've thought I mean, doing mov @r8,r7, when r8 = 0600 0000h, r7 should get the content of $0600 0000 and, somewhere in the cache, there should be 1 line of content : (0600 0000), (0600 0002), (0600 0004), ... (0600 000E) where (0600 0002) is the content of 0600 0002h. Shouldn't it ? Yes. How are you trying to determine if it's in the cache or not? I guess that's the question now.
|
|
ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 11, 2007 1:39:21 GMT -5
I use GensKMod 0.7, available at gendev.spritesmind.net
|
|
|
Post by GiGaBiTe on Mar 11, 2007 2:06:02 GMT -5
Try using a peek (if it exists in SH2 assembly) to read the value of the cache and print it on screen as text data.
|
|
|
Post by jlf65 on Mar 11, 2007 18:42:17 GMT -5
I use GensKMod 0.7, available at gendev.spritesmind.net That's an emulator. I doubt it emulates the SH2's so far as to simulate cache accesses. They would only have the cache-as-memory support.
|
|
ob1
Moldy Popcorn
Posts: 29
|
Post by ob1 on Mar 12, 2007 0:18:05 GMT -5
That's what I thought. I've asked Gens' and GensKMod authors about it. I'll keep you informed. Thank you.
|
|