Main Content

lteNPUSCHDecode

Decode NPUSCH symbols

Description

[cw,stateOut,symbols] = lteNPUSCHDecode(ue,chs,sym) recovers cw, a codeword of soft bits, by decoding sym, the narrowband uplink shared channel (NPUSCH) symbols for the specified user equipment (UE) settings ue and channel transmission configuration chs. The decoding process comprises inverting NPUSCH channel encoding, as described in section 10.1.3 of [1]. The function also returns stateOut, a structure containing the decoder state for bundle reception, and symbols, a vector of received constellation symbols.

[cw,stateOut,symbols] = lteNPUSCHDecode(ue,chs,sym,hEst,noiseEst) decodes the NPUSCH symbols for the specified channel estimate hEst and noise power spectral density estimate noiseEst.

example

[cw,stateOut,symbols] = lteNPUSCHDecode(___,stateIn) specifies stateIn, the initial decoder state, in addition to any input argument combination from previous syntaxes.

Examples

collapse all

Generate NPUSCH symbols on a slot-by-slot basis for a bundle comprising eight slots for an input codeword. Recover the corresponding codeword of soft bits by decoding the NPUSCH symbols.

Configure UE-specific settings.

ue = struct('NNCellID',0,'NBULSubcarrierSpacing','15kHz');

Specify the channel transmission configuration.

chs = struct('NPUSCHFormat','Data','NRUsc',12,'NRep',4,'NRU',1,...
    'NULSlots',2,'Modulation','QPSK','RNTI',0);

Generate a codeword of bits.

cwLen = 2*20*chs.NRUsc*chs.NRU*chs.NULSlots;
cwIn = ones(cwLen,1);

Specify the initial encoder and decoder states as empty structures, indicating the start of a bundle.

encoderStateIn = struct();
stateIn = struct();

Generate NPUSCH symbols for bundle transmission and decode the bundle on a slot-by-slot basis.

for SlotIdx = 0:(chs.NRep*chs.NRU*chs.NULSlots - 1)
    ue.NSlot = SlotIdx;
    [sym,encoderStateOut] = lteNPUSCH(ue,chs,cwIn,encoderStateIn);
    encoderStateIn = encoderStateOut;
    [cw,stateOut,symbols] = lteNPUSCHDecode(ue,chs,sym,stateIn);
    stateIn = stateOut;
end

Confirm that the transmission and reception reach the end of the bundle and that the received codeword corresponds to the input codeword.

disp(encoderStateOut.EndOfTx)
   1
disp(stateOut.EndOfTx)
   1
disp(isequal(cwIn,cw>0))
   1

Input Arguments

collapse all

UE-specific settings, specified as a structure containing these fields.

FieldValuesDescriptionData Types
NNCellIDInteger in the interval [0, 503]Narrowband physical layer cell identity (PCI)double
NBULSubcarrierSpacing'3.75kHz', '15kHz'

NB-IoT uplink subcarrier spacing

To set a subcarrier spacing of 3.75 kHz, specify this field as '3.75kHz'. To set a subcarrier spacing of 15 kHz, specify this field as '15kHz'.

char, string
NSlotNonnegative integerSlot numberdouble
NFrame0 (default), nonnegative integerFrame numberdouble

Data Types: struct

Channel transmission configuration, specified as a structure containing these fields.

FieldValuesDescriptionData Types
NPUSCHFormat'Data', 'Control'

NPUSCH format

To indicate that the NPUSCH carries narrowband uplink shared channel (UL-SCH) data, specify this field as 'Data'. To indicate that the NPUSCH carries uplink control information, specify this field as 'Control'.

char, string
NRUsc1, 3, 6, 12

Number of consecutive subcarriers in a resource unit (RU)

If you specify the NPUSCHFormat field as 'Control' or the NBULSubcarrierSpacing field of the ue input as '3.75kHz', then you must specify this field as 1 .

double
NRep1, 2, 4, 8, 16, 32, 64, 128Number of repetitions for a codeworddouble
NRU1, 2, 3, 4, 5, 6, 8, 10Number of RUsdouble
NULSlots2, 4, 8, 16

Number of slots per RU

If you specify the NPUSCHFormat field as 'Control', then you must specify this field as 4.

If you specify the NPUSCHFormat field as 'Data', then you must specify this field as:

  • 16 when you specify the NRUsc field as 1

  • 8 when you specify the NRUsc field as 3

  • 4 when you specify the NRUsc field as 6

  • 2 when you specify the NRUsc field as 12

double
Modulation'BPSK', 'QPSK'

Modulation type

To enable binary phase-shift keying (BPSK), specify this field as 'BPSK'. To enable quadrature phase-shift keying (QPSK), specify this field as 'QPSK'.

If you specify the NPUSCHFormat field as 'Control', then you must specify this field as 'BPSK'.

char, string
RNTINonnegative integerRadio network temporary identifier (RNTI) valuedouble
CSI'On' (default), 'Off'

Weight soft bits by channel state information (CSI)

To scale the cw output with CSI, specify this field as 'On'. Otherwise, specify this field as 'Off'.

char, string

Data Types: struct

NPUSCH symbols, specified as a complex-valued matrix of size NSym-by-NRxAnts.

  • NSym is the number of symbols per receive antenna assigned to the NPUSCH for a slot.

  • NRxAnts is the number of receive antennas.

Data Types: double
Complex Number Support: Yes

Channel estimate, specified as a complex-valued matrix of size NSym-by-NRxAnts.

  • NSym is the number of symbols per receive antenna assigned to the NPUSCH for a slot.

  • NRxAnts is the number of receive antennas.

Data Types: double
Complex Number Support: Yes

Noise power spectral density estimate per resource element, specified as a real-valued scalar.

Data Types: double

Initial decoder state for bundle reception, specified as a structure containing these fields.

FieldValuesDescriptionData Types
SlotIdxInteger in the interval [0, (chs.NRU x chs.NULSlots x chs.NRep) – 1]Index of a slot within a bundle, in zero-based formdouble
BlkFlushEnabled1 or true, 0 or falseTo flush the buffers at every block, specify this field as 1 (true). Otherwise, specify this field as 0 (false).logical
InitNSlotNonnegative integerSlot number for scrambling sequence initializationdouble
InitNFrameNonnegative integerFrame number for scrambling sequence initializationdouble
EndOfBlk1 or true, 0 or falseTransport block receipt indicatorlogical
EndOfCW1 or true, 0 or falseCodeword receipt indicatorlogical
EndOfTx1 or true, 0 or falseEnd of bundle indicatorlogical
CWBufferReal-valued column vector of the same length as the cw output.Buffer to store the recovered codeworddouble
CWSLCount(chs.NRU x chs.NULSlots)-by-1 vector of integersRepetition counterdouble

Data Types: struct

Output Arguments

collapse all

Codeword of soft bits, returned as a real-valued column vector.

Data Types: double

Output decoder state, returned as a structure. This output contains the internal state of each transport block in these fields.

FieldValuesDescriptionData Types
SlotIdxInteger in the interval [0, (chs.NRU x chs.NULSlots x chs.NRep) – 1]

Index of a slot within a bundle, in zero-based form

The function returns this field as the SlotIdx field of the stateIn input increased by one. When the SlotIdx field of the stateIn input reaches its maximum value, the function returns this field as 0. If you do not specify the SlotIdx field of the stateIn input, the function returns this field as 0. A value of 0 indicates that the transmission has reached the end of a bundle, which the function also indicates by setting the EndOfTx field to 1.

double
BlkFlushEnabled1, 0Indicator that the function flushes the buffers at every blocklogical
InitNSlotNonnegative integer

Slot number for scrambling sequence initialization

When the slot being processed is at the initialization point, this field is equal to the NSlot field of the ue input. Otherwise, the function returns this field as one of these values.

  • The value of the InitNSlot field of the stateIn input

  • The value of the NSlot field of the ue input when you do not specify the InitNSlot field of the stateIn input

double
InitNFrameNonnegative integer

Frame number for scrambling sequence initialization

When the frame being processed is at the initialization point, this field is equal to the NFrame field of the ue input. Otherwise, the function returns this field as one of these values.

  • The value of the InitNFrame field of the stateIn input

  • 0 when you do not specify the InitNFrame field of the stateIn input

double
EndOfBlk1, 0

Transport block receipt indicator

When the function has received all slots of a transport block at least once, it returns this field as 1.

At the beginning of a bundle, the function resets this field.

logical
EndOfCW1, 0

Codeword receipt indicator

When the function has received the entire codeword, that is, when each element of the CWSLCount field is as least 1, the function returns this field as 1.

At the beginning of a bundle, the function resets this field.

logical
EndOfTx1, 0

End of bundle indicator

When the transmission reaches the end of a bundle, that is, when each element of the CWSLCount field is as least 1, the function returns this field as 1. Otherwise, the function returns this field as 0.

At the beginning of a bundle, the function resets this field.

logical
CWBufferReal-valued column vector of the same length as the cw output.

Buffer to store the recovered codeword

At the beginning of a bundle, the function resets this field.

double
CWSLCount(chs.NRU x chs.NULSlots)-by-1 vector of integers

Repetition counter

Each element indicates how many repetitions of the corresponding codeword portion the CWBuffer field has recovered.

At the beginning of a bundle, the function resets this field.

double

Data Types: struct

Received constellation symbols, returned as a complex-valued column vector.

Data Types: double
Complex Number Support: Yes

More About

collapse all

Bundle

A bundle in the medium access control (MAC) layer refers to the repeated transmissions of a transport block.

For more information, see Section 5.3.2.1 of [2].

Tips

To use this function for reception of a bundle, follow these steps.

  1. Call the function, optionally specifying the initial encoder state using the stateIn input. The stateOut output represents the first transmission of the transport block.

  2. Call the function again, specifying the stateIn input as the stateOut output returned by the previous call to the function.

  3. Repeat step 2 until the function returns the EndOfTx field of the stateOut output as 1 (true), indicating the end of the bundle.

References

[1] 3GPP TS 36.211. “Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network; Evolved Universal Terrestrial Radio Access (E-UTRA). https://www.3gpp.org.

[2] 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). https://www.3gpp.org.

Introduced in R2020a