This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


NB-IoT downlink shared channel decoding


[trblkout,blkcrc,stateout] = lteNDLSCHDecode(trblklen,cwin)
[trblkout,blkcrc,stateout] = lteNDLSCHDecode(trblklen,cwin,statein)


[trblkout,blkcrc,stateout] = lteNDLSCHDecode(trblklen,cwin) returns the information bits, trblkout, decoded from the input soft LLR codeword data, cwin. The NB-IoT downlink shared channel (DL-SCH) decoder includes rate recovery, Viterbi decoding, and CRC calculations. The function also returns the type-24A transport block CRC decoding result in blkcrc and the HARQ process decoding state in stateout.


[trblkout,blkcrc,stateout] = lteNDLSCHDecode(trblklen,cwin,statein)specifies the initial HARQ process state in the statein structure. The initial transmission and the re-transmission are both bundles containing multiple subframes, defined in Section of [1].


collapse all

This example shows how to transmit a bundle carrying the same transport block twice. The LLR soft bits from repeated subframes in a bundle are combined in structure dstate, the LLR soft bits from two bundles are combined in structure state. Note that dstate is reset before the re-transmission of the bundle.

Specify the cell-wide settings and channel transmission configuration in parameter structures enb and chs.

enb.NNCellID = 0;
enb.NBRefP = 1;
enb.NFrame = 1;
chs.NSF = 3;
chs.NRep = 4;
chs.RNTI = 0;
chs.NPDSCHDataType = 'NotBCCH';

Set the transport block length to 208 and the output codeword length to 960. Initialize the decoder states for the first HARQ transmission. Generate transport block data.

trblklen = 208;
outlen = 960;
estate = []; 
dstate = []; 
state = [];
trblkin = randi([0 1],trblklen,1);

Generate the 960 NB-Iot DL-SCH codeword bits.

cw = lteNDLSCH(outlen,trblkin);

Perform the initial transmission of a bundle containing the transport block. Verify if there are errors in the transmission.

for subframeIdx = 0:(chs.NSF*chs.NRep-1)
    enb.NSubframe = subframeIdx;
    [sym,estate] = lteNPDSCH(enb,chs,cw,estate);
    [rxcw, dstate] = lteNPDSCHDecode(enb,chs,sym,dstate);
[trblkout1,blkerr1,state] = lteNDLSCHDecode(trblklen,rxcw,state);
blkerr1 = logical

Perform the re-transmission of the bundle containing the same transport block. The information obtained from the initial bundle transmission is saved in state and used as an input to lteNDLSCHDecode. Verify if there are errors in the re-transmission.

for subframeIdx = chs.NSF*chs.NRep:(2*chs.NSF*chs.NRep-1)
    enb.NSubframe = subframeIdx;
    [sym,estate] = lteNPDSCH(enb,chs,cw,estate);
    [rxcw,dstate] = lteNPDSCHDecode(enb,chs,sym,dstate);
[trblkout2,blkerr2,state] = lteNDLSCHDecode(trblklen,rxcw,state);
blkerr2 = logical

Input Arguments

collapse all

Transport block length, specified as a nonnegative integer. trblklen defines the transport block lengths to which the input code blocks should be rate-recovered and decoded.

Data Types: double

Soft LLR codeword data, specified as a numeric vector. cwin contains the floating-point soft LLR data of the codeword to be decoded.

Data Types: double

Initial HARQ process state, specified as a structure. The structure can be empty or contain one field, CBSBuffers, which is defined as follows:

Parameter FieldValuesDescription

Cell array of vectors

A vector representing the LLR soft buffer state associated with a single transport block. The buffer is positioned at the input to the Viterbi decoder, after explicit rate recovery.

The updated buffer states after decoding are returned in the CBSBuffers field of the output parameter stateout. The statein array is normally generated and recycled from the stateout of previous calls to lteNDLSCHDecode as part of a sequence of HARQ transmissions.

Data Types: struct

Output Arguments

collapse all

Decoded information bits, returned as a numeric vector.

Data Types: int8 | cell

Type-24A transport block CRC decoding result, returned as a logical scalar.

Data Types: logical

HARQ process decoding state, returned as a structure. stateout contains the internal state of a transport block in the following fields.

Parameter FieldValuesDescription

Cell array of vectors

Cell array of vectors representing the LLR soft buffer states for the set of code blocks associated with a single transport block. The buffers are positioned at the input to the Viterbi decoder, after explicit rate recovery.


Logical scalar

Type-24A transport block CRC decoding error

Data Types: struct


[1] 3GPP TS 36.321. “Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network; Evolved Universal Terrestrial Radio Access (E-UTRA). URL:

Introduced in R2018a