JP2011211353A - Crc arithmetic circuit - Google Patents

Crc arithmetic circuit Download PDF

Info

Publication number
JP2011211353A
JP2011211353A JP2010075191A JP2010075191A JP2011211353A JP 2011211353 A JP2011211353 A JP 2011211353A JP 2010075191 A JP2010075191 A JP 2010075191A JP 2010075191 A JP2010075191 A JP 2010075191A JP 2011211353 A JP2011211353 A JP 2011211353A
Authority
JP
Japan
Prior art keywords
data
crc
crc calculation
circuit
bytes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2010075191A
Other languages
Japanese (ja)
Other versions
JP5550413B2 (en
Inventor
Makoto Makimoto
允 槙本
Hiroshi Konno
拓 今野
Kazuhiro Takami
和弘 高見
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2010075191A priority Critical patent/JP5550413B2/en
Publication of JP2011211353A publication Critical patent/JP2011211353A/en
Application granted granted Critical
Publication of JP5550413B2 publication Critical patent/JP5550413B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To obtain a CRC arithmetic circuit which suppresses the increase of a circuit size when performing a parallel CRC calculation, and quickly start the CRC calculation.SOLUTION: The CRC arithmetic range calculation circuit 1 calculates a CRC arithmetic range of input data of a variable length. When input data of the variable length are expanded in N bytes concurrently, if the arithmetic range of the data including a head byte position is less than N bytes, a data order adjustment circuit 2 causes data preceding the head byte position to be 0, and if the arithmetic range of data including an end byte position is less than N bytes, it causes data following the end byte position to be replaced with 0, and at the same time, shifts the replaced data to the preceding side by N bytes. The parallel CRC calculation circuit 3 concurrently performs CRC arithmetic for the output of the data order adjustment circuit 2 in units of N bytes.

Description

本発明は、主として通信回線に使用される誤り検出方法に関し、特に、CRC(Cyclic Redundancy Check)生成における演算を行うCRC演算回路に関する。   The present invention relates to an error detection method mainly used for a communication line, and more particularly to a CRC calculation circuit that performs calculation in CRC (Cyclic Redundancy Check) generation.

Ethernet(登録商標)等のデータ通信などで伝送データに誤りが含まれているかを判定するための方式として、CRCがある。このCRC方式は、送信側では送信データを高次の多項式とみなして、所定次数の生成多項式により割り算を行い、その余りをCRCとして送信データの後に付加し符号化を行う。受信側では、送信側と同じ生成多項式を用いて割り算を行うことで復号を行い、余りが送信側で付加された値と一致する場合は受信したデータに誤りがないと判定し、付加された値と一致しない場合は誤りがあると判定する。上記生成多項式としては、例えば次のようなものが実際のCRCに使用されている。
(1)CRC8の生成多項式
+x+x+x+x+1
(2)CRC32−IEEE 802.3の生成多項式
32+x26+x23+x22+x16+x12+x11+x10+x+x+x+x+x+x+1
CRC is a method for determining whether transmission data includes an error in data communication such as Ethernet (registered trademark). In this CRC method, transmission data is regarded as a high-order polynomial on the transmission side, division is performed by a generation polynomial of a predetermined order, and the remainder is added as CRC to the transmission data for encoding. On the reception side, decoding is performed by performing division using the same generator polynomial as that on the transmission side. If the remainder matches the value added on the transmission side, it is determined that there is no error in the received data, and If it does not match the value, it is determined that there is an error. As the generator polynomial, for example, the following is used in actual CRC.
(1) CRC8 generator polynomial x 8 + x 7 + x 6 + x 4 + x 2 +1
(2) generator polynomial CRC32-IEEE 802.3 x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1

このようなCRC演算は、一般的には所定次数の生成多項式に対応する段数のシフトレジスタと排他的論理和回路で構成された回路にデータを1ビットずつ入力することで行っているが、長い入力データに対してCRC演算を短時間で行うことが要求される場合は並列CRC計算回路に対象データを並列に入力して対象データのCRC演算を行っている。   Such a CRC operation is generally performed by inputting data bit by bit into a circuit composed of a shift register having a number of stages corresponding to a generator polynomial of a predetermined order and an exclusive OR circuit. When it is required to perform CRC calculation on input data in a short time, the target data is input in parallel to the parallel CRC calculation circuit to perform CRC calculation on the target data.

例えば特許文献1に記載されているような従来のCRC演算装置においては、Nバイトの並列CRC計算を行う場合に問題となるCRC演算の対象データの先頭バイト位置がNバイトのデータの最上位にない場合とデータの終了バイト位置がNバイトのデータの最下位にない場合においても、CRC演算の対象となるデータの前に“0”が付加されてもCRCの演算結果が変化しないことを利用している。このようなCRC演算装置では、可変長のデータをNバイトパラレルに展開した場合に、最後のNバイトに出現する演算対象でないバイトの数だけ、可変長のデータの先頭に“0”を付加することにより、CRC演算部をNバイトパラレルに対する演算ブロックのみで構成するものである。   For example, in a conventional CRC calculation device as described in Patent Document 1, the first byte position of the target data of CRC calculation, which is a problem when performing N-byte parallel CRC calculation, is at the top of the N-byte data. Even when there is no data and the end byte position of the data is not at the lowest position of the N-byte data, the fact that the CRC calculation result does not change even if “0” is added in front of the data subject to the CRC calculation is used. is doing. In such a CRC calculation device, when variable-length data is expanded in N-byte parallel, “0” is added to the beginning of the variable-length data by the number of non-operational bytes appearing in the last N bytes. Thus, the CRC calculation unit is configured only with calculation blocks for N-byte parallel.

即ち、このようなCRC演算装置では、CRC演算範囲がNバイトの倍数の長さでない場合に、CRC演算範囲の長さをNで割った余り以降からNバイト目までのバイト数N−(データ長をNで割った余り)だけ先頭に“0”を付加することにより、可変長データをNバイトの倍数のサイズとしてCRC演算を行う。   That is, in such a CRC calculation device, when the CRC calculation range is not a multiple of N bytes, the number of bytes N− (data from the remainder after dividing the length of the CRC calculation range by N to the Nth byte. By adding “0” to the head of the remainder (the remainder obtained by dividing the length by N), CRC calculation is performed with the variable length data as a multiple of N bytes.

特許第3546959号公報Japanese Patent No. 3546959

上記のCRC演算装置は、CRC演算範囲が並列CRC演算回路の並列数Nバイトの倍数の長さでない場合に、終了バイトを含むデータをNバイトの長さに揃えるために、先頭に必ず“0”を付与する必要がある。このため、LENGTH情報からCRC演算範囲を計算し、先頭に付与する0の個数を算出することで解決を図っている。しかしながら、この方式はCRC演算範囲を計算するためにデータの前にLENGTH情報を付与する必要があり、LENGTH情報がデータの途中に格納されるデータ転送方式ではCRC演算開始時点のデータ先頭でLENGTH情報を知りうることができない。このため、従来のCRC演算装置では、LENGTH情報が得られるまでデータを遅延させる記憶素子を使用することになる。従って、従来のCRC演算装置では、データのビット幅×LENGTH情報が得られるまでの遅延段数分だけ回路規模が増大する問題点と、遅延段数分だけCRC算出が遅くなるという問題点があった。   When the CRC calculation range is not a multiple of the parallel number N bytes of the parallel CRC calculation circuit, the CRC calculation device described above always has “0” at the head in order to align the data including the end byte to the length of N bytes. "Must be given. For this reason, the CRC calculation range is calculated from the LENGTH information, and the number of 0 given to the head is calculated to solve the problem. However, in this method, LENGTH information needs to be added before the data in order to calculate the CRC calculation range. In the data transfer method in which LENGTH information is stored in the middle of the data, LENGTH information at the beginning of the CRC calculation starts. I can not know. For this reason, the conventional CRC arithmetic unit uses a storage element that delays data until LENGTH information is obtained. Therefore, the conventional CRC arithmetic unit has a problem that the circuit scale increases by the number of delay stages until data bit width × LENGTH information is obtained, and that CRC calculation is delayed by the number of delay stages.

この発明は、上記のような問題点を解決するためになされたもので、並列CRC計算を行う場合の回路規模の増大を抑え、かつ、CRC算出を速やかに開始することのできるCRC演算回路を得ることを目的とする。   The present invention has been made in order to solve the above-described problems. A CRC arithmetic circuit capable of suppressing an increase in circuit scale when performing parallel CRC calculation and starting CRC calculation quickly is provided. The purpose is to obtain.

この発明に係るCRC演算回路は、可変長の入力データのCRC演算範囲を計算するCRC演算範囲計算回路と、Nバイト並列にCRC演算を行う並列CRC計算回路と、CRC演算範囲計算回路で計算したCRC演算範囲に基づいて、可変長の入力データをNバイト並列に展開した場合、先頭バイト位置を含むデータの演算範囲がNバイト未満の場合、先頭バイト位置より前のデータを0とし、かつ、終了バイト位置を含むデータの演算範囲がNバイト未満の場合は、終了バイト位置より後のデータを0に置き換えると共に、置き換えたデータをNバイトの前側にシフトするデータ順番調整回路とを備え、並列CRC計算回路は、データ順番調整回路からの出力に対して並列CRC演算処理を行うものである。   The CRC calculation circuit according to the present invention is calculated by a CRC calculation range calculation circuit that calculates a CRC calculation range of variable-length input data, a parallel CRC calculation circuit that performs CRC calculation in N bytes in parallel, and a CRC calculation range calculation circuit. Based on the CRC calculation range, when variable length input data is expanded in N bytes in parallel, if the calculation range of data including the first byte position is less than N bytes, the data before the first byte position is set to 0, and When the calculation range of the data including the end byte position is less than N bytes, the data after the end byte position is replaced with 0, and the data order adjusting circuit for shifting the replaced data to the front side of N bytes is provided The CRC calculation circuit performs parallel CRC calculation processing on the output from the data order adjustment circuit.

この発明のCRC演算回路は、先頭バイト位置を含むデータの演算範囲がNバイト未満の場合、先頭バイト位置より前のデータを0とし、かつ、終了バイト位置を含むデータの演算範囲がNバイト未満の場合は、終了バイト位置より後のデータを0に置き換えると共に、置き換えたデータをNバイトの前側にシフトするようにしたので、並列CRC計算を行う場合の回路規模の増大を抑え、かつ、CRC算出を速やかに開始することができる。   In the CRC calculation circuit according to the present invention, when the calculation range of data including the first byte position is less than N bytes, the data before the first byte position is set to 0 and the calculation range of data including the end byte position is less than N bytes. In this case, since the data after the end byte position is replaced with 0 and the replaced data is shifted to the front of N bytes, an increase in circuit scale when performing parallel CRC calculation is suppressed, and CRC Calculation can be started immediately.

この発明の実施の形態1によるCRC演算回路を示す構成図である。It is a block diagram which shows the CRC calculating circuit by Embodiment 1 of this invention. この発明の実施の形態1によるCRC演算回路のCRC演算対象データの構成を示す説明図である。It is explanatory drawing which shows the structure of the CRC calculation object data of the CRC calculation circuit by Embodiment 1 of this invention. この発明の実施の形態1によるCRC演算回路の動作を示す説明図である。It is explanatory drawing which shows operation | movement of the CRC calculating circuit by Embodiment 1 of this invention. この発明の実施の形態2によるCRC演算回路を示す構成図である。It is a block diagram which shows the CRC calculating circuit by Embodiment 2 of this invention. この発明の実施の形態2によるCRC演算回路の動作を示す説明図である。It is explanatory drawing which shows operation | movement of the CRC calculating circuit by Embodiment 2 of this invention.

実施の形態1.
図1は、この発明の実施の形態1によるCRC演算回路を示す構成図である。
図示のCRC演算回路は、CRC演算範囲計算回路1、データ順番調整回路2、並列CRC計算回路3を備えている。CRC演算範囲計算回路1は、可変長入力データであるデータ入力データNバイト並列入力と、データ先頭位置信号と、先頭バイト位置情報とを入力して、CRC演算範囲を計算し、その先頭バイト位置情報と終了バイト位置情報とを出力する回路である。尚、データ先頭位置信号は、入力データの先頭位置を示す信号であり、先頭バイト位置情報は、Nバイト並列における入力データの先頭バイト位置を示す情報である。データ順番調整回路2は、入力データNバイト並列入力とデータ先頭位置信号とデータ終了位置信号とを入力し、CRC演算範囲計算回路1で演算された先頭バイト位置情報と終了バイト位置情報とに基づいて、0の挿入と、データの並べ替えを行う回路である。並列CRC計算回路3は、データ順番調整回路2で演算されたデータ列を入力し、CRC演算範囲計算回路1で演算された先頭バイト位置情報と終了バイト位置情報とに基づいて、Nバイト並列CRC演算を行う回路である。
Embodiment 1 FIG.
FIG. 1 is a block diagram showing a CRC arithmetic circuit according to Embodiment 1 of the present invention.
The illustrated CRC calculation circuit includes a CRC calculation range calculation circuit 1, a data order adjustment circuit 2, and a parallel CRC calculation circuit 3. The CRC calculation range calculation circuit 1 inputs data input data N-byte parallel input, which is variable length input data, a data head position signal, and head byte position information, calculates a CRC calculation range, and the head byte position It is a circuit for outputting information and end byte position information. The data head position signal is a signal indicating the head position of the input data, and the head byte position information is information indicating the head byte position of the input data in N bytes in parallel. The data order adjustment circuit 2 receives N bytes of parallel input data, a data head position signal, and a data end position signal, and is based on the head byte position information and end byte position information calculated by the CRC calculation range calculation circuit 1. This is a circuit for inserting 0 and rearranging data. The parallel CRC calculation circuit 3 inputs the data string calculated by the data order adjustment circuit 2 and based on the start byte position information and the end byte position information calculated by the CRC calculation range calculation circuit 1, the N-byte parallel CRC It is a circuit that performs an operation.

次に、実施の形態1のCRC演算回路における各部の動作について説明する。実施の形態1では、図2に示されている可変長の入力データに対して1バイト長のCRC8を8バイト並列CRC計算で行う場合について説明する。
CRC演算範囲計算回路1は、先頭バイト位置情報からCRC演算の先頭バイト位置を決める処理と、データ内の一意に決められた箇所に格納されるLENGTH情報に基づいて終了バイト位置を算出してCRC演算の終了位置を決める処理とを行い、得られた先頭バイト位置情報と終了バイト位置情報とをデータ順番調整回路2と並列CRC計算回路3とに出力する。
Next, the operation of each part in the CRC calculation circuit of the first embodiment will be described. In the first embodiment, a case will be described in which 1-byte CRC8 is performed by 8-byte parallel CRC calculation on variable-length input data shown in FIG.
The CRC calculation range calculation circuit 1 calculates the end byte position based on the processing for determining the start byte position of the CRC calculation from the start byte position information and the LENGTH information stored in a uniquely determined location in the data, and calculates the CRC. Processing for determining the end position of the calculation is performed, and the obtained start byte position information and end byte position information are output to the data order adjustment circuit 2 and the parallel CRC calculation circuit 3.

データ順番調整回路2は、図3に記載されているように、入力データに対して、0への置き換えと並べ替えを行う。尚、図3中データの入力順は、1−1,1−2,・・・,2−1,2−2,・・・,4−7,4−8の順である。図3において、(a)はデータ先頭バイト位置が最上位、データ終了バイト位置が最下位の場合であり、このような場合は、0への置き換えと並べ替えは実行されない。一方、(b)はデータ先頭バイト位置が最上位になく、かつ、データ終了バイト位置が最下位にない場合を示している。この(b)に示すように、先頭バイト位置を含むデータの演算範囲が8バイト未満の場合、例えばKバイトとすると、先頭バイト位置より前のデータとなる(8−K)バイトのデータは0に置き換える。また、終了バイト位置を含むデータの位置の演算範囲が8バイト未満の場合、例えばLバイトとすると、終了バイト位置より後ろのデータとなる(8−L)バイトのデータは0に置き換え、さらにLバイト、(8−L)バイトの順で入力されたデータを(8−L)バイト、Lバイトの順に入れ替える。   As shown in FIG. 3, the data order adjustment circuit 2 performs replacement with 0 and rearrangement of input data. In FIG. 3, the data input order is 1-1, 1-2,..., 2-1 2-2,. In FIG. 3, (a) shows the case where the data start byte position is the most significant and the data end byte position is the least significant. In such a case, replacement to 0 and rearrangement are not executed. On the other hand, (b) shows a case where the data start byte position is not at the most significant position and the data end byte position is not at the least significant position. As shown in (b), when the calculation range of data including the first byte position is less than 8 bytes, for example, if K bytes are used, the data of (8-K) bytes that are data before the first byte position is 0. Replace with Further, when the calculation range of the position of the data including the end byte position is less than 8 bytes, for example, when the L byte is used, the data of (8-L) bytes that is the data after the end byte position is replaced with 0, and further L Data input in the order of bytes and (8-L) bytes are replaced in the order of (8-L) bytes and L bytes.

並列CRC計算回路3は、CRC8の生成多項式x+x+x+x+x+1を8バイト(64bit)並列化した回路を使用する。CRC演算の対象となるデータの前に“0”が付加されてもCRCの演算結果が変化しないことは、一般的に知られており、データ順番調整回路2から出力されるデータを8バイト並列CRC計算回路3に入力することでCRCを算出することが可能となる。また、CRC演算が有効なデータ範囲のみに対して演算されるように先頭バイト位置情報と終了バイト位置情報を入力する。 The parallel CRC calculation circuit 3 uses a circuit obtained by parallelizing a generator polynomial x 8 + x 7 + x 6 + x 4 + x 2 +1 of CRC 8 in 8 bytes (64 bits). It is generally known that the CRC calculation result does not change even if “0” is added in front of the data subject to the CRC calculation, and the data output from the data order adjustment circuit 2 is 8-byte parallel. By inputting to the CRC calculation circuit 3, it is possible to calculate the CRC. Also, the first byte position information and the end byte position information are input so that the CRC calculation is performed only on the valid data range.

実施の形態1のCRC演算回路は、CRC演算範囲を算出する際にデータの先頭にLENGTH情報を必要としないため、CRC演算開始時点ではLENGTH情報が存在しないデータにおいてLENGTH情報を得るまでにデータを遅延させるための記憶素子分の回路規模を増やすことなくCRC演算を正しく行うことができる。また、Nバイト並列CRC計算を行うにあたり、CRC演算の対象となるデータの先頭バイト位置を含むデータ、最終バイト位置を含むデータがNバイトに満たない場合においてもデータ全体をずらすことなくCRC演算を行うことができる。   Since the CRC calculation circuit of the first embodiment does not require LENGTH information at the beginning of data when calculating the CRC calculation range, data is not obtained until LENGTH information is obtained in data that does not have LENGTH information at the start of CRC calculation. CRC calculation can be performed correctly without increasing the circuit scale of the storage element for delaying. Also, when performing N-byte parallel CRC calculation, CRC calculation is performed without shifting the entire data even when the data including the first byte position and the data including the last byte position of the data subject to CRC calculation are less than N bytes. It can be carried out.

以上のように、実施の形態1のCRC演算回路によれば、可変長の入力データのCRC演算範囲を計算するCRC演算範囲計算回路と、Nバイト並列にCRC演算を行う並列CRC計算回路と、CRC演算範囲計算回路で計算したCRC演算範囲に基づいて、可変長の入力データをNバイト並列に展開した場合、先頭バイト位置を含むデータの演算範囲がNバイト未満の場合、先頭バイト位置より前のデータを0とし、かつ、終了バイト位置を含むデータの演算範囲がNバイト未満の場合は、終了バイト位置より後のデータを0に置き換えると共に、置き換えたデータをNバイトの前側にシフトするデータ順番調整回路とを備え、並列CRC計算回路は、データ順番調整回路からの出力に対して並列CRC演算処理を行うようにしたので、回路規模の増大を抑え、かつ、CRC算出を速やかに開始することができる。   As described above, according to the CRC calculation circuit of the first embodiment, the CRC calculation range calculation circuit that calculates the CRC calculation range of variable-length input data, the parallel CRC calculation circuit that performs CRC calculation in N bytes in parallel, Based on the CRC calculation range calculated by the CRC calculation range calculation circuit, when variable-length input data is expanded in N bytes in parallel, if the calculation range of data including the first byte position is less than N bytes, it is before the first byte position. If the operation range of data including the end byte position is less than N bytes, the data after the end byte position is replaced with 0, and the replaced data is shifted to the front of N bytes. And the parallel CRC calculation circuit performs parallel CRC calculation processing on the output from the data order adjustment circuit. Suppressing scale increases, and it is possible to quickly start the CRC calculation.

また、実施の形態1のCRC演算回路によれば、CRC演算範囲計算回路は、入力データの先頭バイト位置情報と入力データ内に含まれるLENGTH情報からCRC演算範囲を計算するようにしたので、データの先頭にLENGTH情報がないデータ転送方式においても、そのLENGTH情報が得られるまでデータを遅延させる必要がなく、記憶素子による回路規模の増加と遅延段数を抑えることができる。   Further, according to the CRC calculation circuit of the first embodiment, the CRC calculation range calculation circuit calculates the CRC calculation range from the leading byte position information of the input data and the LENGTH information included in the input data. Even in a data transfer system that does not have LENGTH information at the head of the data, it is not necessary to delay the data until the LENGTH information is obtained, and an increase in circuit scale and the number of delay stages due to the storage element can be suppressed.

また、実施の形態1のCRC演算回路によれば、並列CRC計算回路は、Nバイト並列CRC計算を行うにあたり、CRC演算の対象となるデータの前に0が付加されてもCRCの演算結果が変化しないことを利用するようにしたので、CRC演算の対象となるデータの先頭バイト位置を含むデータ、最終バイト位置を含むデータがNバイトに満たない場合においてもデータ全体をずらすことなくCRC演算を行うことができる。   In addition, according to the CRC calculation circuit of the first embodiment, when the parallel CRC calculation circuit performs N-byte parallel CRC calculation, even if 0 is added before the data to be subjected to CRC calculation, the CRC calculation result is Since the fact that it does not change is used, even if the data including the first byte position and the data including the final byte position of the data subject to the CRC calculation are less than N bytes, the CRC calculation is performed without shifting the entire data. It can be carried out.

実施の形態2.
実施の形態1では、可変長の入力データに対して1バイト長のCRC8を8バイト並列CRC計算で行う場合について説明したが、実施の形態2では、図4に示すように、4バイト長のCRC32を8バイト並列CRC計算で行う場合について説明する。
Embodiment 2. FIG.
In the first embodiment, a case has been described where CRC8 having a 1-byte length is performed by 8-byte parallel CRC calculation on variable-length input data. However, in the second embodiment, as shown in FIG. The case where CRC32 is performed by 8-byte parallel CRC calculation will be described.

図4に示す実施の形態2のCRC演算回路は、実施の形態1と同様に、CRC演算範囲計算回路1、データ順番調整回路2、並列CRC計算回路3を備えると共に、最終バイト用CRC計算回路4とフリップフロップ5とを備える。最終バイト用CRC計算回路4は、最終バイト位置を含むデータの演算範囲が、CRCの生成多項式で決定されるバイト数で割り切れない場合、並列CRC計算回路3で得られたCRC演算結果と、演算が行われないデータに対応した1サイクル前のCRC演算結果とから最終バイト位置を含むデータのCRC演算を行う回路である。また、フリップフロップ5は、並列CRC計算回路3におけるCRC演算結果を保持するフリップフロップである。   The CRC calculation circuit of the second embodiment shown in FIG. 4 includes a CRC calculation range calculation circuit 1, a data order adjustment circuit 2, a parallel CRC calculation circuit 3, and a final byte CRC calculation circuit, as in the first embodiment. 4 and a flip-flop 5. The CRC calculation circuit for the last byte 4 calculates the CRC calculation result obtained by the parallel CRC calculation circuit 3 and the calculation when the calculation range of the data including the last byte position is not divisible by the number of bytes determined by the CRC generator polynomial. This is a circuit that performs CRC calculation of data including the last byte position from the CRC calculation result of the previous cycle corresponding to data that is not performed. The flip-flop 5 is a flip-flop that holds a CRC calculation result in the parallel CRC calculation circuit 3.

次に実施の形態2の動作について説明する。実施の形態2においてもデータ順番調整回路2により図3に示すデータの入れ替えを行う。並列CRC計算回路3は前記出力データに対してCRC演算を行い、8バイト長のCRCを得ることができる。この並列CRC計算回路3の構成はCRC32の生成多項式x32+x26+x23+x22+x16+x12+x11+x10+x+x+x+x+x+x+1を8バイト(64bit)並列化した回路を使用する。CRC演算の方法は、実施の形態1と同様である。 Next, the operation of the second embodiment will be described. Also in the second embodiment, the data order adjustment circuit 2 replaces the data shown in FIG. The parallel CRC calculation circuit 3 can perform a CRC operation on the output data to obtain an 8-byte CRC. The configuration of the parallel CRC calculation circuit 3 is a circuit in which a CRC32 generator polynomial x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 is parallelized by 8 bytes (64 bits). Is used. The CRC calculation method is the same as in the first embodiment.

しかし、4バイト長のCRC32を8バイト長の並列CRC計算回路3で計算する場合は、最終バイト位置を含むデータの演算範囲が4バイトで割り切れない場合に実施の形態1と同様のデータを置き換えのみで演算を実施すると、最終バイト位置を含むデータについては4バイトで割り切れない部分が計算されない。このため、実施の形態2では、最終バイト用CRC計算回路4により図5に記載されているように割り切れなかった余りの部分についてCRC演算を行う。図5において、(a)は余りの部分が3バイトの場合であり、(b)は2バイト、(c)は1バイトの場合を示している。また、図5において、C3n,C2n,C1n,C0nは最終バイトデータが含まれるデータの1サイクル前のCRCを示し、C3n+1,C2n+1,C1n+1,C0n+1は、最終バイトデータが含まれるデータから算出したCRC、C′3n+1,C′2n+1,C′1n+1,C′0n+1は、最終バイト用CRC計算回路4によるCRCを示している。   However, when the CRC 32 of 4 bytes length is calculated by the parallel CRC calculation circuit 3 of 8 bytes length, the same data as in the first embodiment is replaced when the calculation range of the data including the last byte position cannot be divided by 4 bytes. If the calculation is performed only with this, the portion that cannot be divided by 4 bytes is not calculated for the data including the last byte position. For this reason, in the second embodiment, the CRC calculation is performed on the remainder that was not divisible by the CRC calculation circuit 4 for the last byte as described in FIG. In FIG. 5, (a) shows the case where the remainder is 3 bytes, (b) shows the case of 2 bytes, and (c) shows the case of 1 byte. In FIG. 5, C3n, C2n, C1n, and C0n indicate the CRC one cycle before the data including the last byte data, and C3n + 1, C2n + 1, C1n + 1, and C0n + 1 are the last byte data. CRC, C′3n + 1, C′2n + 1, C′1n + 1, and C′0n + 1 calculated from the data including “” indicate the CRC by the CRC calculation circuit 4 for the last byte.

図5(a)に記載のように、最終バイト位置を含むデータが3バイトの場合は、並列CRC計算回路3でC0n分との計算が行われないため、並列CRC計算回路3で得られたC3n+1と、計算が行われなかったC0nとの排他的論理和をとることでCRCを正しく得ることができる。図5(b)(c)に示す最終バイト位置を含むデータが2バイト、1バイトの場合のときも、並列CRC計算回路3で計算されなかった分を、最終バイト用CRC計算回路4で計算する。上記以外の場合については、並列CRC計算回路3のCRC演算結果をそのまま出力する。   As shown in FIG. 5 (a), when the data including the last byte position is 3 bytes, the parallel CRC calculation circuit 3 does not calculate C0n, so the data obtained by the parallel CRC calculation circuit 3 is obtained. The CRC can be obtained correctly by taking the exclusive OR of C3n + 1 and C0n that has not been calculated. Even when the data including the final byte position shown in FIGS. 5B and 5C is 2 bytes and 1 byte, the data not calculated by the parallel CRC calculation circuit 3 is calculated by the CRC calculation circuit 4 for the final byte. To do. In cases other than the above, the CRC calculation result of the parallel CRC calculation circuit 3 is output as it is.

実施の形態2のCRC演算回路は、従来方式のようにデータ全体をずらすことなくCRC演算を正しく行うことができるため、データ全体をずらすための記憶素子は必要としない。   Since the CRC calculation circuit of the second embodiment can correctly perform CRC calculation without shifting the entire data as in the conventional method, a storage element for shifting the entire data is not required.

尚、上記例では、4バイト長のCRC32を8バイト並列CRC計算する方法について説明しているが、4バイト長のCRC32を16バイト並列CRC計算する場合など、CRCの生成多項式より入力データの並列化数が多いときは同様の考え方でCRC演算を正しく行うことができる。   In the above example, the method of calculating the 4-byte CRC32 with the 8-byte parallel CRC is described. However, when the 4-byte CRC32 is calculated with the 16-byte parallel CRC, the input data is calculated in parallel from the CRC generator polynomial. When the number of conversions is large, the CRC calculation can be performed correctly based on the same concept.

また、上記実施の形態1、2は、ハードウェアで実現することを目的としているが、ソフトウェアでCRCを計算する場合も同様の考え方でCRC演算を正しく行うことができる。   In addition, although the first and second embodiments are intended to be realized by hardware, CRC calculation can be correctly performed in the same way when calculating CRC by software.

以上のように、実施の形態2のCRC演算回路によれば、最終バイト位置を含むデータの演算範囲が、CRCの生成多項式で決定されるバイト数で割り切れない場合、並列CRC計算回路で得られたCRC演算結果と、演算が行われないデータに対応した1サイクル前のCRC演算結果とから最終バイト位置を含むデータのCRC演算を行う最終バイト用CRC計算回路を備えたので、CRCの生成多項式より入力データの並列化数が多い場合でも実施の形態1のCRC演算回路と同様に対応することができる。   As described above, according to the CRC calculation circuit of the second embodiment, when the calculation range of the data including the last byte position is not divisible by the number of bytes determined by the CRC generator polynomial, it is obtained by the parallel CRC calculation circuit. Since the CRC calculation circuit for the last byte that performs CRC calculation of the data including the last byte position from the CRC calculation result and the CRC calculation result of the previous cycle corresponding to the data on which the calculation is not performed is provided. Even when the number of parallelized input data is larger, it can be handled in the same manner as the CRC calculation circuit of the first embodiment.

1 CRC演算範囲計算回路、2 データ順番調整回路、3 並列CRC計算回路、4 最終バイト用CRC計算回路、5 フリップフロップ。   1 CRC calculation range calculation circuit, 2 data order adjustment circuit, 3 parallel CRC calculation circuit, 4 final byte CRC calculation circuit, 5 flip-flop.

Claims (4)

可変長の入力データのCRC演算範囲を計算するCRC演算範囲計算回路と、
Nバイト並列にCRC演算を行う並列CRC計算回路と、
前記CRC演算範囲計算回路で計算したCRC演算範囲に基づいて、前記可変長の入力データをNバイト並列に展開した場合、先頭バイト位置を含むデータの演算範囲がNバイト未満の場合、前記先頭バイト位置より前のデータを0とし、かつ、終了バイト位置を含むデータの演算範囲がNバイト未満の場合は、前記終了バイト位置より後のデータを0に置き換えると共に、当該置き換えたデータをNバイトの前側にシフトするデータ順番調整回路とを備え、
前記並列CRC計算回路は、前記データ順番調整回路からの出力に対して並列CRC演算処理を行うことを特徴とするCRC演算回路。
A CRC calculation range calculation circuit for calculating a CRC calculation range of variable length input data;
A parallel CRC calculation circuit for performing CRC calculation in N bytes in parallel;
Based on the CRC calculation range calculated by the CRC calculation range calculation circuit, when the variable length input data is expanded in N bytes in parallel, the calculation range of data including the start byte position is less than N bytes, the first byte If the data before the position is 0 and the calculation range of the data including the end byte position is less than N bytes, the data after the end byte position is replaced with 0, and the replaced data is replaced with N bytes. A data order adjustment circuit for shifting to the front side,
The parallel CRC calculation circuit performs a parallel CRC calculation process on an output from the data order adjustment circuit.
CRC演算範囲計算回路は、入力データの先頭バイト位置情報と当該入力データ内に含まれるLENGTH情報からCRC演算範囲を計算することを特徴とする請求項1記載のCRC演算回路。   2. The CRC calculation circuit according to claim 1, wherein the CRC calculation range calculation circuit calculates a CRC calculation range from the first byte position information of the input data and the LENGTH information included in the input data. 並列CRC計算回路は、Nバイト並列CRC計算を行うにあたり、CRC演算の対象となるデータの前に0が付加されてもCRCの演算結果が変化しないことを利用することを特徴とする請求項1または請求項2記載のCRC演算回路。   2. The parallel CRC calculation circuit uses that the CRC calculation result does not change even if 0 is added before the data to be subjected to CRC calculation when performing N-byte parallel CRC calculation. Or a CRC operation circuit according to claim 2. 最終バイト位置を含むデータの演算範囲が、CRCの生成多項式で決定されるバイト数で割り切れない場合、並列CRC計算回路で得られたCRC演算結果と、演算が行われないデータに対応した1サイクル前のCRC演算結果とから前記最終バイト位置を含むデータのCRC演算を行う最終バイト用CRC計算回路を備えたことを特徴とする請求項1から請求項3のうちのいずれか1項記載のCRC演算回路。   If the calculation range of the data including the last byte position is not divisible by the number of bytes determined by the CRC generator polynomial, one cycle corresponding to the CRC calculation result obtained by the parallel CRC calculation circuit and the data that is not calculated 4. The CRC according to claim 1, further comprising a CRC calculation circuit for a final byte that performs a CRC calculation of data including the final byte position based on a previous CRC calculation result. Arithmetic circuit.
JP2010075191A 2010-03-29 2010-03-29 CRC calculation circuit Expired - Fee Related JP5550413B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010075191A JP5550413B2 (en) 2010-03-29 2010-03-29 CRC calculation circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010075191A JP5550413B2 (en) 2010-03-29 2010-03-29 CRC calculation circuit

Publications (2)

Publication Number Publication Date
JP2011211353A true JP2011211353A (en) 2011-10-20
JP5550413B2 JP5550413B2 (en) 2014-07-16

Family

ID=44941986

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010075191A Expired - Fee Related JP5550413B2 (en) 2010-03-29 2010-03-29 CRC calculation circuit

Country Status (1)

Country Link
JP (1) JP5550413B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016518750A (en) * 2013-03-15 2016-06-23 ザイリンクス インコーポレイテッドXilinx Incorporated Modular and scalable cyclic redundancy check calculation circuit
KR101816266B1 (en) * 2016-11-15 2018-01-08 현대오트론 주식회사 Crc code generator or checker

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0969836A (en) * 1995-08-31 1997-03-11 Toshiba Corp Crc code generation circuit and crc code generation circuit design method
JP2002359561A (en) * 2001-05-31 2002-12-13 Nec Corp Crc processor
JP2009055407A (en) * 2007-08-28 2009-03-12 Nec Corp Parallel cyclic code generating device and parallel cyclic code checking device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0969836A (en) * 1995-08-31 1997-03-11 Toshiba Corp Crc code generation circuit and crc code generation circuit design method
JP2002359561A (en) * 2001-05-31 2002-12-13 Nec Corp Crc processor
JP3546959B2 (en) * 2001-05-31 2004-07-28 日本電気株式会社 CRC calculation device
JP2009055407A (en) * 2007-08-28 2009-03-12 Nec Corp Parallel cyclic code generating device and parallel cyclic code checking device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN6014002107; 鴫原 正博 他: '100Gbps級MAC用並列CRC演算処理の検討' 2007年電子情報通信学会通信ソサイエティ大会講演論文集2 , 20070829, p.140 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016518750A (en) * 2013-03-15 2016-06-23 ザイリンクス インコーポレイテッドXilinx Incorporated Modular and scalable cyclic redundancy check calculation circuit
KR101816266B1 (en) * 2016-11-15 2018-01-08 현대오트론 주식회사 Crc code generator or checker

Also Published As

Publication number Publication date
JP5550413B2 (en) 2014-07-16

Similar Documents

Publication Publication Date Title
US8468439B2 (en) Speed-optimized computation of cyclic redundancy check codes
JP4764973B2 (en) CRC value calculation device
CN102096609A (en) Instruction-set architecture for programmable cyclic redundancy check (CRC) computations
JP4831018B2 (en) Parallel cyclic code generation apparatus and parallel cyclic code inspection apparatus
US20180143872A1 (en) Cyclic redundancy check calculation for multiple blocks of a message
US8700971B2 (en) Parallel residue arithmetic operation unit and parallel residue arithmetic operating method
CN112306741B (en) CRC (Cyclic redundancy check) method and related device
US9419646B2 (en) Hardware compression to find backward references with multi-level hashes
US8539326B1 (en) Method and implementation of cyclic redundancy check for wide databus
CN101296053A (en) Method and system for calculating cyclic redundancy check code
EP3202045A1 (en) Method and device for calculating a crc code in parallel
JP5550413B2 (en) CRC calculation circuit
US10404277B2 (en) Compression and decompression engines and compressed domain processors
US9287893B1 (en) ASIC block for high bandwidth LZ77 decompression
CN110679090A (en) Reduced delay error correction decoding
JP3485075B2 (en) Decoding circuit and decoding method thereof
US10506388B1 (en) Efficient short message compression
US20200412649A1 (en) Crc update mechanism
US11309994B2 (en) Highly parallel and scalable cyclic redundancy check
JP3579039B2 (en) Error correction circuit using cyclic code
JP4057876B2 (en) Control method of Galois field multiplier
KR102353983B1 (en) How to arrange an algorithm in Cyclic Redundancy Check (CRC)
JP2016201770A (en) Crc code arithmetic circuit, method therefor, and semiconductor device
JP3593039B2 (en) Error and synchronization detection apparatus and method
CN113821370A (en) High-speed CRC (cyclic redundancy check) generation method and device for data transmission error check

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130123

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140117

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140128

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140327

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140422

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140520

R150 Certificate of patent or registration of utility model

Ref document number: 5550413

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees