JP2001358594A - Crc computing device and crc computing method - Google Patents

Crc computing device and crc computing method

Info

Publication number
JP2001358594A
JP2001358594A JP2001113541A JP2001113541A JP2001358594A JP 2001358594 A JP2001358594 A JP 2001358594A JP 2001113541 A JP2001113541 A JP 2001113541A JP 2001113541 A JP2001113541 A JP 2001113541A JP 2001358594 A JP2001358594 A JP 2001358594A
Authority
JP
Japan
Prior art keywords
data
crc
generator polynomial
arithmetic
value
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
JP2001113541A
Other languages
Japanese (ja)
Other versions
JP3512175B2 (en
Inventor
Takao Yoshida
貴夫 吉田
Minoru Okamoto
稔 岡本
Masayuki Yamasaki
雅之 山▲さき▼
Kazuhiro Okabayashi
和宏 岡林
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2001113541A priority Critical patent/JP3512175B2/en
Publication of JP2001358594A publication Critical patent/JP2001358594A/en
Application granted granted Critical
Publication of JP3512175B2 publication Critical patent/JP3512175B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Detection And Correction Of Errors (AREA)
  • Error Detection And Correction (AREA)

Abstract

PROBLEM TO BE SOLVED: To conduct a high-speed CRC computation and use flexibly various generating polynominals without excessive increase in circuit scale. SOLUTION: A CRC computing device is comprised of a circuit provided in general with a DSP that is added with several circuits, and it is provided with a generating polynominal supply part 11 which is provided with a first general-purpose register 12 storing an optional generating polynominal or a selector 13 that selects and outputs the generating polynominal or a data having all bits of zero value, a computed data supply part 21 which is provided with a memory 22, a shift register 23, a second general-purpose register 24, and a barrel shifter 25 and outputs a computed data for CRC computation on the basis of the transmission and reception data, a computing part which conducts CRC computation using the generating polynominal and computed data outputted from the generating polynominal supply part 11 and computed data supply part 21, and a computation command execution control part 41 to control the operation of each part.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、送受信データが通
信路を介して伝送される際、または伝送のためのデータ
処理がなされる際などに、上記送受信データに誤りが生
じたか否かを検出するための誤り検出符号であるCRC
(Cyclic Redundancy Check:巡回冗長性検査)符号の
生成、またはそのような誤り検出符号が付加された送受
信データの符号誤り検出を行うCRC演算装置、および
CRC演算方法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention detects whether or not an error has occurred in transmission / reception data when the transmission / reception data is transmitted via a communication path or when data processing for transmission is performed. CRC which is an error detection code for performing
(Cyclic Redundancy Check) The present invention relates to a CRC operation device and a CRC operation method for generating a code or detecting a code error of transmission / reception data added with such an error detection code.

【0002】[0002]

【従来の技術】CRCは、ディジタル通信において頻繁
に使用されている誤り検出方式である。この誤り検出方
式は、次のようにして誤りの検出を行うものである。す
なわち、送信側では、送信データを高次の多項式とみな
して、所定の生成多項式で除算することによって得られ
る剰余をCRC符号として送信データの後に付加する
(符号化)。受信側では、同じ生成多項式を用いて除算
を行い(復号)、剰余が0であるならば、伝送されたデ
ータに誤りがないと判定する一方、剰余が0でなければ
誤りがあると判定する(誤り検出)。上記生成多項式と
しては、例えば次のようなものが実際のCRCに使用さ
れている。 (1)CRC−12 (2)CRC−16 (3)CRC−CCITT 上記のような符号化や誤り検出、すなわちCRC演算を
行う装置としては、ハードウェアによってCRC演算を
行うCRC演算装置がある。これは、シフトレジスタと
排他的論理和ゲートとを組み合わせることによって構成
された除算器を用いている。この種の装置では、上記シ
フトレジスタと上記排他的論理和ゲートとがどのように
接続されるかによって、生成多項式が決定される。この
ため、この種の装置では生成多項式を変更することがで
きない。それゆえ、適用される生成多項式ごとに、異な
った装置を用いる必要がある。また、送信側と受信側と
で、同一の生成多項式が適用される装置を用いなければ
ならない。
2. Description of the Related Art CRC is an error detection system frequently used in digital communication. This error detection method detects an error as follows. That is, on the transmission side, the transmission data is regarded as a higher-order polynomial, and the remainder obtained by dividing by a predetermined generator polynomial is added to the transmission data as a CRC code (encoding). On the receiving side, division is performed using the same generator polynomial (decoding), and if the remainder is 0, it is determined that there is no error in the transmitted data, while if the remainder is not 0, it is determined that there is an error. (Error detection). As the generator polynomial, for example, the following is used for an actual CRC. (1) CRC-12 (2) CRC-16 (3) CRC-CCITT As an apparatus for performing the above-described encoding and error detection, that is, a CRC operation, there is a CRC operation apparatus for performing a CRC operation by hardware. This uses a divider configured by combining a shift register and an exclusive OR gate. In this type of device, a generator polynomial is determined by how the shift register and the exclusive OR gate are connected. For this reason, the generator polynomial cannot be changed with this type of device. Therefore, it is necessary to use a different device for each applied generator polynomial. In addition, a device to which the same generator polynomial is applied must be used on the transmitting side and the receiving side.

【0003】一方、種々の生成多項式を柔軟に適用でき
るCRC演算装置としては、ソフトウェアによってCR
C演算を行う装置がある。このような装置では、プログ
ラムまたはデータを切り替えるだけで、容易に種々の生
成多項式を適用することができる。ところが、通常、上
記CRC演算は通信端末のプロセッサによって実行さ
れ、そのプロセッサに大きな負荷をかけるため、通信端
末の処理能力が低下する。また、ソフトウェアによるC
RC演算は演算速度が遅いため、高速通信には適してい
ない。
On the other hand, as a CRC operation device to which various generator polynomials can be flexibly applied, a CR operation device by software is used.
There is a device for performing C operation. In such a device, various generator polynomials can be easily applied simply by switching the program or data. However, usually, the CRC calculation is executed by the processor of the communication terminal, and a heavy load is applied to the processor, so that the processing capability of the communication terminal is reduced. Also, C by software
Since the RC operation has a low operation speed, it is not suitable for high-speed communication.

【0004】そこで、生成多項式の柔軟性とCRC演算
の高速性とを両立させ得る装置として、例えば特開平5
−151007号公報に開示されているように、生成多
項式設定レジスタと、シフトレジスタと、排他的論理和
ゲートとが組み合わされて構成された装置が知られてい
る。この装置は、ハードウェアによってCRC演算が行
われるため、高速な処理が可能であるとともに、生成多
項式設定レジスタに設定される生成多項式を変更するこ
とによって、種々の生成多項式を適用することができ
る。
Therefore, as an apparatus which can achieve both the flexibility of the generator polynomial and the high speed of the CRC operation, for example, Japanese Patent Laid-Open No.
As disclosed in JP-A-151007, there is known a device configured by combining a generator polynomial setting register, a shift register, and an exclusive OR gate. Since this device performs a CRC operation by hardware, high-speed processing is possible, and various generator polynomials can be applied by changing the generator polynomial set in the generator polynomial setting register.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、上記の
ようなCRC演算装置は、CRC演算のために特化した
専用回路を用いるものであるため、通信装置等の回路規
模の増大を招くという問題点を有していた。また、生成
多項式設定レジスタと同じビット長の生成多項式につい
ては種々のものが適用できるが、異なるビット長の生成
多項式の適用については、考慮されていなかった。
However, since the above-described CRC operation device uses a dedicated circuit specialized for the CRC operation, the circuit scale of a communication device or the like is increased. Had. Although various types of generator polynomials having the same bit length as the generator polynomial setting register can be applied, application of generator polynomials having different bit lengths has not been considered.

【0006】本発明は、上記の点に鑑み、大幅な回路規
模の増加を招くことなく、高速なCRC演算を行うこと
ができ、しかも、種々の生成多項式を柔軟に適用するこ
とができるCRC演算装置の提供を目的としている。
In view of the above, the present invention provides a CRC operation which can perform a high-speed CRC operation without significantly increasing the circuit scale, and which can flexibly apply various generator polynomials. It is intended to provide equipment.

【0007】[0007]

【課題を解決するための手段】上記の目的を達成するた
め、本発明は、CRC演算装置であって、生成多項式を
示すデータ保持し、上記生成多項式を示すデータと、全
ビットの値が0であるゼロデータとを選択的に出力する
生成多項式供給手段と、CRC演算を行う演算データを
出力する演算データ供給手段と、上記生成多項式を示す
データまたはゼロデータと、上記演算データとの排他的
論理和演算を行う算術論理演算手段とを備え、上記生成
多項式供給手段は、上記算術論理演算手段による演算結
果の最上位ビットの値に応じて、上記生成多項式を示す
データと、ゼロデータとの選択をするように構成され、
上記演算データ供給手段は、上記算術論理演算手段によ
る演算結果の最上位ビットよりも下位のビットの値を上
位ビットの値とし、未処理のCRC演算対象となるデー
タの最上位ビットの値を最下位ビットの値とするデータ
を上記演算データとして出力するように構成されている
ことを特徴とする。
In order to achieve the above object, the present invention relates to a CRC operation device, which holds data indicating a generator polynomial, and sets the data indicating the generator polynomial and the value of all bits to 0. A generator polynomial supply means for selectively outputting zero data, a calculation data supply means for outputting calculation data for performing a CRC calculation, an exclusive data of the generation polynomial or zero data, and the calculation data Arithmetic / logic operation means for performing a logical sum operation, wherein the generator polynomial supply means outputs data of the generator polynomial and zero data according to the value of the most significant bit of the operation result by the arithmetic / logic operation means. Configured to make a choice,
The arithmetic data supply means sets the value of a bit lower than the most significant bit of the operation result of the arithmetic and logic operation means to the value of the upper bit, and sets the value of the most significant bit of the data to be subjected to the unprocessed CRC operation to the most significant bit. It is characterized in that it is configured to output data as the value of the lower bit as the operation data.

【0008】上記生成多項式供給手段は、具体的には、
例えば、上記生成多項式を示すデータを保持する第1の
レジスタと、上記生成多項式を示すデータまたは上記ゼ
ロデータを選択的に出力するセレクタとを備え、上記演
算データ供給手段は、具体的には、例えば、上記算術論
理演算手段による上記演算結果を保持する第2のレジス
タと、上記第2のレジスタに保持される上記演算結果を
1ビット左シフトして出力するシフタと、上記未処理の
CRC演算対象となるデータを保持するメモリと、上記
メモリから転送された、上記未処理のCRC演算対象と
なるデータのうちの一部を保持し、上記保持されたデー
タの最上位ビットの値を出力するとともに、上記保持さ
れたデータを1ビットずつ左シフトするシフトレジスタ
とを備えることによって構成することができる。
[0008] Specifically, the generator polynomial supply means includes:
For example, a first register for holding data indicating the generator polynomial, and a selector for selectively outputting the data indicating the generator polynomial or the zero data, the arithmetic data supply means may include: For example, a second register for holding the operation result by the arithmetic and logic operation means, a shifter for shifting the operation result held in the second register left by one bit and outputting the result, and an unprocessed CRC operation A memory for holding the target data; and a part of the unprocessed data to be subjected to the CRC operation transferred from the memory, and outputs the value of the most significant bit of the stored data. And a shift register that shifts the held data left by one bit.

【0009】これにより、上記生成多項式供給手段に保
持させる生成多項式を示すデータを変更することによっ
て、種々の生成多項式を柔軟に適用することが容易にで
きる。また、上記算術論理演算手段に入力される、生成
多項式を示すデータまたはゼロデータの選択や、CRC
演算を行う演算データの生成は、プログラム命令の実行
によることなく自動的に行われるので、高速なCRC演
算を行うことができる。しかも、上記生成多項式供給手
段、供給手段、および算術論理演算手段は、主として、
通常のプロセッサが備えている構成要素を用いることが
できるので、CRC演算装置を含む装置全体の回路規模
の増大を小さく抑えることができる。
Thus, various generator polynomials can be easily applied flexibly by changing the data indicating the generator polynomial held by the generator polynomial supply means. Further, selection of data indicating a generator polynomial or zero data, which is input to the arithmetic and logic operation means,
Since the generation of the operation data for performing the operation is automatically performed without depending on the execution of the program instruction, a high-speed CRC operation can be performed. Moreover, the generator polynomial supply means, supply means, and arithmetic and logic operation means mainly include
Since the components included in a normal processor can be used, it is possible to suppress an increase in the circuit scale of the entire device including the CRC operation device.

【0010】また、さらに、演算命令実行制御手段を備
え、上記演算命令実行制御手段は、所定の演算命令に応
じて、上記生成多項式供給手段による上記生成多項式を
示すデータまたはゼロデータの出力、上記演算データ供
給手段による上記演算データの出力、および上記算術論
理演算手段による上記排他的論理和演算の実行を制御す
るように構成されてもよい。
Further, the apparatus further comprises an operation instruction execution control means, wherein the operation instruction execution control means outputs data or zero data indicating the generation polynomial by the generation polynomial supply means in accordance with a predetermined operation instruction. The output of the operation data by the operation data supply unit and the execution of the exclusive OR operation by the arithmetic and logic operation unit may be controlled.

【0011】上記演算命令実行制御手段は、例えば、所
定の演算命令に応じて、1回の上記算術論理演算手段に
よる上記排他的論理和演算が行われるための上記生成多
項式供給手段、上記演算データ供給手段、および上記算
術論理演算手段による動作を制御するように構成されて
もよく、また、所定の演算命令に応じて、上記未処理の
CRC演算対象となるデータのすべてに対して上記算術
論理演算手段による上記排他的論理和演算が行われるた
めの、上記生成多項式供給手段、上記演算データ供給手
段、および上記算術論理演算手段による動作を制御する
ように構成されてもよく、また、所定の演算命令に応じ
て、上記シフトレジスタに保持された全てのビットの値
に対して上記算術論理演算手段による上記排他的論理和
演算が行われるための、上記生成多項式供給手段、上記
演算データ供給手段、および上記算術論理演算手段によ
る動作を制御するように構成されてもよい。
The arithmetic instruction execution control means includes, for example, the generating polynomial supply means for performing the exclusive OR operation by the arithmetic and logical operation means once in accordance with a predetermined arithmetic instruction; The arithmetic and logic unit may be configured to control an operation of the arithmetic and logic unit. The arithmetic and logic unit may perform the arithmetic and logic operation on all of the unprocessed data to be subjected to the CRC operation according to a predetermined operation instruction. The generator may be configured to control the operations of the generator polynomial supply unit, the operation data supply unit, and the arithmetic and logic operation unit for performing the exclusive OR operation by the operation unit. According to the operation instruction, the exclusive OR operation is performed on the values of all the bits held in the shift register by the arithmetic and logical operation means. Of the generating polynomial supply means, the operation data supply means, and it may be configured to control the operation by the arithmetic logic unit.

【0012】これらにより、演算命令の組み合わせの自
由度を高くしてCRC演算処理の柔軟性を高くしたり、
少ない演算命令でCRC演算処理の高速性を高めたりす
ることができる。
Thus, the flexibility of the CRC operation process is increased by increasing the degree of freedom of the combination of operation instructions,
It is possible to increase the speed of the CRC operation processing with a small number of operation instructions.

【0013】また、上記未処理のCRC演算対象となる
データのすべてに対して上記算術論理演算手段による上
記排他的論理和演算が行われた後に、上記第2のレジス
タに保持されている値を上記メモリに格納するように構
成したり、上記未処理のCRC演算対象となるデータの
すべてに対して上記算術論理演算手段による上記排他的
論理和演算が行われた後に、上記第2のレジスタに保持
されている値が0であるか否かによって、上記上記未処
理のCRC演算対象となるデータに誤りがあるか否かを
判定するように構成したりしてもよい。
After the exclusive OR operation is performed by the arithmetic and logic means on all of the unprocessed data to be subjected to the CRC operation, the value held in the second register is changed. After the exclusive-OR operation is performed by the arithmetic and logical operation means on all of the unprocessed data to be subjected to the CRC operation, the data is stored in the second register. It may be configured such that it is determined whether or not there is an error in the data to be subjected to the unprocessed CRC calculation, depending on whether or not the held value is 0.

【0014】これらにより、CRC符号化やデータの誤
りの検出を容易に行うことができる。
Thus, CRC coding and data error detection can be easily performed.

【0015】また、上記生成多項式供給手段は、上記生
成多項式を示すデータのビット数が、上記生成多項式供
給手段が保持し得るビット数よりも少ない場合に、上記
生成多項式を示すデータを上位詰めで保持するととも
に、下位のビットに0の値を保持するように構成されて
もよい。
Further, the generator polynomial supply means fills the data indicating the generator polynomial with a higher-order data when the number of bits of the data indicating the generator polynomial is smaller than the number of bits that the generator polynomial supply means can hold. It may be configured to hold the value and to hold the value of 0 in the lower bit while holding.

【0016】これにより、生成多項式の種類だけでな
く、そのビット数に関しても、適用される生成多項式の
柔軟性を高くすることができる。
Thus, the flexibility of the generator polynomial to be applied can be increased not only with respect to the type of generator polynomial but also the number of bits.

【0017】また、本発明は、CRC演算装置であっ
て、生成多項式を示すデータを保持する生成多項式保持
手段と、生成多項式を示すデータ、およびCRC演算対
象となるデータに基づいてCRC演算を行うCRC演算
手段とを備え、上記生成多項式を示すデータのビット数
が、上記生成多項式保持手段が保持し得るビット数より
も少ない場合に、上記生成多項式保持手段に、上記生成
多項式を示すデータが上位詰めで保持されるとともに、
下位のビットに0の値が保持されるように構成されてい
ることを特徴とする。
According to another aspect of the present invention, there is provided a CRC operation device, wherein a generator polynomial holding means for holding data indicating a generator polynomial, and a CRC operation is performed based on data indicating the generator polynomial and data to be subjected to a CRC operation. When the number of bits of the data indicating the generator polynomial is smaller than the number of bits that can be held by the generator polynomial holding means, the data indicating the generator polynomial is stored in the generator polynomial holding means. While being held in the stuffing,
The low-order bit is configured to hold a value of 0.

【0018】これにより、CRC演算に特化した専用の
回路を構成する場合でも、生成多項式の種類だけでな
く、そのビット数に関しても、適用される生成多項式の
柔軟性を高くすることができる。
Thus, even when a dedicated circuit specialized for CRC calculation is configured, not only the type of the generator polynomial but also the number of bits thereof, the flexibility of the generator polynomial to be applied can be increased.

【0019】[0019]

【発明の実施の形態】以下、本発明の実施形態につい
て、図面を参照して説明する。
Embodiments of the present invention will be described below with reference to the drawings.

【0020】(実施の形態1)本発明の実施の形態とし
て、DSP(digital signal processor)などのプロセ
ッサの内部に設けられたCRC演算装置の例を図1に基
づいて説明する。この装置は、一般的にDSPが備えて
いる回路に、若干の回路を付加することによって構成さ
れている。
(Embodiment 1) As an embodiment of the present invention, an example of a CRC arithmetic unit provided inside a processor such as a DSP (digital signal processor) will be described with reference to FIG. This device is generally configured by adding some circuits to circuits provided in a DSP.

【0021】図1に示すように、このCRC演算装置に
は、任意の生成多項式(を示すデータ)を保持し、出力
する生成多項式供給部11(生成多項式供給手段)と、
送受信データに基づいてCRC演算のための演算データ
を出力する演算データ供給部21(演算データ供給手
段)と、上記生成多項式供給部11および演算データ供
給部21から出力される生成多項式および演算データを
用いてCRC演算を行う演算部31(算術論理演算手
段)と、上記各部の動作を制御する演算命令実行制御部
41(演算命令実行制御手段)とが設けられている。
As shown in FIG. 1, the CRC operation device includes a generator polynomial supply section 11 (generator polynomial supply means) for holding and outputting an arbitrary generator polynomial (data indicating).
An operation data supply unit 21 (operation data supply means) for outputting operation data for CRC operation based on the transmission / reception data, and the generation polynomial supply unit 11 and the generation polynomial and operation data output from the operation data supply unit 21 An operation unit 31 (arithmetic logic operation means) for performing a CRC operation using the same, and an operation instruction execution control unit 41 (operation instruction execution control means) for controlling the operation of each unit are provided.

【0022】上記生成多項式供給部11は、生成多項式
が格納される第1の汎用レジスタ12と、上記第1の汎
用レジスタ12に格納された値(生成多項式)、または
全ビットの値が0のデータ(”0”)を選択して出力す
るセレクタ13とを備えている。上記セレクタ13は、
より詳しくは、後述する第2の汎用レジスタ24の最上
位ビット(MSB)の値が0のときには”0”を選択す
る一方、1のときには第1の汎用レジスタ12に格納さ
れた生成多項式を選択するようになっている。なお、上
記セレクタ13は、実際には、第1の汎用レジスタ12
の各ビットの値と第2の汎用レジスタ24のMSBの値
とを論理積演算するAND回路列などによって構成して
もよい。
The generator polynomial supply unit 11 includes a first general-purpose register 12 in which a generator polynomial is stored, and a value (generator polynomial) stored in the first general-purpose register 12 or a value in which all bits are zero. A selector 13 for selecting and outputting data ("0"). The selector 13 is:
More specifically, when the value of the most significant bit (MSB) of the second general-purpose register 24 to be described later is 0, “0” is selected, and when it is 1, the generator polynomial stored in the first general-purpose register 12 is selected. It is supposed to. Note that the selector 13 is actually provided with the first general-purpose register 12.
, And the value of the MSB of the second general-purpose register 24 may be configured by an AND circuit train or the like.

【0023】上記演算データ供給部21は、メモリ22
と、シフトレジスタ23と、第2の汎用レジスタ24
と、バレルシフタ25とを備えて構成されている。
The operation data supply unit 21 includes a memory 22
, A shift register 23 and a second general-purpose register 24
And a barrel shifter 25.

【0024】上記メモリ22には、送受信データが格納
されるようになっている。
The memory 22 stores transmission / reception data.

【0025】上記シフトレジスタ23は、1サイクルの
CRC演算ごとに、保持されているデータのMSBの値
を演算データのLSBの値として演算部31に出力した
後、そのデータを1ビットだけ左シフトするようになっ
ている。そして、保持されているデータの全てのビット
の値が出力されたときには、次のデータがメモリ22か
ら転送されるようになっている。
The shift register 23 outputs the value of the MSB of the held data to the calculation unit 31 as the value of the LSB of the calculation data for each cycle of the CRC calculation, and then shifts the data left by one bit. It is supposed to. Then, when the values of all the bits of the held data are output, the next data is transferred from the memory 22.

【0026】上記第2の汎用レジスタ24は、CRC演
算が開始される際に、メモリ22から初期値として転送
されたデータを保持するとともに、その後には、1サイ
クルのCRC演算ごとに、演算部31から出力される演
算結果のデータを保持するようになっている。
The second general-purpose register 24 holds the data transferred from the memory 22 as an initial value when the CRC operation is started, and thereafter, the second general-purpose register 24 executes the operation unit every one cycle of the CRC operation. The data of the operation result output from the terminal 31 is held.

【0027】上記バレルシフタ25は、第2の汎用レジ
スタ24に保持されているデータを1ビットだけ左シフ
トした後、そのLSBより上位のビットの値を、演算デ
ータのLSBより上位のビットの値として演算部31に
出力するようになっている。なお、前記のようにシフト
レジスタ23のMSBの値が演算部31に直接入力され
るのに代えて、このバレルシフタ25に入力されて、上
記左シフトの際に演算データのLSBの値となるように
してもよい。
The barrel shifter 25 shifts the data held in the second general-purpose register 24 to the left by one bit, and sets the value of the bit higher than the LSB as the value of the bit higher than the LSB of the operation data. The data is output to the calculation unit 31. Note that, instead of the MSB value of the shift register 23 being directly input to the operation unit 31 as described above, the MSB value is input to the barrel shifter 25 and becomes the LSB value of the operation data at the time of the left shift. It may be.

【0028】また、上記演算部31は、算術論理演算器
32を備え、上記生成多項式供給部11から出力される
生成多項式または”0”と、上記演算データ供給部21
から出力される演算データとの排他的論理和演算を実行
するようになっている。その演算結果のデータは、前記
のように第2の汎用レジスタ24に格納される。
The operation unit 31 includes an arithmetic and logic operation unit 32. The operation polynomial or "0" output from the generation polynomial supply unit 11 and the operation data supply unit 21 are provided.
An exclusive-OR operation with the operation data output from is performed. The data of the operation result is stored in the second general-purpose register 24 as described above.

【0029】上記各部は、それぞれ例えばMビットのビ
ット幅を有している。
Each of the above sections has a bit width of, for example, M bits.

【0030】また、演算命令実行制御部41は、プログ
ラムとして与えられる演算命令に基づいて、DSPを構
成する各部の動作を制御するとともに、CRC演算に関
連する演算命令に基づいて、主として上記各部の動作を
制御するようになっている。
The operation instruction execution control unit 41 controls the operation of each unit constituting the DSP based on the operation instruction given as a program, and mainly executes the operation of each of the above units based on the operation instruction related to the CRC operation. The operation is controlled.

【0031】ここで、上記第1の汎用レジスタ12、メ
モリ22、第2の汎用レジスタ24、バレルシフタ2
5、および算術論理演算器32は、通常、プロセッサが
備えているものを用いることができる。すなわち、特に
CRC演算のために設けられているのは、主として、セ
レクタ13、シフトレジスタ23、前記各部などとの間
の信号パス、および演算命令実行制御部41におけるC
RC演算のための制御機能を有している部分である。そ
れゆえ、一般的なプロセッサに、これらの構成要素を付
加するだけで、CRC演算装置を構成することができ、
CRC演算装置全体がCRC演算に特化したものではな
いため、DSPなどの全体の回路規模の増加を少なく抑
えることができる。
Here, the first general-purpose register 12, the memory 22, the second general-purpose register 24, the barrel shifter 2
5 and the arithmetic and logic unit 32 may be those normally provided in a processor. That is, particularly provided for the CRC operation are mainly the signal path between the selector 13, the shift register 23, the above-described units, and the like, and the C command in the operation instruction execution control unit 41.
This part has a control function for RC calculation. Therefore, a CRC processor can be configured by simply adding these components to a general processor,
Since the entire CRC operation device is not specialized for the CRC operation, an increase in the overall circuit scale of the DSP or the like can be suppressed.

【0032】上記のように構成されたCRC演算装置で
は、演算命令実行制御部41に与えられる演算命令に応
じてCRC演算が行われる。以下、その動作について、
図2のフローチャートに基づいて説明する。(なお、以
下の各ステップは説明の便宜のためのものであって、命
令サイクルやマシンサイクルと必ずしも1対1に対応す
るものではない。) (ステップS1) まず、転送命令によって、第1の汎
用レジスタ12に生成多項式が設定される。ここで、設
定される生成多項式のビット長をNとすると、N<M
(Mは第1の汎用レジスタ12のビット幅)であっても
よい。その場合には、左シフト命令などにより上位詰め
されて下位のビットに0が埋め込まれた値が第1の汎用
レジスタ12に設定される。
In the CRC operation device configured as described above, the CRC operation is performed according to the operation instruction given to the operation instruction execution control unit 41. Below, about the operation,
A description will be given based on the flowchart of FIG. (Note that the following steps are for convenience of description and do not necessarily correspond one-to-one with instruction cycles and machine cycles.) (Step S1) First, a first instruction is performed by a transfer instruction. A generator polynomial is set in the general-purpose register 12. Here, assuming that the bit length of the generator polynomial to be set is N, N <M
(M is the bit width of the first general-purpose register 12). In this case, a value in which upper bits are padded by a left shift instruction or the like and 0 is embedded in lower bits is set in the first general-purpose register 12.

【0033】(ステップS2) 同様に、転送命令によ
って、メモリ22に格納されている送受信データのうち
の最初のMビットのデータ(初期データ)が第2の汎用
レジスタ24に設定される。
(Step S2) Similarly, the first M-bit data (initial data) of the transmission / reception data stored in the memory 22 is set in the second general-purpose register 24 by the transfer command.

【0034】(ステップS3) さらに、転送命令によ
って、次のMビットのデータ(入力データ1〜X)がシ
フトレジスタ23に設定される。
(Step S3) Further, the next M bits of data (input data 1 to X) are set in the shift register 23 by the transfer command.

【0035】(ステップS4) 次に、MサイクルのC
RC演算、すなわち、シフトレジスタ23に保持された
Mビットの送受信データに対応するCRC演算が実行さ
れる。より詳しくは、以下のような動作が行われる。
(Step S4) Next, C of M cycles
An RC operation, that is, a CRC operation corresponding to the M-bit transmission / reception data held in the shift register 23 is performed. More specifically, the following operation is performed.

【0036】すなわち、算術論理演算器32は、第2の
汎用レジスタ24に保持された値が上記のようにバレル
シフタ25からシフトされて出力される値のうちの上位
M−1ビットの値およびシフトレジスタ23から出力さ
れるMSBの1ビットの値との合計Mビットの演算デー
タと、セレクタ13から出力されるMビットの生成多項
式(Nビットと0の場合も含む)または全ビットの値が
0のデータとの排他的論理和演算を行い、演算結果のデ
ータを第2の汎用レジスタ24に格納する。すなわち、
1ビットの送受信データに対応する1サイクルのCRC
演算が行われる。また、シフトレジスタ23に保持され
ている値が1ビット左シフトされ、LSBには0が埋め
込まれる。そして、これらの動作が、例えば繰り返し命
令(続く命令を所定回数繰り返すことを示す命令)と、
CRC演算命令との組み合わせによってM回繰り返され
る。これによって、例えば1サイクルのCRC演算(お
よびシフトレジスタ23のシフト動作)を1マシンサイ
クルで行わせることも可能になる。なお、上記繰り返し
命令とCRC演算命令との組み合わせによる動作と同じ
動作を単一の命令によって行わせ得るようにしてもよ
い。また、処理速度は遅くなるが、汎用レジスタに値M
をセットして1サイクルのCRC演算ごとにデクリメン
トし、値が0になるまでCRC演算を繰り返すようにし
てもよい。
That is, the arithmetic and logic unit 32 calculates the value of the upper M-1 bits and the shift value of the value held in the second general-purpose register 24 from the value shifted and output from the barrel shifter 25 as described above. The operation data of M bits in total with the 1-bit value of the MSB output from the register 23 and the generator polynomial of M bits (including the case of N bits and 0) output from the selector 13 or the value of all bits is 0 The exclusive-OR operation is performed with the data of (i), and the data of the operation result is stored in the second general-purpose register 24. That is,
1-cycle CRC corresponding to 1-bit transmission / reception data
An operation is performed. Further, the value held in the shift register 23 is shifted left by one bit, and 0 is embedded in the LSB. These operations are, for example, a repetition command (a command indicating that a subsequent command is repeated a predetermined number of times),
It is repeated M times in combination with the CRC operation instruction. Thus, for example, one cycle of the CRC operation (and the shift operation of the shift register 23) can be performed in one machine cycle. The same operation as the operation by the combination of the repetition instruction and the CRC operation instruction may be performed by a single instruction. Also, although the processing speed is slow, the value M
May be set and decremented for each CRC operation in one cycle, and the CRC operation may be repeated until the value becomes zero.

【0037】(ステップS5) MサイクルのCRC演
算が終了すると、メモリ22に保持されている残りの送
受信データが最終データかどうか(残りがMビット以下
かどうか)が判定される。この判定は、具体的には、例
えばメモリ22からシフトレジスタ23に転送される送
受信データのアドレスを示す図示しないポインタの値が
最終データのアドレスになったかどうかが判定されるよ
うにしてもよいし、MサイクルのCRC演算の回数をカ
ウント(ダウンカウント)し、送受信データの全ビット
数KからMを減算してMで整数除算した商X、 X=int((K−M)/M) の回数だけ繰り返されたかどうかが判定されるようにす
るなどしてもよい。また、上記CRC演算の回数のカウ
ントや判定は、プログラム命令によって行われるように
してもよいし、ハードウェアによって自動的に行われる
ようにしてもよい。(なお、上記KからMが減算される
のは、最初のMビットは初期データとして第2の汎用レ
ジスタ24に設定されるからである。)メモリ22に残
っているのが最終データでなければ、上記ステップS3
〜S5が繰り返される。
(Step S5) When the M-cycle CRC calculation is completed, it is determined whether the remaining transmission / reception data held in the memory 22 is the final data (whether the remaining data is M bits or less). Specifically, this determination may be made, for example, to determine whether or not the value of a pointer (not shown) indicating the address of the transmission / reception data transferred from the memory 22 to the shift register 23 has become the address of the final data. , X = int ((K−M) / M) where the number of CRC operations in M cycles is counted (down-counted), and M is subtracted from the total number of bits K of the transmitted / received data and integer divided by M. For example, it may be determined whether or not the number of times has been repeated. Further, the counting and determination of the number of times of the CRC operation may be performed by a program command, or may be automatically performed by hardware. (Note that M is subtracted from K because the first M bits are set in the second general-purpose register 24 as initial data.) If the remaining data in the memory 22 is not the final data, , Step S3
To S5 are repeated.

【0038】(ステップS6) 上記ステップS6で、
メモリ22に残っている送受信データが最終データであ
ると判定されると、その最終データがシフトレジスタ2
3に転送される。ここで、最終データのビット数は、図
3に示すように、送受信データの全ビット数KからMを
減算してMで除算した剰余L、すなわち L=(K−M)modM である。この剰余LはMより小さいので、最終データは
シフトレジスタ23に上位詰めで設定され、下位のビッ
トに0が埋め込まれる。
(Step S6) In the above step S6,
If it is determined that the transmission / reception data remaining in the memory 22 is the final data, the final data is stored in the shift register 2.
3 is transferred. Here, as shown in FIG. 3, the number of bits of the final data is a remainder L obtained by subtracting M from the total number of bits K of the transmission / reception data and dividing by M, that is, L = (KM) modM. Since this remainder L is smaller than M, the final data is set in the shift register 23 with the upper bits shifted, and 0 is embedded in the lower bits.

【0039】(ステップS7) 最後に、上記ステップ
S4と同様に、M+LサイクルのCRC演算が行われ
る。これによって、全部でM×X+M+L=Kサイクル
のCRC演算が行われることになる。(なお、最終CR
C演算のステップ数において剰余Lに算術論理演算器3
2のビット幅Mが加算されるのは、送受信データの最後
のビットが算術論理演算器32のMSBより1つ上位の
ビットにシフトされるまで演算を繰り返すためである。
これは、送受信データを2のN乗倍して、そのLSBま
でCRC演算をすることに相当する。)そこで、ステッ
プS7でM+Lサイクル(全部の合計では上記のように
Kサイクル)のCRC演算が終了したときに第2の汎用
レジスタ24に保持されている値が、送受信データ全体
に対するCRC演算結果となる。そこで、送信の場合に
は、この第2の汎用レジスタ24に保持されている値が
例えば一旦メモリ22に格納されて、送信データに付加
されることにより、CRC符号化された送信データとな
る。また、受信の場合には、この第2の汎用レジスタ2
4に保持されている値が0であるかどうかを判断するこ
とによって、具体的には、例えば第2の汎用レジスタ2
4に保持された値と全ビットの値が0であるゼロデータ
との排他的論理和演算を行い、図示しないゼロフラグレ
ジスタがセットされるかどうかなどによって、受信され
たデータに誤りがないかどうかを判定することができ
る。
(Step S7) Finally, as in step S4, a CRC operation of M + L cycles is performed. As a result, a CRC operation of M × X + M + L = K cycles is performed in total. (Final CR
Arithmetic and logical operation unit 3 adds remainder L to the number of steps of C operation
The reason why the bit width M of 2 is added is that the operation is repeated until the last bit of the transmission / reception data is shifted to a bit higher than the MSB of the arithmetic and logic unit 32 by one.
This is equivalent to multiplying the transmission / reception data by 2 to the Nth power and performing a CRC operation up to the LSB. Therefore, the value held in the second general-purpose register 24 when the CRC operation of M + L cycles (K cycle in total as described above) is completed in step S7 is the result of the CRC operation for the entire transmitted / received data. Become. Therefore, in the case of transmission, the value held in the second general-purpose register 24 is temporarily stored in, for example, the memory 22 and added to the transmission data, thereby obtaining CRC-coded transmission data. In the case of reception, the second general-purpose register 2
4 is determined by determining whether the value held in the second general-purpose register 2 is 0 or not.
Performs an exclusive OR operation on the value held in 4 and zero data in which all the bit values are 0, and checks whether or not an error is included in the received data by checking whether a zero flag register (not shown) is set. Can be determined.

【0040】次に、上記動作について、図4、5に基づ
き、具体的なデータ例を挙げて説明する。
Next, the above operation will be described with reference to FIGS.

【0041】まず、符号化の例について説明する。この
例では、図4に示すように、符号化前の送信データが
「100000110101(2進表現)」(ビット数
K=12)、生成多項式が「10101(2進表現)」
(ビット数N=5)とする。この場合、5サイクルのC
RC演算の繰返し回数Xは、 X=int((K−M)/M)=int((12−5)
/5)=1回、 最終データのビット数Lは、 L=(K−M)modM=(12−5)mod5=2、 また、最終CRC演算のサイクル数は、 M+L=5+2=7 である。
First, an example of encoding will be described. In this example, as shown in FIG. 4, the transmission data before encoding is “100000110101 (binary representation)” (the number of bits K = 12), and the generator polynomial is “10101 (binary representation)”.
(The number of bits N = 5). In this case, 5 cycles of C
The number of repetitions X of the RC operation is as follows: X = int ((KM) / M) = int ((12-5)
/ 5) = 1, the number of bits L of the final data is L = (K−M) modM = (12−5) mod5 = 2, and the number of cycles of the final CRC operation is M + L = 5 + 2 = 7. .

【0042】(1)CRC演算が開始される際には、第
1の汎用レジスタ12に上記生成多項式「10101」
が設定されるとともに、第2の汎用レジスタ24に、送
信データの最初の5ビットの値「10000」が設定さ
れ、シフトレジスタ23には続く5ビットの値「011
01」が設定される。
(1) When the CRC operation is started, the generator polynomial “10101” is stored in the first general-purpose register 12.
Is set, the first 5-bit value “10000” of the transmission data is set in the second general-purpose register 24, and the subsequent 5-bit value “011” is set in the shift register 23.
01 "is set.

【0043】(2)最初のCRC演算サイクル1では、
第2の汎用レジスタ24のMSBの値は「1」なので、
セレクタ13によって生成多項式「10101」が選択
され、その生成多項式と、第2の汎用レジスタ24のM
SBより下位の4ビット(正確には、バレルシフタ25
によって左シフトされた後のLSBより上位の4ビッ
ト)の値「0000」およびシフトレジスタ23のMS
Bの値「0」とが、算術論理演算器32によって排他的
論理和演算される。その演算結果は「10101」とな
り、この演算結果は第2の汎用レジスタ24に格納され
る。
(2) In the first CRC operation cycle 1,
Since the value of the MSB of the second general-purpose register 24 is “1”,
The selector 13 selects the generator polynomial “10101”, and the generator polynomial and the M of the second general register 24 are selected.
4 bits lower than SB (more precisely, barrel shifter 25
"0000" of the upper 4 bits of the LSB after being shifted left by
The arithmetic logic unit 32 performs an exclusive OR operation on the value “0” of B. The calculation result is “10101”, and the calculation result is stored in the second general-purpose register 24.

【0044】(3)また、シフトレジスタ23に保持さ
れている値は、1ビット左シフトされる。ここで、図4
ではLSBに埋め込まれる値は0になっているが、これ
は0でなくてもよい。(これに対して、最終CRC演算
では、送信データを2のN乗倍することに対応させるた
めに0が埋め込まれる必要がある。) (4)以下、同様の動作が繰り返され、5サイクルのC
RC演算が終了すると、メモリ22に格納されている2
ビットの最終データ「01」がシフトレジスタ23に上
位詰めで下位のビットに0が埋め込まれて転送される。
以下、最終CRC演算で上記(2)(3)と同様の動作
が7サイクル繰り返される。
(3) The value held in the shift register 23 is shifted left by one bit. Here, FIG.
In the example, the value embedded in the LSB is 0, but this may not be 0. (On the other hand, in the final CRC operation, it is necessary to embed 0 in order to cope with the transmission data being multiplied by 2 to the Nth power.) (4) Thereafter, the same operation is repeated and 5 cycles C
When the RC calculation is completed, the 2 stored in the memory 22
The final data “01” of the bit is transferred to the shift register 23 while the lower bit is filled with “0” and the lower bit is filled with “0”.
Hereinafter, the same operations as the above (2) and (3) are repeated seven cycles in the final CRC calculation.

【0045】(5)最終CRC演算が終了したときに第
2の汎用レジスタ24に保持されている値「0001
0」がCRC演算結果である。そこで、図5に示すよう
に元の送信データの末尾に上記CRC演算結果が誤り検
出符号として付加されて、17ビットの符号化データ
(「10000011010100010」)となる。
(5) The value "0001" held in the second general-purpose register 24 when the final CRC operation is completed.
"0" is the CRC calculation result. Therefore, as shown in FIG. 5, the CRC operation result is added to the end of the original transmission data as an error detection code, and becomes 17-bit encoded data ("10000011010101000").

【0046】一方、上記のようにして符号化されたデー
タの復号が行われる場合の動作は、図5に示すように、
上記符号化の場合の(1)〜(4)と同様である。この
復号によって、CRC演算結果が同図に示すように「0
0000」になれば、データに誤りがないと判定され
る。
On the other hand, when the data encoded as described above is decoded, the operation is as shown in FIG.
This is the same as (1) to (4) for the above encoding. As a result of this decoding, the CRC operation result becomes "0" as shown in FIG.
0000 ", it is determined that there is no error in the data.

【0047】ここで、この例では、上記のように誤り検
出符号が付加されて、データのビット長が17ビットに
なっているので、5サイクルのCRC演算の繰返し回数
Xは、 X=int((K−M)/M)=int((17−5)
/5)=2回、 最終データのビット数Lは、 L=(K−M)modM=(17−5)mod5=2、 となる。また、最終CRC演算のサイクル数は、 M+L=5+2=7 であるが、図5に示すように、最終データのビット数L
と同じ2サイクルのCRC演算を行った時点で剰余が0
になっていれば、その後の剰余も0のままになる一方、
0になっていなければ、その後に0になることもないの
で、2サイクルで動作を停止させても結果は同じであ
る。ただし、上記のように7サイクル繰り返すようにし
て、すなわち符号化と復号とで同じ動作が行われるよう
にして構成の簡素化を図るようにしてもよい。
In this example, since the error detection code is added as described above and the bit length of the data is 17 bits, the number of repetitions X of the 5-cycle CRC calculation is X = int ( (KM) / M) = int ((17-5)
/ 5) = 2 times, the number L of bits of the final data is as follows: L = (K−M) modM = (17−5) mod5 = 2. Further, the number of cycles of the final CRC operation is M + L = 5 + 2 = 7, but as shown in FIG.
When the same two-cycle CRC operation as in
, The remainder will remain 0,
If it does not become 0, it does not become 0 thereafter, so even if the operation is stopped in two cycles, the result is the same. However, the configuration may be simplified by repeating seven cycles as described above, that is, by performing the same operation in encoding and decoding.

【0048】なお、上記の例では、各構成要素のビット
幅が互いに同じ例を示したが、これに限らず、例えば第
1の汎用レジスタ12、および算術論理演算器32と、
他の構成要素とでビット幅が異なるようにしたり、第1
の汎用レジスタ12等と算術論理演算器32とでビット
幅が異なるようにしたりしてもよい。
In the above example, the example in which the bit width of each component is the same is shown. However, the present invention is not limited to this. For example, the first general-purpose register 12 and the arithmetic and logic
The bit width may be different from other components,
Or the arithmetic and logic unit 32 may have different bit widths.

【0049】また、送受信データはメモリ22に格納さ
れる例を示したが、例えば受信データがシリアルデータ
として入力される場合には、シフトレジスタ23を設け
ず、受信データが、バッファ(FIFO:first in fir
st out)から直接第2の汎用レジスタ24や算術論理演
算器32に供給されるようにするなどしてもよい。
Also, an example in which the transmission / reception data is stored in the memory 22 has been described. For example, when the reception data is input as serial data, the shift register 23 is not provided and the reception data is stored in a buffer (FIFO: first in fir
st out) may be directly supplied to the second general-purpose register 24 or the arithmetic and logic unit 32.

【0050】また、上記CRC演算装置においては、バ
レルシフタ25は入力されるデータを1ビットシフトさ
せるだけなので、サイクルタイムに余裕が有る場合など
には、シフトレジスタを用いることもできる。
Further, in the above-described CRC operation device, the barrel shifter 25 shifts the input data only by one bit, so that a shift register can be used when there is a margin in the cycle time.

【0051】また、第2の汎用レジスタ24に代えて、
CRC演算専用のレジスタを設ける場合には、入出力を
1ビットずらすことによって、バレルシフタ25を用い
ないようにすることもできる。
In place of the second general-purpose register 24,
When a register dedicated to the CRC operation is provided, the barrel shifter 25 may not be used by shifting the input / output by one bit.

【0052】また、第1の汎用レジスタ12や第2の汎
用レジスタ24に代えて、メモリを用いるようにするこ
ともできる。
Further, a memory may be used instead of the first general-purpose register 12 and the second general-purpose register 24.

【0053】また、セレクタ13の切り替え制御は、上
記のように第2の汎用レジスタ24のMSBの値によっ
て行うのに限らず、算術論理演算器32によって排他的
論理和演算が行われる際に、その演算結果のMSBの値
を保持するフラグレジスタを設け、そのフラグレジスタ
に保持される値によって制御するなどしてもよい。な
お、この場合に、最初の1サイクルのCRC演算が行わ
れる際には、一旦、バレルシフタ25で左シフトさせず
に(または25をバイパスさせて)算術論理演算器32
に入力させるようにすれば、最初のフラグレジスタの値
を設定することができる。
Further, the switching control of the selector 13 is not limited to the above-described operation using the value of the MSB of the second general-purpose register 24. When the exclusive-OR operation is performed by the arithmetic and logic operation unit 32, A flag register that holds the value of the MSB of the operation result may be provided, and control may be performed by the value held in the flag register. In this case, when the CRC operation of the first cycle is performed, the arithmetic and logic unit 32 is not temporarily shifted to the left by the barrel shifter 25 (or is bypassed).
, The value of the first flag register can be set.

【0054】また、送受信データの全てのビットについ
ての上記のような一連のCRC演算が、演算命令実行制
御部41に組み込まれたマイクロプログラムによって実
行されるようにして、1または少数のプログラム命令で
CRC演算を指示し得るようにしてもよい。
Further, the above-described series of CRC operations for all bits of the transmission / reception data is executed by the microprogram incorporated in the operation instruction execution control unit 41, so that one or a small number of program instructions are used. It may be possible to instruct CRC calculation.

【0055】(実施の形態2)実施の形態2として、生
成多項式設定レジスタを含むハードウェアによって構成
され、任意のビット長の生成多項式を適用することがで
きるCRC演算装置の例を説明する。
(Embodiment 2) As Embodiment 2, an example of a CRC operation device constituted by hardware including a generator polynomial setting register and capable of applying a generator polynomial of an arbitrary bit length will be described.

【0056】このCRC演算装置は、図6に示すよう
に、CRC演算部51と、生成多項式供給部61とを備
えている。
As shown in FIG. 6, the CRC operation device includes a CRC operation unit 51 and a generator polynomial supply unit 61.

【0057】上記CRC演算部51(CRC演算手段)
は、所定のM段(Mビット分)のD型フリップフロップ
52…が、排他的論理和ゲート53…を介して接続され
て構成されている。このCRC演算部51は、演算デー
タが1ビットずつ入力されることにより、CRC演算を
行うようになっている。演算結果の商は、最後段のD型
フリップフロップ52から順次出力され、剰余は、CR
C演算が終了した時点で各D型フリップフロップ52か
ら出力される。
The CRC operation section 51 (CRC operation means)
Are configured such that D-type flip-flops 52 of predetermined M stages (for M bits) are connected via exclusive OR gates 53. The CRC operation unit 51 performs a CRC operation by inputting operation data one bit at a time. The quotient of the operation result is sequentially output from the last D-type flip-flop 52, and the remainder is CR
When the C operation is completed, the data is output from each D-type flip-flop 52.

【0058】また、生成多項式供給部61は、生成多項
式が格納されるMビット幅の生成多項式設定レジスタ6
2(生成多項式保持手段)と、セレクタ63と、上位詰
め部64とを備えている。上記セレクタ63は、最後段
のD型フリップフロップ52からの出力に応じて、前記
実施の形態1のセレクタ13と同様に、生成多項式設定
レジスタ62に格納された値(生成多項式)、または全
ビットの値が0のデータ(”0”)を出力するようにな
っている。また、上位詰め部64は、適用される生成多
項式のビット数Nが生成多項式設定レジスタ62のビッ
ト幅Mよりも小さいときに、生成多項式が上位詰めされ
て下位のビットに0が埋め込まれた値を生成多項式設定
レジスタ62に格納するようになっている。具体的に
は、例えばシフトレジスタによって左シフトするように
してもよいし、プログラムのシフト命令などによって左
シフトするようにしてもよい。また、上記上位詰め部6
4を設けるのに代えて、あらかじめ上位詰めされた生成
多項式を入力するようにしてもよい。
The generator polynomial supply section 61 has an M-bit width generator polynomial setting register 6 in which the generator polynomial is stored.
2 (generating polynomial holding means), a selector 63, and a higher-order padding unit 64. According to the output from the last-stage D-type flip-flop 52, the selector 63, like the selector 13 of the first embodiment, stores the value (generation polynomial) stored in the generator polynomial setting register 62 or all bits. Is output as data (“0”) having a value of 0. When the number N of bits of the generator polynomial to be applied is smaller than the bit width M of the generator polynomial setting register 62, the higher-order padding unit 64 fills the upper-order of the generator polynomial and pads the lower bits with 0. Is stored in the generator polynomial setting register 62. Specifically, for example, the left shift may be performed by a shift register, or the left shift may be performed by a shift instruction of a program. In addition, the upper-order padding unit 6
Instead of providing 4, a generator polynomial that has been padded in advance may be input.

【0059】上記のように構成されていることにより、
生成多項式のビット数Nが生成多項式設定レジスタ62
のビット幅Mよりも小さい場合、上位のNビットよりも
下位のビットに関しては、生成多項式設定レジスタ62
に0が埋め込まれているので、最後段のD型フリップフ
ロップ52からの出力に係らず、セレクタ63からは0
が出力される。そこで、上記下位のビットに対応する排
他的論理和ゲート53からは、前段のD型フリップフロ
ップ52から出力される値と同じ値が出力されるので、
生成多項式のビット数と、生成多項式設定レジスタ62
のビット幅と、D型フリップフロップ52の段数とが互
いに等しい場合と同じ結果が得られる。したがって、ビ
ット数に関しても、適用される生成多項式の柔軟性を高
くすることができる。
With the above configuration,
The number of bits N of the generator polynomial is determined by the generator polynomial setting register 62.
When the bit width M is smaller than the bit width M, the generator polynomial setting register 62
Is embedded in the selector 63, regardless of the output from the D-type flip-flop 52 at the last stage.
Is output. Therefore, the same value as the value output from the preceding D-type flip-flop 52 is output from the exclusive OR gate 53 corresponding to the lower-order bit.
Number of bits of generator polynomial and generator polynomial setting register 62
And the number of stages of the D-type flip-flop 52 are equal to each other, the same result can be obtained. Therefore, regarding the number of bits, the flexibility of the applied generator polynomial can be increased.

【0060】[0060]

【発明の効果】以上のように、本発明によれば、通常、
プロセッサ等が備える構成要素を用い得るようにするこ
とにより、大幅な回路規模の増加を招くことなく、高速
なCRC演算を行うことができ、しかも、種々の生成多
項式を柔軟に適用することができるという効果を奏す
る。
As described above, according to the present invention, usually,
By using components included in a processor or the like, high-speed CRC calculation can be performed without significantly increasing the circuit scale, and various generator polynomials can be flexibly applied. This has the effect.

【図面の簡単な説明】[Brief description of the drawings]

【図1】実施の形態1のCRC演算装置の構成を示すブ
ロック図である。
FIG. 1 is a block diagram illustrating a configuration of a CRC calculation device according to a first embodiment.

【図2】実施の形態1のCRC演算装置の動作を示すフ
ローチャートである。
FIG. 2 is a flowchart illustrating an operation of the CRC operation device according to the first embodiment;

【図3】実施の形態1のCRC演算装置のデータの区切
りの例を示す説明図である。
FIG. 3 is an explanatory diagram showing an example of data division in the CRC operation device according to the first embodiment;

【図4】実施の形態1のCRC演算装置の符号化動作の
具体例を示す説明図である。
FIG. 4 is an explanatory diagram showing a specific example of an encoding operation of the CRC operation device according to the first embodiment.

【図5】実施の形態1のCRC演算装置の復号動作の具
体例を示す説明図である。
FIG. 5 is an explanatory diagram showing a specific example of a decoding operation of the CRC operation device according to the first embodiment.

【図6】実施の形態2のCRC演算装置の構成を示すブ
ロック図である。
FIG. 6 is a block diagram illustrating a configuration of a CRC calculation device according to a second embodiment.

【符号の説明】[Explanation of symbols]

11 生成多項式供給部 12 第1の汎用レジスタ 13 セレクタ 21 演算データ供給部 22 メモリ 23 シフトレジスタ 24 第2の汎用レジスタ 25 バレルシフタ 31 演算部 32 算術論理演算器 41 演算命令実行制御部 51 CRC演算部 52 D型フリップフロップ 53 排他的論理和ゲート 61 生成多項式供給部 62 生成多項式設定レジスタ 63 セレクタ 64 上位詰め部 Reference Signs List 11 generator polynomial supply unit 12 first general-purpose register 13 selector 21 operation data supply unit 22 memory 23 shift register 24 second general-purpose register 25 barrel shifter 31 operation unit 32 arithmetic logic unit 41 operation instruction execution control unit 51 CRC operation unit 52 D-type flip-flop 53 Exclusive OR gate 61 Generator polynomial supply unit 62 Generator polynomial setting register 63 Selector 64 Upper-order padding unit

───────────────────────────────────────────────────── フロントページの続き (72)発明者 山▲さき▼ 雅之 大阪府門真市大字門真1006番地 松下電器 産業株式会社内 (72)発明者 岡林 和宏 大阪府門真市大字門真1006番地 松下電器 産業株式会社内 Fターム(参考) 5B001 AA04 AB01 AB03 AC01 AD06 AE02 5J065 AC02 AD04 AH04 AH05 AH06 AH09  ──────────────────────────────────────────────────続 き Continuing from the front page (72) Inventor Yamasaki Saki ▼ 1006 Kadoma, Kazumasa, Osaka Prefecture Matsushita Electric Industrial Co., Ltd. (72) Kazuhiro Okabayashi 1006 Kadoma, Kazuma, Kadoma, Osaka Matsushita Electric Industrial In-house F term (reference) 5B001 AA04 AB01 AB03 AC01 AD06 AE02 5J065 AC02 AD04 AH04 AH05 AH06 AH09

Claims (11)

【特許請求の範囲】[Claims] 【請求項1】生成多項式を示すデータ保持し、上記生成
多項式を示すデータと、全ビットの値が0であるゼロデ
ータとを選択的に出力する生成多項式供給手段と、 CRC演算を行う演算データを出力する演算データ供給
手段と、 上記生成多項式を示すデータまたはゼロデータと、上記
演算データとの排他的論理和演算を行う算術論理演算手
段とを備え、 上記生成多項式供給手段は、上記算術論理演算手段によ
る演算結果の最上位ビットの値に応じて、上記生成多項
式を示すデータと、ゼロデータとの選択をするように構
成され、 上記演算データ供給手段は、上記算術論理演算手段によ
る演算結果の最上位ビットよりも下位のビットの値を上
位ビットの値とし、未処理のCRC演算対象となるデー
タの最上位ビットの値を最下位ビットの値とするデータ
を上記演算データとして出力するように構成されている
ことを特徴とするCRC演算装置。
1. A generator polynomial supply means for holding data indicating a generator polynomial and selectively outputting data indicating the generator polynomial and zero data in which all bits are 0, and operation data for performing a CRC operation And arithmetic or logic operation means for performing an exclusive-OR operation on the data indicating the generator polynomial and zero data and the operation data, wherein the generator polynomial supply means includes the arithmetic logic The data indicating the generator polynomial and zero data are selected in accordance with the value of the most significant bit of the operation result by the operation means. The operation data supply means is configured to select the operation result by the arithmetic and logic operation means. The value of a bit lower than the most significant bit of the data is defined as the value of the upper bit, and the value of the most significant bit of the data to be subjected to the CRC operation is defined as the value of the least significant bit. A CRC calculation device configured to output data to be processed as the calculation data.
【請求項2】請求項1のCRC演算装置であって、 上記生成多項式供給手段は、 上記生成多項式を示すデータを保持する第1のレジスタ
と、 上記生成多項式を示すデータまたは上記ゼロデータを選
択的に出力するセレクタとを備え、 上記演算データ供給手段は、 上記算術論理演算手段による上記演算結果を保持する第
2のレジスタと、 上記第2のレジスタに保持される上記演算結果を1ビッ
ト左シフトして出力するシフタと、 上記未処理のCRC演算対象となるデータを保持するメ
モリと、 上記メモリから転送された、上記未処理のCRC演算対
象となるデータのうちの一部を保持し、上記保持された
データの最上位ビットの値を出力するとともに、上記保
持されたデータを1ビットずつ左シフトするシフトレジ
スタとを備えたことを特徴とするCRC演算装置。
2. The CRC operation device according to claim 1, wherein said generator polynomial supply means selects a first register holding data indicating said generator polynomial, and selects data indicating said generator polynomial or said zero data. An arithmetic data supply means, a second register for holding the operation result by the arithmetic and logic operation means, and a left bit for the operation result held in the second register. A shifter for shifting and outputting, a memory for holding the unprocessed CRC operation target data, and a part of the unprocessed CRC operation target data transferred from the memory, A shift register that outputs the value of the most significant bit of the stored data and shifts the stored data left by one bit. CRC arithmetic unit to symptoms.
【請求項3】請求項1のCRC演算装置であって、さら
に、 演算命令実行制御手段を備え、上記演算命令実行制御手
段は、所定の演算命令に応じて、上記生成多項式供給手
段による上記生成多項式を示すデータまたはゼロデータ
の出力、上記演算データ供給手段による上記演算データ
の出力、および上記算術論理演算手段による上記排他的
論理和演算の実行を制御するように構成されていること
を特徴とするCRC演算装置。
3. The CRC operation device according to claim 1, further comprising an operation instruction execution control means, wherein said operation instruction execution control means responds to a predetermined operation instruction by said generation polynomial supply means. Output of data indicating a polynomial or zero data, output of the operation data by the operation data supply means, and execution of the exclusive OR operation by the arithmetic and logic operation means. CRC calculation device.
【請求項4】請求項3のCRC演算装置であって、 上記演算命令実行制御手段は、所定の演算命令に応じ
て、1回の上記算術論理演算手段による上記排他的論理
和演算が行われるための上記生成多項式供給手段、上記
演算データ供給手段、および上記算術論理演算手段によ
る動作を制御するように構成されていることを特徴とす
るCRC演算装置。
4. The CRC operation device according to claim 3, wherein said operation instruction execution control means performs said exclusive OR operation once by said arithmetic logic operation means according to a predetermined operation instruction. A CRC operation device configured to control operations of the generator polynomial supply means, the operation data supply means, and the arithmetic and logic operation means.
【請求項5】請求項3のCRC演算装置であって、 上記演算命令実行制御手段は、所定の演算命令に応じ
て、上記未処理のCRC演算対象となるデータのすべて
に対して上記算術論理演算手段による上記排他的論理和
演算が行われるための、上記生成多項式供給手段、上記
演算データ供給手段、および上記算術論理演算手段によ
る動作を制御するように構成されていることを特徴とす
るCRC演算装置。
5. The CRC operation device according to claim 3, wherein said operation instruction execution control means performs an arithmetic logic operation on all of the unprocessed data subjected to the CRC operation in accordance with a predetermined operation instruction. A CRC configured to control operations of the generator polynomial supply unit, the operation data supply unit, and the arithmetic and logic operation unit for performing the exclusive OR operation by the operation unit. Arithmetic unit.
【請求項6】請求項2のCRC演算装置であって、さら
に、 演算命令実行制御手段を備え、上記演算命令実行制御手
段は、所定の演算命令に応じて、上記シフトレジスタに
保持された全てのビットの値に対して上記算術論理演算
手段による上記排他的論理和演算が行われるための、上
記生成多項式供給手段、上記演算データ供給手段、およ
び上記算術論理演算手段による動作を制御するように構
成されていることを特徴とするCRC演算装置。
6. The CRC operation device according to claim 2, further comprising an operation instruction execution control means, wherein said operation instruction execution control means stores all of the data stored in said shift register according to a predetermined operation instruction. The exclusive-OR operation by the arithmetic and logical operation means is performed on the bit value of the arithmetic and logical operation means, so that the operations by the generator polynomial supply means, the operation data supply means, and the arithmetic and logic operation means are controlled. A CRC operation device characterized by being constituted.
【請求項7】請求項2のCRC演算装置であって、 上記未処理のCRC演算対象となるデータのすべてに対
して上記算術論理演算手段による上記排他的論理和演算
が行われた後に、上記第2のレジスタに保持されている
値を上記メモリに格納するように構成されていることを
特徴とするCRC演算装置。
7. The CRC operation device according to claim 2, wherein said exclusive OR operation is performed by said arithmetic and logic operation means on all of said unprocessed data to be subjected to CRC operation. A CRC arithmetic unit configured to store a value held in a second register in the memory.
【請求項8】請求項2のCRC演算装置であって、 上記未処理のCRC演算対象となるデータのすべてに対
して上記算術論理演算手段による上記排他的論理和演算
が行われた後に、上記第2のレジスタに保持されている
値が0であるか否かによって、上記上記未処理のCRC
演算対象となるデータに誤りがあるか否かを判定するよ
うに構成されていることを特徴とするCRC演算装置。
8. The CRC operation device according to claim 2, wherein said exclusive OR operation is performed by said arithmetic and logic operation means on all of said unprocessed data to be subjected to CRC operation. The above-mentioned unprocessed CRC is determined by whether the value held in the second register is 0 or not.
A CRC calculation device configured to determine whether data to be calculated has an error.
【請求項9】請求項1のCRC演算装置であって、 上記生成多項式供給手段は、上記生成多項式を示すデー
タのビット数が、上記生成多項式供給手段が保持し得る
ビット数よりも少ない場合に、上記生成多項式を示すデ
ータを上位詰めで保持するとともに、下位のビットに0
の値を保持するように構成されていることを特徴とする
CRC演算装置。
9. The CRC operation device according to claim 1, wherein said generator polynomial supply means is configured to execute the operation when the number of bits of data indicating the generator polynomial is smaller than the number of bits that the generator polynomial supply means can hold. , The data indicating the generator polynomial is held in the upper bits, and 0 is set in the lower bits.
Characterized in that it is configured to hold the value of
【請求項10】生成多項式を示すデータを保持する生成
多項式保持手段と、 生成多項式を示すデータ、およびCRC演算対象となる
データに基づいてCRC演算を行うCRC演算手段とを
備え、 上記生成多項式を示すデータのビット数が、上記生成多
項式保持手段が保持し得るビット数よりも少ない場合
に、上記生成多項式保持手段に、上記生成多項式を示す
データが上位詰めで保持されるとともに、下位のビット
に0の値が保持されるように構成されていることを特徴
とするCRC演算装置。
10. A generator polynomial holding means for holding data indicating a generator polynomial; and CRC operation means for performing a CRC operation based on data indicating the generator polynomial and data to be subjected to a CRC operation. When the number of bits of the data to be indicated is smaller than the number of bits that can be held by the generator polynomial holding means, the generator polynomial holding means holds the data indicating the generator polynomial in upper-order justification, and A CRC operation device characterized in that a value of 0 is retained.
【請求項11】生成多項式を示すデータと、全ビットの
値が0であるゼロデータとを選択的に出力する生成多項
式供給ステップと、 CRC演算を行う演算データを出力する演算データ供給
ステップと、 上記生成多項式を示すデータまたはゼロデータと、上記
演算データとの排他的論理和演算を行う算術論理演算ス
テップとを有し、 上記生成多項式供給ステップは、先立つ上記算術論理演
算ステップによる演算結果の最上位ビットの値に応じ
て、上記生成多項式を示すデータまたはゼロデータを選
択し、 上記演算データ供給ステップは、上記算術論理演算ステ
ップによる演算結果の最上位ビットよりも下位のビット
の値を上位ビットの値とし、未処理のCRC演算対象と
なるデータの最上位ビットの値を最下位ビットの値とす
るデータを上記演算データとして出力することを特徴と
するCRC演算方法。
11. A generator polynomial supply step for selectively outputting data indicating a generator polynomial and zero data having all bits of 0, an operation data supply step for outputting operation data for performing a CRC operation, An arithmetic and logic operation step of performing an exclusive OR operation on the data or the zero data indicating the generator polynomial and the operation data, wherein the generator polynomial supply step includes a step of calculating an arithmetic result of the preceding arithmetic and logic operation step. In accordance with the value of the high-order bit, data indicating the generator polynomial or zero data is selected, and the operation data supply step sets the value of a bit lower than the most significant bit of the operation result of the arithmetic and logic operation step to an upper bit And the data with the value of the most significant bit of the unprocessed CRC operation target data as the value of the least significant bit A CRC calculation method characterized by outputting as calculation data.
JP2001113541A 2000-04-14 2001-04-12 CRC calculation device and CRC calculation method Expired - Fee Related JP3512175B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001113541A JP3512175B2 (en) 2000-04-14 2001-04-12 CRC calculation device and CRC calculation method

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2000113734 2000-04-14
JP2000-113734 2000-04-14
JP2001113541A JP3512175B2 (en) 2000-04-14 2001-04-12 CRC calculation device and CRC calculation method

Publications (2)

Publication Number Publication Date
JP2001358594A true JP2001358594A (en) 2001-12-26
JP3512175B2 JP3512175B2 (en) 2004-03-29

Family

ID=26590155

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001113541A Expired - Fee Related JP3512175B2 (en) 2000-04-14 2001-04-12 CRC calculation device and CRC calculation method

Country Status (1)

Country Link
JP (1) JP3512175B2 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006513588A (en) * 2002-04-09 2006-04-20 クゥアルコム・インコーポレイテッド Apparatus and method for detecting errors in digital images
JP2006254429A (en) * 2005-03-09 2006-09-21 Samsung Electronics Co Ltd Method and means for checking fault-free transmission data
KR100736093B1 (en) 2006-01-16 2007-07-06 삼성전자주식회사 Apparatus and method for controlling nand flash
JP2010218237A (en) * 2009-03-17 2010-09-30 Renesas Electronics Corp Program verification device, and method therefor
US9748978B2 (en) 2015-04-14 2017-08-29 Fujitsu Limited CRC code calculation circuit and method thereof, and semiconductor device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006513588A (en) * 2002-04-09 2006-04-20 クゥアルコム・インコーポレイテッド Apparatus and method for detecting errors in digital images
JP2006254429A (en) * 2005-03-09 2006-09-21 Samsung Electronics Co Ltd Method and means for checking fault-free transmission data
KR100736093B1 (en) 2006-01-16 2007-07-06 삼성전자주식회사 Apparatus and method for controlling nand flash
JP2010218237A (en) * 2009-03-17 2010-09-30 Renesas Electronics Corp Program verification device, and method therefor
US9748978B2 (en) 2015-04-14 2017-08-29 Fujitsu Limited CRC code calculation circuit and method thereof, and semiconductor device

Also Published As

Publication number Publication date
JP3512175B2 (en) 2004-03-29

Similar Documents

Publication Publication Date Title
KR100745863B1 (en) Crc operation unit and crc operation method
US7506237B2 (en) Reconfigurable bit-manipulation node
US9071275B2 (en) Method and device for implementing cyclic redundancy check codes
JP2005102213A (en) Method for computing crc of message
KR100439211B1 (en) The arithmetic processing unit
JP3274668B2 (en) Arithmetic processing device and arithmetic processing method
US6081921A (en) Bit insertion approach to convolutional encoding
JP2010534007A (en) Determining message remainder
KR20060125837A (en) Encoding and decoding of reed-solomon codes using look-up tables for galois field multiplications
JPWO2009019763A1 (en) Error detection apparatus, error correction / error detection decoding apparatus and method
EP1146652B1 (en) High speed coding apparatus for convolutional codes
JP2001358594A (en) Crc computing device and crc computing method
EP1427109A2 (en) Apparatus and method of calculating a cyclic redundancy check value for a multi bit input data word
JP2001127645A (en) Error correction method and error correction device
JP3279624B2 (en) 1-bit error correction circuit based on CRC operation
JP2001036414A (en) Crc code generation circuit and crc error detection circuit
JP2005006188A (en) Crc computation method and crc computing unit
JPH06230991A (en) Method and apparatus for computation of inverse number of arbitrary element in finite field
JP4595055B2 (en) Galois field α multiplication circuit and arithmetic circuit
JP3250363B2 (en) Arithmetic unit
JP3452345B2 (en) Arithmetic processing unit and its utilization device
JP2004120419A (en) Reed-solomon coding circuit and reed-solomon decoding circuit
JP2008112522A (en) Device and method for detecting error
KR970009760B1 (en) An improved crc circuit
JPH07253895A (en) High-speed subtracter by plural bit simultaneous arithmetic operation

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20031224

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040105

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080116

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090116

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090116

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100116

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110116

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110116

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120116

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees