# Chapter 4 Linear Cyclic Codes

4.1 Definition of Cyclic Code
An (n, k) linear code C is called a cyclic code if any cyclic shift of a codeword is another codeword. That is, if c = ( c 0 , c 1 ,L , c n- 1 ) ∈ C
( 1) then c = ( c n- 1 , c0 , c 1 ,L , c n- 2 ) ∈ C

Cyclic structure makes the encoding and syndrome computation very easy.

In polynomial form

c ( x ) = c 0 + c 1 x + c 2 x 2 + L + c n- 1 x n-1 c ( 1 ) ( x ) = c n- 1 + c 0 x + c 1 x 2 + L + c n- 2 x n- 1

4.2 Generator Polynomial
Every nonzero code polynomial c(x) in C must have degree at least n-k but not greater than n-1.

There exists one and only one nonzero generator polynomial g(x) for a cyclic code.

Uniqueness: Suppose g(x) is not unique, then there would exist another such code polynomial of the same degree of the form,

g' ( x ) = 1 + g'1 x + g' 2 x 2 + L + g'n- k - 1 x n- k - 1 + x n- k .
Thus one obtains the code polynomial

g" ( x ) = ( g'1 − g 1 ) x + L + ( g'n- k - 1 − g n- k -1 ) x n- k - 1 .
Polynomial g" ( x ) corresponds to the word

(0, g'1 − g 1 , g' 2 − g 2 ,L , ( g'n- k - 1 − g n- k -1 ) , 0 ) .
Since deg( g" ) < n - k , this contradicts the minimality of g(x). Therefore g(x) must be unique.

.e. i.Every code polynomial c(x) is divisible by g(x). a multiple of g(x).

k) n cyclic code is always a polynomial factor of the polynomial x . h(x) is called the parity polynomial of an (n. it follows that x n .1 . n This means that any factor of x . k) cyclic code. n (or x + 1 ).1) . n Since x .1 x + x .4. h( x ) = 1 + h1 x + h2 x + L + hk .1 of degree n-k is a possible generator of an (n. n Since g(x) divides x . . one has the important relation h( x ) g ( x ) = 0 mod ( x n .1 = h( x ) g ( x ) 2 k where h( x ) = h0 + h1 x + h2 x + L + hk x where h0 = hk = 1 2 k -1 k i.e.3 Selecting the Parameters of a Cyclic Code It can be shown that the generator polynomial g(x) of an (n. k) cyclic code.1 = h( x ) g ( x ) .1 .

k -1 + x n.Define message polynomial as m( x ) = m0 + m1 x + m2 x 2 + L + mk . the product m(x)g(x) is the polynomial that represents the codeword polynomial of degree n-1 or less.1 x k .1 x n. k) cyclic code is completely specified by the monic generator polynomial g ( x ) = 1 + g 1 x + L + g n.k The codeword polynomial is expressed as c ( x ) = c 0 + c 1 x + c 2 x 2 + L + c n.1 Clearly.1 x n-1 .k .1 + c 0 x + c 1 x 2 + L + c n. c ( 1 ) ( x ) = c n.2 x n. . An (n.1 .

1 + c n-1 ( x n . . k Thus.( 1) c(x) and c ( x ) are related by the formula c ( 1) ( x ) = xc( x ) mod ( x n . c ( i ) ( x ) = x i m( x ) g ( x ) mod ( x n .1) = c ( 1) ( x ) + c n.c n.2 x n.1) Now.1 ( x n .1 = c n-1 + c0 x + L + c n. that another codeword in the cyclic code C is formed.1) = m ( i ) ( x ) g( x ) This identity proves that if any codeword is cyclically shifted i times.1 x n = c n-1 + c 0 x + L + c n-1 x n . any set of q codewords which possesses the cyclic property is generated by some generator polynomial g(x).1) ( 1) This follows from the fact that since both c(x) and c ( x ) are code polynomials and xc ( x ) = c0 x + L + c n.

1 x k .k Dividing x m( x ) by g(x).4.k + 1 + L + m k .k Then. n.1 x n . n.k -1 x is the remainder.1 n. .k m( x ) = x n .k . mk -1 ) is the message to be encoded.1 where p( x ) = p0 + p1 x + L + pn. we have x n.4 Encoding of Cyclic Codes Consider an (n. Hence it is the code polynomial for the message m(x).k we obtain Multiplying m(x) by x x n .1 .k + m1 x n . p( x ) + x m( x ) = q( x ) g ( x ) is a multiple of g(x) and has degree n-1.L . m1 . Suppose m = ( m0 .k m( x ) = q( x ) g ( x ) + p( x ) n. m( x ) = m0 + m1 x + L + mk . k) cyclic code with generator polynomial g(x).

k m ( x ) = p0 + p1 x + L + pn.Note that p( x ) + x n . as shown below. Note that the right-most symbol of the word is the first symbol to enter the encoder.k .1 x n.k . Figure 4.1 + m0 x n.k + 1 + L + mk .k + m1 x n. The encoding can be implemented by using a division circuit which is a shift register with feedback connections based on the generator polynomial g(x).2. subscript-order notwithstanding.1 x n-1 14444244443 144444 2444444 4 3 parity message The code polynomial is in systematic form where p(x) is the parity-check part. L .

1 x + c 0 x i + c 1 x i + 1 + L + c n. i -1 Note that c ( i ) ( x ) = c + c n.i .1) + c ( i ) ( x ) Syndrome circuit with input from the right end.5(b) ) r( x ) L .1 + c n.i + 1 ( x n .1 Thus x i c ( x ) = c n.1 x i .1) + c n. ( Fig.1 x n.i ( x n .i + 1 x + L + c n.1 x n-1 and x i c ( x ) = c 0 x i + c 1 x i + 1 + L + c n . 4.1) + L + c n.i + 1 x + L + c n.The gate is turned on until all the information digits have been shifted into the circuit.1 + c 0 x i + L + c n.1 x n+ i .1) = q( x )( x n .i .i n.1 ( x n .i + c n.

k ) ( x ) of r ( n.After the entire r(x) has been shifted into the register. Therefore ρ ( x ) is s . Since x n .k ) ( x ) is divided by g(x). when r ( n. they form the syndrome s the cyclic shift of r(x). which is Rather. ( n.k ) ( x ) . This is because shifting r(x) from the right end is equivalent to n.k r ( x ) = a( x ) g ( x ) + ρ ( x ) x n.1 = h( x ) g ( x ) ( n.1) + r ( n.k r ( x ) = b( x )( x n . the remainder. ρ ( x ) is also This says that.k ) ( x ) n and x .k ) ( x ) = [b( x )h( x ) + a( x )]g ( x ) + ρ ( x ) we have r ( n.k premultiplying r(x) by x . the contents in the register do not form the syndrome of r(x).k ) ( x) .

9 (page 153) 3 For a (7. 4) code. 4) cyclic code generated by g ( x ) = 1 + x + x . g ( x ) = 1 + x + x m = ( 1 0 1 0 ) ⇒ c = (0 0 1 1 0 1 0 ) Figure 4. 4) cyclic encoder shown in Fig. .5 Encoding operation for the (7.Example 4. 3 shift number i 0 1 2 3 4 5 6 register contents R1 R2 R3 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 switch 1 1 1 1 2 2 2 gate on on on on off off off output 0 10 010 1010 11010 011010 0011010 Table 4.3. 4.3 Encoder for the (7.

L . x we obtain the following n-k equalities: ∑h c i =0 k i n.j = 0 for 1 ≤ j ≤ n . x n.k (4. the k k +1 n.L . x . x k +1 . If we expand the product c(x)h(x) on the LHS of the above equation.1 ) be a code vector of C Then c ( x ) = m( x ) g ( x ) Multiply c(x) by h(x).1 do not appear in x n m( x ) − m( x ) . c1 . coefficients of x . Let c = ( c0 .L . Therefore.22) . we obtain c ( x )h( x ) = m( x ) g ( x )h( x ) = m( x )( x n . cn .Code generation by using parity polynomial h(x) h( x ) = h0 + h1 x + h2 x 2 + L + hk x k with h0 = hk = 1 We want to show that a parity-check matrix C may be obtained from h(x).i .1 must be equal to zero.1) = x n m( x ) − m( x ) Since the degree of m(x) is k-1 or less. the powers x k .

c0 .j i =0 k -1 for 1 ≤ j ≤ n .k . c 1 .k -1 . An encoding circuit (with k-stage shift register) based on the above equation is shown below. c n. c n.k .i . the components c n.k +1 .1 of each code vector are information (message) digits.24) For a cyclic code in systematic form.L .22) can be put into the following form: c n. (Fig. c n.Since hk = 1 . k) cyclic code generated by the parity-check polynomial h( x ) = h0 + h1 x + h2 x + L + hk x .k (4. Given these k message digits. the above equation (4.j = ∑ hi c n.4) Figure 4. 4. the above equation is a rule to determine the n-k parity-check digits. 2 k L L L .L .4 A k-stage shift-register encoder for an (n.

Dividing r(x) by the generator polynomial g(x).1 x is the remainder.5 Syndrome Computation Let c(x) and r(x) be the transmitted code polynomial & received polynomials.k where g ( x ) = g 0 + g 1 x + g 2 x + L + g n. respectively. r(x) is a code polynomial if and only if s(x) = 0.k -1 and s( x ) = s0 + s1 x + s2 x + L + sn. we have r ( x ) = q( x ) g ( x ) + s( x ) 2 n. Then s(x) is the syndrome of r(x).1 x 2 n.4.k . Syndrome computation is done by a division circuit as shown below: L r( x ) .k -1 + x n.k .

Since r ( x ) = c ( x ) + e ( x ) and also r ( x ) = q( x ) g ( x ) + s( x ) we have e ( x ) = r ( x ) + c ( x ) = q( x ) g ( x ) + s( x ) + c ( x ) = q( x ) g ( x ) + s ( x ) + m( x ) g ( x ) = [q( x ) + m( x )]g ( x ) + s( x ) or s( x ) = e ( x ) mod g ( x ) Hence the syndrome polynomial s(x) is also the remainder that results from dividing e(x) by g(x). .As soon as the entire r(x) has been shifted into the register. the contents in the register form the syndrome s(x).

i. ( 1) That is.rn-1 ( x n .xq( x ) g ( x ) = [a( x ) − xq( x ) + rn.rn.1 g ( x )h( x ) .33) ( 1) Where s ( x ) is the remainder that results from dividing r ( 1) ( x ) by g(x).33) xs( x ) = a( x ) g ( x ) + s ( 1) ( x ) + rn. Suppose r(x) is the received polynomial. s ( x ) is also the remainder which results from the division of xs(x) by g(x). r ( 1) ( x ) = rn.6 Error Detection and Syndrome Decoding Cyclic codes are very effective for error detection.4.1 h( x )]g ( x ) + s ( 1) ( x ) ( 1) Thus.35) . the syndrome polynomial of the ( 1) cyclically-shifted received word r ( x ) . if r ( x ) is the cyclic shift of r(x) one step to the right.2 x n.1) = x[q( x ) g ( x ) + s( x )] .1 + r0 x + r1 x 2 + L + rn. From (4.1 g ( x )h( x ) ( 1) ( 1) Also denote that r ( x ) = a( x ) g ( x ) + s ( x ) (4. ( 1) ( 1) the syndrome s ( x ) which corresponds to r ( x ) satisfies s ( 1) ( x ) = xs( x ) mod g ( x ) (4.e.1 = xr ( x ) .

the remainder obtained by dividing x s( x ) by g(x) is (i) (i) the syndrome s ( x ) corresponding to r ( x ) .35) generalizes easily to the i-th cyclical shift case. 4) cyclic code generated by g( x ) = 1 + x + x 3 . is the best choice since it allows one to release the corrected codeword bits before the error location actually is identified. the decoder needs only to be able to recognize one of the seven nonzero syndromes to be able to correct all of the nonzero error patterns.Equation (4. Since the error patterns consist of the cyclic shifts of (0 0 0 0 0 0 1). The code has d min = 3 and is capable of correcting any single error in e(x). The syndrome s = (1 0 1). . i That is. corresponding to the error pattern e = (0 0 0 0 0 0 1). Example: Consider the syndrome circuit for (7.

simultaneously. the shift-registers of the syndrome computation circuit contain the syndrome for the received word. the syndrome computation circuit computes the syndrome for the cyclically shifted versions of the received word. 4. As one continues to shift cyclically the contents of the received-word buffer and the syndrome computation circuit.6.  . The received word r is then shifted bit-by-bit into the 7-bit received word buffer and the syndrome-computation circuit. (page 160) r( x ) c( x ) Decoding begins by first setting all of the shift-register cells to zero.Fig. Once the received word is completely shifted into the buffer.

.If at any point the computed syndrome is s = (1 0 1). This value is then used to complement and correct the error in the rightmost bit in the buffer as it leaves the buffer. it is “detected” by the AND gate when its output goes to 1.

6. (Lin / Costello p. e n.1 x with an error at n-1 the highest-order position x . 4.A general decoder (Meggitt decoder) for an (n. (That is.1 = 1 . ( 1) 5. k) cyclic code is shown below.1 if e n. Correct rn. Repeat the same process until n shifts. (i.1 = 1 ?) 3. Now the buffer register contains r ( x ) and ( 1) the syndrome register contains the syndrome s ( x ) of r ( 1) ( x ) . Check whether the syndrome s(x) corresponds to a correctable n-1 error pattern e ( x ) = e 0 + e 1 x + L + e n.) 2. syndrome is formed.2 if it is erroneous. Shift the received polynomial r(x) into a buffer and the syndrome registers simultaneously.e. . 105) The decoding operation is described as follows: 1. Cyclically shift the buffer and syndrome registers once ( 1) simultaneously. Check whether s ( x ) corresponds to a correctable error ( 1) pattern e ( x ) with an error at the highest-order position x n-1 . 7. Correct rn.

r( x ) ri Figure 4.8. the buffer register contains the transmitted codeword and the syndrome register contains zeros. If the syndrome register does not contain all zero at the end of the decoding process. If the error pattern is correctable.  ei  .8 General cyclic code decoder with received polynomial r(x) shifted into the syndrome register from left end. an uncorrectable error pattern has been detected. 9.

The code length is n' = n . a code obtained from shortening a cyclic code is no longer cyclic.7 Shortened Cyclic Codes Suppose we wish to have information blocks of (k-l) digits. 0 0 L 0 ) There is no need to transmit the l zeros. c 1 . m1 . k) code with l < k. .l . m1 .l . c n.1 . mk .k . l 678 Let m = ( m0 . mk .L . 0 0 L 0 ) If the code is a cyclic code in systematic form.l -1 .L .4. Shortened codes have error detection and correction capabilities that are at least as good as the original codes. the code words l 678 generated are c = ( c0 . In general. since the receiver will know this (because we are designing it). m0 . but we use (n.L .1.

k) cyclic code. 4) cyclic code generated by g ( x ) = 1 + x + x 1 0 G= 1  0 1 0 1 0 0 0 1 1 0 1 0 0  1 1 0 0 1 0  0 1 0 0 0 1 The generator matrix of the (6. 3) shortened code is obtained by omitting the last row and column from G of the original (7. 4) code.Example: 3 Consider the (7.4) . (Fig. 1 1 0 1 0 0  G' = 0 1 1 0 1 0     1 1 1 0 0 1   and the parity-check matrix H' is obtained by omitting the last column of H. 4. k-l) can be decoded by a decoder similar to the original (n. 1 0 0 1 1 0 H' = 0 1 0 1 1 1   0 0 1 0 1 1   Decoding of shortened code A shortened cyclic code (n-l.

k .k .1 x be the remainder resulting n.5(b)) If the decoding circuit for the original cyclic code is used for decoding the shortened code.l .k .l x be received polynomial.l ( x ) n. we obtain Dividing x x n .k is equivalent to premultiplying r(x) by x .k . dividing x Since shifting r(x) into the syndrome register from the right end n.n. the proper syndrome for decoding the received digit rn. 4.l r ( x ) by the generator polynomial g(x).l + a2 ( x ) g ( x ) from this division.k . Suppose that r(x) is shifted into the syndrome register from the right end.1 is equal to the remainder resulting from n. (Fig. the syndrome register must be cyclically shifted for another l times after the entire r(x) has been shifted into the register.1.k -1 Let ρ ( x ) = ρ 0 + ρ 1 x + L + ρ n.l r ( x ) = a1 ( x ) g ( x ) + s n .1 Let r ( x ) = r0 + r1 x + L + rn. n. we divide x by g(x).l ) ( x) and then ρ ( x )r ( x ) = [a1 ( x ) + a2 ( x )r ( x )]g ( x ) + s .k .k . These extra l shifts can be eliminated by modifying the connection of the syndrome register: n. That is ρ ( x ) = x ( n.l Next.l .k .l r ( x ) by g(x).

k . The circuit is shown below.k . 117) g1 g2 g n.k -1 ρ0 ρ1 ρ2 ρ n-k .k -1 Figure 4. p.1 and dividing ρ ( x ) r ( x ) by g ( x ) = g0 + g 1 x + L + x n.k .1 x n. the extra l shifts of the syndrome Computing s register can be avoided.l ) ( x ) by multiplying r(x) by ρ ( x ) and dividing the product ρ ( x )r ( x ) by g(x).k .2 g n. (Lin / Costello.l ( x ) this way.The equation above suggests that we can obtain the syndrome s ( n.k . n.k .15 Circuit for multiply by and dividing by ρ ( x ) = ρ 0 + ρ 1 x + L + ρ n.2 ρ n.

4. Concatenated Coding System  .8 CRC Codes Cyclic Redundancy Check (CRC) Codes are error-detecting codes typically used in automatic repeat request (ARQ) systems. CRC codes are shortened cyclic codes. CRC codes have no error-correction capability but they can be used in combination with an error-correcting code to improve the performance of the system.

The result is a (k+16. 16-bit CRC-CCITT g ( x ) = x 16 + x 12 + x 5 + 1 The 16-bit CRC-CCITT is defined as the remainder obtained by 16 dividing the message polynomial m( x ) x by g(x). k) code. . The codewords are formed as a k-bit information sequence followed by a check pattern of 16 bits (two 8-bit bytes) at the end of message.CRC codes are often (but not always) constructed of polynomials of the form g ( x ) = ( x + 1) p( x ) where p(x) is a primitive polynomial of degree (r-1) that divides x2 r -1 -1.

9 Systematic encoder for CCITT polynomial code with g ( x ) = x 16 + x 12 + x 5 + 1 . 4. which are used when computing the CRC. In the encoding process.Fig. and then tests to see whether the result equals zero.9. two zero bytes are added to the end of the message. At the receiver the decoder simply computes the CRC of the message part and adds the results to the CRC bytes. . (page 178) Figure 4.

Also.k + 1) . k) cyclic code is capable of detecting any error burst of length n-k or less. CRC in spread spectrum cellular system g ( x ) = x 30 + x 29 + x 21 + x 20 + x 15 + x 13 + x 12 + x 11 + x 8 + x7 + x 6 + x 2 + x + 1 CRC used in ATM protocol (CRC-ATM) g( x ) = x 8 + x 2 + x + 1 .( n.A CRC constructed by an (n. the fraction of undetectable error burst of length n-k+1 is 2 .