BCH Codes
Outline Binary Primitive BCH Codes Decoding of the BCH Codes Implementation of Galois Field Arithmetic Implementation of Error Correction Nonbinary BCH Codes and Reed-Solomon Codes
Preface The Bose, Chaudhuri, and Hocquenghem (BCH) codes form a large class of powerful random error-correcting cyclic codes This class of codes is a remarkable generalization of the Hamming codes for multiple-error correction Binary BCH codes were discovered by Hocquenghem in 959 and independently by Bose and Chaudhuri in 960 Generalization of the binary BCH codes to codes in p m symbols (where p is a prime) was obtained by Gorenstein and Zierler Among the nonbinary BCH codes, the most important subclass is the class of Reed-Solomon (RS) codes Among all the decoding algorithms for BCH codes, Berlekamp s iterative algorithm, and Chien s search algorithm are the most efficient ones 3
Description of the BCH Codes 4
Binary Primitive BCH Codes m integer m 3, t, a binary BCH codes with m n Block length n k mt Number of parity-check digits d min t Minimum distance Clearly, this code is capable of correcting any combination of t or fewer errors in a block of n m digits We call this code a t- error-correcting BCH code The generator polynomial of this code m is specified in terms of its roots from the Galois field GF( ) m Let be a primitive element of GF( ) The generator poly g(x) of the t-error-correcting BCH code of length m is the lowestdegree poly over GF() which has 3 t as its roots 5
Binary Primitive BCH Codes t It follows from Theorem that g(x) has,,, and their i conjugates as all its roots Let i (x) be the minimal poly of Then g(x) must be the least common multiple (LCM) of x), ( x),, ( ), that is, ( t x If i is an even integer, it can be expressed as a product of the following form : l i i', ' l i i where i is an odd number and l Then ( ) is a conjugate ' ' i i i of and therefore and have the same minimal poly, that is, g( x) LCM ( x), ( x), ( x) t ( x) ( x) i i 6
Binary Primitive BCH Codes Hence, even power of has the same minimal poly as some preceding odd power of deg ( ) g( x) LCM ( x), ( x), ( x) i x m 3 t (Theorem 8 & 9) deg g( x) mt n k mt The BCH codes defined above are usually called primitive (or narrow-sense ) BCH codes 7
Binary Primitive BCH Codes The single-error-correcting BCH codes of length is generated by g( x) ( x) since t = m is a primitive element of GF( ) m x 0 ( ) is a primitive poly of degree m (,,, ) m the single-error-correcting BCH codes of length Hamming code m is a Ex 6 4 is a primitive element of GF( ) given by Table 8 4 such that 0 The minimal polynomials of α,α 3,α 5 are 8
Binary Primitive BCH Codes 9 9
Binary Primitive BCH Codes ( x) x x 3 5 ( x) x x x x ( x) x x 4 3 4 The double-error-correcting BCH code of length n 4 5 is generated by g( x) LCM{ ( x), 3( x)} Since x) and ( ) are two distinct irreducible polynomials, ( 3 x g( x) ( x x x 4 x 4 6 )( x (5, 7) cyclic code with d 5 x 7 x x 8 min W ( g( x)) 5 d 5 min x 3 x 4 ) 0
Binary Primitive BCH Codes The triple-error-correcting BCH code of length 5 is generated by g( x) LCM ( x), ( x), ( x) It s a (5,5) cyclic code with 3 5 4 3 4 ( x x )( x x x x )( x x ) x x x x x x 4 5 8 0 d min 7Since W ( g( x)) 7, dmin 7 Let v( x) v v x v x n be a poly with v GF() 0 n t If v( x) has roots,,,, then v( x) is divisible by ( x), ( x),, ( x) (Theorem 4) t i v(x) is a code poly, g(x) v( x), g( x) LCM{ ( x), ( x),, ( x)} t
Binary Primitive BCH Codes We have a new definition for t-error-correcting BCH code: A binary n-tuple v ( v0, v, v,, vn ) is a code word if n and only if the poly v( x) v0 vx vn x t has,,, as roots, ie v( i ) v v v i i 0 v n ( n) i i ( v0, v, v,, v ) n 0 for i t ( n) i
3 Binary Primitive BCH Codes Let If v is a code word in the t-error-correcting BCH code, then The code is the null space of the matrix H and H is the parity-check matrix of the code ) ( ) ( ) ( ) ( H n t t n n 0 H v T
Binary Primitive BCH Codes j i j i is a conjugate of, then v( ) 0 iff v( ) 0 (Thm ) j-th row of H can be omitted As a result H can be reduced to the following form : H n ( ) ( ) ( ) ( ) 3 3 3 n (t) t t n 只剩下奇數的 Row EX 6 double-error-correcting BCH code of length (5,7) code Let be a primitive element in 4 n 4 5, GF( ) 4
Binary Primitive BCH Codes The parity-check matrix is 4 H 3 6 4 Using 5, and representing each entry of H by its 4- tuple, H 0000000 0000000 0000000 0000000 000000000 000000000 000000000 000 5 (Note that the parity check matrix is not binary anymore)
Binary Primitive BCH Codes FACT: The t-error-correcting BCH code indeed has dmin t (pf): Suppose v 0 such that W(v) t Let v, v, v be the nonzero components of v (ie all ones) j j j T 0 vh ( v j v ) j v j 6 j j t j ( ) ( ) j j t j ( ) ( ) j j t j ( ) ( ) j j j t ( ) ( ) j j j t ( ) ( ) (,,) 0 j j j t ( ) ( )
Binary Primitive BCH Codes j j j ( ) ( ) j j j ( ) ( ) (,,) 0 j j j ( ) ( ) Taking out the common factor from each row of the determinant A A, a square matrix t 0 j j ( ) j ( ) j ( j j j ) 0 j ( ) j 7
Binary Primitive BCH Codes The determinant in the equality above is a Vandermonde determinant which is nonzero The product on the left-hand side of can not be zero This is a contradiction and hence our assumption that there exists a nonzero code vector v of W(v) t is invalid dmin t t+ is the designed distance of the t-error-correcting BCH code The true minimum distance of a BCH code may or may not be equal to its designed distance m Binary BCH code with length n can be constructed in the same manner as for the case n m (Theorem 9) m m Let be an element of order n in GF( ), n and g(x) be the t binary polynomial of minimum degree that has,,, as roots 8
Binary Primitive BCH Codes Let ( x), ( x),, t ( x) be the minimal poly of,, respectively then g(x) LCM{ ( x), ( x),, ( x)} t t n t n,,,, are roots of x n g( x) ( x ) We see that g(x) is a factor of The cyclic code generated by g(x) is a t-error-correcting BCH code of length n The number of parity-check dmin t digits mt X n If β is not a primitive element of GF( m ), the code is called a nonprimitive BCH code 9
General Definition of Binary BCH Codes General definition of binary BCH codes m GF( ), and consider 0 be any nonnegative integer l0 l0 l0 d0,,, For 0 i d0, let i (x), ni be the minimal poly and order of, respectively and the length of the code is Note that: 0 i g( x) LCM{ 0( x), ( x),, d ( x)} d n LCM n, n, n d d min 0 0 parity-check digits md ( ) 0 0 is capable of correcting ( d0 ) / or fewer errors (Proof is omitted and left as an exercise) 0 0
General Definition of Binary BCH Codes If we let l0 =, d0 = t+ and be a primitive element of ), the code becomes a t-error-correcting primitive BCH m code of length GF( m If we let l0 =, d0 = t+ and be not a primitive element of GF( m ), the code is a nonprimitive t-error-correcting BCH code of length n, which is the order of For a BCH code with designed distance d0, we require g(x) has d0 - consecutive powers of a field element as roots This guarantees that the code has dmin d0 This lower bound on the minimum distance is called the BCH bound In the rest of this chapter, we consider only the primitive BCH codes
3 Decoding of the BCH Codes Suppose that a code word v(x) = is transmitted and the transmission errors result : r(x) = Let e(x) be the error pattern Then For decoding, remember 0 n v n x x v x v v 0 n r n x x r r x r e(x) v(x) r(x) ) ( ) ( ) ( ) ( H n t t n n
The syndrome is t-tuple, S ( S, S, S T t H i i i n Let s r( ) r r r ( ) for i i ) 0 n r s can be evaluated by b ( x) R [ r( x)] i i ( x) ( x) is the minimal poly of i r( x) a ( x) ( x) b ( x) i i i i i s r( ) b ( ) i i i i t 4
EX64 Consider the double-error-correcting (5, 7) BCH code given in (from Ex6) If r (0000000000000) r( x) x 8 ( x) ( x) ( x) x x 4 ( x) x x x x 3 ( x) 3 ( x) 3 3 4 b ( x) R [ r( x)] x b ( x) R [ r( x)] x 3 4 s b ( ), s b ( ) s s 4 b 3 3 4 3 9 ( ) 4 8 b( ) 3 7 4 7 8 s (,,, ) (Note that syndrome is not binary anymore) 5
v i t s r e i i i ( ) 0 for ( ) ( ) Suppose i j j j e( x) x x x v 0 j j j n s s j j jv j j jv ( ) ( ) ( ) v s t ( ) ( ) j t jv t j j j where,, v are unknown Any method for solving these equations is a decoding algorithm for the BCH codes 6
Once j j j v the powers If the number of errors in e(x) is t or less, the solution that yields an error pattern with the smallest number of errors is the right solution For convenience, let location numbers,, have been found, j, j, j tell us the error locations in e( x) v s s s j, v v t t t t v v be the error Power-sum Symmetric function 7
Define ( x) ( x)( x)( x) = 0 x x x : error-location poly v v v The roots of ( x) are,, v, which are the inverses of the error location numbers 0 3 v v v v v 8
These coefficients are known as elementary symmetric functions i ' s are related to s ' s by Newton's identities s s 0 s 0 s s s 3 0 3 3 j s s s v 0 v v v v s s s s 0 v v v v Note that, for binary case, 0, we have i for odd i i i 0 for even i 9
Consequently, if m,,, GF( ) v, then ( ) r v v v v j j j i i sj i i r r r r r r r v r r r Since 0 mod, r s 30
Consequently, the Newton s Identities can be simplified into t equations: s 0 s s s 3 3 s s s s s 5 4 3 3 4 5 0 0 s s s s 0 t t t3 t t 3
The equations may have many solutions We want to find the solution that yields a σ(x) of minimal degree This σ(x) would produce an error pattern with minimum number of errors Decoding Procedure step Compute s ( s, s, s ) from r( x) t step Determine ( x) from step 3 Determine the error-location number,, by finding the roots of ( x) v and correct the errors in rx ( ) s 3
The first method for determing ( x) from Peterson s Algorithm s A 0 0 0 0 0 s s s 0 0 0 s 3 s4 s3 s s 0 0 3 s 5 st4 st5 st6 st7 st s t3 t s t3 s s s s s s s t t3 t4 t5 t t t t s, s s s 3 3, 33
The second method: Berlekamps iterative algorithm Iterative Algorithm for finding ( x) i () i sx i e s Y i t ( t) ( x) ( x) N END Does the coeficients of () i satisfy the ( i ) th Newtons identity? Y ( i) ( i) correction term N ( i) ( i) ii a 34
How to add a correction term to () i? Let x x x ( ) ( ) ( ) ( ) be the minimum-degree poly determined at the step ( To determine ) ( x) => compute discrepancy ( ) ( ) ( ) d s s s s ( ) ( ) If d 0 ( x) ( x) If d 0, go back to the steps prior to the th step and determine ( ) ( x) st th discrepancy d 0, and has the largest value ( ) ( deg [ ( x)]) Then th is the minimum-degree poly whose coefficients satisfy the first Newton s identities th ( x) ( x) d d x ( x) ( ) ( ) ( ) ( ) 35
To carry out the iteration of finding σ(x), we begin with the following table: ( ) ( x) d 0-0 S 0 0 t 36
l μ is the degree of σ (μ) (X) If d μ =0, then σ μ (μ+) (X)= σ (μ) (X) and l μ+ = l μ If d μ 0, find another row ρ prior to the μth row such that d ρ 0 and the number ρ-l ρ in the last column of the table has the largest value Then σ (μ+) (X) is given by ( x) ( x) d d x ( x) ( ) ( ) ( ) ( ) and l μ+ = max(l μ, l ρ +μ-ρ) ( ) ( ) In either case, d s s s The polynomial σ (t) (X) in the last row should be the required σ(x) 37
Ex 65 Consider (55) triple-error-correcting BCH codes given in ex 6 (t=3) p( x) x x v 0 r x x x 4 3 6 5 e 4 3 5 ( x) ( x) ( x) x x ( x) ( x) x x x x ( x) x x 4 3 4 38
b ( x) R [ r( x)] ( x) 3 ( x) 5 ( x) b ( x) R [ r( x)] x x 3 b ( x) R [ r( x)] x s s s s s 5 4 3 6 s5 6 9 0 8 5 0 0 0 5 s (,,,,, ) ( ) ( ) ( ) ( ) 3 ( x) ( x) d d x ( x) 39
S = μ=0; d 0 =S = 0 ρ=- ( ) ( ) ( ) d s s s s ( x) ( x) d d x ( x) ( ) ( ) ( ) ( ) σ () (X)= σ (0) (X)+d 0 d - - X (0+) σ (-) (X)=+ X =+X l =max(l 0,l - +μ-ρ))=max(0,0+0+)= μ-l μ =-l =-=0 d =S +σ () S =+ =0 l μ+ = max(l μ, l ρ +μ-ρ) σ () (X)= σ () (X)=+X l =l = μ-l μ =-l =-= d =S 3 +σ () S =α 0 + =(+α+α )+= α 5 40
d =α 5 0 ρ=0 σ (3) (X)=σ () (X)+d d 0 - X (-0) σ (0) (X)=+X+ α 5 X =+X+α 5 X l 3 =max(l,l 0 +μ-ρ))=max(,0+-0)= μ-l μ =3-l 3 =3-= d 3 =S 4 +σ (3) S 3 +σ (3) S +σ 3 (3) S =+ α 0 + α 5 +0 =+(+α+α )+(α+α )=0 4
( ) ( x) d 0-0 0 0 + x 0 0 5 x 5 3 x x 0 5 0 4 + x x 5 5 3 + x x 0 3 5 3 6 + x x - - - ( x) ( x) x x (6) 5 3 3 0 ( x)( x)( x) 3 0 x,, 4
error location numbers 3 0 5 3,, 3 e( x) x x x 3 5 r( x) r( x) e( x) 0 If the number of errors in the received polynomial r(x) is less than the designed error-correcting capability t of the code, it is not necessary to carry out the t steps of iteration to find the errorlocation polynomial σ(x) It has been shown that if d μ and the discrepancies at the next t-l μ - steps are all zeros (ie successive t-l μ zeros), σ (μ) (X) is the errorlocation polynomial If v(v t) errors occur, only v+t steps of iteration are needed The iterative algorithm described above not only applies to binary BCH codes but also nonbinary BCH codes 43
Simplified Algorithm for finding ( x) For a binary BCH code, it is only required to fill out a table with t empty rows Such a table is presented below ( ) ( x) d -/ 0-0 S 0 0 t 44
( ) ( ) If d 0, then ( x) ( x) If d 0, find another row proceding the th row, st is as large as possible and d 0 ( ) ( ) ( ) ( ) Then ( X) ( X) d d X ( X ) note that d s s s ( ) ( ) 3 + ( ) s 3 ( ) deg [ ( x)] 45
The polynomial σ (t) (X) in the last row should be the required σ(x) If it has degree greater than t, there were more than t errors, and generally it is not possible to locate them The computation required in this simplified algorithm is onehalf of the computation required in the general algorithm The simplified algorithm applies only to binary BCH codes If the number of errors in the received polynomial r(x) is less than the designed error-correcting capability t of the code, it is not necessary to carry out the t steps of iteration to find the error-location polynomial σ(x) for a t-error-correcting binary BCH code 46
Remarks: If errors occur, only ( tv)/ steps needed If, for some μ, d μ and the discrepancies at the next (t-l μ -)/ steps are zero, then ( X ) is the error-location poly EX66 v t The simplified table for finding (x) for the code in ex65 is given (3) 5 3 below Thus, ( x) ( x) x x ( ) ( x) d l l -/ 0-0 S= 0 0 5 +Sx=+x S3+S S== (take = -/ ) +x+ 5 x 0 (take = 0 ) 3 +x+ 5 x 3 ---- 3 3(take = ) 47
Finding the Error-Location Numbers and Error Correction Consider ex66 The error-location poly has been found to be 5 3 ( x) x x By substituting 4 3 0,,,, into it, we find that,, are the roots of (x) Therefore, the error location numbers 5 3 3 5 are,, e( x) x x x Chien s procedure: The received vector r( x) r r x r x 0 is decoded on a bit-by-bit basis The high-order bits are n decoded first To decode r n-, the decoder test whether is an error-location number; this is equivalent to test whether its inverse is a root of (x) If is a root, then 48 r n x n v v 0
rn l To decode l l vl, the decoder forms,,, v and tests the sum l l vl v If the sum is zero, then α n-l is an error-location number and r n- l is an erroneous digit; otherwise, r n-l is a correct digit Cyclic error location search unit t output x x x t t i i A i input Buffer 49
The t-registers are initial stored with,,, t calculated in step of the decoding ( v v t 0 for v < t) Immediately before rn- is read out of the buffer, the t multiplier are v pulsed once The multiplications are performed and,,, v are stored in the -registers The output of the logic circuit A is if v and only if the sum v 0; otherwise, the output of A is 0 The digit rn- is read out of the buffer and corrected by the output of A Having decoded rn-,the t multipliers are pulsed 4 v again Now,,, v are stored in the -registers The sum 4 v v is tested for 0 The digit rn- is read out of the buffer and corrected in the same manner as rn- is corrected 50