Bit Selection for LDPC

Bit Selection is used to match the encoded bits to target bits using the circular buffer. The target bits is a reflection of the number of time-frequency resources allocated for payload transmission. Bit Selection performs one of the three operations based on the number of information bits, number of target bits and number of coded bits:

  • Truncation (N>E)

  • Puncturing (N>E)

  • Repetition (N<E)

The rate matching is carried out using on a match pattern. The number of rate matched bits are reduced in the case of truncation and puncturing which perform similar function but differ only in the rate match pattern.

Note

Truncation selects first E bits whereas puncturing selects E bits starting from a certain defined location.

Note

Puncturing rate match patterns enables the hybrid repeat request (HARQ) via incremental redundancy technique.

Bit Selection

The details about the input-output interface of the bit selection modules is provided below.

class toolkit5G.Ratematcher.LDPC.BitSelection(numLayers, modOrder, numCodedBits, baseGraph, enableLBRM=False, tbSize=None, numCBs=-1)[source]

This class performs Bit Selection part of Rate Matching for LDPC as described in Section 5.4.2.2 of [3GPPTS38212pdsch]. The bit-selection divides the codeblocks into 2 segments. Each segment is matches to different number of codeword length to fit the codeword into allocated resources. Bit Selection starts by writing the bits belonging to a specific channel coded segment into a circular buffer. The size of the circular buffer is based upon a Limited Buffer Rate Matching (LBRM) calculation. 3GPP has specified the concept of LBRM to reduce the requirement for buffering large code blocks.

Parameters:
  • numLayers (int) – Number of Layers. It takes either scalar or numpy integer. It accepts values between 1 and 4.

  • modOrder (int) – Modulation Order. It takes either scalar or numpy integer. It takes values 1, 2, 4, 6, 8 or 10.

  • numCodedBits (int) – Number of Target Bits. It takes either scalar or numpy integer. It should be greater than or equal to Number of Layers * Modulation Order

  • baseGraph (str) – LDPC Base Graph. It takes string. It can take either ‘BG1’ or ‘BG2’.

  • enableLBRM (bool) – Limited Buffer Rate Matching (LBRM). Either enabled or disabled. Default = False

  • tbSize (int) – Transport Block Size. It takes either scalar or numpy positive integer. Default = None.

  • numCBs (int) – Number of code Blocks after code block segmentation. It takes either scalar or numpy positive integer. Default = -1.

Input:
  • inputBits ([\(\dots\), \(\text{N}_\text{cb}\), \(\text{N}_\text{ldpc}\)]) – LDPC channel coded code-blocks where \(\text{N}_\text{cb}\) is number of code-blocks and \(\text{N}_\text{ldpc}\) is number of LDPC coded bits for each code-block.

  • rvID (int) – Redundancy Version-ID is indicated within the Downlink Control Information (DCI) on the PDCCH. It takes either scalar or numpy integer. Valid values are 0, 1, 2, 3.

Attributes:

liftingFactor (int) – LDPC Lifting Factor. It takes either scalar or numpy integer. Please refer to 3GPP TS 38.211 Table 5.3.2-1 for valid values.

Output:

[k,], list where k can be either 1 or 2. – Returns a list of rate matched codewords. The list can have either 1 or 2 codeword-segments based on the condition specified in 3GPP TS 38.212 version 16 Section 5.4.2.1. The dimension of codeword-segments-i is […, \(\text{N}_\text{G}^\text{i}\), \(\text{E}_\text{i}\)] where \(\text{N}_\text{cb} = \sum_{\text{i}=0}^{\text{k}} \text{N}_\text{G}^\text{i}\) and \(\text{E}_\text{i}\) is number of rate-matched bits for codeword-segments-i. The details of computation of \(\text{N}_\text{G}^\text{i}\) and \(\text{E}_\text{i}\) are provided in section 5.4.2.1 of [3GPPTS38212pdsch].

Note

The codeblock-segments are created in bit-selection to have \(\text{G} = \sum_{\text{i}=0}^{\text{k}} \text{N}_\text{G}^\text{i} \times \text{E}_\text{i}\) which ensure that rate matched bits fit into the allocated time-frequency OFDM resources.

Raises:
  • ValueError – [Error-BitSelectionLDPC]: Limited Buffer Rate Matching must be an integer

  • ValueError – [Error-BitSelectionLDPC]: ‘modOrder’ must take values from the set {1, 2, 4, 6, 8, 10}!

  • ValueError – [Error-BitSelectionLDPC]: ‘modOrder’ must be an integer!

  • ValueError – [Error-BitSelectionLDPC]: ‘Number of Layers’ allocated should be between 1 and 4

  • ValueError – [Error-BitSelectionLDPC]: ‘Number of Layers’ must be an integer!

  • ValueError – [Error-BitSelectionLDPC]: ‘numCodedBits’ must larger than ‘numLayers*modOrder’!

  • ValueError – [Error-BitSelectionLDPC]: ‘numCodedBits’ must be an integer!

  • ValueError – [Error-BitSelectionLDPC]: ‘baseGraph’ can be either ‘BG1’ or ‘BG2’!

  • ValueError – [Error-BitSelectionLDPC]: ‘baseGraph’ must be a string!

  • ValueError – [Error-BitSelectionLDPC]: ‘tbSize’ must be larger than 0!

  • ValueError – [Error-BitSelectionLDPC]: ‘tbSize’ must be an integer!

  • ValueError – [Error-BitSelectionLDPC]: Invalid ‘liftingFactor’ value! Please refer to 3GPP TS 38.211 Table 5.3.2-1.

  • ValueError – [Error-BitSelectionLDPC]: ‘liftingFactor’ must be an integer!

  • ValueError – [Error-BitSelectionLDPC]: ‘Number of code-blocks’ must be larger than 0!

  • ValueError – [Error-BitSelectionLDPC]: ‘Number of code-blocks’ must be an integer!

  • ValueError – [Error]: ‘Redundancy Version-ID’ must take integer value from the set {0, 1, 2, 3}

  • ValueError – [Error]: ‘Redundancy Version-ID’ must an integer

  • ValueError – [Error]: ‘Number of scheduled codeblocks’ can not be more than ‘Total codeblocks’ in a TB

  • ValueError – ‘inputBits’ must have atleast 2 dimensions: …,numCodeblocks x num_ldpc!

property baseGraph

Low Density Parity Check (LDPC) Base Graph. It takes string values from the set \(\in \{\) ‘BG1’, ‘BG2’ \(\}\).

property enableLBRM

Enabling/Disabling Limited Buffer Rate Matching (LBRM). Default = False

property k0

Starting positions (index) from where next numBits the LDPC bits are selected by bit selection for rate matching. Its value depend on the redundancy versions. Return type: scalar integer. Detailed are provided in Table 5.4.2.1-2 of [3GPPTS38212pdsch].

property liftingFactor

Defines Lifting factor used for LDPC Codec. It takes integer values as defined in 3GPP TS 38.211 Table 5.3.2-1.

property modOrder

Defines Modulation order. It accepts integer values \(\in \{`1,2,4,6,8,10\}\).

property numCBs

Total number of code Blocks obtained after code block segmentation. It takes integer values >= 1. Default value is -1.

property numCodedBits

Number of Target Bits.It takes positive (>numLayers*modOrder) integer values.

property numLayers

Number of MIMO layers (the number of layers is equal to the number of allocated DMRS Ports or rank) per codeword. It accepts integer values \(\in \{1,2,3,4\}\).

property rvID

Redundancy Version-ID is indicated within the Downlink Control Information (DCI) on the PDCCH. It takes integer values \(\{0, 1, 2, 3\}\).

property tbSize

Defines Transport Block Size. It takes integer values and the default value is None.

Bit De-selection

The details about the input-output interface of the bit de-selection modules is provided below.

class toolkit5G.Ratematcher.LDPC.BitDeselection(fillerIndices, baseGraph, liftingFactor, enableLBRM=False)[source]

This class performs Bit Deselection part of Rate Matching for LDPC which is inverse procedure to Bit Selection to be implemented on the receiver to recover the data correctly and support the hybrid automatic request (HARQ) procedure. The details of bit selection for LDPC are provided in Section 5.4.2.2 of [3GPPTS38212pdsch].

Parameters:
  • fillerIndices (np.ndarray) – Indices where filler bits [-1] are inserted. It can be accessed as an attribute from codeBlock segmentation class. It can be empty numpy array in cases where there is no fillerbits in the codeword

  • baseGraph (str) – LDPC Base Graph. It takes string. It can take either ‘BG1’ or ‘BG2’.

  • liftingFactor (int) – LDPC Lifting Factor. It takes either scalar or numpy integer. Please refer to 3GPP TS 38.211 Table 5.3.2-1 for valid values.

  • enableLBRM (bool) – Limited Buffer Rate Matching (LBRM). Either enabled or disabled. Default = False

Input:
  • inputBits ([k,], list where k can be either 1 or 2.) – A list of Bit De-Interleaved codewords. The list can have either 1 or 2 codeword-segments based on the condition specified in section 5.4.2.1 of [3GPPTS38212pdsch] containing either bits of LLRs . The dimension of codeword-segments-i is […, \(\text{N}_\text{G}^\text{i}\), \(\text{E}_\text{i}\)] where \(\text{N}_\text{cb} = \sum_{\text{i}=0}^{\text{k}} \text{N}_\text{G}^\text{i}\) and \(\text{E}_\text{i}\) is number of rate-matched bits for codeword-segments-i. The details of computation of \(\text{N}_\text{G}^\text{i}\) and \(\text{E}_\text{i}\) are provided in section 5.4.2.1 of [3GPPTS38212pdsch].

  • rvID (int) – Redundacy Version ID. It takes value 0,1,2 and 3

Output:

[\(\dots\), \(\text{N}_\text{cb}\), \(\text{N}_\text{ldpc}\)], np.float32 – Rate de-matched codeword of soft or hard values where \(\text{N}_\text{cb}\) is number of code Blocks and \(\text{N}_\text{ldpc}\) is length of the LDPC Encoded code segment.

Raises:

ValueError – [Error-BitDeselectionLDPC]: Number of groups can not be more than 2!

property Ncb

Number of Code Block. It takes a value greater than zero

property baseGraph

Low Density Parity Check (LDPC) Base Graph. It takes string values from the set \(\in \{\) ‘BG1’, ‘BG2’ \(\}\).

property enableLBRM

Enabling/Disabling Limited Buffer Rate Matching (LBRM). Default = False

property k0

Starting positions (index) from where next numBits the LDPC bits are selected by bit selection for rate matching. Its value depend on the redundancy versions. Return type: scalar integer. Detailed are provided in Table 5.4.2.1-2 of [3GPPTS38212pdsch].

property liftingFactor

Defines Lifting factor used for LDPC Codec. It takes integer values as defined in 3GPP TS 38.211 Table 5.3.2-1.

property nLDPC

Number of Bits at the output of LDPC Encoder or NUmber of Bits required to be input to the LDPC Decoder.

property rvID

Redundancy Version-ID is indicated within the Downlink Control Information (DCI) on the PDCCH. It takes integer values \(\{0, 1, 2, 3\}\).