step

System object: comm.HDLRSEncoder
Package: comm

Perform Reed-Solomon encoding

Syntax

[Y,startOut,endOut,validOut] = step(H,X,startIn,EndIn,validIn)

Description

[Y,startOut,endOut,validOut] = step(H,X,startIn,EndIn,validIn) decodes the input data, X, and returns the encoded data, Y, of HDLRSEncoder System object™, H.

The step method for this object accepts fixed-point (fi) inputs for X.

    Note:   Calling step on an object puts that object into a locked state. When locked, you cannot change nontunable properties or any input characteristics (size, data type and complexity) without reinitializing (unlocking and relocking) the object.

Input Arguments

H

Instance of HDLRSEncoder System object

X

Message data

Must be an integer (uint8, uint16, uint32) or fi(). Doubles are allowed for simulation but not for HDL code generation.

startIn

Indicates the start of a frame of data. Boolean value.

endIn

Indicates the end of a frame of data. Boolean value.

validIn

Indicates that input data is valid. Boolean value.

Output Arguments

Y

Message data followed by parity words

The data type is the same as the input data port. Will be an integer (uint8, uint16, uint32) or fi(). Doubles are allowed for simulation but not for HDL code generation.

startOut

Indicates the start of a frame of data. Boolean value.

endOut

Indicates the end of a frame of data, including checksum. Boolean value.

validOut

Indicates that output data is valid. Boolean value.

Examples

RS-encode and decode a DVD-II standard packet of random data.

  1. Assign data and create System objects.

    hHDLEnc = comm.HDLRSEncoder(204,188,'BSource','Property','B',0);
    hHDLDec = comm.HDLRSDecoder(204,188,'BSource','Property','B',0);
    dataIn = [randi([0,255],188,1,'uint8') ; zeros(1024-188,1)];
    for ii = 1:1024
      [encOut(ii), startOut(ii), endOut(ii), validOut(ii)] = step(hHDLEnc, dataIn(ii), ii==1, ii==188, ii<=188);
      [decOut(ii), decStartOut(ii), decEndOut(ii), decValidOut(ii), decErrOut(ii)] = step(hHDLDec, encOut(ii), startOut(ii), endOut(ii), validOut(i  i));
    end
  2. Check results.

    assert(all(dataIn(1:188) == decOut(decValidOut)'))
Was this topic helpful?