Main Content

comm.gpu.ConvolutionalEncoder

Convolutionally encode binary data with GPU

To use this object, you must install Parallel Computing Toolbox™ and have access to a supported GPU. If the host computer has a GPU configured, processing uses the GPU. Otherwise, processing uses the CPU. For more information about GPUs, see GPU Computing (Parallel Computing Toolbox).

Description

The comm.gpu.ConvolutionalEncoder System object™ convolutionally encodes a sequence of binary input vectors to produce a sequence of binary output vectors by using a graphics processing unit (GPU).

To convolutionally encode a binary signal:

  1. Create the comm.gpu.ConvolutionalEncoder 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

gpuConvEncoder = comm.gpu.ConvolutionalEncoder creates a GPU-based convolutional encoder System object.

example

gpuConvEncoder = comm.gpu.ConvolutionalEncoder(trellis) sets the TrellisStructure property to trellis.

gpuConvEncoder = comm.gpu.ConvolutionalEncoder(___,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 retain the encoder states at the end of each input vector for use with the next input vector.

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 structure 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.

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

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

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.

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: struct

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

  • 'Continuous' — The System object retains the encoder states at the end of each input vector for use with the next input vector.

  • 'Truncated' — The System object treats each input vector independently. The encoder states are reset at the start of each input vector. If you set the InitialStateInputPort property to 0 (false), the object resets its states to the all-zeros state. If you set the InitialStateInputPort property to 1 (true), the object resets its states to the values you specify in the InitialStateInputPort input.

  • 'Terminated' — The System object treats each input vector independently. For each input vector, the object uses extra bits to set the encoder states to the all-zeros states at the end of the vector. For a rate K/N code, the object outputs a vector of length (N ✕ (L + S))/K. In this calculation, S = constraintLength – 1 (or, in the case of multiple constraint lengths, S = sum(constraintLength(i) – 1). L is the length of the input. constraintLength – 1 is defined as log2(NumStates).

Data Types: char | string

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

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

Option to enable the initial state input, specified as a numeric or logical 0 (false). The only valid setting is false.

Data Types: logical | numeric

Option to enable the final state output, 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 punctures the code. This puncturing is based on the puncture pattern vector that you specify for the PuncturePattern property.

Dependencies

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

Data Types: char | string

Puncture pattern vector to puncture the encoded data, specified as a column vector. The vector must contain 1s and 0s, where 0 indicates the position of punctured bits or excluded bits.

Dependencies

To enable this property, set the TerminationMethod property to 'Continuous' or 'Truncated' and the PuncturePatternSource property to 'Property'.

Data Types: double

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 encodes them independently. The output contains NumFrames encoded segments.

Dependencies

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

Data Types: double

Usage

Description

codeword = gpuConvEncoder(message) convolutionally encodes the input message specified by the trellis structure and returns the encoded codeword.

example

Input Arguments

expand all

Input message, specified as a binary-valued column vector.

To decrease data transfer latency, format the input signal as a gpuArray (Parallel Computing Toolbox) object. For more information, see Array Processing with GPU-based System Objects.

Data Types: double | single | logical

Output Arguments

expand all

Convolutionally encoded message, returned as a binary-valued column vector. This output vector has the same data type and orientation as input message.

When the convolutional encoder represents a rate K/N code, the length of the input vector equals K×L for some positive integer L. The object sets the length of this output vector to L×N.

Data Types: double | single | logical

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

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 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 making 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 = awgn(modSignal,7); % SNR = 7 dB. Signal power = 0 dBW
    demodSignal = demodPSK(receivedSignal);
    receivedBits = vDec(demodSignal);
    errors = error(data,gather(receivedBits));
end

Display the number of errors.

errors(2)
ans = 26

More About

expand all

Extended Capabilities

Version History

Introduced in R2012a