Codeblock Processing: Receiver

These module are implemented at the receiver to complement the procedure of codeblock processing at the transmitter.

Code-block Segregation

The block performs the opposite of code-block concatenation. It breaks the received codeword into multiple codeblock-segments for rate matching.

Example, if number of groups in rate matching is 1

#numCBGrp1 ---> Number of Code Blocks in Group 1
#numRMOP1  ---> Number of Rate Matched Output Bits of Group 1
#codeword  ---> Demodulated Symbol Block

cbSegregation  = CodeBlockSegregation(numCBGrp1, numRMOP1) #Performs Code Block Segregation
cbSegregateLLR = cbSegregation(codeword)

Example, if number of groups in rate matching is 2

#numCBGrp1 ---> Number of Code Blocks in Group 1 as in bit selection of rate matching
#numRMOP1  ---> Number of Rate Matched Output Bits of Group 1
#numCBGrp2 ---> Number of Code Blocks in Group 2 as in bit selection of rate matching
#numRMOP2  ---> Number of Rate Matched Output Bits of Group 2
#codeword  ---> Demodulated Symbol Block

cbSegregation  = CodeBlockSegregation(numCBGrp1, numRMOP1, numCBGrp2, numRMOP2) #Performs Code Block Segregation
cbSegregateLLR = cbSegregation(codeword)

The details of the input output interface of codeblock segregation is shown below:

class toolkit5G.ChannelCoder.LDPC.CodeBlockSegregation(numCBs1, numBits1, numCBs2=None, numBits2=None)[source]

This class performs code block segregation (Opposite to concatenation). It divides/segregate the input into 1 or 2 code-blocks segment where each segment contains multiple codeblocks of same size.

If number of code-blocks segment is 1:

Then the target bits are segregated into numCBs1 codeblocks each having a size numBits1.

If number of code-blocks segment is 2:

Then the target bits are segregated into 2 segments where first segment consist of numCBs1 codeblocks each having a size numBits1, and second segment have numCBs2 codeblocks each having a size numBits2.

Parameters:
  • numCBs1 (int) – Number of code blocks in group 1 as defined in bit selection of rate matching using \(\text{N}_\text{G}^\text{1}\)

  • numBits1 (int) – Number of rate matched output bits in code blocks in group 1 as defined in bit selection of rate matching using \(\text{E}_\text{1}\).

  • numCBs2 (int) – Number of code blocks in group 1 as defined in bit selection of rate matching using \(\text{N}_\text{G}^\text{2}\). Default = None.

  • numBits2 (int) – Number of rate matched output bits in code blocks in group 1 as defined in bit selection of rate matching using \(\text{E}_\text{2}\). Default = None.

Note

The number of code-block groups that results from BitSelection (RateMatching) can be 1 or 2. In case the number of groups is 1, the value of numCBs2 and numBits2 should be passed as None.

Input:

inputBits ([…, G], np.float32) – Received codewords.

Warning

The number of target bits G must satisfy \(\text{G} = \sum_{\text{i}=0}^{\text{k}} \text{N}_\text{G}^\text{i} \times \text{E}_\text{i}\) else the code crashes.

Output:

(k,) list where k defines the number of code block segments. – Returns a list of segregated code-block segments where code-block segment-i has the dimension […, numCBsi, numBitsi].

Raises:
  • ValueError – “[Error-CodeBlockSegregation]: Either both ‘numCBs2’ and ‘numBits2’ should be ‘None’ or both should be integer type”

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

  • ValueError – “[Error-CodeBlockSegregation]: Mismatch between inputBits.shape[-1] and numCBs1*numBits1*numCBs2*numBits2!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numCBs1’ must be an integer!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numCBs1’ must be larger than 0!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numBits’ in codeblock 1 must be an integer!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numBits’ in codeblock 1 must be larger than 0!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numCBs2’ must be an integer!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numCBs2’ must be larger than 0!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numBits’ in codeblock-segment 2 must be an integer!”

  • ValueError – “[Error-CodeBlockSegregation]: ‘numBits’ in codeblock-segment 2 must be larger than 0!”

Codeblock Aggregation

It performs opposite of code-block segmentation at the receiver to reconstruct the transport block to pass it for transport block processing at receiver before forwarding to MAC layer. Example is understand the usage is shown below.

coderate = 0.650390625 #Code Rate
#tbLen ---> Transport Block size
#decBits ---> LDPC Decoded Block

cbAggregate = CodeBlockAggregation(coderate, tbLen) #Object that performs Code Block Aggregation
rTBwithCRC = cbAggregate(decBits) #Output after Code Block Aggregation

The details of the API of codeblock aggregation is shown below:

class toolkit5G.ChannelCoder.LDPC.CodeBlockAggregation(codeRate, tbsize)[source]

This class aggregates all the code blocks segmented (opposite of code block segmentation) to process for forward error correction.

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.

  • tbSize (int) – Transport Block Size. It can be computed using ComputeTransportBlockSize.

Input:

inputBits ([\(\dots, \text{N}_\text{cb}, \text{K}\)], np.float32) – code-blocks, where \(\text{N}_\text{cb}\) defines the number of code blocks and \(\text{K}\) defines the length of LDPC encoded code-block.

Output:

[ \(\dots, \text{N}_\text{cb} \times \text{K'}\)] – returns the transport block having a size \(\text{N}_\text{cb} \times \text{K'}\) where \(\text{K'}\): includes code block CRC and few 0s. The detailed relation between \(\text{K'}\) and \(\text{K}\) is defined in section 5.2.2 of [3GPPTS38212_LDPC].

Raises:
  • ValueError – “[Error-CodeBlockAggregation]: ‘inputBits’ must be an Numpy array of numbers!”

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

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

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

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

property C

Defines the number of codeblock. Details of computation of C is provided in section 5.2.2 of [3GPPTS38212_LDPC].

property Kbar

Integer type, defines the size of each code-block K’ as detailed in section 5.2.2 of [3GPPTS38212_LDPC].

property Kcb

Defines the maximum code-block size (\(\text{K}_\text{cb}\)). Details of computation of Kcb is provided in section 5.2.2 of [3GPPTS38212_LDPC].

property baseGraph

str type, defines the base graph used for LDPC coding as detailed in section 5.2.2 of [3GPPTS38212_LDPC].

property codeRate

float type, defines target code rate providing a measure of the redundancy which is added by the Physical layer to transport block.

property crcType

Defines the CRC type for code-block error detection.

property tbSize

int type, defines transport-block size. Transport Block is a packet of data which is passed between the MAC and Physical layers.