Main Content

comm.gpu.ViterbiDecoder

Decode convolutionally encoded data using Viterbi algorithm with GPU

To use this object, you must install Parallel Computing Toolbox™ and have access to an appropriate GPU. For more about GPUs, see GPU Computing (Parallel Computing Toolbox).

Description

The comm.gpu.ViterbiDecoder System object™ decodes convolutionally encoded input symbols to produce binary output symbols by using Viterbi algorithm with a graphics processing unit (GPU).

A GPU-based System object accepts typical MATLAB® arrays or objects created using the gpuArray class. A GPU-based System object supports input signals with double- or single-precision data types. The output signal inherits its data type from the input signal.

  • If the input signal is a MATLAB array, the System object handles data transfer between the CPU and the GPU. The output signal is a MATLAB array.

  • If the input signal is a gpuArray, the data remains on the GPU. The output signal is a gpuArray. When the object is given a gpuArray, calculations take place entirely on the GPU, and no data transfer occurs. Passing gpuArray arguments provides increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU (Parallel Computing Toolbox).

To decode convolutionally encoded data using the Viterbi algorithm with a GPU:

  1. Create the comm.gpu.ViterbiDecoder object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

gpuViterbiDec = comm.gpu.ViterbiDecoder creates a GPU-based Viterbi decoder System object.

gpuViterbiDec = comm.gpu.ViterbiDecoder(trellis) sets the TrellisStructure property to trellis.

gpuViterbiDec = comm.gpu.ViterbiDecoder(___,Name,Value) sets Properties using one or more name-value arguments in addition to any of the input argument combinations in previous syntaxes. For example, 'TerminationMethod','Continuous' specifies the termination method as continuous to save the internal state metric at the end of each frame for use with the next frame.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Trellis description of the convolutional code, specified as a structure that contains the trellis description for a rate KN code. K is the number of input bit streams, and N is the number of output bit streams.

You can either use the poly2trellis function to create the trellis structure or create it manually. For more about this structure, see Trellis Description of a Convolutional Code and the istrellis function.

The trellis structure contains these fields.

Number of symbols input to the encoder, specified as an integer equal to 2K, where K is the number of input bit streams.

Data Types: double

Number of symbols output from the encoder, specified as an integer equal to 2N, where N is the number of output bit streams.

Data Types: double

Number of states in the encoder, specified as a power of 2.

Data Types: double

Next states for all combinations of current states and current inputs, specified as a matrix of integers. The matrix size must be numStates-by-2K.

Data Types: double

Outputs for all combinations of current states and current inputs, specified as a matrix of octal numbers. The matrix size must be numStates-by-2K.

Data Types: double

Data Types: struct

Input format to the decoder, specified as one of these values.

  • 'Unquantized' — The input data must be a real-valued vector of double- or single-precision soft decision values that are unquantized. The object maps positive values to logical 0s and negative values to logical 1s.

  • 'Hard' — The input must be a vector of hard decision values, which are 0s or 1s. The data type of the inputs must be double precision or single precision.

  • 'Soft' — The input requires a vector of quantized soft decision values that are represented as integers between 0 and 2SoftInputWordLength – 1. The data type of the inputs must be double precision or single precision.

Data Types: char | string

Soft decision input word length that represents the number of bits for each quantized soft input value, specified as an integer.

Dependencies

To enable this property, set the InputFormat property to 'Soft'.

Data Types: double

Option to take action for an invalid quantized input, specified as 'Ignore'. The only valid setting is 'Ignore', which ignores out-of-range inputs.

Data Types: char | string

Traceback depth, specified as an integer in the range [0, 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. For more information, see Traceback and Decoding Delay and Traceback Depth Estimates.

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', no output delay is present. The TracebackDepth value 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.

Data Types: double

Termination method of the encoded frame, specified as one of these values.

  • 'Continuous' — The System object saves the internal state metric at the end of each frame for use with the next frame. The object treats each traceback path independently. Use this option when the input signal contains only one symbol.

  • 'Truncated' — The System object treats each frame independently. The traceback path starts at the state with the best metric and ends in the all-zeros state.

  • 'Terminated' — The System object treats each frame independently. The traceback path starts and ends in the all-zeros state.

Data Types: char | string

Option to enable the decoder reset input, specified as a numeric or logical 0 (false) or 1 (true). Set this property to true to enable additional input to the object. When this additional reset input is a nonzero value, the internal states of the decoder reset to their initial conditions.

Dependencies

To enable this property, set the TerminationMethod property to 'Continuous'.

Data Types: logical | numeric

Option to delay the output reset, specified as a numeric or logical 0 (false). The only valid setting is false.

Data Types: logical | numeric

Source of the puncture pattern, specified as one of these values.

  • 'None' — The object does not apply puncturing.

  • 'Property' — The object decodes the punctured codewords based on a puncture pattern vector that you specify in the PuncturePattern property.

Data Types: char | string

Puncture pattern vector to puncture the decoded data, specified as a column vector. The vector must contain 1s and 0s, where 0 indicates the position of the punctured bits. This puncture pattern must match the puncture pattern used by the convolutional encoder.

Dependencies

To enable this property, set the PuncturePatternSource property to 'Property'.

Data Types: double

Option to enable the specification of erasures in the input symbols, specified as a numeric or logical 0 (false). The only valid setting is false.

Data Types: logical | numeric

Data type of the output, specified as 'Full precision'. The only valid setting is 'Full precision', which makes the output data type match the input data type.

Data Types: char | string

Number of independent frames present in the input and output data vectors, specified as an integer.

The object segments the input vector into NumFrames segments and decodes them independently. The output contains NumFrames decoded segments.

Dependencies

To enable this property, set the TerminationMethod property to 'Truncated' or 'Terminated'.

Data Types: double

Usage

Description

example

decmsg = gpuViterbiDec(codeword) decodes the GPU-based convolutionally encoded input data by using the GPU-based Viterbi decoding algorithm. The output is the decoded data.

decmsg = gpuViterbiDec(codeword,resetstate) specifies the input to reset the internal states of the decoder. To enable this syntax, set the TerminationMethod property to 'Continuous' and the ResetInputPort property to true.

Input Arguments

expand all

Convolutionally encoded message, specified as a column vector. The data type and element value in the codeword depend on the value of the InputFormat property.

If the convolutional code uses an alphabet of 2N possible output symbols, the length of this input vector must be LN for some positive integer L.

Data Types: double | single

Reset for internal states of the decoder, specified as a logical 0 (false) or 1 (true).

Dependencies

To enable this argument, set the TerminationMethod property to 'Continuous' and the ResetInputPort property to true.

Data Types: double | logical

Output Arguments

expand all

Decoded message, returned as a binary-valued column vector. This output vector has the same data type as input codeword.

If the decoded data uses an alphabet of 2K possible output symbols, the length of this output vector is LK. L is the length of the input message.

Data Types: double | single

Object Functions

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)

expand all

infoCharacteristic information of GPU-based Viterbi decoder
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Create a GPU-based convolutional encoder System object.

conEnc = comm.gpu.ConvolutionalEncoder;

Create a GPU-based phase shift keying (PSK) modulator System object that accepts a bit input signal.

modPSK = comm.gpu.PSKModulator('BitInput',true);

Create a GPU-based additive white Gaussian noise (AWGN) channel System object with a signal-to-noise ratio of seven.

chan = comm.gpu.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)','SNR',7);

Create a GPU-based PSK demodulator System object that outputs a column vector of bit values.

demodPSK = comm.gpu.PSKDemodulator('BitOutput',true);

Create a GPU-based Viterbi decoder System object that accepts an input vector of hard decision values, which are zeros or ones.

vDec = comm.gpu.ViterbiDecoder('InputFormat','Hard');

Create an error rate System object that ignores 3 data samples before makings comparisons. The received data lags behind the transmitted data by 34 samples.

error = comm.ErrorRate('ComputationDelay',3,'ReceiveDelay',34);

Run the simulation by using this for loop to process data.

for counter = 1:20
    data = randi([0 1],30,1);
    encodedData = conEnc(gpuArray(data));
    modSignal = modPSK(encodedData);
    receivedSignal = chan(modSignal);
    demodSignal = demodPSK(receivedSignal);
    receivedBits = vDec(demodSignal);
    errors = error(data,gather(receivedBits));
end

Display the number of errors.

errors(2)
ans = 1

References

[1] Sklar, Bernard. Digital Communications: Fundamentals and Applications. Englewood Cliffs, NJ: Prentice-Hall, 1988.

[2] Moision, B. "A Truncation Depth Rule of Thumb for Convolutional Codes." In Information Theory and Applications Workshop (January 27 2008-February 1 2008, San Diego, California), 555-557. New York: IEEE, 2008.

[3] Fettweis, G., and H. Meyr. “Feedforward Architectures for Parallel Viterbi Decoding.” Journal of VLSI Signal Processing Systems for Signal, Image and Video Technology 3, no. 1–2 (June 1991): 105–19. https://doi.org/10.1007/BF00927838.

Extended Capabilities

Introduced in R2012a