Cyclic redundancy check decoding and removal
the input data vector for a CRC error assuming the vector comprises
a block of data with the associated CRC bits attached. The data part
of the input is returned in vector
blk. The logical
difference (XOR) between the attached CRC and the CRC recalculated
across the data part of the input is returned in
err is not equal to 0, either an error has
occurred or the input CRC has been masked. A logical mask can also
be applied directly to
err. See TS 36.212 , Section 5.1.1 for the associated
Check Data Vector for CRC Error
Check the effect of CRC decoding a block of data with and without a mask.
CRC encode attaching a masked
'24A'-type CRC to an all-ones vector of length 100.
rnti = 8; blkcrc = lteCRCEncode(ones(100,1),'24A',rnti);
CRC decode with the data block without using a mask.
[blk1,err1] = lteCRCDecode(blkcrc,'24A'); err1
err1 = uint32 8
The logical difference between the original CRC and recalculated CRC equals the CRC mask. Since the CRC was been masked, decoding without specifying the mask, returned
err1 = 8, which is the value of
CRC decode using the RNTI as a mask.
[blk2,err2] = lteCRCDecode(blkcrc,'24A',rnti); err2
err2 = uint32 0
The returned output,
err2, is 0 because the original mask,
rnti, is XORed with itself.
blkcrc — CRC input data bit vector
numeric column vector
CRC input data bit vector, specified as a numeric column vector. The function checks the input bit vector for a CRC error assuming that the data consists of a block of data with CRC bits attached.
poly — CRC polynomial
CRC polynomial, specified as
'24B'. See TS 36.212 , Section 5.1.1 for the associated polynomials.
mask — XOR mask
XOR mask, specified as a scalar integer. The CRC difference
is XOR-ed with
blk — Data bit vector
Data bit vector, returned as a column vector.
the data-only part of the input
err — Logical difference
Logical difference, returned as an integer.
the logical difference between the CRC and CRC recalculated across
the data part of the input.
 3GPP TS 36.212. “Evolved Universal Terrestrial Radio Access (E-UTRA); Multiplexing and channel coding.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network. URL: https://www.3gpp.org.
Introduced in R2014a