Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Binary-Input RS Encoder

Create Reed-Solomon code from binary vector data

Library

Block sublibrary of Error Detection and Correction

Description

The Binary-Input RS Encoder block creates a Reed-Solomon code with message length Kand codeword length Nnumber of punctures. You specify N and K directly in the dialog box. The symbols for the code are binary sequences of length M, corresponding to elements of the Galois field GF(2M), where the first bit in each sequence is the most significant bit. Restrictions on M and N are given in Restrictions on the M and the Codeword Length N below.

The block can output shortened codewords when you specify the Shortened message length, S. In this case, specify codeword length N and message length K as the full-length (N, K) code that is shortened to an (NK+S, S) code.

The input and output are binary-valued signals that represent messages and codewords, respectively. The input and output signal lengths are listed in the Input and Output Signal Length in BCH and RS Blocks table on the BCH Decoder reference page. The block inherits the output data type from the input. For information about the data types each block port supports, see the Supported Data Types table.

For more information on representing data for Reed-Solomon codes, Integer Format (Reed-Solomon Only).

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

The default value of M is the smallest integer that is greater than or equal to log2(N+1), that is, ceil(log2(N+1)). You can change the value of M from the default by specifying the primitive polynomial for GF(2M), as described in Specify the Primitive Polynomial below.

An (N,K) Reed-Solomon code can correct up to floor((N-K)/2) symbol errors (not bit errors) in each codeword.

Specify the Primitive Polynomial

You can specify the primitive polynomial that defines the finite field GF(2M), corresponding to the integers that form messages and codewords. To do so, first select Specify primitive polynomial. Then, set Primitive polynomial to a binary row vector that represents a primitive polynomial over GF(2) of degree M, in descending order of powers. For example, to specify the polynomial x3+x+1, enter the vector [1 0 1 1].

If you do not select Specify primitive polynomial, the block uses the default primitive polynomial of degree M = ceil(log2(N+1)). You can display the default polynomial by entering primpoly(ceil(log2(N+1))) at the MATLAB® prompt.

Restrictions on the M and the Codeword Length N

  • If you do not select Specify primitive polynomial, codeword length N must lie in the range 7< N ≤ 216–1.

  • If you do select Specify primitive polynomial, N must lie in the range 7 ≤ N ≤ 216–1 and M must lie in the range 3 ≤ M ≤ 16.

Specify the Generator Polynomial

You can specify the generator polynomial for the Reed-Solomon code. To do so, first select Specify generator polynomial. Then, in the Generator polynomial text box, enter an integer row vector whose entries are between 0 and 2M-1. The vector represents a polynomial, in descending order of powers, whose coefficients are elements of GF(2M) represented in integer format. See Integer Format (Reed-Solomon Only) for more information about integer format. The generator polynomial must be equal to a polynomial with a factored form

g(x) = (x+Ab)(x+Ab+1)(x+Ab+2)...(x+Ab+N-K-1),

where A is the primitive element of the Galois field over which the input message is defined, and b is a nonnegative integer.

If you do not select Specify generator polynomial, the block uses the default generator polynomial, corresponding to b = 1, for Reed-Solomon encoding. If you are using the default primitive polynomial, you can display the default generator polynomial. To do so, at the MATLAB prompt, enter rsgenpoly(N1,K1), where N1 = 2^M-1 and K1 = K+(N1-N). If the Specify primitive polynomial check box is selected, and you specify the primitive polynomial as poly, the default generator polynomial is rsgenpoly(N1,K1,poly).

Puncture Codes

The block supports puncturing when you select the Puncture code check box. 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.

Examples

Suppose M = 3, N = 23-1 = 7, and K = 5. Then a message is a binary vector of length 15 that represents 5 three-bit integers. A corresponding codeword is a binary vector of length 21 that represents 7 three-bit integers. The following figure shows the codeword that would result from a particular message word. The integer format equivalents illustrate that the highest order bit is at the left.

Parameters

Codeword length N

The codeword length. The output has vector length NC*M*(NNP), where NC is the number of codewords being output, and NP is the number of punctures per codeword.

Message length K

The message length. The input has vector length NM*M*K, where NM is the number of messages per frame being input.

Specify shortened message length

Selecting this check box enables the Shortened message length text box.

Shortened message length S

The shortened message length. When you specify this property, provide full-length N and K values to specify the (N,K) code that is shortened to an (NK + S, S) code.

Specify generator polynomial

Selecting this check box enables the Generator polynomial text box.

Generator polynomial

This field is available only when Specify generator polynomial is selected.

Integer row vector, whose entries are in the range from 0 to 2M-1, representing the generator polynomial in descending order of powers.

Specify primitive polynomial

Selecting this check box enables the Primitive polynomial text box.

Primitive polynomial

This field is available only when Specify primitive polynomial is selected.

Binary row vector representing the primitive polynomial in descending order of powers.

Puncture code

Selecting this check box enables the field Puncture vector.

Puncture vector

This field is available only when Puncture code is selected.

A column vector of length NK. A value of 1 in the Puncture vector corresponds to an M-bit symbol that is not punctured, and a 0 corresponds to an M-bit symbol that is punctured.

The default value is [ones(2,1); zeros(2,1)].

Output data type

The output type of the block can be specified as Same as input, boolean, or double. By default, the block sets this to Same as input.

Supported Data Types

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

  • 1-bit unsigned integer (ufix(1))

Out
  • Double-precision floating point

  • Single-precision floating point

  • Boolean

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

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

  • 1-bit unsigned integer (ufix(1))

Algorithms

This object implements the algorithm, inputs, and outputs described in Algorithms for BCH and RS Errors-only Decoding.

Introduced before R2006a

Was this topic helpful?