CRC Encoder

CRC Encoder attaches the parity bits to inputs sequence based on the crc polynomial configured. It supports all the CRC polynomials standardized by 3GPP for 5G. It supports the CRC polynomial “CRC24A”, “CRC24B”, “CRC24C”, “CRC16”, “CRC11”, and “CRC6”. The details of these polynomial are provided in Section 5.1 of [3GPPTS38211_crc]. CRC Encoder uses Sionna CRC Encoder internally. The has been design to pass input exactly same as Sionna CRC Encoder for compatibility.

Important

  • CRC Encoder doesn’t support 1D arrays as inputs. The arrays of dimension (N,) can be passed by reshaping it to (1,N).

The CRC encoding is performed as follows:

CRC Encoding for 1D NumPy Arrays

bits       = np.random.randint(0, 2, size = (1,32)) # Bits to be Encoded
crcType    = "CRC24C"
crcEncoder = CRCEncoder(crcType) # Create object of CRC Encoder
crcBits    = crcEncoder(bits)    # Encode the bits (attach the CRC at the end)
## Shape of crcBits will be (1, 56)

CRC Encoding for 2D NumPy Arrays

bits       = np.random.randint(0, 2, size = (21,64)) # Bits to be Encoded
crcType    = "CRC16"
crcBits    = CRCEncoder(crcType)(bits)    # Encode the bits (attach the CRC at the end)
## Shape of crcBits will be (21, 80)

CRC Encoding for Higher dimension NumPy Arrays

bits       = np.random.randint(0, 2, size = (8,6,119)) # Bits to be Encoded
crcType    = "CRC6"
crcBits    = CRCEncoder(crcType)(bits)    # Encode the bits (attach the CRC at the end)
## Shape of crcBits will be (8,6,125)

The details about the input-output interface of the Symbol demapper detailed below.

class toolkit5G.CRC.CRCEncoder(crcType, dtype=None, *arg)[source]

The module inserts the cyclic redundancy bits to the bits passed to the call method. The parity bits are generated using the cyclic generator polynomials passed to the constructor (init) method. This class uses CRCEncoder from sionna.fec.crc.CRCEncoder .

Parameters:
  • crcType (str) – It defines the CRC type \(\in \{\text{"CRC24A"}, \text{"CRC24B"},\) \(\text{"CRC24C"}, \text{"CRC16"}, \text{"CRC11"}, \text{"CRC6"}\}\).

  • *args (arguments) – As per sionna.fec.crc.CRCEncoder .

Input:

[…, length], np.int8 – Input sequence

Output:

[…, length+crcLength], np.int8 – CRC encoded sequence.

Note

crcLength is 24, 24, 24,16, 11, 6 for crcType \(= \{\text{"CRC24A"}, \text{"CRC24B"}, \text{"CRC24C"},\) \(\text{"CRC16"}, \text{"CRC11"}, \text{"CRC6"}\}\) respectively.

Raises:

ValueError – [Error-CRCEncoder]: ‘inBits’ must be an NumPy array of number!

References:
[3GPPTS38211_crc]

3GPP TS 38.211 “Physical channels and modulation (Release 17)”, V17.1.0 (2022-03).