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.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Decode message using Reed-Solomon decoder

The HDL-optimized `HDLRSDecoder`

System
object™ recovers a message vector from a Reed-Solomon (RS) codeword vector. For
proper decoding, the code and polynomial property values for this object must match
those values in the corresponding encoder.

To recover a message vector from a Reed-Solomon codeword vector:

Create the

`comm.HDLRSDecoder`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

Each input frame must contain more than

`(N-K)*2`

symbols and fewer than or exactly`N`

symbols. The object infers a shortened code when the number of valid data samples between`startIn`

and`endIn`

is less than`N`

. A shortened code still requires`N`

cycles to perform the Chien search. If the input message is less than`N`

symbols, leave a guard interval of at least`N - size`

inactive cycles before starting the next frame, where`size`

is the message length.The decoder can operate on up to four messages at a time. If the object receives the start of a fifth message before completely decoding the first message, the object drops data samples from the first message. To avoid this issue, increase the number of inactive cycles between input messages.

The generator polynomial is not specified explicitly. However, it is defined by the codeword length, the message length, and the B value for the starting exponent of the roots. To get the value of B from a generator polynomial, use the

`genpoly2b`

function.

`RSDec = comm.HDLRSDecoder`

`RSDec = comm.HDLRSDecoder(Name,Value)`

`RSDec = comm.HDLRSDecoder(N,K,Name,Value)`

creates an
HDL-optimized RS decoder System
object, `RSDec`

= comm.HDLRSDecoder`RSDec`

, that performs Reed-Solomon
decoding.

sets properties using one or more name-value pairs. Enclose each property name
in single quotes. For example,
`RSDec`

= comm.HDLRSDecoder(Name,Value)

comm.HDLRSDecoder('BSource','Property','B',2)

sets the `RSDec`

= comm.HDLRSDecoder(N,K,Name,Value)`CodewordLength`

property to `N`

,
the `MessageLength`

property to `K`

, and
other specified property names to the specified values.

**For versions earlier than R2016b, use the step
function to run the System object algorithm. The arguments to
step are the object you created, followed by
the arguments shown in this section.**

**For example, y = step(obj,x) and y = obj(x) perform equivalent operations.**

`[Y,startOut,endOut,validOut,errOut] = RSDec(X,startIn,endIn,validIn)`

`[Y,startOut,endOut,validOut,errOut,numErrors] = RSDec(X,startIn,endIn,validIn)`

`[`

decodes the input data, and also returns the number of errors detected and
corrected. To use this syntax, set the `Y`

,`startOut`

,`endOut`

,`validOut`

,`errOut`

,`numErrors`

] = RSDec(`X`

,`startIn`

,`endIn`

,`validIn`

)`NumErrorsOutputPort`

property to `true`

. If `errOut`

is
`1`

(`true`

), then the object detected
uncorrectable errors in the output frame, and `numErrors`

is
invalid.

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)