Integer-Output RS Decoder
Decode Reed-Solomon code to recover integer vector data
Libraries:
Communications Toolbox /
Error Detection and Correction /
Block
Description
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 N – number of punctures. You specify N and K directly in the block dialog. The symbols for the code are integers in the range [0, 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.
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.
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.
Examples
Reed-Solomon Coding with Erasures, Punctures, and Shortening in Simulink
Configure Reed-Solomon (RS) codes to perform block coding with erasures, punctures, and shortening.
Ports
Input
In — Reed-Solomon codeword
integer column vector
Reed-Solomon codeword, specified as an (NC×(N – K + S – P)-by-1 integer column vector. NC is the number of codewords, N is the Codeword length N, K is the Message length K, S is the Shortened message length S, P is the number of punctures per codeword.
For more information, see Input and Output Signal Length in RS Blocks.
Data Types: single
| double
| integer
Era — Erasure vector
binary column vector
Erasure vector, specified as a binary column vector input signal with the same size as the input Reed-Solomon codeword.
Erasure values of 1 correspond to erased bits in the same position in the codeword. Values of 0 correspond to bits that are not erased. For more information, see Puncturing and Erasures.
Dependencies
To enable this port, select Enable erasures input port.
Data Types: double
| Boolean
Output
Out — Decoded message
integer column vector
Decoded message, returned as one of the following:
When there is no message shortening, a (NC×K)-by-1 integer column vector.
When there is message shortening, a (NC×S)-by-1 integer column vector.
NC is the number of message words, K is the Message length K (symbols), and S is the Shortened message length S (symbols).
Note
The number of decoded message words equals the number of codewords.
For more information, see Input and Output Signal Length in RS Blocks.
Err — Decoding errors
integer vector
Symbol decoding errors, returned as an integer vector with NC elements, where NC is the number of codewords. This port indicates the number of symbol errors detected during decoding of each codeword. A negative integer indicates that the block detected more errors than it could correct by using the specified coding scheme.
Note
An (N,K) Reed-Solomon code
can correct up to floor((N-K)/2)
symbol errors
(not bit errors) in each codeword. When a received codeword contains
more than (N-K)/2 symbol
errors, a decoding failure occurs.
Dependencies
To enable this port, select Output number of corrected symbol errors.
Data Types: double
For more information, see Supported Data Types.
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Codeword length N — Codeword length
7
(default) | integer
Codeword length, specified as an integer.
For more information, see Restrictions on the M and the Codeword Length N and Input and Output Signal Length in RS Blocks.
Message length K — Message word length
3
(default) | integer
Message word length, specified as an integer in the range [1, N–2], where N is the codeword length.
Shortened message length S — Shortened message word length
3
(default) | integer
Shortened message word length, specified as an integer, such that S ≤ K. When Shortened message length S < Message length K, the Reed-Solomon code is shortened.
You still specify N and K values for the full-length (N, K) code but the decoding is shortened to an (N–K+S, S) code.
Dependencies
To enable this parameter, select Specify shortened message length.
Generator polynomial — Generator polynomial
rsgenpoly(7, 3, [], [],
'double')
(default) | polynomial character vector | binary row vector | binary Galois row vector
Generator polynomial with values in the range [0, 2M–1], in order of descending power, specified as one of the following:
A polynomial character vector. For more information, see Representation of Polynomials in Communications Toolbox.
An integer row vector that represents the coefficients of the generator polynomial in order of descending power.
An integer Galois row vector that represents the coefficients of the generator polynomial in order of descending power.
Each coefficient is an element of the Galois field defined by the primitive polynomial. For more information, see Specify the Generator Polynomial.
Example: [1 3 1 2 3]
, which is equivalent to
rsgenpoly(7,3)
Dependencies
To enable this parameter, select Specify generator polynomial.
Primitive polynomial — Primitive polynomial
'X^3 + X + 1'
(default) | polynomial character vector | binary row vector
Primitive polynomial in order of descending power. This polynomial is of order M and defines the finite Galois field GF(2M) corresponding to the integers that form message words and codewords. Specify the primitive polynomial as one of the following:
A polynomial character vector. For more information, see Representation of Polynomials in Communications Toolbox.
A binary row vector that represents the coefficients of the generator polynomial.
For more information, see Specify the Primitive Polynomial.
Example: 'X^3 + X + 1'
, which is the primitive
polynomial used for a (7,3) code, ppoly = primpoly(3,'nodisplay');
int2bit(ppoly,ceil(log2(max(ppoly))))'
Dependencies
To enable this parameter, select Specify primitive polynomial.
Puncture vector — Puncture vector
[ones(2,1); zeros(2,1)]
(default) | binary column vector
Puncture vector, specified as an
(N–K)-by-1 binary column vector.
Element indices with 1
s represent data
symbol indices that pass through the block
unaltered. Element indices with 0
s represent data
symbol indices that get punctured, or removed,
from the data stream. For more information, see Puncturing and Erasures.
Note
If the encoder is processing multiple codewords per frame, then the same puncture pattern holds for all codewords.
Dependencies
To enable this parameter, select Puncture code.
Enable erasures input port — Enable erasures input port
off (default) | on
Selecting this check box enables the erasures port, Era. For more information, see Puncturing and Erasures.
Output number of corrected symbol errors — Enable port to output number of corrected symbol errors
off (default) | on
Selecting this check box enables an additional output port, Err, which indicates the number of symbol errors the block corrected in the input codeword.
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
More About
Input and Output Signal Length in RS Blocks
The Reed-Solomon code has a message word length, K, or shortened message word length, S. The codeword length is N – K + S – P, where N is the full codeword length and P is the number of punctures per codeword. When there is no message shortening, the codeword length expression reduces to N – P, because K = S. If the decoder is processing multiple codewords per frame, then the same puncture pattern holds for all codewords.
This table provides expressions for the input and output signal lengths for the Reed-Solomon encoder and decoder.
The notation y = NC × x denotes that y is an integer multiple of x.
Input, Erasure, and Output Vector Lengths | ||
---|---|---|
RS Block Coder | No Message Shortening Used | Message Shortening Used |
Integer-Input RS Encoder |
Input Length (symbols): NC × K Output Length (symbols): NC × (N–P) |
Input Length (symbols): NC × S Output Length (symbols): NC × (N–K+S–P) |
Integer-Output RS Decoder |
Input Length (symbols): NC × (N–P) Erasures Length (symbols): NC × (N–P) Output Length (symbols): NC × K |
Input Length (symbols): NC × (N–K+S–P) Erasures Length (symbols): NC × (N–K+S–P) Output Length (symbols): NC × S |
N is the codeword length.
K is the message word length.
S is the shortened message word length.
NC is the number of codewords (and message words).
P is the number of punctures, and is equal to the number of zeros in the puncture vector.
M is the degree of the primitive polynomial. Each group of M bits represents an integer between
0
and2M–1
that belongs to the finite Galois fieldGF(2M)
.
For more information on representing data for Reed-Solomon codes, see Integer Format (Reed-Solomon Only).
Restrictions on the M and the Codeword Length N
If you do not select Specify primitive polynomial, valid values for the codeword length, N, are from 7 to 65535. In this case, the block uses the default primitive polynomial of degree
M = ceil(log2(N+1))
. You can display the default primitive polynomial by runningprimpoly(ceil(log2(N+1)))
.If you select Specify primitive polynomial, valid values for the primitive polynomial degree, M, are from 3 to 16. The valid values for N in this case are from 7 to 2M–1. Selecting Specify primitive polynomial enables you to specify the primitive polynomial that defines the finite field GF(2M), which corresponds to the values that form message words and codewords.
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, in the Primitive
polynomial text box, enter a binary row vector that represents a primitive
polynomial over GF(2M), 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.
Specify the Generator Polynomial
Select Specify generator polynomial to enable the Generator polynomial parameter for specifying the generator polynomial of the Reed-Solomon code. Enter an integer row vector with element values from 0 to 2M-1. The vector represents a polynomial, in descending order of powers, whose coefficients are elements of GF(2M) represented in integer format. For more information about integer and binary format, see Integer Format (Reed-Solomon Only). The generator polynomial must be equal to a polynomial with this factored form:
g(x) = (x+αb)(x+αb+1)(x+αb+2)...(x+αb+N-K-1)
α is the primitive element of the Galois field over which the input message is defined, and b is an integer.
If you do not select Specify generator polynomial, the block uses the
default generator polynomial, corresponding to b=1, for Reed-Solomon
encoding. You can display the default generator polynomial by running rsgenpoly
.
If you are using the default primitive polynomial (Specify primitive polynomial is not selected), the default generator polynomial is
rsgenpoly(N,K)
, whereN = 2M-1
.If you are not using the default primitive polynomial (Specify primitive polynomial is selected) and you specify the primitive polynomial as
poly
, the generator polynomial isrsgenpoly(N,K,poly)
.
Note
The degree of the generator polynomial is N − K, where N is the codeword length and K is the message word length.
Puncturing and Erasures
1
s and 0
s have
precisely opposite meanings for the puncture and erasure vectors.
In a puncture vector,
1
means that the data symbol is passed through the block unaltered.0
means that the data symbol is to be punctured, or removed, from the data stream.
In an erasure vector,
1
means that the data symbol is to be replaced with an erasure symbol.0
means that the data symbol is passed through the block unaltered.
These conventions apply to both the encoder and the decoder. For more information, see Shortening, Puncturing, and Erasures.
Supported Data Types
Port | Supported Data Types |
---|---|
In |
|
Out |
|
Era |
|
Err |
|
Algorithms
This block uses the Berlekamp-Massey decoding algorithm. For information about this algorithm, see Algorithms for BCH and RS Errors-only Decoding.
References
[1] Blahut, Richard E. Algebraic Codes for Data Transmission. Cambridge University Press, 2003.
[2] Wicker, Stephen B. Error Control Systems for Digital Communication and Storage. Upper Saddle River, NJ: Prentice Hall, 1995.
[3] Clark, George C., and J. Bibb Cain. Error-Correction Coding for Digital Communications. Applications of Communications Theory. New York: Plenum Press, 1981.
[4] Berlekamp, Elwyn R., Algebraic Coding Theory, New York, McGraw-Hill, 1968.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006a
See Also
Blocks
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)