CN112306741A - CRC (Cyclic redundancy check) method and related device - Google Patents
CRC (Cyclic redundancy check) method and related device Download PDFInfo
- Publication number
- CN112306741A CN112306741A CN202011305695.6A CN202011305695A CN112306741A CN 112306741 A CN112306741 A CN 112306741A CN 202011305695 A CN202011305695 A CN 202011305695A CN 112306741 A CN112306741 A CN 112306741A
- Authority
- CN
- China
- Prior art keywords
- data
- crc
- bit width
- calculation
- calculation unit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/08—Error detection or correction by redundancy in data representation, e.g. by using checking codes
- G06F11/10—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
- G06F11/1004—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Error Detection And Correction (AREA)
- Detection And Correction Of Errors (AREA)
- Detection And Prevention Of Errors In Transmission (AREA)
Abstract
The application discloses a CRC (Cyclic redundancy check) method, which comprises the following steps: acquiring the data bit width of current transmission data; judging whether the data bit width is the same as the bit width of a configured CRC calculation unit or not; if so, performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value; if not, performing cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value. By adopting the CRC calculation unit with the 1Byte bit width to carry out check calculation on the data with different bit widths, rather than configuring corresponding calculation units for all data with bit widths, the complexity and the resource consumption are reduced, and the performance utilization rate is improved. The application also discloses a CRC checking device, a server and a computer readable storage medium.
Description
Technical Field
The present application relates to the field of data computing technologies, and in particular, to a CRC check method, a CRC check apparatus, a server, and a computer-readable storage medium.
Background
At present, a Cyclic Redundancy Check (CRC) algorithm is commonly used in a communication system to perform coding Check on data so as to determine an error occurring in a communication process, avoid transmission of erroneous message data into the system, and improve quality and stability of a user using a network. The CRC algorithm has been widely used in the field of communications as a way of data protection. The CRC algorithm is generally implemented on a hardware circuit by an LFSR (linear feedback shift register), which has two methods, namely a serial method and a parallel method, but the LFSR has a feedback loop in a circuit structure, and cannot improve the operating frequency by inserting a multi-stage pipeline, and particularly when the parallel CRC algorithm is used and the data bit width is large, the combinational logic can reach more than 30 stages, and the operating frequency of the circuit cannot be effectively improved because the pipeline can not be inserted to divide the combinational logic.
For example, in the related art, the CRC32 check method includes a CRC32_1Byte module, a CRC32_2Byte module, a CRC32_3Byte module, a CRC32_4Byte module, a CRC32_5Byte module, a CRC32_6Byte module, a CRC32_7Byte module, a CRC32_8Byte module, a CRC32_9Byte module, a CRC32_10Byte module, a CRC32_11Byte module, a CRC32_12Byte module, a CRC32_13Byte module, a CRC32_14Byte module, a CRC32_15Byte module, and a CRC32_16Byte module when checking the 16Byte data. And after the check data are transmitted, data bit width judgment is carried out on the transmitted data, and the judged data are transmitted to a corresponding module for calculation. However, 16 sub-modules are needed to implement the method, the consumption of resources is greatly increased, and the performance of the system is greatly influenced due to the increase of the resources.
Therefore, how to reduce the resource consumption in the CRC32 checking process is a key issue of attention for those skilled in the art.
Disclosure of Invention
The purpose of the present application is to provide a CRC check method, a CRC check apparatus, a server, and a computer readable storage medium, in which a configured CRC calculation unit is used to calculate transmission data with a matching data bit width, or a CRC calculation unit with a 1Byte bit width is used to perform check calculation on data with different bit widths, instead of configuring corresponding calculation units for all data with data bit widths, so that complexity and resource consumption are reduced, and performance utilization rate is improved.
In order to solve the above technical problem, the present application provides a CRC check method, including:
acquiring the data bit width of current transmission data;
judging whether the data bit width is the same as the bit width of a configured CRC calculation unit or not; wherein the bit width of the configured CRC calculation unit comprises 4 bytes, 8 bytes and 16 bytes;
if so, performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value;
if not, performing cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value.
Optionally, the method further includes:
when a CRC calculation unit with 4Byte bit width is adopted for calculation, 3 data storage blocks with 1Byte are configured for the CRC calculation unit with 1Byte bit width.
Optionally, the method further includes:
when the CRC calculation unit with the 8-Byte bit width is adopted for calculation, 7 data storage blocks with 1Byte are configured for the CRC calculation unit with the 1Byte bit width.
Optionally, the method further includes:
when a 16-Byte-bit-wide CRC calculation unit is adopted for calculation, 15 1-Byte data storage blocks are configured for the 1-Byte-bit-wide CRC calculation unit.
Optionally, performing cyclic CRC check calculation on the transmission data according to a CRC calculation unit with a bit width of 1Byte to obtain a check value, where the method includes:
storing the transmission data into a corresponding data storage block according to a 1Byte unit;
and taking out the data from the data storage blocks according to the transmission data bit sequence, performing CRC check calculation on the data by adopting a CRC calculation unit with the 1Byte bit width, and taking the obtained check value as an initial value for calculation by the CRC calculation unit with the 1Byte bit width next time until the data calculation in all the data storage blocks is completed to obtain the check value.
The present application further provides a CRC check apparatus, including:
the data bit width acquisition module is used for acquiring the data bit width of the current transmission data;
the bit width judging module is used for judging whether the data bit width is the same as the bit width of the configured CRC calculation unit or not; wherein the bit width of the configured CRC calculation unit comprises 4 bytes, 8 bytes and 16 bytes;
the first CRC calculation module is used for performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value when the data bit width is the same as the bit width of a configured CRC calculation unit;
and the second CRC calculation module is used for performing cyclic CRC calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value when the data bit width is different from the bit width of the configured CRC calculation unit.
Optionally, the method further includes:
and the data storage block configuration module is used for configuring 3 data storage blocks of 1Byte for the CRC calculation unit with the bit width of 1Byte when the CRC calculation unit with the bit width of 4Byte is adopted for calculation.
Optionally, the second CRC calculation module includes:
the data write-in storage block submodule is used for storing the transmission data into a corresponding data storage block according to a 1Byte unit;
and the CRC check calculation sub-module is used for taking out data from the data storage blocks according to the transmission data bit sequence, performing CRC check calculation on the data by adopting a CRC calculation unit with the 1Byte bit width, and taking the obtained check value as an initial value calculated by the CRC calculation unit with the 1Byte bit width at the next time until the data calculation in all the data storage blocks is completed to obtain the check value.
The present application further provides a server, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the CRC check method as described above when executing the computer program.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the CRC check method as described above.
The CRC method provided by the application comprises the following steps: acquiring the data bit width of current transmission data; judging whether the data bit width is the same as the bit width of a configured CRC calculation unit or not; wherein the bit width of the configured CRC calculation unit comprises 4 bytes, 8 bytes and 16 bytes; if so, performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value; if not, performing cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value.
The transmission data with the matched data bit width is calculated through the configured CRC calculation unit, or the data with different bit widths are checked and calculated by adopting the CRC calculation unit with the 1Byte bit width, so that the check calculation of the data with multiple bit widths is realized, the corresponding calculation units are not configured for all the data with the data bit widths, the complexity and the resource consumption are reduced, and the performance utilization rate is improved; and similarly, the data is not calculated after being subjected to bit complementing, so that data calculation errors caused by bit complementing are avoided, and the accuracy and precision of CRC (cyclic redundancy check) are improved.
The present application further provides a CRC checking apparatus, a server, and a computer readable storage medium, which have the above beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a CRC check method according to an embodiment of the present disclosure;
FIG. 2 is a block diagram of an architecture for CRC32 check computation according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of CRC32 check code calculation according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a CRC check apparatus according to an embodiment of the present disclosure.
Detailed Description
The core of the application is to provide a CRC checking method, a CRC checking device, a server and a computer readable storage medium, the configured CRC calculation unit is used for calculating transmission data with matched data bit width, or the CRC calculation unit with 1Byte bit width is used for checking and calculating data with different bit widths, instead of configuring corresponding calculation units for all data with data bit width, so that the complexity and the resource consumption are reduced, and the performance utilization rate is improved.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the related art, when the CRC32 check method performs the 16Byte data check, the check modules include a CRC32_1Byte module, a CRC32_2Byte module, a CRC32_3Byte module, a CRC32_4Byte module, a CRC32_5Byte module, a CRC32_6Byte module, a CRC32_7Byte module, a CRC32_8Byte module, a CRC32_9Byte module, a CRC32_10Byte module, a CRC32_11Byte module, a CRC32_12Byte module, a CRC32_13Byte module, a CRC32_14Byte module, a CRC32_15Byte module, and a CRC32_16Byte module. And after the check data are transmitted, data bit width judgment is carried out on the transmitted data, and the judged data are transmitted to a corresponding module for calculation. However, 16 sub-modules are needed to implement the method, the consumption of resources is greatly increased, and the performance of the system is greatly influenced due to the increase of the resources.
In addition, another related art CRC32 check method includes a CRC32_1Byte module, a CRC32_2Byte module, a CRC32_3Byte module, a CRC32_4Byte module, a CRC32_5Byte module, a CRC32_6Byte module, a CRC32_7Byte module, a CRC32_8Byte module, and a CRC32_16Byte module. And after the check data are transmitted, judging the data bit width of the transmitted data, and when the data bit width is less than or equal to 8 bytes or equal to 16 bytes, directly calculating the corresponding calculation module. When the data bit width is between 8 bytes and 16 bytes, a combination operation is performed. When the data bit width is 11Byte, the data verification calculation of 8Byte is firstly carried out, and the calculation result is used as intermediate data to carry out the data verification calculation of 3Byte, thereby realizing the calculation of 11Byte data. The method has the advantages that the calculation of the CRC32 can be realized by using 9 sub-modules, but the consumed clock number is increased by one time when the CRC check value of the data bit width of 9 bytes, 10 bytes, 11 bytes, 12 bytes, 13 bytes, 14 bytes and 15 bytes is calculated. But the resource consumption is reduced to some extent.
Based on the related technologies, another parallel CRC32 checking method for calculating a 64-bit width is mainly implemented by a bit alignment method. The checking method mainly comprises the steps that bit width matching is carried out on input data by 64 bits, if the input data is judged to be insufficient by 64 bits, preset 56-bit data lower by 8i (i is 1, 2, … and 7) bit data are added to the tail of the input data as filling bits, and 64-bit data are obtained; performing CRC32-D64 check on the 64-bit data, then comparing the obtained check result with the CRC check value corresponding to the padding bits, and if the two check results are the same, judging that the CRC check is correct; if the two are different, the CRC check error is judged. The method has the advantages that the verification period is shortened to a single period, and consumed resources are greatly reduced; the disadvantage is that it is not flexible enough to perform a calculation quickly when performing a calculation for a single data block, but if a CRC calculation is finally obtained for a data calculation from 1Byte to 4Mbyte, and the CRC check value is a comparison of the calculation results for different transmission bit widths of the same data block, a CRC check value error will occur, because different calculation modes involve different data bits and different CRC initial bits, and the result calculated by using a padding method will be erroneous for different transmission bit widths.
Therefore, the CRC check method provided by the application calculates the transmission data with the matched data bit width through the configured CRC calculation unit, or adopts the CRC calculation unit with the 1Byte bit width to perform check calculation on the data with different bit widths, so that the check calculation on the data with multiple bit widths is realized, the corresponding calculation units are not configured on all the data with the data bit widths, the complexity and the resource consumption are reduced, and the performance utilization rate is improved; and similarly, the data is not calculated after being subjected to bit complementing, so that data calculation errors caused by bit complementing are avoided, and the accuracy and precision of CRC (cyclic redundancy check) are improved.
A CRC check method provided in the present application is described below by an embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a CRC check method according to an embodiment of the present disclosure.
In this example, the method may include:
s101, acquiring a data bit width of current transmission data;
this step is intended to acquire the data bit width of the transmission data being currently transmitted.
The current transmission data mainly refers to data transmitted within a transmission bandwidth. Generally, in the process of CRC check, a block of data is mainly transmitted through a fixed transmission bandwidth, and then a frame of data or a beat of data currently being transmitted in the transmission bandwidth is obtained as the current transmission data in this embodiment.
Further, the data bit width of the current transmission data is obtained.
S102, judging whether the data bit width is the same as the bit width of a configured CRC calculation unit or not; the bit width of the configured CRC calculation unit comprises 4Byte, 8Byte and 16 Byte; if yes, executing S103; if not, executing S104;
on the basis of S101, this step is intended to determine whether the data bit width is the same as the bit width of the configured CRC calculation unit. The configured bit width of the CRC calculation unit comprises 4 bytes, 8 bytes and 16 bytes.
The configured CRC calculation unit mainly refers to a configured CRC calculation unit before data transmission is performed, and may be determined by a bandwidth of transmission data. For example, when the bandwidth of the transmission data is 4 bytes, a CRC calculation unit having a bit width of 4 bytes is configured. When the bandwidth of the transmission data is 8 bytes, the CRC calculation unit with 8 bytes bit width is configured. When the bandwidth of the transmission data is 16 bytes, the CRC calculation unit with 16 bytes bit width is configured.
The configured CRC calculation unit may be a CRC calculation unit configured in advance before data transmission, a CRC calculation unit determined alternately according to a preset order, or a CRC calculation unit determined according to the size of the data block to be transmitted.
Optionally, this embodiment may further include:
when the CRC calculation unit with the 4-Byte bit width is adopted for calculation, 3 data storage blocks with 1Byte are configured for the CRC calculation unit with the 1Byte bit width.
It can be seen that, in this alternative, when a CRC calculation unit with a 4Byte bit width is adopted, that is, configured, and a CRC calculation unit with a 4Byte bit width is correspondingly configured, a data storage block is adopted for cyclic check performed when the data bit width is less than 4 Byte.
Optionally, this embodiment may further include:
when the CRC calculation unit with the 8-Byte bit width is adopted for calculation, 7 data storage blocks with 1Byte are configured for the CRC calculation unit with the 1Byte bit width.
It can be seen that, in this alternative, when a CRC calculation unit with an 8Byte bit width is adopted, that is, configured, and a CRC calculation unit with an 8Byte bit width is correspondingly configured, a data storage block is adopted for cyclic check performed when the data bit width is less than 8 Byte.
Optionally, this embodiment may further include:
when the CRC calculation unit with the bit width of 16 bytes is adopted for calculation, 15 data storage blocks with the bit width of 1Byte are configured for the CRC calculation unit with the bit width of 1 Byte.
It can be seen that, in this alternative, when a CRC calculation unit with a 16Byte bit width is adopted, that is, configured, and a CRC calculation unit with a 16Byte bit width is correspondingly configured, a data storage block is adopted for cyclic check performed when the data bit width is less than 16 Byte.
S103, performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value;
on the basis of S102, in this step, a CRC calculation unit corresponding to the data bit width is used to perform CRC check calculation on the transmission data, so as to obtain a check value.
When the data bit width of the transmission data is matched with the bit width of the corresponding CRC calculation unit, the matched CRC calculation unit is directly adopted to perform corresponding CRC check calculation on the transmission data, and a corresponding check value is obtained.
The calculation method of the CRC calculation unit is not particularly limited.
And S104, performing cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value.
On the basis of S102, the step aims to perform cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value.
Further, specifically describing the implementation of the step, the step may include:
and 2, taking out data from the data storage blocks according to the transmission data bit sequence, performing CRC check calculation on the data by adopting a CRC calculation unit with the 1Byte bit width, and taking the obtained check value as an initial value for calculation by the CRC calculation unit with the 1Byte bit width at the next time until the data calculation in all the data storage blocks is completed to obtain the check value.
It can be seen that the present alternative mainly explains how to perform cyclic check on data with insufficient data bit width. In the alternative scheme, firstly, the transmission data is stored into a corresponding data storage block according to a 1Byte unit; and then, taking out data from the data storage blocks according to the transmission data bit sequence, performing CRC check calculation on the data by adopting a CRC calculation unit with the 1Byte bit width, and taking the obtained check value as an initial value for calculation by the CRC calculation unit with the 1Byte bit width next time until the data calculation in all the data storage blocks is completed to obtain the check value.
In summary, in the embodiment, the configured CRC calculation unit calculates the transmission data with the matched data bit width, or the CRC calculation unit with the 1Byte bit width is adopted to perform check calculation on the data with different bit widths, so that the check calculation on the data with multiple bit widths is realized, instead of configuring corresponding calculation units for all data bit widths, the complexity and the resource consumption are reduced, and the performance utilization rate is improved; and similarly, the data is not calculated after being subjected to bit complementing, so that data calculation errors caused by bit complementing are avoided, and the accuracy and precision of CRC (cyclic redundancy check) are improved.
A CRC check method provided in the present application is described below with a specific example.
In this embodiment, the present embodiment provides a CRC32 calculation method for data blocks of 1Byte to 4 mbbyte, where the data blocks of 4Byte, 8Byte, and 16Byte have different transmission bit widths. In the embodiment, it is considered that when CRC32 is calculated for the same data block, CRC32 values calculated by different transmission bit widths are required to be checked, and therefore, when a CRC32 check value is calculated, the CRC cannot be implemented by performing low-order bit padding on data with insufficient transmission bit width. In the embodiment, the CRC check value of the data with the insufficient transmission bit width is obtained by performing the data with the insufficient transmission bit width in a cyclic manner according to the 1Byte data, so that the problem of error of the calculation result caused by bit complementing of the low bit is well solved. In the process of calculating the data CRC32, when calculating data with a full transmission bit width, generating a CRC value in one period by one beat of data, when calculating data with an insufficient transmission bit width, generating a CRC value in a plurality of periods by one beat of data, wherein the period number at the moment is related to the size of the one beat of data, and when the one beat of data is 1Byte, calculating a CRC32 check value through 1 period; when one beat of data is 2 bytes, calculating a CRC32 check value through 2 cycles; by analogy, when a beat of data is 15 bytes, the CRC32 check value needs to be calculated through 15 cycles. The maximum clock period is related to the size of the transmission bit width, and is always 1 less than the Byte number of the transmission bit width. Therefore, CRC32 calculation of different transmission bit widths of 4Byte, 8Byte and 16Byte is carried out on the data blocks from 1Byte to 4 MBbyte, and comparison of CRC calculation results of different transmission bit widths is further achieved.
In this embodiment, first, the data transmission bit width is configured and can be configured to be 4Byte, 8Byte and 16 Byte. This embodiment completes the CRC32 check code calculation on the data. The calculation module is configured by configuring the input data bit width and the input data of 1Byte _ CRC 32.
When the CRC32 calculation of 4Byte is performed, the input data bit width needs to be configured to 32 bits, and the input module of 1Byte _ CRC32 needs to be configured to 3 data blocks of 1Byte input, so as to perform cyclic calculation on data less than 4Byte in a 1Byte calculation manner.
When 8-Byte CRC32 is calculated, the input data bit width needs to be configured to 64 bits, and the input module of 1-Byte CRC32 needs to be configured to 7 data blocks of 1-Byte input, so as to circularly calculate the data less than 8-Byte in a 1-Byte calculation manner.
When performing 16Byte CRC calculation, the input data bit width needs to be configured to 128 bits, and the input module of the 1Byte _ CRC32 needs to be configured to 15 1Byte input data blocks, so as to perform cyclic calculation on data less than 16Byte in a 1Byte calculation manner.
And after the corresponding calculation mode is set and data is transmitted, selecting the calculation mode of the data according to the data bit width. And for the data blocks from 4Byte to 4 MBbyte, calculating according to the preset transmission bit width. After data transmission, judging according to the data bit width, when the data bit width is the configured transmission bit width, calculating the corresponding transmission bit width, when the data bit width is smaller than the configured transmission bit width, transmitting the data into a storage module with 1Byte as a unit, and calculating 1Byte _ CRC32 according to the Byte number signal of the data bit width and the 1Byte transmission bit width. When a 1Byte to 4MByte data block is transmitted, when one beat of transmission data is less than a preset transmission bit width, the transmission data is the last beat of data of the data block. At this time, the end-beat flag bit will give a high output, and when the 1Byte _ CRC32 counts to the last 1Byte data, the calculator will give a low signal, which is xored with the end-beat flag to select the value in the CRC check value register to be output.
In the calculation process, no matter the 4/8/16Byte calculation module or the 1Byte _ CRC32 calculation module, the calculated result needs to be updated to the CRC check value register, and when the next calculation is performed, the latest value is read from the register to be used as the CRC initial value of the next calculation.
Referring to fig. 2, fig. 2 is a block diagram of an architecture of CRC32 check calculation according to an embodiment of the present disclosure.
And after the corresponding calculation mode is set and data is transmitted, selecting the calculation mode of the data according to the data bit width. And for the data blocks from 4Byte to 4 MBbyte, calculating according to the preset transmission bit width. After data transmission, judging according to the data bit width, when the data bit width is the configured transmission bit width, calculating the corresponding transmission bit width, when the data bit width is smaller than the configured transmission bit width, transmitting the data into a storage module with 1Byte as a unit, and calculating 1Byte _ CRC32 according to the Byte number signal of the data bit width and the 1Byte transmission bit width. When a 1Byte to 4MByte data block is transmitted, when one beat of transmission data is less than a preset transmission bit width, the transmission data is the last beat of data of the data block. At this time, the end-beat flag bit will give a high output, and when the 1Byte _ CRC32 counts to the last 1Byte data, the calculator will give a low signal, which is xored with the end-beat flag to select the value in the CRC check value register to be output.
In the calculation process, no matter the 4/8/16Byte calculation module or the 1Byte _ CRC32 calculation module, the calculated result needs to be updated to the CRC check value register, and when the next calculation is performed, the latest value is read from the register to be used as the CRC initial value of the next calculation.
The design uses CRC32, whose generator polynomial g (x) is:
x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1
the number representation can be written as: 100000100110000010001110110110111.
in the design, the relation between the output CRC check code and the input data and the initial check code is obtained by deducing the polynomial of the CRC32, so that the calculated CRC32 check code can be directly obtained through a calculation formula when the data and the initial check code are obtained.
The specific operation of obtaining the CRC code of one data is as follows:
step 2, the transmission data is shifted to the left by K bits, and zero filling processing is carried out on the right side (wherein K is the highest power of the generator polynomial)
Step 3, using the data after shifting and zero-filling to perform the modulo-2 division (i.e. XOR operation) on G (x)
And 4, obtaining the remainder which is the CRC value of the data.
Referring to fig. 3, fig. 3 is a schematic structural diagram of CRC32 check code calculation according to an embodiment of the present disclosure.
The calculation of the CRC check code is most originally realized by using an LFSR (linear feedback shift register) to complete the check function. The schematic structure is shown in FIG. 3, where REG0 is register 0, REG1 is register 1, REG2 is register 2, and REGN-1 is register n-1.
In fig. 3, the number of registers is equal to the highest power of g (x), and g1 in fig. 3 represents the link on/off, corresponding to the coefficients of the polynomial: a coefficient of 1 indicates a connection and a coefficient of 0 indicates a disconnection. Data is input 1bit from the right side every clock cycle and the data in the register is shifted to the right by one bit. The process of feedback exclusive or is the process of performing modulo-2 division on the generator polynomial after the data to be transmitted is shifted, so when all data bits are input, the value in the register is the CRC32 check code.
Taking CRC8 as an example, from the above analysis, the following equation can be obtained, where ^ is exclusive-OR operation:
REG2(i)=REG1(i-1)^REG7(i-1)^d(i)
REG1(i)=REG0(i-1)^REG7(i-1)^d(i)
REG0(i)=REG1(i-1)^d(i)
REGK(i)=REGK-1(i-1)(K!=0,1,2)
wherein i represents the current time and i-1 represents the last time. The data bit width is 4 bits, and after four beats, the change process of the data in the register is shown in table 1, where D3 to D0 are input data bits, and C7 to C0 are data bits of the initial value of the CRC check code, which is specifically referred to in table 1.
TABLE 1 CRC data variation Table
The expression after each bit permutation of CRC8 is thus derived as follows:
C0=D0^C4
C1=D1^D0^C4^C5
C2=D2^D1^D0^C4^C5^C6
C3=D3^D2^D1^C5^C6^C7
C4=D3^D2^C0^C6^C7
C5=D3^C1^C7
C6=C2
C7=C3
the values of REG 7-REG 0 after four beats are derived according to the above transfer equation. Through analysis of the above example, a direct expression of CRC32 of different bit widths may be generated by the generator polynomial of CRC32 in combination with the check done by the LFSR.
Taking the 4Byte calculation mode as an example, when 1Byte to 4 mbbyte data block processing is performed, the data processed each time is 4Byte data or less than 4 Byte. At this time, the specific selected calculation submodule is determined according to the number of bytes.
The workflow for the 4Byte _ CRC32 sub-module is introduced as follows:
first, the design of the 4Byte _ CRC32 submodule is obtained according to the calculation formula of CRC 32. There is a distinct computational expression for each bit check value of CRC32, the contents of which are related to the input data and the initial check value of CRC 32.
The calculation expression of 4Byte _ CRC32 is as follows, where newcrc [ ] is the corresponding data bit of the check code value for each CRC calculation, d [ ] is the input data when the current beat of data calculation is performed, and c [ ] is the corresponding data bit of the CRC check value calculated for the previous beat of data:
newcrc[0]=d[31]^d[30]^d[29]^d[28]^d[26]^d[25]^d[24]^d[16]^d[12]^d[10]^d[9]^d[6]^d[0]^c[0]^c[6]^c[9]^c[10]^c[12]^c[16]^c[24]^c[25]^c[26]^c[28]^c[29]^c[30]^c[31];
newcrc[1]=d[28]^d[27]^d[24]^d[17]^d[16]^d[13]^d[12]^d[11]^d[9]^d[7]^d[6]^d[1]^d[0]^c[0]^c[1]^c[6]^c[7]^c[9]^c[11]^c[12]^c[13]^c[16]^c[17]^c[24]^c[27]^c[28];
newcrc[2]=d[31]^d[30]^d[26]^d[24]^d[18]^d[17]^d[16]^d[14]^d[13]^d[9]^d[8]^d[7]^d[6]^d[2]^d[1]^d[0]^c[0]^c[1]^c[2]^c[6]^c[7]^c[8]^c[9]^c[13]^c[14]^c[16]^c[17]^c[18]^c[24]^c[26]^c[30]^c[31];
newcrc[3]=d[31]^d[27]^d[25]^d[19]^d[18]^d[17]^d[15]^d[14]^d[10]^d[9]^d[8]^d[7]^d[3]^d[2]^d[1]^c[1]^c[2]^c[3]^c[7]^c[8]^c[9]^c[10]^c[14]^c[15]^c[17]^c[18]^c[19]^c[25]^c[27]^c[31];
newcrc[4]=d[31]^d[30]^d[29]^d[25]^d[24]^d[20]^d[19]^d[18]^d[15]^d[12]^d[11]^d[8]^d[6]^d[4]^d[3]^d[2]^d[0]^c[0]^c[2]^c[3]^c[4]^c[6]^c[8]^c[11]^c[12]^c[15]^c[18]^c[19]^c[20]^c[24]^c[25]^c[29]^c[30]^c[31];
newcrc[5]=d[29]^d[28]^d[24]^d[21]^d[20]^d[19]^d[13]^d[10]^d[7]^d[6]^d[5]^d[4]^d[3]^d[1]^d[0]^c[0]^c[1]^c[3]^c[4]^c[5]^c[6]^c[7]^c[10]^c[13]^c[19]^c[20]^c[21]^c[24]^c[28]^c[29];
newcrc[6]=d[30]^d[29]^d[25]^d[22]^d[21]^d[20]^d[14]^d[11]^d[8]^d[7]^d[6]^d[5]^d[4]^d[2]^d[1]^c[1]^c[2]^c[4]^c[5]^c[6]^c[7]^c[8]^c[11]^c[14]^c[20]^c[21]^c[22]^c[25]^c[29]^c[30];
newcrc[7]=d[29]^d[28]^d[25]^d[24]^d[23]^d[22]^d[21]^d[16]^d[15]^d[10]^d[8]^d[7]^d[5]^d[3]^d[2]^d[0]^c[0]^c[2]^c[3]^c[5]^c[7]^c[8]^c[10]^c[15]^c[16]^c[21]^c[22]^c[23]^c[24]^c[25]^c[28]^c[29];
newcrc[8]=d[31]^d[28]^d[23]^d[22]^d[17]^d[12]^d[11]^d[10]^d[8]^d[4]^d[3]^d[1]^d[0]^c[0]^c[1]^c[3]^c[4]^c[8]^c[10]^c[11]^c[12]^c[17]^c[22]^c[23]^c[28]^c[31];
newcrc[9]=d[29]^d[24]^d[23]^d[18]^d[13]^d[12]^d[11]^d[9]^d[5]^d[4]^d[2]^d[1]^c[1]^c[2]^c[4]^c[5]^c[9]^c[11]^c[12]^c[13]^c[18]^c[23]^c[24]^c[29];
newcrc[10]=d[31]^d[29]^d[28]^d[26]^d[19]^d[16]^d[14]^d[13]^d[9]^d[5]^d[3]^d[2]^d[0]^c[0]^c[2]^c[3]^c[5]^c[9]^c[13]^c[14]^c[16]^c[19]^c[26]^c[28]^c[29]^c[31];
newcrc[11]=d[31]^d[28]^d[27]^d[26]^d[25]^d[24]^d[20]^d[17]^d[16]^d[15]^d[14]^d[12]^d[9]^d[4]^d[3]^d[1]^d[0]^c[0]^c[1]^c[3]^c[4]^c[9]^c[12]^c[14]^c[15]^c[16]^c[17]^c[20]^c[24]^c[25]^c[26]^c[27]^c[28]^c[31];
newcrc[12]=d[31]^d[30]^d[27]^d[24]^d[21]^d[18]^d[17]^d[15]^d[13]^d[12]^d[9]^d[6]^d[5]^d[4]^d[2]^d[1]^d[0]^c[0]^c[1]^c[2]^c[4]^c[5]^c[6]^c[9]^c[12]^c[13]^c[15]^c[17]^c[18]^c[21]^c[24]^c[27]^c[30]^c[31];
newcrc[13]=d[31]^d[28]^d[25]^d[22]^d[19]^d[18]^d[16]^d[14]^d[13]^d[10]^d[7]^d[6]^d[5]^d[3]^d[2]^d[1]^c[1]^c[2]^c[3]^c[5]^c[6]^c[7]^c[10]^c[13]^c[14]^c[16]^c[18]^c[19]^c[22]^c[25]^c[28]^c[31];
newcrc[14]=d[29]^d[26]^d[23]^d[20]^d[19]^d[17]^d[15]^d[14]^d[11]^d[8]^d[7]^d[6]^d[4]^d[3]^d[2]^c[2]^c[3]^c[4]^c[6]^c[7]^c[8]^c[11]^c[14]^c[15]^c[17]^c[19]^c[20]^c[23]^c[26]^c[29];
newcrc[15]=d[30]^d[27]^d[24]^d[21]^d[20]^d[18]^d[16]^d[15]^d[12]^d[9]^d[8]^d[7]^d[5]^d[4]^d[3]^c[3]^c[4]^c[5]^c[7]^c[8]^c[9]^c[12]^c[15]^c[16]^c[18]^c[20]^c[21]^c[24]^c[27]^c[30];
newcrc[16]=d[30]^d[29]^d[26]^d[24]^d[22]^d[21]^d[19]^d[17]^d[13]^d[12]^d[8]^d[5]^d[4]^d[0]^c[0]^c[4]^c[5]^c[8]^c[12]^c[13]^c[17]^c[19]^c[21]^c[22]^c[24]^c[26]^c[29]^c[30];
newcrc[17]=d[31]^d[30]^d[27]^d[25]^d[23]^d[22]^d[20]^d[18]^d[14]^d[13]^d[9]^d[6]^d[5]^d[1]^c[1]^c[5]^c[6]^c[9]^c[13]^c[14]^c[18]^c[20]^c[22]^c[23]^c[25]^c[27]^c[30]^c[31];
newcrc[18]=d[31]^d[28]^d[26]^d[24]^d[23]^d[21]^d[19]^d[15]^d[14]^d[10]^d[7]^d[6]^d[2]^c[2]^c[6]^c[7]^c[10]^c[14]^c[15]^c[19]^c[21]^c[23]^c[24]^c[26]^c[28]^c[31];
newcrc[19]=d[29]^d[27]^d[25]^d[24]^d[22]^d[20]^d[16]^d[15]^d[11]^d[8]^d[7]^d[3]^c[3]^c[7]^c[8]^c[11]^c[15]^c[16]^c[20]^c[22]^c[24]^c[25]^c[27]^c[29];
newcrc[20]=d[30]^d[28]^d[26]^d[25]^d[23]^d[21]^d[17]^d[16]^d[12]^d[9]^d[8]^d[4]^c[4]^c[8]^c[9]^c[12]^c[16]^c[17]^c[21]^c[23]^c[25]^c[26]^c[28]^c[30];
newcrc[21]=d[31]^d[29]^d[27]^d[26]^d[24]^d[22]^d[18]^d[17]^d[13]^d[10]^d[9]^d[5]^c[5]^c[9]^c[10]^c[13]^c[17]^c[18]^c[22]^c[24]^c[26]^c[27]^c[29]^c[31];
newcrc[22]=d[31]^d[29]^d[27]^d[26]^d[24]^d[23]^d[19]^d[18]^d[16]^d[14]^d[12]^d[11]^d[9]^d[0]^c[0]^c[9]^c[11]^c[12]^c[14]^c[16]^c[18]^c[19]^c[23]^c[24]^c[26]^c[27]^c[29]^c[31];
newcrc[23]=d[31]^d[29]^d[27]^d[26]^d[20]^d[19]^d[17]^d[16]^d[15]^d[13]^d[9]^d[6]^d[1]^d[0]^c[0]^c[1]^c[6]^c[9]^c[13]^c[15]^c[16]^c[17]^c[19]^c[20]^c[26]^c[27]^c[29]^c[31];
newcrc[24]=d[30]^d[28]^d[27]^d[21]^d[20]^d[18]^d[17]^d[16]^d[14]^d[10]^d[7]^d[2]^d[1]^c[1]^c[2]^c[7]^c[10]^c[14]^c[16]^c[17]^c[18]^c[20]^c[21]^c[27]^c[28]^c[30];
newcrc[25]=d[31]^d[29]^d[28]^d[22]^d[21]^d[19]^d[18]^d[17]^d[15]^d[11]^d[8]^d[3]^d[2]^c[2]^c[3]^c[8]^c[11]^c[15]^c[17]^c[18]^c[19]^c[21]^c[22]^c[28]^c[29]^c[31];
newcrc[26]=d[31]^d[28]^d[26]^d[25]^d[24]^d[23]^d[22]^d[20]^d[19]^d[18]^d[10]^d[6]^d[4]^d[3]^d[0]^c[0]^c[3]^c[4]^c[6]^c[10]^c[18]^c[19]^c[20]^c[22]^c[23]^c[24]^c[25]^c[26]^c[28]^c[31];
newcrc[27]=d[29]^d[27]^d[26]^d[25]^d[24]^d[23]^d[21]^d[20]^d[19]^d[11]^d[7]^d[5]^d[4]^d[1]^c[1]^c[4]^c[5]^c[7]^c[11]^c[19]^c[20]^c[21]^c[23]^c[24]^c[25]^c[26]^c[27]^c[29];
newcrc[28]=d[30]^d[28]^d[27]^d[26]^d[25]^d[24]^d[22]^d[21]^d[20]^d[12]^d[8]^d[6]^d[5]^d[2]^c[2]^c[5]^c[6]^c[8]^c[12]^c[20]^c[21]^c[22]^c[24]^c[25]^c[26]^c[27]^c[28]^c[30];
newcrc[29]=d[31]^d[29]^d[28]^d[27]^d[26]^d[25]^d[23]^d[22]^d[21]^d[13]^d[9]^d[7]^d[6]^d[3]^c[3]^c[6]^c[7]^c[9]^c[13]^c[21]^c[22]^c[23]^c[25]^c[26]^c[27]^c[28]^c[29]^c[31];
newcrc[30]=d[30]^d[29]^d[28]^d[27]^d[26]^d[24]^d[23]^d[22]^d[14]^d[10]^d[8]^d[7]^d[4]^c[4]^c[7]^c[8]^c[10]^c[14]^c[22]^c[23]^c[24]^c[26]^c[27]^c[28]^c[29]^c[30];
newcrc[31]=d[31]^d[30]^d[29]^d[28]^d[27]^d[25]^d[24]^d[23]^d[15]^d[11]^d[9]^d[8]^d[5]^c[5]^c[8]^c[9]^c[11]^c[15]^c[23]^c[24]^c[25]^c[27]^c[28]^c[29]^c[30]^c[31];
in performing the first 4Byte _ CRC32 calculation, the module obtains the 4Byte data from the data input, obtains the original CRC check code from the CRC check code register, and then obtains the new CRC32 check code based on the calculation of the expression. The new check code obtained by the calculation is stored in the CRC check code register, and the new check code is calculated as the initial CRC check code of the calculation when the next calculation of the 4Byte _ CRC32 is performed. And circulating in sequence, when the value of the Byte number is less than 4, the 4Byte _ CRC32 is switched to the 1Byte _ CRC32, and the CRC check code result calculated by the last 4Byte _ CRC32 is calculated as the initial CRC check code calculated by the 1Byte _ CRC 32.
The workflow for the 1Byte _ CRC32 sub-module is introduced as follows:
when the 1Byte _ CRC32 submodule calculates, because the data obtained from the data input is unequal 1Byte to 3Byte, the data is transferred to a FIFO register and the data in the FIFO is sequentially executed according to the value of the Byte count signal. And circularly performing data of corresponding Byte number, and updating the calculated result into a CRC (Cyclic redundancy check) code register. And after the calculation is executed, the final output CRC value is the final CRC check code of the data block.
The calculation expression of 1Byte _ CRC32 is as follows, where newcrc [ ] is the corresponding data bit of the check code value for each CRC calculation, d [ ] is the input data when the current beat of data calculation is performed, and c [ ] is the corresponding data bit of the CRC check value calculated for the previous beat of data:
newcrc[0]=d[6]^d[0]^c[24]^c[30];
newcrc[1]=d[7]^d[6]^d[1]^d[0]^c[24]^c[25]^c[30]^c[31];
newcrc[2]=d[7]^d[6]^d[2]^d[1]^d[0]^c[24]^c[25]^c[26]^c[30]^c[31];
newcrc[3]=d[7]^d[3]^d[2]^d[1]^c[25]^c[26]^c[27]^c[31];
newcrc[4]=d[6]^d[4]^d[3]^d[2]^d[0]^c[24]^c[26]^c[27]^c[28]^c[30];
newcrc[5]=d[7]^d[6]^d[5]^d[4]^d[3]^d[1]^d[0]^c[24]^c[25]^c[27]^c[28]^c[29]^c[30]^c[31];
newcrc[6]=d[7]^d[6]^d[5]^d[4]^d[2]^d[1]^c[25]^c[26]^c[28]^c[29]^c[30]^c[31];
newcrc[7]=d[7]^d[5]^d[3]^d[2]^d[0]^c[24]^c[26]^c[27]^c[29]^c[31];
newcrc[8]=d[4]^d[3]^d[1]^d[0]^c[0]^c[24]^c[25]^c[27]^c[28];
newcrc[9]=d[5]^d[4]^d[2]^d[1]^c[1]^c[25]^c[26]^c[28]^c[29];
newcrc[10]=d[5]^d[3]^d[2]^d[0]^c[2]^c[24]^c[26]^c[27]^c[29];
newcrc[11]=d[4]^d[3]^d[1]^d[0]^c[3]^c[24]^c[25]^c[27]^c[28];
newcrc[12]=d[6]^d[5]^d[4]^d[2]^d[1]^d[0]^c[4]^c[24]^c[25]^c[26]^c[28]^c[29]^c[30];
newcrc[13]=d[7]^d[6]^d[5]^d[3]^d[2]^d[1]^c[5]^c[25]^c[26]^c[27]^c[29]^c[30]^c[31];
newcrc[14]=d[7]^d[6]^d[4]^d[3]^d[2]^c[6]^c[26]^c[27]^c[28]^c[30]^c[31];
newcrc[15]=d[7]^d[5]^d[4]^d[3]^c[7]^c[27]^c[28]^c[29]^c[31];
newcrc[16]=d[5]^d[4]^d[0]^c[8]^c[24]^c[28]^c[29];
newcrc[17]=d[6]^d[5]^d[1]^c[9]^c[25]^c[29]^c[30];
newcrc[18]=d[7]^d[6]^d[2]^c[10]^c[26]^c[30]^c[31];
newcrc[19]=d[7]^d[3]^c[11]^c[27]^c[31];
newcrc[20]=d[4]^c[12]^c[28];
newcrc[21]=d[5]^c[13]^c[29];
newcrc[22]=d[0]^c[14]^c[24];
newcrc[23]=d[6]^d[1]^d[0]^c[15]^c[24]^c[25]^c[30];
newcrc[24]=d[7]^d[2]^d[1]^c[16]^c[25]^c[26]^c[31];
newcrc[25]=d[3]^d[2]^c[17]^c[26]^c[27];
newcrc[26]=d[6]^d[4]^d[3]^d[0]^c[18]^c[24]^c[27]^c[28]^c[30];
newcrc[27]=d[7]^d[5]^d[4]^d[1]^c[19]^c[25]^c[28]^c[29]^c[31];
newcrc[28]=d[6]^d[5]^d[2]^c[20]^c[26]^c[29]^c[30];
newcrc[29]=d[7]^d[6]^d[3]^c[21]^c[27]^c[30]^c[31];
newcrc[30]=d[7]^d[4]^c[22]^c[28]^c[31];
newcrc[31]=d[5]^c[23]^c[29];
taking the 8Byte calculation mode as an example, when 1Byte to 4 mbbyte data block processing is performed, the data processed each time is 8Byte data or less than 8 Byte. At this time, the specific selected calculation submodule is determined according to the number of bytes.
The workflow for the 8Byte _ CRC32 sub-module may be as follows:
first, the design of the 8Byte _ CRC32 sub-module is obtained according to the calculation formula of CRC 32. There is an explicit expression for each bit check code value of CRC32, the contents of which are related to the input data and the initial check code value of CRC 32.
The calculation expression of 8Byte _ CRC32 is as follows, where newcrc [ ] is the corresponding data bit of the check code value for each CRC calculation, d [ ] is the input data when the current beat of data calculation is performed, and c [ ] is the corresponding data bit of the CRC check value calculated for the previous beat of data:
newcrc[0]=d[63]^d[61]^d[60]^d[58]^d[55]^d[54]^d[53]^d[50]^d[48]^d[47]^d[45]^d[44]^d[37]^d[34]^d[32]^d[31]^d[30]^d[29]^d[28]^d[26]^d[25]^d[24]^d[16]^d[12]^d[10]^d[9]^d[6]^d[0]^c[0]^c[2]^c[5]^c[12]^c[13]^c[15]^c[16]^c[18]^c[21]^c[22]^c[23]^c[26]^c[28]^c[29]^c[31];
newcrc[1]=d[63]^d[62]^d[60]^d[59]^d[58]^d[56]^d[53]^d[51]^d[50]^d[49]^d[47]^d[46]^d[44]^d[38]^d[37]^d[35]^d[34]^d[33]^d[28]^d[27]^d[24]^d[17]^d[16]^d[13]^d[12]^d[11]^d[9]^d[7]^d[6]^d[1]^d[0]^c[1]^c[2]^c[3]^c[5]^c[6]^c[12]^c[14]^c[15]^c[17]^c[18]^c[19]^c[21]^c[24]^c[26]^c[27]^c[28]^c[30]^c[31];
newcrc[2]=d[59]^d[58]^d[57]^d[55]^d[53]^d[52]^d[51]^d[44]^d[39]^d[38]^d[37]^d[36]^d[35]^d[32]^d[31]^d[30]^d[26]^d[24]^d[18]^d[17]^d[16]^d[14]^d[13]^d[9]^d[8]^d[7]^d[6]^d[2]^d[1]^d[0]^c[0]^c[3]^c[4]^c[5]^c[6]^c[7]^c[12]^c[19]^c[20]^c[21]^c[23]^c[25]^c[26]^c[27];
newcrc[3]=d[60]^d[59]^d[58]^d[56]^d[54]^d[53]^d[52]^d[45]^d[40]^d[39]^d[38]^d[37]^d[36]^d[33]^d[32]^d[31]^d[27]^d[25]^d[19]^d[18]^d[17]^d[15]^d[14]^d[10]^d[9]^d[8]^d[7]^d[3]^d[2]^d[1]^c[0]^c[1]^c[4]^c[5]^c[6]^c[7]^c[8]^c[13]^c[20]^c[21]^c[22]^c[24]^c[26]^c[27]^c[28];
newcrc[4]=d[63]^d[59]^d[58]^d[57]^d[50]^d[48]^d[47]^d[46]^d[45]^d[44]^d[41]^d[40]^d[39]^d[38]^d[33]^d[31]^d[30]^d[29]^d[25]^d[24]^d[20]^d[19]^d[18]^d[15]^d[12]^d[11]^d[8]^d[6]^d[4]^d[3]^d[2]^d[0]^c[1]^c[6]^c[7]^c[8]^c[9]^c[12]^c[13]^c[14]^c[15]^c[16]^c[18]^c[25]^c[26]^c[27]^c[31];
newcrc[5]=d[63]^d[61]^d[59]^d[55]^d[54]^d[53]^d[51]^d[50]^d[49]^d[46]^d[44]^d[42]^d[41]^d[40]^d[39]^d[37]^d[29]^d[28]^d[24]^d[21]^d[20]^d[19]^d[13]^d[10]^d[7]^d[6]^d[5]^d[4]^d[3]^d[1]^d[0]^c[5]^c[7]^c[8]^c[9]^c[10]^c[12]^c[14]^c[17]^c[18]^c[19]^c[21]^c[22]^c[23]^c[27]^c[29]^c[31];
newcrc[6]=d[62]^d[60]^d[56]^d[55]^d[54]^d[52]^d[51]^d[50]^d[47]^d[45]^d[43]^d[42]^d[41]^d[40]^d[38]^d[30]^d[29]^d[25]^d[22]^d[21]^d[20]^d[14]^d[11]^d[8]^d[7]^d[6]^d[5]^d[4]^d[2]^d[1]^c[6]^c[8]^c[9]^c[10]^c[11]^c[13]^c[15]^c[18]^c[19]^c[20]^c[22]^c[23]^c[24]^c[28]^c[30];
newcrc[7]=d[60]^d[58]^d[57]^d[56]^d[54]^d[52]^d[51]^d[50]^d[47]^d[46]^d[45]^d[43]^d[42]^d[41]^d[39]^d[37]^d[34]^d[32]^d[29]^d[28]^d[25]^d[24]^d[23]^d[22]^d[21]^d[16]^d[15]^d[10]^d[8]^d[7]^d[5]^d[3]^d[2]^d[0]^c[0]^c[2]^c[5]^c[7]^c[9]^c[10]^c[11]^c[13]^c[14]^c[15]^c[18]^c[19]^c[20]^c[22]^c[24]^c[25]^c[26]^c[28];
newcrc[8]=d[63]^d[60]^d[59]^d[57]^d[54]^d[52]^d[51]^d[50]^d[46]^d[45]^d[43]^d[42]^d[40]^d[38]^d[37]^d[35]^d[34]^d[33]^d[32]^d[31]^d[28]^d[23]^d[22]^d[17]^d[12]^d[11]^d[10]^d[8]^d[4]^d[3]^d[1]^d[0]^c[0]^c[1]^c[2]^c[3]^c[5]^c[6]^c[8]^c[10]^c[11]^c[13]^c[14]^c[18]^c[19]^c[20]^c[22]^c[25]^c[27]^c[28]^c[31];
newcrc[9]=d[61]^d[60]^d[58]^d[55]^d[53]^d[52]^d[51]^d[47]^d[46]^d[44]^d[43]^d[41]^d[39]^d[38]^d[36]^d[35]^d[34]^d[33]^d[32]^d[29]^d[24]^d[23]^d[18]^d[13]^d[12]^d[11]^d[9]^d[5]^d[4]^d[2]^d[1]^c[0]^c[1]^c[2]^c[3]^c[4]^c[6]^c[7]^c[9]^c[11]^c[12]^c[14]^c[15]^c[19]^c[20]^c[21]^c[23]^c[26]^c[28]^c[29];
newcrc[10]=d[63]^d[62]^d[60]^d[59]^d[58]^d[56]^d[55]^d[52]^d[50]^d[42]^d[40]^d[39]^d[36]^d[35]^d[33]^d[32]^d[31]^d[29]^d[28]^d[26]^d[19]^d[16]^d[14]^d[13]^d[9]^d[5]^d[3]^d[2]^d[0]^c[0]^c[1]^c[3]^c[4]^c[7]^c[8]^c[10]^c[18]^c[20]^c[23]^c[24]^c[26]^c[27]^c[28]^c[30]^c[31];
newcrc[11]=d[59]^d[58]^d[57]^d[56]^d[55]^d[54]^d[51]^d[50]^d[48]^d[47]^d[45]^d[44]^d[43]^d[41]^d[40]^d[36]^d[33]^d[31]^d[28]^d[27]^d[26]^d[25]^d[24]^d[20]^d[17]^d[16]^d[15]^d[14]^d[12]^d[9]^d[4]^d[3]^d[1]^d[0]^c[1]^c[4]^c[8]^c[9]^c[11]^c[12]^c[13]^c[15]^c[16]^c[18]^c[19]^c[22]^c[23]^c[24]^c[25]^c[26]^c[27];
newcrc[12]=d[63]^d[61]^d[59]^d[57]^d[56]^d[54]^d[53]^d[52]^d[51]^d[50]^d[49]^d[47]^d[46]^d[42]^d[41]^d[31]^d[30]^d[27]^d[24]^d[21]^d[18]^d[17]^d[15]^d[13]^d[12]^d[9]^d[6]^d[5]^d[4]^d[2]^d[1]^d[0]^c[9]^c[10]^c[14]^c[15]^c[17]^c[18]^c[19]^c[20]^c[21]^c[22]^c[24]^c[25]^c[27]^c[29]^c[31];
newcrc[13]=d[62]^d[60]^d[58]^d[57]^d[55]^d[54]^d[53]^d[52]^d[51]^d[50]^d[48]^d[47]^d[43]^d[42]^d[32]^d[31]^d[28]^d[25]^d[22]^d[19]^d[18]^d[16]^d[14]^d[13]^d[10]^d[7]^d[6]^d[5]^d[3]^d[2]^d[1]^c[0]^c[10]^c[11]^c[15]^c[16]^c[18]^c[19]^c[20]^c[21]^c[22]^c[23]^c[25]^c[26]^c[28]^c[30];
newcrc[14]=d[63]^d[61]^d[59]^d[58]^d[56]^d[55]^d[54]^d[53]^d[52]^d[51]^d[49]^d[48]^d[44]^d[43]^d[33]^d[32]^d[29]^d[26]^d[23]^d[20]^d[19]^d[17]^d[15]^d[14]^d[11]^d[8]^d[7]^d[6]^d[4]^d[3]^d[2]^c[0]^c[1]^c[11]^c[12]^c[16]^c[17]^c[19]^c[20]^c[21]^c[22]^c[23]^c[24]^c[26]^c[27]^c[29]^c[31];
newcrc[15]=d[62]^d[60]^d[59]^d[57]^d[56]^d[55]^d[54]^d[53]^d[52]^d[50]^d[49]^d[45]^d[44]^d[34]^d[33]^d[30]^d[27]^d[24]^d[21]^d[20]^d[18]^d[16]^d[15]^d[12]^d[9]^d[8]^d[7]^d[5]^d[4]^d[3]^c[1]^c[2]^c[12]^c[13]^c[17]^c[18]^c[20]^c[21]^c[22]^c[23]^c[24]^c[25]^c[27]^c[28]^c[30];
newcrc[16]=d[57]^d[56]^d[51]^d[48]^d[47]^d[46]^d[44]^d[37]^d[35]^d[32]^d[30]^d[29]^d[26]^d[24]^d[22]^d[21]^d[19]^d[17]^d[13]^d[12]^d[8]^d[5]^d[4]^d[0]^c[0]^c[3]^c[5]^c[12]^c[14]^c[15]^c[16]^c[19]^c[24]^c[25];
newcrc[17]=d[58]^d[57]^d[52]^d[49]^d[48]^d[47]^d[45]^d[38]^d[36]^d[33]^d[31]^d[30]^d[27]^d[25]^d[23]^d[22]^d[20]^d[18]^d[14]^d[13]^d[9]^d[6]^d[5]^d[1]^c[1]^c[4]^c[6]^c[13]^c[15]^c[16]^c[17]^c[20]^c[25]^c[26];
newcrc[18]=d[59]^d[58]^d[53]^d[50]^d[49]^d[48]^d[46]^d[39]^d[37]^d[34]^d[32]^d[31]^d[28]^d[26]^d[24]^d[23]^d[21]^d[19]^d[15]^d[14]^d[10]^d[7]^d[6]^d[2]^c[0]^c[2]^c[5]^c[7]^c[14]^c[16]^c[17]^c[18]^c[21]^c[26]^c[27];
newcrc[19]=d[60]^d[59]^d[54]^d[51]^d[50]^d[49]^d[47]^d[40]^d[38]^d[35]^d[33]^d[32]^d[29]^d[27]^d[25]^d[24]^d[22]^d[20]^d[16]^d[15]^d[11]^d[8]^d[7]^d[3]^c[0]^c[1]^c[3]^c[6]^c[8]^c[15]^c[17]^c[18]^c[19]^c[22]^c[27]^c[28];
newcrc[20]=d[61]^d[60]^d[55]^d[52]^d[51]^d[50]^d[48]^d[41]^d[39]^d[36]^d[34]^d[33]^d[30]^d[28]^d[26]^d[25]^d[23]^d[21]^d[17]^d[16]^d[12]^d[9]^d[8]^d[4]^c[1]^c[2]^c[4]^c[7]^c[9]^c[16]^c[18]^c[19]^c[20]^c[23]^c[28]^c[29];
newcrc[21]=d[62]^d[61]^d[56]^d[53]^d[52]^d[51]^d[49]^d[42]^d[40]^d[37]^d[35]^d[34]^d[31]^d[29]^d[27]^d[26]^d[24]^d[22]^d[18]^d[17]^d[13]^d[10]^d[9]^d[5]^c[2]^c[3]^c[5]^c[8]^c[10]^c[17]^c[19]^c[20]^c[21]^c[24]^c[29]^c[30];
newcrc[22]=d[62]^d[61]^d[60]^d[58]^d[57]^d[55]^d[52]^d[48]^d[47]^d[45]^d[44]^d[43]^d[41]^d[38]^d[37]^d[36]^d[35]^d[34]^d[31]^d[29]^d[27]^d[26]^d[24]^d[23]^d[19]^d[18]^d[16]^d[14]^d[12]^d[11]^d[9]^d[0]^c[2]^c[3]^c[4]^c[5]^c[6]^c[9]^c[11]^c[12]^c[13]^c[15]^c[16]^c[20]^c[23]^c[25]^c[26]^c[28]^c[29]^c[30];
newcrc[23]=d[62]^d[60]^d[59]^d[56]^d[55]^d[54]^d[50]^d[49]^d[47]^d[46]^d[42]^d[39]^d[38]^d[36]^d[35]^d[34]^d[31]^d[29]^d[27]^d[26]^d[20]^d[19]^d[17]^d[16]^d[15]^d[13]^d[9]^d[6]^d[1]^d[0]^c[2]^c[3]^c[4]^c[6]^c[7]^c[10]^c[14]^c[15]^c[17]^c[18]^c[22]^c[23]^c[24]^c[27]^c[28]^c[30];
newcrc[24]=d[63]^d[61]^d[60]^d[57]^d[56]^d[55]^d[51]^d[50]^d[48]^d[47]^d[43]^d[40]^d[39]^d[37]^d[36]^d[35]^d[32]^d[30]^d[28]^d[27]^d[21]^d[20]^d[18]^d[17]^d[16]^d[14]^d[10]^d[7]^d[2]^d[1]^c[0]^c[3]^c[4]^c[5]^c[7]^c[8]^c[11]^c[15]^c[16]^c[18]^c[19]^c[23]^c[24]^c[25]^c[28]^c[29]^c[31];
newcrc[25]=d[62]^d[61]^d[58]^d[57]^d[56]^d[52]^d[51]^d[49]^d[48]^d[44]^d[41]^d[40]^d[38]^d[37]^d[36]^d[33]^d[31]^d[29]^d[28]^d[22]^d[21]^d[19]^d[18]^d[17]^d[15]^d[11]^d[8]^d[3]^d[2]^c[1]^c[4]^c[5]^c[6]^c[8]^c[9]^c[12]^c[16]^c[17]^c[19]^c[20]^c[24]^c[25]^c[26]^c[29]^c[30];
newcrc[26]=d[62]^d[61]^d[60]^d[59]^d[57]^d[55]^d[54]^d[52]^d[49]^d[48]^d[47]^d[44]^d[42]^d[41]^d[39]^d[38]^d[31]^d[28]^d[26]^d[25]^d[24]^d[23]^d[22]^d[20]^d[19]^d[18]^d[10]^d[6]^d[4]^d[3]^d[0]^c[6]^c[7]^c[9]^c[10]^c[12]^c[15]^c[16]^c[17]^c[20]^c[22]^c[23]^c[25]^c[27]^c[28]^c[29]^c[30];
newcrc[27]=d[63]^d[62]^d[61]^d[60]^d[58]^d[56]^d[55]^d[53]^d[50]^d[49]^d[48]^d[45]^d[43]^d[42]^d[40]^d[39]^d[32]^d[29]^d[27]^d[26]^d[25]^d[24]^d[23]^d[21]^d[20]^d[19]^d[11]^d[7]^d[5]^d[4]^d[1]^c[0]^c[7]^c[8]^c[10]^c[11]^c[13]^c[16]^c[17]^c[18]^c[21]^c[23]^c[24]^c[26]^c[28]^c[29]^c[30]^c[31];
newcrc[28]=d[63]^d[62]^d[61]^d[59]^d[57]^d[56]^d[54]^d[51]^d[50]^d[49]^d[46]^d[44]^d[43]^d[41]^d[40]^d[33]^d[30]^d[28]^d[27]^d[26]^d[25]^d[24]^d[22]^d[21]^d[20]^d[12]^d[8]^d[6]^d[5]^d[2]^c[1]^c[8]^c[9]^c[11]^c[12]^c[14]^c[17]^c[18]^c[19]^c[22]^c[24]^c[25]^c[27]^c[29]^c[30]^c[31];
newcrc[29]=d[63]^d[62]^d[60]^d[58]^d[57]^d[55]^d[52]^d[51]^d[50]^d[47]^d[45]^d[44]^d[42]^d[41]^d[34]^d[31]^d[29]^d[28]^d[27]^d[26]^d[25]^d[23]^d[22]^d[21]^d[13]^d[9]^d[7]^d[6]^d[3]^c[2]^c[9]^c[10]^c[12]^c[13]^c[15]^c[18]^c[19]^c[20]^c[23]^c[25]^c[26]^c[28]^c[30]^c[31];
newcrc[30]=d[63]^d[61]^d[59]^d[58]^d[56]^d[53]^d[52]^d[51]^d[48]^d[46]^d[45]^d[43]^d[42]^d[35]^d[32]^d[30]^d[29]^d[28]^d[27]^d[26]^d[24]^d[23]^d[22]^d[14]^d[10]^d[8]^d[7]^d[4]^c[0]^c[3]^c[10]^c[11]^c[13]^c[14]^c[16]^c[19]^c[20]^c[21]^c[24]^c[26]^c[27]^c[29]^c[31];
newcrc[31]=d[62]^d[60]^d[59]^d[57]^d[54]^d[53]^d[52]^d[49]^d[47]^d[46]^d[44]^d[43]^d[36]^d[33]^d[31]^d[30]^d[29]^d[28]^d[27]^d[25]^d[24]^d[23]^d[15]^d[11]^d[9]^d[8]^d[5]^c[1]^c[4]^c[11]^c[12]^c[14]^c[15]^c[17]^c[20]^c[21]^c[22]^c[25]^c[27]^c[28]^c[30];
in the first 8Byte _ CRC32 calculation, the module obtains the 8Byte data from the data input, obtains the original CRC check code from the CRC check code register, and then obtains the new CRC32 check code based on the calculation of the expression. The new check code obtained by calculation is stored in the CRC check code register, and when the next calculation of 8Byte _ CRC32 is performed, the new check code is calculated as the initial CRC check code of the current calculation. And circulating in sequence, when the value of the Byte number is less than 8, the 8Byte _ CRC32 is switched to 1Byte _ CRC32, and the CRC check code result calculated by the last 8Byte _ CRC32 is calculated as the initial CRC check code calculated by 1Byte _ CRC 32.
The workflow for the 1Byte _ CRC32 sub-module may be as follows:
when the 1Byte _ CRC32 submodule calculates, because the data obtained from the data input is data with unequal 1Byte to 7Byte, the data is transferred to a FIFO register, and the data in the FIFO register is sequentially executed according to the Byte number value. And circularly performing data of corresponding Byte number, and updating the calculated result into a CRC (Cyclic redundancy check) code register. And after the calculation is executed, the final output CRC value is the final CRC check code of the data block.
Taking the 16Byte calculation mode as an example, the 16Byte calculation module is the working mode of the design when performing 16Byte data processing. And is the default mode of operation for the present design.
When 1Byte to 4 mbbyte data block processing is performed, the data processed each time is 16Byte data, or less than 16 Byte. At this time, the specific selected calculation submodule is determined according to the number of bytes.
The workflow for the 16Byte _ CRC32 sub-module may be as follows:
the design of the 16Byte _ CRC32 sub-module is obtained according to the calculation formula of CRC 32. There is an explicit expression for each bit check code value of CRC32, the contents of which are related to the input data and the initial check code value of CRC 32.
The calculation expression of 16Byte _ CRC32 is as follows, where newcrc [ ] is the corresponding data bit of the check code value for each CRC calculation, d [ ] is the input data when the current beat of data calculation is performed, and c [ ] is the corresponding data bit of the CRC check value calculated for the previous beat of data:
newcrc[0]=d[127]^d[126]^d[125]^d[123]^d[119]^d[118]^d[117]^d[116]^d[114]^d[113]^d[111]^d[110]^d[106]^d[104]^d[103]^d[101]^d[99]^d[98]^d[97]^d[96]^d[95]^d[94]^d[87]^d[85]^d[84]^d[83]^d[82]^d[81]^d[79]^d[73]^d[72]^d[68]^d[67]^d[66]^d[65]^d[63]^d[61]^d[60]^d[58]^d[55]^d[54]^d[53]^d[50]^d[48]^d[47]^d[45]^d[44]^d[37]^d[34]^d[32]^d[31]^d[30]^d[29]^d[28]^d[26]^d[25]^d[24]^d[16]^d[12]^d[10]^d[9]^d[6]^d[0]^c[0]^c[1]^c[2]^c[3]^c[5]^c[7]^c[8]^c[10]^c[14]^c[15]^c[17]^c[18]^c[20]^c[21]^c[22]^c[23]^c[27]^c[29]^c[30]^c[31];
newcrc[1]=d[125]^d[124]^d[123]^d[120]^d[116]^d[115]^d[113]^d[112]^d[110]^d[107]^d[106]^d[105]^d[103]^d[102]^d[101]^d[100]^d[94]^d[88]^d[87]^d[86]^d[81]^d[80]^d[79]^d[74]^d[72]^d[69]^d[65]^d[64]^d[63]^d[62]^d[60]^d[59]^d[58]^d[56]^d[53]^d[51]^d[50]^d[49]^d[47]^d[46]^d[44]^d[38]^d[37]^d[35]^d[34]^d[33]^d[28]^d[27]^d[24]^d[17]^d[16]^d[13]^d[12]^d[11]^d[9]^d[7]^d[6]^d[1]^d[0]^c[4]^c[5]^c[6]^c[7]^c[9]^c[10]^c[11]^c[14]^c[16]^c[17]^c[19]^c[20]^c[24]^c[27]^c[28]^c[29];
newcrc[2]=d[127]^d[124]^d[123]^d[121]^d[119]^d[118]^d[110]^d[108]^d[107]^d[102]^d[99]^d[98]^d[97]^d[96]^d[94]^d[89]^d[88]^d[85]^d[84]^d[83]^d[80]^d[79]^d[75]^d[72]^d[70]^d[68]^d[67]^d[64]^d[59]^d[58]^d[57]^d[55]^d[53]^d[52]^d[51]^d[44]^d[39]^d[38]^d[37]^d[36]^d[35]^d[32]^d[31]^d[30]^d[26]^d[24]^d[18]^d[17]^d[16]^d[14]^d[13]^d[9]^d[8]^d[7]^d[6]^d[2]^d[1]^d[0]^c[0]^c[1]^c[2]^c[3]^c[6]^c[11]^c[12]^c[14]^c[22]^c[23]^c[25]^c[27]^c[28]^c[31];
newcrc[3]=d[125]^d[124]^d[122]^d[120]^d[119]^d[111]^d[109]^d[108]^d[103]^d[100]^d[99]^d[98]^d[97]^d[95]^d[90]^d[89]^d[86]^d[85]^d[84]^d[81]^d[80]^d[76]^d[73]^d[71]^d[69]^d[68]^d[65]^d[60]^d[59]^d[58]^d[56]^d[54]^d[53]^d[52]^d[45]^d[40]^d[39]^d[38]^d[37]^d[36]^d[33]^d[32]^d[31]^d[27]^d[25]^d[19]^d[18]^d[17]^d[15]^d[14]^d[10]^d[9]^d[8]^d[7]^d[3]^d[2]^d[1]^c[1]^c[2]^c[3]^c[4]^c[7]^c[12]^c[13]^c[15]^c[23]^c[24]^c[26]^c[28]^c[29];
newcrc[4]=d[127]^d[121]^d[120]^d[119]^d[118]^d[117]^d[116]^d[114]^d[113]^d[112]^d[111]^d[109]^d[106]^d[103]^d[100]^d[97]^d[95]^d[94]^d[91]^d[90]^d[86]^d[84]^d[83]^d[79]^d[77]^d[74]^d[73]^d[70]^d[69]^d[68]^d[67]^d[65]^d[63]^d[59]^d[58]^d[57]^d[50]^d[48]^d[47]^d[46]^d[45]^d[44]^d[41]^d[40]^d[39]^d[38]^d[33]^d[31]^d[30]^d[29]^d[25]^d[24]^d[20]^d[19]^d[18]^d[15]^d[12]^d[11]^d[8]^d[6]^d[4]^d[3]^d[2]^d[0]^c[1]^c[4]^c[7]^c[10]^c[13]^c[15]^c[16]^c[17]^c[18]^c[20]^c[21]^c[22]^c[23]^c[24]^c[25]^c[31];
newcrc[5]=d[127]^d[126]^d[125]^d[123]^d[122]^d[121]^d[120]^d[116]^d[115]^d[112]^d[111]^d[107]^d[106]^d[103]^d[99]^d[97]^d[94]^d[92]^d[91]^d[83]^d[82]^d[81]^d[80]^d[79]^d[78]^d[75]^d[74]^d[73]^d[72]^d[71]^d[70]^d[69]^d[67]^d[65]^d[64]^d[63]^d[61]^d[59]^d[55]^d[54]^d[53]^d[51]^d[50]^d[49]^d[46]^d[44]^d[42]^d[41]^d[40]^d[39]^d[37]^d[29]^d[28]^d[24]^d[21]^d[20]^d[19]^d[13]^d[10]^d[7]^d[6]^d[5]^d[4]^d[3]^d[1]^d[0]^c[1]^c[3]^c[7]^c[10]^c[11]^c[15]^c[16]^c[19]^c[20]^c[24]^c[25]^c[26]^c[27]^c[29]^c[30]^c[31];
newcrc[6]=d[127]^d[126]^d[124]^d[123]^d[122]^d[121]^d[117]^d[116]^d[113]^d[112]^d[108]^d[107]^d[104]^d[100]^d[98]^d[95]^d[93]^d[92]^d[84]^d[83]^d[82]^d[81]^d[80]^d[79]^d[76]^d[75]^d[74]^d[73]^d[72]^d[71]^d[70]^d[68]^d[66]^d[65]^d[64]^d[62]^d[60]^d[56]^d[55]^d[54]^d[52]^d[51]^d[50]^d[47]^d[45]^d[43]^d[42]^d[41]^d[40]^d[38]^d[30]^d[29]^d[25]^d[22]^d[21]^d[20]^d[14]^d[11]^d[8]^d[7]^d[6]^d[5]^d[4]^d[2]^d[1]^c[2]^c[4]^c[8]^c[11]^c[12]^c[16]^c[17]^c[20]^c[21]^c[25]^c[26]^c[27]^c[28]^c[30]^c[31];
newcrc[7]=d[126]^d[124]^d[122]^d[119]^d[116]^d[111]^d[110]^d[109]^d[108]^d[106]^d[105]^d[104]^d[103]^d[98]^d[97]^d[95]^d[93]^d[87]^d[80]^d[79]^d[77]^d[76]^d[75]^d[74]^d[71]^d[69]^d[68]^d[60]^d[58]^d[57]^d[56]^d[54]^d[52]^d[51]^d[50]^d[47]^d[46]^d[45]^d[43]^d[42]^d[41]^d[39]^d[37]^d[34]^d[32]^d[29]^d[28]^d[25]^d[24]^d[23]^d[22]^d[21]^d[16]^d[15]^d[10]^d[8]^d[7]^d[5]^d[3]^d[2]^d[0]^c[1]^c[2]^c[7]^c[8]^c[9]^c[10]^c[12]^c[13]^c[14]^c[15]^c[20]^c[23]^c[26]^c[28]^c[30];
newcrc[8]=d[126]^d[120]^d[119]^d[118]^d[116]^d[114]^d[113]^d[112]^d[109]^d[107]^d[105]^d[103]^d[101]^d[97]^d[95]^d[88]^d[87]^d[85]^d[84]^d[83]^d[82]^d[80]^d[79]^d[78]^d[77]^d[76]^d[75]^d[73]^d[70]^d[69]^d[68]^d[67]^d[66]^d[65]^d[63]^d[60]^d[59]^d[57]^d[54]^d[52]^d[51]^d[50]^d[46]^d[45]^d[43]^d[42]^d[40]^d[38]^d[37]^d[35]^d[34]^d[33]^d[32]^d[31]^d[28]^d[23]^d[22]^d[17]^d[12]^d[11]^d[10]^d[8]^d[4]^d[3]^d[1]^d[0]^c[1]^c[5]^c[7]^c[9]^c[11]^c[13]^c[16]^c[17]^c[18]^c[20]^c[22]^c[23]^c[24]^c[30];
newcrc[9]=d[127]^d[121]^d[120]^d[119]^d[117]^d[115]^d[114]^d[113]^d[110]^d[108]^d[106]^d[104]^d[102]^d[98]^d[96]^d[89]^d[88]^d[86]^d[85]^d[84]^d[83]^d[81]^d[80]^d[79]^d[78]^d[77]^d[76]^d[74]^d[71]^d[70]^d[69]^d[68]^d[67]^d[66]^d[64]^d[61]^d[60]^d[58]^d[55]^d[53]^d[52]^d[51]^d[47]^d[46]^d[44]^d[43]^d[41]^d[39]^d[38]^d[36]^d[35]^d[34]^d[33]^d[32]^d[29]^d[24]^d[23]^d[18]^d[13]^d[12]^d[11]^d[9]^d[5]^d[4]^d[2]^d[1]^c[0]^c[2]^c[6]^c[8]^c[10]^c[12]^c[14]^c[17]^c[18]^c[19]^c[21]^c[23]^c[24]^c[25]^c[31];
newcrc[10]=d[127]^d[126]^d[125]^d[123]^d[122]^d[121]^d[120]^d[119]^d[117]^d[115]^d[113]^d[110]^d[109]^d[107]^d[106]^d[105]^d[104]^d[101]^d[98]^d[96]^d[95]^d[94]^d[90]^d[89]^d[86]^d[83]^d[80]^d[78]^d[77]^d[75]^d[73]^d[71]^d[70]^d[69]^d[66]^d[63]^d[62]^d[60]^d[59]^d[58]^d[56]^d[55]^d[52]^d[50]^d[42]^d[40]^d[39]^d[36]^d[35]^d[33]^d[32]^d[31]^d[29]^d[28]^d[26]^d[19]^d[16]^d[14]^d[13]^d[9]^d[5]^d[3]^d[2]^d[0]^c[0]^c[2]^c[5]^c[8]^c[9]^c[10]^c[11]^c[13]^c[14]^c[17]^c[19]^c[21]^c[23]^c[24]^c[25]^c[26]^c[27]^c[29]^c[30]^c[31];
newcrc[11]=d[125]^d[124]^d[122]^d[121]^d[120]^d[119]^d[117]^d[113]^d[108]^d[107]^d[105]^d[104]^d[103]^d[102]^d[101]^d[98]^d[94]^d[91]^d[90]^d[85]^d[83]^d[82]^d[78]^d[76]^d[74]^d[73]^d[71]^d[70]^d[68]^d[66]^d[65]^d[64]^d[59]^d[58]^d[57]^d[56]^d[55]^d[54]^d[51]^d[50]^d[48]^d[47]^d[45]^d[44]^d[43]^d[41]^d[40]^d[36]^d[33]^d[31]^d[28]^d[27]^d[26]^d[25]^d[24]^d[20]^d[17]^d[16]^d[15]^d[14]^d[12]^d[9]^d[4]^d[3]^d[1]^d[0]^c[2]^c[5]^c[6]^c[7]^c[8]^c[9]^c[11]^c[12]^c[17]^c[21]^c[23]^c[24]^c[25]^c[26]^c[28]^c[29];
newcrc[12]=d[127]^d[122]^d[121]^d[120]^d[119]^d[117]^d[116]^d[113]^d[111]^d[110]^d[109]^d[108]^d[105]^d[102]^d[101]^d[98]^d[97]^d[96]^d[94]^d[92]^d[91]^d[87]^d[86]^d[85]^d[82]^d[81]^d[77]^d[75]^d[74]^d[73]^d[71]^d[69]^d[68]^d[63]^d[61]^d[59]^d[57]^d[56]^d[54]^d[53]^d[52]^d[51]^d[50]^d[49]^d[47]^d[46]^d[42]^d[41]^d[31]^d[30]^d[27]^d[24]^d[21]^d[18]^d[17]^d[15]^d[13]^d[12]^d[9]^d[6]^d[5]^d[4]^d[2]^d[1]^d[0]^c[0]^c[1]^c[2]^c[5]^c[6]^c[9]^c[12]^c[13]^c[14]^c[15]^c[17]^c[20]^c[21]^c[23]^c[24]^c[25]^c[26]^c[31];
newcrc[13]=d[123]^d[122]^d[121]^d[120]^d[118]^d[117]^d[114]^d[112]^d[111]^d[110]^d[109]^d[106]^d[103]^d[102]^d[99]^d[98]^d[97]^d[95]^d[93]^d[92]^d[88]^d[87]^d[86]^d[83]^d[82]^d[78]^d[76]^d[75]^d[74]^d[72]^d[70]^d[69]^d[64]^d[62]^d[60]^d[58]^d[57]^d[55]^d[54]^d[53]^d[52]^d[51]^d[50]^d[48]^d[47]^d[43]^d[42]^d[32]^d[31]^d[28]^d[25]^d[22]^d[19]^d[18]^d[16]^d[14]^d[13]^d[10]^d[7]^d[6]^d[5]^d[3]^d[2]^d[1]^c[1]^c[2]^c[3]^c[6]^c[7]^c[10]^c[13]^c[14]^c[15]^c[16]^c[18]^c[21]^c[22]^c[24]^c[25]^c[26]^c[27];
newcrc[14]=d[124]^d[123]^d[122]^d[121]^d[119]^d[118]^d[115]^d[113]^d[112]^d[111]^d[110]^d[107]^d[104]^d[103]^d[100]^d[99]^d[98]^d[96]^d[94]^d[93]^d[89]^d[88]^d[87]^d[84]^d[83]^d[79]^d[77]^d[76]^d[75]^d[73]^d[71]^d[70]^d[65]^d[63]^d[61]^d[59]^d[58]^d[56]^d[55]^d[54]^d[53]^d[52]^d[51]^d[49]^d[48]^d[44]^d[43]^d[33]^d[32]^d[29]^d[26]^d[23]^d[20]^d[19]^d[17]^d[15]^d[14]^d[11]^d[8]^d[7]^d[6]^d[4]^d[3]^d[2]^c[0]^c[2]^c[3]^c[4]^c[7]^c[8]^c[11]^c[14]^c[15]^c[16]^c[17]^c[19]^c[22]^c[23]^c[25]^c[26]^c[27]^c[28];
newcrc[15]=d[125]^d[124]^d[123]^d[122]^d[120]^d[119]^d[116]^d[114]^d[113]^d[112]^d[111]^d[108]^d[105]^d[104]^d[101]^d[100]^d[99]^d[97]^d[95]^d[94]^d[90]^d[89]^d[88]^d[85]^d[84]^d[80]^d[78]^d[77]^d[76]^d[74]^d[72]^d[71]^d[66]^d[64]^d[62]^d[60]^d[59]^d[57]^d[56]^d[55]^d[54]^d[53]^d[52]^d[50]^d[49]^d[45]^d[44]^d[34]^d[33]^d[30]^d[27]^d[24]^d[21]^d[20]^d[18]^d[16]^d[15]^d[12]^d[9]^d[8]^d[7]^d[5]^d[4]^d[3]^c[1]^c[3]^c[4]^c[5]^c[8]^c[9]^c[12]^c[15]^c[16]^c[17]^c[18]^c[20]^c[23]^c[24]^c[26]^c[27]^c[28]^c[29];
newcrc[16]=d[127]^d[124]^d[121]^d[120]^d[119]^d[118]^d[116]^d[115]^d[112]^d[111]^d[110]^d[109]^d[105]^d[104]^d[103]^d[102]^d[100]^d[99]^d[97]^d[94]^d[91]^d[90]^d[89]^d[87]^d[86]^d[84]^d[83]^d[82]^d[78]^d[77]^d[75]^d[68]^d[66]^d[57]^d[56]^d[51]^d[48]^d[47]^d[46]^d[44]^d[37]^d[35]^d[32]^d[30]^d[29]^d[26]^d[24]^d[22]^d[21]^d[19]^d[17]^d[13]^d[12]^d[8]^d[5]^d[4]^d[0]^c[1]^c[3]^c[4]^c[6]^c[7]^c[8]^c[9]^c[13]^c[14]^c[15]^c[16]^c[19]^c[20]^c[22]^c[23]^c[24]^c[25]^c[28]^c[31];
newcrc[17]=d[125]^d[122]^d[121]^d[120]^d[119]^d[117]^d[116]^d[113]^d[112]^d[111]^d[110]^d[106]^d[105]^d[104]^d[103]^d[101]^d[100]^d[98]^d[95]^d[92]^d[91]^d[90]^d[88]^d[87]^d[85]^d[84]^d[83]^d[79]^d[78]^d[76]^d[69]^d[67]^d[58]^d[57]^d[52]^d[49]^d[48]^d[47]^d[45]^d[38]^d[36]^d[33]^d[31]^d[30]^d[27]^d[25]^d[23]^d[22]^d[20]^d[18]^d[14]^d[13]^d[9]^d[6]^d[5]^d[1]^c[2]^c[4]^c[5]^c[7]^c[8]^c[9]^c[10]^c[14]^c[15]^c[16]^c[17]^c[20]^c[21]^c[23]^c[24]^c[25]^c[26]^c[29];
newcrc[18]=d[126]^d[123]^d[122]^d[121]^d[120]^d[118]^d[117]^d[114]^d[113]^d[112]^d[111]^d[107]^d[106]^d[105]^d[104]^d[102]^d[101]^d[99]^d[96]^d[93]^d[92]^d[91]^d[89]^d[88]^d[86]^d[85]^d[84]^d[80]^d[79]^d[77]^d[70]^d[68]^d[59]^d[58]^d[53]^d[50]^d[49]^d[48]^d[46]^d[39]^d[37]^d[34]^d[32]^d[31]^d[28]^d[26]^d[24]^d[23]^d[21]^d[19]^d[15]^d[14]^d[10]^d[7]^d[6]^d[2]^c[0]^c[3]^c[5]^c[6]^c[8]^c[9]^c[10]^c[11]^c[15]^c[16]^c[17]^c[18]^c[21]^c[22]^c[24]^c[25]^c[26]^c[27]^c[30];
newcrc[19]=d[127]^d[124]^d[123]^d[122]^d[121]^d[119]^d[118]^d[115]^d[114]^d[113]^d[112]^d[108]^d[107]^d[106]^d[105]^d[103]^d[102]^d[100]^d[97]^d[94]^d[93]^d[92]^d[90]^d[89]^d[87]^d[86]^d[85]^d[81]^d[80]^d[78]^d[71]^d[69]^d[60]^d[59]^d[54]^d[51]^d[50]^d[49]^d[47]^d[40]^d[38]^d[35]^d[33]^d[32]^d[29]^d[27]^d[25]^d[24]^d[22]^d[20]^d[16]^d[15]^d[11]^d[8]^d[7]^d[3]^c[1]^c[4]^c[6]^c[7]^c[9]^c[10]^c[11]^c[12]^c[16]^c[17]^c[18]^c[19]^c[22]^c[23]^c[25]^c[26]^c[27]^c[28]^c[31];
newcrc[20]=d[125]^d[124]^d[123]^d[122]^d[120]^d[119]^d[116]^d[115]^d[114]^d[113]^d[109]^d[108]^d[107]^d[106]^d[104]^d[103]^d[101]^d[98]^d[95]^d[94]^d[93]^d[91]^d[90]^d[88]^d[87]^d[86]^d[82]^d[81]^d[79]^d[72]^d[70]^d[61]^d[60]^d[55]^d[52]^d[51]^d[50]^d[48]^d[41]^d[39]^d[36]^d[34]^d[33]^d[30]^d[28]^d[26]^d[25]^d[23]^d[21]^d[17]^d[16]^d[12]^d[9]^d[8]^d[4]^c[2]^c[5]^c[7]^c[8]^c[10]^c[11]^c[12]^c[13]^c[17]^c[18]^c[19]^c[20]^c[23]^c[24]^c[26]^c[27]^c[28]^c[29];
newcrc[21]=d[126]^d[125]^d[124]^d[123]^d[121]^d[120]^d[117]^d[116]^d[115]^d[114]^d[110]^d[109]^d[108]^d[107]^d[105]^d[104]^d[102]^d[99]^d[96]^d[95]^d[94]^d[92]^d[91]^d[89]^d[88]^d[87]^d[83]^d[82]^d[80]^d[73]^d[71]^d[62]^d[61]^d[56]^d[53]^d[52]^d[51]^d[49]^d[42]^d[40]^d[37]^d[35]^d[34]^d[31]^d[29]^d[27]^d[26]^d[24]^d[22]^d[18]^d[17]^d[13]^d[10]^d[9]^d[5]^c[0]^c[3]^c[6]^c[8]^c[9]^c[11]^c[12]^c[13]^c[14]^c[18]^c[19]^c[20]^c[21]^c[24]^c[25]^c[27]^c[28]^c[29]^c[30];
newcrc[22]=d[124]^d[123]^d[122]^d[121]^d[119]^d[115]^d[114]^d[113]^d[109]^d[108]^d[105]^d[104]^d[101]^d[100]^d[99]^d[98]^d[94]^d[93]^d[92]^d[90]^d[89]^d[88]^d[87]^d[85]^d[82]^d[79]^d[74]^d[73]^d[68]^d[67]^d[66]^d[65]^d[62]^d[61]^d[60]^d[58]^d[57]^d[55]^d[52]^d[48]^d[47]^d[45]^d[44]^d[43]^d[41]^d[38]^d[37]^d[36]^d[35]^d[34]^d[31]^d[29]^d[27]^d[26]^d[24]^d[23]^d[19]^d[18]^d[16]^d[14]^d[12]^d[11]^d[9]^d[0]^c[2]^c[3]^c[4]^c[5]^c[8]^c[9]^c[12]^c[13]^c[17]^c[18]^c[19]^c[23]^c[25]^c[26]^c[27]^c[28];
newcrc[23]=d[127]^d[126]^d[124]^d[122]^d[120]^d[119]^d[118]^d[117]^d[115]^d[113]^d[111]^d[109]^d[105]^d[104]^d[103]^d[102]^d[100]^d[98]^d[97]^d[96]^d[93]^d[91]^d[90]^d[89]^d[88]^d[87]^d[86]^d[85]^d[84]^d[82]^d[81]^d[80]^d[79]^d[75]^d[74]^d[73]^d[72]^d[69]^d[65]^d[62]^d[60]^d[59]^d[56]^d[55]^d[54]^d[50]^d[49]^d[47]^d[46]^d[42]^d[39]^d[38]^d[36]^d[35]^d[34]^d[31]^d[29]^d[27]^d[26]^d[20]^d[19]^d[17]^d[16]^d[15]^d[13]^d[9]^d[6]^d[1]^d[0]^c[0]^c[1]^c[2]^c[4]^c[6]^c[7]^c[8]^c[9]^c[13]^c[15]^c[17]^c[19]^c[21]^c[22]^c[23]^c[24]^c[26]^c[28]^c[30]^c[31];
newcrc[24]=d[127]^d[125]^d[123]^d[121]^d[120]^d[119]^d[118]^d[116]^d[114]^d[112]^d[110]^d[106]^d[105]^d[104]^d[103]^d[101]^d[99]^d[98]^d[97]^d[94]^d[92]^d[91]^d[90]^d[89]^d[88]^d[87]^d[86]^d[85]^d[83]^d[82]^d[81]^d[80]^d[76]^d[75]^d[74]^d[73]^d[70]^d[66]^d[63]^d[61]^d[60]^d[57]^d[56]^d[55]^d[51]^d[50]^d[48]^d[47]^d[43]^d[40]^d[39]^d[37]^d[36]^d[35]^d[32]^d[30]^d[28]^d[27]^d[21]^d[20]^d[18]^d[17]^d[16]^d[14]^d[10]^d[7]^d[2]^d[1]^c[1]^c[2]^c[3]^c[5]^c[7]^c[8]^c[9]^c[10]^c[14]^c[16]^c[18]^c[20]^c[22]^c[23]^c[24]^c[25]^c[27]^c[29]^c[31];
newcrc[25]=d[126]^d[124]^d[122]^d[121]^d[120]^d[119]^d[117]^d[115]^d[113]^d[111]^d[107]^d[106]^d[105]^d[104]^d[102]^d[100]^d[99]^d[98]^d[95]^d[93]^d[92]^d[91]^d[90]^d[89]^d[88]^d[87]^d[86]^d[84]^d[83]^d[82]^d[81]^d[77]^d[76]^d[75]^d[74]^d[71]^d[67]^d[64]^d[62]^d[61]^d[58]^d[57]^d[56]^d[52]^d[51]^d[49]^d[48]^d[44]^d[41]^d[40]^d[38]^d[37]^d[36]^d[33]^d[31]^d[29]^d[28]^d[22]^d[21]^d[19]^d[18]^d[17]^d[15]^d[11]^d[8]^d[3]^d[2]^c[2]^c[3]^c[4]^c[6]^c[8]^c[9]^c[10]^c[11]^c[15]^c[17]^c[19]^c[21]^c[23]^c[24]^c[25]^c[26]^c[28]^c[30];
newcrc[26]=d[126]^d[122]^d[121]^d[120]^d[119]^d[117]^d[113]^d[112]^d[111]^d[110]^d[108]^d[107]^d[105]^d[104]^d[100]^d[98]^d[97]^d[95]^d[93]^d[92]^d[91]^d[90]^d[89]^d[88]^d[81]^d[79]^d[78]^d[77]^d[76]^d[75]^d[73]^d[67]^d[66]^d[62]^d[61]^d[60]^d[59]^d[57]^d[55]^d[54]^d[52]^d[49]^d[48]^d[47]^d[44]^d[42]^d[41]^d[39]^d[38]^d[31]^d[28]^d[26]^d[25]^d[24]^d[23]^d[22]^d[20]^d[19]^d[18]^d[10]^d[6]^d[4]^d[3]^d[0]^c[1]^c[2]^c[4]^c[8]^c[9]^c[11]^c[12]^c[14]^c[15]^c[16]^c[17]^c[21]^c[23]^c[24]^c[25]^c[26]^c[30];
newcrc[27]=d[127]^d[123]^d[122]^d[121]^d[120]^d[118]^d[114]^d[113]^d[112]^d[111]^d[109]^d[108]^d[106]^d[105]^d[101]^d[99]^d[98]^d[96]^d[94]^d[93]^d[92]^d[91]^d[90]^d[89]^d[82]^d[80]^d[79]^d[78]^d[77]^d[76]^d[74]^d[68]^d[67]^d[63]^d[62]^d[61]^d[60]^d[58]^d[56]^d[55]^d[53]^d[50]^d[49]^d[48]^d[45]^d[43]^d[42]^d[40]^d[39]^d[32]^d[29]^d[27]^d[26]^d[25]^d[24]^d[23]^d[21]^d[20]^d[19]^d[11]^d[7]^d[5]^d[4]^d[1]^c[0]^c[2]^c[3]^c[5]^c[9]^c[10]^c[12]^c[13]^c[15]^c[16]^c[17]^c[18]^c[22]^c[24]^c[25]^c[26]^c[27]^c[31];
newcrc[28]=d[124]^d[123]^d[122]^d[121]^d[119]^d[115]^d[114]^d[113]^d[112]^d[110]^d[109]^d[107]^d[106]^d[102]^d[100]^d[99]^d[97]^d[95]^d[94]^d[93]^d[92]^d[91]^d[90]^d[83]^d[81]^d[80]^d[79]^d[78]^d[77]^d[75]^d[69]^d[68]^d[64]^d[63]^d[62]^d[61]^d[59]^d[57]^d[56]^d[54]^d[51]^d[50]^d[49]^d[46]^d[44]^d[43]^d[41]^d[40]^d[33]^d[30]^d[28]^d[27]^d[26]^d[25]^d[24]^d[22]^d[21]^d[20]^d[12]^d[8]^d[6]^d[5]^d[2]^c[1]^c[3]^c[4]^c[6]^c[10]^c[11]^c[13]^c[14]^c[16]^c[17]^c[18]^c[19]^c[23]^c[25]^c[26]^c[27]^c[28];
newcrc[29]=d[125]^d[124]^d[123]^d[122]^d[120]^d[116]^d[115]^d[114]^d[113]^d[111]^d[110]^d[108]^d[107]^d[103]^d[101]^d[100]^d[98]^d[96]^d[95]^d[94]^d[93]^d[92]^d[91]^d[84]^d[82]^d[81]^d[80]^d[79]^d[78]^d[76]^d[70]^d[69]^d[65]^d[64]^d[63]^d[62]^d[60]^d[58]^d[57]^d[55]^d[52]^d[51]^d[50]^d[47]^d[45]^d[44]^d[42]^d[41]^d[34]^d[31]^d[29]^d[28]^d[27]^d[26]^d[25]^d[23]^d[22]^d[21]^d[13]^d[9]^d[7]^d[6]^d[3]^c[0]^c[2]^c[4]^c[5]^c[7]^c[11]^c[12]^c[14]^c[15]^c[17]^c[18]^c[19]^c[20]^c[24]^c[26]^c[27]^c[28]^c[29];
newcrc[30]=d[126]^d[125]^d[124]^d[123]^d[121]^d[117]^d[116]^d[115]^d[114]^d[112]^d[111]^d[109]^d[108]^d[104]^d[102]^d[101]^d[99]^d[97]^d[96]^d[95]^d[94]^d[93]^d[92]^d[85]^d[83]^d[82]^d[81]^d[80]^d[79]^d[77]^d[71]^d[70]^d[66]^d[65]^d[64]^d[63]^d[61]^d[59]^d[58]^d[56]^d[53]^d[52]^d[51]^d[48]^d[46]^d[45]^d[43]^d[42]^d[35]^d[32]^d[30]^d[29]^d[28]^d[27]^d[26]^d[24]^d[23]^d[22]^d[14]^d[10]^d[8]^d[7]^d[4]^c[0]^c[1]^c[3]^c[5]^c[6]^c[8]^c[12]^c[13]^c[15]^c[16]^c[18]^c[19]^c[20]^c[21]^c[25]^c[27]^c[28]^c[29]^c[30];
newcrc[31]=d[127]^d[126]^d[125]^d[124]^d[122]^d[118]^d[117]^d[116]^d[115]^d[113]^d[112]^d[110]^d[109]^d[105]^d[103]^d[102]^d[100]^d[98]^d[97]^d[96]^d[95]^d[94]^d[93]^d[86]^d[84]^d[83]^d[82]^d[81]^d[80]^d[78]^d[72]^d[71]^d[67]^d[66]^d[65]^d[64]^d[62]^d[60]^d[59]^d[57]^d[54]^d[53]^d[52]^d[49]^d[47]^d[46]^d[44]^d[43]^d[36]^d[33]^d[31]^d[30]^d[29]^d[28]^d[27]^d[25]^d[24]^d[23]^d[15]^d[11]^d[9]^d[8]^d[5]^c[0]^c[1]^c[2]^c[4]^c[6]^c[7]^c[9]^c[13]^c[14]^c[16]^c[17]^c[19]^c[20]^c[21]^c[22]^c[26]^c[28]^c[29]^c[30]^c[31];
in the first 16Byte _ CRC32 calculation, the module obtains the 16Byte data from the data input, the initial CRC check code from the CRC check code register, and then the new CRC32 check code from the expression calculation. The new check code obtained by calculation is stored in the CRC check code register, and the new check code is calculated as the initial CRC check code of the calculation when the next calculation of 16Byte _ CRC32 is performed. And circulating in sequence, when the value of the Byte number is less than 16, the 16Byte _ CRC32 is switched to 1Byte _ CRC32, and the CRC check code result calculated by the last 16Byte _ CRC32 is calculated as the initial CRC check code calculated by 1Byte _ CRC 32.
The workflow for the 1Byte _ CRC32 sub-module may be as follows:
when the 1Byte _ CRC32 submodule calculates, because the data obtained from the data input is data with unequal 1Byte to 15Byte, the data is transferred to a FIFO register, and the data in the FIFO register is sequentially executed according to the Byte number value. And circularly performing data of corresponding Byte number, and updating the calculated result into a CRC (Cyclic redundancy check) code register. And after the calculation is executed, the final output CRC value is the final CRC check code of the data block.
It can be seen that, in the embodiment, the configured CRC calculation unit is used for calculating the transmission data with the matched data bit width, or the CRC calculation unit with the 1Byte bit width is used for performing check calculation on the data with different bit widths, so that the check calculation on the data with multiple bit widths is realized, instead of configuring corresponding calculation units for all the data with the data bit widths, the complexity and the resource consumption are reduced, and the performance utilization rate is improved; and similarly, the data is not calculated after being subjected to bit complementing, so that data calculation errors caused by bit complementing are avoided, and the accuracy and precision of CRC (cyclic redundancy check) are improved.
The CRC check apparatus provided in the embodiments of the present application is introduced below, and the CRC check apparatus described below and the CRC check method described above may be referred to correspondingly.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a CRC check apparatus according to an embodiment of the present disclosure.
In this embodiment, the apparatus may include:
a data bit width obtaining module 100, configured to obtain a data bit width of current transmission data;
a bit width judging module 200, configured to judge whether the data bit width is the same as the bit width of the configured CRC calculation unit; the bit width of the configured CRC calculation unit comprises 4Byte, 8Byte and 16 Byte;
the first CRC calculation module 300 is configured to, when the data bit width is the same as the bit width of the configured CRC calculation unit, perform CRC check calculation on the transmission data by using the CRC calculation unit corresponding to the data bit width to obtain a check value;
and a second CRC calculation module 400, configured to perform cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the bit width of 1Byte when the bit width of the data is different from the bit width of the configured CRC calculation unit, so as to obtain a check value.
Optionally, the apparatus may further include:
and the data storage block configuration module is used for configuring 3 data storage blocks of 1Byte for the CRC calculation unit with the bit width of 1Byte when the CRC calculation unit with the bit width of 4Byte is adopted for calculation.
Optionally, the second CRC calculation module 400 may include:
the data write-in storage block submodule is used for storing the transmission data into the corresponding data storage block according to the 1Byte unit;
and the CRC check calculation sub-module is used for taking out data from the data storage blocks according to the transmission data bit sequence, performing CRC check calculation on the data by adopting a CRC calculation unit with the 1Byte bit width, and taking the obtained check value as an initial value for calculation by the CRC calculation unit with the 1Byte bit width at the next time until the data calculation in all the data storage blocks is completed to obtain the check value.
An embodiment of the present application further provides a server, including:
a memory for storing a computer program;
a processor for implementing the steps of the CRC check method as described in the above embodiments when executing the computer program.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the CRC check method according to the above embodiments are implemented.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
A CRC check method, a CRC check apparatus, a server, and a computer readable storage medium provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
Claims (10)
1. A CRC check method, comprising:
acquiring the data bit width of current transmission data;
judging whether the data bit width is the same as the bit width of a configured CRC calculation unit or not;
if so, performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value;
if not, performing cyclic CRC check calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value.
2. The CRC check method of claim 1, wherein the bit width of the configured CRC calculation units includes 4, 8, 16 Bytes.
3. The CRC check method of claim 1, further comprising:
when a CRC calculation unit with 4Byte bit width is adopted for calculation, 3 data storage blocks with 1Byte are configured for the CRC calculation unit with 1Byte bit width.
4. The CRC check method of claim 1, further comprising:
when the CRC calculation unit with the 8-Byte bit width is adopted for calculation, 7 data storage blocks with 1Byte are configured for the CRC calculation unit with the 1Byte bit width.
5. The CRC check method of claim 1, further comprising:
when a 16-Byte-bit-wide CRC calculation unit is adopted for calculation, 15 1-Byte data storage blocks are configured for the 1-Byte-bit-wide CRC calculation unit.
6. The CRC check method of any of claims 3 to 5, wherein performing a cyclic CRC check calculation on the transmission data according to a CRC calculation unit with a bit width of 1Byte to obtain a check value comprises:
storing the transmission data into a corresponding data storage block according to a 1Byte unit;
and taking out the data from the data storage blocks according to the transmission data bit sequence, performing CRC check calculation on the data by adopting a CRC calculation unit with the 1Byte bit width, and taking the obtained check value as an initial value for calculation by the CRC calculation unit with the 1Byte bit width next time until the data calculation in all the data storage blocks is completed to obtain the check value.
7. A CRC check apparatus, comprising:
the data bit width acquisition module is used for acquiring the data bit width of the current transmission data;
the bit width judging module is used for judging whether the data bit width is the same as the bit width of the configured CRC calculation unit or not; wherein the bit width of the configured CRC calculation unit comprises 4 bytes, 8 bytes and 16 bytes;
the first CRC calculation module is used for performing CRC check calculation on the transmission data by adopting a CRC calculation unit corresponding to the data bit width to obtain a check value when the data bit width is the same as the bit width of a configured CRC calculation unit;
and the second CRC calculation module is used for performing cyclic CRC calculation on the transmission data according to the CRC calculation unit with the 1Byte bit width to obtain a check value when the data bit width is different from the bit width of the configured CRC calculation unit.
8. The CRC check device of claim 7, further comprising:
and the data storage block configuration module is used for configuring 3 data storage blocks of 1Byte for the CRC calculation unit with the bit width of 1Byte when the CRC calculation unit with the bit width of 4Byte is adopted for calculation.
9. A server, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the CRC check method as claimed in any one of claims 1 to 6 when executing said computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the CRC check method as claimed in any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011305695.6A CN112306741B (en) | 2020-11-19 | 2020-11-19 | CRC (Cyclic redundancy check) method and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011305695.6A CN112306741B (en) | 2020-11-19 | 2020-11-19 | CRC (Cyclic redundancy check) method and related device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112306741A true CN112306741A (en) | 2021-02-02 |
CN112306741B CN112306741B (en) | 2022-12-23 |
Family
ID=74335273
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011305695.6A Active CN112306741B (en) | 2020-11-19 | 2020-11-19 | CRC (Cyclic redundancy check) method and related device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112306741B (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113434544A (en) * | 2021-06-02 | 2021-09-24 | 中科驭数(北京)科技有限公司 | Database data reading method, database data writing method and device |
CN116861493A (en) * | 2023-08-31 | 2023-10-10 | 上海芯联芯智能科技有限公司 | Verification code generation method, processor and electronic equipment |
CN117097440A (en) * | 2023-10-18 | 2023-11-21 | 苏州联讯仪器股份有限公司 | CRC (cyclic redundancy check) method for Ethernet packet |
CN117914444A (en) * | 2023-12-13 | 2024-04-19 | 无锡众星微***技术有限公司 | Hardware implementation method and device for CRC calculation of IB network data packet |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6092231A (en) * | 1998-06-12 | 2000-07-18 | Qlogic Corporation | Circuit and method for rapid checking of error correction codes using cyclic redundancy check |
CN101702639A (en) * | 2009-11-23 | 2010-05-05 | 成都市华为赛门铁克科技有限公司 | Check value calculation method and device of cyclic redundancy check |
CN102130744A (en) * | 2011-03-25 | 2011-07-20 | 中兴通讯股份有限公司 | Method and device for computing Cyclic Redundancy Check (CRC) code |
CN102158316A (en) * | 2011-04-25 | 2011-08-17 | 中兴通讯股份有限公司 | Method and device for verifying parallel CRC (Cyclic Redundancy Check) 32 with 64-bit width |
CN102916781A (en) * | 2012-10-31 | 2013-02-06 | 华为技术有限公司 | Calibration method and calibration device |
CN103701566A (en) * | 2013-12-18 | 2014-04-02 | 华为技术有限公司 | Check method and check device |
CN105162551A (en) * | 2015-07-29 | 2015-12-16 | 中工科安科技有限公司 | Calculation method for CRC security check code for encoder signal processing |
US20190158115A1 (en) * | 2017-11-21 | 2019-05-23 | Silicon Motion Inc. | Method employed in ldpc decoder and the decoder |
-
2020
- 2020-11-19 CN CN202011305695.6A patent/CN112306741B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6092231A (en) * | 1998-06-12 | 2000-07-18 | Qlogic Corporation | Circuit and method for rapid checking of error correction codes using cyclic redundancy check |
CN101702639A (en) * | 2009-11-23 | 2010-05-05 | 成都市华为赛门铁克科技有限公司 | Check value calculation method and device of cyclic redundancy check |
CN102130744A (en) * | 2011-03-25 | 2011-07-20 | 中兴通讯股份有限公司 | Method and device for computing Cyclic Redundancy Check (CRC) code |
CN102158316A (en) * | 2011-04-25 | 2011-08-17 | 中兴通讯股份有限公司 | Method and device for verifying parallel CRC (Cyclic Redundancy Check) 32 with 64-bit width |
CN102916781A (en) * | 2012-10-31 | 2013-02-06 | 华为技术有限公司 | Calibration method and calibration device |
CN103701566A (en) * | 2013-12-18 | 2014-04-02 | 华为技术有限公司 | Check method and check device |
CN105162551A (en) * | 2015-07-29 | 2015-12-16 | 中工科安科技有限公司 | Calculation method for CRC security check code for encoder signal processing |
US20190158115A1 (en) * | 2017-11-21 | 2019-05-23 | Silicon Motion Inc. | Method employed in ldpc decoder and the decoder |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113434544A (en) * | 2021-06-02 | 2021-09-24 | 中科驭数(北京)科技有限公司 | Database data reading method, database data writing method and device |
CN116861493A (en) * | 2023-08-31 | 2023-10-10 | 上海芯联芯智能科技有限公司 | Verification code generation method, processor and electronic equipment |
CN116861493B (en) * | 2023-08-31 | 2024-03-29 | 上海芯联芯智能科技有限公司 | Verification code generation method, processor and electronic equipment |
CN117097440A (en) * | 2023-10-18 | 2023-11-21 | 苏州联讯仪器股份有限公司 | CRC (cyclic redundancy check) method for Ethernet packet |
CN117097440B (en) * | 2023-10-18 | 2024-03-15 | 苏州联讯仪器股份有限公司 | CRC (cyclic redundancy check) method for Ethernet packet |
CN117914444A (en) * | 2023-12-13 | 2024-04-19 | 无锡众星微***技术有限公司 | Hardware implementation method and device for CRC calculation of IB network data packet |
Also Published As
Publication number | Publication date |
---|---|
CN112306741B (en) | 2022-12-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112306741B (en) | CRC (Cyclic redundancy check) method and related device | |
US9071275B2 (en) | Method and device for implementing cyclic redundancy check codes | |
US8745472B2 (en) | Memory with segmented error correction codes | |
US7219293B2 (en) | High performance CRC calculation method and system with a matrix transformation strategy | |
US8468439B2 (en) | Speed-optimized computation of cyclic redundancy check codes | |
US7590916B2 (en) | Cyclic redundancy checking value calculator | |
US20010007111A1 (en) | Apparatus and method for efficient arithmetic in finite fields through alternative representation | |
US10248498B2 (en) | Cyclic redundancy check calculation for multiple blocks of a message | |
CN107239362B (en) | Parallel CRC (Cyclic redundancy check) code calculation method and system | |
US8700971B2 (en) | Parallel residue arithmetic operation unit and parallel residue arithmetic operating method | |
CN101795175B (en) | Data verifying method and device | |
US8683291B2 (en) | High throughput frame check sequence module architecture | |
CN101296053A (en) | Method and system for calculating cyclic redundancy check code | |
US20020144208A1 (en) | Systems and methods for enabling computation of CRC' s N-bit at a time | |
CN108809323B (en) | Method and device for generating cyclic redundancy check code | |
KR100731985B1 (en) | Device and method for pipelined parallel crc | |
CN102684870B (en) | Device and method for generating algorithm secret key of Zu Chong-Chi | |
US7299398B2 (en) | Data generating method for forming desired CRC code | |
US7181671B2 (en) | Parallelized CRC calculation method and system | |
US6442747B1 (en) | Method of synthesizing a cycle redundancy code generator circuit using hardware description language | |
CN114884517A (en) | CRC hardware computing system and chip | |
CN109462458B (en) | Method for realizing parallel CRC (cyclic redundancy check) by multistage pipeline circuit | |
CN116861493B (en) | Verification code generation method, processor and electronic equipment | |
CN117200809B (en) | Low-power-consumption money search and error estimation circuit for RS code for correcting two error codes | |
JP2797570B2 (en) | Euclidean circuit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |