Professional Documents
Culture Documents
Code Theroy Cyclic Codes
Code Theroy Cyclic Codes
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
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,
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 ) g ( x ) = 0 mod ( x n - 1) .
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.
g ( x ) = 1 + g 1 x + L + g n- k - 1 x n- k -1 + x n- k
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 .
c ( 1) ( x ) = xc( x ) mod ( x n - 1)
( 1) This follows from the fact that since both c(x) and c ( x ) are
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
m( x ) = m0 + m1 x + L + mk - 1 x k - 1 .
x n - k m( x ) = x n - k + m1 x n - k + 1 + L + m k - 1 x n - 1
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.
has degree n-1. Hence it is the code polynomial for the message m(x).
Note that
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
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
m = ( 1 0 1 0 ) c = (0 0 1 1 0 1 0 )
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
Table 4.5 Encoding operation for the (7, 4) cyclic encoder shown in Fig. 4.3.
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
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)
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
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.
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).
= 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.33)
r ( 1) ( x )
by
g(x),
i.e.
the
syndrome
polynomial
of
the
From (4.33)
s ( 1) ( x ) = xs( x ) mod g ( x )
(4.35)
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.
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
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 .
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)
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
( 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
( 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
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 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.
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) .
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
g( x ) = x 8 + x 2 + x + 1