Module 4
Module 4
6.1 INTRODUCTION
BCH codes are a class of cyclic codes discovered in 1959 by Hocquenghem [1] and
independently in 1960 by Bose and Ray-Chaudhuri [2]. They include both binary and
multilevel codes and the codes discovered in 1960 by Reed and Solomon [3] were soon
recognized to be a special case of multilevel BCH codes [4]. In this chapter we shall
confine our attention to binary BCH codes, leaving Reed Solomon codes to Chapter 7.
From the discussions of Chapter 4, we could, given a generator polynomial, con-
struct an encoder for binary BCH codes. Moreover, using the discussions of finite field
arithmetic in Chapter 5, it requires only a straightforward extension of the principles of
Chapter 4 to construct an encoder for a Reed Solomon code, given the generator
polynomial. The purpose of this chapter is to show the structure of BCH codes and the
decoding methods. We will therefore be able to work out the generator polynomials
for any code of interest and to implement low complexity decoders.
We shall therefore be able to say equivalently that all codewords of a cyclic code have
zeros at specific locations in the frequency domain.
• Binary BCH codes will consist of binary sequences of length 2m — 1 with roots
including It consecutive powers of the primitive element of GF(2m). Alternatively,
the Fourier transform over GF(2m) will contain 2t consecutive zeros. Note that the
generator polynomial will have conjugate roots (or conjugate frequency domain
zeros) in addition to the specified 2t values.
• Reed Solomon codes are the special case where m = 1. They therefore consist of
sequences of length q — 1 whose roots include 2t consecutive powers of the primi-
tive element of GF(q). Alternatively, the Fourier transform over GF(q) will contain
2t consecutive zeros. Note that because both the roots and the symbols are
specified in GF(q), the generator polynomial will have only the specified roots;
there will be no conjugates. Similarly the Fourier transform of the generator
sequence will be zero in only the specified 2t consecutive positions.
The individual codewords, being multiples of the generator, may have roots in
addition to the ones specified, depending on the multiplying polynomial. However
the generator itself will have only the roots (or frequency domain zeros) implied by
the above, and only those roots (or frequency domain zeros) will be common to every
codeword.
Suppose we choose a1 and a2 as the consecutive roots for this code. We know that
there will be conjugate roots, the full set of conjugates being
a1 a2 a4 a8
BCH CODES 139
This set of conjugates contains the two roots we want, therefore no others are
required. The generator polynomial is
Alternatively we find that the generator polynomial is the LCM of the minimum
polynomials of a1 and a2. Both these elements have X4 + X + 1 as their minimum
polynomial, therefore this is the generator of the code. The code has 4 parity checks
(from the degree of the generator) and so is a (15, 11) code.
Note that the generator polynomial is primitive and that therefore the code created
is a Hamming code. We can therefore see that cyclic Hamming codes are just single-
error correcting binary BCH codes.
a1 a2 a4 a8
140 ERROR CONTROL CODING
However we still need another root, namely a3. Including the conjugates we create
roots
a3 a6 a12 a9
the result above. The degree of the generator is 8, so the code is (15, 7).
a5 a10
g(X) = (X8 + X7 + X6 + X4 + 1 ) ( X 2 + X + 1)
g(X) = X10 + X8 + X5 + X4 + X2 + X + 1
With a degree 10 generator, and therefore 10 parity checks, this is a (15, 5) code.
Vn-1ß
n-1
+ • • • + v2 ß2 + v1ß + v0 = o
or in vector form
BCH CODES 141
(6.1)
ßn-1Pi . r1"
ft ' ft-! =0 (6.2)
i ft
ft
ftl
1 i i
but
=0
which means that the large matrix in Equation (6.2), when transposed, will give the
parity check matrix of the code.
The roots are polynomials in a and so may be regarded as vectors which themselves
need to be transposed. Therefore
1t
H= (6.3)
2r2 :
ßj-1 2r ßj-1r 1
ßj ßj 1:
Only one of the roots ß, ß2, ß4, ß8, etc. needs to be included in the parity check
matrix as the inclusion of any one implies all the others.
Hamming codes
Hamming codes have generator polynomials which are primitive. Hence any primi-
tive element can be a root of the code. If we take the element a as the root then
H= (6.4)
The powers of a are just all the nonzero elements of the field which leads to the
conclusion that the columns of the parity check matrix contain all the possible
combinations of 1 and 0. For example taking the code based on GF(8), for which
a3 + a + 1 = 0, gives
142 ERROR CONTROL CODING
1 1 1 0 1 0 0
H 0 1 1 1 0 1 0
1 1 0 1 0 0 1
This is in fact the parity check matrix for the cyclic Hamming code in Chapter 4.
A double-error correcting binary BCH code might have roots of a, a2, a3 and a4. Of
these, only a and a3 are independent, the others being implied by a, and so the parity
check matrix is
H = (n-1)
or a (6.5)
a3 r a 3x2 a
— II a'12
H— 4 r
3x2
a
or
1 1 1 1 0 1 0 1 1 0 0 1 0 0 0
0 1 1 1 1 0 1 0 1 1 0 0 1 0 0
0 0 1 1 1 1 0 1 0 1 1 0 0 1 0
1 1 1 0 1 0 1 1 0 0 1 0 0 0 1
H=
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 0 1 0 0 1 0 1 0 0 1 0 1 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 0 0 0 1 1 0 0 0 1 1 0 0 0 1
Note that this does not correspond to the usual definition of the parity check
matrix for a systematic code. It will, however, be seen to be useful for decoding.
A triple-error correcting code would introduce an additional root a5. The parity
check matrix becomes
1T
H= 1T (6.6)
1T
Corresponding to this, the parity check matrix for the length 15 code is
1T
H
,10r 1T
1 1 1 1 0 1 0 1 1 0 0 1 0 0 0
0 1 1 1 1 0 1 0 1 1 0 0 1 0 0
0 0 1 1 1 1 0 1 0 1 1 0 0 1 0
1 1 1 0 1 0 1 1 0 0 1 0 0 0 1
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 0 1 0 0 1 0 1 0 0 1 0 1 1 0
H=
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 0 0 0 1 1 0 0 0 1 1 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 1 1 0 1 1 0 1 1 0 1 1 0
1 1 0 1 1 0 1 1 0 1 1 0 1 1 0
1 0 1 1 0 1 1 0 1 1 0 1 1 0 1
Note, however, that there is one all-zero row and one that duplicates the previous
one. Both can therefore be removed from the parity check matrix to give
1 1 1 1 0 1 0 1 1 0 0 1 0 0 0
0 1 1 1 1 0 1 0 1 1 0 0 1 0 0
0 0 1 1 1 1 0 1 0 1 1 0 0 1 0
1 1 1 0 1 0 1 1 0 0 1 0 0 0 1
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
H=
1 0 1 0 0 1 0 1 0 0 1 0 1 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 0 0 0 1 1 0 0 0 1 1 0 0 0 1
1 1 0 1 1 0 1 1 0 1 1 0 1 1 0
1 0 1 1 0 1 1 0 1 1 0 1 1 0 1
(6.7)
s3 = a3j-a3j + a3j
=0 (6.8)
Any value of ai which is a root of this equation will locate an error and, as the
assignment of the parameters i and j is arbitrary, both error locations can be found
144 ERROR CONTROL CODING
from the same equation. Roots can be found by trying all possible values, which is
better than having to try all possible combinations of positions, or by other tech-
niques. This method is known as a Chien search.
Example
For the double-error correcting BCH code of length 15, if the received sequence is
101010110010101, the syndrome is 10010110. Thus
s1=a14
s3 = a5
a 13+i +a 14+2i +a 12 +a 5 =
s1 = ai
s3 = a3i
This condition can be recognized from the fact that s3 = (s1 )3 and the position of
the error found directly from s1 .
We shall see in the next section that frequency domain decoding uses a polynomial
whose zero coefficients indicate the locations of errors in the time domain and whose
roots in the frequency domain can therefore be used to locate the errors. For the
moment we will use such a polynomial to prove a property of BCH codes, namely
that 2t consecutive zero-valued spectral components are sufficient to guarantee t-
error correction.
Suppose we have a code vector c(X) with fewer than d nonzero components, and
its spectrum C(z) has d - 1 consecutive zeros. We define a polynomial A(X) such that
it is zero where c(X} is nonzero and let the positions of the zeros be denoted ij. The
polynomial k(X) is usually called the error locator polynomial because, as we shall see,
there is no codeword apart from the all-zero sequence which satisfies the defined
conditions.
The zero components in 1(X) mean that each or'' will be a root of the transform
A(z) of MX), or
Note from the above definition of A(z) that AO is equal to 1 . The polynomial A(z) is
known as the connection polynomial.
Now in the time domain, A/c/ = 0 for all /, therefore in the frequency domain,
replacing multiplication with a convolution:
Ay (6.9)
This is the equation for the output of a linear feedback shift register with feedback
polynomial A(z), as shown in Figure 6.1.
If we know any d — 1 consecutive values of Cy we can use the shift registers with
feedback to generate all the rest. We know, however that there are d — I consecutive
zeros and using them to initialize the feedback shift register will generate a string of
zeros. Thus Cj must be zero for ally and all terms in c(X) are zero. This proves that if
there are 2t consecutive zeros in the spectrum, the nonzero codewords must have
weight at least 2t + 1 and the code can therefore correct at least t errors.
Although we are left with the possibility that the code may be able to correct more
than t errors, the BCH decoding method will use the 2t consecutive zeros in a way
that will correct up to t errors, and any extra capabilities of the code will go into error
detection.
where R(z), C(z) and E(z) are the transforms of the received sequence, the codeword
and the error sequence respectively. We know that C(z) is zero in 2t consecutive spectral
locations, so we can use these locations to give us a window on E(z), i.e. 2t components
of E(z) can easily be obtained and can be considered to form a syndrome S(z).
We assume that there are v < t errors and define an error locator polynomial A(X)
such that it is zero in the positions where e(X) is nonzero. The product of the received
sequence and the error locator sequence in the time domain will therefore be zero,
which means that in the frequency domain the convolution will be zero
AyEk-i = 0 (6.10)
Here we have used the fact that A.(X) has at most t zeros; hence, A(z) has at most /
roots and is therefore a polynomial of degree no greater than t. If we know the error
spectrum from positions m to m + 2t - 1, we can form t equations by letting k take
values from m + Mo m + 2t — 1. Assuming the spectral zeros of the code are from
positions 1 to 2t, the equations are as follows:
(6.11)
A0E2t-1 + A1E2t,_2 +- A,Et-1 = 0
Ai£ 2 ,_i H h A,£, = 0
This set of t equations in / + 1 unknowns is called the key equation, which we can
solve for the different values of A, provided we impose an arbitrary value on one of
the roots, corresponding to the fact that the value of the error locator polynomial is
arbitrary in the nonzero positions in the time domain. In practice the condition we
impose is A0= 1. The procedure for solving the key equation may be straightforward
BCH CODES 147
if t is small, but in the general case special methods have to be devised which are
computationally efficient and which take into account the fact that the number of
errors may be less than t. One such method, Euclid's algorithm, will be explained in a
later section. For the moment it is sufficient to believe that the task can be accom-
plished.
a5 + a 13 A 1 + a 14 A 2 = 0
a 11 +a 5 A 1 + a 13 A 2 =0
To solve, we can multiply each term in the second equation by a and add to the
first equation to eliminate A2n. This gives
A1=a14
Hence
A2 = 1
Decoding can now be carried out by finding the roots of z2 + al4z + 1, which are a2
and a13. Hence the errors are at positions -2 and -13, or 13 and 2, respectively.
Suppose now that only one error occurred, say the error in position 13. The
syndromes are found to be S1 = a 13 , S3 = a9, giving a full syndrome polynomial of
a 1 1 A 1 +a ! 3 A 2
an1 1 = 0
148 ERROR CONTROL CODING
It can be seen that these two equations are not linearly independent, the first being
merely a2 times the second. Only one unknown can therefore be found and the
connection polynomial must be of degree 1, i.e. A2 = 0. Inserting this condition
gives A1 = or2 = a13. The connection polynomial is therefore a 13 z+ 1, which has
root or-13, indicating an error at position 13. Any solution method therefore needs to
take account of the possibility that there may be fewer errors than the maximum
corrected by the code. Of course, in this case the occurrence of a single error can be
recognized through the condition 53 = (s 1 ) 3 from Section 6.6 and its location deter-
mined from the value of s1 .
Another possibility is that too many errors may occur and in that case the decoder
may give the wrong result or may detect the errors but be unable to correct them. We
need to know, however, how the decoding failure will arise.
Suppose we insert a third error at position 10 into our received sequence. The
syndromes are found to be s 1 =a 1 1 ,53 = a10. The full syndrome polynomial is
a 10 + a 7 A 1 + a l l A 2 = 0
a14 + a10A1 +- a 7 A 2 = 0
Eliminating A2 gives
a 1 2 +a 1 A 1 = 0
The connection polynomial is therefore a1z2 + a11z + 1. We now try to find the
roots as shown in Table 6.2. It is seen that no roots are found. The general condition
for detected uncorrectable errors is that the number of roots found is less than the
degree of the connection polynomial.
]T A/ E k-j = 0 t<k<2t-1
7 =0
The terms in the left-hand side of degree t to 2t — 1 are zero. The terms of degree 2t
or more are represented by f(z)z2t. Here, fi(z) represents the terms of degree less than
t. It is known as the error evaluator polynomial because it is used for such a purpose
in the decoding of multilevel BCH codes such as Reed Solomon codes.
There are two commonly used methods for solving the key equation in this form.
They are Euclid's algorithm and the Berlekamp-Massey algorithm. The latter is
more efficient, but is more difficult to understand than Euclid's method and is related
to it. We shall study the Euclid algorithm in detail and merely outline the steps
involved in the other.
where r(z) is known to have degree less than some fixed value. In our case, r(z) will
have degree < t, a(z) = z2t and b(z) is the syndrome polynomial S(z). The polynomial
g(z) will give us A(z), which is what we need to know. The method involves repeated
division of polynomials until a remainder of degree < Ms found.
The first step is to divide a(z) by b(z) to find the quotient q 1 (z) and remainder r\(z):
If the degree of r 1 (z) is less than t then we have reached our solution with f(z) = 1,
g(z) = q1(z) and r(z) = r 1 (z). Otherwise set g1(z) = q1(z) and proceed to the next stage.
The second step is to divide b(z) by r 1 (z) giving
Note that the degree of r2(z) must be less than that of r 1 (z) so that this process is
reducing the degree of the remainder. If we eliminate r\(z) from Equations (6.13) and
(6.14) we obtain
Set g2(z) = q 2 (z)g 1 (z) + 1. If the degree of r2(z) is less than t then g(z) = g2(z);
otherwise, continue to the next step.
The third step continues in similar vein, dividing r1 (z) by r2(z):
Again the degree of the remainder is decreasing. Using Equations (6.14) and (6.15)
to eliminate r 1 (z) and r2(z) gives
If the degree of r3(z) is less than t then g3(z) = g3(z) = q 3 (z)g 2 (z) + g 1 (z).
The method continues in this way until a remainder of degree less than t is found,
at each stage setting
Set n = 1. Divide z2t by S(z) to find quotient q 1 (z) and remainder r 1 (z). Calculate
g1(z) from Equation (6.18).
While degree of remainder is greater than or equal to t, continue by incrementing
n, divide previous divisor by previous remainder and calculate gn(z) by Equation
(6.18).
When desired degree of remainder is obtained, set A(z) = gw(z).
BCH CODES 151
Example
We shall now solve the key equation for the double-error example from Section 6.9, using
the Euclid algorithm. We treat the syndrome with 4 terms as a degree-3 polynomial
begin
l:=0: 0
n :— 0; 0
k:=!; -1
A(z) := 1; 1
D(z):=zA(z); z
while (n < 2t) do 0<4 1 <4 2<4 3<4
begin
<5 := Z! A,Sn_i; a14 0 a14 0
i=0 14 14
if (5 =0) then a =0 0=0 a =0 0=0
begin
A* (z) = A(z) + 5 x D(z); a14z+l z2 + a 1 4 z+l
if (l<n - k) 0< 1 1 <2
begin
l :=n-k- 1 2
k:=n~l; 0 1
D(z) := A(z)/5; a1 z+a
/:=/* 1 2
end;
A(z):=A*(z) al4z+l z2 + a14z + 1
end;
Z)(z):=zZ)(z); a1z a'z2 z2 + az z 3 +az 2
«:=/7+l 1 2 3 4
end;
end.
we could multiply it by any constant. Thus we could eliminate the division in the line
D(z) := A(z)/<5 provided that on the line A* (z) = A(z) + 6 x D(z) we first multiply
the value of A(z) by the previously applied version of 6. We therefore introduce a
variable <5* and amend the algorithm to that shown in Table 6.4.
The working shown in Table 6.4 is again the stages in calculating the connection
polynomial for the double-error example of Section 6.9. The connection polynomial
is «14z2 + a13z + a14 which is just a14 times the previous result and therefore has the
same roots.
6.13 CONCLUSION
As indicated at the beginning of this chapter, BCH codes have a long history and are
therefore well represented in standard text books [5-9]. The inversionless Berlekamp-
Massey algorithm given here is similar to that published in [10] and another imple-
mentation is embodied in [11]. The performance and applicability of binary BCH
codes are discussed in Chapter 8.
BCH CODES 153
begin
/ := 0; 0
n :=0; 0
k : = -1; —1
A(z) : = 1; 1
D(z) := zA(z); z
(5* :=1; 1
while (n < It) do 0<4 1 <4 2<4 3<4
begin
f> :=[Link] n - i a14 0 a14 0
/=0 4
14
if (=^0) then a ^ 0 0=0 a' ^0 0=0
begin
A*(z) = 5* xA(z) + <5 x D(z); a14z+l a14:z2 + a13 + a14
if ( l < n - k ) 0< 1 1 <2
begin
l* : = n - k ; 1 2
k:=n-l; 0 1
(X...14 14
6.14 EXERCISES
1 Given that
X+ l)(X4 + X3 + l)(X4 + X3 + X2 + X
find the generator polynomial of a triple-error correcting BCH code of length 15,
assuming that GF(16) is created using the primitive polynomial X4 + X 3 + 1.
2 For the double-error correcting BCH code defined in Section 6.5, decode the
sequence 100010110010001.
4 Find the generator polynomial of a triple-error correcting BCH code of length 15,
assuming that GF(16) is created using the primitive polynomial X4 + X3 + 1.
5 For the BCH code of length 15 with roots , a, a2, a3, and a4 in GF(16) (created
using the primitive polynomial X4 + X3 + 1), find the generator polynomial and
decode the following sequences
100010110010001
101110100101001
100110000011111
6.15 REFERENCES
1 A. Hocquenghem, Codes correcteurs d'erreurs, ChifFres, Vol. 2, pp. 147-156, 1959.
2 R.C. Bose and D.K. Ray-Chaudhuri, On a class of error-correcting binary group codes,
Information and Control, Vol. 3, pp. 68-79, 1960.
3 I.S. Reed and G. Solomon, Polynomial codes over certain finite fields, J. Soc. Indust.
Applied Math. Vol. 8, pp. 300–304, 1960.
4 D.C. Gorenstein and N. Zierler, A class of error-correcting codes in pm symbols, J. Soc.
Indust. Applied Math. Vol. 9, pp. 207-214, 1961.
5 R.E. Blahut, Theory and Practice of Error Control Codes, Addison Wesley, 1983.
6 G.C. Clark and J.B. Cain, Error-Correction Coding for Digital Communications, Plenum
Press, 1981.
7 A.M. Michelson and A.H. Levesque, Error-Control Techniques for Digital Communica-
tion, John Wiley & Sons, 1985.
8 S.B. Wicker, Error Control Systems for Digital Communication and Storage, Prentice Hall,
1994.
9 M. Bossert, Channel Coding for Telecommunications, John Wiley and Sons, 1999.
10 Y. Xu, Implementation of Berlekamp-Massey Algorithm without inversion, IEE Proceed-
ings-I, Vol. 138, No. 3, pp. 138-140, June 1991.
11 H-C. Chang and C-S.B. Shung, Method and apparatus for solving key equation polynomials
in decoding error correction codes, US Patent US6119262, September 2000.
7
Reed Solomon codes
7.1 INTRODUCTION
It was pointed out in Chapter 6 that Reed Solomon codes are a special example
of multilevel BCH codes. Because the symbols are nonbinary, an understanding of
finite field arithmetic is essential even for encoding. Moreover the decoding methods
will be similar to those encountered for binary BCH codes, so some familiarity with
Chapter 6 will also be advisable for the understanding of this chapter.
There are two distinctly different approaches to the encoding of Reed Solomon
codes. One works in the time domain through calculation of parity check symbols.
The other works in the frequency domain through an inverse Fourier transform. We
shall meet the time domain technique first as it is more likely to be encountered in
practice. It was pointed out in Chapter 6 that the standard decoding method is
essentially a frequency domain technique, but we will see that a modification is needed
for RS codes which can be achieved in two different ways. There is also a purely time
domain decoding method for RS codes - the Welch-Berlekamp algorithm - which will
be presented towards the end of the chapter.
To construct the generator for a Reed Solomon code, we need only to construct the
appropriate finite field and choose the roots. Suppose we decide that the roots will be
from ai to a i + 2/-1 , the generator polynomial will be
In contrast to the case with binary BCH codes, the choice of value of i will not
affect the dimension or the minimum distance of the code because there are no
conjugates to consider.
Example
Suppose we wish to construct a double-error correcting, length 7 RS code; we first construct
GF(8) using the primitive polynomial X3 + X + 1 as shown in Table 7.1. We decide to choose
i = 0, placing the roots from a° to a3. The generator polynomial is
Element Polynomial
0 000
a° 001
a1 010
a2 100
a3 011
a4 110
a5 111
a6 101
Example
For the Reed Solomon code above, encode the data sequence 111001111. Assuming the
polynomial mapping in Table 7.1, the data maps to symbols a5 a° a5. Four zeros are
appended, corresponding to the four parity checks to be generated, and the divisor is the
generator sequence.
a5 0 a2
a5 a5 «6)«5 «° a* 0 0 0 0
«5 a° a3 a3 a4
a2 a3 «4 00
a2
a a° a° a1
4
As shown, the multipliers used were a5 0 and a2. The remainder is a6 a5 a° a1 so that
the codeword is a5 a° a5 a6 a5 a° a1. Expressed as a binary sequence this is
111001111101111001010.
The encoder circuit for a Reed Solomon code is shown in Figure 7.1. This is almost
identical to Figure 4.3 except that the value of go is not necessarily 1 and there are
multipliers in every feedback connection rather than just connection or no connec-
tion as there was for the binary case. In fact all the feedback terms will be nonzero for
a Reed Solomon code.
The encoder for the above example is shown in Figure 7.2 and the stages in the
encoding in Table 7.2. The example terminates with the registers containing the
values a6 a5 a° a1, the parity checks for this codeword.
0 0 0 0
a5 a5 a° a3 a3 a4
a° 0 a3 a3 a4 0
a5 a2 a6 a5 a° a1
where A(z) is the connection polynomial, E(z) can be taken as the frequency domain
syndrome terms expressed as a polynomial and O(z) is a polynomial of degree / — 1
known as the error evaluator polynomial. We calculate the error evaluator polyno-
mial and also A'(z), the formal derivative of the connection polynomial. This is found
to be
In other words, get rid of the zero coefficient of A and then set all the odd terms in
the resulting series to zero.
The error value in position m is now
A'(z) (7.2)
evaluated at z = a~m. The parameter i is the starting location of the roots of the
generator polynomial.
REED SOLOMON CODES 159
S0 = a5 + a4 + a5 + a3 + a5 + a° + a1 = a0
S1 = a 5 - a 6 + a 4 - a 5 + a 5 - a 4 + a 3 -a 3 + a? • a2 + a0 • a.1 +a! = a1
S2 = a5- a5 + a4- a3 + a5- a1 + a3- a6 + a5- a4 + a°- a2 + a1 = a°
S3 = a 5 -a 4 + a 4 - a 1 +a 5 - a5 + a3- a2 + a5- a6 + a°- a3 +a1 = 0
a 6 A 1, = a1
A1 = a2 A
2 indicates successful error correction with errors located at positions -4 and -2, i.e.
positions 3 and 5. We now calculate the error evaluator polynomial, taking the
powers from 0 to t — 1 of S(z)A(z).
For the assumed g(X) in which i = 0, we want zA'(z) as the denominator which is
just A(z) with all the even coefficients set to zero. Therefore
em —
zA'(z) ,=g_-m a2;
a 4 a - 3 + a° a3 ..4
2
°
160 ERROR CONTROL CODING
c0 = a2 + a5 + a° = a1
c1 = a2 + a5 a2 + a0 = a°
c2 = a2 + a5 a4 + a0a6 = a5
c3 = a2 + aV + aV = a6
codeword
codeword
syndrome
Error correction
Figure 7.3 Frequency domain encoding and decoding of Reed Solomon codes
REED SOLOMON CODES 161
c4 = oc2a4 + aV + a°a5 = a5
c5 = « 2 a 5 + a 5 a 3 + aV = a°
c6 - a 2 a 6 + aV + a°a4 = a5
Hence the code sequence is a5 a° a5 a6 a5 a° a1. This is in fact the same codeword
that we created from different information in Section 7.3. The previous encoding
method was systematic whereas this method is not. There is no straightforward way
to recover the information from the codeword.
We now create a two-symbol error, say a5 in position 5 and a4 in position 3, as in
our previous example. The received sequence is a5 a4 a5 a3 a5 a° a1.
The decoding proceeds by finding the Fourier transform of the received sequence:
RO = a5 + a4 + a5 + a3 + a5 + a° + a1 = a°
R1 = aV + aV + a5a4 + aV + aV + aV + a'a° = a1
R2 = aV + aV + aV + oc3a6 + aV + aV + a'a° = a°
R3 - a5 a4 + aV + aV + aV + aV + a°a3 + a'a 0 = 0
R4 = a5a3 + aV + «5a2 + a3a5 + aV + a°a4 + a'a 0 = a3
R5 = a5a2 + a4 a4 + a5a6 + aV + asa3 + a°a5 + a'a° = a2
R6 = a 5 «' + a4 a2 + a5a3 + a3a4 + aV + a°a6 + a'a 0 = a5
a 1 A 2 + a 0 A 1 +0 = 0
a6A = a1
A] = a2 A2 = a
Instead of carrying out a Chien search, however, we use the connection polynomial
to synthesize shift registers with feedback, as in Figure 6.1, to generate the entire
frequency domain error sequence. If we initialize the registers with E2 and E3 (which
are just the syndrome components in those positions), subsequent shifts will generate
E4, E5 and E6. This process is known as recursive extension of the frequency domain
error sequence. The general arrangement is shown in Figure 7.4 where it is considered
that we may have used a method such as the inversionless Berlekamp-Massey algo-
rithm or the Euclidean algorithm to obtain a connection polynomial where A0= 1 .
In our case we have obtained a solution with A0 = 1 ; therefore, the circuit becomes
as shown in Figure 7.5.
We load the value a° into the leftmost stage of the shift register, and zero into the
other stage. Cycling the shift register will generate values a1, a3, a3, which are the
162 ERROR CONTROL CODING
frequency domain errors in positions 4, 5 and 6, respectively. The next two values
generated are a°, a1, corresponding to syndrome components Sb and S\. Thus the
cycle will repeat; it can be shown that a failure to repeat is the condition for detection
of uncorrectable errors.
The complete error sequence in the frequency domain is a3 a3 a1 0 a° a1 a°.
Adding this to a5 a2 a3 0 a0 a1 a°, the Fourier transform of the received signal,
gives a decoded sequence of a2 a5 a° 0 0 0 0. Thus we have shown that double-
error-correction has been achieved.
a2 + + a3A2 = 0
a3 + + a3A2 = 0
Eliminating A2 gives
a5 + a 5 A 1 = 0
A1 - a°
A? = or
The registers for recursive extension are shown in Figure 7.6. After initializing with
values a3 a2, the error sequence generated is a2 a6 a5 followed by a5. The sequence is
therefore incorrect because the syndrome S0 has not been generated at this point. The
general condition for detection of uncorrectable errors is that the sequence generated
by recursive extension is not cyclic with the correct length. This can be shown to be
identical to the condition that the Chien search does not return the correct number of
roots.
Looking next at the case where we have fewer than the maximum number of
correctable errors, it is obvious that if there are no errors then the transform of the
codeword will exhibit zeros in the expected places and no decoding is required. If
there are some errors, but less than t, the transform of the error locator polynomial
will have fewer than t unknown roots and the t simultaneous equations will not be
linearly independent. This will be illustrated by returning to the example of the
previous section but this time introducing only one error.
Let us assume that we receive a sequence a5 a4 a5 a6 a5 a° a1. This is the same as
the previous example except that position 3 does not contain an error, the sole error
being in position 5. The transform is
a 1 +a 3 A 1 +a 5 A 2 =0
a6 + a'A 1 +a 3 A 2 = 0
This is similar to what happened in the single-error example of Section 6.9. The
second equation is the same as the first, multiplied by a2, which tells us that there is
only one error and we must set A2 equal to zero. The solution to the key equation is
thus
A 1 =a 5
and loading the value a6 into the shift register of Figure 7.7 gives the sequence
a4 a2 a° as the corrections to the frequency domain data positions 4, 5 and 6, then
the next value is a5 which reproduces the value of s0, showing that the error correc-
tion is successful. We therefore correct the received Fourier transform values in
positions 6, 5 and 4, a6 a3 a5 to a2 a5 a°, the information encoded in Section 7.7.
The fact that in the above example each term in the syndrome is a constant factor
times the previous term is characteristic of single symbol errors, and the position of
the error in the time domain can be readily determined from the factor. In this case
because Sj = a5Sj-i, the error is in position 5 and the value of so is the error value in
that location. It is often worth including a check for single errors in a decoder and a
special decoding routine, because in many practical examples single errors will make
up a significant proportion of the sequence errors. Moreover all decoders will have to
cope with the case where there are fewer than / errors.
2t + e < dn (7.3)
REED SOLOMON CODES 165
At this point, one might well ask whether there is any point in declaring erasures
on a binary symmetric channel. A f-error correcting code will be able to fill up to 21
erasures, but if a guess was made for the values of all the erased symbols then on
average half would be correct and the error correction would cope with the rest. It
will be seen shortly that erasures do give some advantage, in that erasure filling is
equivalent to carrying out error correction on two possible sets of reconstituted bit
values, and then choosing the better of the two. On the other hand, the demodulator
need only have a slight inclination towards one or other value to make choosing the
more likely bit value a better strategy than erasure.
For any binary code there is a straightforward, nonalgebraic erasure filling
method. Replace all the erased bits by zero and decode. If no more than half of the
erasures should have been ones and Equation (7.3) was satisfied, then the number of
errors will still be less than half of dmin and the decoding will be correct. If on the
other hand more than half the erasures should have been ones then we may get a
decoding that will introduce extra errors into the sequence.
In this case, replacing all the erased bits by 1 will be successful. The procedure is
therefore to decode twice, replacing all the erased bits firstly with zeros and then with
ones. If the decoded sequences differ, choose the one that is closer to the received
sequence.
In contrast, if several bits of a Reed Solomon symbol are erased, it is unlikely that they
can be guessed correctly and erasure filling is a good strategy. They may be decoded
in the presence of erasures by an algebraic technique to be explained below. The
minimum distance of these codes is n — k + 1, which means that in the absence of errors,
Equation (7.3) shows that n-k erasures can be filled. We thus have the interesting
result that a Reed Solomon codeword can be recovered from any k correct symbols.
To decode algebraically, we replace the erased symbols by some arbitrary value,
usually zero. We adopt the polynomial approach in the frequency domain and
multiply the product of the syndrome polynomial S(z) and the connection polyno-
mial A(z) by an erasure polynomial F(z) which is known because the positions of the
erasures are known. For every two erasures, the degree of the error locator polyno-
mial is reduced by one so that the degree of the product of erasure and error locator
polynomials is increased by one. The number of simultaneous equations that can be
formed will thus be reduced by one, thus matching the reduction in the number of
unknowns. This all sounds rather horrific, but is fairly straightforward if considered
in the context of an example.
The low order terms of R(z) form a syndrome of the received sequence.
The erasure polynomial is
F(z) = ( a 6 z + l ) ( a ' z + l ) = z 2 + a 5 z + l
A(z) = A 1 z + l
As this polynomial is of degree 3, we can only carry out a single place convolution
with a known section of the error spectrum to produce a key equation. We are
therefore only interested in the terms of degree 3 when we multiply by the syndrome
a°A1 + a5 + a3A1 + a4 + a 6 A, + a1 = 0
a5A1 = a3; A1 = a5
We can now substitute this value back into the expression for F(z)A(z), which will
be the polynomial used to generate the errors in the frequency domain by recursive
extension:
This gives rise to the circuit shown in Figure 7.8 to be used for recursive extension.
Loading with values a5 a6 a1 and shifting gives the sequence a1 a1 a° and then,
regenerating the syndrome, oc° a5, a6. The error correction is therefore successful
and the values a° a1 a1 are added to the components a6 a6 a3 from the Fourier
transform of the received sequence to give recovered information a2 a5 a°.
Figure 7.8 Recursive extension with one error and two erasures
REED SOLOMON CODES 167
If instead we choose to use the Forney algorithm to correct errors in the time
domain, the error evaluator polynomial is found to be
Note that the degree of this polynomial is now 2 because there are effectively three
errors to correct. To calculate error values, we also need the formal derivative of
F(z)A(z), i.e. of oc5z3 4- oc'z2 + a°. The value of this derivative is z5z2. Therefore at
position i, the error value is
The polynomial F(z)A(z) has known roots a- 6 and a ] (because erasures were
detected there) and a further root a-5 that can be located by Chien search. Calculat-
ing the error values at positions 1, 5 and 6 gives e\ = oe°, e5 = a5, e6 — a5. The
received sequence is therefore corrected to a5 a° a5 a6 a5 a° a1, corresponding to
the original codeword.
Euclid's algorithm may be used to solve for the feedback polynomial in the
presence of erasures by initializing g1(z) as F(z) and terminating when the degree of
the remainder is less than t + e/2 (e is the degree of the erasure locator polynomial,
assumed to be even). To operate the Berlekamp-Massey algorithm, set l and n to e
and initialize A(z) to F(z).
2 Erase the two least reliable symbols and decode for t — 1 errors and 2 erasures.
4 From the symbols input to the previous decoding, erase the two least reliable (i.e.
increase the number of erasures by 2), decode and return to step 3.
5 From the decoded sequences produced, choose the closest to the received sequence.
168 ERROR CONTROL CODING
h5 = a 6 /a 1 = «5
h4 = a 6 / ° = a6
and the length L[Q(x), N(x)], defined as the maximum of deg[Q(x)] and
deg[N(x)] + 1, has the minimum possible value.
The steps in the algorithm are now:
The steps in evaluation for this example are shown in Table 7.3.
The error locator polynomial is x2 + %2x + a1 which has roots a3 and a5. Finding
two roots for a degree 2 polynomial indicates that errors are correctable.
The error values in the data positions are
N(a k )
ek = hk (7.4)
170 ERROR CONTROL CODING
Table 7.3
where Q''(x:) is the formal derivative of Q(x) (see Section 7.4). In this case Q'(x) = a2.
Therefore the error value at location 5 is e5 — a5(a5 + a3)/a2 = a5. The received
information is therefore corrected to a5 a° a5.
The application of the Welch-Berlekamp algorithm to GMD is that, for a Reed
Solomon code, any n - k symbols can be treated as parity checks. The least reliable
n — k symbols are therefore treated as parity checks with the syndromes derived by
recomputing the codeword from the most reliable symbols. As we enter the syn-
dromes into the algorithm, each time a new pair of values of Q and N is produced we
carry out the correction and produce a new codeword for consideration.
i to /, | i0 | 2t-1zeros
Inverse Fourier transform
Figure 7.10 Frequency domain view of singly extended Reed Solomon code
more errors detected and correction can proceed. If there are t errors in the length
q — 1 sequence then they will be detected by s2t-2; however, in this case we can
assume that the received value of S2t-t is correct (otherwise there would be more
than t errors in the whole codeword). We therefore add the received value of S2t-1 to
the calculated value to produce a usable value for t-error correction.
The choice of edge frequency from the two available is unimportant for the
properties of the code. However, assuming that the Berlekamp-Massey algorithm
is used for decoding, the choice of st-2 will be convenient as the connection polyno-
mial can, if necessary, be calculated as an extension of the results up to S2l-2. The
location of the edge symbol in the final codeword is entirely arbitrary.
with the value in position 3 being a6. The single-error correcting connection polyno-
mial is O1Z + 1, but this does not correctly predict the next component. We therefore
assume that the edge frequency a6 was correct and add it to the calculated 53 value to
give a syndrome for a double-error correcting code
a°A1 + a 1 A 2 = 0
q + ! symbol codeword
q+1 symbols
high-order
edge symbol 1 low-order
edge symbol
It symbols syndrome
Figure 7.12 Syndrome formation for doubly extended Reed Solomon code
174 ERROR CONTROL CODING
We consider the case of a (9, 5) Reed Solomon code over GF(8). In this case we have
a 5 symbol information sequence 1 a3 a a6 a2. We treat the first and last of these as
edge symbols, placing them in positions 3 and 0, respectively, in the frequency
domain. Thus we start from the spectrum of a single-error correcting Reed Solomon
code
The two extra information symbols are now added to the ends of the codeword to
produce the (9, 5) RS codeword
Now assume that errors occur at positions 8 and 5 producing a received sequence
which transforms to
The terms of order 3 downwards are extracted as the syndrome, with the add-
itional symbols added at the appropriate points, giving
R(z) = z3 + aV + a6z + a2
Decoding has been correctly achieved and all the information is directly available
from C(z).
7.14 CONCLUSION
Reed Solomon codes are arguably the most elegant and most useful product of
algebraic coding theory. The origin and the discovery of their relation to BCH
codes were mentioned in Chapter 6. The implementations of algorithms mentioned
in that chapter, and of finite field arithmetic from Chapter 5 are also highly relevant.
The Welch-Berlekamp algorithm was originally embodied in a US patent [2]. The
anticipated expiry of that patent gave rise to considerable interest and the publication
of several papers describing it and its uses, of which [3] describes its application to
GMD decoding. A similar method described in [4] includes a method to keep track of
the results of the Chien search to assist the multiple decoding attempts. Some
applications of Reed Solomon codes will be discussed in Chapters 9 and 10.
7.15 EXERCISES
2 Using the (7, 3) RS code example of question 1, carry out the decoding if the
errors are
e(X} = a5^4 + a2+X2
using Euclid's algorithm for solution of the key equation.
3 Using the RS code of the above question, show the decoding with a single error
affecting all bits in position 4.
4 In the example (7, 3) Reed Solomon code of Section 4.16, erase the transmitted
symbols at positions 6, 5, 3 and 0. Carry out the decoding.