Decode convolutionally encoded data using Viterbi algorithm with GPU
The GPU ViterbiDecoder System object™ decodes input symbols to produce binary output symbols using a graphics processing unit (GPU). This object processes variable-size signals; however, variable-size signals cannot be applied for erasure inputs.
Note: To use this object, you must install a Parallel Computing Toolbox™ license and have access to an appropriate GPU. For more about GPUs, see GPU Computing in the Parallel Computing Toolbox documentation.
A GPU-based System object accepts typical MATLAB® arrays or objects that you create using the gpuArray class as an input to the step method. GPU-based System objects support input signals with double- or single-precision data types. The output signal inherits its datatype from the input signal.
If the input signal is a MATLAB array, then the output signal is also a MATLAB array. In this case, the System object handles data transfer between the CPU and GPU.
If the input signal is a gpuArray, then the output signal is also a gpuArray. In this case, the data remains on the GPU. Therefore, when the object is given a gpuArray, calculations take place entirely on the GPU and no data transfer occurs. Invoking the step method with gpuArray arguments provides increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU in the Parallel Computing Toolbox documentation.
To decode input symbols and produce binary output symbols:
H = comm.gpu.ViterbiDecoder creates a Viterbi decoder System object, H. This object uses the Viterbi algorithm to decode convolutionally encoded input data.
H = comm.gpu.ViterbiDecoder(Name,Value) creates a Viterbi decoder object, H, with the specified property Name set to the specified Value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN.
H = comm.gpu.ViterbiDecoder(TRELLIS,Name,Value) creates a Viterbi decoder object, H, with the TrellisStructure property set to TRELLIS, and other specified property Names set to the specified Values.
Trellis structure of convolutional code
Specify the trellis as a MATLAB structure that contains the trellis description of the convolutional code. Use the istrellis function to check if a structure is a valid trellis structure. This object supports rate 1/2, 1/3 and 1/4 trellises from simple feedforward encoders. The default value is the result of poly2trellis(7, [171 133]).
Specify the format of the input to the decoder as one of Unquantized | Hard | Soft. The default is Unquantized.
When you set this property to Unquantized, the input must be a real vector of double or single precision unquantized soft values. The object considers negative numbers to be ones and positive numbers to be zeros. When you set this property to Hard, the input must be a vector of hard decision values, which are zeros or ones. The data type of the inputs can be double precision or single precision. When you set this property to Soft, the input must be a vector of quantized soft values represented as integers between 0 and 2^SoftInputWordLength-1. The data type of the inputs can be double precision or single precision.
Soft input word length
Specify the number of bits used to represent each quantized soft input value as a positive, integer scalar. This property applies when you set the InputFormat property to Soft. The default is 4 bits.
Action when input values are out of range
The only valid setting is Ignore which ignores out of range inputs.
Specify the number of trellis branches used to construct each traceback path as a positive, integer scalar less than or equal to 256. The traceback depth influences the decoding accuracy and delay. The number of zero symbols that precede the first decoded symbol in the output represent a decoding delay. When you set the TerminationMethod property to Continuous, the decoding delay consists of TracebackDepth zero symbols, or TracebackDepth zero bits for a rate 1/N convolutional code. When you set the TerminationMethod property to Truncated or Terminated, there is no output delay and TracebackDepth must be less than or equal to the number of symbols in each input. If the code rate is 1/2, a typical traceback depth value is about five times the constraint length of the code. The default is 34.
Termination method of encoded frame
Specify TerminationMethod as one of Continuous | Truncated | Terminated. The default is Continuous. In Continuous mode, the object saves its internal state metric at the end of each frame for use with the next frame. The object treats each traceback path independently. Select Continuous mode when the input signal contains only one symbol. In Truncated mode, the object treats each frame independently. The traceback path starts at the state with the best metric and always ends in the all-zeros state. In Terminated mode, the object treats each frame independently, and the traceback path always starts and ends in the all-zeros state.
Enable decoder reset input
Set this property to true to enable an additional step method input. When the reset input is a non-zero value, the object resets the internal states of the decoder to initial conditions. This property applies when you set the TerminationMethod property to Continuous. The default is false.
Delay output reset
Delaying the output reset is not supported. The only valid setting is false.
Source of puncture pattern
Specify the source of the puncture pattern as one of None | Property. The default is None. When you set this property to None the object assumes no puncturing. Set this property to Property to decode punctured codewords based on a puncture pattern vector specified via the PuncturePattern property.
Puncture pattern vector
Specify puncture pattern used to puncture the encoded data. The default is [1; 1; 0; 1; 0; 1]. The puncture pattern is a column vector of ones and zeros, where the zeros indicate where to insert dummy bits. The puncture pattern must match the puncture pattern used by the encoder. This property applies when you set the PuncturePatternSource property to Property.
Enable erasures input
Erasures are not supported. The only valid setting is false.
Data type of output
The only valid setting is Full precision which makes the output data type match the input data type.
Number of independent frames present in the input and output data vectors.
Specify the number of independent frames contained in a single data input/output vector. The input vector will be segmented into NumFrames segments and decoded independently. The output will contain NumFrames decoded segments. The default value of this property is 1. This property is applies when you set the TerminationMethod is set to Terminated or Truncated.
|clone||Create Viterbi Decoder object with same property values|
|info||Display information about GPU-based Viterbi Decoder object|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|reset||Reset states of the GPU-based Viterbi Decoder modulator object|
|step||Decode convolutionally encoded data using Viterbi algorithm|
Transmit a convolutionally encoded 8-DPSK-modulated bit stream through an AWGN channel. Then, demodulate, decode using a Viterbi decoder, and count errors.
hConEnc = comm.ConvolutionalEncoder; hMod = comm.DPSKModulator('BitInput',true); hChan = comm.gpu.AWGNChannel('NoiseMethod', ... 'Signal to noise ratio (SNR)', 'SNR',10); hDemod = comm.DPSKDemodulator('BitOutput',true); hDec = comm.gpu.ViterbiDecoder('InputFormat','Hard'); % Delay in bits is TracebackDepth times the number of % bits per symbol delay = hDec.TracebackDepth*... log2(hDec.TrellisStructure.numInputSymbols); hError = comm.ErrorRate('ComputationDelay',3,'ReceiveDelay',delay); for counter = 1:20 data = randi([0 1],30,1); encodedData = step(hConEnc, data); modSignal = step(hMod, encodedData); receivedSignal = step(hChan, modSignal); demodSignal = step(hDemod, receivedSignal); receivedBits = step(hDec, demodSignal); errorStats = step(hError, data, receivedBits); end fprintf('Error rate = %f\nNumber of errors = %d\n', ... errorStats(1), errorStats(2))
 Fettweis, G., H. Meyr. "Feedforward Architecture for Parallel Viterbi Decoding," Journal of VLSI Signal Processing, Vol. 3, June 1991.