Code-block 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. The control information is often very small in size but can vary from 1 to 140 in downlink and from 12 to 1706 in uplink. Its import to note that Polar Encoder have good error correction capabilities small size input bit string in comparison to LDPC and other codes. Hence when the control information size become large the blocks should be split to provide required quality of service using Polar coders.
Code-block Segmentation
The codeblock segmentation breaks the large transport block into small codeblock which are processed individually a defined
in Section 5.3.1 of [3GPPTS38212Polar]. The example demonstrate a way to use the CodeBlockSegmentation
module.
logits = 100*(2*codeword-1) # Logits/LLR to decode the bits | Dimension = (numBatches, N)
K = 56 # Number of bits to encode
E = 864 # Rate matching bits
dec_type = 'SC' # Polar Decoder Type is "Successive Cancellation type".
crcType = 'CRC24C' # CRC used for error detection (not relevant in this case.)
purpose = 'PDCCH' # Physical channel for whose to decode the payload.
list_size = 8 # List Size (not relevant in this case.)
num_iter = 20 # Number of iterations (not relevant in this case.)
# Create Object for Polar Decoder
decoder = PolarDecoder5G(K = K, E = E, purpose = purpose)
bitEst = decoder(logits) # Recover information Bits using the Decoder Object | Dimension = (numBatches, K)
The API for codeblock segmentation is as follows.
- class toolkit5G.ChannelCoder.PolarCoder.CodeBlockSegmentation[source]
This module implements a 5G standards complaint Encoder for Polar Codes. The modules is built on the top on Sionna Polar Decoder with modifications to provide low level API for section 5.3.1 of 38.212 specifications [3GPPTS38212Polar]. Moreover, it corrects the broken standards complaince and optimize the implementation for performance and memory.
- Parameters:
K (int) – Number of information bits to encode.
E – Number of target bits after rate matching.
purpose (str) – Defines the physical channel for which the Polar Decoder is being used. It is used computation of N (number of coded bits at the out of Polar Decoder) \(\in \{\) “PBCH”, “PDCCH”, “PUCCH” \(\}\).
verbose (bool) – Defaults to False. If True, rate-matching parameters will be printed.
- Input:
modOrder
numTargetBits
formatPUCCH – Defines th Format of
inputBits ([…,K], tf.float32) – 2+D tensor containing the channel logits/llr values.
- Output:
[…,N], np.float32 – 2+D tensor containing hard-decided estimates of all k information bits.
- Raises:
Exception – “[Error]: Invalid value for “”K”” for UCI:PUCCH!”
Exception – “[Error]: Invalid value for “”purpose””!”
ValueError – “[Polar Encoder]: ‘input’ must a numpy array of numbers!”
Note
Although the decoding list size is not provided by 3GPP [3GPPTS38212Polar], the consortium has agreed on a list size of 8 for the 5G decoding reference curves [Bioglio].
All list-decoders apply CRC-aided decoding, however, the non-list decoders (“SC” and “BP”) cannot materialize the CRC leading to an effective rate-loss.
Code-block Concatenation
Code-block Processing: Receiver
Code-block Segregation
- class toolkit5G.ChannelCoder.PolarCoder.CodeBlockSegregation[source]
- Parameters:
None
- 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!”
Code-block Aggregation
Input Bit Interleavers
Input Bit Interleaver
- class toolkit5G.ChannelCoder.PolarCoder.InputBitInterleaver[source]
This module implements the Input BIt Interleaver defined in section 5.3.1.1. of [3GPPTS38212Polar]. This module is enabled in 5G by setting \(\text{I}_\text{IL}\) flag.
- Parameters:
None
- Input:
input_bits ([…,K], np.number) – Input bits to be interleaved.
Warning
The number of bits input passed to InputBitInterleaver should be less than 165.
- Output:
[…,K], np.number – Interleaver bits.
- Attributes:
K_IL_max (integer) – Defines the maximum numer of bits that can be interleaved.
interleavePattern ([164,], int) – Defines the Interleaving pattern as defined in Table 5.3.1.1-1 of [3GPPTS38212Polar].
- Raises:
ValueError – “[Error-InputBitInterleaver]: ‘input_bits’ should be NumPy array of numbers!”
ValueError – “[Error-InputBitInterleaver]: number of ‘input_bits’ (0<K<165) should be less than 165 amd more than 0!”
Input Bit Deinterleaver
- class toolkit5G.ChannelCoder.PolarCoder.InputBitDeInterleaver[source]
This module implements the Input Bit De-interleaver which is used to undo the effect of Input Bit Interleaver as defined in section 5.3.1.1. of [3GPPTS38212Polar]. This module is enabled in 5G by setting \(\text{I}_\text{IL}\) flag.
- Parameters:
None
- Input:
input_bits ([…,K], np.number) – Input bits to be de-interleaved.
Warning
The number of bits input passed to InputBitDeInterleaver should be less than 165.
- Output:
[…,K], np.number – De-interleaver bits.
- Attributes:
K_IL_max (integer) – Defines the maximum numer of bits that can be interleaved.
interleavePattern ([164,], int) – Defines the Interleaving pattern as defined in Table 5.3.1.1-1 of [3GPPTS38212Polar].
- Raises:
ValueError – “[Error-InputBitDeInterleaver]: ‘input_bits’ should be NumPy array of numbers!”
ValueError – “[Error-InputBitDeInterleaver]: number of ‘input_bits’ (0<K<165) should be less than 165 amd more than 0!”