27.3.3 Data FIFO

The module incorporates a FIFO that works with a variable data width. The data width is defined by the DWIDTH[4:0] bits (CRCCON[28:24]). It can be configured to any value between 1 and 32 bits. The logic associated with the FIFO contains a 5-bit counter, VWORD[4:0] bits (CRCCON[12:8]).

The value in the VWORD[4:0] bits indicates the number of unprocessed data elements in the FIFO. The FIFO is:

  • 16-word deep when DWIDTH[4:0] ≤ 7 (data words, 8-bit wide or less)
  • 8-word deep when DWIDTH[4:0] ≤ 15 (data words from 9 to 16-bit wide)
  • 4-word deep when DWIDTH[4:0] ≤ 31 (data words from 17 to 32-bit wide)

The data for the CRC calculation must be written into the FIFO using the CRCDAT registers. Reading the CRCDAT registers always returns zero. To accommodate the MSb first shift method (LENDIAN = 0), byte and word swapping must be done in software when filling the FIFO.

Note: Ensure that the new data is not written into the CRCDAT registers when the CRCFUL bit is set; if the new data is written, it will be ignored.

When all shifts are done (i.e., the FIFO is empty and the CRC shift engine is Idle), it is possible to change the FIFO width (DWIDTH[4:0] bits) without any information loss or CRC result damage.

With a data width of eight bits or less, the FIFO increments on a write to the lower byte of the CRCDAT register (a byte access to the CRCDAT register must be used). The smallest data element that can be written into the FIFO is one byte.

For example, if DWIDT[20:16] is five, then the size of the data is DWIDT[20:16] + 1 or six. The data is written as a whole byte; the two unused upper bits are ignored. Once the data byte is written into the CRCDAT register, the value of the VWORD[4:0] bits (CRCCON[12:8]) increments by one.

With data widths more than 8 bits and less than or equal to 16 bits, the FIFO increments on a write to the CRCDAT register (16-bit word access to the CRCDAT register must be used). Unused upper data bits are ignored. The value of the VWORD[4:0] bits is incremented for every write to the CRCDAT register.

When the data width is greater than 16 bits, any write to the CRCDAT register increments the VWORD[4:0] bits by one. Writing the lower word into the CRCDAT register must be done before writing the upper word into the CRCDAT register. Unused upper data bits are ignored.