No more Bits: Only Bytes!!!
One way of sharing data between PPE program and SPE program is by using a header file defining a common data structure. The era of counting for bits of memory is comes to end by Cell BE’s byte level memory processing. The data passed between PPE and SPE programs should be in multiples of 16 bytes. And there is also a limit on the variables declared in a SPE program. So, in header file the size of total variables declared should in multiple of 16 bytes. If it is not; we have to follow a work around of adding few dummy variables in order to meet the 16bytes criteria.
For example following is the content of datadef.h header file:
typedef struct
{
/*Array to store the name of the array*/
char genome_file[32];
char output_file[32];
/*Variable to store the total number of input queries*/
unsigned int num_queries;
float aa_ga_weighting[20];
unsigned int dummy[3];
} filexchg_data
In the above sample at the end one dummy integer array is declared inorder to make the total size divisible by 16.
Here is the calculation:
32 + 32 + 4 + (4×20) + 12 = 160 / 16 = 10