HomeForumsWhat's newResources 
 
 
CSH lib and using cache in emus or on games
vbt - Nov 7, 2006
 vbt Nov 7, 2006
Ive check lately the CSH sample and it does only few things :


CSH_Init(CSH_4WAY);

CSH_AllClr();

CSH_Purge((volatile void *)0x06000008, (Uint32)0x10);



It inits the cache mode and purge it and nothing else. Maybe a noob question, how to fill it ? can we leave functions inside the cache or the CPU uses it automatically ?


Last thing were it could be use in emus ? for instance in CPU core ? The main goal is to increase the speed of the emu naturally

 Mask of Destiny Nov 8, 2006
Generally speaking, the CPU handles the cache on its own; however, if you disable the cache you can use it as high-speed RAM. I think it might be difficult to use it this way in C though. The cache on the SH-2 isn't very big and if you were to do it in C you'd need a separate linker script for the portion to be run out of the cache. Also if you're not careful in what portion of the program goes in the cache, you could very well reduce performance with this strategy.

 RockinB Nov 9, 2006
Somewhere in this forum, I once wrote how to use it as RAM and what it's address is. Anyway, the information is hidden in the CPU manual.

 vbt Nov 9, 2006

RockinB said:
Somewhere in this forum, I once wrote how to use it as RAM and what it's address is. Anyway, the information is hidden in the CPU manual.



Not found :S

 CyberWarriorX Nov 9, 2006
Actually, one of the more interesting ways I've seen it used was in the game Assault Suits Leynos 2. The programmers basically turned half the cache into ram, then used it as a high-speed stack.

Cyber Warrior X