Reed Solomon Explained V1-0 PDF
Reed Solomon Explained V1-0 PDF
Reed Solomon Explained V1-0 PDF
Codes Explained
INDEX
1 INTRODUCTION ........................................................................................................................................3
2 OVERVIEW ............................................................................................................................................... 3
2.1 EXAMPLE OF RS APPLICATION ........................................................................................................................ 3
2.2 FINITE FIELDS .............................................................................................................................................. 4
2.2.1 Finite Field Example ........................................................................................................................ 4
2.2.2 GF (2) Fields .................................................................................................................................... 6
2.3 POLYNOMIALS ............................................................................................................................................. 7
2.3.1 Polynomial Roots ............................................................................................................................ 7
2.3.2 Generating a GF (2n) ....................................................................................................................... 8
2.3.3 GF (2n) Addition & Multiplication Tables ...................................................................................... 10
2.3.4 Polynomial Arithmetic................................................................................................................... 11
2.3.5 Exponents and Coefficients ........................................................................................................... 13
2.4 RS CODEWORDS........................................................................................................................................ 13
2.5 RS POLYNOMIALS ...................................................................................................................................... 14
2.5.1 GF Polynomial ............................................................................................................................... 14
2.5.2 Generator Polynomial ................................................................................................................... 14
2.5.3 Encoding Polynomial ..................................................................................................................... 14
3 RS CODEWORD EXAMPLE ....................................................................................................................... 15
3.1 BIT STRING ............................................................................................................................................... 15
3.2 CODEWORD GENERATION ........................................................................................................................... 15
3.3 ERROR DETECTION ..................................................................................................................................... 17
3.4 REMAINDER LOOKUP TABLE ......................................................................................................................... 17
3.5 ADVANCED ERROR DETECTION ..................................................................................................................... 19
3.5.1 Recap ............................................................................................................................................ 19
3.5.2 Syndromes..................................................................................................................................... 19
3.5.3 Euclidean Algorithm ...................................................................................................................... 20
3.5.4 Error Locator Polynomial .............................................................................................................. 20
3.5.5 The Chien Search Algorithm .......................................................................................................... 21
3.5.6 Error Correction ............................................................................................................................ 22
4 APPENDIX 1 - WORKED EXAMPLE 1 ........................................................................................................ 22
5 APPENDIX 2 - WORKED EXAMPLE 2 ........................................................................................................ 24
6 APPENDIX 3 - EXTENDED EUCLIDIAN ALGORITHM .................................................................................. 26
1 Introduction
Error identification and correction are crucial for reliable and efficient digital communication and data
storage. Reed Solomon (RS) codewords are the most widely used method to provide digital error
detection and correction capabilities for ADSL/VDSL lines, Digital Video Broadcast (DVB), CD and
DVD players, and many other forms of digital communication and data storage.
Most of the articles on RS focus on number theory and many are quite difficult to understand, unless
you have a strong background in maths or are studying this topic at college or university. Few provide
practical, working examples of how RS codewords are generated, encoded and decoded and how
error detection and correction is implemented. This paper does not delve too deeply into number
theory (there has to be some) nor does it attempt to prove complex mathematical equations, there is
plenty of other material out there that does precisely that. Several working examples are provided
throughout the text and in the appendices.
2 Overview
2.1 Example of RS Application
ADSL is an example of the application of RS for error detection and correction. Ignoring for now the
ATM encapsulation and SAR function, the sending device extracts user (payload) data from IP
packets and places it inside ADSL frames. A polynomial uses the data bits in the frame to generate a
Forward Error Correction (FEC) checksum, which is appended to the frame forming a RS codeword.
The codewords are converted to symbols and transmitted as tone frequencies over a copper pair to
the far-end receiving device.
ADSL MODEM
#1 RS
Frames
FEC CW
Fourier Transform
Tone Bit Ordering
Symbol Encoding
#1
#2 RS Copper
Multiplexor
Modulation
#2 FEC CW Pair
Payload IP #3 #3 RS
FEC CW
#N
#N RS
FEC CW
Upon receiving the frequency tones, the far-end device converts the symbols back into codewords
and divides them by the same polynomial that the sending device used to generate them. No errors
have been introduced during transmission if the division does not produce a remainder. If there is a
remainder, the receiving device knows there is an error and uses the value of the remainder to
identify and correct the specific symbols in which the errors occurred.
The length of the checksum determines the number of errors that can be detected and corrected.
Error detection and correction incur a processing overhead so a balance has to be struck between the
amount of FEC and user data information that is transmitted. An ADSL1 implementation typically uses
256 x byte codewords that include 224 x data bytes and 32 x FEC bytes.
A finite field is constructed using a prime number base. The use of prime numbers is essential to
ensure that any single element in the field produces a unique value when it is added to, or multiplied
by, any other element in the field. This is not the case if a non-prime base is used.
GF (2), GF (3), GF (5), GF (7) etc. are all examples of valid prime number integer fields. However, so
is 2n, where 2 is the prime base and n an exponent that determines the number of elements within the
field. For example, GF (2 3) = GF (8) is a base-2 field with 8 elements {0, 1, 2, 3, 4, 5, 6, 7}. GF (28) =
GF (256) is a base-2 field with 256 elements {0, 1, 2, 3…….255} etc.
It clearly makes sense to use 2 as the prime base for binary computation. The example later in this
paper generates a RS codeword based on a GF (2 3) field. However, polynomials are used rather than
integers when populating a 2n finite field, which is explained later.
30 = 1 [= 36 = mod 1]
31 = 3 [= 37 = mod 3]
32 = 2 [3 x 3 = 9 ÷ 7 = 1 mod 2]
33 = 6 [3 x 3 x 3 = 27 ÷ 7 = 3 mod 6]
34 = 4 [3 x 3 x 3 x 3 = 81 ÷ 7 = 11 mod 4]
35 = 5 [3 x 3 x 3 x 3 x 3 = 243 ÷ 7 = 34 mod 5]
36 = 1 [3 x 3 x 3 x 3 x 3 x 3 = 729 ÷ 7 = 104 mod 1]
37 = 3 [3 x 3 x 3 x 3 x 3 x 3 x 3 = 2,187 ÷ 7 = 312 mod 3]
3n = etc.
6 0 7 1 8 2
Note that 3 = 3 = 1 and 3 = 3 = 3 and 3 = 3 = 2 etc. The values of the field repeat ad infinitum for
any powers of 3. Any values obtained as a result of addition, subtraction, multiplication and division
are always equal to the values 30 to 35 no matter what the result of the arithmetic. This cyclic
behaviour is well suited to the way that microprocessors use registers to perform bit-shift arithmetic.
The GF (7) addition table below contains the results of all of the possible addition and subtraction
operations for the elements in the field. Note the symmetry of the table. There are no negative or
duplicate numbers in any of the rows or columns.
GF (7) - {0, 1, 2, 3, 4, 5, 6}
Numbers with sums less than 7 are added in the usual way. For example, 1 + 5 = 6, 2 + 4 = 6, 3 + 3 =
6, 4 + 2 = 6, 5 +1 = 6. Addition obeys the commutative law i.e. 1 + 5 = 5 + 1, 2 + 4 = 4 + 2, 3 + 3 = 3 +
3 etc. For numbers with sums greater than or equal to 7 ignore the integer result and take the
modulus-7 remainder i.e. 1 + 6 = 0, 2 + 6 = 1, 3 + 6 = 2, 5 + 3 = 1 etc.
Subtraction is also performed as an addition using the additive inverse of elements. The additive
inverse of an element is the value which when added to that element results in 0 [a + (-a) = 0]:
For example, to subtract 1 - 6 add the first digit 1 to the additive inverse of 6, which is 1 i.e. 1 +1 = 2.
Proof: 6 + 2 = 1 so 2 = 1 - 6.
To subtract 3 - 5 add the first digit 3 to the additive inverse of 5, which is 2 i.e. 3 + 2 = 5. Proof: 5 + 5 =
3 so 5 = 3 - 5.
The GF (7) multiplication table below contains the results of all of the possible multiplication and
division operations for the field. As with the addition table, there are no negative or duplicate numbers
in any of the rows or columns.
GF (7) - {0, 1, 2, 3, 4, 5, 6}
Multiplication of values within the field follows the same modulus rules for addition. For numbers with
products greater than or equal to 7 ignore the integer result and take the modulus-7 remainder i.e. 1 x
5 = 5, 2 x 5 = 3, 3 x 5 = 1, 4 x 5 = 6, 5 x 5 = 4, 5 x 6 = 2 etc. Multiplication obeys the commutative law
i.e. 1 x 5 = 5 x 1, 2 x 5 = 5 x 2 etc.
2
It is also possible to multiply numbers by adding the powers of the primitive 3, for example, 2 x 5 = 3
x 35 = 37 = 31 = 3. Another example: 6 x 5 = 33 x 35 = 38 = 32 = 2. Recall that the powers repeat so 36
= 30, 37 = 31, 38 = 32 etc.
Division is also performed as a multiplication using the multiplicative inverse of elements. The
multiplicative inverse of an element is the value which when multiplied by that element results in 1 [b x
-1
(b ) = 1]:
33 x 33 = 1
34 x 32 = 1
35 x 31 = 1
36 x 30 = 1
Table 2-4: GF (7) Multiplicative Inverse
i N-i
From above, it can be seen that the inverse of an element 3 is 3 where N = 6, the highest value in
the field.
For example, to divide 4 ÷ 3 multiply 4 by the inverse of 31, which is 35 i.e. 34 x 35 = 39 = 33 = 6. Proof:
4 ÷ 3 = 6, 6 x 3 = 4.
It is also possible to divide numbers by multiplying and subtracting the powers of the primitive 3, for
example, 4 ÷ 3 = 34 x 3-1 = 33 = 6.
This section has confirmed some important properties of finite fields, in particular:
A finite field must be based on a prime number to ensure that each row and column of its
addition and multiplication tables contains unique values;
The primitive (root) of the field is used to derive all of the values in the field;
0 6 12
A finite field is indeed finite, but the field repeats an infinite number of times (3 = 3 = 3
etc.);
Only addition and multiplication are required - subtraction and division are performed using
the additive and multiplicative inverses respectively.
The most basic field is a GF (21), which contains two elements {0, 1}. This simple field allows us to
demonstrate the binary mathematical rules for all GF (2n) fields.
The following key rules are stipulated for the base-2 field:
There are only two mathematical operations; addition and multiplication. Subtraction is
achieved using an element’s additive inverse and division using an element’s multiplicative
inverse;
The following information is derived from Table 2-5 and the rules above:
0+0=0, 0+1=1, 1+0=1, 1+1=0. Therefore, addition is an XOR operation;
0x0=0, 0x1=0, 1x0=0, 1x1=1. Therefore, multiplication is an AND operation;
Since 1+1=0 and 1-1=0 then 1 = -1. Therefore, adding is the same as subtracting;
Since 1+1=0 and 1+1=2 then 2 = 0.
2.3 Polynomials
2.3.1 Polynomial Roots
A polynomial is an expression that describes a non-linear set of co-ordinates. For example, the
polynomial y = x2 -1 is used to describe the parabola in Figure 2-2 below. The graph is described by
substituting x with a series of values and plotting the points x, y.
Val X Val Y
-5 = 24
-4 = 15
-3 = 8
-2 = 3
-1 = 0
0 = -1
1 = 0
2 = 3
3 = 8
4 = 15
5 = 24
th
Reed Solomon Explained V1-0
Val X Val Y
-5 = 26
-4 = 17
-3 = 10
-2 = 5
-1 = 2
0 = 1
1 = 2
2 = 5
3 = 10
4 = 17
5 = 26
2
Figure 2-3: Parabola for the Polynomial x + 1
The polynomial x2 + 1 has no roots i.e. it is irreducible. In other words, it is the polynomial equivalent
of a prime number.
Irreducible (prime) polynomials rather than prime integers are used to generate the values in GF (2n)
finite fields. The irreducible polynomial x3 + x + 1 is used to generate the example GF (23) field later in
this paper.
th
Reed Solomon Explained V1-0
0 1 2 m-1
P(x) = a0 x + a1 x + a2 x +……am-1 x where the coefficients a0 to am-1 are binary or decimal
values.
An irreducible 3rd degree (cubic) polynomial generates an 8 x 3-bit symbol field; an irreducible 4th
th
degree polynomial generates 16 x 4-bit symbol field; an irreducible 8 degree polynomial generates
256 x 8-bit symbol field etc.
rd 3 3 2
Either of the two irreducible 3 degree polynomials P(a) = a + a + 1 or P(a) = a + a + 1 can be used
to generate an 8 x 3-bit symbol field. The first one is used to generate the GF for the examples in this
paper.
As discussed in Section 2.3.1, the prime polynomial is irreducible so it does not have a real integer
root. However, from Section 2.2.2 we know that for a GF (2n) field 1 + 1 = 0 and 1 - 1 = 0 so we can
assign a value to a and make it a root to create a finite field with some interesting properties. If a = 2
3 3 3
is the primitive root of P(a) = a + a + 1 and a + a + 1 = 0 then a = a + 1 (because 1 + 1 = 0 and 1 = -
1). The first elements of the field are 0 and a. Populate the rest of the field by multiplying the previous
3
non-zero element by a and substituting a for a + 1. Note that the positions of the bits in the 3-bit
2 1 0
symbols match the positions of a , a and a in the table.
3 011 a + 1 a3 2 3
axa =a =a+1
2 4 2
6 110 a + a a a x (a + 1) = a + a
2 5 2 3 2 2
7 111 a + a + 1 a a x (a + a) = a + a = a + 1 + a
5 101 a2 + 1 a6 a x (a + a + 1) = a + a + a = a + 1 + a2 + a = a2 + 2a + 1
2 3 2
Recall from Section 2.2.1 that a finite field repeats an infinite number of times. To verify this, prove
that a7 = a0 = 1:
7 6 2 3
a = a x a = a x (a + 1) = a + a = a + a + 1 = 2a + 1 = 1
Note: 1 + 1 = 0, therefore 2 = 0, so 2a = 0.
Table 2-7 below summarises the field and shows the position of the element polynomials and the
symbol values in binary and decimal.
0 a0 a1 a2 a3 a4 a5 a6
0 7 2 2 2 2
0 x =x x x x+1 x +x x +x+1 x +1
000 001 010 100 011 110 111 101
0 1 2 4 3 6 7 5
3
Table 2-7: GF (8) Table for Polynomial P(x) = x + x + 1
The irreducible polynomial (x3 + x + 1) that generates the field defines the modulus of the field for all
arithmetic operations. The value of the modulus is 10112 = 1110:
3 2
P(x) = 1x + 0x + 1x + 1 = 10112 = 1110
Addition and subtraction yield exactly the same result because 1 + 1 = 0 and 1 - 1 = 0.
+ 0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 1 0 3 2 5 4 7 6
2 2 3 0 1 6 7 4 5
3 3 2 1 0 7 6 5 4
4 4 5 6 7 0 1 2 3
5 5 4 7 6 1 0 3 2
6 6 7 4 5 2 3 0 1
7 7 6 5 4 3 2 1 0
Table 2-8: GF (8) Addition Table
Multiplication is performed using conventional binary arithmetic combined with XOR. As ever, the
result of the multiplication is determined by the modulus of the field. If the result is more than the
modulus, it is XORed with the modulus to obtain the remainder.
0 1 1
x 1 0 1
0 1 1
0 0 0 Shift left
0 1 1 Shift left
1 1 1 1 XOR Result
1 0 1 1 XOR Modulus 10112 (1110)
1 0 0 Result = 410
1 1 0
x 1 1 1
1 1 0
1 1 0 Shift left
1 1 0 Shift left
1 0 0 1 0 XOR Result
1 0 1 1 XOR Modulus 10112 (1110)
1 0 0 Result = 410
4 5 9 2 (mod 7)
Verify by adding the powers of the a in the field: 6 x 7 = a x a = a = a =4
x 0 1 2 3 4 5 6 7
0 0 0 0 0 0 0 0 0
1 0 1 2 3 4 5 6 7
2 0 2 4 6 3 1 7 5
3 0 3 6 5 7 4 1 2
4 0 4 3 7 6 2 5 1
5 0 5 1 4 2 7 3 6
6 0 6 7 1 5 3 2 4
7 0 7 5 2 1 6 4 3
Table 2-9: GF (8) Multiplication Table
Division is performed using conventional binary arithmetic with XOR until the remainder is obtained.
Note that for polynomial division the principal objective is to determine the remainder. The reason for
this is explained further when generating the codeword in the example later in the paper.
21 20 22 21 20
1 0 = 2 remainder 1
1 1 1 1 1
1 1 XOR
0 0 1 Remainder 1
1 0 2 1 0
2 2 2 2 2
1 1 = 3 remainder 0
1 1 1 0 1
1 1 XOR
1 1 Remainder 0
6 -3 3
Verify by subtracting the powers of a in the field: 5 ÷ 3 = a x a = a = 3
2
x + x + 1 a5 111 7
2 6
+ x + + 1 a 101 5
2 1
2x + x + 0 a 010 2
Note that for a GF (2n) field since 1 + 1 = 0, then 2 = 0 so 2x2 = 0. Therefore, the answer is 010.
Examining the addition table confirms that 7 + 5 = 2.
1 1 1
XOR 1 0 1
0 1 0
x2 + x + 1 a5 111 7
2 4
x x + x + 0 a 110 6
0 + 0 + 0 000 0
3 2
x + x + x + 0 1110 14 shift left
4 3 2
x + x + x + 0 + 0 11100 28 shift left
4 3 2
x + 2x + 2x + x + 0 10010 18 > modulus
3 2 4
Since 1 + 1 = 0, then 2 = 0 so 2x = 0 and 2x = 0. Therefore, the answer is x + x. But this is a higher
degree polynomial than the field generating polynomial so exceeds the modulus of the field. To
calculate the final result is it necessary to divide x4 + x by x3 + x + 1 (the modulus) to obtain the
remainder:
2
x + 0 = x remainder x = 4
3 4 3 2
x + x + 1 x + 0x + 0x + x + 0
4 2
x + 1x + x XOR
2
x + 0
0 + 0 XOR
2 2
x Remainder x = 4
Using coefficient rather than polynomial long division:
1 0 = 2 remainder 100 = 4
1 0 1 1 1 0 0 1 0
1 0 1 1 XOR
1 0 0
0 0 0 XOR
1 0 0 Remainder 100 = 4
The whole operation could have been performed using binary, as follows:
1 1 1 a5
x 1 1 0 a4
0 0 0
1 1 1 0 shift left
1 1 1 0 0 shift left
1 0 0 1 0 XOR result
1 0 1 1 0 shift left modulus & XOR
2 5 4 9 2
1 0 0 a a +a =a =a
Division is also performed as a multiplication using the multiplicative inverse of elements. The
multiplicative inverse of an element is the value which when multiplied by that element results in 1 [a x
-1
(a ) = 1]. For example,
3
Table 2-10: GF (2 ) Multiplicative Inverse
i N-i
From above, it can be seen that the inverse of an element a is a where N = 7, the highest value in
the field.
4 3 4 3 4 4 4 8 (mod 7) 1 4
To divide a ÷ a multiply a by the inverse of a , which is a i.e. a x a = a = a = 2. Proof: a =
6, a3 = 3, 6 ÷ 3 = 2.
a5 x4 a5 x3 a2 x2 a3 x1 a0 x0
111 111 100 011 010
7 7 4 3 2
Therefore, it is relatively straightforward to take any string of bits, split them into the 3-bit symbols and
generate RS codewords that result in a specific remainder when divided by a certain value.
If the receiving device obtains a different remainder than the sending device it not only knows that an
error is present it can use the value of the remainder to identify specific symbols that have been
affected.
2.4 RS Codewords
The maximum RS codeword length n is given by the following formula where s is the symbol size in
bytes. In other words, if the symbol size is 8-bits (one byte) the highest codeword byte is 28 - 1 = 255.
s
n=2 -1
RS codewords are denoted with the expression RS [n, k] where n = number of codeword bytes and k
= number of data bytes. The number of Forward Error Correction (FEC) bytes is n - k. A complete RS
codeword specification for a 256 symbol codeword that uses 8-bits per symbol with parity symbols
would be:
RS [n = 255, k = 233] s = 8, 2t = 32
Where s = symbol size and 2t = the number of parity symbols. 2 x parity symbols are required to
correct a single symbol error. Therefore, 2t = 32 would correct a single symbol (t = 1) errors.
RS [7, 5] s = 3, t = 2
5 symbols are data and 2 symbols are used for error correction. As there are 2 x FEC symbols it is
only possible to identify and correct one errored symbol for each codeword.
2.5 RS Polynomials
Three polynomials are used to generate RS codewords. The first is used to generate the finite field
(Galois Field), the second is a generic polynomial that is used to generate the encoding polynomial,
and the third is the encoding polynomial itself. The encoding polynomial generates the actual RS
codewords.
2.5.1 GF Polynomial
The following polynomial is used to generate the finite field (Galois Field) for the example in this
3
paper. It is an “irreducible” cubic (x ) polynomial that cannot be factored (reduced) any further. It is
effectively the polynomial equivalent of a prime number.
P(x) = x3 + x + 1
If the codeword’s specification were RS [7, 3] s = 3, t = 4 we would use the 4 values (x - a1) (x - a2) (x
3 4
- a ) (x - a ) from the generator polynomial to create a codeword that consists of 3 x data symbols and
4 x FEC symbols allowing us to identify and correct 2 x errored symbols.
n
As described in the previous sections, addition and subtraction are the same for a GF (2 ) field so (x -
1 1 2 2
a ) = (x + a ) and (x - a ) = (x + a ), therefore, the encoding polynomial is calculated as follows:
Note that (x + 2) (x + 4) = x2 + 6x + 8. However, the polynomial used to generate the finite field in this
example is x3 + x + 1, which is modulo 10112 = 1110 so it is necessary to convert the 8 to a 3.
1 0 0 0 =8
XOR 1 0 1 1 = 11
1 1 =3
Therefore, the encoding polynomial used in this paper for generating RS codewords is:
2
G(x) = x + 6x + 3
3 RS Codeword Example
3.1 Bit String
The bit string to encode as a RS codeword for transmission in this example is “001010011100101”:
a0 x4 a1 x3 a3 x2 a2 x1 a6 x0
001 010 011 100 101
1 2 3 4 5
To accommodate the 2 x FEC symbols at the end of the 5 x symbol message it is necessary to
2
multiply the bit string by x to shift the message left two symbol places:
2
Divide M(x) by G(x) to obtain the FEC symbols, where G(x) is the encoding polynomial x + 6x + 3.
Note that it is only necessary to use the coefficients because their position is implied by the
exponents:
2 1 0 6 5 4 3 2 1 0
x x x x x x x x x x
1 4 5 0 1 Remainder 63
1 6 3 1 2 3 4 5 0 0
1 6 3 x 1x4
4 0 4 XOR value
3
4 5 7 x 4x
5 3 5 XOR value
5 3 4 x 5x2
1 0 0 XOR value
0
1 6 3 x 1x
6 3 Remainder
Note that addition is the same as subtraction for the GF (23). When using XOR in the division above,
the following method is used. For example, 123 XOR 163:
1 2 3
0 0 1 0 1 0 0 1 1
1 6 3
XOR 0 0 1 1 1 0 0 1 1
0 0 0 1 0 0 0 0 0
0 4 0
This method is referred to as “systematic” encoding because the error correction information is
embedded in and part of the codeword.
To verify that the codeword is valid, divide C(x) by the encoding polynomial G(x) to check that
remainder = 0:
x2 x1 x0 x6 x5 x4 x3 x2 x1 x0
1 4 5 0 1 Remainder 0
1 6 3 1 2 3 4 5 6 3
4
1 6 3 x 1x
4 0 4 XOR value
4 5 7 x 4x3
5 3 5 XOR value
2
5 3 4 x 5x
1 6 3 XOR value
1 6 3 x 1x0
0 0 Remainder
The error that causes this transformation is the value 3 (0112) because 100 XOR 011 = 111. But the
receiver doesn’t yet know this:
3
E(x) = 3x (0112)
The receiver divides R(x) by G(x) and obtains a remainder and now knows that there is an error.
x2 x1 x0 x6 x5 x4 x3 x2 x1 x0
1 4 5 3 0 Remainder 3 3
1 6 3 1 2 3 7 5 6 3
1 6 3 x 1x4
4 0 7 XOR value
3
4 5 7 x 4x
5 0 5 XOR value
5 3 4 x 5x2
3 1 6 XOR value
1
3 1 5 x 3x
3 3 XOR value
Dividing the error 0x6 + 0x5 + 0x4 + 3x3 + 0x2 + 0x1 + 0 by G(X) returns exactly the same remainder
3
proving that the error is in the symbol at position x :
2 1 0 6 5 4 3 2 1 0
x x x x x x x x x x
3 1 Remainder 3 3
1 6 3 0 0 0 3 0 0 0
3 1 5 x 3x1
1 5 0 XOR value
0
1 6 3 x 1x
3 3 Remainder
This remainder is unique and is only generated for this specific bit error at this specific location in the
bit string.
3
remainder in a lookup table. The GF (2 ) field is cyclic and values repeat modulo 1110 so there are
only 7 x 7 = 49 remainder values for all of the combinations of 7 x 3-bit codeword symbols.
The remainders are obtained by dividing every possible symbol coefficient value {1 to 7} of every
exponent value {x0 to x6} by G(x) = 1x2 + 6x + 3 modulo x3 + x + 1 (10112).
Table 3-2 below shows all of the values that are divided to create the table:
÷ 163 x0 x1 x2 x3 x4 x5 x6
1 1 10 100 1000 10000 100000 1000000
2 2 20 200 2000 20000 200000 2000000
3 3 30 300 3000 30000 300000 3000000
4 4 40 400 4000 40000 400000 4000000
5 5 50 500 5000 50000 500000 5000000
6 6 60 600 6000 60000 600000 6000000
7 7 70 700 7000 70000 700000 7000000
Table 3-2: Creating the Remainder Lookup Table
x2 x1 x0 x3 x2 x1 x0
7 4 Remainder 77
1 6 3 7 0 0 0
1
7 4 2 x 7x
4 2 0 XOR value
4 5 7 x 4x0
7 7 Remainder
÷ 163 x0 x1 x2 x3 x4 x5 x6
1 01 10 63 11 73 72 62
2 02 20 76 22 56 54 74
3 03 30 15 33 25 26 16
4 04 40 57 44 17 13 53
5 05 50 34 55 64 61 31
6 06 60 21 66 41 47 27
7 07 70 42 77 32 35 45
Table 3-3: Completed Remainder Lookup Table
It divided R(x) by G(x) and obtained the remainder 3 3. The receiver located this value in the lookup
table and determined that the remainder is only possible for coefficient value 3 of exponent x3. To
correct the error, the receiver carries out the following XOR operation on the symbol in position x3:
1 1 1 Received symbol = 7
XOR 0 1 1 Coefficient value from table = 3
1 0 0 Symbol changed to = 4
3.5.1 Recap
In Section 3.2 we stipulated a five-symbol message polynomial M(x), as follows:
M(x) was divided by the generator polynomial G(x) = 1x2 + 6x + 3 to determine the remainder (6x +
3), which was appended to M(x) to form the systematic codeword C(x):
Dividing C(x) by G(x) produces a remainder of 0. The codeword was transmitted to a receiving device
and an error E(x) = 3x3 was introduced causing the symbol 4x3 to change into 7x3.
The receiver divided R(x) by G(x) and obtained a remainder of 3x + 3 indicating the presence of an
error. The following sections describe an alternative method the receiver uses to locate and correct
the error.
3.5.2 Syndromes
Both the sender and receiver use the same polynomial and finite field to encode and decode
messages so they know the roots of the generated codewords. When the receiver obtains a
remainder, it creates a “syndrome” polynomial to define the error. It does this by substituting values of
the finite field roots a into the R(x) codeword.
In this example, the roots a0, a1 and a2 are substituted to create three syndromes S0, S1 and S2. The
number of values to substitute and the number of syndromes required is dependent on the dimension
th
of the finite field. If the finite field contained 16 x 4-bit values defined by a 4 degree polynomial it
would be necessary to create a fourth syndrome, and so on.
0
The S0 syndrome is effectively a parity check determined by substituting each occurrence of a in R(x)
and XORing every element:
The S2 syndrome is determined by substituting each occurrence of a2 in R(x) and XORing every
element. The final value is taken modulo 1110 which is the modulus of the cubic polynomial:
6 5 4 3 2 1
1x 2x 3x 7x 5x 6x 3 XOR
2 2 6 2 5 2 4 2 3 2 2 2 1 2 0
S2 a =4 (a ) 2(a ) 3(a ) 7(a ) 5(a ) 6(a ) 3(a )
4096 2048 768 448 80 24 3 4
Table 3-6: R(x) S2 Syndrome
Note that the equivalent syndromes for the sender’s (good) codeword C(x) all equal 0.
The syndrome polynomial S(x) for codeword R(x) is defined using the values of S0, S1 and S2 as
follows:
2
S(x) = 4x + 5x + 3
This polynomial quantifies the error across the entire R(x) codeword. The accuracy of the S0 and S1
syndromes can verified as follows:
R(x) divided by the (x + 2) root of G(x) returns remainder 5, which is the x coefficient of S(x);
2
R(x) divided by the (x + 4) root of G(x) returns remainder 4, which is the x coefficient of S(x).
The S(x) polynomial quantifies but does not locate the error within the R(x) codeword.
This algorithm is use in the next section to create the error locator polynomial. Please refer to
Appendix 3 for an explanation of the extended Euclidean algorithm.
The S(x) syndrome polynomial created in Section 3.5.2 is used to create the ∆(x) error locator
3
polynomial. The Euclidian algorithm is used to divide S(x) into x (the degree of the finite field
polynomial) to find a common divisor of both the finite field and S(x). The quotient of the division is
used as a polynomial ∆(x) to locate the exponent of R(x) at which the error is located and the
remainder is used as a polynomial Ω(x) to determine the magnitude of the error. It is essential that we
obtain a remainder for this purpose.
Please note that for this example it isn’t actually necessary to continue beyond the first line because
2
the degree of the remainder drops below the degree of the generator polynomial G(x) (i.e. x + 6x + 3)
after the first division. However, the remaining operations are carried out to illustrate how the table is
completed until the GCD (GCD = 6) is located. For a higher degree finite field with a higher degree
generator polynomial G(x) it is necessary to continue dividing until the remainder drops below the
degree of G(x); the quotient on that line of the table becomes ∆(x) and the remainder Ω(x).
And:
2 2
4x + 5x + 7 ÷ 6 = 7x + 4x + 2 no remainder
Recall that the modulus of the finite field GF (23) field = 10112. The substitution and results are shown
in Table 3-9 below:
n n
∆(x) a Inverse a Sum Error = 0
∆x– 6 –6
7(a ) + 4 = 7(a1) + 4 = 5+4 = 1
∆x– 5 7(a– 5) + 4 = 7(a2) + 4 = 1+4 = 5
∆x– 4 7(a– 4) + 4 = 7(a3) + 4 = 2+4 = 6
∆x– 3 7(a– 3) + 4 = 7(a4) + 4 = 4+4 = 0
∆x– 2 7(a– 2) + 4 = 7(a5) + 4 = 3+4 = 7
–1 –1
∆x 7(a ) + 4 = 7(a6) + 4 = 6+4 = 2
–0 –0
∆x 7(a ) + 4 = 7(a0) + 4 = 7+4 = 3
Table: 3-9: Chien Search Algorithm
3
The error is located in the R(x) exponent position x . We know this to be correct because the error
3
introduced was E(x) = 3x , which resulted in the following discrepancy between the C(x) and R(x)
codewords:
6 5 4 3 2
C(x) = 1x + 2x + 3x + 4x + 5x + 6x + 3
ej = xj Ω(X–1)
∆(X–1)
where j is the position of the error in the R(x) codeword.
The ∆(x) = 7x + 4 polynomial is modified such that the even powers of x are deleted and the
polynomial is divided by x leaving ∆(x) = 7.
The position of the errored symbol 7x3 is a3. Therefore, substituting the information for a into the
formula:
ej = a3 (a–3 + 1)
7
ej = a3 (a4 + 1)
7
ej = 3 (6 + 1)
7
ej = 3
The magnitude of the error is 3. Therefore, to correct the error: 7 (1112) XOR 3 (0112) = 4 (1002).
G(x) = 1x2 + 6x + 3
2
Multiply M(x) by x to accommodate 2 x FEC symbols:
2 6 5 4 3 2
M(x) (x ) = 2x + 2x + 2x + 2x + 2x + 0x + 0
Divide M(x) by the generator polynomial G(x) = 1x2 + 6x + 3 to create the systematic codeword C(x):
6 5 4 3 2
C(x) = 2x + 2x + 2x + 2x + 2x + 2x + 2
5 5
Introduce an error into symbol 2x such that it becomes 1x :
6 5 4 3 2 1
2x 1x 2x 2x 2x 2x 2 Parity
0
S0 a =1 2(a0)6 1(a0)5 2(a0)4 2(a0)3 2(a0)2 2(a0)1 2(a0)0
010 001 010 010 010 010 010 1 (0012)
Table A1-1: R(x) S0 Syndrome
S(x) = 5x2 + 2x + 1
Run the Euclidian algorithm to determine the error locator and magnitude polynomials ∆(x) and Ω(x):
∆(x) = 2x + 3
Ω(x) = 4x + 3
n n
∆(x) a Inverse a Sum Error = 0
–6 –6 1
∆x 2(a ) + 3 = 2(a ) + 3 = 4+3 = 7
–5 –5 2
∆x 2(a ) + 3 = 2(a ) + 3 = 3+3 = 0
–4 –4 3
∆x 2(a ) + 3 = 2(a ) + 3 = 6+3 = 5
–3 –3 4
∆x 2(a ) + 3 = 2(a ) + 3 = 7+3 = 4
–2 –2 5
∆x 2(a ) + 3 = 2(a ) + 3 = 5+3 = 6
–1 –1 6
∆x 2(a ) + 3 = 2(a ) + 3 = 1+3 = 2
–0 –0 0
∆x 2(a ) + 3 = 2(a ) + 3 = 1+3 = 4
Table: A1-5: Chien Search Algorithm
ej = a5 (4a–5 + 3)
2
ej = a5 (4a2 + 3)
2
ej = 7 (6 + 3)
2
ej = 7 5
2
ej = 7 x7
ej = 3
The magnitude of the error is 3. Therefore, to correct the error: 1 (0012) XOR 3 (0112) = 2 (0102).
G(x) = 1x2 + 6x + 3
2
Multiply M(x) by x to accommodate 2 x FEC symbols:
Divide M(x) by the generator polynomial G(x) = 1x2 + 6x + 3 to create the systematic codeword C(x):
6 5 4 3 2
C(x) = 5x + 3x + 6x + 7x + 2x + 5x + 7
4 4
Introduce an error into symbol 6x such that it becomes 5x :
6 5 4 3 2 1
5x 3x 5x 7x 2x 5x 7 Parity
0
S0 a =1 5(a0)6 3(a0)5 5(a0)4 7(a0)3 2(a0)2 5(a0)1 0 0
7(a )
101 011 101 111 010 101 111 4 (1002)
Table A2-1: R(x) S0 Syndrome
S(x) = 6x2 + 1x + 4
Run the Euclidian algorithm to determine the error locator and magnitude polynomials ∆(x) and Ω(x):
∆(x) = 3x + 5
Ω(x) = 2x + 2
–1 –1 6
∆x 3(a ) + 5 = 3(a ) + 5 = 4+5 = 1
–0 –0 0
∆x 3(a ) + 5 = 3(a ) + 5 = 3+5 = 6
Table: A2-5: Chien Search Algorithm
ej = a4 (2a–4 + 2)
3
ej = a4 (2a3 + 2)
3
ej = a4 (6 + 2)
3
ej = 6 4
3
ej = 6 x5
ej = 3
The magnitude of the error is 3. Therefore, to correct the error: 5 (1012) XOR 3 (0112) = 6 (1102).
ax + by = c gcd(a,b)
c is the GCD of the two variables x and y that have coefficients a and b i.e. c divides into both a and
b. Table A3-1 below illustrates an extension of the Euclidean algorithm that allows values of the
variables and their coefficients to be calculated. The approach is to work down steps 1 to 4 on the left
hand side for the values of a and b and to work upwards from steps 4 to 1 to calculate the values of x
and y on the right hand side. Note that q is the quotient and r the remainder. The starting values of a
and b are a = 657 and b = 306.
The GCD (or common factor) c is found to be 9. On the right-hand side, the value of y in step 1 is the
value of x in step 2; y in step 2 is x in step 3; y in step 3 is x in step 4. This facilitates calculation of y
when moving up the steps from 1 to 4. Substituting the values for x and y into the equation confirms
that the values are correct:
Step a x b y c
4 36 0 + 9 1 = 9
3 45 1 + 36 -1 = 9
2 306 -1 + 45 7 = 9
1 657 7 + 306 -15 = 9
Table A3-2: Extended Euclidean Algorithm Results