WO2017148096A1 - Method and device for generating cyclic redundancy check - Google Patents

Method and device for generating cyclic redundancy check Download PDF

Info

Publication number
WO2017148096A1
WO2017148096A1 PCT/CN2016/092716 CN2016092716W WO2017148096A1 WO 2017148096 A1 WO2017148096 A1 WO 2017148096A1 CN 2016092716 W CN2016092716 W CN 2016092716W WO 2017148096 A1 WO2017148096 A1 WO 2017148096A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
data unit
data
output result
group
Prior art date
Application number
PCT/CN2016/092716
Other languages
French (fr)
Chinese (zh)
Inventor
刘磊山
刘明强
杨敏华
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017148096A1 publication Critical patent/WO2017148096A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Definitions

  • the present application relates to, but is not limited to, the field of communication technologies, and in particular, to a method and an apparatus for generating a Cyclic Redundancy Check (CRC).
  • CRC Cyclic Redundancy Check
  • a parallel algorithm is usually used to calculate the CRC value, and a CRC calculation function is generated according to a polynomial, and the CRC result can be calculated in one cycle.
  • the parallel algorithm when the data width to be processed is wide, the parallel algorithm cannot satisfy the frequency requirement, and the pipeline operation can be implemented by using a separate calculation method, that is, the XOR expression in the parallel algorithm is separately calculated, and then the separation is calculated. Multiple results are XORed to obtain the final CRC value.
  • the related art method for calculating a high bit width CRC value has a long calculation time and occupies a large amount of resources and power consumption of the chip.
  • the present invention solves the technical problem that the CRC value of the high bit width data in the related art is long, and the occupied chip resources and power consumption are large.
  • the method for generating a cyclic redundancy check code includes:
  • Acquiring data information according to the data amount of each level in the data information being M bits, dividing each level of data into data units having an M/N frame width of N bits, and the M/N frame data
  • the unit is divided into Q groups;
  • the first output result of the corresponding position of each frame of the data unit is calculated; and for each group of data units, according to all the groups in the group The data content of the data unit, and the validity of each frame of the data unit in the group, and the second output result of the corresponding position of each frame of the data unit in each group is synchronously calculated;
  • the CRC value when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to a receiving end, so that the data receiving end generates a first CRC value according to itself. Determining, by the comparison result of the CRC value, whether the received data information is erroneous; when the data information is of a received type, the CRC value is used for size comparison with a second CRC value embedded in the data information. So that the data receiving end determines whether the data information is in error according to the comparison result.
  • the cyclic redundancy check code before the step of calculating the first output result of the corresponding position of each data unit according to the CRC input value and the validity of the data unit per frame, the cyclic redundancy check code is The generation method also includes:
  • i is a natural number, and M/N ⁇ i ⁇ 2, calculate the possible combinations of the validity of the data units of the first frame to the (i-1)th frame, and configure a corresponding for each combination.
  • First calculation function For the i-th frame data unit, i is a natural number, and M/N ⁇ i ⁇ 2, calculate the possible combinations of the validity of the data units of the first frame to the (i-1)th frame, and configure a corresponding for each combination.
  • the step of calculating a first output result of a corresponding position of each data unit according to the CRC input value and the validity of the data unit per frame includes:
  • Defining the CRC output value corresponding to the last frame data unit in the previous level data is the CRC input value of the current level; according to the validity of the data unit in each frame, assigning a corresponding number to each data unit in the current level data An input data of a calculation function;
  • the first output result of the corresponding position of the data unit of the first frame is calculated by using the corresponding first input function as the input value by the corresponding first calculation function;
  • the method for generating the cyclic redundancy check code further includes:
  • the total number of data units in each group is ⁇ j ⁇ 2, and the possible combinations of the validity of the data units of the first frame to the (j-1)th frame are calculated.
  • Each combination is configured with a corresponding second calculation function;
  • the step of calculating, according to the data content of all data units in the group, and the validity of each data unit in the group for each group of data units, the second output result of calculating the corresponding position of each frame of the data unit in each group includes :
  • the second output result of the corresponding position of the data unit of the first frame in the group is calculated according to the corresponding input data through the corresponding second calculation function;
  • the corresponding second calculation function is searched, and the corresponding second calculation function is used.
  • the corresponding input data is used as an input value, and the second output result of the corresponding position of the data unit of the jth frame in the group is calculated.
  • the method for generating the cyclic redundancy check code further includes:
  • the steps of a third output of all the data units to the corresponding locations of the M/N frame data units include:
  • the third position corresponding to the current position is calculated. Output the actual validity of the data unit of the result, and find the corresponding third calculation function;
  • a third output result of the corresponding position of the data unit W is calculated by the corresponding third calculation function using the input data as an input value.
  • the step of performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit, and obtaining the CRC value corresponding to each data unit of the frame includes:
  • the corresponding output position of the frame data unit is obtained by performing an exclusive-OR calculation on the first output result and the second output result.
  • the output result calculated by the data unit of a certain frame includes the first output result, the second output result, and the third output result, performing exclusive-OR calculation on the first output result, the second output result, and the third output result
  • the CRC value of the corresponding position of the frame data unit is obtained.
  • the application further provides a computer readable storage medium storing computer executable instructions that are implemented when the computer executable instructions are executed.
  • the application further provides a device for generating a cyclic redundancy check code, where the device for generating a cyclic redundancy check code includes:
  • a dividing module configured to acquire data information, according to the data amount of each level in the data information being M bits, and dividing each level of data into data units having an M/N frame width of N bits,
  • the M/N frame data unit is divided into Q groups;
  • a first output result calculation module configured to calculate, for each level of data, a first output result corresponding to a position of each data unit according to a CRC input value and a validity condition of the data unit per frame;
  • a second output result calculation module is configured to, for each group of data units, synchronously calculate a data unit corresponding to each frame in each group according to data content of all data units in the group and validity of each frame of data units in the group The second output of the location;
  • a third output result calculation module configured to be a second output result according to a corresponding position of the last frame data unit in each group of data units, and a last frame data unit to the (M/N-1) frame data unit in the group The validity of the situation, synchronously calculating the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit;
  • the CRC value calculation module is configured to perform an exclusive-OR calculation on the output result of the corresponding position of the data unit of each frame to obtain a CRC output value corresponding to each data unit of the frame; wherein the output result includes the first output result and the second output result, Or including a first output result, a second output result, and a third output result;
  • a definition module configured to define a CRC output value corresponding to a last frame data unit in the last level data in the data information, as a CRC value of the data information
  • the CRC value when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to a receiving end, so that the data receiving end generates a first CRC value according to itself. Determining, by the comparison result of the CRC value, whether the received data information is erroneous; when the data information is of a received type, the CRC value is used for size comparison with a second CRC value embedded in the data information. So that the data receiving end determines whether the data information is erroneous according to the comparison result;
  • the first output result calculation module is synchronously executed with the second output result calculation module operating.
  • the generating device of the cyclic redundancy check code further includes:
  • a first calculation function configuration module configured to: configure a first first calculation function for the first frame data unit before the first output result calculation module calculates a first output result of the corresponding position of each frame of the data unit; and for the ith a frame data unit, i is a natural number, and M/N ⁇ i ⁇ 2, a possible combination of the validity of the data units of the first frame to the (i-1)th frame is calculated, and a corresponding first is configured for each combination Calculation function
  • the first output result calculation module includes:
  • the input data determining unit is configured to define a CRC output value corresponding to the CRC output value of the last frame data unit in the previous level data, and a current level CRC input value according to the validity of the data unit in each frame,
  • the frame data unit allocates input data of the corresponding first calculation function
  • a first output result calculation unit configured to calculate, for the first frame data unit, a first output result of the corresponding position of the first frame data unit by using a corresponding first input function as the input value by the corresponding first calculation function;
  • the i-th frame data unit searches for a corresponding first calculation function according to the actual validity of the data unit of the first frame to the (i-1)th frame, and calculates the first by a corresponding first calculation function according to the corresponding input data.
  • the i-frame data unit corresponds to the first output of the location.
  • the generating device of the cyclic redundancy check code further includes:
  • a second calculation function configuration module configured to: configure, corresponding to the first frame data unit in each group of data units, before the second output result calculation module calculates a second output result of the corresponding position of each frame of the data unit in each group a second calculation function; and for the j-th frame data unit in each set of data units, the total number of data units in each group is ⁇ j ⁇ 2, and the validity of the data unit of the first frame to the (j-1)th frame is calculated.
  • An input data determining module configured to determine input data of a second computing function corresponding to each frame of data units in each group
  • the second output result calculation module is configured to calculate, according to the first frame data unit of each group, a second output corresponding to the corresponding position of the first frame data unit in the group by using a corresponding second calculation function according to the corresponding input data. a result; and for the jth frame data unit in each group, according to the actual validity of the data unit of the first frame to the (j-1)th frame in the group, searching for a corresponding second calculation function, The second output result of the corresponding position of the data unit of the jth frame in the group is calculated by using the corresponding second calculation function as the input value.
  • the generating device of the cyclic redundancy check code further includes:
  • a determining module configured to: before the third output result calculating module calculates a third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit, for the last one in the fth group And determining, as the input data, a second output result of the corresponding position of the frame data unit, calculating a third output result of the corresponding position of the data unit of each frame in the f+1th group to the Qth group, and determining the last frame data unit of the fth group a possible combination of the validity of each data unit that needs to calculate a third output result of the corresponding position, (Q-1) ⁇ f ⁇ 1;
  • a third calculation function configuration module configured to configure a corresponding third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determine input data of each third calculation function
  • the third output result calculation module includes:
  • a determining unit configured to determine a data unit W that currently needs to calculate a third output result of the corresponding position
  • a third calculation function searching unit configured to: if the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the last frame data unit of the fth group Up to the current need to calculate the actual validity of the data unit of the third output result of the corresponding position, and find a corresponding third calculation function;
  • the third output result calculation unit is configured to calculate a third output result of the corresponding position of the data unit W by using the input data as an input value through a corresponding third calculation function.
  • the generating device of the cyclic redundancy check code, the CRC value calculating module is configured to: when the output result of the corresponding position of the data unit of the certain frame includes the first output result and the second output result, The first output result and the second output result are XORed to obtain a CRC value corresponding to the position of the frame data unit; and the output result calculated by the data unit of the certain frame includes the first output result and the second output result And the third output result is obtained by performing an exclusive-OR calculation on the first output result, the second output result, and the third output result to obtain a CRC value corresponding to the position of the frame data unit.
  • the method and apparatus for generating a cyclic redundancy check code divides the data information into data units having an M/N frame width of N bits according to the data amount of the data information being M bits.
  • the M/N frame data unit is divided into Q groups; according to the CRC input value and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; and the corresponding position of the data unit of each frame is calculated.
  • FIG. 1 is a schematic flowchart of an embodiment of a method for generating a cyclic redundancy check code according to the present application
  • step S20 in FIG. 1 is a schematic diagram of a specific refinement process of step S20 in FIG. 1;
  • FIG. 3 is a schematic diagram of a specific data signal and a control signal of step S20 in FIG. 1;
  • FIG. 4 is a schematic diagram of a specific data signal and a control signal of step S30 in FIG. 1;
  • FIG. 5 is a schematic diagram of specific data signals and control signal directions of step S40 in FIG. 1;
  • FIG. 6 is a schematic diagram showing the direction of another specific data signal and control signal in step S40 of FIG. 1;
  • FIG. 7 is a schematic diagram of functional modules of an embodiment of a device for generating a cyclic redundancy check code according to the present application.
  • FIG. 8 is a schematic diagram of functional modules of another embodiment of a device for generating a cyclic redundancy check code according to the present application.
  • FIG. 9 is a schematic diagram of a specific refinement function module of the first output result calculation module in FIG. 8;
  • FIG. 10 is a schematic diagram of functional modules of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application.
  • FIG. 11 is a schematic diagram of functional blocks of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application.
  • FIG. 12 is a schematic diagram of a specific refinement function module of the third output result calculation module in FIG. 11.
  • FIG. 1 is a schematic flowchart diagram of an embodiment of a method for generating a cyclic redundancy check code according to the present application.
  • the method for generating the cyclic redundancy check code includes:
  • Step S10 Obtaining data information, according to the data quantity of each level in the data information being M bits, dividing each level of data into data units having an M/N frame width of N bits, and the M/ The N frame data unit is divided into Q groups.
  • the number of data unit frames in each group in the Q group described in this application may be the same or different, and the embodiment is the same.
  • Step S20 For each level of data, calculate a first output result of a corresponding position of each data unit according to a CRC input value and a validity condition of the data unit per frame.
  • a corresponding first calculation function needs to be configured for each frame of data units before calculating the first output result of the corresponding position of each frame of the data unit. That is, before step S20, the method further includes: configuring a corresponding first calculation function for the first frame data unit; i is a natural number for the i-th frame data unit, and M/N ⁇ i ⁇ 2, determining the first frame to the first frame (i-1) a possible combination of the validity of the frame data unit, A corresponding first calculation function is configured for each combination.
  • the data unit of each frame in this application may be valid or invalid, and the validity of each frame of data unit includes two types: one is that the frame data unit is valid, and the other is that the frame data unit is invalid.
  • the possible combinations of the validity conditions of the data units of the first frame to the (i-1)th frame include a plurality of types.
  • "0" can be used as a valid identifier
  • "1" is used as an invalid identifier
  • the first to the (i-1)th frame data units include: a first frame data unit and a second frame data unit.
  • the validity of the data unit of the first frame is valid "0" or invalid "1”
  • the validity of the data unit of the second frame is valid "0" or invalid "1".
  • the possible combinations of the validity conditions of the first and second frame data units include the following four types: the first frame data unit is valid "0", the second frame data unit is valid "0"; the first frame data unit is valid "0", The second frame data unit is invalid "1"; the first frame data unit is valid "0"; the second frame data unit is invalid "1"; the first frame data unit is invalid "1”; the second frame data unit is invalid "1".
  • FIG. 2 is a detailed flowchart of step S20 in FIG.
  • the step S20 includes:
  • Step S21 defining a CRC output value corresponding to the last frame data unit in the previous level data as a CRC input value of the current level; and assigning each data unit in the current level data according to the validity of the data unit in each frame. Corresponding input data of the first calculation function.
  • each frame of data unit in the present application includes two types: valid and invalid, wherein "0" can be used as a valid identifier and "1" as an invalid identifier.
  • Step S22 For the first frame data unit, calculate a first output result of the corresponding position of the first frame data unit by using a corresponding first input function as the input value by the corresponding first calculation function.
  • Step S23 searching for a corresponding first calculation function according to the actual validity of the data unit of the first frame to the (i-1)th frame for the ith frame data unit, and passing the corresponding first calculation function according to the corresponding input data. Calculating a first output result of the corresponding position of the ith frame data unit.
  • the bit width of each data unit is 64 bits, and the 24 data units are divided into three frames with the same number of frames.
  • the validity signal "previous level CTRLIN[23]" of the last frame data unit of the previous level data in the control signal is judged.
  • the first calculation function is configured as C63_0 for the first frame data unit DATA0, and the input data for determining pre_crc as C63_0 is selected.
  • a possible combination of the validity conditions of the first to (i-1)th frame data units is predetermined, and a corresponding first calculation function is configured for each combination.
  • the second frame data unit DATA1 is invalid "1”
  • the first calculation function is set to C63_0
  • the determination 32'hffff_fff is selected as the input data of the first calculation function C63_0.
  • the second frame data unit DATA1 is valid "0”
  • the first frame data unit DATA0 is invalid "1”
  • the first calculation function is configured as C127_0
  • 32'hffff_fffffff is selected as the input data of the first calculation function C127_0.
  • the first calculation function is configured as C191_0, and the input data determining the pre_crc as the first calculation function C191_0 is selected.
  • the control signal CTRLIN[23:0] input during the actual calculation process includes the actual validity identification of the data unit DATA0 to the 24th data unit DATA23 of the first frame. There is one and only one actual validity condition of the data unit of the first frame to the (i-1)th frame. First, the actual validity of the data unit of the first frame to the (i-1)th frame is searched according to the control signal CTRLIN[23:0].
  • the principle of calculating the first output result of the corresponding position of the data unit of the second frame and the subsequent data unit is basically the same as the principle of calculating the first output result of the corresponding position of the data unit of the third frame.
  • Step S30 For each group of data units, synchronously calculate a second output result of the corresponding position of each frame of the data unit in each group according to the data content of all the data units in the group and the validity of each frame of the data unit in the group. .
  • Step S20 described in the present application is performed in synchronization with the step S30.
  • the method before calculating the second output result of the corresponding position of each frame of the data unit in each group, a corresponding second calculation function needs to be configured for each frame of the data unit in each group. That is, before the step S30, the method further includes: configuring a corresponding second calculation function for the first frame data unit in each group of data units; and data in each group for the jth frame data unit in each group of data units The total number of frames of the unit ⁇ j ⁇ 2, the possible combinations of the validity of the data units of the first frame to the (j-1)th frame are calculated, and a corresponding second calculation function is configured for each combination; The input data of the corresponding second calculation function of each frame of data unit.
  • the step S30 includes: calculating, for each frame of the first frame data unit, a second output result of the corresponding position of the data unit of the first frame in the group by using a corresponding second input function as the input value; For the jth frame data unit in each group, according to the actual validity of the data unit of the first frame to the (j-1)th frame in the group, the corresponding second calculation function is searched, and the corresponding second calculation function is used to The corresponding input data is used as an input value to calculate a second output result of the corresponding position of the data unit of the jth frame in the group.
  • FIG. 4 is a schematic diagram of the direction of the data signal and the control signal in step S30 of FIG. The data information referred to in FIG.
  • the second output result of the third frame (DATA2) data unit in the first group is calculated by taking FIG. 4 as an example, and the step S30 is further described.
  • Possible combinations of the validity of the data unit of the first frame (DATA0) to the second frame (DATA1) in the first group include: invalidation of "1" for the second frame; "0" for the second frame, and "1" for the first frame "; other effectiveness.
  • the second frame is invalid "1", the corresponding second calculation function is D63_0, the input data is (DATA2); the second frame is valid "0", the first frame is invalid "1", and the corresponding second calculation function is D63_0.
  • the corresponding second calculation function is D63_0 ⁇ D127_64 ⁇ D191_128, wherein the input data of D63_0 is DATA2; the input data of D127_64 is DATA1
  • the input data of D191_128 is DATA0.
  • the second output result of calculating the corresponding position of other data units in the group is consistent, and the second output result of calculating the corresponding position of the data unit of the other group is consistent with the principle of the first group, This will not be repeated here.
  • the calculation process of the second output result of the corresponding position of the data unit of each group in the present application is synchronous, and the design greatly shortens the calculation time of the second output result of the corresponding position of all the data units, and improves the second output result. Calculate the frequency and reduce the use of resources.
  • Step S40 Synchronize according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group. A third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit is calculated.
  • the method further includes: processing, for the second output result of the corresponding position of the last frame data unit in the fth group as the input data, each frame in the f+1th group to the Qth group Determining, by the case of the third output result of the corresponding position of the data unit, a possible combination of the validity of the data unit of the last frame of the f-th group to the data unit of each of the third output results requiring calculation of the corresponding position, (Q-1) ⁇ f ⁇ 1; a corresponding third calculation function is configured for each combination of data units each of which needs to calculate a third output result of the corresponding position, and input data of each third calculation function is determined.
  • the step S40 calculates the group according to the second output result of the corresponding position of the last frame data unit in each group of data units and the validity of the last frame data unit to the (M/N-1) frame data unit.
  • the third output result of the next set of all data units to the corresponding position of the M/N frame data unit includes a process of: determining a data unit W that currently needs to calculate a third output result of the corresponding position; if the data unit is the f+
  • the data unit of any one of the first frame data unit to the M/N frame data unit of the group 1 is calculated according to the data unit of the last frame of the fth group to the data unit of the third output result of the corresponding position currently needed to be calculated.
  • the validity condition is to find a corresponding third calculation function; the third output result of the corresponding position of the data unit W is calculated by using the input data as an input value by a corresponding third calculation function.
  • FIG. 5 is a schematic diagram of specific data signals and control signal directions in step S40 of FIG.
  • the data information referred to in FIG. 5 is consistent with the data information described in FIG.
  • the second output result of the corresponding position of the data unit of the last frame in the first group is used as the input data, and the third output result of the corresponding position of the data unit of each frame in the second group to the second group is calculated as an example. description.
  • the combination of the validity of DATA7 to DATA22 is: DATA22 invalid “1”, DATA21 valid “0”, ... DATA9 valid “0”, DATA8 valid “0”, DATA7 valid “0”, the corresponding third calculation function is C959_0, the input data of the third calculation function C959_0 is the second output result D_OUT7 of the corresponding position of the last frame data unit in the first group.
  • the validity of DATA7 to DATA22 is other validity, and the third output directly takes 32'h0.
  • FIG. 6 is a schematic diagram of another specific data signal and a control signal of step S40 in FIG.
  • the data information referred to in FIG. 6 is consistent with the data information described in FIG.
  • the second output result of the corresponding position of the data unit of the last frame in the second group is used as the input data
  • the third output result of the corresponding position of each data unit in the third group to the Q group is calculated as an example. Further description is made.
  • the input data is the second output result D_OUT15 of the corresponding position of the last frame data unit in the second group.
  • the validity of DATA15 to DATA22 is combined into other validity cases, and the third output result is directly 32'h0.
  • the third output result of each data unit in the third group includes two, that is, the number of third output results of the corresponding position of each data unit of the Lth group in the present application is (L-1). ).
  • the second output result of the corresponding position of the last frame data unit in the different groups is used as the input data, and the corresponding position of the data unit of each group in the next group to the Q group corresponding to the second output result corresponding to the input data
  • the calculation process of the third output result is synchronous, and the design greatly shortens the calculation time of the third output result of the corresponding position of all the data units, improves the calculation frequency of the third output result, and reduces the use of resources.
  • Step S50 performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit to obtain a CRC output value corresponding to each frame of the data unit; the output result includes the first output result, the second output result, or the first output result , the second output result, and the third output result.
  • the processing of the step S50 is as follows: when the output result of the corresponding position of the data unit of the certain frame includes the first output result and the second output result, the XOR calculation is performed on the first output result and the second output result.
  • the frame data unit corresponds to a CRC value of the position; when the output result calculated by the frame data unit includes the first output result, the second output result, and the third output result, the first output result and the second output are passed As a result, the third output result is XORed to obtain a CRC value corresponding to the position of the frame data unit.
  • the third output result of the corresponding position of the data unit in the different group is different, and the third output result of the corresponding position of the data unit of the Lth group is (L-1).
  • This step S50 will be described by taking the first frame data unit (DATA0) of the first group, the first frame data unit (DATA8) of the second group, and the first frame data unit (DATA16) of the third group as an example. Since the output result of the corresponding position of the data unit of the first frame of the first group includes only the first output result C_OUT0 and the second output result D_OUT0, the C_OUT0 and D_OUT0 are XORed to obtain the first frame data unit (DATA0). CRC value.
  • the output result of the corresponding position of the first frame data unit (DATA8) of the second group includes the first output result C_OUT8, the second output result D_OUT8, and the third output result C_D2_OUT8, and the C_OUT8, D_OUT8, C_D2_OUT8 are XORed to obtain the The CRC value of the first frame of data unit (DATA8) of the second group.
  • the output result of the corresponding position of the first frame data unit (DATA16) of the third group includes the first output result C_OUT16, the second output result D_OUT16, and the third output result C_D2_OUT16 And C_D1_OUT16, the C_OUT16, D_OUT16, C_D2_OUT16, C_D1_OUT16 are XORed to obtain the CRC value of the first frame data unit (DATA16) of the third group.
  • Step S60 Define a CRC output value corresponding to a last frame data unit in the last level data in the data information as a CRC value of the data information.
  • the CRC value when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to the receiving end, so that the data receiving end generates the first according to itself. Determining whether the received data information is erroneous as a result of the comparison of the CRC value and the CRC value; when the data information is of a received type, the CRC value is used for performing with a second CRC value embedded in the data information The size is compared, so that the data receiving end determines whether the data information is in error according to the comparison result.
  • the method for generating a cyclic redundancy check code is to divide the data information into data units having an M/N frame width of N bits according to the data amount of the data information being M bits, and the data unit is The M/N frame data unit is divided into Q groups; according to the CRC input value and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; in calculating the corresponding position of each frame of the data unit Simultaneously executing the first output result, the data unit of each group in each group is synchronously calculated according to the data content of all the data units in the group and the validity of each data unit in the group for each group of data units.
  • the exclusive-OR calculation method obtains the CRC value corresponding to each frame of data unit, which greatly shortens the calculation time of the CRC value of the corresponding position of the data unit of each frame, improves the calculation frequency of the CRC value, and reduces the calculation of the CRC value by the chip. Accounting for resources and power consumption.
  • Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions that are implemented when the computer executable instructions are executed.
  • FIG. 7 is a schematic diagram of functional blocks of an embodiment of a device for generating a cyclic redundancy check code according to the present application.
  • the cyclic redundancy check code generating apparatus 100 includes: a dividing module 110, and a first output node.
  • the dividing module 110 is configured to acquire data information, and divide each level of data into data units with an M/N frame width of N bits according to the data amount of each level in the data information being M bits.
  • the first output result calculation module 120 is configured to calculate, for each level of data, a first output result corresponding to a position of each frame of the data unit according to the CRC input value and the validity of the data unit per frame.
  • the second output result calculation module 130 is configured to synchronously calculate each frame in each group according to the data content of all data units in the group and the validity of each data unit in the group for each group of data units. The second output of the corresponding location of the data unit.
  • the third output result calculation module 140 is configured to be based on a second output result of the corresponding position of the last frame data unit in each group of data units, and the last frame data unit in the group to the (M/N-1) The validity of the frame data unit, the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit is synchronously calculated.
  • the CRC value calculation module 150 is configured to perform an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit to obtain a CRC output value corresponding to each frame of the data unit.
  • the definition module 160 is configured to define a CRC output value corresponding to a last frame data unit in the last data of the data information, and a CRC value of the data information; the first output result calculation module and the first The two output result calculation modules synchronously perform related operations.
  • the CRC value when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to the receiving end, so that the data receiving end generates the first according to itself. Determining whether the received data information is erroneous as a result of the comparison of the CRC value and the CRC value; when the data information is of a received type, the CRC value is used for performing with a second CRC value embedded in the data information The size is compared, so that the data receiving end determines whether the data information is in error according to the comparison result.
  • the output result in the embodiment of the above-described cyclic redundancy check code generating apparatus 100 includes a first output result, a second output result, or a first output result, a second output result, and a third output result.
  • the output result of the corresponding position of each data unit of the first group includes only the first output result and the second output result. Only the output result of the corresponding position of each data unit of the second group and its subsequent group includes the first output result, the second output result, and the third output result.
  • the number of data unit frames in each group in the Q group described in the present application may be the same or different, and is the same in this embodiment.
  • FIG. 8 is a schematic diagram of functional modules of another embodiment of a device for generating a cyclic redundancy check code according to the present application.
  • the apparatus for generating cyclic redundancy check code 100 in this embodiment further includes: a first calculation function configuration module 170.
  • the first calculation function configuration module 170 is configured to configure a corresponding first calculation function for the first frame data unit before the first output result calculation module calculates the first output result of the corresponding position of each frame of the data unit; For the i-th frame data unit, i is a natural number, and M/N ⁇ i ⁇ 2, determining a possible combination of the validity of the data units of the first frame to the (i-1)th frame, and configuring a corresponding for each combination The first calculation function.
  • the data unit of each frame in this application may be valid or invalid, and the validity of each frame of data unit includes two types: one is that the frame data unit is valid, and the other is that the frame data unit is invalid.
  • the possible combinations of the validity conditions of the data units of the first frame to the (i-1)th frame include a plurality of types.
  • "0" can be used as a valid identifier
  • "1" is used as an invalid identifier
  • the first to the (i-1)th frame data units include: a first frame data unit and a second frame data unit.
  • the validity of the data unit of the first frame is valid "0" or invalid "1”
  • the validity of the data unit of the second frame is valid "0" or invalid "1".
  • the possible combinations of the validity conditions of the first and second frame data units include the following four types: the first frame data unit is valid "0", the second frame data unit is valid "0"; the first frame data unit is valid "0", The second frame data unit is invalid "1"; the first frame data unit is valid "0"; the second frame data unit is invalid "1"; the first frame data unit is invalid "1”; the second frame data unit is invalid "1".
  • FIG. 9 is a schematic diagram of a specific refinement function module of the first output result calculation module in FIG.
  • the first output result calculation module 120 includes an input data determination unit 121 and a first output result calculation unit 122.
  • the input data determining unit 121 is configured to define a CRC output value corresponding to a CRC output value of a last frame data unit in the previous level data, and a current CRC input value according to the validity of the data unit in each frame.
  • the data unit of each frame in the level data is assigned the input data of the corresponding first calculation function.
  • the first output result calculating unit 122 is configured to calculate, for the first frame data unit, the first output result of the corresponding position of the first frame data unit by using the corresponding first input function as the input value by the corresponding first calculation function. And for the ith frame data unit, according to the actual validity of the data unit of the first frame to the (i-1)th frame, the corresponding first calculation function is searched, and the corresponding first input function is used to calculate according to the corresponding input data.
  • the ith frame data unit corresponds to a first output result of the location.
  • the validity of the data unit in each frame in the above embodiment includes two types: valid and invalid, wherein "0" can be used as a valid identifier and "1" as an invalid identifier.
  • the first calculation function is configured as C63_0, and the selection pre_crc is selected as C63_0. Input data.
  • a possible combination of the validity of the first to the (i-1)th frame data units is predetermined, and a corresponding first is configured for each combination.
  • the second frame data unit DATA1 is invalid "1”
  • the first calculation function is configured as C63_0
  • the determination 32'hffff_fff is selected as the input data of the first calculation function C63_0.
  • the data unit DATA1 is valid "0”
  • the first frame data unit DATA0 is invalid "1”
  • the first calculation function is configured as C127_0
  • 32'hfff_fffffff is selected as the input data of the first calculation function C127_0.
  • the configuration is first.
  • Calculation The function is C191_0, and the input data determining the pre_crc as the first calculation function C191_0 is selected.
  • the control signal CTRLIN[23:0] input in the actual calculation process includes the actual validity of the data unit DATA0 to the 24th frame data unit DATA23 of the first frame.
  • Sexual identification There is one and only one kind of actual validity of the data unit from frame 1 to frame (i-1). First, the first frame to the (i-1)th frame data unit are searched according to the control signal CTRLIN[23:0].
  • the corresponding first calculation function is C127 _0
  • the input data is 32'hffff_ffff, that is, the first calculation function is C127_0
  • the first output result C_OUT2 of the third frame data unit DATA2 is calculated with the input data 32'hfff_ffff as an input value.
  • the principle of calculating the first output result of the corresponding position of the data unit of the second frame and the subsequent data unit is basically the same as the principle of calculating the first output result of the corresponding position of the data unit of the third frame.
  • FIG. 10 is a schematic diagram of functional modules of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application.
  • the apparatus for generating cyclic redundancy check code 100 in this embodiment further includes: a second calculation function configuration module 180 and an input data determination module 190.
  • the second calculation function configuration module 180 is configured to: before the second output result calculation module calculates the second output result of the corresponding position of each frame of the data unit in each group, the first frame data in each group of data units.
  • the unit is configured with a corresponding second calculation function; and for the jth frame data unit in each group of data units, the total number of frames of the data unit in each group is ⁇ j ⁇ 2, and the first frame to the (j-1)th frame data are calculated.
  • a possible combination of the validity of the unit, a corresponding second calculation function is configured for each combination.
  • the input data determination module 190 is configured to determine input data of a second calculation function corresponding to each frame of data units in each group.
  • the second output result calculation module 130 in the embodiment of the above-described cyclic redundancy check code generating apparatus 100 is configured to pass the corresponding second calculation function according to the corresponding input data for the first frame data unit of each group. Calculating a second output result of the corresponding position of the data unit of the first frame in the group; and for the data unit of the jth frame in each group, according to the actual validity of the data unit of the first frame to the (j-1)th frame in the group In the case, the corresponding second calculation function is searched, and the second output result of the corresponding position of the data unit of the jth frame in the group is calculated according to the corresponding input result through the corresponding second calculation function. Referring to FIG. 4, FIG. 4, FIG.
  • FIG. 4 is a schematic diagram of specific data information and control signals of step S30 in FIG.
  • the data information referred to in FIG. 4 is identical to the data information described in FIG.
  • the second output result of the third frame (DATA2) data unit in the first group is calculated by taking FIG. 4 as an example.
  • the second output result calculation module 130 for each group of data units, according to the data of all the data units in the group. The content, and the validity of each frame of data units in the group, the process of calculating the second output of the corresponding location of each frame of data units in the group is further described.
  • Possible combinations of the validity of the data unit of the first frame (DATA0) to the second frame (DATA1) in the first group include: invalidation of "1" for the second frame; effective "0” for the second frame, Frame 1 is invalid “1”; other validity cases.
  • the second frame is invalid “1”, the corresponding second calculation function is D63_0, the input data is (DATA2); the second frame is valid "0", the first frame is invalid "1”, and the corresponding second calculation function is D63_0.
  • the corresponding second calculation function is D63_0 ⁇ D127_64 ⁇ D191_128, wherein the input data of D63_0 is DATA2; the input data of D127_64 is DATA1
  • the input data of D191_128 is DATA0.
  • the second output result of calculating the corresponding position of the other data unit in the group is consistent, and the second output result of calculating the corresponding position of the data unit of the other group is consistent with the principle of the first group, and details are not described herein again.
  • the calculation process of the second output result of the corresponding position of the data unit of each group in the present application is synchronous, and the design greatly shortens the calculation time of the second output result of the corresponding position of all the data units, and improves the second output result. Calculate the frequency and reduce the use of resources.
  • FIG. 11 is a schematic diagram of functional modules of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application.
  • the apparatus for generating cyclic redundancy check code 100 in any one of the above embodiments further includes a determining module 201 and a third calculating function configuration module 101.
  • the determining module 201 is configured to calculate, as input data, a second output result of the corresponding position of the last frame data unit in the fth group, and calculate a third position corresponding to each data unit in the f+1th group to the Qth group.
  • the third calculation function configuration module 101 is configured to configure a corresponding third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determine an input of each third calculation function. data.
  • FIG. 12 is a schematic diagram of a specific refinement function module of the third output result calculation module in FIG.
  • the third output result calculation module 140 includes: a determining unit 141, a third calculation function The number finding unit 142 and the third output result calculating unit 143.
  • the determining unit 141 is configured to determine a data unit W that currently needs to calculate a third output result of the corresponding location.
  • the third calculation function searching unit 142 is configured to: if the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the last group of the fth group The frame data unit is to the actual validity of the data unit that needs to calculate the third output result of the corresponding position, and the corresponding third calculation function is searched for.
  • the third output result calculation unit 143 is configured to calculate a third output result of the corresponding position of the data unit W by using the input data as an input value through a corresponding third calculation function.
  • the data information involved in FIG. 5 is consistent with the data information described in FIG. Referring to FIG. 5, the second output result of the corresponding position of the data unit of the last frame in the first group is used as input data, and the third output result of the corresponding position of each data unit in the second group to the second group is calculated as an example to the third.
  • the output result calculation module 140 is configured according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group. The specific process of calculating the third output result of the next set of all data units of the group to the corresponding position of the M/N frame data unit is further described.
  • the combination of the validity of DATA7 to DATA22 is: DATA22 invalid “1”, DATA21 valid “0”, ... DATA9 valid “0”, DATA8 valid “0”, DATA7 valid “0”, the corresponding third calculation function is C959_0, the input data of the third calculation function C959_0 is the second output result D_OUT7 of the corresponding position of the last frame data unit in the first group.
  • the validity of DATA7 to DATA22 is other validity, and the third output directly takes 32'h0.
  • FIG. 6 is a schematic diagram of another specific data information and a control signal of step S40 in FIG.
  • the data information referred to in FIG. 6 is consistent with the data information described in FIG.
  • the second output result of the corresponding position of the data unit of the last frame in the second group is used as the input data
  • the third output result of the corresponding position of each data unit in the third group to the Q group is calculated as an example.
  • the third output result calculation module 140 is configured according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group.
  • the third output result of each data unit in the third group includes two, that is, the number of third output results of the corresponding position of each data unit of the Lth group in the present application is (L-1). ).
  • the second output result of the corresponding position of the last frame data unit in the different groups is used as the input data, and the corresponding position of the data unit of each group in the next group to the Q group corresponding to the second output result corresponding to the input data
  • the calculation process of the third output result is synchronous, and the design greatly shortens the calculation time of the third output result of the corresponding position of all the data units, and improves the third output.
  • the frequency of calculations reduces the use of resources.
  • the CRC value calculation module 150 is specifically configured to: when the output result of the corresponding position of the data unit of a certain frame includes the first output result and the second output result, And performing an exclusive-OR calculation on the first output result and the second output result to obtain a CRC value corresponding to the position of the frame data unit; and outputting the calculated result of the data unit of the certain frame includes the first output result and the second
  • the output result and the third output result are obtained by performing an exclusive-OR calculation on the first output result, the second output result, and the third output result to obtain a CRC value corresponding to the position of the frame data unit.
  • this step S50 is exemplified by taking the first frame data unit (DATA0) of the first group and the first frame data unit (DATA16) of the third group of the first frame data unit (DATA8) of the second group as an example, because The output result of the corresponding position of the data unit of the first frame of the first group includes only the first output result C_OUT0 and the second output result D_OUT0, and the C_OUT0 and D_OUT0 are XORed to obtain the CRC of the first frame data unit (DATA0). value.
  • the output result of the corresponding position of the first frame data unit (DATA8) of the second group includes the first output result C_OUT8, the second output result D_OUT8, and the third output result C_D2_OUT8, and the C_OUT8, D_OUT8, C_D2_OUT8 are XORed to obtain the The CRC value of the first frame of data unit (DATA8) of the second group.
  • the output result of the corresponding position of the first frame data unit (DATA16) of the third group includes the first output result C_OUT16, the second output result D_OUT16, and the third output result C_D2_OUT16 and C_D1_OUT16, and the C_OUT16, D_OUT16, C_D2_OUT16, C_D1_OUT16 are different. Or calculate the CRC value of the first frame data unit (DATA16) of the third group.
  • the cyclic redundancy check code generating apparatus 100 divides the data information into data units having M/N frame bit width N according to the bit number M of the data information, and the M is /N frame data unit is divided into Q groups; according to the CRC input value, and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; in the calculation of the corresponding position of the data unit of each frame Simultaneously calculating the corresponding position of each data unit in each group according to the data content of all data units in the group and the validity of each data unit in the group.
  • the operation of the second output result; then the second output result according to the corresponding position of the last frame data unit in each set of data units, and the group The validity of the last frame data unit to the (M/N-1) frame data unit, and the third output result of the next group of all data units of each group to the corresponding position of the M/N frame data unit is synchronously calculated.
  • the CRC value corresponding to each frame of the data unit is obtained by performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit, which greatly shortens the calculation time of the CRC value of the corresponding position of the data unit of each frame, and improves the CRC value. Calculating the frequency reduces the resources and power consumption of the chip to calculate the CRC value.
  • each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function.
  • Embodiments of the invention are not limited to any specific form of combination of hardware and software.
  • the CRC value corresponding to each data unit is obtained by performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit, which greatly shortens each
  • the calculation time of the CRC value corresponding to the position of the frame data unit increases the calculation frequency of the CRC value, and reduces the resources and power consumption occupied by the chip to calculate the CRC value.

Abstract

Disclosed are a method and device for generating a cyclic redundancy check (CRC). The method comprises: dividing each level of data in data information into M/N frames of data units, and grouping the M/N frames of data units into Q groups; calculating a first output result of each frame of data unit for each level of data according to a CRC input value and the validity of each frame of data unit; synchronously calculating a second output result of each frame of data unit in each group according to the validity of each frame of data unit; synchronously calculating third output results of all the data units in the next group of each group to the M/Nth frame of data unit according to the second output result of the last frame of data unit in each group and the validity of the last frame of data unit to the (M/N-1)th frame of data unit in the group; and performing an exclusive-OR calculation on the output result of each frame of data unit to obtain a CRC value of each frame of data unit, and defining the CRC output value of the last frame of data unit in the last level of data as the CRC value of the data information. The solution shortens the time for calculating a CRC value, improves the calculation frequency of the CRC value, and reduces resources and power consumption of a chip for calculating the CRC value.

Description

循环冗余校验码的生成方法和装置Method and device for generating cyclic redundancy check code 技术领域Technical field
本申请涉及但不限于通信技术领域,特别是一种循环冗余校验码(Cycle Redundancy Check,简称CRC)的生成方法和装置。The present application relates to, but is not limited to, the field of communication technologies, and in particular, to a method and an apparatus for generating a Cyclic Redundancy Check (CRC).
背景技术Background technique
在数据通信领域中通常采用并行算法来计算CRC值,根据多项式生成CRC计算函数,在一个周期内就可以计算出CRC结果。In the field of data communication, a parallel algorithm is usually used to calculate the CRC value, and a CRC calculation function is generated according to a polynomial, and the CRC result can be calculated in one cycle.
相关技术中当需要处理的数据位宽很宽,并行算法不能满足频率要求,可以采用分离计算的方式实现pipeline操作,即对并行算法中的异或表达式进行分离计算,再对分离计算出的多个结果进行异或运算得到最终的CRC值。In the related art, when the data width to be processed is wide, the parallel algorithm cannot satisfy the frequency requirement, and the pipeline operation can be implemented by using a separate calculation method, that is, the XOR expression in the parallel algorithm is separately calculated, and then the separation is calculated. Multiple results are XORed to obtain the final CRC value.
相关技术的这种计算高位宽CRC值的方法,其计算时间长,占用芯片的资源和功耗大。The related art method for calculating a high bit width CRC value has a long calculation time and occupies a large amount of resources and power consumption of the chip.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本申请解决相关技术中高位宽数据的CRC值计算时间长,占用的芯片资源和功耗大的技术问题。The present invention solves the technical problem that the CRC value of the high bit width data in the related art is long, and the occupied chip resources and power consumption are large.
本申请提供的一种循环冗余校验码的生成方法,所述循环冗余校验码的生成方法包括:The method for generating a cyclic redundancy check code provided by the present application, the method for generating the cyclic redundancy check code includes:
获取数据信息,根据所述数据信息中每一级的数据量为M比特,将所述每一级数据划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组; Acquiring data information, according to the data amount of each level in the data information being M bits, dividing each level of data into data units having an M/N frame width of N bits, and the M/N frame data The unit is divided into Q groups;
针对每一级数据,根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;并同时针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果;For each level of data, according to the CRC input value, and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; and for each group of data units, according to all the groups in the group The data content of the data unit, and the validity of each frame of the data unit in the group, and the second output result of the corresponding position of each frame of the data unit in each group is synchronously calculated;
根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;Calculating each time according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group a third output result of the next set of all data units of the group to the corresponding position of the M/N frame data unit;
将每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC输出值;其中,所述输出结果包括第一输出结果、第二输出结果,或者包括第一输出结果、第二输出结果、第三输出结果;Performing an exclusive-OR calculation on the output result of the corresponding position of the data unit of each frame to obtain a CRC output value corresponding to each data unit of the frame; wherein the output result includes the first output result, the second output result, or the first output result, a second output result, a third output result;
定义所述数据信息中最后一级数据中最后一帧数据单元对应的CRC输出值为所述数据信息的CRC值;Defining a CRC output value corresponding to a last frame data unit in the last level data in the data information as a CRC value of the data information;
其中,当所述数据信息为待发送类型,所述CRC值用于嵌入所述数据信息,与所述数据信息一并发送至接收端,以使数据接收端根据自身生成的第一CRC值与所述CRC值的比对结果,判断所接收的数据信息是否出错;当所述数据信息为已接收类型,所述CRC值用于与所述数据信息中嵌入的第二CRC值进行大小比对,以使数据接收端根据比对结果判断所述数据信息是否出错。Wherein, when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to a receiving end, so that the data receiving end generates a first CRC value according to itself. Determining, by the comparison result of the CRC value, whether the received data information is erroneous; when the data information is of a received type, the CRC value is used for size comparison with a second CRC value embedded in the data information. So that the data receiving end determines whether the data information is in error according to the comparison result.
可选地,在所述根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果的步骤之前,所述的循环冗余校验码的生成方法还包括:Optionally, before the step of calculating the first output result of the corresponding position of each data unit according to the CRC input value and the validity of the data unit per frame, the cyclic redundancy check code is The generation method also includes:
为第1帧数据单元配置相应的第一计算函数;Configuring a corresponding first calculation function for the first frame data unit;
针对第i帧数据单元,i为自然数,且M/N≥i≥2,计算第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数;For the i-th frame data unit, i is a natural number, and M/N ≥ i ≥ 2, calculate the possible combinations of the validity of the data units of the first frame to the (i-1)th frame, and configure a corresponding for each combination. First calculation function;
所述根据CRC输入值以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果的步骤包括: The step of calculating a first output result of a corresponding position of each data unit according to the CRC input value and the validity of the data unit per frame includes:
定义前一级数据中最后一帧数据单元所对应的CRC输出值为当前级的CRC输入值;根据每帧所述数据单元的有效性情况,为当前级数据中每帧数据单元分配相应的第一计算函数的输入数据;Defining the CRC output value corresponding to the last frame data unit in the previous level data is the CRC input value of the current level; according to the validity of the data unit in each frame, assigning a corresponding number to each data unit in the current level data An input data of a calculation function;
针对第1帧数据单元,通过相应的第一计算函数以相应的输入数据作为输入值,计算所述第1帧数据单元对应位置的第一输出结果;For the data unit of the first frame, the first output result of the corresponding position of the data unit of the first frame is calculated by using the corresponding first input function as the input value by the corresponding first calculation function;
针对第i帧数据单元,根据第1帧至第(i-1)帧数据单元实际有效性情况,查找相应的第一计算函数,根据相应的输入数据通过相应的第一计算函数,计算所述第i帧数据单元对应位置的第一输出结果。For the ith frame data unit, according to the actual validity of the data unit of the first frame to the (i-1)th frame, searching for a corresponding first calculation function, and calculating the corresponding first calculation function according to the corresponding input data The first output result of the position corresponding to the i-th frame data unit.
可选地,所述针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效情况,计算每组中每帧数据单元对应位置的第二输出结果的步骤之前,所述的循环冗余校验码的生成方法还包括:Optionally, for each group of data units, calculating a second output corresponding to a position of each frame of data units in each group according to data content of all data units in the group and validity of each frame of data units in the group Before the step of the result, the method for generating the cyclic redundancy check code further includes:
为每一组数据单元中的第1帧数据单元配置相应的第二计算函数;Configuring a corresponding second calculation function for the first frame data unit in each group of data units;
针对每一组数据单元中的第j帧数据单元,每组中数据单元总帧数≥j≥2,计算第1帧至第(j-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第二计算函数;For the jth frame data unit in each group of data units, the total number of data units in each group is ≥j≥2, and the possible combinations of the validity of the data units of the first frame to the (j-1)th frame are calculated. Each combination is configured with a corresponding second calculation function;
确定每一组中每一帧数据单元相应的第二计算函数的输入数据;Determining input data of a corresponding second calculation function of each frame of data units in each group;
所述针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效情况,计算每组中每帧数据单元对应位置的第二输出结果的步骤包括:The step of calculating, according to the data content of all data units in the group, and the validity of each data unit in the group for each group of data units, the second output result of calculating the corresponding position of each frame of the data unit in each group includes :
针对每一组的第1帧数据单元,根据相应的输入数据通过相应的第二计算函数,计算本组中第1帧数据单元对应位置的第二输出结果;For each group of the first frame data unit, the second output result of the corresponding position of the data unit of the first frame in the group is calculated according to the corresponding input data through the corresponding second calculation function;
针对每一组中第j帧数据单元,根据本组中第1帧至第(j-1)帧数据单元的实际有效性情况,查找相应的第二计算函数,通过相应的第二计算函数以相应的输入数据作为输入值,计算本组中第j帧数据单元对应位置的第二输出结果。For the jth frame data unit in each group, according to the actual validity of the data units of the first frame to the (j-1)th frame in the group, the corresponding second calculation function is searched, and the corresponding second calculation function is used. The corresponding input data is used as an input value, and the second output result of the corresponding position of the data unit of the jth frame in the group is calculated.
可选地,所述根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该最后一帧数据单元至(M/N-1)帧数据单元的有效情况,计算每该组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输 出结果的步骤之前,所述的循环冗余校验码的生成方法还包括:Optionally, the second output result according to the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit, The third group of all the data units of the group to the corresponding position of the M/N frame data unit Before the step of generating the result, the method for generating the cyclic redundancy check code further includes:
针对以第f组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第f+1组至第Q组中每帧数据单元对应位置的第三输出结果的情况,确定所述第f组最后一帧数据单元至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;Determining, by using the second output result of the corresponding position of the last frame data unit in the fth group as the input data, the third output result of the corresponding position of the data unit of each frame in the f+1th group to the Qth group, determining the a possible combination of the data unit of the last frame of the fth group to the data unit of each of the third output results for which the corresponding position needs to be calculated, (Q-1) ≥ f ≥ 1;
为每个需要计算对应位置的第三输出结果的数据单元的每一种组合配置一个相应的第三计算函数,确定每个第三计算函数的输入数据;Configuring a respective third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determining input data of each third calculation function;
所述根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该最后一帧数据单元至(M/N-1)帧数据单元的有效情况,计算每该组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果的步骤包括:Calculating the second output result according to the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit, calculating the lower of each group The steps of a third output of all the data units to the corresponding locations of the M/N frame data units include:
确定当前需要计算对应位置的第三输出结果的数据单元W;Determining a data unit W that currently needs to calculate a third output result of the corresponding location;
若该数据单元为第f+1组中第1帧数据单元至第M/N帧数据单元中的任何一帧数据单元,根据第f组最后一帧数据单元至当前需要计算对应位置的第三输出结果的数据单元的实际有效性情况,查找相应的第三计算函数;If the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the data unit of the last frame of the fth group, the third position corresponding to the current position is calculated. Output the actual validity of the data unit of the result, and find the corresponding third calculation function;
通过相应的第三计算函数以所述输入数据作为输入值,计算所述数据单元W对应位置的第三输出结果。A third output result of the corresponding position of the data unit W is calculated by the corresponding third calculation function using the input data as an input value.
可选地,所述对每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC值的步骤包括:Optionally, the step of performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit, and obtaining the CRC value corresponding to each data unit of the frame includes:
当某一帧数据单元对应位置的输出结果包括第一输出结果、第二输出结果,则通过对所述第一输出结果、第二输出结果进行异或计算,得出该帧数据单元对应位置的CRC值;When the output result of the corresponding position of the data unit of the certain frame includes the first output result and the second output result, the corresponding output position of the frame data unit is obtained by performing an exclusive-OR calculation on the first output result and the second output result. CRC value;
当某一帧数据单元计算出的输出结果包括第一输出结果、第二输出结果、第三输出结果,则通过对所述第一输出结果、第二输出结果、第三输出结果进行异或计算,得出该帧数据单元对应位置的CRC值。When the output result calculated by the data unit of a certain frame includes the first output result, the second output result, and the third output result, performing exclusive-OR calculation on the first output result, the second output result, and the third output result The CRC value of the corresponding position of the frame data unit is obtained.
本申请另外提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现上述方法。 The application further provides a computer readable storage medium storing computer executable instructions that are implemented when the computer executable instructions are executed.
此外,本申请还提供一种循环冗余校验码的生成装置,所述循环冗余校验码的生成装置包括:In addition, the application further provides a device for generating a cyclic redundancy check code, where the device for generating a cyclic redundancy check code includes:
划分模块,设置为获取数据信息,根据所述数据信息中每一级的数据量为M比特,将所述每一级数据划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组;a dividing module, configured to acquire data information, according to the data amount of each level in the data information being M bits, and dividing each level of data into data units having an M/N frame width of N bits, The M/N frame data unit is divided into Q groups;
第一输出结果计算模块,设置为针对每一级数据,根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;a first output result calculation module, configured to calculate, for each level of data, a first output result corresponding to a position of each data unit according to a CRC input value and a validity condition of the data unit per frame;
第二输出结果计算模块,设置为针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果;a second output result calculation module is configured to, for each group of data units, synchronously calculate a data unit corresponding to each frame in each group according to data content of all data units in the group and validity of each frame of data units in the group The second output of the location;
第三输出结果计算模块,设置为根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;a third output result calculation module, configured to be a second output result according to a corresponding position of the last frame data unit in each group of data units, and a last frame data unit to the (M/N-1) frame data unit in the group The validity of the situation, synchronously calculating the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit;
CRC值计算模块,设置为将每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC输出值;其中,所述输出结果包括第一输出结果、第二输出结果,或者包括第一输出结果、第二输出结果、第三输出结果;The CRC value calculation module is configured to perform an exclusive-OR calculation on the output result of the corresponding position of the data unit of each frame to obtain a CRC output value corresponding to each data unit of the frame; wherein the output result includes the first output result and the second output result, Or including a first output result, a second output result, and a third output result;
定义模块,设置为定义所述数据信息中最后一级数据中最后一帧数据单元对应的CRC输出值为所述数据信息的CRC值;a definition module, configured to define a CRC output value corresponding to a last frame data unit in the last level data in the data information, as a CRC value of the data information;
其中,当所述数据信息为待发送类型,所述CRC值用于嵌入所述数据信息,与所述数据信息一并发送至接收端,以使数据接收端根据自身生成的第一CRC值与所述CRC值的比对结果,判断所接收的数据信息是否出错;当所述数据信息为已接收类型,所述CRC值用于与所述数据信息中嵌入的第二CRC值进行大小比对,以使数据接收端根据比对结果判断所述数据信息是否出错;Wherein, when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to a receiving end, so that the data receiving end generates a first CRC value according to itself. Determining, by the comparison result of the CRC value, whether the received data information is erroneous; when the data information is of a received type, the CRC value is used for size comparison with a second CRC value embedded in the data information. So that the data receiving end determines whether the data information is erroneous according to the comparison result;
所述第一输出结果计算模块与所述第二输出结果计算模块同步执行相关 操作。The first output result calculation module is synchronously executed with the second output result calculation module operating.
可选地,所述的循环冗余校验码的生成装置还包括:Optionally, the generating device of the cyclic redundancy check code further includes:
第一计算函数配置模块,设置为在所述第一输出结果计算模块计算每帧数据单元对应位置的第一输出结果之前,为第1帧数据单元配置相应的第一计算函数;以及针对第i帧数据单元,i为自然数,且M/N≥i≥2,计算第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数;a first calculation function configuration module configured to: configure a first first calculation function for the first frame data unit before the first output result calculation module calculates a first output result of the corresponding position of each frame of the data unit; and for the ith a frame data unit, i is a natural number, and M/N ≥ i ≥ 2, a possible combination of the validity of the data units of the first frame to the (i-1)th frame is calculated, and a corresponding first is configured for each combination Calculation function
所述第一输出结果计算模块包括:The first output result calculation module includes:
输入数据确定单元,设置为定义前一级数据中最后一帧数据单元所对应的CRC输出值为当前级的CRC输入值;根据每帧所述数据单元的有效性情况,为当前级数据中每帧数据单元分配相应的第一计算函数的输入数据;The input data determining unit is configured to define a CRC output value corresponding to the CRC output value of the last frame data unit in the previous level data, and a current level CRC input value according to the validity of the data unit in each frame, The frame data unit allocates input data of the corresponding first calculation function;
第一输出结果计算单元,设置为针对第1帧数据单元,通过相应的第一计算函数以相应的输入数据作为输入值,计算所述第1帧数据单元对应位置的第一输出结果;以及针对第i帧数据单元,根据第1帧至第(i-1)帧数据单元实际有效性情况,查找相应的第一计算函数,根据相应的输入数据通过相应的第一计算函数,计算所述第i帧数据单元对应位置的第一输出结果。a first output result calculation unit configured to calculate, for the first frame data unit, a first output result of the corresponding position of the first frame data unit by using a corresponding first input function as the input value by the corresponding first calculation function; The i-th frame data unit searches for a corresponding first calculation function according to the actual validity of the data unit of the first frame to the (i-1)th frame, and calculates the first by a corresponding first calculation function according to the corresponding input data. The i-frame data unit corresponds to the first output of the location.
可选地,所述的循环冗余校验码的生成装置还包括:Optionally, the generating device of the cyclic redundancy check code further includes:
第二计算函数配置模块,设置为在所述第二输出结果计算模块计算每组中每帧数据单元对应位置的第二输出结果之前,为每一组数据单元中的第1帧数据单元配置相应的第二计算函数;以及针对每一组数据单元中的第j帧数据单元,每组中数据单元总帧数≥j≥2,计算第1帧至第(j-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第二计算函数;a second calculation function configuration module configured to: configure, corresponding to the first frame data unit in each group of data units, before the second output result calculation module calculates a second output result of the corresponding position of each frame of the data unit in each group a second calculation function; and for the j-th frame data unit in each set of data units, the total number of data units in each group is ≥ j ≥ 2, and the validity of the data unit of the first frame to the (j-1)th frame is calculated. a possible combination of sexual conditions, configuring a corresponding second calculation function for each combination;
输入数据确定模块,设置为确定每一组中每一帧数据单元相应的第二计算函数的输入数据;An input data determining module configured to determine input data of a second computing function corresponding to each frame of data units in each group;
所述第二输出结果计算模块,设置为针对每一组的第1帧数据单元,根据相应的输入数据通过相应的第二计算函数,计算本组中第1帧数据单元对应位置的第二输出结果;以及针对每一组中第j帧数据单元,根据本组中第1帧至第(j-1)帧数据单元的实际有效性情况,查找相应的第二计算函数,通 过相应的第二计算函数以相应的输入数据作为输入值,计算本组中第j帧数据单元对应位置的第二输出结果。The second output result calculation module is configured to calculate, according to the first frame data unit of each group, a second output corresponding to the corresponding position of the first frame data unit in the group by using a corresponding second calculation function according to the corresponding input data. a result; and for the jth frame data unit in each group, according to the actual validity of the data unit of the first frame to the (j-1)th frame in the group, searching for a corresponding second calculation function, The second output result of the corresponding position of the data unit of the jth frame in the group is calculated by using the corresponding second calculation function as the input value.
可选地,所述的循环冗余校验码的生成装置还包括:Optionally, the generating device of the cyclic redundancy check code further includes:
确定模块,设置为在所述第三输出结果计算模块计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果之前,针对以第f组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第f+1组至第Q组中每帧数据单元对应位置的第三输出结果的情况,确定所述第f组最后一帧数据单元至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;a determining module, configured to: before the third output result calculating module calculates a third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit, for the last one in the fth group And determining, as the input data, a second output result of the corresponding position of the frame data unit, calculating a third output result of the corresponding position of the data unit of each frame in the f+1th group to the Qth group, and determining the last frame data unit of the fth group a possible combination of the validity of each data unit that needs to calculate a third output result of the corresponding position, (Q-1) ≥ f ≥ 1;
第三计算函数配置模块,设置为为每个需要计算对应位置的第三输出结果的数据单元的每一种组合配置一个相应的第三计算函数,确定每个第三计算函数的输入数据;a third calculation function configuration module, configured to configure a corresponding third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determine input data of each third calculation function;
所述第三输出结果计算模块包括:The third output result calculation module includes:
确定单元,设置为确定当前需要计算对应位置的第三输出结果的数据单元W;a determining unit, configured to determine a data unit W that currently needs to calculate a third output result of the corresponding position;
第三计算函数查找单元,设置为若该数据单元为第f+1组中第1帧数据单元至第M/N帧数据单元中的任何一帧数据单元,根据第f组最后一帧数据单元至当前需要计算对应位置的第三输出结果的数据单元的实际有效性情况,查找相应的第三计算函数;a third calculation function searching unit configured to: if the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the last frame data unit of the fth group Up to the current need to calculate the actual validity of the data unit of the third output result of the corresponding position, and find a corresponding third calculation function;
第三输出结果计算单元,设置为通过相应的第三计算函数以所述输入数据作为输入值,计算所述数据单元W对应位置的第三输出结果。The third output result calculation unit is configured to calculate a third output result of the corresponding position of the data unit W by using the input data as an input value through a corresponding third calculation function.
可选地,所述的循环冗余校验码的生成装置,所述CRC值计算模块设置为当某一帧数据单元对应位置的输出结果包括第一输出结果、第二输出结果,则通过对所述第一输出结果、第二输出结果进行异或计算,得出该帧数据单元对应位置的CRC值;以及当某一帧数据单元计算出的输出结果包括第一输出结果、第二输出结果、第三输出结果,则通过对所述第一输出结果、第二输出结果、第三输出结果进行异或计算,得出该帧数据单元对应位置的CRC值。 Optionally, the generating device of the cyclic redundancy check code, the CRC value calculating module is configured to: when the output result of the corresponding position of the data unit of the certain frame includes the first output result and the second output result, The first output result and the second output result are XORed to obtain a CRC value corresponding to the position of the frame data unit; and the output result calculated by the data unit of the certain frame includes the first output result and the second output result And the third output result is obtained by performing an exclusive-OR calculation on the first output result, the second output result, and the third output result to obtain a CRC value corresponding to the position of the frame data unit.
本申请所提供的循环冗余校验码的生成方法和装置,通过根据数据信息的数据量为M比特,将所述数据信息划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组;根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;在计算每帧数据单元对应位置的第一输出结果的同时,同步执行针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果的操作;然后根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;将每帧数据单元对应位置的输出结果进行异或计算的方式,得到每帧数据单元对应的CRC值,大大地缩短了每帧数据单元对应位置的CRC值的计算时间,提高了CRC值的计算频率,降低了芯片计算CRC值所占的资源和功耗。The method and apparatus for generating a cyclic redundancy check code provided by the present application divides the data information into data units having an M/N frame width of N bits according to the data amount of the data information being M bits. The M/N frame data unit is divided into Q groups; according to the CRC input value and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; and the corresponding position of the data unit of each frame is calculated. Simultaneously calculating the first output result, simultaneously performing data unit for each group in each group according to the data content of all data units in the group and the validity of each data unit in the group for each group of data units The operation of the second output result corresponding to the position; then the second output result according to the corresponding position of the last frame data unit in each group of data units, and the last frame data unit to the (M/N-1) frame in the group The validity of the data unit, synchronously calculate the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit; The result of the XOR calculation results in the CRC value corresponding to each frame of the data unit, which greatly shortens the calculation time of the CRC value of the corresponding position of the data unit of each frame, improves the calculation frequency of the CRC value, and reduces the chip calculation CRC value. The resources and power consumption.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为本申请的的循环冗余校验码的生成方法一实施例的流程示意图;1 is a schematic flowchart of an embodiment of a method for generating a cyclic redundancy check code according to the present application;
图2为图1中步骤S20的具体细化流程示意图;2 is a schematic diagram of a specific refinement process of step S20 in FIG. 1;
图3为图1中步骤S20的具体数据信号和控制信号的走向示意图;3 is a schematic diagram of a specific data signal and a control signal of step S20 in FIG. 1;
图4为图1中步骤S30的具体数据信号和控制信号的走向示意图;4 is a schematic diagram of a specific data signal and a control signal of step S30 in FIG. 1;
图5为图1中步骤S40的具体数据信号和控制信号走向示意图;5 is a schematic diagram of specific data signals and control signal directions of step S40 in FIG. 1;
图6为图1中步骤S40的另一具体数据信号和控制信号的走向示意图;6 is a schematic diagram showing the direction of another specific data signal and control signal in step S40 of FIG. 1;
图7为本申请的循环冗余校验码的生成装置一个实施例的功能模块示意图;FIG. 7 is a schematic diagram of functional modules of an embodiment of a device for generating a cyclic redundancy check code according to the present application; FIG.
图8为本申请的循环冗余校验码的生成装置另一实施例的功能模块示意图; 8 is a schematic diagram of functional modules of another embodiment of a device for generating a cyclic redundancy check code according to the present application;
图9为图8中第一输出结果计算模块的具体细化功能模块示意图;9 is a schematic diagram of a specific refinement function module of the first output result calculation module in FIG. 8;
图10为本申请的循环冗余校验码的生成装置又一实施例的功能模块示意图;FIG. 10 is a schematic diagram of functional modules of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application; FIG.
图11为本申请的循环冗余校验码的生成装置又一实施例的功能模块示意图;11 is a schematic diagram of functional blocks of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application;
图12为图11中第三输出结果计算模块的具体细化功能模块示意图。FIG. 12 is a schematic diagram of a specific refinement function module of the third output result calculation module in FIG. 11.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features and advantages of the present application will be further described with reference to the accompanying drawings.
本发明的较佳实施方式Preferred embodiment of the invention
以下结合说明书附图对本申请的可选实施例进行说明,应当理解,此处所描述的可选实施例仅用于说明和解释本申请,并不用于限定本申请,并且在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The following is a description of the embodiments of the present invention in conjunction with the accompanying drawings. It is understood that the embodiments described herein are merely illustrative and are not intended to limit the application, and Landosphere in the embodiment and in the embodiments can be businessed together.
本申请提供一种循环冗余校验码的生成方法。参照图1,图1为本申请的循环冗余校验码的生成方法一实施例的流程示意图。在该实施例中,所述循环冗余校验码的生成方法包括:The application provides a method for generating a cyclic redundancy check code. Referring to FIG. 1, FIG. 1 is a schematic flowchart diagram of an embodiment of a method for generating a cyclic redundancy check code according to the present application. In this embodiment, the method for generating the cyclic redundancy check code includes:
步骤S10、获取数据信息,根据所述数据信息中每一级的数据量为M比特,将所述每一级数据划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组。Step S10: Obtaining data information, according to the data quantity of each level in the data information being M bits, dividing each level of data into data units having an M/N frame width of N bits, and the M/ The N frame data unit is divided into Q groups.
本申请中所述Q组中的每组中数据单元帧数可以相同也可以不同,本实施例为相同。The number of data unit frames in each group in the Q group described in this application may be the same or different, and the embodiment is the same.
步骤S20、针对每一级数据,根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果。Step S20: For each level of data, calculate a first output result of a corresponding position of each data unit according to a CRC input value and a validity condition of the data unit per frame.
本实施例中在计算每帧数据单元对应位置的第一输出结果之前需要为每帧数据单元配置相应的第一计算函数。即在步骤S20之前还包括如下处理:为第1帧数据单元配置相应的第一计算函数;针对第i帧数据单元,i为自然数,且M/N≥i≥2,确定第1帧至第(i-1)帧数据单元的有效性情况的可能组合, 为每一种组合配置一个相应的第一计算函数。本申请中每帧数据单元可能是有效的也可能是无效的,每帧数据单元的有效性情况包括两种:一种是该帧数据单元有效,另一种是该帧数据单元无效。当i为大于等于3的自然数时,则第1帧至第(i-1)帧数据单元的有效性情况的可能组合包括多种。本申请中可以“0”作为有效标识、“1”作为无效标识;假设i=3,则第1帧至第(i-1)帧数据单元包括:第1帧数据单元和第2帧数据单元,其中第1帧数据单元的有效性情况为有效“0”或无效“1”;第2帧数据单元的有效性情况为有效“0”或无效“1”。因此第1、2帧数据单元的有效性情况可能的组合包括以下四种:第1帧数据单元有效“0”、第2帧数据单元有效“0”;第1帧数据单元有效“0”、第2帧数据单元无效“1”;第1帧数据单元有效“0”;第2帧数据单元无效“1”;第1帧数据单元无效“1”;第2帧数据单元无效“1”。In this embodiment, a corresponding first calculation function needs to be configured for each frame of data units before calculating the first output result of the corresponding position of each frame of the data unit. That is, before step S20, the method further includes: configuring a corresponding first calculation function for the first frame data unit; i is a natural number for the i-th frame data unit, and M/N≥i≥2, determining the first frame to the first frame (i-1) a possible combination of the validity of the frame data unit, A corresponding first calculation function is configured for each combination. The data unit of each frame in this application may be valid or invalid, and the validity of each frame of data unit includes two types: one is that the frame data unit is valid, and the other is that the frame data unit is invalid. When i is a natural number greater than or equal to 3, the possible combinations of the validity conditions of the data units of the first frame to the (i-1)th frame include a plurality of types. In the present application, "0" can be used as a valid identifier, and "1" is used as an invalid identifier; if i=3, the first to the (i-1)th frame data units include: a first frame data unit and a second frame data unit. The validity of the data unit of the first frame is valid "0" or invalid "1"; the validity of the data unit of the second frame is valid "0" or invalid "1". Therefore, the possible combinations of the validity conditions of the first and second frame data units include the following four types: the first frame data unit is valid "0", the second frame data unit is valid "0"; the first frame data unit is valid "0", The second frame data unit is invalid "1"; the first frame data unit is valid "0"; the second frame data unit is invalid "1"; the first frame data unit is invalid "1"; the second frame data unit is invalid "1".
参见图2,图2为图1中步骤S20的细化流程图。所述步骤S20包括:Referring to FIG. 2, FIG. 2 is a detailed flowchart of step S20 in FIG. The step S20 includes:
步骤S21、定义前一级数据中最后一帧数据单元所对应的CRC输出值为当前级的CRC输入值;根据每帧所述数据单元的有效性情况,为当前级数据中每帧数据单元分配相应的第一计算函数的输入数据。Step S21: defining a CRC output value corresponding to the last frame data unit in the previous level data as a CRC input value of the current level; and assigning each data unit in the current level data according to the validity of the data unit in each frame. Corresponding input data of the first calculation function.
本申请中每帧数据单元的有效性情况包括两种:有效、无效,其中可以“0”作为有效标识、“1”作为无效标识。The validity of each frame of data unit in the present application includes two types: valid and invalid, wherein "0" can be used as a valid identifier and "1" as an invalid identifier.
步骤S22、针对第1帧数据单元,通过相应的第一计算函数以相应的输入数据作为输入值,计算所述第1帧数据单元对应位置的第一输出结果。Step S22: For the first frame data unit, calculate a first output result of the corresponding position of the first frame data unit by using a corresponding first input function as the input value by the corresponding first calculation function.
步骤S23、针对第i帧数据单元,根据第1帧至第(i-1)帧数据单元实际有效性情况,查找相应的第一计算函数,根据相应的输入数据通过相应的第一计算函数,计算所述第i帧数据单元对应位置的第一输出结果。Step S23, searching for a corresponding first calculation function according to the actual validity of the data unit of the first frame to the (i-1)th frame for the ith frame data unit, and passing the corresponding first calculation function according to the corresponding input data. Calculating a first output result of the corresponding position of the ith frame data unit.
参见图3,图3为图1中步骤S20的数据信号和控制信号的走向示意图。图3以M为1536比特的数据信息为例,将数据信息划分为1536/64=24帧数据单元,每帧数据单元的位宽为64比特,将24帧数据单元划分为帧数相同的三组:第一组包括第1帧数据单元DATA0至第8帧数据单元DATA7;第二组包括第9帧数据单元DATA8至第16帧数据单元DATA15;第三组包括第17帧数据单元DATA16至第24帧数据单元DATA23。首先判断控制信号中的前一级数据的最后一帧数据单元的有效性信号“前一级CTRLIN[23]” 的值为“0”还是“1”,若为“0”则前一级CRC值pre_crc=CRC输入值;若为“1”则pre_crc=32‘hffff ffff;并将该pre_crc作为输入数据供每个第一计算函数选择。对于第1帧数据单元DATA0配置第一计算函数为C63_0,并选择确定pre_crc作为C63_0的输入数据。针对第i(i≥2)帧数据单元,预先确定第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数。以第3帧数据单元DATA2为例,第2帧数据单元DATA1无效“1”,配置第一计算函数为C63_0,选择确定32'hffff_ffff作为第一计算函数C63_0的输入数据。第2帧数据单元DATA1有效“0”,第1帧数据单元DATA0无效“1”,配置第一计算函数为C127_0,选择32'hffff_ffff作为第一计算函数C127_0的输入数据。其他有效性情况下,配置第一计算函数为C191_0,选择确定pre_crc作为第一计算函数C191_0的输入数据。而在实际计算过程中输入的控制信号CTRLIN[23:0]包含第1帧数据单元DATA0至第24帧数据单元DATA23的实际有效性标识。第1帧至第(i-1)帧数据单元实际有效性情况有且只有一种,首先根据控制信号CTRLIN[23:0]查找第1帧至第(i-1)帧数据单元实际有效性情况组合属于哪何种组合,然后查找该组合对应的第一计算函数,再通过所查找到的第一计算函数以相应的输入数据作为输入值计算该第i帧数据单元对应位置的第一输出结果。以第3帧数据单元DATA2为例,当控制信号中的CTRLIN[1:0]的值为“2'b01”,则表示计算第3帧数据单元DATA2对应位置的第一输出结果所需要的第1帧数据单元DATA0至第2=(3-1)帧数据单元DATA1实际有效性情况为:第2帧数据单元DATA1有效“0”,第1帧数据单元DATA0无效“1”,其对应的第一计算函数为C127_0,输入数据为32'hffff_ffff,即通过第一计算函数为C127_0,以输入数据32'hffff_ffff作为输入值计算第3帧数据单元DATA2的第一输出结果C_OUT2。另外计算第2帧数据单元及其后续的数据单元对应位置的第一输出结果原理与计算所述第3帧数据单元对应位置的第一输出结果的原理基本相同,具体参见图3,在此不再赘述。Referring to FIG. 3, FIG. 3 is a schematic diagram of the direction of the data signal and the control signal in step S20 of FIG. Figure 3 takes the data information of M 1536 bits as an example, and divides the data information into 1536/64=24 frame data units. The bit width of each data unit is 64 bits, and the 24 data units are divided into three frames with the same number of frames. Group: the first group includes the first frame data unit DATA0 to the eighth frame data unit DATA7; the second group includes the ninth frame data unit DATA8 to the 16th frame data unit DATA15; the third group includes the 17th frame data unit DATA16 to 24 frame data unit DATA23. First, the validity signal "previous level CTRLIN[23]" of the last frame data unit of the previous level data in the control signal is judged. The value of "0" is "0" or "1". If it is "0", the previous CRC value is pre_crc=CRC input value; if it is "1", pre_crc=32'hffff ffff; and the pre_crc is used as input data for each The first calculation function selection. The first calculation function is configured as C63_0 for the first frame data unit DATA0, and the input data for determining pre_crc as C63_0 is selected. For the i-th (i ≥ 2) frame data unit, a possible combination of the validity conditions of the first to (i-1)th frame data units is predetermined, and a corresponding first calculation function is configured for each combination. Taking the third frame data unit DATA2 as an example, the second frame data unit DATA1 is invalid "1", the first calculation function is set to C63_0, and the determination 32'hffff_ffff is selected as the input data of the first calculation function C63_0. The second frame data unit DATA1 is valid "0", the first frame data unit DATA0 is invalid "1", the first calculation function is configured as C127_0, and 32'hffff_ffff is selected as the input data of the first calculation function C127_0. In other cases, the first calculation function is configured as C191_0, and the input data determining the pre_crc as the first calculation function C191_0 is selected. The control signal CTRLIN[23:0] input during the actual calculation process includes the actual validity identification of the data unit DATA0 to the 24th data unit DATA23 of the first frame. There is one and only one actual validity condition of the data unit of the first frame to the (i-1)th frame. First, the actual validity of the data unit of the first frame to the (i-1)th frame is searched according to the control signal CTRLIN[23:0]. Which combination of the situation combination belongs to, then finds the first calculation function corresponding to the combination, and then calculates the first output of the corresponding position of the data unit of the ith frame by using the first input function found as the input value result. Taking the data unit DATA2 of the third frame as an example, when the value of CTRLIN[1:0] in the control signal is "2'b01", it indicates that the first output result of the corresponding position of the data unit DATA2 of the third frame is calculated. The actual validity of the data unit DATA0 to the second = (3-1) frame data unit DATA1 is: the second frame data unit DATA1 is valid "0", the first frame data unit DATA0 is invalid "1", and its corresponding A calculation function is C127_0, the input data is 32'hffff_ffff, that is, C127_0 is calculated by the first calculation function, and the first output result C_OUT2 of the third frame data unit DATA2 is calculated with the input data 32'hffff_ffff as an input value. In addition, the principle of calculating the first output result of the corresponding position of the data unit of the second frame and the subsequent data unit is basically the same as the principle of calculating the first output result of the corresponding position of the data unit of the third frame. For details, refer to FIG. Let me repeat.
步骤S30、针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果。 Step S30: For each group of data units, synchronously calculate a second output result of the corresponding position of each frame of the data unit in each group according to the data content of all the data units in the group and the validity of each frame of the data unit in the group. .
本申请中所述步骤S20与所述步骤S30同步进行。Step S20 described in the present application is performed in synchronization with the step S30.
本实施例中,所述本实施例中在计算每组中的每帧数据单元对应位置的第二输出结果之前需要为每组中的每帧数据单元配置相应的第二计算函数。即在本步骤S30之前还包括如下处理:为每一组数据单元中的第1帧数据单元配置相应的第二计算函数;针对每一组数据单元中的第j帧数据单元,每组中数据单元总帧数≥j≥2,计算第1帧至第(j-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第二计算函数;确定每一组中每一帧数据单元相应的第二计算函数的输入数据。所述步骤S30包括:针对每一组的第1帧数据单元,通过相应的第二计算函数以相应的输入数据作为输入值,计算本组中第1帧数据单元对应位置的第二输出结果;针对每一组中第j帧数据单元,根据本组中第1帧至第(j-1)帧数据单元的实际有效性情况,查找相应的第二计算函数,通过相应的第二计算函数以相应的输入数据作为输入值,计算本组中第j帧数据单元对应位置的第二输出结果。参见图4,图4为图1中步骤S30的数据信号和控制信号的走向示意图。图4中涉及的数据信息与图3中所述的数据信息一致。现结合图4计算第一组中第3帧(DATA2)数据单元的第二输出结果为例,对本步骤S30进行进一步的描述。第一组中第1帧(DATA0)至第2帧(DATA1)数据单元的有效性情况的可能组合包括:第2帧无效“1”;第2帧有效“0”、第1帧无效“1”;其他有效性情况。第2帧无效“1”,对应配置的第二计算函数为D63_0,输入数据为(DATA2);第2帧有效“0”、第1帧无效“1”,对应配置的第二计算函数为D63_0^D127_64,其中D63_0的输入数据为DATA2;D127_64的输入数据DATA1;其他有效性情况,对应配置的第二计算函数为D63_0^D127_64^D191_128,其中D63_0的输入数据为DATA2;D127_64的输入数据为DATA1;D191_128的输入数据为DATA0。在实际计算过程中当输入的控制信号CTRLIN[1:0]的值为“2'b01”,表示针对计算第3帧数据单元(DATA2)对应位置的第二输出结果,第2帧数据单元DATA1有效“0”、第1帧数据单元无效“1”,选择采用D63_0^D127_64作为计算第3帧数据单元(DATA2)对应位置的第二输出结果的第二计算函数,其中D63_0的输入数据为DATA2,D127_64的输入数据为DATA1。本组中计算其他数据单元对应位置的第二输出结果原理一致,同时计算其他组的数据单元对应位置的第二输出结果与第1组原理一致,在 此不再赘述。另外本申请中每一组的数据单元对应位置的第二输出结果的计算过程为同步进行,如此设计大大地缩短了所有数据单元对应位置的第二输出结果的计算时间,提高第二输出结果的计算频率,减少了资源的使用。In this embodiment, in the present embodiment, before calculating the second output result of the corresponding position of each frame of the data unit in each group, a corresponding second calculation function needs to be configured for each frame of the data unit in each group. That is, before the step S30, the method further includes: configuring a corresponding second calculation function for the first frame data unit in each group of data units; and data in each group for the jth frame data unit in each group of data units The total number of frames of the unit ≥ j ≥ 2, the possible combinations of the validity of the data units of the first frame to the (j-1)th frame are calculated, and a corresponding second calculation function is configured for each combination; The input data of the corresponding second calculation function of each frame of data unit. The step S30 includes: calculating, for each frame of the first frame data unit, a second output result of the corresponding position of the data unit of the first frame in the group by using a corresponding second input function as the input value; For the jth frame data unit in each group, according to the actual validity of the data unit of the first frame to the (j-1)th frame in the group, the corresponding second calculation function is searched, and the corresponding second calculation function is used to The corresponding input data is used as an input value to calculate a second output result of the corresponding position of the data unit of the jth frame in the group. Referring to FIG. 4, FIG. 4 is a schematic diagram of the direction of the data signal and the control signal in step S30 of FIG. The data information referred to in FIG. 4 is identical to the data information described in FIG. The second output result of the third frame (DATA2) data unit in the first group is calculated by taking FIG. 4 as an example, and the step S30 is further described. Possible combinations of the validity of the data unit of the first frame (DATA0) to the second frame (DATA1) in the first group include: invalidation of "1" for the second frame; "0" for the second frame, and "1" for the first frame "; other effectiveness. The second frame is invalid "1", the corresponding second calculation function is D63_0, the input data is (DATA2); the second frame is valid "0", the first frame is invalid "1", and the corresponding second calculation function is D63_0. ^D127_64, where the input data of D63_0 is DATA2; the input data DATA1 of D127_64; for other validity cases, the corresponding second calculation function is D63_0^D127_64^D191_128, wherein the input data of D63_0 is DATA2; the input data of D127_64 is DATA1 The input data of D191_128 is DATA0. In the actual calculation process, when the value of the input control signal CTRLIN[1:0] is "2'b01", indicating the second output result for calculating the corresponding position of the third frame data unit (DATA2), the second frame data unit DATA1 Valid "0", the first frame data unit is invalid "1", and D63_0^D127_64 is selected as the second calculation function for calculating the second output result of the corresponding position of the third frame data unit (DATA2), wherein the input data of D63_0 is DATA2 The input data of D127_64 is DATA1. The second output result of calculating the corresponding position of other data units in the group is consistent, and the second output result of calculating the corresponding position of the data unit of the other group is consistent with the principle of the first group, This will not be repeated here. In addition, the calculation process of the second output result of the corresponding position of the data unit of each group in the present application is synchronous, and the design greatly shortens the calculation time of the second output result of the corresponding position of all the data units, and improves the second output result. Calculate the frequency and reduce the use of resources.
步骤S40、根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果。Step S40: Synchronize according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group. A third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit is calculated.
本实施例中,在本步骤S40之前还包括如下处理:针对以第f组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第f+1组至第Q组中每帧数据单元对应位置的第三输出结果的情况,确定所述第f组最后一帧数据单元至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;为每个需要计算对应位置的第三输出结果的数据单元的每一种组合配置一个相应的第三计算函数,确定每个第三计算函数的输入数据。所述步骤S40根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该最后一帧数据单元至(M/N-1)帧数据单元的有效情况,计算出该组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果包括如下处理:确定当前需要计算对应位置的第三输出结果的数据单元W;若该数据单元为第f+1组中第1帧数据单元至第M/N帧数据单元中的任何一帧数据单元,则根据第f组最后一帧数据单元至当前需要计算对应位置的第三输出结果的数据单元的实际有效性情况,查找相应的第三计算函数;通过相应的第三计算函数以所述输入数据作为输入值,计算所述数据单元W对应位置的第三输出结果。In this embodiment, before the step S40, the method further includes: processing, for the second output result of the corresponding position of the last frame data unit in the fth group as the input data, each frame in the f+1th group to the Qth group Determining, by the case of the third output result of the corresponding position of the data unit, a possible combination of the validity of the data unit of the last frame of the f-th group to the data unit of each of the third output results requiring calculation of the corresponding position, (Q-1) ≥ f ≥ 1; a corresponding third calculation function is configured for each combination of data units each of which needs to calculate a third output result of the corresponding position, and input data of each third calculation function is determined. The step S40 calculates the group according to the second output result of the corresponding position of the last frame data unit in each group of data units and the validity of the last frame data unit to the (M/N-1) frame data unit. The third output result of the next set of all data units to the corresponding position of the M/N frame data unit includes a process of: determining a data unit W that currently needs to calculate a third output result of the corresponding position; if the data unit is the f+ The data unit of any one of the first frame data unit to the M/N frame data unit of the group 1 is calculated according to the data unit of the last frame of the fth group to the data unit of the third output result of the corresponding position currently needed to be calculated. The validity condition is to find a corresponding third calculation function; the third output result of the corresponding position of the data unit W is calculated by using the input data as an input value by a corresponding third calculation function.
参见图5,图5为图1中步骤S40的具体数据信号和控制信号走向示意图。图5中涉及的数据信息为图3中所述的数据信息一致。现以第1组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第2组至第Q组中每帧数据单元对应位置的第三输出结果为例对本步骤S40进行进一步的描述。首先确定所述第1组最后一帧数据单元(DATA7)至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;例如以第1组中最后一帧数据单元(DATA7)对应位置的第二输出结果作为输 入数据,针对计算第三组的第7帧数据单元(DATA22)的第三输出结果,其中DATA7至DATA22的有效性情况的可能组合包括:DATA22无效“1”、DATA21有效“0”、…DATA9有效“0”、DATA8有效“0”、DATA7有效“0”;其他有效性情况。DATA7至DATA22的有效性情况的组合为:DATA22无效“1”、DATA21有效“0”、…DATA9有效“0”、DATA8有效“0”、DATA7有效“0”,对应配置的第三计算函数为C959_0,第三计算函数C959_0的输入数据为第1组中最后一帧数据单元对应位置的第二输出结果D_OUT7。DATA7至DATA22的有效性情况为其他有效性情况,第三输出结果直接取值为32'h0。在实际计算过程中当输入的控制信号CTRLIN[22:7]的值为“16'b1000000000000000”,表明DATA7至DATA22的有效性情况的组合为:DATA22无效“1”、DATA21有效“0”、…DATA9有效“0”、DATA8有效“0”、DATA7有效“0”,则通过第三计算函数C959_0以输入数据D_OUT7作为输入值计算出DATA22对应位置的第三输出结果。Referring to FIG. 5, FIG. 5 is a schematic diagram of specific data signals and control signal directions in step S40 of FIG. The data information referred to in FIG. 5 is consistent with the data information described in FIG. The second output result of the corresponding position of the data unit of the last frame in the first group is used as the input data, and the third output result of the corresponding position of the data unit of each frame in the second group to the second group is calculated as an example. description. First determining a possible combination of the validity of the first group of data units (DATA7) of the first group to the data unit of each of the third output results for which the corresponding position needs to be calculated, (Q-1) ≥ f ≥ 1; for example The second output result of the corresponding position of the last frame data unit (DATA7) in the first group is used as the input Incoming data, for calculating the third output result of the seventh frame data unit (DATA22) of the third group, wherein the possible combinations of the validity conditions of DATA7 to DATA22 include: DATA22 invalid "1", DATA21 valid "0", ... DATA9 Valid "0", DATA8 valid "0", DATA7 valid "0"; other validity cases. The combination of the validity of DATA7 to DATA22 is: DATA22 invalid "1", DATA21 valid "0", ... DATA9 valid "0", DATA8 valid "0", DATA7 valid "0", the corresponding third calculation function is C959_0, the input data of the third calculation function C959_0 is the second output result D_OUT7 of the corresponding position of the last frame data unit in the first group. The validity of DATA7 to DATA22 is other validity, and the third output directly takes 32'h0. In the actual calculation process, when the value of the input control signal CTRLIN[22:7] is "16'b1000000000000000", it indicates that the combination of the validity of DATA7 to DATA22 is: DATA22 invalid "1", DATA21 valid "0", ... When DATA9 is valid "0", DATA8 is valid "0", and DATA7 is valid "0", the third output result of the corresponding position of DATA22 is calculated by the third calculation function C959_0 using the input data D_OUT7 as an input value.
参见图6,图6为图1中步骤S40的另一具体数据信号和控制信号的走向示意图。图6中涉及的数据信息为图3中所述的数据信息一致。现结合图6以第2组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第3组至第Q组中每帧数据单元对应位置的第三输出结果为例对本步骤S40进行进一步的描述。首先确定所述第2组最后一帧数据单元(DATA15)至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;例如以第2组中最后一帧数据单元(DATA15)对应位置的第二输出结果作为输入数据,针对计算第三组的第7帧数据单元(DATA22)的第三输出结果,其中DATA15至DATA22的有效性情况的可能组合包括:DATA22无效“1”、DATA21有效“0”、…DATA16有效“0”、DATA15有效“0”;其他有效性情况。DATA15至DATA22的有效性情况组合为:DATA22无效“1”、DATA21有效“0”、…DATA16有效“0”、DATA15有效“0”,对应配置的第三计算函数为C447_0,第三计算函数C447_0的输入数据为第2组中最后一帧数据单元对应位置的第二输出结果D_OUT15。DATA15至DATA22的有效性情况组合为其他有效性情况,第三输出结果直接取值为32'h0。在实际计算过程中当输入的控制信号CTRLIN[22:15]的值为“8'b10000000”,表明DATA15至DATA22的有效性情况组合为:DATA22无效“1”、DATA21 有效“0”、…DATA16有效“0”、DATA15有效“0”,则通过第三计算函数C447_0以输入数据D_OUT15作为输入值计算出DATA22的第三输出结果。Referring to FIG. 6, FIG. 6 is a schematic diagram of another specific data signal and a control signal of step S40 in FIG. The data information referred to in FIG. 6 is consistent with the data information described in FIG. Referring to FIG. 6 , the second output result of the corresponding position of the data unit of the last frame in the second group is used as the input data, and the third output result of the corresponding position of each data unit in the third group to the Q group is calculated as an example. Further description is made. First determining a possible combination of the validity of the second group of last frame data units (DATA15) to each of the data units of the third output result requiring calculation of the corresponding position, (Q-1) ≥ f ≥ 1; for example The second output result of the corresponding position of the last frame data unit (DATA15) in the second group is used as input data for calculating the third output result of the seventh frame data unit (DATA22) of the third group, wherein the validity of DATA15 to DATA22 Possible combinations of conditions include: DATA22 invalid "1", DATA21 valid "0", ... DATA16 valid "0", DATA15 valid "0"; other validity cases. The validity of DATA15 to DATA22 is combined: DATA22 invalid "1", DATA21 valid "0", ... DATA16 valid "0", DATA15 valid "0", the corresponding third calculation function is C447_0, the third calculation function C447_0 The input data is the second output result D_OUT15 of the corresponding position of the last frame data unit in the second group. The validity of DATA15 to DATA22 is combined into other validity cases, and the third output result is directly 32'h0. In the actual calculation process, when the value of the input control signal CTRLIN[22:15] is "8'b10000000", it indicates that the validity of DATA15 to DATA22 is combined: DATA22 is invalid "1", DATA21 If "0", DATA16 is valid "0", and DATA15 is "0", the third output result of DATA22 is calculated by the third calculation function C447_0 using the input data D_OUT15 as an input value.
从图5和图6可知第三组中每个数据单元的第三输出结果包括两个,即本申请中第L组的每个数据单元对应位置的第三输出结果个数为(L-1)个。It can be seen from FIG. 5 and FIG. 6 that the third output result of each data unit in the third group includes two, that is, the number of third output results of the corresponding position of each data unit of the Lth group in the present application is (L-1). ).
本申请中以不同组中最后一帧数据单元对应位置的第二输出结果作为输入数据,与作为输入数据的第二输出结果对应的组的下一组至第Q组中每帧数据单元对应位置的第三输出结果的计算过程为同步进行,如此设计大大地缩短了所有数据单元对应位置的第三输出结果的计算时间,提高了第三输出结果的计算频率,减少了资源的使用。In the present application, the second output result of the corresponding position of the last frame data unit in the different groups is used as the input data, and the corresponding position of the data unit of each group in the next group to the Q group corresponding to the second output result corresponding to the input data The calculation process of the third output result is synchronous, and the design greatly shortens the calculation time of the third output result of the corresponding position of all the data units, improves the calculation frequency of the third output result, and reduces the use of resources.
步骤S50、将每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC输出值;所述输出结果包括第一输出结果、第二输出结果,或者包括第一输出结果、第二输出结果、第三输出结果。Step S50: performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit to obtain a CRC output value corresponding to each frame of the data unit; the output result includes the first output result, the second output result, or the first output result , the second output result, and the third output result.
本步骤S50的处理如下:当某一帧数据单元对应位置的输出结果包括第一输出结果、第二输出结果,则通过对所述第一输出结果、第二输出结果进行异或计算,得出该帧数据单元对应位置的CRC值;当某一帧数据单元计算出的输出结果包括第一输出结果、第二输出结果、第三输出结果,则通过对所述第一输出结果、第二输出结果、第三输出结果进行异或计算,得出该帧数据单元对应位置的CRC值。其中不同组中的数据单元对应位置的第三输出结果个数不同,第L组的数据单元对应位置的第三输出结果为(L-1)个。The processing of the step S50 is as follows: when the output result of the corresponding position of the data unit of the certain frame includes the first output result and the second output result, the XOR calculation is performed on the first output result and the second output result. The frame data unit corresponds to a CRC value of the position; when the output result calculated by the frame data unit includes the first output result, the second output result, and the third output result, the first output result and the second output are passed As a result, the third output result is XORed to obtain a CRC value corresponding to the position of the frame data unit. The third output result of the corresponding position of the data unit in the different group is different, and the third output result of the corresponding position of the data unit of the Lth group is (L-1).
现以第一组的第1帧数据单元(DATA0)、第二组的第1帧数据单元(DATA8)、第三组的第1帧数据单元(DATA16)为例对本步骤S50进行举例式说明,由于第一组的第1帧数据单元对应位置的输出结果只包括第一输出结果C_OUT0、第二输出结果D_OUT0,则对该C_OUT0与D_OUT0进行异或计算得到该第1帧数据单元(DATA0)的CRC值。第二组的第1帧数据单元(DATA8)对应位置的输出结果包括第一输出结果C_OUT8、第二输出结果D_OUT8、第三输出结果C_D2_OUT8,则对该C_OUT8、D_OUT8、C_D2_OUT8进行异或计算得到该第二组的第1帧数据单元(DATA8)的CRC值。第三组的第1帧数据单元(DATA16)对应位置的输出结果包括第一输出结果C_OUT16、第二输出结果D_OUT16、第三输出结果C_D2_OUT16 和C_D1_OUT16,则对该C_OUT16、D_OUT16、C_D2_OUT16、C_D1_OUT16进行异或计算得到该第三组的第1帧数据单元(DATA16)的CRC值。This step S50 will be described by taking the first frame data unit (DATA0) of the first group, the first frame data unit (DATA8) of the second group, and the first frame data unit (DATA16) of the third group as an example. Since the output result of the corresponding position of the data unit of the first frame of the first group includes only the first output result C_OUT0 and the second output result D_OUT0, the C_OUT0 and D_OUT0 are XORed to obtain the first frame data unit (DATA0). CRC value. The output result of the corresponding position of the first frame data unit (DATA8) of the second group includes the first output result C_OUT8, the second output result D_OUT8, and the third output result C_D2_OUT8, and the C_OUT8, D_OUT8, C_D2_OUT8 are XORed to obtain the The CRC value of the first frame of data unit (DATA8) of the second group. The output result of the corresponding position of the first frame data unit (DATA16) of the third group includes the first output result C_OUT16, the second output result D_OUT16, and the third output result C_D2_OUT16 And C_D1_OUT16, the C_OUT16, D_OUT16, C_D2_OUT16, C_D1_OUT16 are XORed to obtain the CRC value of the first frame data unit (DATA16) of the third group.
步骤S60、定义所述数据信息中最后一级数据中最后一帧数据单元对应的CRC输出值为所述数据信息的CRC值。Step S60: Define a CRC output value corresponding to a last frame data unit in the last level data in the data information as a CRC value of the data information.
本实施例中,当所述数据信息为待发送类型,所述CRC值用于嵌入所述数据信息,与所述数据信息一并发送至接收端,以使数据接收端根据自身生成的第一CRC值与所述CRC值的比对结果,判断所接收的数据信息是否出错;当所述数据信息为已接收类型,所述CRC值用于与所述数据信息中嵌入的第二CRC值进行大小比对,以使数据接收端根据比对结果判断所述数据信息是否出错。In this embodiment, when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to the receiving end, so that the data receiving end generates the first according to itself. Determining whether the received data information is erroneous as a result of the comparison of the CRC value and the CRC value; when the data information is of a received type, the CRC value is used for performing with a second CRC value embedded in the data information The size is compared, so that the data receiving end determines whether the data information is in error according to the comparison result.
以上实施例所提供的循环冗余校验码的生成方法,通过根据数据信息的数据量为M比特,将所述数据信息划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组;根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;在计算每帧数据单元对应位置的第一输出结果的同时,同步执行针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果的操作;然后根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;将每帧数据单元对应位置的输出结果进行异或计算的方式,得到每帧数据单元对应的CRC值,大大地缩短了每帧数据单元对应位置的CRC值的计算时间,提高了CRC值的计算频率,降低了芯片计算CRC值所占的资源和功耗。The method for generating a cyclic redundancy check code provided by the above embodiment is to divide the data information into data units having an M/N frame width of N bits according to the data amount of the data information being M bits, and the data unit is The M/N frame data unit is divided into Q groups; according to the CRC input value and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; in calculating the corresponding position of each frame of the data unit Simultaneously executing the first output result, the data unit of each group in each group is synchronously calculated according to the data content of all the data units in the group and the validity of each data unit in the group for each group of data units. The operation of the second output result of the position; then the second output result according to the corresponding position of the last frame data unit in each group of data units, and the last frame data unit to the (M/N-1) frame data in the group The validity of the unit, synchronously calculate the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit; the output of the corresponding position of each frame of the data unit As a result, the exclusive-OR calculation method obtains the CRC value corresponding to each frame of data unit, which greatly shortens the calculation time of the CRC value of the corresponding position of the data unit of each frame, improves the calculation frequency of the CRC value, and reduces the calculation of the CRC value by the chip. Accounting for resources and power consumption.
本发明实施例另外提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现上述方法。Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions that are implemented when the computer executable instructions are executed.
本申请进一步提供一种循环冗余校验码的生成装置,参照图7,图7为本申请的循环冗余校验码的生成装置一实施例的功能模块示意图。在该实施例中,该循环冗余校验码的生成装置100包括:划分模块110、第一输出结 果计算模块120、第二输出结果计算模块130、第三输出结果计算模块140、CRC值计算模块150、定义模块160。其中,所述划分模块110设置为获取数据信息,根据所述数据信息中每一级的数据量为M比特,将所述每一级数据划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组。所述第一输出结果计算模块120,设置为针对每一级数据,根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果。所述第二输出结果计算模块130,设置为针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果。所述第三输出结果计算模块140,设置为根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果。所述CRC值计算模块150,设置为将每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC输出值。所述定义模块160,设置为定义所述数据信息中最后一级数据中最后一帧数据单元对应的CRC输出值为所述数据信息的CRC值;所述第一输出结果计算模块与所述第二输出结果计算模块同步执行相关操作。The present application further provides a device for generating a cyclic redundancy check code. Referring to FIG. 7, FIG. 7 is a schematic diagram of functional blocks of an embodiment of a device for generating a cyclic redundancy check code according to the present application. In this embodiment, the cyclic redundancy check code generating apparatus 100 includes: a dividing module 110, and a first output node. The calculation module 120, the second output result calculation module 130, the third output result calculation module 140, the CRC value calculation module 150, and the definition module 160. The dividing module 110 is configured to acquire data information, and divide each level of data into data units with an M/N frame width of N bits according to the data amount of each level in the data information being M bits. And dividing the M/N frame data unit into Q groups. The first output result calculation module 120 is configured to calculate, for each level of data, a first output result corresponding to a position of each frame of the data unit according to the CRC input value and the validity of the data unit per frame. The second output result calculation module 130 is configured to synchronously calculate each frame in each group according to the data content of all data units in the group and the validity of each data unit in the group for each group of data units. The second output of the corresponding location of the data unit. The third output result calculation module 140 is configured to be based on a second output result of the corresponding position of the last frame data unit in each group of data units, and the last frame data unit in the group to the (M/N-1) The validity of the frame data unit, the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit is synchronously calculated. The CRC value calculation module 150 is configured to perform an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit to obtain a CRC output value corresponding to each frame of the data unit. The definition module 160 is configured to define a CRC output value corresponding to a last frame data unit in the last data of the data information, and a CRC value of the data information; the first output result calculation module and the first The two output result calculation modules synchronously perform related operations.
本实施例中,当所述数据信息为待发送类型,所述CRC值用于嵌入所述数据信息,与所述数据信息一并发送至接收端,以使数据接收端根据自身生成的第一CRC值与所述CRC值的比对结果,判断所接收的数据信息是否出错;当所述数据信息为已接收类型,所述CRC值用于与所述数据信息中嵌入的第二CRC值进行大小比对,以使数据接收端根据比对结果判断所述数据信息是否出错。In this embodiment, when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to the receiving end, so that the data receiving end generates the first according to itself. Determining whether the received data information is erroneous as a result of the comparison of the CRC value and the CRC value; when the data information is of a received type, the CRC value is used for performing with a second CRC value embedded in the data information The size is compared, so that the data receiving end determines whether the data information is in error according to the comparison result.
上述循环冗余校验码的生成装置100实施例中所述输出结果包括第一输出结果、第二输出结果,或者包括第一输出结果、第二输出结果、第三输出结果。其中第1组的每个数据单元对应位置的输出结果只包括第一输出结果、第二输出结果。只有第2组及其后续组的每个数据单元对应位置的输出结果包括有第一输出结果、第二输出结果、第三输出结果。另外本申请中所述Q组中的每组中数据单元帧数可以相同也可以不同,本实施例中为相同。 The output result in the embodiment of the above-described cyclic redundancy check code generating apparatus 100 includes a first output result, a second output result, or a first output result, a second output result, and a third output result. The output result of the corresponding position of each data unit of the first group includes only the first output result and the second output result. Only the output result of the corresponding position of each data unit of the second group and its subsequent group includes the first output result, the second output result, and the third output result. In addition, the number of data unit frames in each group in the Q group described in the present application may be the same or different, and is the same in this embodiment.
本实施例中在计算每帧数据单元对应位置的第一输出结果之前需要为每帧数据单元配置相应的第一计算函数。参见图8,图8为本申请的循环冗余校验码的生成装置另一实施例的功能模块示意图。本实施例中所述循环冗余校验码的生成装置100还包括:第一计算函数配置模块170。所述第一计算函数配置模块170,设置为在所述第一输出结果计算模块计算每帧数据单元对应位置的第一输出结果之前,为第1帧数据单元配置相应的第一计算函数;以及针对第i帧数据单元,i为自然数,且M/N≥i≥2,确定第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数。本申请中每帧数据单元可能是有效的也可能是无效的,每帧数据单元的有效性情况包括两种:一种是该帧数据单元有效,另一种是该帧数据单元无效。当i为大于等于3的自然数时,则第1帧至第(i-1)帧数据单元的有效性情况的可能组合包括多种。本申请中可以“0”作为有效标识、“1”作为无效标识;假设i=3,则第1帧至第(i-1)帧数据单元包括:第1帧数据单元和第2帧数据单元,其中第1帧数据单元的有效性情况为有效“0”或无效“1”;第2帧数据单元的有效性情况为有效“0”或无效“1”。因此第1、2帧数据单元的有效性情况可能的组合包括以下四种:第1帧数据单元有效“0”、第2帧数据单元有效“0”;第1帧数据单元有效“0”、第2帧数据单元无效“1”;第1帧数据单元有效“0”;第2帧数据单元无效“1”;第1帧数据单元无效“1”;第2帧数据单元无效“1”。In this embodiment, a corresponding first calculation function needs to be configured for each frame of data units before calculating the first output result of the corresponding position of each frame of the data unit. Referring to FIG. 8, FIG. 8 is a schematic diagram of functional modules of another embodiment of a device for generating a cyclic redundancy check code according to the present application. The apparatus for generating cyclic redundancy check code 100 in this embodiment further includes: a first calculation function configuration module 170. The first calculation function configuration module 170 is configured to configure a corresponding first calculation function for the first frame data unit before the first output result calculation module calculates the first output result of the corresponding position of each frame of the data unit; For the i-th frame data unit, i is a natural number, and M/N ≥ i ≥ 2, determining a possible combination of the validity of the data units of the first frame to the (i-1)th frame, and configuring a corresponding for each combination The first calculation function. The data unit of each frame in this application may be valid or invalid, and the validity of each frame of data unit includes two types: one is that the frame data unit is valid, and the other is that the frame data unit is invalid. When i is a natural number greater than or equal to 3, the possible combinations of the validity conditions of the data units of the first frame to the (i-1)th frame include a plurality of types. In the present application, "0" can be used as a valid identifier, and "1" is used as an invalid identifier; if i=3, the first to the (i-1)th frame data units include: a first frame data unit and a second frame data unit. The validity of the data unit of the first frame is valid "0" or invalid "1"; the validity of the data unit of the second frame is valid "0" or invalid "1". Therefore, the possible combinations of the validity conditions of the first and second frame data units include the following four types: the first frame data unit is valid "0", the second frame data unit is valid "0"; the first frame data unit is valid "0", The second frame data unit is invalid "1"; the first frame data unit is valid "0"; the second frame data unit is invalid "1"; the first frame data unit is invalid "1"; the second frame data unit is invalid "1".
参见图9,图9为图8中第一输出结果计算模块的具体细化功能模块示意图。所述第一输出结果计算模块120包括:输入数据确定单元121和第一输出结果计算单元122。其中所述输入数据确定单元121,设置为定义前一级数据中最后一帧数据单元所对应的CRC输出值为当前级的CRC输入值;根据每帧所述数据单元的有效性情况,为当前级数据中每帧数据单元分配相应的第一计算函数的输入数据。所述第一输出结果计算单元122,设置为针对第1帧数据单元,通过相应的第一计算函数以相应的输入数据作为输入值,计算所述第1帧数据单元对应位置的第一输出结果;以及针对第i帧数据单元,根据第1帧至第(i-1)帧数据单元实际有效性情况,查找相应的第一计算函数,根据相应的输入数据通过相应的第一计算函数,计算所述第i帧数据单元对应位置的第一输出结果。 Referring to FIG. 9, FIG. 9 is a schematic diagram of a specific refinement function module of the first output result calculation module in FIG. The first output result calculation module 120 includes an input data determination unit 121 and a first output result calculation unit 122. The input data determining unit 121 is configured to define a CRC output value corresponding to a CRC output value of a last frame data unit in the previous level data, and a current CRC input value according to the validity of the data unit in each frame. The data unit of each frame in the level data is assigned the input data of the corresponding first calculation function. The first output result calculating unit 122 is configured to calculate, for the first frame data unit, the first output result of the corresponding position of the first frame data unit by using the corresponding first input function as the input value by the corresponding first calculation function. And for the ith frame data unit, according to the actual validity of the data unit of the first frame to the (i-1)th frame, the corresponding first calculation function is searched, and the corresponding first input function is used to calculate according to the corresponding input data. The ith frame data unit corresponds to a first output result of the location.
上述实施例中每帧所述数据单元的有效性情况包括两种:有效、无效,其中可以“0”作为有效标识、“1”作为无效标识。The validity of the data unit in each frame in the above embodiment includes two types: valid and invalid, wherein "0" can be used as a valid identifier and "1" as an invalid identifier.
参见图3,图3以M为1536比特的数据信息为例,将数据信息划分为1536/64=24帧数据单元,每帧数据单元的位宽为64比特,将24帧数据单元划分为帧数相同的三组:第一组包括第1帧数据单元DATA0至第8帧数据单元DATA7;第二组包括第9帧数据单元DATA8至第16帧数据单元DATA15;第三组包括第17帧数据单元DATA16至第24帧数据单元DATA23。首先判断控制信号中前一级数据的最后一帧数据单元的有效性信号“前一级CTRLIN[23]的值为“0”还是“1”,若为“0”则pre_crc=CRC输入值;若为“1”则pre_crc=32‘hffff ffff;并将该pre_crc作为输入数据供每个第一计算函数选择。对于第1帧数据单元DATA0配置第一计算函数为C63_0,并选择确定pre_crc作为C63_0的输入数据。针对第i(i≥2)帧数据单元,预先确定第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数。以第3帧数据单元DATA2为例,第2帧数据单元DATA1无效“1”,配置第一计算函数为C63_0,选择确定32'hffff_ffff作为第一计算函数C63_0的输入数据。第2帧数据单元DATA1有效“0”,第1帧数据单元DATA0无效“1”,配置第一计算函数为C127_0,选择32'hffff_ffff作为第一计算函数C127_0的输入数据。其他有效性情况下,配置第一计算函数为C191_0,选择确定pre_crc作为第一计算函数C191_0的输入数据。而在实际计算过程中输入的控制信号CTRLIN[23:0]包含第1帧数据单元DATA0至第24帧数据单元DATA23的实际有效性标识。第1帧至第(i-1)帧数据单元实际有效性情况有且只有一种,首先根据控制信号CTRLIN[23:0]查找第1帧至第(i-1)帧数据单元实际有效性情况组合属于哪何种组合,然后查找该组合对应的第一计算函数,再通过所查找到的第一计算函数以相应的输入数据作为输入值计算该第i帧数据单元对应位置的第一输出结果。以第3帧数据单元DATA2为例,当控制信号CTRLIN[1:0]的值为“2'b01”,则表示计算第3帧数据单元DATA2对应位置的第一输出结果所需要的第1帧数据单元DATA0至第2=(3-1)帧数据单元DATA1实际有效性情况为:第2帧数据单元DATA1有效“0”,第1帧数据单元DATA0无效“1”,其对应的第一计算函数为C127_0,输入数据为32'hffff_ffff,即通过第一计算函数为C127_0, 以输入数据32'hffff_ffff作为输入值计算第3帧数据单元DATA2的第一输出结果C_OUT2。另外计算第2帧数据单元及其后续的数据单元对应位置的第一输出结果原理与计算所述第3帧数据单元对应位置的第一输出结果的原理基本相同,具体参见图3,在此不再赘述。Referring to FIG. 3, FIG. 3 takes the data information of M 1536 bits as an example, and divides the data information into 1536/64=24 frame data units, and the bit width of each data unit is 64 bits, and the 24 data units are divided into frames. The same number of three groups: the first group includes the first frame data unit DATA0 to the eighth frame data unit DATA7; the second group includes the ninth frame data unit DATA8 to the 16th frame data unit DATA15; the third group includes the 17th frame data The unit DATA16 to the 24th frame data unit DATA23. First, the validity signal of the last frame data unit of the previous level data in the control signal is judged whether the value of the previous stage CTRLIN[23] is "0" or "1", and if it is "0", the pre_crc = CRC input value; If it is "1", then pre_crc=32'hffff ffff; and the pre_crc is used as input data for each first calculation function. For the first frame data unit DATA0, the first calculation function is configured as C63_0, and the selection pre_crc is selected as C63_0. Input data. For the i-th (i ≥ 2) frame data unit, a possible combination of the validity of the first to the (i-1)th frame data units is predetermined, and a corresponding first is configured for each combination. For example, in the third frame data unit DATA2, the second frame data unit DATA1 is invalid "1", the first calculation function is configured as C63_0, and the determination 32'hffff_ffff is selected as the input data of the first calculation function C63_0. The data unit DATA1 is valid "0", the first frame data unit DATA0 is invalid "1", the first calculation function is configured as C127_0, and 32'hffff_ffff is selected as the input data of the first calculation function C127_0. In other validity cases, the configuration is first. Calculation The function is C191_0, and the input data determining the pre_crc as the first calculation function C191_0 is selected. The control signal CTRLIN[23:0] input in the actual calculation process includes the actual validity of the data unit DATA0 to the 24th frame data unit DATA23 of the first frame. Sexual identification. There is one and only one kind of actual validity of the data unit from frame 1 to frame (i-1). First, the first frame to the (i-1)th frame data unit are searched according to the control signal CTRLIN[23:0]. Which combination of actual effectiveness cases belongs to, then finds the first calculation function corresponding to the combination, and then calculates the corresponding position of the data unit of the ith frame by using the first input function found as the input value The first output result. Taking the data unit DATA2 of the third frame as an example, when the value of the control signal CTRLIN[1:0] is "2'b01", it indicates that the first output result of the corresponding position of the data unit DATA2 of the third frame is calculated. The actual validity of the required first frame data unit DATA0 to the second = (3-1) frame data unit DATA1 is: the second frame data unit DATA1 is valid "0", and the first frame data unit DATA0 is invalid "1", The corresponding first calculation function is C127 _0, the input data is 32'hffff_ffff, that is, the first calculation function is C127_0, The first output result C_OUT2 of the third frame data unit DATA2 is calculated with the input data 32'hffff_ffff as an input value. In addition, the principle of calculating the first output result of the corresponding position of the data unit of the second frame and the subsequent data unit is basically the same as the principle of calculating the first output result of the corresponding position of the data unit of the third frame. For details, refer to FIG. Let me repeat.
上述任何一个实施例中在计算每组中的每帧数据单元对应位置的第二输出结果之前需要为每组中的每帧数据单元配置相应的第二计算函数。参见图10,图10为本申请的循环冗余校验码的生成装置又一实施例的功能模块示意图。本实施例中所述循环冗余校验码的生成装置100还包括:第二计算函数配置模块180和输入数据确定模块190。所述第二计算函数配置模块180,设置为在所述第二输出结果计算模块计算每组中每帧数据单元对应位置的第二输出结果之前,为每一组数据单元中的第1帧数据单元配置相应的第二计算函数;以及针对每一组数据单元中的第j帧数据单元,每组中数据单元总帧数≥j≥2,计算第1帧至第(j-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第二计算函数。所述输入数据确定模块190,设置为确定每一组中每一帧数据单元相应的第二计算函数的输入数据。上述循环冗余校验码的生成装置100实施例中所述第二输出结果计算模块130,设置为针对每一组的第1帧数据单元,根据相应的输入数据通过相应的第二计算函数,计算本组中第1帧数据单元对应位置的第二输出结果;以及针对每一组中第j帧数据单元,根据本组中第1帧至第(j-1)帧数据单元的实际有效性情况,查找相应的第二计算函数,根据相应的输入结果通过相应的第二计算函数,计算本组中第j帧数据单元对应位置的第二输出结果。参见图4,图4为图2中步骤S30的具体数据信息和控制信号的走向示意图。图4中涉及的数据信息与图3中所述的数据信息一致。现结合图4计算第一组中第3帧(DATA2)数据单元的第二输出结果为例对所述第二输出结果计算模块130针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,计算该组中每帧数据单元对应位置的第二输出结果的过程进行进一步的描述。第一组中第1帧(DATA0)至第2帧(DATA1)数据单元的有效性情况的可能组合包括:第2帧无效“1”;第2帧有效“0”、 第1帧无效“1”;其他有效性情况。第2帧无效“1”,对应配置的第二计算函数为D63_0,输入数据为(DATA2);第2帧有效“0”、第1帧无效“1”,对应配置的第二计算函数为D63_0^D127_64,其中D63_0的输入数据为DATA2;D127_64的输入数据DATA1;其他有效性情况,对应配置的第二计算函数为D63_0^D127_64^D191_128,其中D63_0的输入数据为DATA2;D127_64的输入数据为DATA1;D191_128的输入数据为DATA0。在实际计算过程中当输入的控制信号CTRLIN[1:0]的值为“2'b01”,表示针对计算第3帧数据单元(DATA2)对应位置的第二输出结果,第2帧数据单元DATA1有效“0”、第1帧数据单元无效“1”,选择采用D63_0^D127_64作为计算第3帧数据单元(DATA2)对应位置的第二输出结果的第二计算函数,其中D63_0的输入数据为DATA2,D127_64的输入数据为DATA1。本组中计算其他数据单元对应位置的第二输出结果原理一致,同时计算其他组的数据单元对应位置的第二输出结果与第1组原理一致,在此不再赘述。另外本申请中每一组的数据单元对应位置的第二输出结果的计算过程为同步进行,如此设计大大地缩短了所有数据单元对应位置的第二输出结果的计算时间,提高第二输出结果的计算频率,减少了资源的使用。In any of the above embodiments, a corresponding second calculation function needs to be configured for each frame of data units in each group before calculating the second output result of the corresponding position of each frame of data units in each group. Referring to FIG. 10, FIG. 10 is a schematic diagram of functional modules of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application. The apparatus for generating cyclic redundancy check code 100 in this embodiment further includes: a second calculation function configuration module 180 and an input data determination module 190. The second calculation function configuration module 180 is configured to: before the second output result calculation module calculates the second output result of the corresponding position of each frame of the data unit in each group, the first frame data in each group of data units The unit is configured with a corresponding second calculation function; and for the jth frame data unit in each group of data units, the total number of frames of the data unit in each group is ≥j≥2, and the first frame to the (j-1)th frame data are calculated. A possible combination of the validity of the unit, a corresponding second calculation function is configured for each combination. The input data determination module 190 is configured to determine input data of a second calculation function corresponding to each frame of data units in each group. The second output result calculation module 130 in the embodiment of the above-described cyclic redundancy check code generating apparatus 100 is configured to pass the corresponding second calculation function according to the corresponding input data for the first frame data unit of each group. Calculating a second output result of the corresponding position of the data unit of the first frame in the group; and for the data unit of the jth frame in each group, according to the actual validity of the data unit of the first frame to the (j-1)th frame in the group In the case, the corresponding second calculation function is searched, and the second output result of the corresponding position of the data unit of the jth frame in the group is calculated according to the corresponding input result through the corresponding second calculation function. Referring to FIG. 4, FIG. 4 is a schematic diagram of specific data information and control signals of step S30 in FIG. The data information referred to in FIG. 4 is identical to the data information described in FIG. The second output result of the third frame (DATA2) data unit in the first group is calculated by taking FIG. 4 as an example. For the second output result calculation module 130, for each group of data units, according to the data of all the data units in the group. The content, and the validity of each frame of data units in the group, the process of calculating the second output of the corresponding location of each frame of data units in the group is further described. Possible combinations of the validity of the data unit of the first frame (DATA0) to the second frame (DATA1) in the first group include: invalidation of "1" for the second frame; effective "0" for the second frame, Frame 1 is invalid "1"; other validity cases. The second frame is invalid "1", the corresponding second calculation function is D63_0, the input data is (DATA2); the second frame is valid "0", the first frame is invalid "1", and the corresponding second calculation function is D63_0. ^D127_64, where the input data of D63_0 is DATA2; the input data DATA1 of D127_64; for other validity cases, the corresponding second calculation function is D63_0^D127_64^D191_128, wherein the input data of D63_0 is DATA2; the input data of D127_64 is DATA1 The input data of D191_128 is DATA0. In the actual calculation process, when the value of the input control signal CTRLIN[1:0] is "2'b01", indicating the second output result for calculating the corresponding position of the third frame data unit (DATA2), the second frame data unit DATA1 Valid "0", the first frame data unit is invalid "1", and D63_0^D127_64 is selected as the second calculation function for calculating the second output result of the corresponding position of the third frame data unit (DATA2), wherein the input data of D63_0 is DATA2 The input data of D127_64 is DATA1. The second output result of calculating the corresponding position of the other data unit in the group is consistent, and the second output result of calculating the corresponding position of the data unit of the other group is consistent with the principle of the first group, and details are not described herein again. In addition, the calculation process of the second output result of the corresponding position of the data unit of each group in the present application is synchronous, and the design greatly shortens the calculation time of the second output result of the corresponding position of all the data units, and improves the second output result. Calculate the frequency and reduce the use of resources.
参见图11,图11为本申请的循环冗余校验码的生成装置又一实施例的功能模块示意图。上述任何一个实施例中所述循环冗余校验码的生成装置100还包括:确定模块201和第三计算函数配置模块101。所述确定模块201,设置为针对以第f组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第f+1组至第Q组中每帧数据单元对应位置的第三输出结果的情况,确定所述第f组最后一帧数据单元至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1。所述第三计算函数配置模块101,设置为为每个需要计算对应位置的第三输出结果的数据单元的每一种组合配置一个相应的第三计算函数,确定每个第三计算函数的输入数据。Referring to FIG. 11, FIG. 11 is a schematic diagram of functional modules of still another embodiment of a cyclic redundancy check code generating apparatus according to the present application. The apparatus for generating cyclic redundancy check code 100 in any one of the above embodiments further includes a determining module 201 and a third calculating function configuration module 101. The determining module 201 is configured to calculate, as input data, a second output result of the corresponding position of the last frame data unit in the fth group, and calculate a third position corresponding to each data unit in the f+1th group to the Qth group. In the case of the output result, a possible combination of the data unit of the last frame of the f-th group to the data unit of each of the third output results for which the corresponding position needs to be calculated is determined, (Q-1) ≥ f ≥ 1. The third calculation function configuration module 101 is configured to configure a corresponding third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determine an input of each third calculation function. data.
参见图12,图12为图11中第三输出结果计算模块的具体细化功能模块示意图。所述第三输出结果计算模块140包括:确定单元141、第三计算函 数查找单元142、第三输出结果计算单元143。所述确定单元141,设置为确定当前需要计算对应位置的第三输出结果的数据单元W。所述第三计算函数查找单元142,设置为若该数据单元为第f+1组中第1帧数据单元至第M/N帧数据单元中的任何一帧数据单元,根据第f组最后一帧数据单元至当前需要计算对应位置的第三输出结果的数据单元的实际有效性情况,查找相应的第三计算函数。所述第三输出结果计算单元143,设置为通过相应的第三计算函数以所述输入数据作为输入值,计算所述数据单元W对应位置的第三输出结果。Referring to FIG. 12, FIG. 12 is a schematic diagram of a specific refinement function module of the third output result calculation module in FIG. The third output result calculation module 140 includes: a determining unit 141, a third calculation function The number finding unit 142 and the third output result calculating unit 143. The determining unit 141 is configured to determine a data unit W that currently needs to calculate a third output result of the corresponding location. The third calculation function searching unit 142 is configured to: if the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the last group of the fth group The frame data unit is to the actual validity of the data unit that needs to calculate the third output result of the corresponding position, and the corresponding third calculation function is searched for. The third output result calculation unit 143 is configured to calculate a third output result of the corresponding position of the data unit W by using the input data as an input value through a corresponding third calculation function.
参见图5,图5中涉及的数据信息为图3中所述的数据信息一致。现结合图5以第1组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第2组至第Q组中每帧数据单元对应位置的第三输出结果为例对第三输出结果计算模块140根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,计算出该组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果的具体过程进行进一步的描述。首先确定所述第1组最后一帧数据单元(DATA7)至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;例如以第1组中最后一帧数据单元(DATA7)对应位置的第二输出结果作为输入数据,针对计算第三组的第7帧数据单元(DATA22)的第三输出结果,其中DATA7至DATA22的有效性情况的可能组合包括:DATA22无效“1”、DATA21有效“0”、…DATA9有效“0”、DATA8有效“0”、DATA7有效“0”;其他有效性情况。DATA7至DATA22的有效性情况的组合为:DATA22无效“1”、DATA21有效“0”、…DATA9有效“0”、DATA8有效“0”、DATA7有效“0”,对应配置的第三计算函数为C959_0,第三计算函数C959_0的输入数据为第1组中最后一帧数据单元对应位置的第二输出结果D_OUT7。DATA7至DATA22的有效性情况为其他有效性情况,第三输出结果直接取值为32'h0。在实际计算过程中当输入的控制信号CTRLIN[22:7]的值为“16'b1000000000000000”,表明DATA7至DATA22的有效性情况的组合为:DATA22无效“1”、DATA21有效“0”、…DATA9有效“0”、DATA8有效“0”、DATA7有效“0”,则通过第三计算函数C959_0以输入数据D_OUT7作为输入值计算出DATA22对应位置的第三输出结果。 Referring to FIG. 5, the data information involved in FIG. 5 is consistent with the data information described in FIG. Referring to FIG. 5, the second output result of the corresponding position of the data unit of the last frame in the first group is used as input data, and the third output result of the corresponding position of each data unit in the second group to the second group is calculated as an example to the third. The output result calculation module 140 is configured according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group. The specific process of calculating the third output result of the next set of all data units of the group to the corresponding position of the M/N frame data unit is further described. First determining a possible combination of the validity of the first group of data units (DATA7) of the first group to the data unit of each of the third output results for which the corresponding position needs to be calculated, (Q-1) ≥ f ≥ 1; for example The second output result of the corresponding position of the last frame data unit (DATA7) in the first group is used as input data for calculating the third output result of the seventh frame data unit (DATA22) of the third group, wherein the validity of DATA7 to DATA22 Possible combinations of conditions include: DATA22 invalid "1", DATA21 valid "0", ... DATA9 valid "0", DATA8 valid "0", DATA7 valid "0"; other validity cases. The combination of the validity of DATA7 to DATA22 is: DATA22 invalid "1", DATA21 valid "0", ... DATA9 valid "0", DATA8 valid "0", DATA7 valid "0", the corresponding third calculation function is C959_0, the input data of the third calculation function C959_0 is the second output result D_OUT7 of the corresponding position of the last frame data unit in the first group. The validity of DATA7 to DATA22 is other validity, and the third output directly takes 32'h0. In the actual calculation process, when the value of the input control signal CTRLIN[22:7] is "16'b1000000000000000", it indicates that the combination of the validity of DATA7 to DATA22 is: DATA22 invalid "1", DATA21 valid "0", ... When DATA9 is valid "0", DATA8 is valid "0", and DATA7 is valid "0", the third output result of the corresponding position of DATA22 is calculated by the third calculation function C959_0 using the input data D_OUT7 as an input value.
参见图6,图6为图2中步骤S40的另一具体数据信息和控制信号的走向示意图。图6中涉及的数据信息为图3中所述的数据信息一致。现结合图6以第2组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第3组至第Q组中每帧数据单元对应位置的第三输出结果为例,对第三输出结果计算模块140根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,计算出该组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果的具体过程进行进一步的描述。首先确定所述第2组最后一帧数据单元(DATA15)至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;例如以第2组中最后一帧数据单元(DATA15)对应位置的第二输出结果作为输入数据,针对计算第三组的第7帧数据单元(DATA22)的第三输出结果,其中DATA15至DATA22的有效性情况的可能组合包括:DATA22无效“1”、DATA21有效“0”、…DATA16有效“0”、DATA15有效“0”,其他有效性情况。DATA15至DATA22的有效性情况组合为:DATA22无效“1”、DATA21有效“0”、…DATA16有效“0”、DATA15有效“0”,对应配置的第三计算函数为C447_0,第三计算函数C447_0的输入数据为第2组中最后一帧数据单元对应位置的第二输出结果D_OUT15。DATA15至DATA22的有效性情况组合为其他有效性情况,第三输出结果直接取值为32'h0。在实际计算过程中当输入的控制信号CTRLIN[22:15]的值为“8'b10000000”,表明DATA16至DATA22的有效性情况组合为:DATA22无效“1”、DATA21有效“0”、…DATA16有效“0”、DATA15有效“0”,则通过第三计算函数C447_0以输入数据D_OUT15作为输入值计算出DATA22的第三输出结果。Referring to FIG. 6, FIG. 6 is a schematic diagram of another specific data information and a control signal of step S40 in FIG. The data information referred to in FIG. 6 is consistent with the data information described in FIG. Referring to FIG. 6 , the second output result of the corresponding position of the data unit of the last frame in the second group is used as the input data, and the third output result of the corresponding position of each data unit in the third group to the Q group is calculated as an example. The third output result calculation module 140 is configured according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group. In the case, a specific process of calculating the third output result of the next set of all data units of the group to the corresponding position of the M/N frame data unit is further described. First determining a possible combination of the validity of the second group of last frame data units (DATA15) to each of the data units of the third output result requiring calculation of the corresponding position, (Q-1) ≥ f ≥ 1; for example The second output result of the corresponding position of the last frame data unit (DATA15) in the second group is used as input data for calculating the third output result of the seventh frame data unit (DATA22) of the third group, wherein the validity of DATA15 to DATA22 Possible combinations of conditions include: DATA22 invalid "1", DATA21 valid "0", ... DATA16 valid "0", DATA15 valid "0", other validity. The validity of DATA15 to DATA22 is combined: DATA22 invalid "1", DATA21 valid "0", ... DATA16 valid "0", DATA15 valid "0", the corresponding third calculation function is C447_0, the third calculation function C447_0 The input data is the second output result D_OUT15 of the corresponding position of the last frame data unit in the second group. The validity of DATA15 to DATA22 is combined into other validity cases, and the third output result is directly 32'h0. In the actual calculation process, when the value of the input control signal CTRLIN[22:15] is "8'b10000000", it indicates that the validity of DATA16 to DATA22 is combined: DATA22 invalid "1", DATA21 valid "0", ... DATA16 If the valid "0" and the DATA15 are valid "0", the third output result of the DATA 22 is calculated by the third calculation function C447_0 using the input data D_OUT15 as an input value.
从图5和图6可知第三组中每个数据单元的第三输出结果包括两个,即本申请中第L组的每个数据单元对应位置的第三输出结果个数为(L-1)个。It can be seen from FIG. 5 and FIG. 6 that the third output result of each data unit in the third group includes two, that is, the number of third output results of the corresponding position of each data unit of the Lth group in the present application is (L-1). ).
本申请中以不同组中最后一帧数据单元对应位置的第二输出结果作为输入数据,与作为输入数据的第二输出结果对应的组的下一组至第Q组中每帧数据单元对应位置的第三输出结果的计算过程为同步进行,如此设计大大地缩短了所有数据单元对应位置的第三输出结果的计算时间,提高了第三输出 结果的计算频率,减少了资源的使用。In the present application, the second output result of the corresponding position of the last frame data unit in the different groups is used as the input data, and the corresponding position of the data unit of each group in the next group to the Q group corresponding to the second output result corresponding to the input data The calculation process of the third output result is synchronous, and the design greatly shortens the calculation time of the third output result of the corresponding position of all the data units, and improves the third output. The frequency of calculations reduces the use of resources.
上述循环冗余校验码的生成装置任何一个实施例中,所述CRC值计算模块150,具体设置为当某一帧数据单元对应位置的输出结果包括第一输出结果、第二输出结果,则通过对所述第一输出结果、第二输出结果进行异或计算,得出该帧数据单元对应位置的CRC值;以及当某一帧数据单元计算出的输出结果包括第一输出结果、第二输出结果、第三输出结果,则通过对所述第一输出结果、第二输出结果、第三输出结果进行异或计算,得出帧数据单元对应位置的CRC值。In any one of the foregoing embodiments of the apparatus for generating a cyclic redundancy check code, the CRC value calculation module 150 is specifically configured to: when the output result of the corresponding position of the data unit of a certain frame includes the first output result and the second output result, And performing an exclusive-OR calculation on the first output result and the second output result to obtain a CRC value corresponding to the position of the frame data unit; and outputting the calculated result of the data unit of the certain frame includes the first output result and the second The output result and the third output result are obtained by performing an exclusive-OR calculation on the first output result, the second output result, and the third output result to obtain a CRC value corresponding to the position of the frame data unit.
现以第一组的第1帧数据单元(DATA0)、第二组的第1帧数据单元(DATA8)第三组的第1帧数据单元(DATA16)为例对本步骤S50进行举例式说明,由于第一组的第1帧数据单元对应位置的输出结果只包括第一输出结果C_OUT0、第二输出结果D_OUT0,则对该C_OUT0与D_OUT0进行异或计算得到该第1帧数据单元(DATA0)的CRC值。第二组的第1帧数据单元(DATA8)对应位置的输出结果包括第一输出结果C_OUT8、第二输出结果D_OUT8、第三输出结果C_D2_OUT8,则对该C_OUT8、D_OUT8、C_D2_OUT8进行异或计算得到该第二组的第1帧数据单元(DATA8)的CRC值。第三组的第1帧数据单元(DATA16)对应位置的输出结果包括第一输出结果C_OUT16、第二输出结果D_OUT16、第三输出结果C_D2_OUT16和C_D1_OUT16,则对该C_OUT16、D_OUT16、C_D2_OUT16、C_D1_OUT16进行异或计算得到该第三组的第1帧数据单元(DATA16)的CRC值。Now, this step S50 is exemplified by taking the first frame data unit (DATA0) of the first group and the first frame data unit (DATA16) of the third group of the first frame data unit (DATA8) of the second group as an example, because The output result of the corresponding position of the data unit of the first frame of the first group includes only the first output result C_OUT0 and the second output result D_OUT0, and the C_OUT0 and D_OUT0 are XORed to obtain the CRC of the first frame data unit (DATA0). value. The output result of the corresponding position of the first frame data unit (DATA8) of the second group includes the first output result C_OUT8, the second output result D_OUT8, and the third output result C_D2_OUT8, and the C_OUT8, D_OUT8, C_D2_OUT8 are XORed to obtain the The CRC value of the first frame of data unit (DATA8) of the second group. The output result of the corresponding position of the first frame data unit (DATA16) of the third group includes the first output result C_OUT16, the second output result D_OUT16, and the third output result C_D2_OUT16 and C_D1_OUT16, and the C_OUT16, D_OUT16, C_D2_OUT16, C_D1_OUT16 are different. Or calculate the CRC value of the first frame data unit (DATA16) of the third group.
以上实施例所提供的循环冗余校验码的生成装置100,通过根据数据信息的比特数M,将所述数据信息划分为M/N帧比特位宽为N的数据单元,将所述M/N帧数据单元划分为Q组;根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;在计算每帧数据单元对应位置的第一输出结果的同时,同步执行针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果的操作;然后根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组 中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;将每帧数据单元对应位置的输出结果进行异或计算的方式,得到每帧数据单元对应的CRC值,大大地缩短了每帧数据单元对应位置的CRC值的计算时间,提高了CRC值的计算频率,降低了芯片计算CRC值所占的资源和功耗。The cyclic redundancy check code generating apparatus 100 provided in the above embodiment divides the data information into data units having M/N frame bit width N according to the bit number M of the data information, and the M is /N frame data unit is divided into Q groups; according to the CRC input value, and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; in the calculation of the corresponding position of the data unit of each frame Simultaneously calculating the corresponding position of each data unit in each group according to the data content of all data units in the group and the validity of each data unit in the group. The operation of the second output result; then the second output result according to the corresponding position of the last frame data unit in each set of data units, and the group The validity of the last frame data unit to the (M/N-1) frame data unit, and the third output result of the next group of all data units of each group to the corresponding position of the M/N frame data unit is synchronously calculated. The CRC value corresponding to each frame of the data unit is obtained by performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit, which greatly shortens the calculation time of the CRC value of the corresponding position of the data unit of each frame, and improves the CRC value. Calculating the frequency reduces the resources and power consumption of the chip to calculate the CRC value.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序/指令来实现其相应功能。本发明实施例不限制于任何特定形式的硬件和软件的结合。One of ordinary skill in the art will appreciate that all or a portion of the above steps may be performed by a program to instruct related hardware, such as a processor, which may be stored in a computer readable storage medium, such as a read only memory, disk or optical disk. Wait. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function. Embodiments of the invention are not limited to any specific form of combination of hardware and software.
以上仅为本申请的可选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above is only an alternative embodiment of the present application, and thus does not limit the scope of the patent application, and the equivalent structure or equivalent process transformation of the specification and the drawings of the present application, or directly or indirectly applied to other related technologies. The fields are all included in the scope of patent protection of this application.
工业实用性Industrial applicability
根据本申请所提供的循环冗余校验码的生成方法和装置,将每帧数据单元对应位置的输出结果进行异或计算的方式,得到每帧数据单元对应的CRC值,大大地缩短了每帧数据单元对应位置的CRC值的计算时间,提高了CRC值的计算频率,降低了芯片计算CRC值所占的资源和功耗。 According to the method and device for generating a cyclic redundancy check code provided by the present application, the CRC value corresponding to each data unit is obtained by performing an exclusive-OR calculation on the output result of the corresponding position of each frame of the data unit, which greatly shortens each The calculation time of the CRC value corresponding to the position of the frame data unit increases the calculation frequency of the CRC value, and reduces the resources and power consumption occupied by the chip to calculate the CRC value.

Claims (11)

  1. 一种循环冗余校验码的生成方法,包括:A method for generating a cyclic redundancy check code, comprising:
    获取数据信息,根据所述数据信息中每一级的数据量为M比特,将所述每一级数据划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组;Acquiring data information, according to the data amount of each level in the data information being M bits, dividing each level of data into data units having an M/N frame width of N bits, and the M/N frame data The unit is divided into Q groups;
    针对每一级数据,根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;并同时针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果;For each level of data, according to the CRC input value, and the validity of the data unit per frame, the first output result of the corresponding position of each frame of the data unit is calculated; and for each group of data units, according to all the groups in the group The data content of the data unit, and the validity of each frame of the data unit in the group, and the second output result of the corresponding position of each frame of the data unit in each group is synchronously calculated;
    根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;Calculating each time according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit in the group a third output result of the next set of all data units of the group to the corresponding position of the M/N frame data unit;
    将每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC输出值;其中,所述输出结果包括第一输出结果、第二输出结果,或者包括第一输出结果、第二输出结果、第三输出结果;Performing an exclusive-OR calculation on the output result of the corresponding position of the data unit of each frame to obtain a CRC output value corresponding to each data unit of the frame; wherein the output result includes the first output result, the second output result, or the first output result, a second output result, a third output result;
    定义所述数据信息中最后一级数据中最后一帧数据单元对应的CRC输出值为所述数据信息的CRC值;Defining a CRC output value corresponding to a last frame data unit in the last level data in the data information as a CRC value of the data information;
    其中,当所述数据信息为待发送类型,所述CRC值用于嵌入所述数据信息,与所述数据信息一并发送至接收端,以使数据接收端根据自身生成的第一CRC值与所述CRC值的比对结果,判断所接收的数据信息是否出错;当所述数据信息为已接收类型,所述CRC值用于与所述数据信息中嵌入的第二CRC值进行大小比对,以使数据接收端根据比对结果判断所述数据信息是否出错。Wherein, when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to a receiving end, so that the data receiving end generates a first CRC value according to itself. Determining, by the comparison result of the CRC value, whether the received data information is erroneous; when the data information is of a received type, the CRC value is used for size comparison with a second CRC value embedded in the data information. So that the data receiving end determines whether the data information is in error according to the comparison result.
  2. 根据权利要求1所述的循环冗余校验码的生成方法,在所述根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果的步骤之前,所述方法还包括:The method for generating a cyclic redundancy check code according to claim 1, wherein the first output result of the corresponding position of each data unit is calculated according to the CRC input value and the validity of the data unit per frame Before the step, the method further includes:
    为第1帧数据单元配置相应的第一计算函数; Configuring a corresponding first calculation function for the first frame data unit;
    针对第i帧数据单元,i为自然数,且M/N≥i≥2,计算第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数;For the i-th frame data unit, i is a natural number, and M/N ≥ i ≥ 2, calculate the possible combinations of the validity of the data units of the first frame to the (i-1)th frame, and configure a corresponding for each combination. First calculation function;
    所述根据CRC输入值以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果的步骤包括:The step of calculating a first output result of a corresponding position of each data unit according to the CRC input value and the validity of the data unit per frame includes:
    定义前一级数据中最后一帧数据单元所对应的CRC输出值为当前级的CRC输入值;根据每帧所述数据单元的有效性情况,为当前级数据中每帧数据单元分配相应的第一计算函数的输入数据;Defining the CRC output value corresponding to the last frame data unit in the previous level data is the CRC input value of the current level; according to the validity of the data unit in each frame, assigning a corresponding number to each data unit in the current level data An input data of a calculation function;
    针对第1帧数据单元,通过相应的第一计算函数以相应的输入数据作为输入值,计算所述第1帧数据单元对应位置的第一输出结果;For the data unit of the first frame, the first output result of the corresponding position of the data unit of the first frame is calculated by using the corresponding first input function as the input value by the corresponding first calculation function;
    针对第i帧数据单元,根据第1帧至第(i-1)帧数据单元实际有效性情况,查找相应的第一计算函数,根据相应的输入数据通过相应的第一计算函数,计算所述第i帧数据单元对应位置的第一输出结果。For the ith frame data unit, according to the actual validity of the data unit of the first frame to the (i-1)th frame, searching for a corresponding first calculation function, and calculating the corresponding first calculation function according to the corresponding input data The first output result of the position corresponding to the i-th frame data unit.
  3. 根据权利要求1所述的循环冗余校验码的生成方法,所述针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效情况,计算每组中每帧数据单元对应位置的第二输出结果的步骤之前,所述方法还包括:The method for generating a cyclic redundancy check code according to claim 1, wherein for each group of data units, calculating according to data content of all data units in the group and validity of each frame of data units in the group Before the step of outputting the second output result of the corresponding position of the data unit in each group, the method further includes:
    为每一组数据单元中的第1帧数据单元配置相应的第二计算函数;Configuring a corresponding second calculation function for the first frame data unit in each group of data units;
    针对每一组数据单元中的第j帧数据单元,每组中数据单元总帧数≥j≥2,计算第1帧至第(j-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第二计算函数;For the jth frame data unit in each group of data units, the total number of data units in each group is ≥j≥2, and the possible combinations of the validity of the data units of the first frame to the (j-1)th frame are calculated. Each combination is configured with a corresponding second calculation function;
    确定每一组中每一帧数据单元相应的第二计算函数的输入数据;Determining input data of a corresponding second calculation function of each frame of data units in each group;
    所述针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效情况,计算每组中每帧数据单元对应位置的第二输出结果的步骤包括:The step of calculating, according to the data content of all data units in the group, and the validity of each data unit in the group for each group of data units, the second output result of calculating the corresponding position of each frame of the data unit in each group includes :
    针对每一组的第1帧数据单元,根据相应的输入数据通过相应的第二计算函数,计算本组中第1帧数据单元对应位置的第二输出结果;For each group of the first frame data unit, the second output result of the corresponding position of the data unit of the first frame in the group is calculated according to the corresponding input data through the corresponding second calculation function;
    针对每一组中第j帧数据单元,根据本组中第1帧至第(j-1)帧数据单元 的实际有效性情况,查找相应的第二计算函数,通过相应的第二计算函数以相应的输入数据作为输入值,计算本组中第j帧数据单元对应位置的第二输出结果。For the jth frame data unit in each group, according to the first frame to the (j-1)th frame data unit in the group The actual validity situation, find the corresponding second calculation function, and calculate the second output result of the corresponding position of the jth frame data unit in the group by using the corresponding second input function as the input value.
  4. 根据权利要求1所述的循环冗余校验码的生成方法,所述根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该最后一帧数据单元至(M/N-1)帧数据单元的有效情况,计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果的步骤之前,所述方法还包括:The method for generating a cyclic redundancy check code according to claim 1, wherein the second output result according to a corresponding position of a last frame data unit in each group of data units, and the last frame data unit to (M/) N-1) The validity of the frame data unit, before the step of calculating the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit, the method further includes:
    针对以第f组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第f+1组至第Q组中每帧数据单元对应位置的第三输出结果的情况,确定所述第f组最后一帧数据单元至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;Determining, by using the second output result of the corresponding position of the last frame data unit in the fth group as the input data, the third output result of the corresponding position of the data unit of each frame in the f+1th group to the Qth group, determining the a possible combination of the data unit of the last frame of the fth group to the data unit of each of the third output results for which the corresponding position needs to be calculated, (Q-1) ≥ f ≥ 1;
    为每个需要计算对应位置的第三输出结果的数据单元的每一种组合配置一个相应的第三计算函数,确定每个第三计算函数的输入数据;Configuring a respective third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determining input data of each third calculation function;
    所述根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该最后一帧数据单元至(M/N-1)帧数据单元的有效情况,计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果的步骤包括:Calculating the next output of each group according to the second output result of the corresponding position of the last frame data unit in each group of data units, and the validity of the last frame data unit to the (M/N-1) frame data unit The steps of a third output of all the data units to the corresponding locations of the M/N frame data units include:
    确定当前需要计算对应位置的第三输出结果的数据单元W;Determining a data unit W that currently needs to calculate a third output result of the corresponding location;
    若该数据单元为第f+1组中第1帧数据单元至第M/N帧数据单元中的任何一帧数据单元,根据第f组最后一帧数据单元至当前需要计算对应位置的第三输出结果的数据单元的实际有效性情况,查找相应的第三计算函数;If the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the data unit of the last frame of the fth group, the third position corresponding to the current position is calculated. Output the actual validity of the data unit of the result, and find the corresponding third calculation function;
    通过相应的第三计算函数以所述输入数据作为输入值,计算所述数据单元W对应位置的第三输出结果。A third output result of the corresponding position of the data unit W is calculated by the corresponding third calculation function using the input data as an input value.
  5. 根据权利要求1至4任一项所述的循环冗余校验码的生成方法,其中,所述对每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC值的步骤包括:The method for generating a cyclic redundancy check code according to any one of claims 1 to 4, wherein the output result of the corresponding position of each data unit is subjected to exclusive OR calculation to obtain a CRC value corresponding to each data unit of the frame. The steps include:
    当某一帧数据单元对应位置的输出结果包括第一输出结果、第二输出结 果,则通过对所述第一输出结果、第二输出结果进行异或计算,得出该帧数据单元对应位置的CRC值;The output result of the corresponding position of the data unit of a certain frame includes the first output result and the second output result If the first output result and the second output result are XORed, the CRC value of the corresponding position of the frame data unit is obtained;
    当某一帧数据单元计算出的输出结果包括第一输出结果、第二输出结果、第三输出结果,则通过对所述第一输出结果、第二输出结果、第三输出结果进行异或计算,得出该帧数据单元对应位置的CRC值。When the output result calculated by the data unit of a certain frame includes the first output result, the second output result, and the third output result, performing exclusive-OR calculation on the first output result, the second output result, and the third output result The CRC value of the corresponding position of the frame data unit is obtained.
  6. 一种循环冗余校验码的生成装置,包括:A device for generating a cyclic redundancy check code, comprising:
    划分模块,设置为获取数据信息,根据所述数据信息中每一级的数据量为M比特,将所述每一级数据划分为M/N帧位宽为N比特的数据单元,将所述M/N帧数据单元划分为Q组;a dividing module, configured to acquire data information, according to the data amount of each level in the data information being M bits, and dividing each level of data into data units having an M/N frame width of N bits, The M/N frame data unit is divided into Q groups;
    第一输出结果计算模块,设置为针对每一级数据,根据CRC输入值,以及每帧所述数据单元的有效性情况,计算每帧数据单元对应位置的第一输出结果;a first output result calculation module, configured to calculate, for each level of data, a first output result corresponding to a position of each data unit according to a CRC input value and a validity condition of the data unit per frame;
    第二输出结果计算模块,设置为针对每一组数据单元,根据该组中所有数据单元的数据内容,以及该组中每帧数据单元的有效性情况,同步计算每组中每帧数据单元对应位置的第二输出结果;a second output result calculation module is configured to, for each group of data units, synchronously calculate a data unit corresponding to each frame in each group according to data content of all data units in the group and validity of each frame of data units in the group The second output of the location;
    第三输出结果计算模块,设置为根据每一组数据单元中最后一帧数据单元对应位置的第二输出结果,以及该组中最后一帧数据单元至第(M/N-1)帧数据单元的有效性情况,同步计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果;a third output result calculation module, configured to be a second output result according to a corresponding position of the last frame data unit in each group of data units, and a last frame data unit to the (M/N-1) frame data unit in the group The validity of the situation, synchronously calculating the third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit;
    CRC值计算模块,设置为将每帧数据单元对应位置的输出结果进行异或计算,得到每帧数据单元对应的CRC输出值;其中,所述输出结果包括第一输出结果、第二输出结果,或者包括第一输出结果、第二输出结果、第三输出结果;The CRC value calculation module is configured to perform an exclusive-OR calculation on the output result of the corresponding position of the data unit of each frame to obtain a CRC output value corresponding to each data unit of the frame; wherein the output result includes the first output result and the second output result, Or including a first output result, a second output result, and a third output result;
    定义模块,设置为定义所述数据信息中最后一级数据中最后一帧数据单元对应的CRC输出值为所述数据信息的CRC值;a definition module, configured to define a CRC output value corresponding to a last frame data unit in the last level data in the data information, as a CRC value of the data information;
    其中,当所述数据信息为待发送类型,所述CRC值用于嵌入所述数据信息,与所述数据信息一并发送至接收端,以使数据接收端根据自身生成的第一CRC值与所述CRC值的比对结果,判断所接收的数据信息是否出错;当 所述数据信息为已接收类型,所述CRC值用于与所述数据信息中嵌入的第二CRC值进行大小比对,以使数据接收端根据比对结果判断所述数据信息是否出错;Wherein, when the data information is of a to-be-sent type, the CRC value is used to embed the data information, and is sent together with the data information to a receiving end, so that the data receiving end generates a first CRC value according to itself. Determining, by the comparison result of the CRC value, whether the received data information is in error; The data information is a received type, and the CRC value is used for size comparison with a second CRC value embedded in the data information, so that the data receiving end determines whether the data information is erroneous according to the comparison result;
    所述第一输出结果计算模块与所述第二输出结果计算模块同步执行相关操作。The first output result calculation module and the second output result calculation module perform related operations in synchronization.
  7. 根据权利要求6所述的循环冗余校验码的生成装置,还包括:The apparatus for generating a cyclic redundancy check code according to claim 6, further comprising:
    第一计算函数配置模块,设置为在所述第一输出结果计算模块计算每帧数据单元对应位置的第一输出结果之前,为第1帧数据单元配置相应的第一计算函数;以及针对第i帧数据单元,i为自然数,且M/N≥i≥2,计算第1帧至第(i-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第一计算函数;a first calculation function configuration module configured to: configure a first first calculation function for the first frame data unit before the first output result calculation module calculates a first output result of the corresponding position of each frame of the data unit; and for the ith a frame data unit, i is a natural number, and M/N ≥ i ≥ 2, a possible combination of the validity of the data units of the first frame to the (i-1)th frame is calculated, and a corresponding first is configured for each combination Calculation function
    所述第一输出结果计算模块包括:The first output result calculation module includes:
    输入数据确定单元,设置为定义前一级数据中最后一帧数据单元所对应的CRC输出值为当前级的CRC输入值;根据每帧所述数据单元的有效性情况,为当前级数据中每帧数据单元分配相应的第一计算函数的输入数据;The input data determining unit is configured to define a CRC output value corresponding to the CRC output value of the last frame data unit in the previous level data, and a current level CRC input value according to the validity of the data unit in each frame, The frame data unit allocates input data of the corresponding first calculation function;
    第一输出结果计算单元,设置为针对第1帧数据单元,通过相应的第一计算函数以相应的输入数据作为输入值,计算所述第1帧数据单元对应位置的第一输出结果;以及针对第i帧数据单元,根据第1帧至第(i-1)帧数据单元实际有效性情况,查找相应的第一计算函数,根据相应的输入数据通过相应的第一计算函数,计算所述第i帧数据单元对应位置的第一输出结果。a first output result calculation unit configured to calculate, for the first frame data unit, a first output result of the corresponding position of the first frame data unit by using a corresponding first input function as the input value by the corresponding first calculation function; The i-th frame data unit searches for a corresponding first calculation function according to the actual validity of the data unit of the first frame to the (i-1)th frame, and calculates the first by a corresponding first calculation function according to the corresponding input data. The i-frame data unit corresponds to the first output of the location.
  8. 根据权利要求6所述的循环冗余校验码的生成装置,还包括:The apparatus for generating a cyclic redundancy check code according to claim 6, further comprising:
    第二计算函数配置模块,设置为在所述第二输出结果计算模块计算每组中每帧数据单元对应位置的第二输出结果之前,为每一组数据单元中的第1帧数据单元配置相应的第二计算函数;以及针对每一组数据单元中的第j帧数据单元,每组中数据单元总帧数≥j≥2,计算第1帧至第(j-1)帧数据单元的有效性情况的可能组合,为每一种组合配置一个相应的第二计算函数;a second calculation function configuration module configured to: configure, corresponding to the first frame data unit in each group of data units, before the second output result calculation module calculates a second output result of the corresponding position of each frame of the data unit in each group a second calculation function; and for the j-th frame data unit in each set of data units, the total number of data units in each group is ≥ j ≥ 2, and the validity of the data unit of the first frame to the (j-1)th frame is calculated. a possible combination of sexual conditions, configuring a corresponding second calculation function for each combination;
    输入数据确定模块,设置为确定每一组中每一帧数据单元相应的第二计算函数的输入数据; An input data determining module configured to determine input data of a second computing function corresponding to each frame of data units in each group;
    所述第二输出结果计算模块,设置为针对每一组的第1帧数据单元,根据相应的输入数据通过相应的第二计算函数,计算本组中第1帧数据单元对应位置的第二输出结果;以及针对每一组中第j帧数据单元,根据本组中第1帧至第(j-1)帧数据单元的实际有效性情况,查找相应的第二计算函数,通过相应的第二计算函数以相应的输入数据作为输入值,计算本组中第j帧数据单元对应位置的第二输出结果。The second output result calculation module is configured to calculate, according to the first frame data unit of each group, a second output corresponding to the corresponding position of the first frame data unit in the group by using a corresponding second calculation function according to the corresponding input data. a result; and for the jth frame data unit in each group, according to the actual validity of the data frame of the first frame to the (j-1)th frame in the group, searching for a corresponding second calculation function, corresponding to the second The calculation function uses the corresponding input data as an input value to calculate a second output result of the corresponding position of the data unit of the jth frame in the group.
  9. 根据权利要求6所述的循环冗余校验码的生成装置,还包括:The apparatus for generating a cyclic redundancy check code according to claim 6, further comprising:
    确定模块,设置为在所述第三输出结果计算模块计算出每组的下一组所有数据单元至第M/N帧数据单元对应位置的第三输出结果之前,针对以第f组中最后一帧数据单元对应位置的第二输出结果作为输入数据,计算第f+1组至第Q组中每帧数据单元对应位置的第三输出结果的情况,确定所述第f组最后一帧数据单元至每个需要计算对应位置的第三输出结果的数据单元的有效性情况的可能组合,(Q-1)≥f≥1;a determining module, configured to: before the third output result calculating module calculates a third output result of the next set of all data units of each group to the corresponding position of the M/N frame data unit, for the last one in the fth group And determining, as the input data, a second output result of the corresponding position of the frame data unit, calculating a third output result of the corresponding position of the data unit of each frame in the f+1th group to the Qth group, and determining the last frame data unit of the fth group a possible combination of the validity of each data unit that needs to calculate a third output result of the corresponding position, (Q-1) ≥ f ≥ 1;
    第三计算函数配置模块,设置为为每个需要计算对应位置的第三输出结果的数据单元的每一种组合配置一个相应的第三计算函数,确定每个第三计算函数的输入数据;a third calculation function configuration module, configured to configure a corresponding third calculation function for each combination of data units each of which needs to calculate a third output result of the corresponding position, and determine input data of each third calculation function;
    所述第三输出结果计算模块包括:The third output result calculation module includes:
    确定单元,设置为确定当前需要计算对应位置的第三输出结果的数据单元W;a determining unit, configured to determine a data unit W that currently needs to calculate a third output result of the corresponding position;
    第三计算函数查找单元,设置为若该数据单元为第f+1组中第1帧数据单元至第M/N帧数据单元中的任何一帧数据单元,根据第f组最后一帧数据单元至当前需要计算对应位置的第三输出结果的数据单元的实际有效性情况,查找相应的第三计算函数;a third calculation function searching unit configured to: if the data unit is any one of the first frame data unit to the M/N frame data unit in the f+1th group, according to the last frame data unit of the fth group Up to the current need to calculate the actual validity of the data unit of the third output result of the corresponding position, and find a corresponding third calculation function;
    第三输出结果计算单元,设置为通过相应的第三计算函数以所述输入数据作为输入值,计算所述数据单元W对应位置的第三输出结果。The third output result calculation unit is configured to calculate a third output result of the corresponding position of the data unit W by using the input data as an input value through a corresponding third calculation function.
  10. 根据权利要求6至9任一项所述的循环冗余校验码的生成装置,其中,The apparatus for generating a cyclic redundancy check code according to any one of claims 6 to 9, wherein
    所述CRC值计算模块设置为当某一帧数据单元对应位置的输出结果包 括第一输出结果、第二输出结果,则通过对所述第一输出结果、第二输出结果进行异或计算,得出该帧数据单元对应位置的CRC值;以及当某一帧数据单元计算出的输出结果包括第一输出结果、第二输出结果、第三输出结果,则通过对所述第一输出结果、第二输出结果、第三输出结果进行异或计算,得出该帧数据单元对应位置的CRC值。The CRC value calculation module is configured to output an output result packet corresponding to a position of a frame data unit The first output result and the second output result are obtained by performing an exclusive-OR calculation on the first output result and the second output result to obtain a CRC value of a corresponding position of the frame data unit; and calculating a data unit of a certain frame The output result includes a first output result, a second output result, and a third output result, and the frame data unit is obtained by performing an exclusive-OR calculation on the first output result, the second output result, and the third output result Corresponding location CRC value.
  11. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现权利要求1-5中任意一项所述的方法。 A computer readable storage medium storing computer executable instructions that, when executed, implement the method of any of claims 1-5.
PCT/CN2016/092716 2016-02-29 2016-08-01 Method and device for generating cyclic redundancy check WO2017148096A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610113250.5 2016-02-29
CN201610113250.5A CN107135047A (en) 2016-02-29 2016-02-29 The generation method and device of cyclic redundancy check code

Publications (1)

Publication Number Publication Date
WO2017148096A1 true WO2017148096A1 (en) 2017-09-08

Family

ID=59720947

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/092716 WO2017148096A1 (en) 2016-02-29 2016-08-01 Method and device for generating cyclic redundancy check

Country Status (2)

Country Link
CN (1) CN107135047A (en)
WO (1) WO2017148096A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107656833A (en) * 2017-11-06 2018-02-02 郑州云海信息技术有限公司 A kind of CRC computing devices and computational methods
CN109787713B (en) * 2017-11-15 2020-10-09 华为技术有限公司 Cyclic Redundancy Check (CRC) calculation method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090037800A1 (en) * 2007-08-01 2009-02-05 Samsung Electronics Co., Ltd. Data parallelizing receiver
CN104639294A (en) * 2015-02-10 2015-05-20 浪潮电子信息产业股份有限公司 Improved CRC (Cyclic Redundancy Check) realization method
CN105049057A (en) * 2015-08-17 2015-11-11 中国航天科技集团公司第九研究院第七七一研究所 CRC (Cyclic Redundancy Check)-32 checking circuit facing 128-bit parallel input
CN105119694A (en) * 2015-09-11 2015-12-02 烽火通信科技股份有限公司 Method and system for calculating CRC value in high speed network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090037800A1 (en) * 2007-08-01 2009-02-05 Samsung Electronics Co., Ltd. Data parallelizing receiver
CN104639294A (en) * 2015-02-10 2015-05-20 浪潮电子信息产业股份有限公司 Improved CRC (Cyclic Redundancy Check) realization method
CN105049057A (en) * 2015-08-17 2015-11-11 中国航天科技集团公司第九研究院第七七一研究所 CRC (Cyclic Redundancy Check)-32 checking circuit facing 128-bit parallel input
CN105119694A (en) * 2015-09-11 2015-12-02 烽火通信科技股份有限公司 Method and system for calculating CRC value in high speed network

Also Published As

Publication number Publication date
CN107135047A (en) 2017-09-05

Similar Documents

Publication Publication Date Title
CN106575346B (en) Cryptographic integrity check in memory
US9047082B2 (en) Instruction-set architecture for programmable Cyclic Redundancy Check (CRC) computations
KR101767018B1 (en) Error correction in non_volatile memory
KR20170032424A (en) Recovery algorithm in non-volatile memory
US8726124B2 (en) Cyclic redundancy check generation via distributed time multiplexed linear feedback shift registers
JP2010528509A (en) Data transmission method between master device and slave device
US8738990B2 (en) Cyclic redundancy check generation via distributed time multiplexed linear feedback shift registers
US8281111B2 (en) System and method to execute a linear feedback-shift instruction
CN104299637A (en) Flash memory device and operation method thereof
US8972815B1 (en) Recovery of media datagrams
WO2017148096A1 (en) Method and device for generating cyclic redundancy check
CN101296053A (en) Method and system for calculating cyclic redundancy check code
KR101915351B1 (en) High performance read-modify-write system providing line-rate merging of dataframe segments in hardware
KR102440705B1 (en) Progressive Length Error Control Codes
US20040088497A1 (en) Methods and apparatus for exchanging data using cyclic redundancy check codes
CN110679090A (en) Reduced delay error correction decoding
CN113300716A (en) Method and device for generating cyclic redundancy check code and computer readable medium
US20150007003A1 (en) Methods, systems, and computer readable media for multi-packet cyclic redundancy check engine
US9791509B2 (en) Monitoring microprocessor interface information for a preset service using an address based filter
KR20200135881A (en) Progressive length error control code
CN113721986B (en) Data compression method and device, electronic equipment and storage medium
US10044500B2 (en) Error correction coding redundancy based data hashing
KR102058495B1 (en) Error detection circuit and semiconductor integrated circuit using the same
US20120023388A1 (en) Parity Look-Ahead Scheme for Tag Cache Memory
US10771095B2 (en) Data processing device, data processing method, and computer readable medium

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16892283

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16892283

Country of ref document: EP

Kind code of ref document: A1