主要内容

pre6GTransportChannelDecode

Pre-6G transport channel decoding

Since R2026a

    Description

    Add-On Required: This feature requires the 6G Exploration Library for 5G Toolbox add-on.

    [trblk,blkerr,dstate] = pre6GTransportChannelDecode(ch,trblklen,tcr,rv,softbits,dstate) decodes transport channel soft bits for 6G research and prototyping. The decoding consists of rate recovery, soft combining with any buffered retransmission data in dstate, LDPC decoding, code block desegmentation with CRC check, and transport block CRC decoding.

    example

    [trblk,blkerr,dstate] = pre6GTransportChannelDecode(___,Name=Value) specifies options using one or more name-value arguments. For example, MaximumLDPCIterationCount=25 sets the maximum number of LDPC decoding iterations to 25.

    Examples

    collapse all

    Configure a carrier and a physical channel with two layers and 64-QAM modulation that uses the first 25 physical resource blocks (PRBs). Get resource information for the carrier and channel.

    carrier = pre6GCarrierConfig(NSizeGrid=25);
    ch = pre6GPhysicalChannelConfig;
    ch.NumLayers = 2;
    ch.Modulation = "64QAM";
    ch.PRBSet = (0:24)';
    [~,info] = pre6GPhysicalChannelIndices(carrier,ch);

    Get the transport block size and generate random transport blocks for target code rate of 0.75, 120 resource elements (REs) per PRB, and a batch size of four.

    tcr = 0.75;
    NREPrime = 120;
    trblklen = pre6GTBS(ch,tcr,NREPrime);
    B = 4;
    trblkin = randi([0 1],trblklen,B,"int8");

    Encode the transport blocks.

    rv = zeros(1,B);
    outlen = info.G;
    codedBits = pre6GTransportChannel(ch,outlen,tcr,rv,trblkin);

    Convert the coded bits to soft bits and add AWGN with a signal-to-noise ratio of 10 dB.

    snr = 10;
    softbits = 1 - 2*codedBits;
    softbits = awgn(double(softbits),snr);

    Decode the blocks. Display the block errors and bit errors per block.

    [trblk,blkerr] = pre6GTransportChannelDecode(ch,trblklen,tcr,rv,softbits,[]);
    disp("Block errors: " + num2str(blkerr))
    Block errors: 0  0  0  0
    
    disp("Bit errors per block: " + num2str(sum(trblk ~= trblkin)))
    Bit errors per block: 0  0  0  0
    

    Create a physical channel configuration object. Determine the transport block size and codeword length for a target code rate of 0.75 and 144 REs per PRB. Calculate the codeword length.

    ch = pre6GPhysicalChannelConfig;
    ch.Modulation = "256QAM";
    
    tcr = 0.75;
    NREPrime = 144;
    trblklen = pre6GTBS(ch,tcr,NREPrime);
    outlen = NREPrime * numel(ch.PRBSet) * ch.NumLayers * ch.Qm;

    Generate a random transport block. Transmit with HARQ retransmissions and decode with soft combining using the dstate input and output arguments.

    trblkin = randi([0 1],trblklen,1,"int8");
    
    % Transmit with HARQ retransmissions (RV sequence: 0, 2, 3, 1)
    rvSequence = [0 2 3 1];
    snr = 4;
    dstate = [];
    
    for rvIdx = 1:numel(rvSequence)
        rv = rvSequence(rvIdx);
    
        % Encode with current redundancy version
        codedBits = pre6GTransportChannel(ch,outlen,tcr,rv,trblkin);
    
        % Simulate noisy channel and convert to soft bits
        softbits = 1 - 2*codedBits;
        softbits = awgn(double(softbits),snr);
        
    
        % Decode with soft combining via dstate
        [trblk,blkerr,dstate] = pre6GTransportChannelDecode( ...
            ch,trblklen,tcr,rv,softbits,dstate);
    
    disp("RV " + rv + ": block error = " + blkerr)
        if ~blkerr
            break
        end
    end
    RV 0: block error = true
    RV 2: block error = false
    
    disp("Bit errors after decoding: " + sum(trblk ~= trblkin))
    Bit errors after decoding: 0
    

    Input Arguments

    collapse all

    Physical channel configuration parameters, specified as a pre6GPhysicalChannelConfig object. This function uses only these pre6GPhysicalChannelConfig object properties:

    Transport block length, in bits, specified as a positive integer. This value equals the number of information bits in the original transport block before encoding.

    Data Types: double

    Target code rate, specified as a scalar between 0 and 1.

    Data Types: double

    Redundancy version, specified as an integer in the range [0, 3] or a vector of integers in the range [0, 3]. Different redundancy versions indicate different starting positions in the LDPC circular buffer for rate matching. To use a different redundancy version for each element in the batch, specify rv as a vector of length B, where B is the batch size and is equal to the second dimension of softbits.

    Data Types: double

    Received soft bits, specified as a real matrix of size G-by-B, where G is the codeword length and B is the batch size. The values are log-likelihood ratios (LLRs), where negative values represent 1 and positive values represent 0. The length of rv must equal B.

    Data Types: single | double

    Decoder state for HARQ soft combining, specified as [] or a structure. Specify [] for the initial transmission. For retransmissions, pass the dstate output from the previous decoding attempt to enable soft combining of received data across multiple transmissions of the same transport block.

    The structure contains these fields:

    FieldDescription
    CBSBuffersCode block segment (CBS) soft buffers, a 3-D array of size N-by-C-by-B, where N is the LDPC codeword length, C is the number of code block segments, and B is the batch size.
    CBSCRCCBS CRC error flags, a logical C-by-B matrix. A value of true indicates the corresponding code block failed its CRC check. When there is only one code block, this field is empty because no CRC is appended.
    BLKCRCTransport block CRC error flags, a logical 1-by-B vector. A value of true indicates the transport block failed the CRC check.

    Data Types: struct

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: MaximumLDPCIterationCount=25 sets the maximum number of LDPC decoding iterations to 25.

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

    Data Types: double

    LDPC decoding algorithm, specified as one of these options:

    • "Normalized min-sum" — Use a normalized min-sum approximation for LDPC decoding. The scaling factor is specified by the ScalingFactor name-value argument.

    • "Layered belief propagation" — Use layered belief propagation for LDPC decoding.

    • "Offset min-sum" — Use an offset min-sum approximation for LDPC decoding. The offset is specified by the Offset name-value argument.

    Data Types: char | string

    Scaling factor for normalized min-sum LDPC decoding, specified as a scalar in the range (0, 1].

    Dependencies

    This argument applies only when you specify LDPCDecodingAlgorithm as "Normalized min-sum".

    Data Types: double

    Offset for offset min-sum LDPC decoding, specified as a nonnegative finite scalar.

    Dependencies

    This argument applies only when you specify LDPCDecodingAlgorithm as "Offset min-sum".

    Data Types: double

    Output Arguments

    collapse all

    Decoded transport block, returned as a binary matrix of size TBS-by-B, where TBS is the transport block size specified by trblklen and B is the batch size.

    Data Types: int8

    Transport block CRC error indicator, returned as a logical row vector of length B. A value of true indicates that the corresponding transport block in the batch failed the CRC check.

    Data Types: logical

    Updated decoder state, returned as a structure. To enable HARQ soft combining across retransmissions, pass this output as the dstate input on the next call . For the structure fields, see the dstate input argument.

    Data Types: struct

    Extended Capabilities

    expand all

    Version History

    Introduced in R2026a