Descrambler
The descrambling is performed at the receiver to undo the effect of scrambling. THe descrambling is carried out in two different ways
When the scrambling is carried out between the channel coder and symbol mapper, and soft information is generated from the symbol mapper for channel decoding
When either the scrambling is carried out before the channel coder or the hard information is conveyed by the symbol mapper to channel coder.
This module is used for first case only. As scrambling is an inverse process, hence for the second case the descrambling can be carried out simply by passing the information through a scrambler itself.
Important
Scrambling and descrambling are inverse process of itself.
Tip
For bit information, the descrambling can be carried out using
Scrambler
itself.For soft information (log likelihood ratios), the
DeScrambler
class is used.
Tip
For executing the following code, the output of a scrambler must be bi-polarized before passing it to the object of a
DeScrambler
class.
Descrambling for PBCH:
## Bits to be scrambled
cellID = 471 # Physical cell ID
Lmax = 8 # Maximum number of candidate SS/PBCH blocks in a half frame
# Decrambler Object for PBCH
pbchdeScr = DeScrambler("PBCH", cellID, Lmax)
# Descrambling the input Bits using the object
descrBits = pbchdeScr(scrBits)
Descrambling for PDCCH:
rnti = 1051 # RNTI value
nID = 18548 # Scrambling ID
# Decrambler Object for PBCH
pbchdeScr = DeScrambler("PDCCH", rnti, nID)
# Descrambling the input Bits using the object
descrBits = pbchdeScr(scrBits)
Descrambling for PDSCH:
rnti = 1151 # RNTI value
cbIndex = 0 # Codeblock Index
nID = 39742 # Scrambling ID
# Decrambler Object for PBCH
pbchScr = DeScrambler("PDSCH", rnti, cbIndex, nID)
# Descrambling the input Bits using the object
descrBits = pbchdeScr(scrBits)
The details about the input-output interface of the Descrambler
is provided below.
- class toolkit5G.Scrambler.DeScrambler(purpose, *args)[source]
Descrambles the input soft values passed to the call method. The soft inputs are descrambled using values randomly generated using a seed. This seed is calculated using the parameters passed as input the constructor. The first variable
purpose
defines the physical channel for whom scrambling is performed and*args
accepts variable inputs with different understanding based on thepurpose
.Important
The descrambler is used to undo the effect of scrambling when soft decoding is used at the receiver. The input and output of the descrabler are soft.
If the information to be descrambled is hard then scrambler itself can be used.
- Parameters:
purpose (str) – Defines the physical channel for which the scrambling is being performed. It can take 6 values currently {“PBCH-1”, “PDCCH”, “PDSCH”, “PBCH-2”, “PSBCH”, “PSCCH”}.
*args – Its a Variable length argument list which accepts values based on the parameter
purpose
.- If
purpose
== “PBCH-1”: arg[0]
is N_cell_ID (int) - physical cell ID \(N_{ID}^{cell} \in \{0,1,...,1007\}\)arg[1]
is Lmax (int) - maximum number of candidate SS/PBCH blocks in a half frame (\(L_{max}\)), \(\in \{4, 8, 64\}\).
- If
purpose
== “PBCH-2”: arg[0]
is N_cell_ID (int) - physical cell ID \(N_{ID}^{cell} \in \{0,1,...,1007\}\)arg[1]
is Lmax (int) - maximum number of candidate SS/PBCH blocks in a half frame (\(L_{max}\)), :math:`in {4, 8, 64}.arg[2]
is ssbIndex (int or Numpy array, np.int) - It is the index pointing towards the SS/PBCH Block and must be lesser than (\(L_{max}\))
- If
purpose
== “PDCCH”: arg[0]
is rnti (int or NumPy array, np.int) - It defines the radio network temporary identifier (RNTI) \(\in \{1,2,..,65519\}\).arg[1]
is id (int) - It is defined by pdcch-DMRS-ScramblingID \(\in \{0,1,2,..,65535\}\).
- If
purpose
== “PSCCH”: No arguments required
- If
purpose
== “PDSCH”: arg[0]
is rnti (int or NumPy array, np.int) - It defines the radio network temporary identifier (RNTI) \(\in \{1,2,..,65519\}\).arg[1]
is q (int or NumPy array, np.int) - It defines codeword index \(\in \{0,1\}\).arg[2]
is nID (int or NumPy array, np.int) - It defines dataScramblingIdentityPDSCH(2), \(\text{n}_{\text{ID}} \in \{0,1,2,..,65535\}\).
- If
purpose
== “PSBCH”: -
arg[0]
is N_cell_ID (int) - Physical-layer sidelink synchronization identity. \(N_{ID}^{cell} \in \{0,1,...,671\}\).
- If
Important
The array parameters passed for descrambling should have equal lengths.
- Input:
[…, length], np.float – Input (scrambled) sequence (llrs)
- Output:
[…, length], np.float – descrambled sequence (llrs).
Note
For PBCH, the
length
must be 32.- Raises:
ValueError – [Error-DeScrambler]: Invalid choice for
purpose
!n Valid inputs are “”PBCH-1””, “”PDCCH””, “”PBCH-2””, “”PSBCH””, “”PSCCH”” and, “”PDSCH””ValueError – [Error-DeScrambler]:
input
must be an NumPy array of numbers!ValueError – [Error-DeScrambler]: Number of MIB bits must be 32 only!
ValueError – [Error-DeScrambler]:
rnti
in PD(S|C)CHdescrambler must be an integer/array!ValueError – [Error-DeScrambler]:
rnti
in PD(S|C)CHdescrambler must be +ve integer/array!ValueError – [Error-DeScrambler]:
q
‘(codeword-Index)’ in PD(S|C)CHdescrambler must be an integer/array!ValueError – [Error-DeScrambler]:
q
‘(codeword-Index)’ in PD(S|C)CHdescrambler must be +ve integer/array!ValueError – [Error-DeScrambler]:
q
‘(codeword-Index)’ in PD(S|C)CHdescrambler must be have size same as ‘rnti’!ValueError – [Error-DeScrambler]:
nID
in PD(S|C)CHdescrambler must be an integer/array!ValueError – [Error-DeScrambler]:
nID
in PD(S|C)CHdescrambler must be +ve integer/array!ValueError – [Error-DeScrambler]:
nID
in PD(S|C)CHdescrambler must be have size same as ‘rnti’!ValueError – [Error-DeScrambler]:
rnti
in pdcchdescrambler must be +ve integer!ValueError – [Error-DeScrambler]: ‘PDCCH’:
id
in pdcchdescrambler must be +ve integer!ValueError – [Error-DeScrambler]:
Lmax
in pdcchdescrambler must be +ve integer!ValueError – [Error-Scrambler]:
ssbIndex
in scrambler must be lesser than (\(L_{max}\))!ValueError – [Error-DeScrambler]:
A
: ‘size of payload’ in pdcchdescrambler must be +ve integer!
- property Lmax
Defines the maximum number of candidate SS/PBCH blocks in a half frame (\(L_{max}\)), \(\in \{4, 8, 64\}\).
- property c_init
Defines the seed used for generating the random variables for scrambling.
- property id
Defines the pdcch-DMRS-ScramblingID \(\in \{0,1,2,..,65535\}\).
- property mu
\({\nu}\) is internally calculated for scrambling PBCH-2.
- property nID
Defines dataScramblingIdentityPDSCH(2), \(\text{n}_{\text{ID}} \in \{0,1,2,..,65535\}\).
- property purpose
Defines the physical channel for which the scrambling is being performed. It can take 3 values currently {“PBCH-1”, “PBCH-2”, “PDCCH”,”PSCCH”, “PDSCH”}.
- property q
Defines codeword index \(\in \{0,1\}\).
- property rnti
Defines the radio network temporary identifier (RNTI) \(\in \{1,2,..,65519\}\).
- property ssbIndex
Defines the maximum number of candidate SS/PBCH blocks in a half frame (\(L_{max}\)), \(\in \{4, 8, 64\}\).
The examples of Descrambling and scrambling can be found in Tutorials [?].