
CRC Calculation Circuit
Specifications in this manual are tentative and subject to change
Rev. E
MITSUBISHI MICROCOMPUTERS
M30245 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
174
CRC calculation circuit
The Cyclic Redundancy Check (CRC) calculation circuit detects any errors in data blocks. The microcomputer
uses a generator polynomial of CRC-CCITT (x16+ x12 + x5 + 1) or CRC-16 (x16+ x15 + x2 + 1) to generate CRC
code.
The CRC code is a 16-bit code generated for a block of a given data length in multiples of 8 bits. It is set in a CRC
data register every time one byte of data is transferred to a CRC input register after writing an initial value into the
CRC data register. Generation of CRC code for one byte of data is completed in two machine cycles.
Figure 1.127 shows the block diagram of the CRC circuit. Figure 1.128 shows the CRC-related registers. Figure
1.129 shows an example of the CRC using CRC-CCITT.
CRC Snoop
The CRC circuit includes the ability to snoop reads and writes to certain SFR addresses. This can be
used to accumulate the CRC value on a stream of data without using extra bandwidth to explicitly write
data into the CRCIN register. For example, it may be useful to snoop the writes to a UART TX buffer, or
the reads from a UART RX buffer. This can only be used on USB, UART and SSI registers.
To snoop an SFR address, the target address is written to the CRC Snoop Address Register (CRCSAR).
The two most significant bits of this register enable snooping on reads or writes to the target address. If the
target SFR is written to by the CPU or DMA, and the CRC snoop write bit is set (CRCSW=1), the CRC will
latch the data into the CRCIN register. The new CRC code will be set in the CRCD register.
Similarly, if the target SFR is read by the CPU or DMA, and the CRC snoop read bit is set (CRCSR=1), the
CRC will latch the data from the target into the CRCIN register and calculate the CRC.
The CRC circuit can only calculate CRC codes on data one byte at a time. Therefore, if a target SFR is
accessed in a word (16 bit) bus cycle, only the byte of data going to or from the target is snooped into
CRCIN. The other byte of the word access is ignored.
Note: CRC Snoop can only be used to snoop USB, UART and SSI related SFR registers.
Figure 1.127. CRC circuit block diagram
Eight low-order bits
Eight high-order bits
Data bus high-order bits
Data bus low-order bits
CRC data register (16)
CRC input register (8)
CRC code generating circuit
x16 + x12 + x5 + 1
(Addresses 03BD 16, 03BC
(Address 03BE
16
)
16
)
OR x16 + x15 + x2 + 1
Snoop Address
Equal?
Address Bus
Snoop
enable
Snoop
Block
Enable