
Reed Solomon Encoder/Decoder on the StarCore SC140/SC1400 Cores, With Extended Examples, Rev. 1
14
Freescale Semiconductor
Implementation on the SC140 Core
Matrices of this form are called power matrices. Thus, polynomial evaluation over a set of field points is called
matrix multiplication. The basic operation is an inner vector product of the vector by the matrix row vector, which
is equivalent to a sequence of MAC instructions under Galois algebra. How to efficiently implement these MAC
instructions is the subject of the next section.
4.2 MAC Instructions Over Galois Fields
The two alternative ways to support Galois arithmetic, namely the binary representation and the exponential
representation, are introduced in
Section 2.1.2
,
Extended Galois Fields GF(2m)
. As noted there, addition is easy in
a binary representation and multiplication is easy in an exponential representation. A series of MAC instructions
over a Galois field is an alternating series of multiplications and additions. Difficulties are encountered in either
representation.
A first approach is to stay within the framework of the binary representation and to create a multiplication table,
indexed by the multiplication operands, with entries as the product. This solution is fast but requires a large
memory. For
GF(256)
, the required table size is 64 KB, which is impractical for typical DSP memories. A second
approach is the extreme opposite, requiring no memory at all. In this approach, multiplication is simply performed
bitwise by carry-less multiplication of the two binary operands, followed by the division by the primitive
polynomial over
GF(2)
. This method is slow and inefficient. A third method is to perform addition in binary
representation and multiplication in exponential representation and to perform the conversions between the two
representations with the aid of look-up tables. In this particular software implementation, we chose this third
approach because it offers the most reasonable trade-off between execution speed and memory conservation.
4.3 Look-up Tables
For a look-up table implementation, the following three types of tables are used:
A binary-to-exponential conversion table with the exponent as entry and the Galois number as index.
An exponential-to-binary conversion table with the exponent as index and the Galois number as entry.
A power matrix of the kind introduced in
Section 4.1
.
The zero element deserves particular attention since its exponent must be defined. A suitable exponent is attributed
to the zero element on the basis of the laws that such an exponent must obey if two Galois numbers, at least one of
them a zero, are multiplied. The exponent of the product of two Galois numbers is the sum of their individual
exponents, modulo 255 (or modulo 2
m
–
1 for a general Galois field). However, if at least one of the factors is zero,
the exponent of the product must be equal to the exponent of the zero element. Following is one way to implement
Galois multiplication efficiently while taking care of the zero element:
1.
Associate the exponent 511 (or 2
m
+1
–
1
for a general Galois field) to the zero element.
2.
Extend the basic exponential-to-binary table whose exponents range from 0 to 254 to a table whose
exponents range from 0 to 510. To accomplish this step, replicate the exponential-to-binary table
entries for exponents exceeding 255 and append a zero byte at index 511.
If both operands differ from zero, the sum of their exponents is less than 511 and is a valid index to the table. If one
or more of the original operands is zero, the sum of exponents exceeds 511. Since the exponent of the end result
must be 511, multiplication is correctly performed by taking the
minimum
between the sum of the exponents and
511. The tables use in this implementation are as follows:
bin_2_exp.
Binary-to-exponential table, 256 words long. Indices are the Galois numbers in binary
form and entries are their corresponding exponents. The first entry is equal to 511.