bch_verilog icon indicating copy to clipboard operation
bch_verilog copied to clipboard

BCH Encoder Different result from MATLAB

Open h-sh-h opened this issue 2 years ago • 1 comments

Hi, First of all thank you for making this great project.

One thing that I have problem with is the difference between the output of bch encoder for BCH(127,71) from MATLAB comm.BCHEncoder even if generator polynomials are the same. I checked the ENC parameter and it's the same as "genpoly(127,71)" function from MATLAB.

But when I input the same data to both "bch_encode" and MATLAB function i get different encoded data. Actually the difference is only in the second part of data not the original part of data.

Can you please tell me why ? Thanks

h-sh-h avatar Jan 11 '22 12:01 h-sh-h

I came up with another problem I know that "any polynomial that is a multiple of the generator polynomial is a valid BCH codeword" . But when I divide the encoded data by the generator polynomial it has non-zero remainder. when I do it with the MATLAB encoded data it has zero remainder which is correct

Why ?

example BCH(127_71) "bch_verilog" encoded data => 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 0 1 1 0 1 0 1 0 0 1 1

"MATLAB" encoded data => 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 1 0 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1 1 0 0 0 0

Thanks

PS : I changed the primitive polynomial for m=7 in bch_defs to make both MATLAB and bch_verilog the same and therfore the generator polynomials for both are the same

h-sh-h avatar Jan 11 '22 19:01 h-sh-h