Você está na página 1de 94

CYCLIC CODES

Cyclic codes
• Important subclass of linear codes
• Encoding and syndrome computing circuits
can be implemented easily by employing shift
registers with feedback
• Because of the inherent algebraic structure, it
is possible to find different practical methods
to decode them
Description of cyclic Codes
• An n-tuple v is

v  (v0 , v1,v2 ,...vn3 , vn2 , vn1 )


• If the components are cyclically shifted 1 place
to the right (or n-1 positions to the left)

v  (vn 1 , v0 , v1,v2 ,...vn 3 , vn 2 )


1
Description of cyclic Codes
• If the components are cyclically shifted i place
to the right (or n-i positions to the left)

v  (vn i , vn i 1,vn i  2 ,...vn 1, , v0 , v1,v2 ,...vn i 1 )


i
Definition of cyclic Codes
An (n,k) linear code C is cyclic if every cyclic shift
of a code vector in C is also a code vector in C
Code Polynomial v(X)
• The components of the code vector

v  (v0 , v1,v2 ,...vn2 , vn1 )


can be considered as the coefficients of the
polynomial
n 2 n 1
v( X )  v0  v1 X  v2 X  .....  vn 2 X
2
 vn 1 X
1
Relation between v ( X ) & v( X )

v( X )  v0  v1 X  v2 X 2  .....  vn 2 X n 2  vn 1 X n 1
Xv( X )  v0 X  v1 X 2  v2 X 3  .....  vn  2 X n 1  vn 1 X n
 v0 X  v1 X 2  v2 X 3  .....  vn  2 X n 1  vn 1 X n  vn 1  vn 1
 vn 1 ( X n  1)  vn 1  v0 X  v1 X 2  v2 X 3  .....  vn 2 X n 1
 vn 1 ( X n  1)  v1 ( X )
i
Relation between v ( X )& v( X )

X i v( X )  q ( X )( X n  1)  v i ( X )
Algebraic Properties of Cyclic Codes

Theorem 1
The nonzero code polynomial of minimum
degree in cyclic code C is unique

g( X )  g0  g1 X  g2 X 2  .....  gr 1 X r 1  gr X r
Algebraic Properties of Cyclic Codes

Theorem 2
For the nonzero code polynomial of minimum
degree
g( X )  g0  g1 X  g2 X 2  .....  gr 1 X r 1  gr X r

g0  1
Code Polynomial v(X) as multiple of g(X)

We have the relation


X v( X )  q ( X )( X  1)  v ( X )
i n i

Xg( X )  g ( X );
1

X 2 g( X )  g2 ( X )......
X n r 1 g( X )  gn r 1( X )
So Xg( X ), X 2 g( X ),..., X nr 1 g( X ) are code
polynomials.
Linear combination of the code
polynomials = another code polynomial
(linearity property)
V ( X )  u0 g( X )  u1 Xg( X )  u2 X 2 g( X )  ...  un r 1 X n r 1 g( X )

V ( X )  (u0  u1 X  u2 X 2  ...  un r 1 X n r 1 ) g( X )
Algebraic Properties of Cyclic Codes

Theorem 3

r 1
Let g( X )  g0  g1 X  g2 X 2
 .....  gr 1 X  gr X r

be the nonzero code polynomial of minimum


degree in an (n,k) cyclic code C . A binary
polynomial of degree n -1 or less is a code
polynomial if and only if it is a multiple of g(X)
Degree of nonzero code polynomial of
minimum degree
The number of binary polynomials of
degree n-1 or less that are multiples of g(X)
is 2n  r
k
This code polynomials are 2 code
polynomials of (n,k) cyclic code

2n  r k
 2 ;r  n  k
General form of nonzero code polynomial
of minimum degree

n  k 1 n k
g( X )  1  g1 X  g2 X  .....  gn k 1 X
2
X
Algebraic Properties of Cyclic Codes

Theorem 4
In an (n,k) cyclic code C, there exists one and
only one code polynomial of degree n-k
n  k 1 n k
g( X )  1  g1 X  g2 X  .....  gn k 1 X
2
X

Every code polynomial is a multiple of g(X), and


every binary polynomial of degree n-1 or less
that is multiple of g(X) is code polynomial
Generator polynomial of (n,k) Cyclic code
v( X )  u( X )g( X )

V ( X )  (u0  u1 X  u2 X 2  ...  uk 1 X k 1 ) g( X )

(n,k) cyclic code is completely specified by


g(X)
Algebraic Properties of Cyclic Codes

Theorem 5

The generator polynomial of an (n,k) cyclic code


C is a factor of X n  1
Proof
k n k
X g( X )  ( X  1)  g ( X )
k
g ( X )  a( X ) g( X )
k n
X g( X )  ( X  1)  a( X ) g( X )
n k
( X  1)  X g( X )  a( X ) g( X )
n k
( X  1)  {X  a( X )}g( X )
Algebraic Properties of Cyclic Codes

Theorem 6

If g(X) is a polynomial of degree n-k and is


factor of X n  1 , then g(X) generates an
(n,k) cyclic code
Cyclic Code in Systematic Form

n-k Parity Bits nk Message Bits

Let u  (u , u , u ..., u )
0 1 2 k 1
be the message to encoded
u( X )  u  u X  u X 2  ...  u X k 1
0 1 2 k 1

X n  k u( X )  u0 X n  k  u1X n  k  1  u2 X n  k  2  ...  uk  1X n  1

X n  k u( X )  a( X ) g( X )  b( X )
Cyclic Code in Systematic Form
b( X )  X n  k u( X )  a( X ) g( X )

b0  b1X  b2 X 2  ...  bn  k  1X n  k  1  u0 X n  k  u1X n  k  1

u2 X n  k  2  ...  uk  1X n  1  a( X ) g( X )

(b0 ,b1,b2 ,...bnk 1, u0, , u1, .....uk 1 )


Steps to obtain a Cyclic Code in
Systematic Form

1. Premultiply u( X ) by X n  k
2. Obtain b(X) by dividing X n  k u( X ) by g(X)
3. Obtain the code polynomial by combining
b(X) and X n  k u( X )
Example

Consider the (7,4) cyclic code generated by


g( X )  1  X  X 3 . Obtain the code word in
systematic form for the message 0101
Generator and Parity Check Matrices
of (n,k) Cyclic Codes
n  k 1 n k
g( X )  1  g1 X  g2 X  .....  gn k 1 X
2
X

Every code polynomial can be expressed as a


linear combination of k code polynomials

g( X ), Xg( X ), X 2 g( X )......., X k 1 g( X )
These code polynomials span the (n,k) code
Generator Matrix of (n,k) Cyclic Code

If the n-tuples corresponding to these code


polynomials are used as the k rows of k X n
matrix , we get the generator matrix of the (n,k)
code.
Generator Matrix of (n,k) Cyclic Code
Generator Matrix of (7,4) Cyclic Code
generated by g( X )  1  X  X 3

1 1 0 1 0 0 0
0 1 1 0 1 0 0 
G 
0 0 1 1 0 1 0
 
0 0 0 1 1 0 1
Generator Matrix of (7,4) Cyclic Code
generated by g( X )  1  X  X 3
in
systematic form

1 1 0 1 0 0 0
0 1 1 0 1 0 0 
G'   
1 1 1 0 0 1 0
 
1 0 1 0 0 0 1
Parity Check Matrix of (n,k) Cyclic
Code

g(X) of (n,k) code is a factor of X n  1

( X  1)  h( X )g( X )
n

h( X )  h0  h1 X  h2 X 2  .....  hk 1 X k 1  hk X k
h0  hk  1
Parity Check Matrix of (n,k) Cyclic
Code

Let v  (v0 , v1,v2 ,...vn3 , vn2 , vn1 ) be a


codeword of (n,k)code

v( X )  a( X ) g( X )
h( X )v( X )  a( X ) g( X )h( X )
 a( X )( X  1)
n

 a( X )  a( X )X n
Parity Check Matrix of (n,k) Cyclic
Code

k 1
v( X )h( X )  a0  a1 X  a2 X  .....  ak 1 X
2

k 1
(a0  a1 X  a2 X  .....  ak 1 X
2
)X n

k 1
 a0  a1 X  a2 X  .....  ak 1 X
2

n 1 n2 n  k 1
a0 X  a1 X
n
 a2 X  .....  ak 1 X
Parity Check Matrix of (n,k) Cyclic
Code
k
 hi vn i  j  0; for1  j  n  k
i 0
The reciprocal of h(X) is defined as

X k h( X 1 )  hk  hk 1 X  hk 2 X 2  .....  h0 X k
Parity Check Matrix of (n, k) Cyclic Code

X k h( X 1 ) is a factor of X n  1

X k h( X 1 ) generates (n, n-k) code


Generator matrix of (n, n-k) Cyclic
code

 hk hk 1 hk  2 . h0 0 . 0
0 hk hk 1 . . h0 . 0 
H 
. . . . . . . .
 
0 . 0 hk hk 1 . h1 h0 
Parity Polynomial of (n,k) Cyclic Code
• Any codeword v in C is orthogonal to every
row of H
• Therefore H is the parity check matrix of the
cyclic code C and the row space of H is the
dual code of C
• Since the parity check matrix H is obtained
from the polynomial h(X), h(X) is called the
parity polynomial of C
Parity Polynomial of (n,k) Cyclic Code

h( X )  h0  h1 X  h2 X 2  .....  hk 1 X k 1  hk X k
h0  hk  1
Theorem 7

Let C be an (n,k) cyclic code with generator


polynomial g(X). The dual code of C is also cyclic
k 1
and is generated by the polynomial X h( X )
where h( X )  X n  1/ g ( X )
Example
• Consider the (7,4) cyclic code generated by
the generator polynomial g( X )  1  X  X 3 .
Find the dual code
Generator Matrix in Systematic Form

X n  k  i  ai ( X ) g ( X )  bi ( X ); i  0,1,......k 1
n  k 1
bi ( X )  bi 0  bi1X  bi 2 X  ...  bi,n k 1X
2

bi ( X )  X n  k  i  ai ( X ) g ( X )
Generator Matrix of (n,k) Cyclic Code
in Systematic Form
 b00 b01 b02 . . b0,n k 1 1 0 . . 0
 b b11 b12 . . b1,n k 1 0 1 . . 0 
 10
 . . . . . . . . . . .
 
 . . . . . . . . . . .
bk 1,0 bk 1,1 bk 1,2 . . bk 1,n k 1 0 0 . . 1 

Parity check Matrix of (n, k) Cyclic
Code in Systematic Form

1 0 . 0 b00 b10 . . bk 1,0 


0 1 . 0 b b . . bk 1,1  
H  01 11
.
. . . . . . . . . 
 
0 . . 1 b0,nk 1 b1,n k 1 . . bk 1,n k 1 
Example
• Consider the (7,4) cyclic code generated by
the generator polynomial g( X )  1  X  X 3 .
Find the generator matrix in systematic form
Encoding of (n, k) Cyclic Code

Encoding circuit for an (n, k) cyclic code with the


nk
generator polynomial g ( X )  1  g1 X  g 2 X 2
 ...  X
Steps to obtain a Cyclic Code in
Systematic Form

1. Premultiply u( X ) by X n k
2. Obtain b( X ) by dividing X n  k u( X ) by g ( X )
3. Obtain the code polynomial by combining b( X ) and
X n  k u( X )
Encoding steps
• Initially Gate is turned on and the ‘k’ information
digits are shifted into the register from the right
end and the channel simultaneously. Shifting the
message u( X ) from the right end is equivalent to
multiply it by X n  k . The contents of the shift
register are the parity check digits
• Then Gate is turned off and the parity-check
digits are shifted one by one to the channel
Encoding of (7, 4) Cyclic Code

b  u b b
1(new) i 0 2
b0 b1 b2 u
b  u b b b i
0(new) i 2 2(new) 1
v

Encoding circuit for an (n, k) cyclic code with the


generator polynomial g( X )  1  X  X 3
• Suppose the message 1011 is to be encoded
Input Register Contents (b0,b1, b2)
 u  b ) (b b )
(ui) i 2 1(new)  ui  b2  b0 ) 2(new) 1
(b (b
0(new)

0 0 0
(Initial Condition)
1 1 1 0
(First Shift)

1 1 0 1
(Second Shift)
• Suppose the message 1011 is to be encoded
Input Register Contents (b0,b1, b2)
 u  b ) (b b )
(ui) i 2 1(new)  ui  b2  b0 ) 2(new) 1
(b (b
0(new)

1 1 0 1
(Second Shift)

0 1 0 0
(Third Shift)

1 1 0 0
(Fourth Shift)
Encoding of (n, k) Cyclic Code using
Parity Polynomial

Encoding circuit for an (n, k) cyclic code using parity


polynomial h( X )  h  h X  ...  h X k
0 1 k
Encoding steps
• Initially Gate 1 is turned on and Gate 2 is turned
off and the ‘k’ information digits are shifted into
the register and the channel simultaneously
• Then Gate 1 is turned off and Gate 2 is turned on
and the first parity-check digit is formed at P
• The register is shifted once. The second parity-
check digit is formed at P
• The register is shifted again, until all parity-digits
are formed .
k
 hi vn i  j  0; for1  j  n  k
i 0
k 1
vn  k  j   hi vn i  j  0; for1  j  n  k Difference Equation

i 0
v  (v0 , v1,v2 ,...vnk 1 , vnk , vnk 1 ,....vn1 )
v  (v0 , v1,v2 ,...vnk 1 , u0 , u1 ,....uk 1 )
vn  k 1  h0vn 1  h1vn  2  .......  hk 1vn  k
 uk 1  h1uk  2  .......  hk 1u0
k 1
vn  k  j   hi vn i  j  0; for1  j  n  k
i 0

v  (vn k 1 , v0, v1, v2 ,...vn  k 1 , vn k , vn k 1 ,....vn2 )


v  (vn k 1 , v0, v1, v2 ,...vn  k 1 , u0 , u1 ,....uk 2 )

vn  k  2  h0vn  2  h1vn 3  .......  hk 1vn  k 1


 uk  2  h1uk 3  ....  hk  2u0  hk 1vn  k 1
k 1
vn  k  j   hi vn i  j  0; for1  j  n  k
i 0

vn  k  2  h0vn  2  h1vn 3  .......  hk 1vn  k 1


 uk  2  h1uk 3  ....  hk  2u0  hk 1vn  k 1
Encoding of (7, 4) Cyclic Code

Encoding circuit for an (n, k) cyclic code using parity


polynomial h( X )  1  X  X 2  X 4
• Suppose the message 1011 is to be encoded

0 0 1

0 0 1
1 0 1 1

OFF

• The bit formed at point P is ‘0’ and it is the


first parity bit shifted into the channel and
also the register is shifted to the right
1 1 0

1 0 1
0 0 1 0

OFF

• The bit formed at point P is ‘1’ and it is the


third parity bit shifted into the channel and
the register Gate 1 is turned on to encode the
next message.
• The codeword is 1001011
Syndrome computation and Error
Detection
• The received vector ‘r’ can be taken as a
polynomial of degree ‘n-1’ or less
n2 n 1
r ( X )  r0  r1 X  r2 X  .....  rn 2 X
2
 rn 1 X

r ( X )  a( X ) g ( X )  s( X )
• s(X) is polynomial of degree n-k-1 or less
• s(X) is identical to zero if and only if r(X) is a
code polynomial . s(X) is called the syndrome
Syndrome computation and Error
Detection

An (n - k) stage syndrome circuit with input from the left


end
i
Relation between v ( X )& v( X )

X v( X )  q( X )( X  1)  v ( X )
i n i

q( X )  vni  vni 1 X  .........  vn1 X i 1


1
Relation between v ( X ) & v( X )

v( X )  v0  v1 X  v2 X 2  .....  vn 2 X n 2  vn 1 X n 1
Xv( X )  v0 X  v1 X 2  v2 X 3  .....  vn  2 X n 1  vn 1 X n
 v0 X  v1 X 2  v2 X 3  .....  vn  2 X n 1  vn 1 X n  vn 1  vn 1
 vn 1 ( X n  1)  vn 1  v0 X  v1 X 2  v2 X 3  .....  vn 2 X n 1
 vn 1 ( X n  1)  v1 ( X )
Syndrome computation and Error
Detection
Theorem 8
Let s(X) be the syndrome of a received polynomial
n2 n 1
r ( X )  r0  r1 X  r2 X  .....  rn 2 X
2
 rn 1 X

The remainder resulting from dividing Xs(X) by the generator


polynomial g(X) is the syndrome of r1(X), which is a cyclic
shift of r(X)

Xr ( X )  rn1 ( X  1)  r ( X )
n 1

r1 ( X )  rn1 ( X n  1)  Xr ( X )
Syndrome computation and Error
Detection
Xr ( X )  rn1 ( X n  1)  r1 ( X )
r ( X )  rn1 ( X  1)  Xr ( X )
1 n

r1 ( X )  c( X ) g ( X )   ( X )
Rg ( X ) [r ( X )]   ( X )
1
Syndrome computation and Error
Detection
r1 ( X )  c( X ) g ( X )   ( X )
r ( X )  rn 1 ( X  1)  Xr ( X )
1 n

c( X ) g ( X )   ( X )  rn 1 g ( X )h( X )  Xr ( X )
c( X ) g ( X )   ( X )  rn 1 g ( X )h( X )  X {a( X ) g ( X )  s( X )}
 {rn 1h( X )  Xa( X )}g ( X )  Xs( X )
Xs( X )  {c( X )  rn 1h( X )  Xa( X )}g ( X )   ( X )
Syndrome computation and Error
Detection

Rg ( X ) [ Xs( X )]   ( X )

Rg ( X ) [r1 ( X )]   ( X )
Syndrome computation and Error
Detection
• We can obtain the syndrome s1(X) of r1(X) by
shifting the syndrome register once with s(X) as
the initial contents with the input gate disabled.
• Shifting the syndrome register once with s(X) as
the initial contents is equivalent to dividing Xs(X)
by g(X)
• The syndrome si(X) of ri(X) is obtained by shifting
the syndrome register ‘i’ times with s(X) as the
initial contents with the input gate disabled.
Syndrome circuit for (7,4) Cyclic Code

s0( new)  ri  s2 s1( new)  s2  s0 s2( new)  s1


ri
s0 s1 s2

Syndrome circuit for an (7, 4) cyclic code with the


generator polynomial g ( X )  1  X  X 3
Suppose r = 0010110
Shift Input Register Contents (s0, s1, s2)
(ri) ( s0( new)  ri  s2 ) ( s1( new)  s2  s0 ) ( s2( new)  s1 )
0 0 0 (Initial state)
1 0 000
2 1 100
3 1 110
4 0 011
5 1 011
6 0 111

7 0 10 1 (syndrome s)
8 - 100 (syndrome s1 )
9 - 010 (syndrome s2 )
Decoding of Cyclic Codes
• Syndrome Computation

• Association of syndrome with an error


pattern

• Error correction
Decoding of Cyclic Codes
• A Straightforward approach to the design of
a decoding circuit is via a combinational logic
circuit that implements the table look-up
procedure
• The complexity of the decoding circuit tends
to grow exponentially with the code length
and the number of errors to be corrected
Decoding of Cyclic Codes

• Cyclic codes have considerable algebraic and


geometric properties
• Proper usage of this properties simplifies the
decoding circuitry
• The cyclic structure allows serial decoding.
Each digit is decoded with the same circuitry
Parts of the Decoding Circuitry
• Syndrome register

• An error pattern detector

• Buffer register to hold received vector


Meggitt
Decoder
Decoding Steps of Cyclic Codes
r ( X )  a( X ) g ( X )  s( X )
r ( X )  v ( X )  e( X )
 b ( X ) g ( X )  e( X )
e( X )  [a( X )  b( X )]g ( X )  s( X )
s ( X )  Rg ( X ) [e( X )]
s ( X )  Rg ( X ) [r ( X )]
Decoding Steps of Cyclic Codes

• Since g(X) ≠ X times ( polynomial of degree n-k-1),


and g(X) is factor of Xn+1, g(X) and Xj are
relatively prime

X  Rg ( X ) [ X ];0  j  n 1
j j
• The syndrome s11 (X) of r11 (X) is the
remainder obtained by dividing X[s(X)+Xn-1 ]
by g(X)
Rg ( X ) [ Xs ( X )]  s ( X ); Rg ( X ) [ X ]  1
1 n

s ( X )  s ( X ) 1
1
1 1

• If 1 is added to the left end of the syndrome


register while it is shifted we get s11 (X)
• The decoding circuitry proceeds to decode the
received digit rn-2 . The decoding of rn-2 and
the other received digits is identical to the
decoding of rn-1
• Whenever an error is detected and corrected ,
its effect on the syndrome is removed.
• The decoding steps stop after a total of ‘n’
shifts.
• If e(X) is a correctable error pattern, the
contents of the syndrome register should be
zero at the end of the decoding operation,
and the received vector v(X) has been
correctly decoded
• If it is not zero an uncorrectable error pattern
has been detected.
Decoding Steps of Cyclic Codes
• Syndrome computation
• Checks whether syndrome corresponds to a correctable
error pattern
e( X )  e0  e1 X  e2 X 2  .....  en 2 X n 2  en 1 X n 1
with an error at the highest order position
( en 1  1)

• If not , the received polynomial buffer register and the


syndrome register are cyclically shifted once
simultaneously
Decoding Steps of Cyclic Codes
• Now the buffer register contains

r1 ( X )  rn 1  r0 X  r1 X 2  .....  rn 3 X n 2  rn 2 X n 1

• The syndrome register content is s1 ( X )

• The decoding circuitry checks whether syndrome


corresponds to a correctable error pattern with an
error location at X n 1 (same as en 1  1 )
Decoding Steps of Cyclic Codes
• If the syndrome corresponds to an errror pattern with
an error at X n 1 , ( en 1  1 ) the first digit rn 1
is an erroneous digit and it must be corrected.

• The correction is carried out by taking the sum


rn 1  en 1

• This correction results in a modified received


polynomial
r1 ( X )  r0  r1 X  r2 X 2  .....  rn 2 X n2  (rn 1  en 1 ) X n1
Decoding Steps of Cyclic Codes
• The effect of the digit en 1  1 on the syndrome is removed by
adding the syndrome of the error pattern e1 ( X )  X n1 to
s(X)

• This syndrome is the syndrome of the modified received


polynomial
r1 ( X )  r0  r1 X  r2 X 2  .....  rn 2 X n2  (rn 1  en 1 ) X n1

• Now r ( X ) and the syndrome register are cyclically shifted


1

simultaneously. This shift results in a received polynomial

r11 ( X )  (rn 1  en 1 )  r0 X  r1 X 2  ..  rn  2 X n 1
Meggitt
Decoder
Step1 of Decoding

• Syndrome is formed by shifting the entire


received vector into the shift register. The
received vector is simultaneously stored in the
buffer register
Step 2 of Decoding

• The syndrome is read into the detector and is


tested for the corresponding error pattern.
• Detector is a combinational circuit with o/p ‘1’
if the rightmost bit in the buffer register is in
error and is ‘0’ if it is not in error.
Step 3 of Decoding

• The buffer register and syndrome register are


shifted once.
• The first received symbol shifted out from the
register gets corrected by adding it with the
detector output if it is in error. The syndrome
also gets modified by the detector o/p.
• The new syndrome corresponds to the altered
received vector shifted one place to the right
Step 4 of Decoding

• The new syndrome formed in step 3 is used to


detect whether the second received symbol is
an erroneous symbol. The decoder repeats
steps 2 and 3. The second received symbol is
corrected exactly in the same manner as the
first received symbol was corrected.
Step 5 of Decoding

• The decoder decodes the received vector


symbol by symbol in the same manner
outlined until the entire received vector is read
out of the buffer register
OFF
s0( new)  do  s2

s1( new)  s2  s0

s2( new)  s1
Meggitt
Decoder
For (7,4)
Cyclic code
Decoding of (7, 4) Cyclic Code
Example
• Suppose that the codeword v = (1001011) is
transmitted and r=(1011011) is received . A
single error occurs at location X2 .
Decoding of (7, 4) Cyclic Code
generated by g ( X )  1  X  X
3
s0( new)  do  s2
do

s1( new)  s2  s0

s2( new)  s1
Gate

g0 g1 gn-k-1

b0 + b1 + b2 + bn-k-1
+

Você também pode gostar