English
Language : 

M306H7MG-XXXFP Datasheet, PDF (181/329 Pages) Renesas Technology Corp – SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER with DATA ACQUISITION CONTROLLER
M306H7MG-XXXFP/MC-XXXFP/FGFP
13. CRC CALCULATION
Setup procedure and CRC operation when generating CRC code “80C416”
(a) CRC operation performed by the M16C
CRC code: Remainder of a division in which the value written to the CRCIN register with its bit positions reversed is
divided by the generator polynomial
Generator polynomial: X16 + X12 + X5 + 1 (1 0001 0000 0010 00012)
(b) Setting procedure
(1) Reverse the bit positions of the value “80C416” bytewise in a program.
“8016” → “0116”, “C416” → “2316”
b15
(2) Write 000016 (initial value)
b0
CRCD register
(3) Write 0116
(4) Write 2316
b7
b15
118916
b7
b15
0A4116
b0
CRCIN register
Two cycles later, the CRC code for “8016,” i.e.,
918816, has its bit positions reversed to become
“118916” which is stored in the CRCD register.
b0
CRCD register
b0
CRCIN register
Two cycles later, the CRC code for “80C416,” i.e.,
825016, has its bit positions reversed to become
“0A4116” which is stored in the CRCD register.
b0
CRCD register
(c) Details of CRC operation
In the case of (3) above, the value written to the CRCIN register “0116 (000000012)” has its bit positions reversed to
become “100000002.” The value “1000 0000 0000 0000 0000 00002” derived from that by adding 16 digits and the
CRCD register’s initial value “000016” are added, the result of which is divided by the generator polynomial using
modulo-2 arithmetic.
1 0001 0000 0010 0001
Generator polynomial
1000 1000
1000 0000 0000 0000 0000 0000
1000 1000 0001 0000 1
1000 0001 0000 1000 0
1000 1000 0001 0000 1
1001 0001 1000 1000
Data
Modulo-2 operation is
operation that complies
with the law given below.
0+0=0
0+1=1
1+0=1
1+1=0
-1 = 1
CRC code
The value “0001 0001 1000 10012 (118916)” derived from the remainder “1001 0001 1000 10002 (918816)” by
reversing its bit positions may be read from the CRCD register.
If operation (4) above is performed subsequently, the value written to the CRCIN register “2316 (001000112)” has its bit
positions reversed to become “110001002. The value “1100 0100 0000 0000 0000 00002” derived from that by adding
16 digits and the remainder in (3) “1001 0001 1000 10002” which is left in the CRCD register are added, the result of
which is divided by the generator polynomial using modulo-2 arithmetic.
The value “0000 1010 0100 00012 (0A4116)” derived from the remainder by reversing its bit positions may be read
from the CRCD register.
Figure 13.3 CRC Calculation
Rev.2.10 Oct 25, 2006 Page 181 of 326
REJ03B0152-0210