Documentation

lteCRCEncode

Cyclic redundancy check calculation and appending

Syntax

  • blkcrc = lteCRCEncode(blk,poly)
    example
  • blkcrc = lteCRCEncode(blk,poly,mask)
    example

Description

example

blkcrc = lteCRCEncode(blk,poly) calculates a cyclic redundancy check (CRC) for the input data vector and returns a copy of the vector with the CRC attached. To support the correct processing of filler bits, negative input bit values are interpreted as logical 0 for the purposes of the CRC calculation. A value of –1 is used to represent filler bits. lteCRCEncode calculates the CRC defined by poly for the input bit vector blk and returns a copy of the input with the CRC appended in vector blkcrc. Valid options for the CRC polynomial are '8', '16', '24A', or '24B'. See TS 36.212 [1], Section 5.1.1 for the associated polynomials.

example

blkcrc = lteCRCEncode(blk,poly,mask) XOR masks the appended CRC bits with the integral value of mask. 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

Calculate and Append CRC

Calculate and append the CRC associated with an all zero vector, which is also zero.

crc1 = lteCRCEncode(zeros(100,1),'24A');
crc1(1:10)
ans =

    0
    0
    0
    0
    0
    0
    0
    0
    0
    0

The result is an all-zeros vector of length 124.

Calculate and Append CRC with MSB First

Mask the CRC bits in an MSB-first order.

Set the XOR mask to 1 to make the appended CRC bits XOR masked from the most significant to least significant bit.

mask = 1;
crc2 = lteCRCEncode(zeros(100,1),'24A',mask);
crc2(end-10:end)
ans =

    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    1

The result is all zeros, except for a single one in last element position.

Input Arguments

collapse all

blk — Data bit vectornumeric column vector

Data bit vector, specified as a numeric column vector.

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 maskinteger

XOR mask, specified as an integer. The appended CRC bits are XOR masked from the most significant to least significant bit.

Output Arguments

collapse all

blkcrc — Bit vector with CRCcolumn vector

Bit vector with CRC, returned as a column vector.

Data Types: int8

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?