Crate cai_cyclic [] [src]

Encoding and decoding of the base (17, 9, 5) cyclic code used by DMR and P25.

The generator polynomial for the base code is given by

g(x) = x8 + x5 + x4 + x3 + 1

It can detect up to 4 errors or correct up to 2 errors.

DMR "quadrature residue" code

The DMR air interface extends this code to (18, 9, 6) with an extra parity check bit in the LSB, then shortens it to (16, 7, 6) by deleting two MSB data bits. The extra parity bit is computed over the data bits using the mask 1010111.

P25 "shortened cyclic" code

The P25 air interface shortens this code to (16, 8, 5) by deleting the MSB data bit.


The decoding algorithm is based on the algorithm described in Lin and Costello's Error Control Coding (1983) and Roman's Coding and Information Theory (1992), p345.



Try to decode the given 17-bit word to the nearest codeword, correcting up to 2 errors.


Encode the given 9 data bits into a 17-bit codeword.