Main Content

nrPUSCHDecode

Decode PUSCH modulation symbols

Description

example

[cw,symbols] = nrPUSCHDecode(sym,mod,nid,rnti) returns soft bits cw and constellation symbols symbols resulting from the inverse operation of physical uplink shared channel (PUSCH) processing from TS 38.211 Section 6.3.1 [1]. The decoding consists of layer demapping, demodulation of symbols sym with modulation scheme mod, and descrambling with scrambling identity nid. The input rnti is the radio network temporary identifier (RNTI) of the user equipment (UE). This function performs data descrambling only. Because uplink control information (UCI) placeholder bit locations are unknown, the function cannot correctly descramble UCIs if present in the input.

[cw,symbols] = nrPUSCHDecode(___,nVar) specifies the noise variance scaling factor of the soft bits in the PUSCH demodulation in addition to the input arguments in the first syntax.

[cw,symbols] = nrPUSCHDecode(___,transformPrecode,mrb) specifies transform deprecoding as a logical value and the number of allocated PUSCH resource blocks. Specify these inputs in addition to the input arguments in the second syntax. When transformPrecode is set to true, the function applies the inverse of transform precoding defined in TS 38.211 Section 6.3.1.4. mrb specifies the allocated number of PUSCH resource blocks.

example

[cw,symbols] = nrPUSCHDecode(___,txScheme,nLayers,tpmi) specifies the transmission scheme in addition to the input arguments in the third syntax. When txScheme is set to 'codebook', the function performs multi-input multi-output (MIMO) deprecoding based on the specified number of transmission layers nLayers and transmitted precoding matrix indicator (TPMI) tpmi.

example

[cw,symbols] = nrPUSCHDecode(carrier,pusch,sym,nVar) returns soft bits cw and constellation symbols symbols for the specified carrier configuration carrier and PUSCH configuration pusch. The input sym is received PUSCH symbols to decode. The optional input nVar specifies the noise variance scaling factor of the soft bits.

Examples

collapse all

Specify a random sequence of binary values corresponding to a codeword of 8064 bits.

cw = randi([0 1],8064,1);

Using 256-QAM modulation, generate PUSCH modulation symbols for the specified physical layer cell identity number, RNTI, and two transmission layers. By default, this function disables transform precoding and noncodebook-based transmission.

modulation = '256QAM';
nlayers = 2;
ncellid = 17;
rnti = 111;
sym = nrPUSCH(cw,modulation,nlayers,ncellid,rnti)
sym = 504×2 complex

  -0.9971 - 0.8437i   0.0767 + 0.2301i
   0.3835 + 0.2301i   0.9971 - 0.5369i
  -0.3835 - 1.1504i  -0.3835 + 0.9971i
   0.5369 + 0.0767i  -0.9971 + 0.8437i
   1.1504 - 0.9971i  -0.8437 - 0.6903i
  -0.6903 + 0.0767i   1.1504 - 0.3835i
   0.8437 + 0.6903i   1.1504 + 0.2301i
  -0.6903 - 0.2301i  -0.8437 + 1.1504i
   0.0767 + 0.8437i  -0.0767 + 0.6903i
   0.3835 - 0.8437i   0.3835 + 0.9971i
      ⋮

Decode the PUSCH modulation symbols.

demod = nrPUSCHDecode(sym,modulation,ncellid,rnti)
demod = 8064×1
1010 ×

   -1.1529
   -0.8471
    0.2118
   -0.0941
   -0.0235
    0.0235
    0.0235
   -0.0235
   -0.0235
   -0.0941
      ⋮

Perform hard decision on the soft metric.

rxcw = double(demod<0)
rxcw = 8064×1

     1
     1
     0
     1
     1
     0
     0
     1
     1
     1
      ⋮

Compare the result with the original codeword.

isequal(cw,rxcw)
ans = logical
   1

Specify a random sequence of binary values corresponding to a codeword of 8064 bits.

cw = randi([0 1],8064,1);

Using QPSK modulation, generate PUSCH modulation symbols for the specified physical layer cell identity number, RNTI, bandwidth, and one transmission layer. Enable transform precoding and codebook-based transmission based on the specified PUSCH bandwidth, TPMI, and four antennas.

modulation = 'QPSK';
ncellid = 17;
rnti = 111;
nlayers = 1;
transformPrecode = true;
txScheme = 'codebook';
mrb = 6;
tpmi = 1;
nports = 4;
sym = nrPUSCH(cw,modulation,nlayers,ncellid,rnti,transformPrecode,mrb,txScheme,nports,tpmi)
sym = 4032×4 complex

   0.0000 + 0.0000i  -0.1667 + 0.0833i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i  -0.0632 - 0.2911i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i  -0.1519 - 0.0450i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.3677 + 0.3664i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i  -0.3079 - 0.5027i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i  -0.8082 - 0.1640i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i  -0.0640 - 0.2388i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.3936 - 0.4160i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.0851 - 0.4625i   0.0000 + 0.0000i   0.0000 + 0.0000i
   0.0000 + 0.0000i   0.0345 - 0.3333i   0.0000 + 0.0000i   0.0000 + 0.0000i
      ⋮

Decode the PUSCH modulation symbols assuming zero noise variance.

nVar = 0;
demod = nrPUSCHDecode(sym,modulation,ncellid,rnti,nVar,transformPrecode,mrb,txScheme,nlayers,tpmi)
demod = 8064×1
1010 ×

   -2.0000
   -2.0000
    2.0000
   -2.0000
   -2.0000
    2.0000
    2.0000
   -2.0000
   -2.0000
   -2.0000
      ⋮

Perform hard decision on the soft metric.

rxcv = double(demod<0)
rxcv = 8064×1

     1
     1
     0
     1
     1
     0
     0
     1
     1
     1
      ⋮

Compare the result with the original codeword.

isequal(cw,rxcv)
ans = logical
   1

Create a carrier configuration object with physical layer cell identity as 42.

carrier = nrCarrierConfig;
carrier.NCellID = 42;

Create a PUSCH configuration object with these properties.

pusch = nrPUSCHConfig;
pusch.Modulation = '256QAM';
pusch.NumLayers = 2;
pusch.RNTI = 111;
pusch.TransformPrecoding = 0;
pusch.TransmissionScheme = 'nonCodebook';
pusch.NID = []; % Use empty to be equal to NCellID of carrier
pusch.NSizeBWP = 25;
pusch.NStartBWP = 10;
pusch.PRBSet = 0:pusch.NSizeBWP-1; % Occupy entire bandwidth part

Generate PUSCH symbols for a single codeword of 8064 bits with the specified carrier configuration and uplink shared channel configuration.

cw = randi([0 1],8064,1);
sym = nrPUSCH(carrier,pusch,cw)
sym = 504×2 complex

  -0.3835 - 0.8437i  -1.1504 - 0.3835i
   0.6903 + 0.6903i   0.0767 + 0.3835i
  -1.1504 - 0.2301i  -1.1504 + 0.2301i
   0.9971 - 0.6903i  -0.2301 - 0.8437i
  -0.0767 + 0.2301i   0.2301 + 0.8437i
  -0.6903 + 1.1504i   0.8437 + 0.3835i
  -0.0767 + 0.8437i  -0.3835 + 0.5369i
   0.3835 + 0.5369i  -0.8437 - 1.1504i
   0.3835 + 0.2301i  -1.1504 - 0.8437i
   0.2301 - 0.0767i  -0.3835 + 1.1504i
      ⋮

Add an additive white Gaussian noise (AWGN) to the PUSCH symbols. Then demodulate to produce soft bit estimates.

SNR = 30; % SNR in dB
rxsym = awgn(sym,SNR);
demod = nrPUSCHDecode(carrier,pusch,rxsym)
demod = 8064×1
1010 ×

   -0.2106
   -0.8118
    0.0949
   -0.0824
   -0.0231
    0.0294
    0.0239
   -0.0176
   -1.4404
   -0.1963
      ⋮

Perform hard decision on the soft metric.

rxcw = double(demod<0);

Compare the result with the original codeword.

isequal(cw,rxcw)
ans = logical
   1

Input Arguments

collapse all

Received PUSCH modulation symbols, specified as a complex matrix.

Data Types: single | double
Complex Number Support: Yes

Modulation scheme, specified as 'pi/2-BPSK', 'QPSK', '16QAM', '64QAM', or '256QAM'. This modulation scheme determines the modulation type and number of bits used per modulation symbol.

Modulation SchemeNumber of Bits Per Symbol
'pi/2-BPSK'1
'QPSK'2
'16QAM'4
'64QAM'6
'256QAM'8

Data Types: char | string

Scrambling identity, specified as an integer from 0 to 1023. nid is higher layer parameter dataScramblingIdentityPUSCH, ranging from 0 to 1023, if the higher layer parameter is configured. Otherwise, nid is physical layer cell identity number NCellID, ranging from 0 to 1007. For more information, see TS 38.211 Section 6.3.1.1.

Data Types: double

RNTI of the UE, specified as an integer from 0 to 65,535.

Data Types: double

Noise variance, specified as a nonnegative numeric scalar. The soft bits are scaled with the variance of additive white Gaussian noise (AWGN). The default value corresponds to an SNR of 100 dB, assuming unit signal power.

Note

The default value assumes the decoder and coder are connected back-to-back, where the noise variance is zero. To avoid -Inf or +Inf values in the output, the function uses 1e-10 as the default value for noise variance. To get appropriate results when the signal is transmitted through a noisy channel, adjust the noise variance accordingly.

Data Types: double

Transform deprecoding, specified as false or true. For more information, see TS 38.211 Section 6.3.1.4.

Data Types: double | logical

Number of allocated PUSCH resource blocks, specified as an integer from 1 to 275. For more information, see TS 38.214 Section 6.1.2.

Data Types: double

Transmission scheme, specified as one of these values:

  • 'nonCodebook' — Use this option to disable MIMO deprecoding.

  • 'codebook' — Use this option for codebook-based transmission using MIMO deprecoding.

For more information, see TS 38.211 Section 6.3.1.4.

Data Types: char | string

Number of transmission layers, specified as an integer from 1 to 4. For more information, see TS 38.211 Section 6.3.1.3.

Data Types: double

Transmitted precoding matrix indicator, specified as an integer from 0 to 27. The valid range of tpmi depends on the specified number of transmission layers nLayers and the number of ports. For more information, see TS 38.211 Tables 6.3.1.5-1 to 6.3.1.5-7.

Data Types: double

Carrier configuration parameters for a specific OFDM numerology, specified as an nrCarrierConfig object. This function uses only NCellID property of this nrCarrierConfig object.

Property FieldValuesDescription
NCellID

1 (default), integer from 0 to 1007

Physical layer cell identity

PUSCH configuration parameters for a specific OFDM numerology, specified as an nrPUSCHConfig object. This function only uses these nrPUSCHConfig object properties.

Property FieldValuesDescription
Modulation

'QPSK', '16QAM', '64QAM', or '256QAM', 'pi/2-BPSK', string scalar, or character array

Modulation scheme of codeword

NumLayers

1 (default), integer from 1 to 4

Number of transmission layers

NID

[] (default), integer from 0 to 1023

Scrambling identity, specified as an integer from 0 to 1023. Use [] value to allow this property to be equal to NCellID of carrier input.

RNTI

1 (default), integer from 0 to 65,535

Radio network temporary identifier of the user equipment

TransformPrecoding

0 (default), 1

Transform precoding flag, specified as one of these values.

  • 0 — The transform precoding is disabled and waveform type is CP-OFDM.

  • 1 — The transform precoding is enabled and waveform type is DFT-s-OFDM.

PRBSet

[0:51] (default), vector of nonnegative integers from 0 to 274

Physical resource blocks allocated for the shared channel within a BWP (0-based)

TransmissionScheme

'nonCodebook' (default), 'codebook'

PUSCH transmission scheme

TPMI

0 (default), integer from 0 to 27

Transmitted precoding matrix indicator

Output Arguments

collapse all

Approximate log-likelihood ratio (LLR) soft bits, returned as a real column vector. cw inherits the data type of sym. Sign represents hard bits.

Data Types: double | single

Constellation symbols for cw, returned as a column vector of complex numbers. symbols inherits the data type of sym.

Data Types: double | single
Complex Number Support: Yes

References

[1] 3GPP TS 38.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2019a