
Rev. 1.00
481 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
24 Cyclic Redundancy Check (CRC)
Functional Descriptions
This unit only enables the calculation in the CRC16, CCITT CRC16 and IEEE-802.3 CRC32
polynomials. In this unit, the generator polynomial is fixed to the numeric values for those modes;
therefore, the CRC value based on other generator polynomials cannot be calculated.
CRC Computation
The CRC calculation unit has a 32-bit write CRC data register (CRCDR) and a read CRC checksum
register (CRCCSR). The CRCDR register is used to input new data (write access) and the CRCCSR
register is used to hold the result of the previous CRC calculation (read access). Each write operation
to the CRCDR register creates a combination of the previous CRC value (stored in CRCCSR) and
the new one. The CRC block diagram is shown as Figure 177. The CRC unit calculates the CRC data
register (CRCDR) value byte by byte and the default byte and bit order is big-endian. The CRCDR
register can be written by word, right-aligned half-word and right-aligned byte. For the other
registers only 32-bit access is allowed. The duration of the computation depends on data width:
▄
4 AHB clock cycles for 32-bit data input
▄
2 AHB clock cycles for 16-bit data input
▄
1 AHB clock cycle for 8-bit data input
Byte and Bit Reversal for CRC Computation
The byte reordering and byte-level bit reversal operation can be occurred before the data is
used in the CRC calculation or after the CRC checksum output. They are configurable using the
corresponding setting field of the CRCCR register. These operations occur on word or half-word
writes. The hardware ignores the DATBYRV bit of the CRCCR register with any byte writes but
the bit reversal setting DATBIRV are still applied to the byte. The
178 is shown the byte and
bit reversal operation example.
Byte 3
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 2
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 1
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 0
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 0
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 1
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 2
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte 3
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
Byte Reversal Enable
Byte 0
Bi
t0
Bi
t1
Bi
t2
Bi
t3
Bi
t4
Bi
t5
Bi
t6
Bi
t7
Byte 1
Byte 2
Byte 3
Bit Reversal Enable
Bi
t0
Bi
t1
Bi
t2
Bi
t3
Bi
t4
Bi
t5
Bi
t6
Bi
t7
Bi
t0
Bi
t1
Bi
t2
Bi
t3
Bi
t4
Bi
t5
Bi
t6
Bi
t7
Bi
t0
Bi
t1
Bi
t2
Bi
t3
Bi
t4
Bi
t5
Bi
t6
Bi
t7
Input data is
big-endian
Figure 178. CRC Data Bit and Byte Reversal Example