#include "mt_ppu.h" extern spe_program_handle_t mt_spu; unsigned long buffer[32] __attribute__ ((aligned(128))); #define ACTIVE_SPUS 4 void mt_init(mt_state_t *state) { unsigned long int *const mt = state->mt; int i; for (i = 0; i < N*ACTIVE_SPUS; i++) { mt[i] = (rand() << 16) | rand(); //if(i % 83 == 0) // printf("fun %d %x \n", i,mt[i]); } } int main() { /* SPE Management */ speid_t speid[ACTIVE_SPUS]; int status[ACTIVE_SPUS]; int i; control_block * cb = malloc_align(128,7); /* Control block */ cb->first = 0; cb->last = ACTIVE_SPUS - 1; cb->memory = &buffer[0]; /****** Seeds for MT ******/ mt_state_t * statePtr = malloc_align(sizeof(mt_state_t),7); mt_init(statePtr); printf("-------------- PPU 1 Creating threads \n"); /* Create the threads */ for (i=0;ilstore[i] = spe_get_ls(speid[i]); /* Wait until there is something in the mailbox */ while (!spe_stat_out_mbox(speid[i])) {} /* 2 Add this to the local store address */ cb->lstore[i] += spe_read_out_mbox(speid[i]); } printf("-------------- PPU 3 Share control block \n"); /* 3 Give control block pointer */ for (i=0;i