Renesas M16C Laptop User Manual


 
Rev.1.10 Jul 01, 2005 page 201 of 318
REJ09B0124-0110
M16C/6N Group (M16C/6NK, M16C/6NM) 17. CRC Calculation
Under development
This document is under development and its contents are subject to change.
Figure 17.3 CRC Calculation
b15
b7
b15
1189h
b7
b15
0A41h
b0
b0
b0
b0
b0
CRCD register
CRCIN register
Two cycles later, the CRC code for "80h," i.e.,
9188h, has its bit positions reversed to become
"1189h" which is stored in the CRCD register.
CRCD register
CRCIN register
Two cycles later, the CRC code for "80C4h," i.e.,
8250h, has its bit positions reversed to become
"0A41h" which is stored in the CRCD register.
CRCD register
Setup procedure and CRC operation when generating CRC code "80C4h"
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: X
6
+X
12
+X
5
+1(1 0001 0000 0010 0001b)
Setting procedure
(1) Reverse the bit positions of the value "80C4h" by program in 1-byte unit.
"80h" "01h", "C4h" "23h"
(2) Write 0000h (initial value)
(3) Write 01h
(4) Write 23h
Details of CRC operation
n the case of (3) above, the value written to the CRCIN register "01h (00000001b)" has its bit positions reversed to become
"10000000b". The value "1000 0000 0000 0000 0000 0000b" derived from that by adding 16 digits and the initial value
of the CRCD register, "0000h" are added. The result is divided by the generator polynomial using modulo-2 arithmetic.
The value "0001 0001 1000 1001b (1189h)" derived from the remainder "1001 0001 1000 1000b (9188h)" 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 "23h (00100011b)" has its bit
positions reversed to become "11000100b". The value "1100 0100 0000 0000 0000 0000b" derived from that by adding
16 digits and the remainder in (3) "1001 0001 1000 1000b" 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 0001b (0A41h)" derived from the remainder by reversing its bit positions may be read from
the CRCD register.
1 0001 0000 0010 0001
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
1000 1000
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
Generator polynomial
CRC code
Data