Decode and remove cyclic redundancy check (CRC)
checks the input data
blkcrc for a CRC error. The function assumes that
the input data comprises the CRC parity bits associated with the polynomial
poly. The function returns
blk, which is the
data part of the input
blkcrc. The function also returns
err, which is the logical difference (XOR) between the CRC comprised
in the input and the CRC recalculated across the data part of the input. If
err is not equal to 0, either an error has occurred or the input CRC
has been masked. For details on the associated polynomials, see TS 38.212 Section 5.1 .
Check the effect of CRC decoding with and without a mask.
Define a mask corresponding to the radio network temporary identifier (RNTI) equal to 12. Append RNTI-masked CRC parity bits to an all-ones matrix of one data block.
rnti = 12; blkCrc = nrCRCEncode(ones(100,1),'24C',rnti);
When you perform CRC decoding without a mask,
err1 is equal to
the RNTI because the CRC was masked during coding. The logical difference between the
original CRC and the recalculated CRC is the CRC mask.
[blk,err1] = nrCRCDecode(blkCrc,'24C'); err1
err1 = uint32 12
When you perform CRC decoding using the RNTI value as a mask,
is equal to 0.
[blk,err2] = nrCRCDecode(blkCrc,'24C',err1); err2
err2 = uint32 0
blkcrc— CRC encoded data
CRC encoded data, specified as a matrix of real numbers. Each column of the matrix is considered as a separate CRC encoded data block.
poly— CRC polynomial
CRC polynomial, specified as
'24C'. For details on the associated polynomials, see TS 38.212
mask— XOR mask
0(default) | nonnegative integer
XOR mask, specified as a nonnegative integer. The mask is typically a radio network temporary identifier (RNTI).
blk— CRC decoded data
CRC decoded data, returned as a matrix of real numbers.
the data-only part of the input
err— Logical CRC difference
 3GPP TS 38.212. “NR; Multiplexing and channel coding.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.