Skip to main content

Module crc

Module crc 

Source
Expand description

Cyclic redundancy checks.

A CRC of degree $L$ appends the remainder of $D^{L} a(D)$ divided by the generator polynomial $g(D)$ to the information bits $a(D)$ (most significant bit first, zero initial state, no reflection, no final XOR — the convention of 3GPP TS 38.212, Sec. 5.1). The polynomials of 5G NR are provided.

Constructor$g(D)$Use in NR
Crc::crc24a0x864CFBtransport blocks
Crc::crc24b0x800063code blocks
Crc::crc24c0xB2B117downlink control (polar)
Crc::crc160x1021small transport blocks
Crc::crc110x621uplink control (polar)
Crc::crc60x21uplink control (polar)

§Examples

use comnum_fec::crc::Crc;
let crc = Crc::crc24a();
let mut word = crc.attach(&[1, 0, 1, 1, 0, 0, 1]);
assert_eq!(word.len(), 7 + 24);
assert!(crc.check(&word));
word[3] ^= 1;
assert!(!crc.check(&word));

§References

  1. 3GPP TS 38.212, NR; Multiplexing and channel coding, Sec. 5.1.
  2. W. W. Peterson and D. T. Brown, “Cyclic codes for error detection,” Proc. IRE, 49(1), 228–235, 1961.

Structs§

Crc
A cyclic redundancy check of degree width and generator poly (without its leading term), valid by construction (Crc::new checks them).