Berlekamp–Massey Algorithm
5.9 Encoding for RS codes C RS (28, 24), C RS (32, 28) and C RS (255, 251) In its original design an RS code is designed for operation over the Galois field GF(2 m ), and
its code length is n=2m−1. One interesting application of these codes is the design of RS
codes over the extended Galois field GF(28)=GF(256), because any element of a code vector
in these codes is itself a vector of 8 bits, or a byte. An RS code designed over this field, able to correct any error pattern of size t=2 or less, is the RS code CRS(255, 251). A table of
the codewords in this code would be enormous. However, the first page of the table (or set of codewords at the top of the table) would contain codewords with ‘0’s only in the most significant message positions. Therefore a shortened RS code can be formed by taking this page of codewords and deleting the positions that are ‘0’s in all the codewords on this page. More specifically, a shortened RS code can be constructed by setting sRS message symbols
to zero, where 1≤sRS<k. Then the length of the code is n−sRSsymbols, the number of
message symbols is k−sRSand the number of parity symbols is n−k as before, where all
the symbols remain in GF(2m). The generator polynomial and the error-correcting capability of the shortened code is the same as that of the unshortened code, but the code is no longer cyclic since not all cyclic shifts of codewords in the shortened code are also in the shortened code. For this reason the shortened code is said to be quasi-cyclic.
In this way, an RS code can be designed without the restriction of having a fixed code length n=2m−1, so that the code length can be significantly reduced, without losing any
good property of the main code. Thus, shortened RS codes CRS(28, 24) and CRS(32, 28)
are obtained from the original RS code CRS(255, 251) by setting sRS=227 and sRS=223,
respectively, and both the shortened codes have the same error-correction capability as that of the main code CRS(255, 251), which is t=2. The main code and the shortened versions of
this code all have a minimum distance dmin=5. These two codes are the constituent codes of
For the main code,
q =2m =28 n =2m−1=255
n−k=2t =255−251=4 dmin=2t+1=5
The shortened versions of the main code CRS(255,251), the codes CRS(28,24) and
CRS(32,28), all have the same parameters, except that the shortened codes have n=28 and
k=24 for the former, and n=32 and k=28 for the latter.
The coding procedure for the CD utilizes an interleaver between these two shortened RS codes, which essentially creates a delayed distribution of the bytes in a given code vector. In this way, the uncoded message of 24 bytes is first encoded by the shortened RS code CRS(28,24)
that generates a code vector of 28 bytes, and then the interleaver forms a vector of 28 bytes containing bytes from previous code vectors generated by the first encoder. In this interleaving process, each element of the vector of 28 bytes generated by the first encoder is placed in different vectors of 28 bytes position by position. The resulting vector of 28 bytes is input to the encoder of the shortened RS code CRS(32,28) that adds 4 bytes to the vector and generates
at the end a code vector of 32 bytes.
An example of the operation of these shortened RS codes is introduced here. The encoder operates in systematic form. A message vector, expressed in polynomial form m(X ), is multi- plied by X2t =X4, as usually done in the systematic encoding of an RS code, generating the
polynomial X4m(X ), which is then divided by the generator polynomial g(X ) of the code. As
said above, this generator polynomial is the same as that of the main code, and is also the same for both shortened versions of RS codes CRS(28, 24) and CRS(32, 28). Therefore, if t =2, then
g(X )=(X+α)(X+α2)(X+α3)(X+α4)
g(X )=(X2+α26X+α3)(X2+α28X+α7)
g(X )=X4+(α26+α28)X3+(α7+α54)X2+(α31+α33)X+α10
g(X )=X4+α76X3+α251X2+α81X+α10 (53) All operations performed in the calculation of this generator polynomial are done in GF(28). This is the generator polynomial of RS codes CRS(255, 251), CRS(28, 24) and CRS(32, 28). As
explained above, systematic encoding of a given message polynomial m(X ) consists in taking the remainder polynomial of the division of X4m(X ) by g(X ). This remainder polynomial is
of degree 2t−1 or less, and represents the 4 bytes added by this encoding.
As a result of both shortened RS codes having the same generator polynomial, in this concatenated scheme, the code vector generated by the outer code, the shortened RS code CRS(28, 24), has to be altered, in order to conveniently enable operation of the second encoder.
This is so because, as said above, the generator polynomial for both shortened RS codes in this concatenation is the same. Indeed, after the encoding of a vector of 24 bytes into a code vector of 28 bytes, the resulting code vector belongs to the code, and so it is a multiple of g(X ). Even after shifting by 4 bytes the positions of this code polynomial before the second encoding, it is very likely that the shifted code vector of the inner code is still a code vector of the shortened
More significant 12 bytes Less significant 12 bytes
4 parity bytes
Figure 5.4 Code vector generated by the shortened RS code CRS(28, 24)
RS code CRS(32, 28). If this is so, then in the systematic encoding procedure for the second
(inner) encoder, it is very likely that the remainder, that is, the redundancy, will be a zero polynomial, because the vector to be encoded already belongs to this code. For this reason, the parity bytes generated by the outer code, the shortened RS code CRS(28, 24), are placed in the
middle of the code vector before the inner encoding process, as shown in Figure 5.4 [9, 15].
Example 5.9: An arbitrary message vector m of 24 bytes will be encoded by the shortened RS code CRS(28,24) [15]:
m=α100 α90 α80 α70 α0 0 0 α70 α60 α50 α200 α100 α2 α1 α0 0
α4 α3 α2 α1 α40 α30 α20 α10
The convention used here is that the most significant element of the Galois field GF(28)=
GF(256) is on the left, and the least significant element is on the right. The message vector is composed of elements of the field; for example, elementα2 has a binary representation
of the form (00100000). The resulting encoded vector generated by the shortened RS code CRS(28,24), expressed in a way that the 4 bytes of the redundancy are in the middle of the
code vector, is
c1=
α100 α90 α80 α70 α0 0 0 α70 α60 α50 α200 α100 α89 α139 α249 α228 α2 α1 α0 0 α4 α3 α2 α1 α40 α30 α20 α10
Part of the polynomial division involved in the calculation of this code vector is as follows: X4+α76X3+α251X2+α81X+α10 α100X27+α90X26+α80X25+α70X24+α0X23 +0.X22+0.X21+α70X20 . . . α100X27+α176X26+α96X25+α181X24+α110X23 +α77X26+α225X25+α61X24+α126X23 +α77X26+α153X25+α73X24+α158X23+α87X22 +α93X25+α188X24+α161X23+α87X22 .. .
The division stops after 23 operations. The last part of this division is α218X4+α41X3+α83X2+α251X
α218X4+α39X3+α284X2+α44X+α228
+α89X3+α139X2+α249X+α228
The remainder polynomial is the calculated redundancy, which is, as said above, placed in the middle of the message vector.
The second encoder in this concatenated scheme, for the shortened RS code CRS(32,28),
takes the code vector of 28 bytes generated by the first encoder, and operates in the same way as that described above, in order to calculate the additional 4 bytes of redundancy. The number of steps in the division is now 27, instead of 23. The encoded vector is finally of the form
c2=(α100 α90 α80 α70 α0 0 0 α70 α60 α50 α200 α100 α89 α139 α249 α228
α2 α1 α0 0 α4 α3 α2 α1 α40 α30 α20 α10 α144 α68 α240 α5)
Now the redundant bytes are placed as traditionally done at the end of the resulting code vector, that is, in the least significant positions. It is noted here that in the real CD coding procedure, there is an interleaver between these two concatenated encoders.
It is practically impossible to enumerate all the code vectors that form these codes, even in the case of shortened RS codes. Any of the 256 elements of the field being used have the possibility of being in each position of the message vector of 24 bytes. This means that the total number of code vectors in the shortened RS code CRS(28,24) is
2km=224×8=6.27710×1057
This is the size of the input of the table of code vectors, and also the number of message vectors that can be encoded. The shortened RS code CRS(32,28) expands this vector space into a space
of the following number of code vectors:
2nm =228×8=2.69599×1067 The relationship between these quantities is
2nm/2km=228×8/224×8=232=4.29×109 which gives an idea of the expansion capability of the encoding procedure.