By :Er. Amit Mahajan
By :Er. Amit Mahajan
CYCLIC CODES
CYCLIC CODES
CYCLIC CODES
Definition:
Definition:
An ( An (nn,, kk) linear code) linear code C C is called ais called a cyclic codecyclic code if every cyclic shift of a codeif every cyclic shift of a code
vector in
vector in C C is also a code vectoris also a code vector
Codewords can be represented as polynomials of degreeCodewords can be represented as polynomials of degree nn. For a cyclic. For a cyclic
code all codewords are multiple of some
code all codewords are multiple of some polynomialpolynomial gg(( X X ) modulo) modulo X X nn++11
such that
such that gg(( X X ) divides) divides X X nn++1.1. gg(( X X ) is called the generator polynomial.) is called the generator polynomial.
Examples:
Examples:
Hamming codes, Golay Codes, BCH codes, RS codesHamming codes, Golay Codes, BCH codes, RS codes
BCH codes were independently discovered by Hocquenghem (1959) andBCH codes were independently discovered by Hocquenghem (1959) and
by Bose and Chaudhuri (1960) by Bose and Chaudhuri (1960)
Reed-Solomon codes (non-binary BCH codes) wReed-Solomon codes (non-binary BCH codes) were independently ere independently
introduced by Reed-Solomon introduced by Reed-Solomon
Cyclic codes
Cyclic codes
are of interest and importance because
are of interest and importance because
•
•
They posses rich algebraic structure that can be utilized in a
They posses rich algebraic structure that can be utilized in a
variety of ways.
variety of ways.
•
•
They have extremely concise specifications.
They have extremely concise specifications.
•
•
They can be efficiently implemented using simple
They can be efficiently implemented using simple shift
shift
registers.
registers.
•
Notations
Notations
k = Number of binary digits i
k = Number of binary digits in the message before
n the message before
encoding
encoding
n = Number of binary digits in the encoded
n = Number of binary digits in the encoded
message
message
n –
n – k =
k = r =
r = number
number of check
of check bits
bits
r r k k n n
Basic properties of Cyclic codes:
Basic properties of Cyclic codes:
Let C be a binary (n,k) linear cyclic codeLet C be a binary (n,k) linear cyclic code
1.
1. Within the set of code polynomials in C, there is a unique monicWithin the set of code polynomials in C, there is a unique monic
polynomial
polynomial with with minimal minimal degree degree is is called called the the generator generator polynomials.
polynomials.
2.
2. Every code Every code polynomial polynomial in in C, C, can can be be expressed expressed uniquely uniquely asas
3.
3. The generator The generator polynomial polynomial is is a a factor factor of of
4.
4. The orthogonality of The orthogonality of GG andand HH in polynomial form is expressed asin polynomial form is expressed as
.
. This
This means
means
is
is also
also a
a factor
factor of
of
)) (( X X g g r r <<nn.. gg((X X )) r r r r X X g g X X g g g g X X )) == ++ ++...++ (( 00 11 g g )) (( X X U U )) (( )) (( )) (( X X mm X X gg X X U U == )) (( X X g g 1 1 + + n n X X 1 1 )) (( )) (( X X hh X X == X X nn ++ g g hh(( X X )) X X nn ++11
Polynomial Representation of Binary Information
Polynomial Representation of Binary Information
It is convenient to think
It is convenient to think of binary digits as
of binary digits as
coefficients of a polynomial in the
coefficients of a polynomial in the dummy
dummy
variable X.
variable X.
Polynomial is
Polynomial is written low-order-to-high-
written
low-order-to-high-order.
order.
Polynomials are treated according to the laws
Polynomials are treated according to the laws
of ordinary algebra with an
of ordinary algebra with an exception addition
exception addition
is to be done
Types of Cyclic Codes
Types of Cyclic Codes
There are two types of Cyclic Codes on basis of
There are two types of Cyclic Codes on basis of
Encoding:
Encoding:
Non-Systematic Encoding:
Non-Systematic Encoding:
Information bits are not packed together in the
Information bits are not packed together in the
codeword. These are rarely used.
codeword. These are rarely used.
c(x)= i(x) g(x)
c(x)= i(x) g(x)
Systematic Encoding:
Systematic Encoding:
Information bits are packed together in the codeword.
Information bits are packed together in the codeword.
c(x)= i(x) x
8
8
Systematic Encoding
Systematic Encoding
Systematic encoding algorithm for an (n,k)
Systematic encoding algorithm for an (n,k)
Cyclic code:
Cyclic code:
1.
1.
Multiply the
Multiply
the message
message polynomial
polynomial
by
by
2.
2.
Divide the result of Step 1 by the generator
Divide the result of Step 1 by the generator
polynomial
polynomial
.
. Let
Let
be
be the
the remainder.
remainder.
3.
3.
Add
Add
to
to
to
to form
form the
the codeword
codeword
))
((
X X ii X X nn−−k k))
((
X Xg
g
r r((
X X))
))
((
x x ii X X nn−−k k))
((
X X C C))
((
X X r rImplementation
Implementation
The hardware to implement this algorithm is a shift
The hardware to implement this algorithm is a shift
register and a collection of modulo
register and a collection of modulo two adders.
two adders.
The number of shift register positions is equal to the
The number of shift register positions is equal to the
degree of the divisor, G(X), and the dividend is shifted
degree of the divisor, G(X), and the dividend is shifted
through high order first and left to right.
Circuit for encoding systematic cyclic codes
Circuit for encoding systematic cyclic codes
x
x WWe noticed earlier that e noticed earlier that cyclic codes can cyclic codes can be generated by using be generated by using shift registersshift registers
whose feedback coefficients are determined directly by the generating whose feedback coefficients are determined directly by the generating polynomial
Example
Example
Decoding cyclic codes
Decoding cyclic codes
Every valid, received code wordEvery valid, received code word R R (p)(p) must be a multiple of must be a multiple of GG(p),(p), otherwiseotherwise
an error has occurred. (Assume that the probability of noise to convert code an error has occurred. (Assume that the probability of noise to convert code words to other code words is very small.)
words to other code words is very small.)
Therefore dividing theTherefore dividing the R R (p)/ (p)/ GG(p)(p) and considering the remainder as aand considering the remainder as a
syndrome can reveal if an error
syndrome can reveal if an error has happened and sometimes also to reveal inhas happened and sometimes also to reveal in which bit (depending on code strength)
which bit (depending on code strength)
Division is accomplished by a shift registersDivision is accomplished by a shift registers
The error syndrome of q=The error syndrome of q=n-k n-k bits is thereforebits is therefore
[ [
]]
(( ))
p
p
==m
mo
od
d
(( )) //
p
p
(( ))
p
p
S
Decoding cyclic codes: error correction
Decoding circuit for (7,4) code
Decoding circuit for (7,4) code
syndrome computation
syndrome computation
x
x To start with, the switch is at “0” positionTo start with, the switch is at “0” position
x
x Then shift register is stepped until all the received code bits have entered theThen shift register is stepped until all the received code bits have entered the
register register x
x This results is a 3-bit syndrome (This results is a 3-bit syndrome (nn -- k k = 3 ):= 3 ):
that is then left to the register that is then left to the register x
x Then the switch is turned to the position “1” that drives the syndrome out of Then the switch is turned to the position “1” that drives the syndrome out of thethe
register register
[ [
]]
(( ))
p
p
==m
mo
od
d
(( )) //
p
p
(( ))
p
p
S
S
R
R
G
G
Decoding
Decoding
Encoder and Decoder
Advantages of Cyclic codes
Advantages of Cyclic codes
Simplified encoding.
Simplified encoding.
Easy syndrome calculation S(p) =
Easy syndrome calculation S(p) = rem{Y(p)/G(p)}
rem{Y(p)/G(p)}
Ingenious error correcting decoding methods have been
Ingenious error correcting decoding methods have been devised for
devised for
specific cyclic codes. They eliminate the storage needed for t
specific cyclic codes. They eliminate the storage needed for table
able
lookup.
lookup.
Cyclic Redundancy Co
Cyclic Redundancy Codes (CRC), a class of cyclic
des (CRC), a class of cyclic codes, has ability to
codes, has ability to
detect burst errors of length ‘q’, all
detect burst errors of length ‘q’, all single bit errors, any odd number of
single bit errors, any odd number of
errors if (p+1) is a factor
errors if (p+1) is a factor of G(p), Double errors if G(p) has at
of G(p), Double errors if G(p) has at least
least
three 1’s.
three 1’s.
Cyclic codes for error detection provides high efficiency and the ease of
Cyclic codes for error detection provides high efficiency and the ease of
implementation.
implementation.
Some block codes that can be realized by cyclic codes
Some block codes that can be realized by cyclic codes
(n,1)(n,1) Repetition codesRepetition codes. High coding gain (minimum . High coding gain (minimum distance alwaysdistance always n
n--1), but very low rate: 1/ 1), but very low rate: 1/nn
(n,k)(n,k) Hamming codesHamming codes. Minimum distance always 3. Thus can detect 2. Minimum distance always 3. Thus can detect 2
errors and correct one error.
errors and correct one error. n=2n=2mm-1, k = n - m,-1, k = n - m,
Maximum-length codesMaximum-length codes. For every integer there exists a . For every integer there exists a maximummaximum
length code (
length code (n,k n,k ) with) with n = 2n = 2k k - 1,d - 1,d m
miinn = 2= 2kk--11 ..
BCH-codesBCH-codes. For every integer there exist a . For every integer there exist a code withcode with nn = 2= 2mm-1,-1,
and where
and where t t is the error correction capabilityis the error correction capability
((n,k n,k )) Reed-Solomon (RS) codesReed-Solomon (RS) codes. Works with. Works with k k symbolssymbols that consists of that consists of
m
m bits that are encoded to yield code words of bits that are encoded to yield code words of nn symbolssymbols..
Nowadays BCH and RS are very popular due to large Nowadays BCH and RS are very popular due to large d d mmiinn , large number , large number of codes, and easy generation
of codes, and easy generation
Code selection criteria: number of codes, correlation properties, codeCode selection criteria: number of codes, correlation properties, code
gain, code rate, error
Reference:
Reference:
1.
1.
Communication
Communication Systems
Systems by
by R.P
R.P Singh
Singh ,
, S.D
S.D Sapre
Sapre
2.
2.
Information Theory , Coding and Cryptography by Ranjan Bose
Information Theory , Coding and Cryptography by Ranjan Bose
3. 3.