Main Content

comm.gpu.LDPCDecoder

Decode binary low-density parity-check (LDPC) code 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.LDPCDecoder System object™ uses the belief propagation algorithm to decode a binary LDPC code, which is input to the object as the soft-decision output (log-likelihood ratio of received bits) from demodulation. The object decodes generic binary LDPC codes where no patterns in the parity-check matrix are assumed. For more information, see Belief Propagation Decoding.

To decode an LDPC-encoded signal:

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

gpu_ldpcdecoder = comm.gpu.LDPCDecoder creates a GPU-based binary LDPC decoder System object. This object performs LDPC decoding based on the specified parity-check matrix.

gpu_ldpcdecoder = comm.gpu.LDPCDecoder(parity) sets the ParityCheckMatrix property to parity and creates a GPU-based LDPC decoder System object. The parity input must be specified as described by the ParityCheckMatrix property.

gpu_ldpcdecoder = comm.gpu.LDPCDecoder(___,Name,Value) sets properties using one or more name-value pairs, in addition to inputs from any of the prior syntaxes. For example, comm.LDPCDecoder('DecisionMethod','Soft decision') configures an LDPC decoder System object to decode data using the soft-decision method and output log-likelihood ratios of data type double. Enclose each property name in quotes.

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.

Parity-check matrix, specified as a sparse (NK)-by-N binary-valued matrix. N is the length of the received signal and must be in the range (0, 231). K is the length of the uncoded message and must be less than N. The last (NK) columns in the parity-check matrix must be an invertible matrix in the Galois field of order 2, gf(2).

You can also specify the parity-check matrix as a two-column nonsparse index matrix, I, that defines the row and column indices of the 1s in the parity-check matrix such that sparse(I(:,1),I(:,2),1).

This property accepts numeric data types. When you set this property to a sparse binary matrix, this property also accepts the logical data type.

The default value uses the dvbs2ldpc function to configure a sparse parity-check matrix for half-rate LDPC coding, as specified in the DVB-S.2 standard.

Example: dvbs2ldpc(R,'indices') configures the index matrix for the DVB-S.2 standard, where R is the code rate, and 'indices' specifies the output format of dvbs2ldpc as a two-column double-precision matrix that defines the row and column indices of the 1s in the parity-check matrix.

Data Types: double | logical

Output value format, specified as one of these values:

  • 'Information part' — The object outputs a K-by-1 column vector containing only the information-part of the received log-likelihood ratio vector. K is the length of the uncoded message.

  • 'Whole codeword' — The object outputs an N-by-1 column vector containing the whole log-likelihood ratio vector. N is the length of the received signal.

    N and K must align with the dimension of the (NK)-by-K parity-check matrix.

Data Types: char

Decision method used for decoding, specified as one of these values:

  • 'Hard decision' — The object outputs decoded data of data type logical.

  • 'Soft decision' — The object outputs log-likelihood ratios of data type double.

Data Types: char

Condition for iteration termination, specified as one of these values:

  • 'Maximum iteration count' — Decoding terminates after the number of iterations specified by the MaximumIterationCount property.

  • 'Parity check satisfied' — Decoding terminates after all parity checks are satisfied. If not all parity checks are satisfied, decoding terminates after the number of iterations specified by the MaximumIterationCount property.

Data Types: char

Maximum number of decoding iterations, specified as a positive integer.

Data Types: double

Output number of iterations executed, specified as false or true. To output the number of iterations executed, set this property to true.

Data Types: logical

Output final parity checks, specified as false or true. To output the final calculated parity checks, set this property to true.

Data Types: logical

Usage

Description

example

y = gpu_ldpcdecoder(x) decodes input data using an LDPC code based on the default parity-check matrix.

[y,numiter] = gpu_ldpcdecoder(x) returns the decoded data, y, and number of iterations performed, numiter. To use this syntax, set the NumIterationsOutputPort property to true.

[y,parity] = gpu_ldpcdecoder(x) returns the decoded data, y, and final parity checks, parity. To use this syntax, set the FinalParityChecksOutputPort property to true.

[y,numiter,parity] = gpu_ldpcdecoder(x) returns the decoded data, number of iterations performed, and final parity checks. To use this syntax, set the NumIterationsOutputPort and FinalParityChecksOutputPort properties to true.

Input Arguments

expand all

Log-likelihood ratios, specified as an N-by-1 column vector containing the soft-decision output from demodulation. N is the number of bits in the LDPC codeword before modulation. Each element is the log-likelihood ratio for a received bit. Element values are more likely to be 0 if the log-likelihood ratio is positive. The first K elements correspond to the information-part of the input message.

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

Output Arguments

expand all

Decoded data, returned as a column vector. The DecisionMethod property specifies whether the object outputs hard decisions or soft decisions (log-likelihood ratios).

  • If the OutputValue property is set to 'Information part', the output includes only the information-part of the received log-likelihood ratio vector.

  • If the OutputValue property is set to 'Whole codeword', the output includes the whole log-likelihood ratio vector.

Data Types: double | logical

Number of executed decoding iterations, returned as a positive integer.

Dependencies

To enable this output, set the NumIterationsOutputPort property to true.

Final parity checks after decoding the input LDPC code, returned as an (N-K)-by-1 column vector. N is the number of bits in the LDPC codeword before modulation. K is the length of the uncoded message.

Dependencies

To enable this output, set the FinalParityChecksOutputPort property to true.

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

Using a comm.gpu.LDPCDecoder System Object™ to decode the signal, transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel. After adding AWGN, demodulate and decode the received signal. Compute the error statistics for the reception of uncoded and LDPC-coded signals. For more information, see Accelerate Simulation Using GPUs.

Define simulation variables. Create an LDPC encoder configuration object and System objects for the LDPC decoder, QPSK modulator, and QPSK demodulators.

M = 4; % Modulation order (QPSK)
snr = [0.25,0.5,0.75,1.0,1.25];
numFrames = 10;
gpuldpcDecoder = comm.gpu.LDPCDecoder;
encoderCfg = ldpcEncoderConfig(gpuldpcDecoder.ParityCheckMatrix);
pskMod = comm.PSKModulator(M,'BitInput',true);
pskDemod = comm.PSKDemodulator(M,'BitOutput',true,...
    'DecisionMethod','Approximate log-likelihood ratio');
pskuDemod = comm.PSKDemodulator(M,'BitOutput',true,...
    'DecisionMethod','Hard decision');
errRate = zeros(1,length(snr));
uncErrRate = zeros(1,length(snr));

For each SNR setting and all frames, compute the error statistics for uncoded and LDPC-coded signals.

for ii = 1:length(snr)
    ttlErr = 0;
    ttlErrUnc = 0;
    pskDemod.Variance = 1/10^(snr(ii)/10); % Set variance
    for counter = 1:numFrames
        data = logical(randi([0 1],32400,1));
        % Transmit and receiver uncoded signal data
        mod_uncSig = pskMod(data);
        rx_uncSig = awgn(mod_uncSig,snr(ii),'measured');
        demod_uncSig = pskuDemod(rx_uncSig);
        numErrUnc = biterr(data,demod_uncSig);
        ttlErrUnc = ttlErrUnc + numErrUnc;
        % Transmit and receive LDPC coded signal data
        encData = ldpcEncode(data,encoderCfg);
        modSig = pskMod(encData);
        rxSig = awgn(modSig,snr(ii),'measured');
        demodSig = pskDemod(rxSig);
        rxBits = gpuldpcDecoder(demodSig);
        numErr = biterr(data,rxBits);
        ttlErr = ttlErr + numErr;
    end
    ttlBits = numFrames*length(rxBits);
    uncErrRate(ii) = ttlErrUnc/ttlBits;
    errRate(ii) = ttlErr/ttlBits;
end

Plot the error statistics for uncoded and LDPC-coded data.

plot(snr,uncErrRate,snr,errRate)
legend('Uncoded','LDPC coded')
xlabel('SNR (dB)')
ylabel('BER')

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent Uncoded, LDPC coded.

Limitations

  • The comm.gpu.LDPCDecoder System object cannot be included in MATLAB System (Simulink) blocks.

More About

expand all

Algorithms

expand all

This object performs LDPC decoding using the belief propagation algorithm, also known as a message-passing algorithm.

References

[1] Gallager, Robert G. Low-Density Parity-Check Codes. Cambridge, MA: MIT Press, 1963.

Extended Capabilities

Version History

Introduced in R2012a

expand all