Main Content

lteCRCDecode

Cyclic redundancy check decoding and removal

Description

[blk,err] = lteCRCDecode(blkcrc,poly) checks 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 uint32 scalar err. If 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 [1], Section 5.1.1 for the associated polynomials.

example

[blk,err] = lteCRCDecode(blkcrc,poly,mask) checks the input data vector for a CRC error XOR-ing with the scalar mask parameter before it is returned in err. The mask value is applied to the CRC bits with the most significant bit (MSB) first and the least significant bit (LSB) last.

example

Examples

collapse all

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 rnti.

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.

Input Arguments

collapse all

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.

CRC polynomial, specified as '8', '16', '24A', or '24B'. See TS 36.212 [1], Section 5.1.1 for the associated polynomials.

XOR mask, specified as a scalar integer. The CRC difference is XOR-ed with mask before err is returned.

Data Types: double

Output Arguments

collapse all

Data bit vector, returned as a column vector. blk is the data-only part of the input blkcrc.

Data Types: int8

Logical difference, returned as an integer. err is the logical difference between the CRC and CRC recalculated across the data part of the input.

Data Types: uint32

References

[1] 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.

Version History

Introduced in R2014a