This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Integer-Output RS Decoder

Decode Reed-Solomon code to recover integer vector data

  • Library:
  • Communications Toolbox / Error Detection and Correction / Block


The Integer-Output RS Decoder block recovers a message vector from a Reed-Solomon codeword vector. For proper decoding, the parameter values in this block must match those in the corresponding Integer-Input RS Encoder block.

The Reed-Solomon code has message length K, and codeword length Nnumber of punctures. You specify N and K directly in the block dialog. The symbols for the code are integers between 0 and 2M-1, which represent elements of the finite field GF(2M). Restrictions on M and N are described in Restrictions on the M and the Codeword Length N below.

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

This icon shows optional ports.

The input and output are integer-valued signals that represent codewords and messages, respectively. For more information, see Input and Output Signal Length in RS Blocks. The block inherits the output data type from the input data type. For information about the data types each block port supports, see Supported Data Types.

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

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

The default value of M is ceil(log2(N+1)), that is, the smallest integer greater than or equal to 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.

You can also specify the generator polynomial for the Reed-Solomon code, as described in Specify the Generator Polynomial.

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

The second output is the number of errors detected during decoding of the codeword. A -1 indicates that the block detected more errors than it could correct using the coding scheme. An (N,K) Reed-Solomon code can correct up to floor((N-K)/2) symbol errors (not bit errors) in each codeword. The data type of this output is also inherited from the input signal.

You can disable the second output by deselecting Output number of corrected errors. This removes the block's second output port.

If decoding fails, the message portion of the decoder input is returned unchanged as the decoder output.

The sample times of the input and output signals are equal.


Codeword length N

The codeword length in symbols.

Message length K

The message length in symbols.

Specify shortened message length

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

Shortened message length S

The shortened message length in symbols. When you specify this parameter, 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

Integer row vector whose entries are in the range from 0 to 2M-1, representing the generator polynomial in descending order of powers. Each coefficient is an element of the Galois field defined by the primitive polynomial.

This parameter applies only when you select Specify generator polynomial.

Specify primitive polynomial

Selecting this check box enables the Primitive polynomial text box.

Primitive polynomial

This parameter applies only when you select Specify primitive polynomial.

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

Puncture code

Selecting this check box enables the Puncture vector text box.

Puncture vector

A column vector of length NK. 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 default value is [ones(2,1); zeros(2,1)].

This parameter applies only when you select Puncture code.

Enable erasures input port

Selecting this check box will open the port, Era. This port accepts a binary column vector input signal with the same size as the codeword.

Erasure values of 1 represents symbols in the same position in the codeword that get erased, and values of 0 represent symbols that do not get erased.

Output number of corrected errors

When you select this check box, the block outputs the number of corrected symbol errors in each word through a second output port. A decoding failure occurs when a certain word in the input contains more than (NK)/2 errors. A value of -1 indicates a decoding failure in the corresponding position in the second output vector.

Block Characteristics

Data Types

double | single | base integer

Multidimensional Signals


Variable-Size Signals


More About

expand all


This block uses the Berlekamp-Massey decoding algorithm. For information about this algorithm, see Algorithms for BCH and RS Errors-only Decoding.


[1] Wicker, Stephen B., Error Control Systems for Digital Communication and Storage. Upper Saddle River, N.J.: Prentice Hall, 1995.

[2] Berlekamp, Elwyn R., Algebraic Coding Theory, New York: McGraw-Hill, 1968.

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

See Also


System Objects


Introduced before R2006a