Sie sind auf Seite 1von 29

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.

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

4.3 Selecting the Parameters of a Cyclic Code


It can be shown that the generator polynomial g(x) of an (n, k)
n cyclic code is always a polynomial factor of the polynomial x - 1 , n (or x + 1 ). n This means that any factor of x - 1 of degree n-k is a possible

generator of an (n, k) cyclic code.

n Since g(x) divides x - 1 , it follows that

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. h( x ) = 1 + h1 x + h2 x + L + hk - 1 x + x .

h(x) is called the parity polynomial of an (n, k) cyclic code.

n Since x - 1 = h( x ) g ( x ) , one has the important relation

h( x ) g ( x ) = 0 mod ( x n - 1) .

Define message polynomial as

m( x ) = m0 + m1 x + m2 x 2 + L + mk - 1 x k - 1
Clearly, the product m(x)g(x) is the polynomial that represents the codeword polynomial of degree n-1 or less.

An (n, k) cyclic code is completely specified by the monic generator polynomial

g ( x ) = 1 + g 1 x + L + g n- k - 1 x n- k -1 + x n- k

The codeword polynomial is expressed as

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 .

( 1) c(x) and c ( x ) are related by the formula

c ( 1) ( x ) = xc( x ) mod ( x n - 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 n

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

Now, c ( i ) ( x ) = x i m( x ) g ( x ) mod ( x n - 1)

= m ( i ) ( x ) g( x )
This identity proves that if any codeword is cyclically shifted i times, that another codeword in the cyclic code C is formed.
k Thus, any set of q codewords which possesses the cyclic

property is generated by some generator polynomial g(x).

4.4 Encoding of Cyclic Codes


Consider an (n, k) cyclic code with generator polynomial g(x). Suppose m = ( m0 , m1 ,L , mk -1 ) is the message to be encoded.

m( x ) = m0 + m1 x + L + mk - 1 x k - 1 .

n- k we obtain Multiplying m(x) by x

x n - k m( x ) = x n - k + m1 x n - k + 1 + L + m k - 1 x n - 1

n- k Dividing x m( x ) by g(x), we have

x n- k m( x ) = q( x ) g ( x ) + p( x )
n- k - 1 where p( x ) = p0 + p1 x + L + pn- k -1 x is the remainder.

n- k Then, p( x ) + x m( x ) = q( x ) g ( x ) is a multiple of g(x) and

has degree n-1. Hence it is the code polynomial for the message m(x).

Note that

p( x ) + x n - k m ( x ) = p0 + p1 x + L + pn- k - 1 x n- k - 1 + m0 x n- k + m1 x n- k + 1 + L + mk - 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.

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), as shown below.

Figure 4.2.

Note that the right-most symbol of the word is the first symbol to enter the encoder, subscript-order notwithstanding.

The gate is turned on until all the information digits have been shifted into the circuit.

i -1 Note that c ( i ) ( x ) = c + c n- i n- i + 1 x + L + c n- 1 x

+ c 0 x i + c 1 x i + 1 + L + c n- i - 1 x n-1

and

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

Thus

x i c ( x ) = c n- i + c n- i + 1 x + L + c n- 1 x i - 1 + c 0 x i + L + c n- i - 1 x n- 1 + c n- i ( x n - 1) + c n- i + 1 ( x n - 1) + L + c n- 1 ( x n - 1) = q( x )( x n - 1) + c ( i ) ( x )

Syndrome circuit with input from the right end. ( Fig. 4.5(b) )

r( x )

After the entire r(x) has been shifted into the register, the contents in the register do not form the syndrome of r(x);
( n- k ) ( x ) of r ( n- k ) ( x ) , which is Rather, they form the syndrome s

the cyclic shift of r(x).

This is because shifting r(x) from the right end is equivalent to


n- k premultiplying r(x) by x .

Since

x n - k r ( x ) = a( x ) g ( x ) + ( x ) x n- k r ( x ) = b( x )( x n - 1) + r ( n- k ) ( x )

n and x - 1 = h( x ) g ( x ) ( n- k ) ( x ) = [b( x )h( x ) + a( x )]g ( x ) + ( x ) we have r ( n- k ) ( x ) is divided by g(x), ( x ) is also This says that, when r ( n- k ) ( x) . the remainder. Therefore ( x ) is s

Example 4.9 (page 153)


3 For a (7, 4) code, g ( x ) = 1 + x + x

m = ( 1 0 1 0 ) c = (0 0 1 1 0 1 0 )

Figure 4.3 Encoder for the (7, 4) cyclic code generated by g ( x ) = 1 + x + x .


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.5 Encoding operation for the (7, 4) cyclic encoder shown in Fig. 4.3.

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). Let c = ( c0 , c1 ,L , cn - 1 ) be a code vector of C Then c ( x ) = m( x ) g ( x ) Multiply c(x) by h(x), we obtain

c ( x )h( x ) = m( x ) g ( x )h( x ) = m( x )( x n - 1) = x n m( x ) m( x )
Since the degree of m(x) is k-1 or less, the powers

x k , x k +1 ,L , x n- 1 do not appear in x n m( x ) m( x ) . If we expand


the product c(x)h(x) on the LHS of the above equation, the
k k +1 n- 1 must be equal to zero. Therefore, coefficients of x , x ,L , x

we obtain the following n-k equalities:

h c
i =0

i n- i - j

= 0 for 1 j n - k

(4.22)

Since hk = 1 , the above equation (4.22) can be put into the following form:

c n- k - j = hi c n- i - j
i =0

k -1

for 1 j n - k

(4.24)

For a cyclic code in systematic form, the components

c n- k , c n- k +1 ,L , c n- 1 of each code vector are information (message)


digits. Given these k message digits, the above equation is a rule to determine the n-k parity-check digits, c0 , c 1 ,L , c n- k -1 . An encoding circuit (with k-stage shift register) based on the above equation is shown below. (Fig. 4.4)

Figure 4.4 A k-stage shift-register encoder for an (n, k) cyclic code generated by the parity-check polynomial h( x ) = h0 + h1 x + h2 x + L + hk x .
2 k

L L L

4.5 Syndrome Computation


Let c(x) and r(x) be the transmitted code polynomial & received polynomials, respectively.

Dividing r(x) by the generator polynomial g(x), we have

r ( x ) = q( x ) g ( x ) + s( x )
2 n- k -1 + x n- k where g ( x ) = g 0 + g 1 x + g 2 x + L + g n- k - 1 x 2 n- k -1 and s( x ) = s0 + s1 x + s2 x + L + sn- k - 1 x is the remainder.

Then s(x) is the syndrome of r(x).

r(x) is a code polynomial if and only if s(x) = 0.

Syndrome computation is done by a division circuit as shown below:

r( x )

As soon as the entire r(x) has been shifted into the register, the contents in the register form the syndrome s(x).

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).

4.6 Error Detection and Syndrome Decoding


Cyclic codes are very effective for error detection.

Suppose r(x) is the received polynomial,

r ( 1) ( x ) = rn- 1 + r0 x + r1 x 2 + L + rn- 2 x n- 1 = xr ( x ) - rn-1 ( x n - 1) = x[q( x ) g ( x ) + s( x )] - rn- 1 g ( x )h( x )


( 1) ( 1) Also denote that r ( x ) = a( x ) g ( x ) + s ( x )

(4.33)

( 1) Where s ( x ) is the remainder that results from dividing

r ( 1) ( x )

by

g(x),

i.e.

the

syndrome

polynomial

of

the

( 1) cyclically-shifted received word r ( x ) .

From (4.33)

xs( x ) = a( x ) g ( x ) + s ( 1) ( x ) + rn- 1 g ( x )h( x ) - xq( x ) g ( x ) = [a( x ) xq( x ) + rn- 1 h( x )]g ( x ) + s ( 1) ( x )


( 1) Thus, s ( x ) is also the remainder which results from the

division of xs(x) by g(x).


( 1) That is, if r ( x ) is the cyclic shift of r(x) one step to the right, ( 1) ( 1) the syndrome s ( x ) which corresponds to r ( x ) satisfies

s ( 1) ( x ) = xs( x ) mod g ( x )

(4.35)

Equation (4.35) generalizes easily to the i-th cyclical shift case.


i That is, the remainder obtained by dividing x s( x ) by g(x) is (i) (i) the syndrome s ( x ) corresponding to r ( x ) .

Example: Consider the syndrome circuit for (7, 4) cyclic code generated by

g( x ) = 1 + x + x 3 .
The code has d min = 3 and is capable of correcting any single error in e(x). Since the error patterns consist of the cyclic shifts of (0 0 0 0 0 0 1), 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. The syndrome s = (1 0 1), corresponding to the error pattern e = (0 0 0 0 0 0 1), is the best choice since it allows one to release the corrected codeword bits before the error location actually is identified.

Fig. 4.6. (page 160)


r( x )

c( x )

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

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

A general decoder (Meggitt decoder) for an (n, k) cyclic code is shown below. (Lin / Costello p. 105) The decoding operation is described as follows: 1. Shift the received polynomial r(x) into a buffer and the syndrome registers simultaneously. (That is, syndrome is formed.) 2. Check whether the syndrome s(x) corresponds to a correctable
n-1 error pattern e ( x ) = e 0 + e 1 x + L + e n- 1 x with an error at n-1 the highest-order position x . (i.e. e n- 1 = 1 ?)

3. Correct rn- 1 if e n- 1 = 1 . 4. Cyclically shift the buffer and syndrome registers once
( 1) simultaneously. Now the buffer register contains r ( x ) and ( 1) the syndrome register contains the syndrome s ( x ) of

r ( 1) ( x ) .
( 1) 5. Check whether s ( x ) corresponds to a correctable error ( 1) pattern e ( x ) with an error at the highest-order position

x n-1 .
6. Correct rn- 2 if it is erroneous. 7. Repeat the same process until n shifts.

8. If the error pattern is correctable, the buffer register contains the transmitted codeword and the syndrome register contains zeros. 9. If the syndrome register does not contain all zero at the end of the decoding process, an uncorrectable error pattern has been detected.

r( x )

ri

Figure 4.8 General cyclic code decoder with received polynomial r(x) shifted into the syndrome register from left end.


ei

4.7 Shortened Cyclic Codes


Suppose we wish to have information blocks of (k-l) digits, but we use (n, k) code with l < k.
l 678 Let m = ( m0 , m1 ,L , mk - 1- l , 0 0 L 0 )

If the code is a cyclic code in systematic form, the code words


l 678 generated are c = ( c0 , c 1 ,L , c n- k - 1 , m0 , m1 ,L , mk - l -1 , 0 0 L 0 )

There is no need to transmit the l zeros, since the receiver will know this (because we are designing it). The code length is

n' = n - l .

In general, a code obtained from shortening a cyclic code is no longer cyclic.

Shortened codes have error detection and correction capabilities that are at least as good as the original codes.

Example:
3 Consider the (7, 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.

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.

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-l) can be decoded by a decoder similar to the original (n, k) cyclic code. (Fig. 4.4)

n- l - 1 Let r ( x ) = r0 + r1 x + L + rn- 1- l x be received polynomial.

Suppose that r(x) is shifted into the syndrome register from the right end. (Fig. 4.5(b)) If the decoding circuit for the original cyclic code is used for decoding the shortened code, the proper syndrome for decoding the received digit rn- l - 1 is equal to the remainder resulting from
n- k - l r ( x ) by the generator polynomial g(x). dividing x

Since shifting r(x) into the syndrome register from the right end
n- k is equivalent to premultiplying r(x) by x , the syndrome

register must be cyclically shifted for another l times after the entire r(x) has been shifted into the register. These extra l shifts can be eliminated by modifying the connection of the syndrome register:
n- k - l r ( x ) by g(x), we obtain Dividing x

x n - k - l r ( x ) = a1 ( x ) g ( x ) + s n - k - l ( x )
n- k - l Next, we divide x by g(x). n- k -1 Let ( x ) = 0 + 1 x + L + n- k - 1 x be the remainder resulting n- k - l + a2 ( x ) g ( x ) from this division. That is ( x ) = x ( n- k - l ) ( x) and then ( x )r ( x ) = [a1 ( x ) + a2 ( x )r ( x )]g ( x ) + s

The equation above suggests that we can obtain the syndrome

s ( n- k - l ) ( x ) by multiplying r(x) by ( x ) and dividing the product

( x )r ( x ) by g(x).
n- k - l ( x ) this way, the extra l shifts of the syndrome Computing s

register can be avoided. The circuit is shown below. (Lin / Costello, p. 117)

g1

g2

g n- k - 2

g n- k -1

n-k - 2

n- k -1

Figure 4.15 Circuit for multiply by and dividing by

( x ) = 0 + 1 x + L + n- k - 1 x n- k - 1 and dividing ( x ) r ( x ) by
g ( x ) = g0 + g 1 x + L + x n- k

4.8 CRC Codes


Cyclic Redundancy Check (CRC) Codes are error-detecting codes typically used in automatic repeat request (ARQ) systems.

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.

CRC codes are shortened cyclic codes.

Concatenated Coding System

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.

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).

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. The result is a (k+16, k) code.

Fig. 4.9. (page 178)

Figure 4.9 Systematic encoder for CCITT polynomial code with

g ( x ) = x 16 + x 12 + x 5 + 1 .

In the encoding process, two zero bytes are added to the end of the message, which are used when computing the CRC.

At the receiver the decoder simply computes the CRC of the message part and adds the results to the CRC bytes, and then tests to see whether the result equals zero.

A CRC constructed by an (n, k) cyclic code is capable of detecting any error burst of length n-k or less. Also, the fraction of undetectable error burst of length n-k+1 is

2 - ( n- k + 1) .

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

Das könnte Ihnen auch gefallen