Quantcast

Documentation Center

  • Trial Software
  • Product Updates

BCH Encoder

Create BCH code from binary vector data

Library

Block sublibrary of Error Detection and Correction

Description

The BCH Encoder block creates a BCH code with message length K and codeword length (N - number of punctures). You specify both N and K directly in the dialog box.

This block accepts a column vector input signal with an integer multiple of K elements. Each group of K input elements represents one message word to be encoded.

If the encoder is processing multiple codewords per frame, then the same puncture pattern holds for all codewords.

For a given codeword length N, only specific message lengths K are valid for a BCH code. For a full length BCH code, N must be of the form 2M-1, where . If N is less than 2M-1, the block assumes that the code has been shortened by length 2M - 1 - N. However, if N is greater than or equal to 2M-1, Primitive polynomial must be specified to appropriately set the value of M.

No known analytic formula describes the relationship among the codeword length, message length, and error-correction capability. The tables below list valid [n,k] pairs for small values of n, as well as the corresponding values of the error-correction capability, t.

nkt
7 4 1

nkt
15 11 1
15 7 2
15 5 3

nkt
31 26 1
31 21 2
31 16 3
31 11 5
31 6 7

nkt
63 57 1
63 51 2
63 45 3
63 39 4
63 36 5
63 30 6
63 24 7
63 18 10
63 16 11
63 10 13
63 7 15

nkt
127 120 1
127 113 2
127 106 3
127 99 4
127 92 5
127 85 6
127 78 7
127 71 9
127 64 10
127 57 11
127 50 13
127 43 14
127 36 15
127 29 21
127 22 23
127 15 27
127 8 31

nkt
255 247 1
255 239 2
255 231 3
255 223 4
255 215 5
255 207 6
255 199 7
255 191 8
255 187 9
255 179 10
255 171 11
255 163 12
255 155 13
255 147 14
255 139 15
255 131 18
255 123 19
255 115 21
255 107 22
255 99 23
255 91 25
255 87 26
255 79 27
255 71 29
255 63 30
255 55 31
255 47 42
255 45 43
255 37 45
255 29 47
255 21 55
255 13 59
255 9 63

nkt
511 502 1
511 493 2
511 484 3
511 475 4
511 466 5
511 457 6
511 448 7
511 439 8
511 430 9
511 421 10
511 412 11
511 403 12
511 394 13
511 385 14
511 376 15
511 367 16
511 358 18
511 349 19
511 340 20
511 331 21
511 322 22
511 313 23
511 304 25
511 295 26
511 286 27
511 277 28
511 268 29
511 259 30
511 250 31
511 241 36
511 238 37
511 229 38
511 220 39
511 211 41
511 202 42
511 193 43
511 184 45
511 175 46
511 166 47
511 157 51
511 148 53
511 139 54
511 130 55
511 121 58
511 112 59
511 103 61
511 94 62
511 85 63
511 76 85
511 67 87
511 58 91
511 49 93
511 40 95
511 31 109
511 28 111
511 19 119
511 10 121

The primitive and generator polynomials may be specified in their respective fields, which appear after selecting their corresponding check boxes.

For information about the data types each block port supports, see the Supported Data Type table on this page.

Puncture Codes

This block supports puncturing when you select the Puncture code parameter. This selection enables the Puncture vector parameter, which takes in a binary vector to specify the puncturing pattern. For a puncture vector, 1 represents that the data symbol passes unaltered, and 0 represents that the data symbol gets punctured, or removed, from the data stream. This convention is carried for both the encoder and the decoder. For more information, see Shortening, Puncturing, and Erasures.

    Note:   1s and 0s have precisely opposite meanings for the puncture and erasure vectors. For an erasure vector, 1 means that the data symbol is to be replaced with an erasure symbol, and 0 means that the data symbol is passed unaltered. This convention is carried for both the encoder and the decoder.

Dialog Box

Codeword length, N

The codeword length.

Message length, K

The message length.

Specify primitive polynomial

Selecting this check box enables the Primitive polynomial field.

Primitive polynomial

A row vector that represents the binary coefficients of the primitive polynomial in order of descending powers.

This field defaults to de2bi(primpoly(4, 'nodisplay'), 'left-msb'), corresponding to a (15,5) code.

This parameter applies only when you select Specify primitive polynomial.

Specify generator polynomial

Selecting this check box enables the Generator polynomial field.

Generator polynomial

A row vector that represents the binary coefficients of the generator polynomial in order of descending powers.

The length of the Generator polynomial must be N-K+1.

This field defaults to bchgenpoly(15,5).

This parameter applies only when you select Specify generator polynomial.

Disable generator polynomial checking

This check box appears only when you select Specify generator polynomial.

Each time a model initializes, the block performs a polynomial check. This check verifies that X N + 1 is divisible by the user-defined generator polynomial, where N represents the full code word length. Selecting this check box disables the polynomial check. For larger codes, disabling the check speeds up the simulation process. You should always run the check at least once before disabling this feature.

Puncture code

Selecting this check box enables the Puncture vector field.

Puncture vector

A column vector of length N-K. In the Puncture vector, a value of 1 represents that the data symbol passes unaltered, and 0 represents that the data symbol gets punctured, or removed, from the data stream.

The field defaults to [ones(8,1); zeros(2,1)].

This parameter applies only when you select Puncture code.

Supported Data Type

PortSupported Data Types
In
  • Double-precision floating point

  • Single-precision floating point

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Out
  • Double-precision floating point

  • Single-precision floating point

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Pair Block

BCH Decoder

References

[1] Clark, George C., Jr., and J. Bibb Cain, Error-Correction Coding for Digital Communications, New York, Plenum Press, 1981.

See Also

bchenc (in Communications System Toolbox™ documentation)

Was this topic helpful?