Want to use the powerpc e200z6 SPE APU

Peter Dufault dufault at hda.com
Sun Oct 11 09:38:14 UTC 2009


I want to use the "Signal Processing Engine Auxiliary Processing Unit"  
in the e200z6.  At the moment the interface defined in spe.h and  
documented in the Freescale Programming Interface Manual spepim.pdf is  
what I need and I'll only be using them in a single task.  The default  
configuration of the compiler doesn't support them:

[dufault at finny motobank]$ powerpc-rtems4.10-gcc -c -mspe foo.c
foo.c:1: error: E500 and FPRs not supported

and then there is the issue of context switching.  The SPE doesn't use  
the floating point registers but does use the full 64 bits of the  
GPRs.  The "normal" instructions leave the upper half of the GPR  
alone.  There is some earlier discussion here: http://www.rtems.com/ml/rtems-users/2008/september/msg00206.html

I suppose if I REALLY do this in only one task then all I need to do  
is configure a compiler that can support what's in spe.h and start  
using it, right?  To be sure nothing else used the SPE I'd only use  
that compiler to compile a single file (avert your eyes, Ralf) and I  
would enable / disable the SPE when I entered/left that routine.  I  
will probably start out that way.

To do this properly is this roughly what must be done:

1. Configure a compiler to support the SPE.  Does anyone off-hand know  
the exact incantation to extend the current build to also do that?
2. Ensure that __SPE__ and __NO_FPRS__ is somehow defined (hopefully  
by the above) so that the CPU model is "Generic (E500/float-gprs/SPE)"  
and PPC_HAS_FPU is 0;
3. Context switching - I know Till earlier talked about adding  
"context switch plugins".  To get started I would implement a compile- 
time _CPU_Save_float_context() / _CPU_Restore_float_context() that  
saves the upper half of the registers and the other SPE context.   
Would that all "just work" then or will PPC_HAS_FPU 0 mess things up  
somewhere?

I suppose another easy way to get started is to write Till's "context  
switch hooks" and explicitly load up the context and enable the SPE in  
the task where I want to use it, and then save and disable it at the  
end.

Peter



More information about the users mailing list