An introduction< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
In order to guarantee that data in computer system in transmission and memory correct reliable, has introduced the channel coding. Has two aspects regarding the channel coding; first, after request code symbol stream frequency spectrum adaptation channel frequency characteristic; second, examines error code which and corrects produces. The former belongs to the spectrum forming technique, the latter for error control technology. The CRC code belongs to the latter. It is through increases the redundant information, achieves the discovery error code the goal. The common redundancy check has the parity check, the sea bright verification, the cyclical redundancy check.
This article discusses the cyclical redundancy check (CRC) realization, and in ethernet’s application.
Two circulation redundant codes introduction
1 circulation redundant codes are the establishment in the modern algebra foundation. Arranges the demoding circuit to be simple, error detection ability. Obtains the widespread application in computer system’s data storage and the transmission.
2 code principles
Supposes treats a transmission bit data is D (x), the production multinomial is G (x). Information code length k, verification code length n-k position, then after coding the code length is n. Like Figure 1:

Code step: Message data D (x) is multiplied by< ?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
It is not all multinomials may make position production multinomial G(x), the common production multinomial includes:
CRC8=X8 X5 X4 1
CRC-CCITT=X16 X12 X5 1
CRC12=X12 X11 X3 X2 1
CRC16=X16 X15 X5 1
CRC32=X32 X26 X23 X22 X16 X12 X11 X10 X8 X7 X5 X4 X2 X1 1
3 CRC32 realizations
What the ethernet channel coding uses is CRC32, therefore gives CRC32 in here realization, it increased a detail in the general CRC foundation.
Introduces the ethernet MAC frame structure

Mathematically speaking, assigns the frame correspondingly the CRC value by the following process definition:
(1) Makes the supplement operation to this frame’s first 32.
(2) Then, this frame’s n regards as is (n-1) step multinomial M (x) the coefficient.
(3) M (x) is multiplied by
(4) To this bit position by the position supplement, takes CRC finally.
Mainly realizes the way to have serial and the parallel two kinds:
(a) serial realizes through the linear feedback shift register (take CRC-CCITT as example), see Figure 2

The information flow sends in the register by the low position, when after all information bit sends in the register finished, in register for verification code.
(b) CRC32 parallel realization
The serial processing regarding high speed ethernet like 100M,10G and so on, is obviously inappropriate, here my gate gives CRC parallel to realize the method, by a byte position processing unit. Below gives the CRC32 source program which the C language realizes:



Because the ethernet CRC32 request takes before frame 32bit instead, my gate may initialize the register for entire 1 to serve this purpose.
In Crcbuff depositing needs to code the information bit, the last count CRC verification code, the followed information code transmits together.
4 summaries
This article is aims in the project the embedded equipment’s networking question, the design CRC32 verification algorithm, already succeeded in FPGA realizes, because realizes the code with FPGA to be relatively simple, here no longer tired states.
Author Email: lijunshen148@sohu.com