Altera_Forum
Honored Contributor
16 years agoSOPC Custom Peripheral
Hi there!
I am trying to accelerate the following block of code implemented in the NIOS II softcore processor:
//-----------------------------------------------------
void mlse(void)
{
//Iterative MLSE detector
for(int k=0 ; k<NUMBER_OF_ITERATIONS ; k++)
{
B = pow(5,((double)(2*(k-NUMBER_OF_ITERATIONS+1)))/NUMBER_OF_ITERATIONS) ;
//perform asynchronous updates
for(int p=0 ; p<SEQUENCE_LENGTH ; p++)
{
u = 0;
//Multiply
for(int q=0 ; q<SEQUENCE_LENGTH ; q++)
u += T*s ;
//Add
u += I ;
sigmoid(B,p) ; //s = g(u)
}
}
}
All the variables are of type float. I was thinking of converting them to integer, accelerating with C2H and then convert back to float for the sigmoid() function, but then I will have a floating point operation inside the loop. The other way I was considering of doing this was keeping the variables of type float and using the altfp_matrix_mult Megacore function. The altfp_matrix_mult function block looks like a good idea, but I have no idea of how to implement it using the NIOS II processor. I was reading up on custom instructions and as far as I can understand this block won't work as a custom instruction since it needs more than two floating point input values and outputs more than one value. I have read up a bit on custom peripherals but I have no idea how to implement this using a custom peripheral. If someone could please help me out here as I am stuck, I don't know how to solve this! Thank you ;)