For (7,3) Cyclic Code Using Matlab
ENCODER
Micro project of Information Theory and Coding
Sinjon Nath – 11500317053
Snehesh Dutta - 11500317052
Sounavo Mukharjee – 11500317051
Soumik Das - 11500317050
01
02
03
04
05
06
07
08
What is Cyclic
Code
Encoding Circuit
for an (n, k)
Cyclic Code
Decoding &
Meggitt encoder
Contents of the Presentation
Matlab Code
for 7-3 & Output
Description of
Cyclic Codes
Method of
generation
Generation of
systematic
cyclic code
Error Detection
& Application
What is Cyclic Code1.1
In coding theory, a cyclic code
is a block code, where the circul
ar shifts of each codeword gives
another word that belongs to the
code. They are error-correcting
codes that have algebraic proper
ties that are convenient for effic
ient error detection and correcti
on.
Description of Cyclic Codes2.1
If the n-tuple v = (v0, v1,…, vn-1) are cyclic shifted one place to the right, w
e obtain another n-tuple
which is called a cyclic shift of v. If the v are cyclically shifted i places to the
right, we have -
Description of Cyclic Codes Continued...2.2
Cyclically shifting v i places to the right is equivalent to cyclically shifting v (n – i) p
lace to the left. An (n, k) linear code C is called a cyclic code if every cyclic shift of a
code vector in C is also a code vector in C. To develop the algebraic properties of a c
yclic code, we treat the components of a code vector v = (v0, v1,…, vn-1) as the coef
ficients of a polynomial as follows:
If vn-1 ≠ 0, the degree of v(X) is n – 1. If vn-1 = 0, the degree of v(X) is less than
n – 1. The correspondence between the vector v and the polynomial v(X) is one-to-o
ne. The code polynomial that corresponds to the code vector is -
Description of Cyclic Codes Continued...2.3
The equation above can be manipulated into the following form :
Method of generation3.1
1. Consider a polynomial f(x) in cn . The block length of the co
de is n.
2. Obtain a set of polynomials by multiplying f(x) to all the pos
sible polynomials of message u(x).
3. The set of polynomials obtained in the above steps are the set
of code words belonging to a cyclic code.
Generation of systematic cyclic code4.1
Encoding of an (n, k) cyclic code in systematic form consists of thr
ee steps:
Add your words here,according to
your need to draw the text box siz
e.
Add your words here,according to
your need to draw the text box siz
e.
Add your words here,according to
your need to draw the text box siz
e.
Encoding Circuit for an (n, k) Cyclic Code5.1
Message bits are shifted into both communication channel and gate Equivalent to m
essage of k bits,
The parity bits are simultaneously generated in the shift registers No
w the switch is turned to parity side and parity bits are shifted for n-k
times to communication channel Message bits are also shifted n-k ti
mes, equivalent to
Encoding Circuit for an (n, k) Cyclic Code Continued5.2
Next the switch is again turned to gate/message input side
Decoding6.1
There are three basic steps to decode a cyclic code:
1.Syndrome computation,
2.Obtaining error pattern,
3.Error correction
Meggitt Decoder7.1
The received polynomial is shifted into syndrome register from the left end
At the same time it is fed into buffer register.
The syndrome is checked against corresponding error pattern
The error pattern detector is a combinational circuit that is designed such a way
that its output is 1, if and only if the syndrome register contents correspond to a
correctable error pattern with the error at the highest order position x
n-1 This means if the rightmost digit of received polynomial is erroneous, 1 wil
l appear at error detector If 0 appears at error detector, the rightmost stage of re
ceived polynomial is correct and no correction is necessary.
Output of error detector is estimated error value of the buffer First received sym
bol is read out of the buffer and simultaneously the syndrome register is shifted
once If the first received symbol is erroneous, it is corrected by the
output of the detector
Meggitt Decoder Continued7.2
The output of the detector is also fed to the syndrome register to form new syndrom
e with shifted once to right which is free from error effect The new syndrome is now
compared for any error effect in similar manner which is for second right most digit.
Second rightmost digit is corrected and read out from buffer and error detector outp
ut is fed to syndrome register to from new syndrome vector for next digit This proce
ss is continued till the leftmost digit of received vector is read out with correction.
Matlab Code for 7-3 encoder8.1
n = 7; % Codeword length
k = 3; % Message length
%Input a binary message with length equal to the message length.
data[] = input(“Enter message data:”)
%Create a generator polynomial for a cyclic code. Create a parity-check matrix by using the ge
nerator polynomial.
genpoly = cyclpoly(n,k)
parmat = cyclgen(n,genpoly)
%Create a syndrome decoding table by using the parity-check matrix.
trt = syndtable(parmat)
Matlab Code for 7-3 encoder continued8.2
%Encode the data by using the generator polynomial.
encData = encode(data,n,k,'cyclic/binary',genpoly)
%Corrupt the encoded message sequence by introducing errors in the first, second, fourth and se
venth bits.
encData(1) = ~encData(1)
encData(2) = ~encData(2)
encData(4) = ~encData(4)
%Decode the corrupted sequence. Observe that the decoder has correctly recovered the message
.
decData = decode(encData,n,k,'cyclic/binary',genpoly,trt)
Output9.1
data =
0
1
1
genpoly =
1 0 1 1 1
parmat =
1 0 0 0 1 1 0
0 1 0 0 0 1 1
0 0 1 0 1 1 1
0 0 0 1 1 0 1
Single-error patterns loaded in decoding table. 8 rows remaining.
2-error patterns loaded. 1 rows remaining.
3-error patterns loaded. 0 rows remaining.
trt =
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 1 0 0 0 0
1 0 0 0 1 0 0
0 1 0 0 0 0 0
0 1 0 1 0 0 0
1 0 0 0 0 1 0
0 0 0 0 0 0 1
1 0 0 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 0 0 0
0 0 0 0 1 0 0
1 1 0 0 0 0 0
1 1 0 1 0 0 0
0 0 0 0 0 1 0
1 0 0 0 0 0 1
Output Continued9.2
encData =
1
0
0
1
0
1
1
encData =
0
0
0
1
0
1
1
encData =
0
1
0
1
0
1
1
encData =
0
1
0
0
0
1
1
decData =
0
1
1
numerr =
0
Error Detection10.1
Let v(x), r(x) and e(x) respectively be the transmitted vector, received vector and err
or introduced in the channel Then r(x) = v(x) + e(x)
So, a(x)f(x) + s(x) = b(x)f(x) + e(x)
or, e(x) = [a(x) + b(x)]f(x) + s(x)
This shows that the syndrome is actually the remainder resulting from dividing the e
rror polynomial by the generator polynomial f(x).
Syndrome can be computed by shift registers as shown, but
error pattern e(x) is unknown.So decoder has to estimate the e(x) based on s(x)
However e(x) can be correctly determined, using decoder lookup table, if e(x) is a co
set leader in standard array s(x) is identical to zero, if and only if e(x) is either identi
cal to zero or equivalent to code vector.
Error Detection Continued10.2
If e(x) is identical to code vector, it is undetectable to estimate the error.
Cyclic codes are very effective to detect any errors – random or burst.
Error detection may be made simply by feeding all the syndrome register dig
its to an OR gate.
If any of the syndrome digits is not 0, which is in case of presence of error, o
utput of the OR gate is 1
Application11.1
• An Application of Cyclic Coding to Message Identification. Abstract: In certa
in digital communication systems data is coded into cyclic code words for err
or correction or detection. To safeguard certain aspects of the system, all the
code words of a message may have the same identifying pattern in a group of
digits.
• In certain digital communication systems data is coded into cyclic code word
s for error correction or detection. To safeguard certain aspects of the system,
all the code words of a message may have the same identifying pattern in a gr
oup of digits. This increases the redundancy of the message. This paper propo
ses a method of doing this using little or no redundancy.
References12.1
• Information Theory, Coding & Cryptography-Arijit Saha, Nilotpal Manna, Surajit Mandal.
• W. W. Peterson, Error-Correcting Codes, New York:Wiley, 1961
• Blahut, Richard E. (2003), Algebraic Codes for Data Transmission (2nd ed.), Cambridge U
niversity Press, ISBN 0-521-55374-1
• Van Lint, J. H. (1998), Introduction to Coding Theory, Graduate Texts in Mathematics 86
(3rd ed.), Springer Verlag, ISBN 3-540-64133-5
Thanks For Watching

Encoder for (7,3) cyclic code using matlab

  • 1.
    For (7,3) CyclicCode Using Matlab ENCODER Micro project of Information Theory and Coding Sinjon Nath – 11500317053 Snehesh Dutta - 11500317052 Sounavo Mukharjee – 11500317051 Soumik Das - 11500317050
  • 2.
    01 02 03 04 05 06 07 08 What is Cyclic Code EncodingCircuit for an (n, k) Cyclic Code Decoding & Meggitt encoder Contents of the Presentation Matlab Code for 7-3 & Output Description of Cyclic Codes Method of generation Generation of systematic cyclic code Error Detection & Application
  • 3.
    What is CyclicCode1.1 In coding theory, a cyclic code is a block code, where the circul ar shifts of each codeword gives another word that belongs to the code. They are error-correcting codes that have algebraic proper ties that are convenient for effic ient error detection and correcti on.
  • 4.
    Description of CyclicCodes2.1 If the n-tuple v = (v0, v1,…, vn-1) are cyclic shifted one place to the right, w e obtain another n-tuple which is called a cyclic shift of v. If the v are cyclically shifted i places to the right, we have -
  • 5.
    Description of CyclicCodes Continued...2.2 Cyclically shifting v i places to the right is equivalent to cyclically shifting v (n – i) p lace to the left. An (n, k) linear code C is called a cyclic code if every cyclic shift of a code vector in C is also a code vector in C. To develop the algebraic properties of a c yclic code, we treat the components of a code vector v = (v0, v1,…, vn-1) as the coef ficients of a polynomial as follows: If vn-1 ≠ 0, the degree of v(X) is n – 1. If vn-1 = 0, the degree of v(X) is less than n – 1. The correspondence between the vector v and the polynomial v(X) is one-to-o ne. The code polynomial that corresponds to the code vector is -
  • 6.
    Description of CyclicCodes Continued...2.3 The equation above can be manipulated into the following form :
  • 7.
    Method of generation3.1 1.Consider a polynomial f(x) in cn . The block length of the co de is n. 2. Obtain a set of polynomials by multiplying f(x) to all the pos sible polynomials of message u(x). 3. The set of polynomials obtained in the above steps are the set of code words belonging to a cyclic code.
  • 8.
    Generation of systematiccyclic code4.1 Encoding of an (n, k) cyclic code in systematic form consists of thr ee steps:
  • 9.
    Add your wordshere,according to your need to draw the text box siz e. Add your words here,according to your need to draw the text box siz e. Add your words here,according to your need to draw the text box siz e. Encoding Circuit for an (n, k) Cyclic Code5.1 Message bits are shifted into both communication channel and gate Equivalent to m essage of k bits, The parity bits are simultaneously generated in the shift registers No w the switch is turned to parity side and parity bits are shifted for n-k times to communication channel Message bits are also shifted n-k ti mes, equivalent to
  • 10.
    Encoding Circuit foran (n, k) Cyclic Code Continued5.2 Next the switch is again turned to gate/message input side
  • 11.
    Decoding6.1 There are threebasic steps to decode a cyclic code: 1.Syndrome computation, 2.Obtaining error pattern, 3.Error correction
  • 12.
    Meggitt Decoder7.1 The receivedpolynomial is shifted into syndrome register from the left end At the same time it is fed into buffer register. The syndrome is checked against corresponding error pattern The error pattern detector is a combinational circuit that is designed such a way that its output is 1, if and only if the syndrome register contents correspond to a correctable error pattern with the error at the highest order position x n-1 This means if the rightmost digit of received polynomial is erroneous, 1 wil l appear at error detector If 0 appears at error detector, the rightmost stage of re ceived polynomial is correct and no correction is necessary. Output of error detector is estimated error value of the buffer First received sym bol is read out of the buffer and simultaneously the syndrome register is shifted once If the first received symbol is erroneous, it is corrected by the output of the detector
  • 13.
    Meggitt Decoder Continued7.2 Theoutput of the detector is also fed to the syndrome register to form new syndrom e with shifted once to right which is free from error effect The new syndrome is now compared for any error effect in similar manner which is for second right most digit. Second rightmost digit is corrected and read out from buffer and error detector outp ut is fed to syndrome register to from new syndrome vector for next digit This proce ss is continued till the leftmost digit of received vector is read out with correction.
  • 14.
    Matlab Code for7-3 encoder8.1 n = 7; % Codeword length k = 3; % Message length %Input a binary message with length equal to the message length. data[] = input(“Enter message data:”) %Create a generator polynomial for a cyclic code. Create a parity-check matrix by using the ge nerator polynomial. genpoly = cyclpoly(n,k) parmat = cyclgen(n,genpoly) %Create a syndrome decoding table by using the parity-check matrix. trt = syndtable(parmat)
  • 15.
    Matlab Code for7-3 encoder continued8.2 %Encode the data by using the generator polynomial. encData = encode(data,n,k,'cyclic/binary',genpoly) %Corrupt the encoded message sequence by introducing errors in the first, second, fourth and se venth bits. encData(1) = ~encData(1) encData(2) = ~encData(2) encData(4) = ~encData(4) %Decode the corrupted sequence. Observe that the decoder has correctly recovered the message . decData = decode(encData,n,k,'cyclic/binary',genpoly,trt)
  • 16.
    Output9.1 data = 0 1 1 genpoly = 10 1 1 1 parmat = 1 0 0 0 1 1 0 0 1 0 0 0 1 1 0 0 1 0 1 1 1 0 0 0 1 1 0 1 Single-error patterns loaded in decoding table. 8 rows remaining. 2-error patterns loaded. 1 rows remaining. 3-error patterns loaded. 0 rows remaining. trt = 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1
  • 17.
    Output Continued9.2 encData = 1 0 0 1 0 1 1 encData= 0 0 0 1 0 1 1 encData = 0 1 0 1 0 1 1 encData = 0 1 0 0 0 1 1 decData = 0 1 1 numerr = 0
  • 18.
    Error Detection10.1 Let v(x),r(x) and e(x) respectively be the transmitted vector, received vector and err or introduced in the channel Then r(x) = v(x) + e(x) So, a(x)f(x) + s(x) = b(x)f(x) + e(x) or, e(x) = [a(x) + b(x)]f(x) + s(x) This shows that the syndrome is actually the remainder resulting from dividing the e rror polynomial by the generator polynomial f(x). Syndrome can be computed by shift registers as shown, but error pattern e(x) is unknown.So decoder has to estimate the e(x) based on s(x) However e(x) can be correctly determined, using decoder lookup table, if e(x) is a co set leader in standard array s(x) is identical to zero, if and only if e(x) is either identi cal to zero or equivalent to code vector.
  • 19.
    Error Detection Continued10.2 Ife(x) is identical to code vector, it is undetectable to estimate the error. Cyclic codes are very effective to detect any errors – random or burst. Error detection may be made simply by feeding all the syndrome register dig its to an OR gate. If any of the syndrome digits is not 0, which is in case of presence of error, o utput of the OR gate is 1
  • 20.
    Application11.1 • An Applicationof Cyclic Coding to Message Identification. Abstract: In certa in digital communication systems data is coded into cyclic code words for err or correction or detection. To safeguard certain aspects of the system, all the code words of a message may have the same identifying pattern in a group of digits. • In certain digital communication systems data is coded into cyclic code word s for error correction or detection. To safeguard certain aspects of the system, all the code words of a message may have the same identifying pattern in a gr oup of digits. This increases the redundancy of the message. This paper propo ses a method of doing this using little or no redundancy.
  • 21.
    References12.1 • Information Theory,Coding & Cryptography-Arijit Saha, Nilotpal Manna, Surajit Mandal. • W. W. Peterson, Error-Correcting Codes, New York:Wiley, 1961 • Blahut, Richard E. (2003), Algebraic Codes for Data Transmission (2nd ed.), Cambridge U niversity Press, ISBN 0-521-55374-1 • Van Lint, J. H. (1998), Introduction to Coding Theory, Graduate Texts in Mathematics 86 (3rd ed.), Springer Verlag, ISBN 3-540-64133-5
  • 22.