[hatari-devel] WinUAE and 030 cache hits/misses?

laurent.sallafranque at free.fr laurent.sallafranque at free.fr
Mon Jan 21 10:52:59 CET 2013


> Is WinUAE CPU core able to detect cache hits/misses?

According to the work I did last year on the 68030 cycles, I would say yes and no ;)

According to the new core code, it seems that the 68030 cache is taken into account.
See newcpu.c (fill_icache030, update_cache030, getcache030 and the same functions for d cache)

So it seems that the 68030 cache management is implemented. I don't know if it is used actually, but I think it is (we should have a look at the memory access in the 030 prefetch instruction to be sure of that).

But the cycles are certainly not taken into account correctly.

I wrote a static cycles timings (falcon_cycles030.h) which gives the corrected cycles timings for a falcon with 4 cycles bus access (the standard).
This gives quite a good approximation for non cache timings, but doesn't take into account the cached ones.

Have a look at my comments in m68k_run_2ce

If I detect the cache is ON and not frozen I count the cycles as if all instructions were in the cache, which is wrong.
Everything is in the code to be able to use the cycles values (cache or non cache values) + head and tail values.

But I think the static approach is not the good one : cycles should be set in gencpu.c for the static part (head, tail and cache / non cache values) and in the instructions in newcpu.c for the dynamic part.
Like this, we could better take into account the cycles in general and better manage the cache/non cache instruction timings.

Another point : the new CPU implemented for the PMMU does not use my static timings table, which means that all the cycles are taking 2 cycles (défault for the new cpu).

It would be good to have only one 68030 CPU (the one with the PMMU is good) and implement the cycles into it.



----- Mail original -----
De: "Eero Tamminen" <oak at helsinkinet.fi>
À: hatari-devel at lists.berlios.de
Envoyé: Lundi 21 Janvier 2013 01:05:43
Objet: [hatari-devel] WinUAE and 030 cache hits/misses?


Is WinUAE CPU core able to detect cache hits/misses?

Doug is asking about that on Atari forum, to help
optimize Bad Mood for Falcon:

I have one more, perhaps more difficult 'request', but I believe it would be 
very worthwhile 

that is... to count cache misses on instruction addresses (and ideally, on 
data addresses too but i-cache is more interesting most of the time). I 
realize this means the cache behaviour should be quite close to a real 68030 
but it doesn't rely on timing accuracy so it seems like it might be 
practical without much margin for error.

Being able to view cache misses on the code would be fantastic for larger 
areas of code. We are normally blind to this information and it's difficult 
to test non-loop code offline except to measure the size - and that doesn't 
work well if the code has complex program flow (it's always doable but it 
gets impractically difficult on bigger programs).

So this would be a 'magical' feature for me I think.

If it has support for that, I could add to profiler
counting of them, per instruction.

	- Eero
hatari-devel mailing list
hatari-devel at lists.berlios.de

More information about the hatari-devel mailing list