JPH05151007A - Crc arithmetic unit - Google Patents

Crc arithmetic unit

Info

Publication number
JPH05151007A
JPH05151007A JP3340388A JP34038891A JPH05151007A JP H05151007 A JPH05151007 A JP H05151007A JP 3340388 A JP3340388 A JP 3340388A JP 34038891 A JP34038891 A JP 34038891A JP H05151007 A JPH05151007 A JP H05151007A
Authority
JP
Japan
Prior art keywords
crc
data
generator polynomial
terminal
initial 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.)
Pending
Application number
JP3340388A
Other languages
Japanese (ja)
Inventor
Takao Sawano
貴夫 沢野
Kunihiro Tanaka
邦寛 田中
Terutaka Hayashi
照貴 林
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.)
Nintendo Co Ltd
Original Assignee
Nintendo 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 Nintendo Co Ltd filed Critical Nintendo Co Ltd
Priority to JP3340388A priority Critical patent/JPH05151007A/en
Publication of JPH05151007A publication Critical patent/JPH05151007A/en
Pending legal-status Critical Current

Links

Landscapes

  • Detection And Correction Of Errors (AREA)
  • Detection And Prevention Of Errors In Transmission (AREA)

Abstract

PURPOSE:To provide the CRC arithmetic unit enabling the switching of the CRC arithmetic expression from the outside and high-speed calculation. CONSTITUTION:A CRC computing element 4 enables the setting of the generating polynomial and the initial value from the CPU of the terminal. The CRC computing element 4 performs the CRC operation for the data row to be supplied from a shift register 3 for data input based on the set generating polynomial. The arithmetic result of the CRC computing element 4 is outputted to the CPU of the terminal through an output buffer 5.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】この発明は、CRC演算装置に関
し、より特定的には入力データ列の誤りを検出するため
にCRC演算を行う装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a CRC calculation device, and more particularly to a device for performing a CRC calculation for detecting an error in an input data string.

【0002】[0002]

【従来の技術】CRC(Cyclic Redunda
ncy Check)は、同期式伝送の場合に多く使用
される誤り検出方式であり、巡回符号方式とも呼ばれて
いる。
2. Description of the Related Art CRC (Cyclic Redunda)
ncy Check) is an error detection method often used in the case of synchronous transmission, and is also called a cyclic code method.

【0003】この誤り検出方式では、送るべきデータ列
が高次の多項式(メッセージ多項式と呼ばれる)とみな
され、これが予め定められた生成多項式(Checki
ngPolynomial)で除算される。そして、そ
の除算結果の余り(BCC:Block Check
Code)がデータの後に付加して送信され、受信側で
は、同じ生成多項式を用いて除算が行われる。このと
き、余りがなければ伝送されたデータは正しいと判断さ
れる。
In this error detection method, the data string to be sent is regarded as a high-order polynomial (called a message polynomial), which is a predetermined generator polynomial (Checki).
ngPolynomial). The remainder of the division result (BCC: Block Check
Code) is added after the data and transmitted, and the reception side performs division using the same generator polynomial. At this time, if there is no remainder, the transmitted data is judged to be correct.

【0004】現在実際に使用されているCRC方式の生
成多項式には、次のようなものがある。
The following CRC generating polynomials are actually used at present.

【0005】(1)CRC−12 CRC−12は、6ビット・キャラクタの同期伝送に用
いられる。生成多項式には次式(1)が用いられ、CR
C演算の結果であるBCCは、12ビットで構成され
る。 P(x)=X12+X11+X3 +X2 +X+1 ・・・(1)
(1) CRC-12 CRC-12 is used for synchronous transmission of 6-bit characters. The following equation (1) is used for the generator polynomial, and CR
BCC, which is the result of the C operation, is composed of 12 bits. P (x) = X 12 + X 11 + X 3 + X 2 + X + 1 (1)

【0006】(2)CRC−16 CRC−16は、8ビット・キャラクタの同期伝送に用
いられ、特にEBCDICコードのデータ伝送に多く用
いられている。生成多項式には次式(2)が用いられ、
BCCは16ビットで構成される。 P(x)=X16+X15+X2 +1 ・・・(2)
(2) CRC-16 CRC-16 is used for synchronous transmission of 8-bit characters, and is often used especially for data transmission of EBCDIC code. The following equation (2) is used for the generator polynomial,
BCC consists of 16 bits. P (x) = X 16 + X 15 + X 2 +1 (2)

【0007】(3)CRC−CCITT CRC−CCITTもCRC−16と同様に8ビット・
キャラクタの同期式伝送に用いられ、ISOコードの伝
送に多く用いられている。生成多項式は次式(3)が用
いられ、BCCは16ビットで構成される。 P(x)=X16+X12+X5 +1 ・・・(3)
(3) CRC-CCITT CRC-CCITT is also 8 bits as well as CRC-16.
It is used for synchronous transmission of characters and is often used for transmission of ISO codes. The following equation (3) is used as the generator polynomial, and the BCC is composed of 16 bits. P (x) = X 16 + X 12 + X 5 +1 (3)

【0008】なお、従来のCRC誤り検出をハード回路
で行う技術は、CQ出版社から1988年3月1日に発
行された「トランジスタ技術SPECIAL」のNo.
8の第10〜11頁に詳しく開示されている。
The conventional technique for detecting a CRC error by a hard circuit is described in No. 1 of "Transistor Technology SPECIAL" issued by CQ Publishing Company on March 1, 1988.
8, pages 10-11.

【0009】[0009]

【発明が解決しようとする課題】従来のCRC演算装置
は、入力されたデータ列を予め定められた一種類の生成
多項式でのみ除算するように構成されていた。そのた
め、通信を行う相手方の端末に設けられたCRC演算装
置が異なった生成多項式を用いてCRC演算を行う場
合、CRC演算の整合性がとれずデータの誤り検出を行
うことができないという問題点があった。特に、複数の
端末との間でデータの通信を行う場合、このような問題
点は顕著なものとなる。
A conventional CRC calculation device is configured to divide an input data string by only one kind of predetermined generator polynomial. Therefore, when the CRC calculation device provided in the terminal of the other party for communication performs the CRC calculation using different generator polynomials, there is a problem in that the CRC calculation cannot be consistent and data error cannot be detected. there were. Especially, when data communication is performed with a plurality of terminals, such a problem becomes remarkable.

【0010】上記のような問題点を解消するために、端
末のコンピュータが複数種類の生成多項式によるCRC
演算プログラムを持ち、ユーザーの要望に応じて、任意
のCRC演算プログラムを実行する技術が考えられる。
しかしながら、このようなソフトウェアによる技術で
は、端末のコンピュータの負担が重くなり、本来行わな
ければならないプログラムの実行処理速度が大幅に低下
してしまう。また、コンピュータによるCRC演算は、
専用のハード回路によるCRC演算に比べて演算速度が
遅いため、高速通信には適さないという問題点もあっ
た。
In order to solve the above problems, the computer of the terminal is required to perform CRC by a plurality of types of generator polynomials.
A technique that has a calculation program and executes an arbitrary CRC calculation program according to the user's request is conceivable.
However, with such a technique using software, the load on the computer of the terminal becomes heavy, and the execution processing speed of the program that should be originally executed is significantly reduced. Also, the CRC calculation by the computer is
There is also a problem that it is not suitable for high-speed communication because the calculation speed is slower than the CRC calculation by the dedicated hardware circuit.

【0011】それゆえに、この発明の目的は、生成多項
式の変更が自由に行え、かつ高速演算が可能なCRC演
算装置を提供することである。
Therefore, an object of the present invention is to provide a CRC arithmetic unit capable of freely changing a generator polynomial and capable of high speed arithmetic.

【0012】[0012]

【課題を解決するための手段】この発明にかかるCRC
演算装置は、シフトレジスタ手段と、CRC演算手段
と、切換制御手段とを備えている。シフトレジスタ手段
は、N個(Nは2以上の整数)のラッチ回路を含み、そ
れぞれが同一のクロック信号に同期してシフト動作を行
う。CRC演算手段は、各ラッチ回路と交互に配置され
たN個の論理演算手段を含み、入力されたデータ列に対
してCRC演算を行う。切換制御手段は、入力された生
成多項式設定データに基づいて、各論理演算手段の論理
演算機能の能動化と不能動化とを切り換える。
CRC according to the present invention
The arithmetic unit includes shift register means, CRC arithmetic means, and switching control means. The shift register means includes N (N is an integer of 2 or more) latch circuits, and each performs a shift operation in synchronization with the same clock signal. The CRC calculation means includes N logic calculation means alternately arranged with each latch circuit, and performs the CRC calculation on the input data string. The switching control means switches between activation and deactivation of the logical operation function of each logical operation means based on the input generator polynomial setting data.

【0013】[0013]

【作用】この発明にかかるCRC演算装置においては、
入力された生成多項式設定データに基づいて、切換制御
手段が、各論理演算手段の論理演算機能の能動化と不能
動化とを切り換えることにより、CRC演算のための生
成多項式が切り換えられる。したがって、この発明のC
RC演算装置は、外部から演算式の変更が可能であり、
常に通信相手と整合性を保ちながらCRC演算を行うこ
とができる。また、この発明のCRC演算装置は、CR
C演算を行う専用のハード回路として構成されているの
で、高速演算が可能である。
In the CRC calculation device according to the present invention,
Based on the input generator polynomial setting data, the switching control means switches between activation and deactivation of the logical operation function of each logical operation means, thereby switching the generator polynomial for the CRC operation. Therefore, C of this invention
The RC arithmetic unit can change the arithmetic expression from the outside.
CRC calculation can be performed while always maintaining consistency with the communication partner. The CRC calculation device of the present invention is a CR
Since it is configured as a dedicated hardware circuit for performing C calculation, high speed calculation is possible.

【0014】[0014]

【実施例】図1は、この発明の一実施例の構成を示す概
略ブロック図である。図において、この実施例のCRC
演算装置は、例えば端末本体(以下、「端末」と略称す
る)に接続されたモデムの内部に設けられており、初期
値入力レジスタ1と、生成多項式設定レジスタ2と、デ
ータ入力用レジスタ3と、CRC演算器4と、出力バッ
ファ5と、クロック制御回路6とを含む。初期値入力レ
ジスタ1には、端末に含まれるCPU(図示せず)か
ら、8ビットのデータバス7を介して、例えば16ビッ
トの初期値が8ビットずつ分割して与えられる。初期値
入力レジスタ1に記憶された初期値は、CRC演算器4
に与えられて設定される。生成多項式設定レジスタ2に
は、端末のCPUから、データバス7を介して、例えば
16ビットの生成多項式設定データが8ビットずつ分割
して与えられる。生成多項式設定レジスタ2に記憶され
た生成多項式設定データは、CRC演算器4に与えられ
て設定される。例えば8ビットのデータ入力用シフトレ
ジスタ3は、端末のCPUからCRC演算の対象となる
データ列が与えられる。このデータ列は、他の端末に対
して送信すべき送信データ、または他の端末から受信し
た受信データである。データ入力用シフトレジスタ3に
記憶されたデータ列は、クロック信号CLKに同期して
順次読み出され、CRC演算器4に与えられる。CRC
演算器4は、データ入力用シフトレジスタ3から与えら
れるデータ列に対してCRC計算を行う。このとき、C
RC演算器4は、生成多項式設定レジスタ2によって設
定された生成多項式に基づいてCRC演算を行う。CR
C演算器4の出力(16ビット)は、出力バッファ5に
与えられる。出力バッファ5は、CRC演算器4から与
えられた16ビットの演算結果を、8ビットに分割して
データバス7に出力する。データバス7に出力された演
算結果は、端末のCPUに与えられる。クロック制御回
路6は、クロック発振器を含み、CPUから与えられた
入力データのバイト数を8倍した数のクロック信号(C
LK)を発生して、シフト回数に相当する数のクロック
信号をCRC演算器4に与える。
1 is a schematic block diagram showing the structure of an embodiment of the present invention. In the figure, the CRC of this embodiment
The arithmetic unit is provided inside a modem connected to, for example, a terminal body (hereinafter abbreviated as “terminal”), and has an initial value input register 1, a generator polynomial setting register 2, and a data input register 3. , CRC calculator 4, an output buffer 5, and a clock control circuit 6. To the initial value input register 1, a CPU (not shown) included in the terminal gives an initial value of, for example, 16 bits divided into 8 bits via an 8-bit data bus 7. The initial value stored in the initial value input register 1 is the CRC calculator 4
Is given to and set. To the generator polynomial setting register 2, for example, 16-bit generator polynomial setting data is divided by 8 bits from the CPU of the terminal and given via the data bus 7. The generator polynomial setting data stored in the generator polynomial setting register 2 is given to the CRC calculator 4 and set. For example, the 8-bit data input shift register 3 is provided with a data string to be subjected to CRC calculation from the CPU of the terminal. This data string is transmission data to be transmitted to another terminal or reception data received from another terminal. The data string stored in the data input shift register 3 is sequentially read in synchronization with the clock signal CLK and is given to the CRC calculator 4. CRC
The arithmetic unit 4 performs CRC calculation on the data string given from the data input shift register 3. At this time, C
The RC calculator 4 performs a CRC calculation based on the generator polynomial set by the generator polynomial setting register 2. CR
The output (16 bits) of the C arithmetic unit 4 is given to the output buffer 5. The output buffer 5 divides the 16-bit operation result given from the CRC calculator 4 into 8 bits and outputs the result to the data bus 7. The calculation result output to the data bus 7 is given to the CPU of the terminal. The clock control circuit 6 includes a clock oscillator and has a number of clock signals (C
LK), and the number of clock signals corresponding to the number of shifts is given to the CRC calculator 4.

【0015】図2は、図1に示すCRC演算装置のより
詳細な構成を示す回路図であり、特にCRC演算器4の
構成を詳細に示している。
FIG. 2 is a circuit diagram showing a more detailed structure of the CRC calculator shown in FIG. 1, and particularly shows the structure of the CRC calculator 4 in detail.

【0016】図2において、CRC演算器4は、D型フ
リップフロップ41a〜41pと、排他的論理和ゲート
42a〜42pと、スイッチ回路43b〜43qとを含
む。各D型フリップフロップ41a〜41pは、データ
端子Dと、出力端子Qと、プリセット端子PRSと、リ
セット端子RSTと、クロック端子Cとを含む。
In FIG. 2, the CRC calculator 4 includes D-type flip-flops 41a to 41p, exclusive OR gates 42a to 42p, and switch circuits 43b to 43q. Each of the D-type flip-flops 41a to 41p includes a data terminal D, an output terminal Q, a preset terminal PRS, a reset terminal RST, and a clock terminal C.

【0017】D型フリップフロップ41a〜41pの出
力端子Qから出力される信号は、それぞれ、排他的論理
和ゲート42a〜42pに与えられるとともに、出力バ
ッファ5に与えられる。排他的論理和ゲート42b〜4
2pの出力信号は、それぞれ、D型フリップフロップ4
1a〜41oのデータ端子Dに与えられる。排他的論理
和ゲート42aの出力信号は、スイッチ回路43b〜4
3pを介して排他的論理和ゲート42b〜42pに与え
られる。ここで、スイッチ回路43a〜43pは、図示
では簡略化のために機械的なスイッチ記号で示すが、実
際にはアンドゲート等の論理スイッチまたは論理ゲート
が用いられる。さらに、排他的論理和ゲート42aの出
力信号は、スイッチ回路43qを介してD型フリップフ
ロップ41pのデータ端子Dに与えられる。スイッチ回
路43b〜43qの切り換えは、生成多項式設定レジス
タ2から与えられる生成多項式設定データの対応ビット
位置の論理状態に基づいて制御される。各スイッチ43
b〜43qは、オンされたときに、排他的論理和ゲート
42aの出力信号を排他的論理和ゲート42b〜42p
およびD型フリップフロップ41pに伝達する。一方、
各スイッチ回路43b〜43qは、オフされたときに、
接地端子に接続され、排他的論理和ゲート42b〜42
pおよびD型フリップフロップ41pにLレベルの信号
を与える。排他的論理和ゲート42aには、さらにデー
タ入力用シフトレジスタ3からCRC演算の対象となる
データ列が与えられる。
The signals output from the output terminals Q of the D-type flip-flops 41a to 41p are applied to the exclusive OR gates 42a to 42p and the output buffer 5, respectively. Exclusive OR gates 42b-4
The output signals of 2p are the D-type flip-flops 4 respectively.
It is given to the data terminals D of 1a to 41o. The output signal of the exclusive OR gate 42a is output by the switch circuits 43b to 4b.
It is given to the exclusive OR gates 42b to 42p via 3p. Here, the switch circuits 43a to 43p are shown by mechanical switch symbols for simplification in the drawing, but actually, logical switches such as AND gates or logical gates are used. Further, the output signal of the exclusive OR gate 42a is given to the data terminal D of the D-type flip-flop 41p via the switch circuit 43q. Switching of the switch circuits 43b to 43q is controlled based on the logical state of the corresponding bit position of the generator polynomial setting data given from the generator polynomial setting register 2. Each switch 43
b to 43q, when turned on, output signals of the exclusive OR gate 42a to exclusive OR gates 42b to 42p.
And to the D-type flip-flop 41p. on the other hand,
When the switch circuits 43b to 43q are turned off,
Exclusive-OR gates 42b to 42 connected to the ground terminal
An L level signal is applied to p and D type flip-flop 41p. The exclusive OR gate 42a is further supplied with a data string to be subjected to a CRC operation from the data input shift register 3.

【0018】各D型フリップフロップ41a〜41pの
プリセット端子PRSおよびリセット端子RSTには、
初期値入力レジスタ1から初期値設定信号が与えられ
る。プリセット端子PRSに与えられる初期値設定信号
がHレベルであって、リセット端子RSTに与えられる
初期値設定信号がLレベルの場合、D型フリップフロッ
プの出力端子Qの出力信号の初期値はHレベルとなる。
一方、プリセット端子PRSに与えられる初期値設定信
号がLレベルでリセット端子RSTに与えられる初期値
設定信号がHレベルの場合、D型フリップフロップの出
力端子Qの出力信号の初期値はLレベルとなる。さら
に、各D型フリップフロップ41a〜41pのクロック
端子Cには、クロック信号CLKが与えられる。各D型
フリップフロップ41a〜41pは、このクロック信号
CLKに同期して、データのシフト動作を行う。したが
って、D型フリップフロップ41a〜41pによって、
いわゆるシフトレジスタが構成される。
The preset terminal PRS and the reset terminal RST of each D-type flip-flop 41a to 41p are
An initial value setting signal is given from the initial value input register 1. When the initial value setting signal given to the preset terminal PRS is at H level and the initial value setting signal given to the reset terminal RST is at L level, the initial value of the output signal of the output terminal Q of the D-type flip-flop is at H level. Becomes
On the other hand, when the initial value setting signal given to the preset terminal PRS is L level and the initial value setting signal given to the reset terminal RST is H level, the initial value of the output signal of the output terminal Q of the D-type flip-flop is L level. Become. Further, the clock signal CLK is applied to the clock terminal C of each of the D-type flip-flops 41a to 41p. Each of the D-type flip-flops 41a to 41p performs a data shift operation in synchronization with this clock signal CLK. Therefore, by the D-type flip-flops 41a to 41p,
A so-called shift register is configured.

【0019】図3は、図1および図2に示す実施例によ
って実現されるCRC誤り検出方式を説明するための模
式図である。図において、送信側の端末では、たとえば
256バイトの送信データ(1バイトはたとえば8ビッ
トで構成される)に対してCRC演算が施され、たとえ
ば16ビットのCRCデータが生成される。送信側の端
末は、元の送信データおよびCRC演算によって生成さ
れたCRCデータを、受信側の端末に送信する。受信側
の端末では、256バイトの受信データおよび16ビッ
トのCRCデータに対してCRC演算を行う。その結
果、16ビットのCRCデータが生成される。受信側の
端末は、このとき生成されたCRCデータが、図1およ
び図2に示すCRC演算装置に予め設定された初期値設
定データと一致するか否かをチェックする。チェックの
結果、CRCデータと初期値設定データとが一致した場
合はデータ誤りなしと判断され、不一致の場合はデータ
誤りがあると判断される。
FIG. 3 is a schematic diagram for explaining a CRC error detection method realized by the embodiments shown in FIGS. 1 and 2. In the figure, in the terminal on the transmission side, for example, 256 bytes of transmission data (1 byte is made up of, for example, 8 bits) is subjected to a CRC operation to generate, for example, 16 bits of CRC data. The terminal on the transmitting side transmits the original transmission data and the CRC data generated by the CRC calculation to the terminal on the receiving side. The receiving side terminal performs a CRC operation on the received data of 256 bytes and the CRC data of 16 bits. As a result, 16-bit CRC data is generated. The terminal on the receiving side checks whether or not the CRC data generated at this time matches the initial value setting data preset in the CRC calculation device shown in FIG. 1 and FIG. As a result of the check, if the CRC data and the initial value setting data match, it is determined that there is no data error, and if they do not match, it is determined that there is a data error.

【0020】図4は、図1および図2に示す実施例の動
作を示すフローチャートである。以下、この図4を参照
して、図1および図2に示す実施例の動作を説明する。
まず、ステップS1において、端末のCPUから生成多
項式設定レジスタ2に生成多項式設定データが与えられ
る。生成多項式設定データは16ビットであるが、端末
のCPUとCRC演算装置を接続するデータバスのビッ
ト幅は8ビットである。そのため、端末のCPUは、生
成多項式設定データを、8ビットずつ2回に分けて生成
多項式設定レジスタ2に出力する。生成多項式設定レジ
スタ2に記憶された生成多項式設定データは、CRC演
算器4に与えられる。これによって、CRC演算器4に
おいて、生成多項式の設定が行われる。より具体的に説
明すると、CRC演算器4におけるスイッチ回路43b
〜43qが個別的にオンまたはオフ状態とされる。オン
状態とされたスイッチ回路は、排他的論理和ゲート42
aの出力信号を、対応する排他的論理和ゲートまたはD
型フリップフロップ41pにフィードバックする。オフ
状態とされたスイッチ回路は、対応する排他的論理和ゲ
ートまたはD型フリップフロップ41pにLレベルの信
号を伝達する。各排他的論理和ゲート42b〜42p
は、対応するスイッチ回路43b〜43pを介して排他
的論理和ゲート42aの出力信号がフィードバックされ
たとき、このフィードバック信号と対応するD型フリッ
プフロップ41b〜41pの出力信号との論理演算(排
他的論理和演算)を行う。一方、各排他的論理和ゲート
42b〜42pは、対応するスイッチ回路43b〜43
pを介してLレベルの信号が与えられたとき、上記のよ
うな論理演算を行わず、対応するフリップフロップ41
b〜41pの出力信号をそのまま出力する。すなわち、
このとき排他的論理和ゲート42b〜42pは、単なる
ドライバとして動作し、データスルーの状態になる。参
考のために、各スイッチ回路43b〜43qと生成多項
式との関係を、図5に示しておく。図5において、排他
的論理和ゲート42aの出力信号は、下式(4)の生成
多項式P(x)の係数aに相当し、スイッチ回路43b
〜43qのオン・オフ状態は、下式(4)の生成多項式
P(x)の係数b〜qに相当する。具体的には、スイッ
チ回路43b〜43qがオンのときは係数b〜qが1と
なり、オフのときは係数b〜qが0(すなわち、当該X
の次数が零)となる。 P(x)=aX16+bX15+cX14・・oX2 +pX+q ・・・(4)
FIG. 4 is a flow chart showing the operation of the embodiment shown in FIGS. The operation of the embodiment shown in FIGS. 1 and 2 will be described below with reference to FIG.
First, in step S1, the generator polynomial setting data is given to the generator polynomial setting register 2 from the CPU of the terminal. The generator polynomial setting data is 16 bits, but the bit width of the data bus connecting the CPU of the terminal and the CRC arithmetic unit is 8 bits. Therefore, the CPU of the terminal outputs the generator polynomial setting data to the generator polynomial setting register 2 by dividing it into 8 bits each twice. The generator polynomial setting data stored in the generator polynomial setting register 2 is given to the CRC calculator 4. Thus, the CRC calculator 4 sets the generator polynomial. More specifically, the switch circuit 43b in the CRC calculator 4
.About.43q are individually turned on or off. The switch circuit turned on has the exclusive OR gate 42.
The output signal of a is converted into a corresponding exclusive OR gate or D
Feedback to the type flip-flop 41p. The switch circuit in the off state transmits an L level signal to the corresponding exclusive OR gate or D-type flip-flop 41p. Each exclusive OR gate 42b to 42p
When the output signal of the exclusive OR gate 42a is fed back via the corresponding switch circuits 43b to 43p, the logical operation (exclusive operation) between this feedback signal and the output signal of the corresponding D-type flip-flops 41b to 41p is performed. OR operation). On the other hand, the exclusive OR gates 42b to 42p have corresponding switch circuits 43b to 43, respectively.
When an L level signal is given through p, the above-mentioned logical operation is not performed and the corresponding flip-flop 41
The output signals b to 41p are output as they are. That is,
At this time, the exclusive OR gates 42b to 42p operate merely as drivers and are in a data through state. For reference, the relationship between the switch circuits 43b to 43q and the generator polynomial is shown in FIG. In FIG. 5, the output signal of the exclusive OR gate 42a corresponds to the coefficient a of the generator polynomial P (x) of the following expression (4), and the switch circuit 43b
The on / off states of ~ 43q correspond to the coefficients b ~ q of the generator polynomial P (x) of the following expression (4). Specifically, when the switch circuits 43b to 43q are on, the coefficients b to q are 1, and when the switch circuits 43b to 43q are off, the coefficients b to q are 0 (that is, the X
Is zero). P (x) = aX 16 + bX 15 + cX 14 ... oX 2 + pX + q (4)

【0021】次に、ステップS2において、端末のCP
Uから初期値入力レジスタ1に初期値設定データが与え
られる。初期値設定データは、16ビットであるため、
前述の生成多項式設定データと同様に、8ビットずつ2
回に分けて与えられる。初期値入力レジスタ1に記憶さ
れた16ビットの初期値設定データは、それぞれのビッ
トが相補的な2本の初期値設定信号に変換され、各D型
フリップフロップ41a〜41pに与えられる。たとえ
ば、初期値設定データのあるビットの論理が“1”の場
合、対応するD型フリップフロップのプリセット端子P
RSにはHレベルの初期値設定信号が与えられ、リセッ
ト端子RSTにはLレベルの初期値設定信号が与えられ
る。一方、初期値設定データのあるビットの論理が
“0”の場合、対応するD型フリップフロップのプリセ
ット端子PRSにはLレベルの初期値設定信号が与えら
れ、リセット端子RSTにはHレベルの初期値設定信号
が与えられる。あるD型フリップフロップについて、プ
リセット端子PRSにHレベルの初期値設定信号が与え
られ、リセット端子RSTにLレベルの初期値設定信号
が与えられた場合、そのD型フリップフロップの出力信
号の初期値はHレベルとなる。一方、あるD型フリップ
フロップについて、プリセット端子PRSにLレベルの
初期値設定信号が与えられ、リセット端子RSTにLレ
ベルの初期値設定信号が与えられた場合、そのD型フリ
ップフロップの出力信号の初期値はLレベルとなる。
Next, in step S2, the CP of the terminal
Initial value setting data is supplied from U to the initial value input register 1. Since the initial value setting data is 16 bits,
Similar to the above-mentioned generator polynomial setting data, 8 bits each
It is given in divided times. The 16-bit initial value setting data stored in the initial value input register 1 is converted into two initial value setting signals each having complementary bits, and is supplied to each D-type flip-flop 41a to 41p. For example, when the logic of a bit of the initial value setting data is "1", the preset terminal P of the corresponding D-type flip-flop is
The RS is supplied with an H-level initial value setting signal, and the reset terminal RST is supplied with an L-level initial value setting signal. On the other hand, when the logic of a bit of the initial value setting data is "0", the L-level initial value setting signal is given to the preset terminal PRS of the corresponding D flip-flop, and the H-level initial value is given to the reset terminal RST. A value setting signal is given. For a D-type flip-flop, when an H-level initial value setting signal is applied to the preset terminal PRS and an L-level initial value setting signal is applied to the reset terminal RST, the initial value of the output signal of the D-type flip-flop. Becomes H level. On the other hand, regarding a certain D-type flip-flop, when an L-level initial value setting signal is applied to the preset terminal PRS and an L-level initial value setting signal is applied to the reset terminal RST, the output signal of the D-type flip-flop is changed. The initial value is L level.

【0022】次に、ステップS3において、端末のCP
Uからデータ入力用シフトレジスタ3にCRC演算を行
うべきデータが1バイトすなわち8ビットずつ与えられ
る。データ入力用シフトレジスタ3に記憶されたデータ
は、クロック信号CLKに同期して1ビットずつシリア
ルに出力され、排他的論理和ゲート42aに与えられ
る。これによって、CRC演算器4は、シフト制御回路
6からシフト信号が与えられるごとに1ビットずつシフ
ト動作し、CPUから伝送される入力データのバイト数
と1バイトのビット数との積に相当する数のシフト回数
だけシフト動作することにより、入力データ列のCRC
演算が行われる。端末のCPUからデータ入力用シフト
レジスタ3には、256バイト分のデータが順次与えら
れ、それらのデータがCRC演算器4において演算され
る。
Next, in step S3, the CP of the terminal
Data to be subjected to the CRC calculation is given from the U to the data input shift register 3 by 1 byte, that is, by 8 bits. The data stored in the data input shift register 3 is serially output bit by bit in synchronization with the clock signal CLK and is given to the exclusive OR gate 42a. As a result, the CRC calculator 4 shifts by 1 bit each time a shift signal is given from the shift control circuit 6, and corresponds to the product of the number of bytes of input data transmitted from the CPU and the number of bits of 1 byte. CRC of the input data string
Calculation is performed. 256 bytes of data are sequentially applied from the CPU of the terminal to the data input shift register 3, and these data are calculated by the CRC calculator 4.

【0023】次に、ステップS4において、CRC演算
器4の演算結果が、各D型フリップフロップの出力端子
Qから読み出され、出力バッファ5を介して端末のCP
Uに出力される。このとき、出力バッファ5は、16ビ
ットのCRC演算結果データを、8ビットずつ2つに分
割し、分割された各データを時分割的に出力する。
Next, in step S4, the calculation result of the CRC calculator 4 is read from the output terminal Q of each D-type flip-flop, and is output via the output buffer 5 to the CP of the terminal.
Output to U. At this time, the output buffer 5 divides the 16-bit CRC calculation result data into two by 8 bits, and outputs each divided data in a time division manner.

【0024】図6は、図1および図2に示す実施例にお
いて、CRC−CCITTの生成多項式が設定された場
合のCRC演算器4の構成を示す等価回路図である。図
において、この場合、スイッチ回路43e,43lおよ
び43qがオンとなり、その他のスイッチ回路がオフと
なる。そのため、排他的論理和ゲート42a,42eお
よび42lのみが論理演算を行い、その他の排他的論理
和ゲートはデータスルーの状態となる。したがって、D
型フリップフロップ41a〜41dは、排他的論理和ゲ
ート42aと42eとの間で4ビットのシフトレジスタ
を構成し、D型フリップフロップ41e〜41kは排他
的論理和ゲート42eと42lとの間で7ビットのシフ
トレジスタを構成し、D型フリップフロップ41l〜4
1pは排他的論理和ゲート42lと42aとの間で5ビ
ットのシフトレジスタを構成する。
FIG. 6 is an equivalent circuit diagram showing the configuration of the CRC calculator 4 in the case where the CRC-CCITT generator polynomial is set in the embodiment shown in FIGS. 1 and 2. In the figure, in this case, the switch circuits 43e, 43l and 43q are turned on and the other switch circuits are turned off. Therefore, only the exclusive OR gates 42a, 42e and 42l perform the logical operation, and the other exclusive OR gates are in the data through state. Therefore, D
The type flip-flops 41a to 41d form a 4-bit shift register between the exclusive OR gates 42a and 42e, and the D-type flip-flops 41e to 41k are connected between the exclusive OR gates 42e and 42l. A bit shift register, and D-type flip-flops 41l to 4l
1p constitutes a 5-bit shift register between the exclusive OR gates 42l and 42a.

【0025】図7は、図1および図2に示す実施例にお
いて、CRC−16の生成多項式が設定された場合のC
RC演算器4の構成を示す等価回路図である。図におい
て、この場合排他的論理和ゲート42a,42bおよび
42oのみが論理演算を行い、その他の排他的論理和ゲ
ートはデータスルーの状態となる。したがって、D型フ
リップフロップ41aは排他的論理和ゲート42aと4
2bとの間で1ビットのシフトレジスタを構成し、D型
フリップフロップ41b〜41nは排他的論理和ゲート
42bと42oとの間で13ビットのシフトレジスタを
構成し、D型フリップフロップ41oおよび41pは排
他的論理和ゲート42oと42aとの間で2ビットのシ
フトレジスタを構成する。
FIG. 7 shows C in the case where the CRC-16 generator polynomial is set in the embodiment shown in FIGS.
6 is an equivalent circuit diagram showing the configuration of an RC calculator 4. FIG. In this figure, in this case, only the exclusive OR gates 42a, 42b and 42o perform the logical operation, and the other exclusive OR gates are in the data through state. Therefore, the D-type flip-flop 41a is connected to the exclusive OR gates 42a and 4a.
2b constitutes a 1-bit shift register, D-type flip-flops 41b to 41n constitute a 13-bit shift register between exclusive OR gates 42b and 42o, and D-type flip-flops 41o and 41p. Constitutes a 2-bit shift register between the exclusive OR gates 42o and 42a.

【0026】図6および図7は、単なる一例を示すに過
ぎず、CRC演算器4の構成を他の生成多項式に組み換
えることも勿論可能である。
FIGS. 6 and 7 are merely examples, and it is of course possible to recompose the configuration of the CRC calculator 4 into another generator polynomial.

【0027】また、上記実施例では、CRC演算器4は
16ビットの構成とされているが、これは一例に過ぎ
ず、そのビット数は16ビットに限定されない。
In the above embodiment, the CRC calculator 4 has a 16-bit configuration, but this is merely an example, and the number of bits is not limited to 16 bits.

【0028】[0028]

【発明の効果】以上のように、この発明によれば、CR
C演算装置の演算機能を外部から任意に変更することが
できる。その結果、通信を行う相手方の端末との整合性
が向上し、複数の端末との間でデータ通信を行う場合で
あっても確実にデータ誤りを検出することができる。ま
た、この発明によれば、専用のハード回路を用いてCR
C演算を行っているため、端末のコンピュータがプログ
ラムに基づいてソフト的にCRC演算を行う場合に比べ
て、演算速度が速く、高速通信に適している。
As described above, according to the present invention, the CR
The calculation function of the C calculation device can be arbitrarily changed from the outside. As a result, the consistency with the other party's terminal with which communication is performed is improved, and a data error can be reliably detected even when performing data communication with a plurality of terminals. Further, according to the present invention, CR is performed by using a dedicated hardware circuit.
Since the C operation is performed, the operation speed is higher than that in the case where the computer of the terminal performs the CRC operation by software based on the program, which is suitable for high-speed communication.

【0029】また、この発明によれば、新規の生成多項
式を採用しても、容易に設定変更して演算できるので、
生成多項式を一種のパスワードとして使用すれば、生成
多項式を知らないユーザがデータ通信できなくなり、通
信の秘密性を確保できる。より具体的に説明すれば、通
常はCRC演算結果に誤りが生じた場合に相手先(送信
側)に対して再送要求を送るが、新規な生成多項式を利
用した正常なCRCデータと誤ったCRCデータとを送
信したときに、再送要求があるか否かを送信側でチェッ
クし、受信側のモデムが新たに決められた生成多項式を
使用しているかどうかを判別することにより、正規の端
末か否かを識別できる。
Further, according to the present invention, even if a new generator polynomial is adopted, the setting can be easily changed and the calculation can be performed.
If the generator polynomial is used as a kind of password, a user who does not know the generator polynomial cannot perform data communication, and the confidentiality of communication can be secured. More specifically, normally, when an error occurs in the CRC calculation result, a retransmission request is sent to the other party (transmission side), but normal CRC data using a new generator polynomial and erroneous CRC data are used. When data and are sent, the sending side checks whether or not there is a resend request, and determines whether the receiving side modem is using the newly determined generator polynomial. You can identify whether or not.

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

【図1】この発明の一実施例のCRC演算装置の構成を
示す概略ブロック図である。
FIG. 1 is a schematic block diagram showing the configuration of a CRC calculation device according to an embodiment of the present invention.

【図2】図1に示すCRC演算装置のより詳細な構成を
示す回路図である。
FIG. 2 is a circuit diagram showing a more detailed configuration of the CRC calculation device shown in FIG.

【図3】図1および図2に示す実施例において実現され
るCRCデータ誤り検出方式を説明するための模式図で
ある。
FIG. 3 is a schematic diagram for explaining a CRC data error detection method implemented in the embodiments shown in FIGS. 1 and 2.

【図4】図1および図2に示す実施例の動作を説明する
ためのフローチャートである。
FIG. 4 is a flowchart for explaining the operation of the embodiment shown in FIGS. 1 and 2.

【図5】図2に示すCRC演算器における各スイッチ回
路と生成多項式との関係を示す模式図である。
5 is a schematic diagram showing a relationship between each switch circuit and a generator polynomial in the CRC calculator shown in FIG.

【図6】図1および図2に示す実施例において、CRC
−CCITTの生成多項式が設定された場合におけるC
RC演算器の構成を示す等価回路図である。
FIG. 6 shows a CRC in the embodiment shown in FIGS. 1 and 2.
-C when the generator polynomial of CCITT is set
It is an equivalent circuit diagram which shows the structure of RC arithmetic unit.

【図7】図1および図2に示す実施例において、CRC
−16の生成多項式が設定された場合におけるCRC演
算器の構成を示す等価回路図である。
FIG. 7 shows a CRC in the embodiment shown in FIGS. 1 and 2.
It is an equivalent circuit diagram which shows the structure of a CRC calculator in case the generator polynomial of -16 is set.

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

1:初期値入力レジスタ 2:生成多項式設定レジスタ 3:データ入力用シフトレジスタ 4:CRC演算器 5:出力バッファ 6:クロック制御回路 41a〜41p:D型フリップフロップ 42a〜42p:排他的論理和ゲート 43b〜43q:スイッチ回路 1: Initial value input register 2: Generator polynomial setting register 3: Data input shift register 4: CRC calculator 5: Output buffer 6: Clock control circuit 41a to 41p: D-type flip-flop 42a to 42p: Exclusive OR gate 43b to 43q: switch circuit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 入力データ列の誤りを検出するためにC
RC演算を行う装置であって、 N個(Nは2以上の整数)のラッチ回路を含み、それぞ
れが同一のクロック信号に同期してシフト動作を行うシ
フトレジスタ手段、 各前記ラッチ回路と交互に配置されたN個の論理演算手
段を含み、入力されたデータ列に対してCRC演算を行
うCRC演算手段、および入力された生成多項式設定デ
ータに基づいて、各前記論理演算手段の論理演算機能の
能動化と不能動化とを切り換えるための切換制御手段を
備える、CRC演算装置。
1. C for detecting an error in an input data string
An apparatus for performing RC operation, comprising N (N is an integer of 2 or more) latch circuits, each of which performs shift operation in synchronization with the same clock signal, and shift register means alternately with each of the latch circuits. CRC operation means including the arranged N logic operation means for performing a CRC operation on an input data string, and a logic operation function of each of the logic operation means based on the input generator polynomial setting data. A CRC arithmetic unit comprising switching control means for switching between activation and deactivation.
【請求項2】 前記切換手段は、 入力された生成多項式設定データを記憶保持する複数の
ビットセルを含む生成多項式記憶レジスタと、 前記生成多項式記憶レジスタに含まれるビットセルの保
持データに基づいて、CRC演算手段の出力を各ビット
セルに対応する前記論理演算手段に与えるように回路接
続された論理スイッチ手段とを含む、請求項1に記載の
CRC演算装置。
2. The switching means comprises a generator polynomial storage register including a plurality of bit cells for storing and retaining the input generator polynomial setting data, and a CRC operation based on the bit cell retention data contained in the generator polynomial storage register. 2. The CRC arithmetic unit according to claim 1, further comprising a logic switch circuit connected so as to provide an output of the circuit to the logical operation circuit corresponding to each bit cell.
JP3340388A 1991-11-28 1991-11-28 Crc arithmetic unit Pending JPH05151007A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3340388A JPH05151007A (en) 1991-11-28 1991-11-28 Crc arithmetic unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3340388A JPH05151007A (en) 1991-11-28 1991-11-28 Crc arithmetic unit

Publications (1)

Publication Number Publication Date
JPH05151007A true JPH05151007A (en) 1993-06-18

Family

ID=18336476

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3340388A Pending JPH05151007A (en) 1991-11-28 1991-11-28 Crc arithmetic unit

Country Status (1)

Country Link
JP (1) JPH05151007A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1148650A1 (en) * 2000-04-14 2001-10-24 Matsushita Electric Industrial Co., Ltd. Crc operation unit and crc operation method
JP2014068405A (en) * 2001-05-14 2014-04-17 Intel Corp Base station and processing method
JP2016030025A (en) * 2014-07-28 2016-03-07 株式会社三共 Game machine

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1148650A1 (en) * 2000-04-14 2001-10-24 Matsushita Electric Industrial Co., Ltd. Crc operation unit and crc operation method
US6754870B2 (en) 2000-04-14 2004-06-22 Matsushita Electric Industrial Co., Ltd. CRC operation unit and CRC operation method
KR100745863B1 (en) * 2000-04-14 2007-08-02 마츠시타 덴끼 산교 가부시키가이샤 Crc operation unit and crc operation method
JP2014068405A (en) * 2001-05-14 2014-04-17 Intel Corp Base station and processing method
JP2016030025A (en) * 2014-07-28 2016-03-07 株式会社三共 Game machine

Similar Documents

Publication Publication Date Title
US4723243A (en) CRC calculation machine with variable bit boundary
EP0230730B1 (en) CRC calculation machines
US7103830B1 (en) DC balanced error correction coding
US11075652B2 (en) Polar code transmission method and apparatus
US4691319A (en) Method and system for detecting a predetermined number of unidirectional errors
US4720831A (en) CRC calculation machine with concurrent preset and CRC calculation function
JPH10107646A (en) Crc code generating circuit, code error detection circuit and crc circuit
JPH0728227B2 (en) Decoding device for BCH code
US7266760B1 (en) Method and apparatus for calculating cyclic redundancy checks for variable length packets
Kennedy et al. Generalized parallel CRC computation on FPGA
US7178091B1 (en) Reed solomon encoder
JPH10107647A (en) Cyclic redundancy check
JPH05151007A (en) Crc arithmetic unit
US11804855B2 (en) Pipelined forward error correction for vector signaling code channel
US5694405A (en) Encoder and decoder of an error correcting code
US11361838B2 (en) Cyclic redundancy check circuit, corresponding device and method
JPH1098392A (en) Crc code generating circuit, code error detecting circuit and crc circuit
US7047479B1 (en) Parallel CRC formulation
JPS6260320A (en) Error correction circuit
JP2553576B2 (en) Error correction device
KR20020033227A (en) Circuit for parallel cyclic redundancy check in data communication
KR100234703B1 (en) Data fault checking method
RU1810909C (en) Error corrector
KR100213256B1 (en) 5 bit and 16 bit cyclic redundancy check circuit
KR940007872B1 (en) Circuit for calculating crc of atm cell head