13.3 CRC Polynomial Implementation
Any polynomial can be used. The polynomial and accumulator sizes are
determined by the PLEN bits. For an n-bit accumulator, PLEN = n-1 and the
corresponding polynomial is n+1 bits. Therefore, the accumulator can be any size up to 16
bits with a corresponding polynomial up to 17 bits. The MSb and LSb of the polynomial are
always ‘1
’ which is forced by hardware. Therefore,
the LSb of the CRCXORL register is hardwired high and always reads as ‘1
’.
All polynomial bits between the MSb and LSb are specified by the CRCXOR registers. For example, when using CRC16-ANSI,
the polynomial is defined as X16+X15+X2+1. The X16 and X0 = 1
terms are the MSb and LSb controlled by hardware. The
X15 and X2 terms
are specified by setting the corresponding CRCXOR[15:0] bits with the value of 0x8004.
Reading the CRCXOR registers will return 0x8005 because the LSb is hardwired high. Refer to
the following example.