Codeblock Processing: Transmitter

Codeblock segmentation allows the physical layer to process large transport blocks to make the best use of the capabilities of the encoder and decoders. To make the best use of the structure of the LDPC codes the inputs shall be passed in a certain format with the bound on the upper limit of the inputs that LDPC codec can process. In case transport block sizes exceed the upper limit, it is broken into multiple smaller sub-blocks called codeblocks which are individually processed by LDPC encoder/decoder and ratemater/dematcher at transmitter and receiver respectively. The implementations are discussed in details in upcoming sub-sections.

Codeblock Segmentation

The codeblock segmentation breaks the large transport block into small codeblock which are processed individually a defined in Section 5.3.2 of [3GPPTS38212_LDPC]. The example demonstrate a way to use the CodeBlockSegmentation module.

coderate = 0.650390625 #Code Rate
#crcTBlock ---> Transport Block with CRC bits attached

cbSegment   = CodeBlockSegmentation(coderate) # Object for processing the code blocks
codeblocks  = cbSegment(crcTBlock) # Attach the segment the TB and attach the CRC to TB based on 38.212

The API for codeblock segmentation is as follows.

class toolkit5G.ChannelCoder.LDPC.CodeBlockSegmentation(codeRate)[source]

Implements code block segmentation for the Low Density Parity Check coding. The transport block is segmented into multiple code-blocking which are individually channel coded and rate-matched for efficiency and scale. The details are provide in section 5.2.2 of [3GPPTS38212_LDPC].

Parameters:

codeRate (float) – Target Code Rate. It takes any value between 0 and 1. The codeRate for 5G is extracted from mciIndex and computed using ComputeTransportBlockSize.

Input:

inputBits ([…,B] where B (=A+L) is the size of processed transport block.) – Processed transport Block. Processed transport block contains transport block bits (A) and 24 (L) or 16 (L) bit CRC attachment.

Output:

[\(\dots, \text{N}_\text{cb}, \text{K}\)], np.float32 – Returns \(\text{N}_\text{cb}\) code-blocks each of size \(\text{K}\) where \(\text{K}\) contains K’-L’ information bits, L’ CRC bits and K-K’ zeros.

Raises:
  • ValueError – “[Error-CodeBlockSegregation]: inputBits should either be an array of int ot float”

  • ValueError – “[Error:CodeBlockSegmentation]: ‘Kbar’ can not be larger than ‘K’!”

  • ValueError – “[Error-CodeBlockSegmentation]: ‘codeRate’ should either be an float!”

  • ValueError – “[Error-CodeBlockSegmentation]: ‘codeRate’ should be in (0,1]!”

  • ValueError – “[Error-CodeBlockSegmentation]: ‘Inputsize’ should either be an int!”

  • ValueError – “[Error-CodeBlockSegmentation]: ‘Inputsize’ should be non-zero +ve number!”

property B

Int type. Defines the Input Bit Sequence Length.

property C

Total number of code blocks for LPDC codec

property K

Defines the size of each code block.

property Kb

Int type. Defines the maximum code-block size.

property Kbar

Int type. Defines the number of information bits + CRC attached, denotes by K’ in section 5.2.2 of [3GPPTS38212_LDPC].

property L

Int type. Defines the number of CRC bits attached to each codeblock.

property Zc

Int type. Defines the minimum lifting size to be used for LDPC encoding/decoding.

property baseGraph

Str type. This function returns base graph selection based on the Transport Block size and Code rate with reference to 3GPP TS 38.212 Section 5.2.2.

property codeRate

Float type. Target Code Rate. It takes any value between 0 and 1. The codeRate for 5G is extracted from mciIndex and computed using ComputeTransportBlockSize.

Codeblock Concatenation

Each codeblock is individually channel coded and broken further into 1 or 2 codeblock segments. All these codeblock segments are concatenated by the last module of the upper physical layer chain. The implementation is compliant with section 5.5 of [3GPPTS38212_LDPC]. An example to demonstrate the implementation is shown below:

# rmBits ---> Rate Matched Output Block after Interleaving

codeword   = CodeBlockConcatenation()(rmBits) #Performs Code Block Concatenation

The details of the API of codeblock concatenation is detailed below.

class toolkit5G.ChannelCoder.LDPC.CodeBlockConcatenation[source]

Performs code block concatenation for LDPC as defined in section 5.2.2 of [3GPPTS38212_LDPC].

Input:

inBits ((k,) where k is 1 or 2.) – 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].

Output:

[…,G], np.float – concatenated code block segments where E is number of target bits.

Raises:
  • ValueError – “[Error-CodeBlockConcatenation]]: ‘inBits’ must be a Python list type variable!”

  • ValueError – “[Error-CodeBlockConcatenation]: inputBits should either be an array of int or float”

  • ValueError – “[Error-CodeBlockConcatenation]: inputBits-1 should either be an array of int or float”

  • ValueError – “[Error-CodeBlockConcatenation]: inputBits-2 should either be an array of int or float”

  • ValueError – “[Error]: length of input List can either be 1 or 2!”)