|
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
|
▷ |