Decode input signal using turbo decoding 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).
System object™ decodes the input signal by using a parallel concatenated decoding scheme
with a graphics processing unit (GPU). This decoding scheme uses the a-posteriori
probability (APP) decoder as the constituent decoder. The constituent decoders use the
same trellis structure and algorithm.
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
gpuArrayarguments provides increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU (Parallel Computing Toolbox).
To decode an input signal using a turbo decoding scheme with GPU:
comm.gpu.TurboDecoderobject 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?
creates a GPU-based turbo decoder System object. This object uses an APP constituent decoder to iteratively decode
the parallel-concatenated convolutionally encoded input data.
gpuTurboDec = comm.gpu.TurboDecoder
sets Properties using one or more name-value arguments in
addition to any of the input argument combinations in previous syntaxes. For
gpuTurboDec = comm.gpu.TurboDecoder(___,
'NumIterations',10 specifies the number of decoding
iterations used for each call to the System object.
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.
TrellisStructure — Trellis description of constituent convolutional code
poly2trellis(4, [13 15], 13) (default) | structure
Trellis description of the constituent convolutional code, specified as a structure that contains the trellis description for a rate K ∕ N code. K is the number of input bit streams, and N is the number of output bit streams.
K must be 1 for the turbo coder. For more information, see Coding Rate.
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
The trellis structure contains these fields.
numInputSymbols — Number of symbols input to encoder
Number of symbols input to the encoder, specified as an integer equal to 2K, where K is the number of input bit streams.
numOutputSymbols — Number of symbols output from encoder
Number of symbols output from the encoder, specified as an integer equal to 2N, where N is the number of output bit streams.
numStates — Number of states in encoder
power of 2
Number of states in the encoder, specified as a power of 2.
nextStates — Next states
matrix of integers
Next states for all combinations of current states and current inputs, specified
as a matrix of integers. The matrix size must be
outputs — Outputs
matrix of octal numbers
Outputs for all combinations of current states and current inputs, specified as a matrix of
octal numbers. The matrix size must be
InterleaverIndicesSource — Source of interleaver indices
Source of interleaver indices, specified as
The only valid setting for this property is
which uses the interleaver indices that you specify in the
InterleaverIndices — Interleaver indices
(64:-1:1)' (default) | column vector of integers
Interleaver indices that define the mapping used to permute the codeword
bits input to the decoder, specified as a column vector of integers. The
vector must be of length L. Each element of the vector
must be an integer in the range [1, L] and must be
unique. L is the length of the decoded output message,
Algorithm — Decoding algorithm
'True APP' (default)
Decoding algorithm, specified as
'True APP'. The only
valid setting is
'True APP', which implements true APP
NumIterations — Number of decoding iterations
6 (default) | positive integer
Number of decoding iterations, specified as a positive integer. This property sets the number of decoding iterations used for each call to the object.
NumFrames — Number of independent frames
1 (default) | positive integer
Number of independent frames present in the input and output data vectors, specified as a positive integer.
The object segments the input vector into
segments and decodes them independently. The output contains
NumFrames decoded segments.
codeword — Parallel concatenated codeword
Parallel concatenated codeword, specified as a column vector.
dec — Decoded message
binary-valued column vector
Decoded message, returned as a binary-valued column vector. The output signal is the same data type as the input. The object iterates and provides updates to the log-likelihood ratios (LLR) of the uncoded output bits. The output of the object is the hard-decision output of the final LLR update.
When the constituent convolutional code represents a rate 1/N code, the object sets the length
dec to (M-2✕NTails)/(2✕N-1). M is the input
vector length, and NTails is given by
TrellisStructure.numStates)✕N. The length of
equals the length of the interleaver indices.
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
GPU-Based Turbo Encode and Decode BPSK Modulated Data
Transmit turbo-encoded data over a binary phase-shift keying (BPSK) modulated additive white Guassian noise (AWGN) channel. Then, decode using an iterative turbo decoder and display errors.
Define a noise variable, establish a frame length of 256, and use the random stream so that the results are repeatable.
noiseVar = 4; frmLen = 256; s = RandStream('mt19937ar','Seed',11); intrlvrIndices = randperm(s,frmLen);
Create a turbo encoder System object™ with these properties.
tEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4,[13 15 17],13), ... 'InterleaverIndices',intrlvrIndices);
Create a PSK Modulator System object.
modBPSK = comm.BPSKModulator;
Create an AWGN Channel System object.
channel = comm.AWGNChannel('NoiseMethod','Variance', ... 'Variance',noiseVar);
Create a GPU-based Turbo Decoder System object. The trellis structure for the constituent convolutional code is poly2trellis(4, [13 15 17], 13).
tDec = comm.gpu.TurboDecoder('TrellisStructure',poly2trellis(4,[13 15 17],13), ... 'InterleaverIndices',intrlvrIndices, ... 'NumIterations',4);
Create an error rate System object.
errorRate = comm.ErrorRate;
Run the simulation. Convert the received signal to log-likelihood ratios for decoding. Compare original the data to the received data and then calculate the error rate results.
for frmIdx = 1:10 data = randi(s,[0 1],frmLen,1); encodedData = tEnc(data); modSignal = modBPSK(encodedData); receivedSignal = channel(modSignal); receivedBits = tDec(-2/(noiseVar/2)*real(receivedSignal)); errorStats = errorRate(data,receivedBits); end
Display the number of errors.
fprintf('Error rate = %f\nNumber of errors = %d\nTotal bits = %d\n', ... errorStats(1), errorStats(2), errorStats(3));
Error rate = 0.000000 Number of errors = 0 Total bits = 2560
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This System object runs on a GPU, and also supports GPU array inputs. For more information, see Simulation Acceleration Using GPUs.