Experiment No 9 (B) Experimental Study of BCH Encoder and Decoder
Experiment No 9 (B) Experimental Study of BCH Encoder and Decoder
9.b.1 Theory
BCH Code
BCH codes are a class of powerful error-correcting codes widely used in various
communication systems, data storage devices, and digital broadcasting applications. This
method is named after three people: Bose, Chaudhuri and Hocquenghem. They offer efficient
error correction capabilities and are well-suited for channels with high noise levels. This report
provides an overview of BCH encoders and decoders, their functionalities, and their critical
components.
Error Locator Polynomial Determination: The decoder uses the syndrome to determine the
error locator polynomial, which identifies the locations of errors in the codeword.
Error Correction: Based on the error locator polynomial, the decoder identifies the corrupted
bits and corrects them to restore the original message.
1
9.b.3 Experimental Analysis & Results
Experimental Setup:
D3 D2 D1 C2 D0 C1 C0
Block-length=2m-1 …………………………………………………………………..(9.1)
M= Check-bits ; t= errors
k=2m -m-1…………………………………………………………………………..(9.2)
dmin=2t+1……………………………………………………………………………(9.3)
Given, D=[1001] = [ D3 D2 D1 D0]
Therefore, Codeword=[1001001]
Relations: C0=D0+D1+D3
C1=D0+D2+D3
C2=D1+D2+D3
2
Table-9.2: Observation table.
Address C2 C1 C0 Address C2 C1 C0
0 0 0 0 4 1 0 0
1 0 0 1 5 1 0 1
2 0 1 0 6 1 1 0
3 0 1 1 7 1 1 1
D6 D5 D4 D3 D2 D1 D0
Relations: P0=D0+D2+D4+D6
P1=D1+D2+D4+D6
P2=D3+D4+ D5+D6
Position of P2 P1 P0 Position of P2 P1 P0
errors errors
All correct 0 0 0 4 1 0 0
1 0 0 1 5 1 0 1
2 0 1 0 6 1 1 0
3 0 1 1 7 1 1 1
3
9.3.1 Write code for General (Non-systematic) Cyclic code in MATLAB.
Solution:
Code:
clc;
clear all;
close all;
disp('Enter the message signal:');
m=input('m=');
syms x;
disp(g);
gl=polynomialDegree(g);
c=expand(msg*g);
disp('Code word polynomial, c(x)=');
disp(c);
cl=ml+gl;
cw=zeros(1,cl);
for i=1:cl
[r,q] = polynomialReduce(c,x.^(cl-i));
c=r;
if(q==1)
cw(1,i)=1;
end
end
disp('The codeword for General Cyclic Code is:');
disp(cw);
Output:
4
For Systematic Code:
clc;
clear all;
close all;
disp('Enter the message signal:');
m=input('m=');
syms x;
msg=poly2sym(m);
ml=length(m(1,:));
mx=zeros(1,ml);
for i=1:ml
mx(1,ml-i+1)=m(1,i);
end
disp('Message polynomial, m(x)=');
disp(mx);
disp('Enter the generator polynomial, ');
g=input('g(x)=');
disp(g);
pd=sym2poly(g);
pdl=length(pd(1,:));
gx=zeros(1,pdl);
for j=1:pdl
gx(1,pdl-j+1)=pd(1,j);
end
gl=polynomialDegree(g);
xnk=zeros(1,gl+1);
xn=sym2poly(x.^gl);
for i=1:gl+1
xnk(1,gl-i+2)=xn(1,i);
end
[q,r] = gfdeconv(conv(xnk,mx),gx);
disp('Parity,p(x)=');
gfpretty(r);
c=expand(msg*(x.^gl))+poly2sym(r);
disp('Code word polynomial, c(x)=');
disp(c);
cw=sym2poly(c);
disp('The codeword for Systematic Cyclic Code is:');
disp(cw);
Output:
Enter the 4-bits data:
D=[1 0 1 0]
The codeword for BCH Code is:
1 0 1 0 0 1 0
5
9.4 Discussion & Conclusion
Through this experiment,We had seen the BCH code encoding and decoding method .Using a
BCH encoder and decoder trainer kit, we conducted this experiment. In accordance with the
lab manual's block diagram, we had connected the circuit. According to the theoretical idea,
we had discovered the intended outputs for the encoder and decoder. We had also used the
MATLAB software to watch this experiment. With MATLAB software, we followed the
guidelines and created codes with loops to get the intended results according to theoretical
concepts. We discovered the cyclic code's encoding and decoding output. We had completed
this lab experiment correctly at last.