Documentation

lteCRCDecode

Cyclic redundancy check decoding and removal

Syntax

  • [blk,err] = lteCRCDecode(blkcrc,poly)
    example
  • [blk,err] = lteCRCDecode(blkcrc,poly,mask)
    example

Description

example

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

Examples

collapse all

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 =

           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 =

           0

The returned output, err2, is 0 because the original mask, rnti, is XORed with itself.

Input Arguments

collapse all

blkcrc — CRC input data bit vectornumeric 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'8' | '16' | '24A' | '24B'

CRC polynomial, specified as a string. See TS 36.212 [1], Section 5.1.1 for the associated polynomials.

mask — XOR maskscalar integer

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

blk — Data bit vectorcolumn vector

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

Data Types: int8

err — Logical differenceinteger

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. "Multiplexing and channel coding." 3rd Generation Partnership Project; Technical Specification Group Radio Access Network; Evolved Universal Terrestrial Radio Access (E-UTRA). URL: http://www.3gpp.org.

Introduced in R2014a

Was this topic helpful?