You are on page 1of 32

CYCLIC CODE

Submitted By:
Farida Mohamed Ahmed 18P1474
Hagar Ahmed Mohamed 18P6623
Mariam Hany Wadie 18P5465
Nada Ayman Abd El Qader 18P3028
Rahma Ahmed Hesham 18P9374

Submitted To:
Dr. Fatma Newagy
Eng. Moustafa Mohamed

1
Main Concept
• Cyclic Code properties
• Encoding
• Decoding
Agenda Encoder & Decoder Circuit Design

Advantages & Disadvantages

Standards & Applications


Cyclic Code
 Subclass of linear block code
Properties:

 Linearity property

The Sum of two codewords gives another codeword

→ Ex: {101 , 110,011} → 101 + 110 = 011

→ 101 + 011 = 110

→ 110 + 011 = 101


Cyclic Shifting Property

Cyclic shifting of any codeword right or left by any number of bits gives another codeword

Ex: {000,011,101,110}  shifting 011 right by 1 bit gives 101

 shifting 101 right by 1 bit gives 110

 shifting 110 right by 1 bit gives 011

 shifting 000 right by 1 bit gives 000


Cyclic codes

Encoding Decoding

Cyclic encoders Cyclic


Syndrome
Systematic Non-systematic Circuit (shift Decoders
decoding
register) Circuit (shift
(error pattern)
register)

Generator
Division Generator Multiplicatio
matrix
method matrix method n method
method
Non-systematic Codeword

 In Non-Systematic codeword

→ codeword ≠ [msg, parity]


 Else msg and parity bits are not in sequence.
Cyclic code for non-systematic codeword
(Multiplication Method)
 How to get codeword?

c(x) = m(x)*g(x) , m(x)  message polynomial

, g(x)  generator polynomial

, c(x)  codeword polynomial


Note:
• How to get polynomials from bits
Ex: msg polynomial from msg bits, msg = 1011
 1st (least significant) bit corresponds to x0
 2nd bit corresponds to x1
 3rd bit corresponds to x2
 4th (most significant) bit corresponds to x3

‫ ؞‬polynomial of the msg = 1(x ) + 0(x ) + 1(x ) + 1(x ) = x + x + 1


3 2 1 0 3 1
Cyclic Code for non-systematic codeword
(Multiplication Method)
 Ex: construct Non-Systematic codeword (7,4) using cyclic codes , generator polynomial

, msg = 1010

 msg polynomial =
 c(x) = m(x)*g(x) =

(note: we use modulo 2 sum x3 + x3 = 0)


 Then get codeword bits from codeword polynomial
Coeff. of = 0 Coeff. of = 1
Coeff. of = 1 Coeff. of = 1
Coeff. of = 0 Coeff. of = 1 → codeword bits = 1110010
Coeff. of = 0
Cyclic Code for non-systematic codeword
(Generator Matrix Method)

 How to get codeword?!


c = m*g , m  message matrix
, g generator matrix
, c codeword matrix
Cyclic Code for non-systematic codeword
(Generator Matrix Method)
 Getting Generator matrix from generator polynomial:
• G is of size nxk
• Rows of generator matrix is given by {Ri = xk-1 g(x)} , i= 1, 2…,k
• EX: construct generator matrix (7,4), generator polynomial = x3 + x + 1
 i=1 , R1 = x3(x3 + x + 1) = x6 + x4 + x3 , R1 matrix = [ 1011000]

 i=2 , R2 = x2(x3 + x + 1) = x5 + x3 + x2 , R1 matrix = [ 0101100]

 i=3 , R3 = x1(x3 + x + 1) = x4 + x2 + x1 , R1 matrix = [ 0010110]

 i=4 , R1 = x0(x3 + x + 1) = x3 + x + 1, R1 matrix = [ 0001011]


Cyclic code for non-systematic codeword
(Generator Matrix Method)

R1 1 0 1 1 0 0 0

• G= R2 = 0 1 0 1 1 0 0
0 0 1 0 1 1 0
R3
0 0 0 1 0 1 1
R4
Cyclic code for non-systematic codeword
(Generator Matrix Method)
 EX: construct Non-Systematic codeword (7,4) using cyclic codes, generator polynomial
g(x) = x3 + x + 1, msg = 1011
G= 1 0 1 1 0 0 0
0 1 0 1 1 0 0
0 0 1 0 1 1 0
0 0 0 1 0 1 1

1 0 1 1 0 0 0
C =m * G = [1011]
0 1 0 1 1 0 0
0 0 1 0 1 1 0
0 0 0 1 0 1 1

=1000101
Cyclic code for systematic codeword
(Division Method)
 In Systematic codeword
codeword = [msg, parity]
 How to get codeword?!
c(x) = xn-k m(x) + p(x) , p(x) = rem [/g(x)]
, m(x)  message polynomial
, g(x)  generator polynomial
, c(x)  codeword polynomial
Cyclic code for systematic codeword
(Division Method)
 Ex: construct Systematic codeword (7,4) using cyclic codes, generator polynomial
g(x) = x3 + x2 + 1, msg = 1010
 msg polynomial = x3 + x
 c(x) = xn-k m(x) + p(x) , p(x) = rem [/g(x)] , n= 7 & k =4
 /g(x) = x3 (x3 + x ) / (x3 + x2 + 1 ) = ( x6 + x4) / (x3 + x2 + 1 )
x3 + x2 + 1
x3 + x2 + 1 x 6 + x4
x 6 + x5 + x 3
x5 + x4 + x3
x5 + x4 + x2
x3 + x 2

‫؞‬ p(x) = rem [/g(x)] = 1


x3 + x2 +1
1
c(x) = xn-k m(x) + p(x) = x6 + x4 +1
Cyclic code for systematic codeword
(Division Method)
 Then get codeword bits from codeword polynomial
Coeff. of x0 = 1
Coeff. of x1 = 0
Coeff. of x2 = 0
Coeff. of x3 = 0
Coeff. of x4 = 1
Coeff. of x5 = 0
Coeff. of x6 = 1  codeword bits = 1010 001
msg Parity
bits
Cyclic code for systematic codeword
(Generator Matrix Method)

 In Systematic codeword
codeword = [msg , parity]
 How to get codeword?!
c= m* g , m  message matrix
, g generator matrix
, c codeword matrix
Cyclic code for systematic codeword
(Generator Matrix Method)
 Getting Generator matrix from generator polynomial:
• G = [I : P], G is of size nxk
• Identity matrix is of size kxk
• To get parity matrix → 1st row : rem [/g(x)]
→ 2.nd row : rem [/g(x)]
..

→ kth row: rem [/g(x)]


Cyclic code for systematic codeword
(Generator Matrix Method)
 Generator Matrix:
• Ex: construct generator matrix (7,4), generator polynomial = x3 + x + 1
To get parity matrix → 1st row : rem [ / (x3 + x + 1)]
x3 + x + 1
x3 + x + 1 x6
x6 + x4 + x3
x4 + x3
x4 + x2 + x
x3 + x2 + x
x3 + x +1
x2 + 1
 1st row bits = 101
Cyclic code for systematic codeword
(Generator Matrix Method)
 2nd row : rem [/ (x3 + x + 1)] x2 + 1
x3 + x + 1 x5
x5 + x3 + x2
x 3 + x2
x3 + x + 1
x2 + x + 1
2nd row bits = 111
x
x3 + x + 1 x4
 3 row : rem [ / (x + x + 1)]]
rd 3

x4 + x2 + x
3rd row bits = 110 x2 + x
Cyclic code for systematic codeword
(Generator Matrix Method)
→ 4th row : rem [/ (x3 + x + 1)]] = x+1 1
x3 + x + 1 x3
x3 + x + 1
x+ 1
4th row bits = 011

1 0 0 0 1 0 1
G = [I : P] =
0 1 0 0 1 1 1
0 0 1 0 1 1 0
0 0 0 1 0 1 1
Cyclic code for systematic codeword
(Generator Matrix Method)
 Ex: construct Systematic codeword (7,4) using cyclic codes, generator
polynomial g(x) = x3 + x + 1, msg = 1011
G= 1 0 0 0 1 0 1
0 1 0 0 1 1 1
0 0 1 0 1 1 0
0 0 0 1 0 1 1

C = m * G = 1011 1 0 0 0 1 0 1
0 1 0 0 1 1 1
0 0 1 0 1 1 0
0 0 0 1 0 1 1

= 1011000
Decoding of cyclic codes

a. Syndrome Decoding:
 It’s used in cyclic codes in order to decode the sequence and to decode and
correct it.
 Syndrome polynomial is obtained as
S(x)= Reminder of
 If S(x) =0, then No errors
 If S(x), there are some errors
Decoding of cyclic codes
a. Syndrome Decoding:
 Ex: Consider received sequence is R=1011000 for (7,4) code dimension and
generator polynomial g(x)=
Find received sequence is valid or not?

S(x)=0 → No Error
Cyclic encoder Circuit design
 Codewords could be generated using n-k flipflops

Ex: For generator polynomial = 1 + x + x3 = 1 + x +0(x2) + x3

1 1 0 1

FF FF FF

P3 Input
P1 P2
MS message
LSB
B
Cyclic encoder Circuit Design
 Construct codeword (7,4) using cyclic codes, generator polynomial
g(x) = x3 + x + 1, msg = 1011

‫ ؞‬Codeword = [msg |p] = [1011000]


F F F
F F F
P1 P2 P3 Input
LS MSB message

Input B
P1 = inputi-1 xor P3i-1 P2 = inputi-1 xor P1i-1 xor P3i-1 P3 = P2i-1
1 0 0 0
After 1st clk cycle 0 1 1 0
After 2nd clk cycle 1 0 1 1
After 3rd clk cycle 1 0 0 1
After 4th clk cycle 0 0 0
P1 P2 P3
LSB MSB
Cyclic Decoder Circuit Design
b. Syndrome Calculator:
 Ex: Consider a cyclic code with code dimension (7,4) and g(x)=. If the received codeword
is R=1001000. Determine the syndrome by using a syndrome calculator.

Before Shift After Shift


𝑔 2=0 𝑆3
𝑆3 R
1 1 0 0 0 1 0 0
0 1 0 0 0 1 0
R 𝑆1 𝑆2 𝑆3 Syndrome 0 0 1 0 0 0 1
+ +
SW 2 Output 1 0 0 1 0 1 0
0 0 1 0 0 0 1
0 0 0 1 1 1 0
0 1 1 0 0 1 1
WB MSB

so, S=110
Advantages of cyclic code

 They are easy to implement.


 Simple and easy error detection and correction methods.
 Easy implementation for encoding and decoding circuit for cyclic codes
using shift registers.
 They can be easily implemented in both hardware or software.
 Small overhead.
Disadvantages of cyclic code

 Low robustness during overloads.


 Error correction is slightly more complicated than error detection; due to the
complexity of the combination logic circuit used for error correction.
Some standard cyclic codes
 The hamming code:
Single error-correcting codes can be used in cyclic form.
 The BCH code:
Extension of hamming for n-errors correcting codes.
 CRC code:
Cyclic redundancy check code which is a shortened cyclic error-detecting code
used in automatic repeat request systems.
 Reed Solomon code:
A non-binary cyclic code.
Reed Solomon Codes Applications

 Reed-Solomon codes have been widely used in mass storage systems to correct the
burst errors caused by media defects.
 Special types of Reed-Solomon codes have been used to overcome the unreliable
nature of data transmission over erasure channels.
 Several bar-code systems use Reed-Solomon codes to allow correct reading even if a
portion of a bar code is damaged.
 Reed-Solomon codes were used to encode pictures sent by the Voyager spacecraft.
Other applications of cyclic code
 Satellite & wireless communication :

The information sent digitally in satellite & wireless communication uses cyclic code
in the encoding and decoding process.
 Compact discs(CD):

Since CD errors are burst errors, cyclic codes can be used in CDs to correct these
burst errors.
 Error correction:

Used to correct double errors and burst errors.


THANK YOU

You might also like