Main Content

nrPUSCHDescramble

Perform PUSCH descrambling

Description

cw = nrPUSCHDescramble(in,nid,rnti) returns the soft bits resulting from the inverse operation of physical uplink shared channel (PUSCH) scrambling from TS 38.211 Section 6.3.1.1 [1]. in is the scrambled soft bits of one or two codewords. nid is the scrambling identity, and rnti is the radio network temporary identifier (RNTI) of the user equipment (UE). When you use this syntax, the function descrambles only the data bits because the placeholder bit locations for any uplink control information (UCI), if present, are unknown in this case.

example

cw = nrPUSCHDescramble(in,nid,rnti,nrapid) specifies random access preamble index nrapid to initialize the scrambling sequence for msgA on PUSCH, as defined in Release 16 of TS 38.211 Section 6.3.1.1.

When in specifies the scrambled soft bits of two codewords, the function ignores nrapid. (since R2024a)

cw = nrPUSCHDescramble(in,nid,rnti,nrapid,xInd,yInd) specifies UCI placeholder X bit locations xInd and UCI placeholder Y bit locations yInd. The inputs xInd and yInd are 1-based column vectors within the codeword and indicate the respective placeholder locations.

When in specifies the scrambled soft bits of two codewords, the function assumes that the UCI is multiplexed on the first codeword. (since R2024a)

example

cw = nrPUSCHDescramble(in,nid,rnti,nrapid,xInd,yInd,quci) specifies on which codeword the UCI is multiplexed. When in specifies the scrambled soft bits of a single codeword, the function ignores quci. (since R2024a)

Examples

collapse all

Create a random sequence of binary values corresponding to a codeword containing 3000 bits. Perform PUSCH scrambling initialized with the specified physical layer cell identity number and RNTI.

cw = randi([0 1],3000,1);
ncellid = 42;
rnti = 101;
scrambled = nrPUSCHScramble(cw,ncellid,rnti);

Modulate the scrambled data using 16-QAM modulation. Demodulate the result.

modulation = '16QAM';
sym = nrSymbolModulate(scrambled,modulation);
demod = nrSymbolDemodulate(sym,modulation);

Perform PUSCH descrambling of the demodulated symbols.

descrambled = nrPUSCHDescramble(demod,ncellid,rnti)
descrambled = 3000×1
1010 ×

   -1.6000
   -1.6000
    0.4000
   -0.4000
   -1.6000
    0.4000
    0.4000
   -0.4000
   -0.4000
   -0.4000
      ⋮

Perform hard decision on the soft metric.

rxcw = double(descrambled<0)
rxcw = 3000×1

     1
     1
     0
     1
     1
     0
     0
     1
     1
     1
      ⋮

Compare the result with the original codeword.

isequal(cw,rxcw)
ans = logical
   1

Create a codeword for 1 bit.

cw = [1 -2 -1 -1]';

Specify the scrambling identity as 100 and radio network temporary identifier as 65,350.

nid = 100;
rnti = 65350;

Perform PUSCH scrambling that is initialized with the UCI placeholder X and Y bit locations.

xind = find(cw == -1);
yind = find(cw == -2);
scrambled = nrPUSCHScramble(cw,nid,rnti);

Modulate the scrambled data using 16-QAM scheme. Demodulate the result.

modulation = '16QAM';
sym = nrSymbolModulate(scrambled,modulation);
demod = nrSymbolDemodulate(sym,modulation);

Perform PUSCH descrambling of the demodulated symbols.

descrambled = nrPUSCHDescramble(demod,nid,rnti,xind,yind)
descrambled = 4×1
1010 ×

   -1.6000
   -1.6000
   -0.4000
   -0.4000

Compare the result with the original codeword.

isequal(descrambled(1)<0,cw(1))
ans = logical
   1

Input Arguments

collapse all

Approximate log-likelihood ratio (LLR) soft bits, specified as a real column vector, representing the scrambled soft bits of a single codeword, or a cell array of one or two real column vectors, representing the scrambled soft bits of one or two codewords. Sign represents scrambled hard bit.

Data Types: double | single

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

Random access preamble index, specified as one of these values.

  • [] — Use this value to indicate that the scrambling initialization does not consider msgA on PUSCH.

  • Integer from 0 to 63 — Use this value to initialize the scrambling sequence for msgA on PUSCH, as defined in Release 16 of TS 38.211 Section 6.3.1.1.

Data Types: double

X placeholder indices of the UCI, specified as a column vector of positive values. When you specify this input, the function descrambles the input codeword, in, at all locations except the X placeholder locations. A value of [] indicates no X placeholder indices.

Data Types: double

Y placeholder indices of the UCI, specified as a column vector of positive values. The input codeword, in, at the placeholder locations, yInd, is descrambled with the previous values of the scrambling sequence. A value of [] indicates no Y placeholder indices.

Data Types: double

Since R2024a

Codeword on which the UCI is multiplexed, specified as one of these values:

  • 0 — The UCI is multiplexed on the first codeword.

  • 1 — The UCI is multiplexed on the second codeword.

Data Types: double

Output Arguments

collapse all

Descrambled approximate LLR soft bits, returned as one of these values:

  • Numeric column vector — The function only returns this value when the in input is a column vector.

  • Cell array of one or two numeric column vectors — The function only returns this value when the in input is cell array of one or two column vectors, respectively. (since R2024a)

Sign represents descrambled hard bit.

Data Types: double | single

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™.

Version History

Introduced in R2019a

expand all

See Also

Functions