Decode input signal using turbo decoding 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).
System object™ decodes the input signal by using a parallel concatenated decoding scheme
on 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.
To decode an input signal using a turbo decoding scheme:
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 example,
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
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 Decode BPSK Modulated Data
Transmit turbo-encoded blocks of BPSK-modulated data over a AWGN channel. Decode individual data frames by using a GPU-based turbo decoder System object and accumulate error statistics. Display the errors statistics after processing all of the data frames.
Specify the frame length. To produce repeatable results, use the random stream property with the seed set.
framelen = 256; s = RandStream('mt19937ar',Seed=11);
Create a turbo encoder System object and GPU-based turbo decoder System object. Define the trellis structure for the constituent convolutional code by using the
poly2trellis function. Generate the interleaver indices as a random column vector of unique integers that define the mapping used to permute the input bits at the encoder and decoder by using the
intrlvrIndices = randperm(s,framelen); trellis = poly2trellis(4,[13 15 17],13); turboEnc = comm.TurboEncoder( ... TrellisStructure=trellis, ... InterleaverIndices=intrlvrIndices); turboDec = comm.gpu.TurboDecoder( ... TrellisStructure=trellis, ... InterleaverIndices=intrlvrIndices, ... NumIterations=4);
Define the modulation order for BPSK modulation. Define the SNR level for the AWGN channel. Create an error rate System object to calculate error statistics. Run the simulation and calculate error results by comparing the original data to the received data.
M = 2; % BPSK modulation snr = 2; % dB numframes = 100; errorRate = comm.ErrorRate; for ii = 1:numframes data = randi(s,[0 1],framelen,1); encodedData = turboEnc(data); modSignal = pskmod(encodedData,M); rxsig = awgn(modSignal,2); demodsig = pskdemod(rxsig,M); rxbits = turboDec(demodsig); errorStats = errorRate(data,rxbits); end fprintf('BER = %f\nNumber of errors = %d\nTotal bits = %d\n', ... errorStats(1),errorStats(2),errorStats(3))
BER = 0.001680 Number of errors = 43 Total bits = 25600
Array Processing with GPU-based System Objects
A GPU-based System object accepts typical MATLAB® arrays or
gpuArray (Parallel Computing Toolbox) objects. The output signal data
type matches the input signal data type.
When the input signal to the GPU-based System object is a
gpuArrayobject, calculations take place entirely on the GPU, the data remains on the GPU, and the output signal is a
gpuArrayarguments minimizes data transfer latency by limiting the number of data transfers between the CPU and the GPU when your simulation runs. For more information, see Establish Arrays on a GPU (Parallel Computing Toolbox).
When the input signal is a MATLAB array, the GPU-based System object transfers the data between the CPU and the GPU for each object call. The output signal is a MATLAB array and data transfer latency occurs.
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 Accelerate Simulation Using GPUs.
Introduced in R2012a