Code Block Concatenation
Codeblock Concatenation: Transmitter
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!”)
Code-block Segregation: Receiver
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 sizenumBits1
.- 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 sizenumBits1
, and second segment havenumCBs2
codeblocks each having a sizenumBits2
.
- 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
andnumBits2
should be passed asNone
.- 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!”