Atmel Evaluation Kit AT91SAM9G25-EK AT91SAM9G25-EK Data Sheet

Product codes
AT91SAM9G25-EK
Page of 1102
331
SAM9G25 [DATASHEET]
11032C–ATARM–25-Jan-13
27.5
Software Implementation
27.5.1 Remainder Substitution Procedure
The substitute function evaluates the polynomial remainder, with different values of the field primitive
elements. The finite field arithmetic addition operation is performed with the Exclusive or. The finite
field arithmetic multiplication operation is performed through the gf_log, gf_antilog lookup tables.
The REM2NP1 and REMN2NP3 fields of the PMECC_REMx registers contain only odd remainders.
Each bit indicates whether the coefficient of the polynomial remainder is set to zero or not.
NB_ERROR_MAX defines the maximum value of the error correcting capability.
NB_ERROR defines the error correcting capability selected at encoding/decoding time.
NB_FIELD_ELEMENTS defines the number of elements in the field.
si[] is a table that holds the current syndrome value, an element of that table belongs to the field. This
is also a shared variable for the next step of the decoding operation.
oo[] is a table that contains the degree of the remainders.
int substitute()
{
int i;
int j;
for (i = 1; i < 2 * NB_ERROR_MAX; i++)
{
si[i] = 0;
}
for (i = 1; i < 2*NB_ERROR; i++)
{
for (j = 0; j < oo[i]; j++)
{
if (REM2NPX[i][j])
{
si[i] = gf_antilog[(i * j)%NB_FIELD_ELEMENTS] 
^ si[i];
}
}
}
return 0;
}
27.5.2 Find the Error Location Polynomial Sigma(x)
The sample code below gives a Berlekamp iterative procedure for finding the value of the error
location polynomial.
The input of the procedure is the si[] table defined in the remainder substitution procedure.
The output of the procedure is the error location polynomial named smu (sigma mu). The polynomial
coefficients belong to the field. The smu[NB_ERROR+1][] is a table that contains all these
coefficients.
NB_ERROR_MAX defines the maximum value of the error correcting capability.
NB_ERROR defines the error correcting capability selected at encoding/decoding time.
NB_FIELD_ELEMENTS defines the number of elements in the field.
int get_sigma()
{