JP2000181733A - Method and device for data inspection based upon crc and recording medium - Google Patents
Method and device for data inspection based upon crc and recording mediumInfo
- Publication number
- JP2000181733A JP2000181733A JP10358078A JP35807898A JP2000181733A JP 2000181733 A JP2000181733 A JP 2000181733A JP 10358078 A JP10358078 A JP 10358078A JP 35807898 A JP35807898 A JP 35807898A JP 2000181733 A JP2000181733 A JP 2000181733A
- Authority
- JP
- Japan
- Prior art keywords
- processing result
- bit
- data
- remainder
- bits
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000007689 inspection Methods 0.000 title claims description 32
- 238000012545 processing Methods 0.000 claims description 251
- RRLHMJHRFMHVNM-BQVXCWBNSA-N [(2s,3r,6r)-6-[5-[5-hydroxy-3-(4-hydroxyphenyl)-4-oxochromen-7-yl]oxypentoxy]-2-methyl-3,6-dihydro-2h-pyran-3-yl] acetate Chemical compound C1=C[C@@H](OC(C)=O)[C@H](C)O[C@H]1OCCCCCOC1=CC(O)=C2C(=O)C(C=3C=CC(O)=CC=3)=COC2=C1 RRLHMJHRFMHVNM-BQVXCWBNSA-N 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 8
- 125000004122 cyclic group Chemical group 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 5
- 238000007796 conventional method Methods 0.000 description 4
- 238000004891 communication Methods 0.000 description 2
- 239000000654 additive Substances 0.000 description 1
- 230000000996 additive effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000007429 general method Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Detection And Correction Of Errors (AREA)
- Error Detection And Correction (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、CRCに基づいて
データの誤りの有無を検査するデータ検査方法及び装置
並びにその検査方法を実施するためのプログラムを記録
した記録媒体に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data inspection method and apparatus for inspecting the presence or absence of data errors based on a CRC and a recording medium on which a program for executing the inspection method is recorded.
【0002】[0002]
【従来の技術】記録媒体に記録されたデータ,伝送回線
を介して送信されたデータについて誤りがあるか否かを
検査する方法として、パリティ・チェック(バイト単位
で奇数または偶数に合わせるために各バイト毎に1ビッ
トのパリティを付加する方法)、サム・チェック(媒体
全体にわたるバイト毎の加算結果である2バイトを付加
する方法)が用いられている。これらの方法は、計算負
荷及び検査用記憶容量が少なくて済む簡易的な誤り検査
方法である。しかしながら、これらの方法は、検査精度
があまり高くなく、正確な誤り検査を行えない事態が良
く発生している。2. Description of the Related Art As a method for checking whether there is an error in data recorded on a recording medium and data transmitted through a transmission line, a parity check (to match an odd number or an even number in a byte unit) is performed. A method of adding 1-bit parity to each byte) and a sum check (a method of adding 2 bytes which are the addition result of each byte over the entire medium) are used. These methods are simple error checking methods that require less computational load and test storage capacity. However, these methods do not have high inspection accuracy and often fail to perform accurate error inspection.
【0003】このような検査方法に比べて検査精度が高
い誤り検査方法として、CRC(Cyclic Redundancy Ch
eck:巡回冗長検査)が知られている。このCRCは、デ
ータの信頼性が不十分な場合の検査に利用されることが
多く、シリアル通信,ハードディスクのアクセス時など
の用途で主に用いられている。As an error checking method having a higher checking accuracy than such checking methods, a CRC (Cyclic Redundancy Ch.
eck: cyclic redundancy check) is known. The CRC is often used for inspection when data reliability is insufficient, and is mainly used for applications such as serial communication and access to a hard disk.
【0004】以下、このCRCの概念について簡単に説
明する。CRCは、誤り検査に効果的な符号である巡回
符号(ある符号の任意の符号語を任意ビットだけ巡回シ
フトして得られるベクトルがやはり符号語であるような
符号)を利用し、データを所定の数で除算し、その剰余
を検査用に使用する。この巡回符号のデータブロック
は、kビットの情報ビットと(n−k)ビットの検査ビ
ットとで構成される。Hereinafter, the concept of the CRC will be briefly described. CRC uses a cyclic code (a code in which a vector obtained by cyclically shifting an arbitrary code word of a certain code by an arbitrary bit is also a code word) that is a code effective for error checking, and uses a predetermined code as a code. Divide by the number and use the remainder for inspection. This cyclic code data block is composed of k information bits and (nk) check bits.
【0005】そして、データを変数xの多項式と考え、
数学的に取り扱う。例えばデータ“101011”について、
最左端の1はx5 ,左端より2番目の1はx3 ,同じく
3番目の1はx1 ,最右端の1は定数項と見なした場
合、このデータを多項式で表すとx5 +x3 +x+1と
なる。[0005] Then, consider the data as a polynomial of a variable x,
Treat mathematically. For example, for data "101011",
1 of leftmost x 5, 1 second from the left end x 3, likewise the third 1 x 1, when one of the right-most were considered constant term, expressed the data polynomial x 5 + x 3 + x + 1.
【0006】このような多項式による表現に対して、次
のような多項式のmod 2加算を定義してこれによる演算
を行う。一般にmod N加算は、数Nの範囲内での加算を
表し、Nを越えた部分は捨てられる。従って、mod 2加
算では、0+1=1,1+1=0のようになり、「桁上
げがない2進数加算」を意味し、これは2進数値同士の
加算において双方の各ビットを排他的論理和(EX−O
R)していくことになる。具体的には以下のようにな
る。 1xn +1xn =0xn 1xn +0xn =0xn +1xn =1xn 0xn +0xn =0xn −1xn =1xn 以上のことから、mod 2加算においては、結合則,分配
則,交換則が成り立つことが分かる。また、mod 2加算
では、−1xn =1xn であるので、減法は加法と同じ
である。For such a polynomial expression, the following modulo 2 addition of a polynomial is defined and an operation based on this is performed. In general, mod N addition indicates addition within a range of a number N, and portions exceeding N are discarded. Therefore, in mod 2 addition, 0 + 1 = 1, 1 + 1 = 0, which means “binary addition without carry”, which is an exclusive OR operation of both bits in addition of binary values. (EX-O
R). Specifically, it is as follows. 1x n + a 1x n = 0x n 1x n + 0x n = 0x n + 1x n = 1x n 0x n + 0x n = 0x n -1x n = 1x n above, in the mod 2 adder, associativity, distributivity, exchange It can be seen that the rule holds. Further, the mod 2 adder, because it is -1x n = 1x n, subtraction is the same as additive.
【0007】巡回符号は、データの検査ビットを決定す
る(n−k)次の剰余生成多項式G(x)というものに
よって一義的に定義できる。この剰余生成多項式G
(x)による巡回符号の生成は、次のようにして行う。A cyclic code can be uniquely defined by a (n−k) -th order residue generating polynomial G (x) that determines a check bit of data. This residue generating polynomial G
Generation of a cyclic code by (x) is performed as follows.
【0008】情報ビットを示すメッセージ多項式M
(x)を符号化するためには、xn-k をM(x)に乗じ
てxn-k ・M(x)を求め、その乗算式を剰余生成多項
式G(x)で割る。この除算の商,剰余をそれぞれQ
(x),R(x)とすると、下記式(1)が成立する。 xn-k ・M(x)=Q(x)・G(x)+R(x) …(1)Message polynomial M indicating information bits
In order to encode (x), x ( nk ) is multiplied by M (x) to obtain x ( nk ) M (x), and the multiplication formula is divided by the remainder generator polynomial G (x). The quotient and remainder of this division are Q
Assuming that (x) and R (x), the following equation (1) holds. x nk · M (x) = Q (x) · G (x) + R (x) (1)
【0009】例えば、通信における送信データU(x)
を生成するには、剰余R(x)をx n-k ・M(x)に加
算する。mod 2加算では加法と減法とは同じであるの
で、U(x)は、下記式(2)のようになる。 U(x)=xn-k ・M(x)+R(x)=Q(x)・G(x) …(2) よって、送信データでは、上位kビットの情報ビットは
xn-k ・M(x)を表し、下位(n−k)ビットの検査
ビットはR(x)を表す。また、上記式(2)から、下
記式(3)が導出される。 U(x)÷G(x)=(xn-k ・M(x)+R(x))÷G(x) =Q(x) …(3) この式(3)から判るように、検査ビットも含めたデー
タ全体U(x)を剰余生成多項式G(x)で割るとその
剰余は0となる。よって、受信側でこの除算の剰余が0
になるか否かによって、送信データが正しいか否かを検
出できる。なお、ここで除算は、mod 2加算、つまり2
進法で行われ、桁上げ及び桁借りが生じないようにEX
−ORで行われる。従って、この場合には、剰余が常に
除数よりも1ビット少なく、その結果、剰余が検査ビッ
トとなり、除数は剰余生成多項式である。For example, transmission data U (x) in communication
Is generated by dividing the remainder R (x) by x nk・ Addition to M (x)
Calculate. Addition and subtraction are the same in mod 2 addition
Then, U (x) is expressed by the following equation (2). U (x) = xnkM (x) + R (x) = Q (x) G (x) (2) Therefore, in the transmission data, the information bits of the upper k bits are
xnk-Inspection of lower (nk) bits, representing M (x)
The bits represent R (x). From the above equation (2),
Expression (3) is derived. U (x) ÷ G (x) = (xnkM (x) + R (x)) ÷ G (x) = Q (x) (3) As can be seen from equation (3), the data including the check bits
Dividing the entire data U (x) by the remainder generator polynomial G (x)
The remainder is 0. Therefore, the remainder of this division is 0 on the receiving side.
Whether the transmission data is correct or not.
I can get out. Here, the division is mod 2 addition, that is, 2
EX so that carry and borrow do not occur.
-OR. Therefore, in this case, the remainder is always
One bit less than the divisor, so that the remainder is
And the divisor is a remainder generator polynomial.
【0010】このようなCRCの代表的なものとして、
n−k=16とする16ビットCRCが良く利用されてい
る。この16ビットCRCにおける剰余生成多項式はG
(x)=x16+x15+x2 +1であって、係数xn-k は
n−k=16であるのでx16となる。16ビットCRCで
は、バースト誤り検出を最大16ビット長まで行え、ま
た、誤りのバーストが16ビットよりも大きい場合には99
%の確率で誤りを検出できることも証明されている。As a typical example of such a CRC,
A 16-bit CRC with nk = 16 is often used. The remainder generating polynomial in this 16-bit CRC is G
(X) = x 16 + x 15 + x 2 +1 and the coefficient x nk is x 16 because nk = 16. In 16-bit CRC, burst error detection can be performed up to a maximum length of 16 bits, and when an error burst is larger than 16 bits, 99 bits can be detected.
It has also been proven that errors can be detected with a% probability.
【0011】16ビットCRCにおける具体例を示す。例
えば、剰余生成多項式G(x)=x 16+x15+x2 +1
を用いたn=24,k=8,n−k=16の巡回符号を考え
る。メッセージ多項式M(x)=x6 +x4 +1に対応
するメッセージ“01010001”を符号化するためには、x
16・M(x)をG(x)で割って剰余R(x)に対応す
るデータ“1000000111100101”を求める。A specific example of a 16-bit CRC will be described. An example
For example, the remainder generator polynomial G (x) = x 16+ X15+ XTwo+1
Consider cyclic code of n = 24, k = 8, nk = 16 using
You. Message polynomial M (x) = x6+ XFourCorresponds to +1
X to encode the message "01010001"
16Dividing M (x) by G (x) to correspond to the remainder R (x)
Data "1000000111100101" is obtained.
【0012】よって、x16・M(x)は下記式(4)の
ように示され、送信データU(x)は、x16・M(x)
に剰余R(x)=x15+x8 +x7 +x6 +x5 +x2
+1を加算して作られるので、下記式(5)のようにな
る。 x16・M(x)=x22+x20+x16 =(x16+x15+x2 +1)×(x6 +x5 +1) +(x15+x8 +x7 +x6 +x5 +x2 +1)…(4) U(x)=(x22+x20+x16) +(x15+x8 +x7 +x6 +x5 +x2 +1) …(5)Therefore, x 16 · M (x) is expressed by the following equation (4), and transmission data U (x) is expressed by x 16 · M (x)
And the remainder R (x) = x 15 + x 8 + x 7 + x 6 + x 5 + x 2
Since it is made by adding +1, it becomes like the following equation (5). x 16 · M (x) = x 22 + x 20 + x 16 = (x 16 + x 15 + x 2 +1) × (x 6 + x 5 +1) + (x 15 + x 8 + x 7 + x 6 + x 5 + x 2 +1) ... ( 4) U (x) = (x 22 + x 20 + x 16 ) + (x 15 + x 8 + x 7 + x 6 + x 5 + x 2 +1) (5)
【0013】[0013]
【発明が解決しようとする課題】16ビットCRCにおけ
る剰余を求める一般的な方法として、従来から次のよう
な2つの方法が用いられている。第1従来方法は、1ビ
ット毎にシフトしながら上位桁から順次除算を行うもの
であり、この第1従来方法では、計算は簡単であるが、
多くのループが必要であって実行速度が遅いという問題
がある。これに対して、第2従来方法は、剰余テーブル
を利用して実行速度を高める方法であり、8ビットのす
べての被除数(256 個)における剰余を予めテーブルと
して格納しておき、除算の際にそのテーブルを参照して
必要な剰余を得るようにしている。この第2従来方法
は、実行速度は速いが、剰余を表すテーブルを準備して
おく必要があるという問題がある。As a general method for obtaining a remainder in a 16-bit CRC, the following two methods have been conventionally used. In the first conventional method, division is performed sequentially from the upper digit while shifting by one bit. In the first conventional method, although the calculation is simple,
There is a problem that many loops are required and the execution speed is slow. On the other hand, the second conventional method is a method of increasing the execution speed by using a remainder table, in which the remainders of all 8-bit dividends (256) are stored in advance as a table, and when the division is performed, The necessary remainder is obtained by referring to the table. The second conventional method has a high execution speed, but has a problem that a table representing a remainder needs to be prepared.
【0014】本発明は斯かる事情に鑑みてなされたもの
であり、ループ計算及び剰余のテーブル格納の何れもが
不要であり、従来に比べて計算負荷が小さくて高速な処
理が可能であるCRCに基づくデータ検査方法及び装置
並びにその検査方法を実施するためのプログラムを記録
した記録媒体を提供することを目的とする。The present invention has been made in view of such circumstances, and does not require any of the loop calculation and the storage of the remainder table. It is an object of the present invention to provide a data inspection method and apparatus based on a computer and a recording medium on which a program for executing the inspection method is recorded.
【0015】[0015]
【課題を解決するための手段】請求項1に係るCRCに
基づくデータ検査方法は、あるMビットのデータにこれ
より以前のデータ列に対するNビットの剰余を含めたも
のを示すxの多項式を所定のxの剰余生成多項式で割っ
た際の剰余を順次求めることにより、CRCに基づいて
データの誤りを検査する方法において、ビットシフト処
理と論理演算とにより前記剰余を求めることを特徴とす
る。According to a first aspect of the present invention, there is provided a data inspection method based on CRC, wherein a polynomial of x indicating a certain M-bit data including an N-bit remainder with respect to an earlier data string is determined. In the method for sequentially checking the remainder when divided by the remainder generation polynomial of x, and checking for a data error based on CRC, the remainder is obtained by a bit shift process and a logical operation.
【0016】請求項2に係るCRCに基づくデータ検査
方法は、請求項1において、N=2Mであって、以前の
データ列に対するNビットの剰余を上位Mビットの剰余
データと下位Mビットの剰余データとに分け、前記Mビ
ットのデータ,前記上位Mビットの剰余データ及び前記
下位Mビットの剰余データに対するビットシフト処理と
論理演算とにより前記剰余を求めることを特徴とする。According to a second aspect of the present invention, there is provided a data inspection method based on a CRC according to the first aspect, wherein N = 2M, the N-bit remainder of the previous data string is replaced by the upper M-bit remainder data and the lower M-bit remainder data. The remainder is obtained by performing a bit shift process and a logical operation on the M-bit data, the upper M-bit remainder data, and the lower M-bit remainder data.
【0017】請求項3に係るCRCに基づくデータ検査
方法は、請求項2において、M=8であって、前記上位
8ビットの剰余データと前記8ビットのデータとをEX
−OR処理して第1処理結果を求めるステップと、該第
1処理結果を右へ1ビットシフトして第2処理結果を得
るステップと、前記第1処理結果と該第2処理結果とを
EX−OR処理して第3処理結果を求めるステップと、
該第3処理結果を左へ2ビットシフトして第4処理結果
を得るステップと、前記第3処理結果と該第4処理結果
とをEX−OR処理して第5処理結果を求めるステップ
と、該第5処理結果を左へ4ビットシフトして第6処理
結果を得るステップと、前記第5処理結果と該第6処理
結果とをEX−OR処理して第7処理結果を求めるステ
ップと、該第7処理結果を右へ6ビットシフトして第8
処理結果を得るステップと、該第8処理結果と前記第4
処理結果とをEX−OR処理して第9処理結果を求める
ステップと、前記第7処理結果を左へ1ビットシフトし
て第10処理結果を得るステップと、該第10処理結果とデ
ータ“10000000”とをAND処理して第11処理結果を求
めるステップと、前記第3処理結果を右へ6ビットシフ
トして第12処理結果を得るステップと、前記第11処理結
果と該第12処理結果とをEX−OR処理して第13処理結
果を求めるステップと、該第13処理結果と前記下位8ビ
ットの剰余データとをEX−OR処理し、その処理結果
を新しい16ビットの剰余の上位8ビットとするステップ
と、前記第9処理結果を新しい16ビットの剰余の下位8
ビットとするステップとを有することを特徴とする。According to a third aspect of the present invention, in the data inspection method according to the second aspect of the present invention, M = 8 and the upper 8 bits of the remainder data and the 8 bits of the data are EX.
-ORing to obtain a first processing result, shifting the first processing result to the right by one bit to obtain a second processing result, and performing EX processing on the first processing result and the second processing result. -ORing to obtain a third processing result;
Shifting the third processing result to the left by 2 bits to obtain a fourth processing result; EX-ORing the third processing result and the fourth processing result to obtain a fifth processing result; Shifting the fifth processing result to the left by 4 bits to obtain a sixth processing result; EX-ORing the fifth processing result and the sixth processing result to obtain a seventh processing result; The seventh processing result is shifted 6 bits to the right to
Obtaining a processing result, the eighth processing result and the fourth
EX-OR processing the processing result to obtain a ninth processing result; shifting the seventh processing result left by one bit to obtain a tenth processing result; and calculating the tenth processing result and data "10000000". And AND processing to obtain an eleventh processing result; shifting the third processing result to the right by 6 bits to obtain a twelfth processing result; and calculating the eleventh processing result and the twelfth processing result. EX-OR processing to obtain a thirteenth processing result; EX-OR processing the thirteenth processing result and the lower 8-bit remainder data to obtain a higher 16 bits of the new 16-bit remainder And converting the ninth processing result to the lower 8 bits of the new 16-bit remainder.
Bit setting step.
【0018】請求項4に係るCRCに基づくデータ検査
装置は、あるMビットのデータにこれより以前のデータ
列に対するNビットの剰余を含めたものを示すxの多項
式を所定のxの剰余生成多項式で割った際の剰余を順次
求めることにより、CRCに基づいてデータの誤りを検
査する装置において、シフトレジスタと論理演算器とを
備え、前記シフトレジスタによるビットシフト処理と前
記論理演算器による論理演算とにより前記剰余を求める
ようにしたことを特徴とする。According to a fourth aspect of the present invention, there is provided a data inspection apparatus based on a CRC, wherein a polynomial of x indicating a certain M-bit data including an N-bit remainder with respect to a data sequence earlier than the predetermined M-bit data is converted into a predetermined x-residue generation polynomial. A device for checking a data error based on a CRC by sequentially calculating the remainder when divided by a shift register and a logical operation unit, wherein a bit shift process by the shift register and a logical operation by the logical operation unit Thus, the remainder is obtained by the following.
【0019】請求項5に係るCRCに基づくデータ検査
装置は、請求項4において、N=2Mであって、以前の
データ列に対するNビットの剰余を上位Mビットの剰余
データと下位Mビットの剰余データとに分け、前記Mビ
ットのデータ,前記上位Mビットの剰余データ及び前記
下位Mビットの剰余データに対する前記シフトレジスタ
によるビットシフト処理と前記論理演算器による論理演
算とにより前記剰余を求めるようにしたことを特徴とす
る。According to a fifth aspect of the present invention, there is provided a data inspection apparatus based on a CRC according to the fourth aspect, wherein N = 2M, the N-bit remainder of the previous data string is replaced by upper M-bit remainder data and lower M-bit remainder data. And dividing the M bits of data, the upper M bits of surplus data, and the lower M bits of surplus data by a bit shift process by the shift register and a logical operation by the logical operation unit. It is characterized by having done.
【0020】請求項6に係るCRCに基づくデータ検査
装置は、請求項5において、M=8であって、前記シフ
トレジスタ及び論理演算器は、前記上位8ビットの剰余
データと前記8ビットのデータとをEX−OR処理して
第1処理結果を求める第1論理演算器と、該第1処理結
果を右へ1ビットシフトして第2処理結果を得る第1シ
フトレジスタと、前記第1処理結果と該第2処理結果と
をEX−OR処理して第3処理結果を求める第2論理演
算器と、該第3処理結果を左へ2ビットシフトして第4
処理結果を得る第2シフトレジスタと、前記第3処理結
果と該第4処理結果とをEX−OR処理して第5処理結
果を求める第3論理演算器と、該第5処理結果を左へ4
ビットシフトして第6処理結果を得る第3シフトレジス
タと、前記第5処理結果と該第6処理結果とをEX−O
R処理して第7処理結果を求める第4論理演算器と、該
第7処理結果を右へ6ビットシフトして第8処理結果を
得る第4シフトレジスタと、該第8処理結果と前記第4
処理結果とをEX−OR処理して第9処理結果を求める
第5論理演算器と、前記第7処理結果を左へ1ビットシ
フトして第10処理結果を得る第5シフトレジスタと、該
第10処理結果とデータ“10000000”とをAND処理して
第11処理結果を求める第6論理演算器と、前記第3処理
結果を右へ6ビットシフトして第12処理結果を得る第6
シフトレジスタと、前記第11処理結果と該第12処理結果
とをEX−OR処理して第13処理結果を求める第7論理
演算器と、該第13処理結果と前記下位8ビットの剰余デ
ータとをEX−OR処理する第8論理演算器とを有し、
該第8論理演算器での処理結果を新しい16ビットの剰余
の上位8ビットとし、前記第9処理結果を新しい16ビッ
トの剰余の下位8ビットとするようにしたことを特徴と
する。According to a sixth aspect of the present invention, in the data inspecting apparatus based on CRC according to the fifth aspect, wherein M = 8, and the shift register and the logical operation unit include the upper 8 bits of surplus data and the 8 bits of data. A first logical operation unit for performing an EX-OR operation on the first processing result to obtain a first processing result, a first shift register for shifting the first processing result to the right by one bit to obtain a second processing result, A second logical operation unit for performing an EX-OR operation on the result and the second processing result to obtain a third processing result;
A second shift register that obtains a processing result, a third logical operation unit that performs an EX-OR operation on the third processing result and the fourth processing result to obtain a fifth processing result, and shifts the fifth processing result to the left 4
A third shift register for performing a bit shift to obtain a sixth processing result, and EX-O converting the fifth processing result and the sixth processing result with each other.
A fourth logical operation unit for performing R processing to obtain a seventh processing result, a fourth shift register for shifting the seventh processing result to the right by 6 bits to obtain an eighth processing result, 4
A fifth logical operation unit that performs an EX-OR operation on the processing result to obtain a ninth processing result, a fifth shift register that shifts the seventh processing result one bit to the left to obtain a tenth processing result, A sixth logical operation unit for performing an AND operation on the tenth processing result and the data “10000000” to obtain an eleventh processing result, and a sixth logical operation unit for shifting the third processing result rightward by 6 bits to obtain a twelfth processing result
A shift register; a seventh logical operation unit for performing an EX-OR operation on the eleventh processing result and the twelfth processing result to obtain a thirteenth processing result; And an eighth logical operator for performing an EX-OR operation on
The processing result of the eighth logical operation unit is set to the upper 8 bits of the new 16-bit remainder, and the ninth processing result is set to the lower 8 bits of the new 16-bit remainder.
【0021】請求項7に係る記録媒体は、ある8ビット
のデータにこれより以前のデータ列に対する16ビットの
剰余を含めたものを示すxの多項式を所定のxの剰余生
成多項式で割った際の剰余を順次求めることにより、16
ビットCRCに基づいてデータの誤りを検査するための
プログラムを記録してあるコンピュータでの読み取り可
能な記録媒体において、以前のデータ列に対する16ビッ
トの剰余を上位8ビットの剰余データと下位8ビットの
剰余データとに分けることを前記コンピュータにさせる
プログラムコード手段と、前記上位8ビットの剰余デー
タと前記8ビットのデータとをEX−OR処理して第1
処理結果を求めることを前記コンピュータにさせるプロ
グラムコード手段と、該第1処理結果を右へ1ビットシ
フトして第2処理結果を得ることを前記コンピュータに
させるプログラムコード手段と、前記第1処理結果と該
第2処理結果とをEX−OR処理して第3処理結果を求
めることを前記コンピュータにさせるプログラムコード
手段と、該第3処理結果を左へ2ビットシフトして第4
処理結果を得ることを前記コンピュータにさせるプログ
ラムコード手段と、前記第3処理結果と該第4処理結果
とをEX−OR処理して第5処理結果を求めることを前
記コンピュータにさせるプログラムコード手段と、該第
5処理結果を左へ4ビットシフトして第6処理結果を得
ることを前記コンピュータにさせるプログラムコード手
段と、前記第5処理結果と該第6処理結果とをEX−O
R処理して第7処理結果を求めることを前記コンピュー
タにさせるプログラムコード手段と、該第7処理結果を
右へ6ビットシフトして第8処理結果を得ることを前記
コンピュータにさせるプログラムコード手段と、該第8
処理結果と前記第4処理結果とをEX−OR処理して第
9処理結果を求めることを前記コンピュータにさせるプ
ログラムコード手段と、前記第7処理結果を左へ1ビッ
トシフトして第10処理結果を得ることを前記コンピュー
タにさせるプログラムコード手段と、該第10処理結果と
データ“10000000”とをAND処理して第11処理結果を
求めることを前記コンピュータにさせるプログラムコー
ド手段と、前記第3処理結果を右へ6ビットシフトして
第12処理結果を得ることを前記コンピュータにさせるプ
ログラムコード手段と、前記第11処理結果と該第12処理
結果とをEX−OR処理して第13処理結果を求めること
を前記コンピュータにさせるプログラムコード手段と、
該第13処理結果と前記下位8ビットの剰余データとをE
X−OR処理し、その処理結果を新しい16ビットの剰余
の上位8ビットとすることを前記コンピュータにさせる
プログラムコード手段と、前記第9処理結果を新しい16
ビットの剰余の下位8ビットとすることを前記コンピュ
ータにさせるプログラムコード手段とを有することを特
徴とする。According to a seventh aspect of the present invention, when a polynomial of x indicating a certain 8-bit data including a 16-bit remainder with respect to an earlier data sequence is divided by a predetermined remainder generating polynomial of x. By sequentially calculating the remainder of
On a computer-readable recording medium on which a program for checking a data error based on a bit CRC is recorded, a 16-bit remainder with respect to a previous data string is replaced with upper 8-bit remainder data and lower 8-bit remainder data. Program code means for causing the computer to divide the data into surplus data; and EX-OR processing of the upper 8 bits of the surplus data and the 8-bit data to obtain a first data.
Program code means for causing the computer to obtain a processing result, program code means for causing the computer to shift the first processing result right by one bit to obtain a second processing result, and the first processing result Program code means for causing the computer to EX-OR-process the second processing result with the second processing result to obtain a third processing result; and
Program code means for causing the computer to obtain a processing result; and program code means for causing the computer to obtain a fifth processing result by performing an EX-OR operation on the third processing result and the fourth processing result. Program code means for causing the computer to shift the fifth processing result to the left by 4 bits to obtain a sixth processing result; and EX-O processing the fifth processing result and the sixth processing result.
Program code means for causing the computer to perform R processing to obtain a seventh processing result; and program code means for causing the computer to shift the seventh processing result to the right by 6 bits to obtain an eighth processing result. , The eighth
Program code means for causing the computer to perform an EX-OR operation on the processing result and the fourth processing result to obtain a ninth processing result; and shifting the seventh processing result left by one bit to the tenth processing result. Program code means for causing the computer to obtain the first processing result, program code means for causing the computer to perform an AND operation on the tenth processing result and data "10000000" to obtain an eleventh processing result, and the third processing Program code means for causing the computer to shift the result to the right by 6 bits to obtain a twelfth processing result; and EX-OR processing the eleventh processing result and the twelfth processing result to obtain a thirteenth processing result Program code means for causing the computer to determine
The 13th processing result and the lower 8 bits of surplus data are
X-OR processing, program code means for causing the computer to make the processing result the upper 8 bits of a new 16-bit remainder, and
Program code means for causing the computer to set the lower 8 bits of the bit remainder to the lower 8 bits.
【0022】本発明では、このようにしてビットシフト
処理と論理演算とを行うだけで新しい剰余を求めるよう
にしたので、剰余を表すテーブルが不要であり、ループ
計算も行わずに、極めて簡易に新しい剰余を求めること
ができ、従来に比して計算負荷が極めて小さくて処理速
度が速くなる。According to the present invention, a new remainder is obtained only by performing a bit shift process and a logical operation in this manner. Therefore, a table representing the remainder is unnecessary, and a loop calculation is not performed. A new remainder can be obtained, and the calculation load is extremely small and the processing speed is faster than in the past.
【0023】[0023]
【発明の実施の形態】図1は、データ誤りをCRCに基
づいて検査する検査装置1の機能ブロック図である。検
査装置1は、検査対象の情報データを入力する入力部2
と、本発明による検査方法のプログラムを格納するRO
M3と、CRC検査におけるEX−OR処理,AND処
理などの論理演算を行う論理演算部4と、CRC検査時
の計算中間値などを記憶するRAM5と、任意のビット
数のシフト処理を行えるシフトレジスタ6と、これらの
各部を制御するCPU7とを有する。FIG. 1 is a functional block diagram of an inspection apparatus 1 for inspecting a data error based on a CRC. The inspection apparatus 1 includes an input unit 2 for inputting information data to be inspected.
And RO storing program of inspection method according to the present invention
M3, a logical operation unit 4 that performs a logical operation such as an EX-OR process and an AND process in a CRC check, a RAM 5 that stores an intermediate value calculated in a CRC check, and a shift register that can perform a shift process of an arbitrary number of bits 6 and a CPU 7 for controlling these components.
【0024】前述したように、16ビットCRCの場合、
剰余生成多項式G(x)=x16+x 15+x2 +1であ
り、係数xn-k はn−k=16であるのでx16となる。As described above, in the case of a 16-bit CRC,
Residue generating polynomial G (x) = x16+ X 15+ XTwo+1
And the coefficient xnkIs nk = 16, so x16Becomes
【0025】任意の8ビットデータ単位のデータ列M
(x)は、一般的に下記式(6)で表される。 M(x)=k7 ・x7 +k6 ・x6 +k5 ・x5 +k4 ・x4 +k3 ・x3 +k2 ・x2 +k1 ・x1 +k0 ・x0 …(6) (但し、ki =0または1)Data string M in arbitrary 8-bit data units
(X) is generally represented by the following equation (6). M (x) = k 7 · x 7 + k 6 · x 6 + k 5 · x 5 + k 4 · x 4 + k 3 · x 3 + k 2 · x 2 + k 1 · x 1 + k 0 · x 0 ... (6) ( However, k i = 0 or 1)
【0026】従って、このデータ列に対応する、被除数
となる多項式は、下記式(7)のようになる。 x16・M(x)=x16・(k7 ・x7 +k6 ・x6 +k5 ・x5 +k4 ・x4 +k3 ・x3 +k2 ・x2 +k1 ・x1 +k0 ・x0 ) =k7 ・x16・x7 +k6 ・x16・x6 +k5 ・x16・x5 +k4 ・x16・x4 +k3 ・x16・x3 +k2 ・x16・x2 +k1 ・x16・x1 +k0 ・x16・x0 …(7)Therefore, the polynomial which is the dividend corresponding to this data string is as shown in the following equation (7). x 16 · M (x) = x 16 · (k 7 · x 7 + k 6 · x 6 + k 5 · x 5 + k 4 · x 4 + k 3 · x 3 + k 2 · x 2 + k 1 · x 1 + k 0 · x 0) = k 7 · x 16 · x 7 + k 6 · x 16 · x 6 + k 5 · x 16 · x 5 + k 4 · x 16 · x 4 + k 3 · x 16 · x 3 + k 2 · x 16 · x 2 + k 1 · x 16 · x 1 + k 0 · x 16 · x 0 (7)
【0027】ここで、x16・x7 =Q7 (x)・G
(x)+R7 (x),x16・x6 =Q6(x)・G
(x)+R6 (x),・・・,x16・x0 =Q0 (x)
・G(x)+R0 (x)と設定すると、上記式(7)は
下記式(8)のように変形できる。 x16・M(x)=k7 ・{Q7 (x)・G(x)+R7 (x)} +k6 ・{Q6 (x)・G(x)+R6 (x)} +・・・ +k0 ・{Q0 (x)・G(x)+R0 (x)} ={k7 ・Q7 (x)+k6 ・Q6 (x)+・・・ +k0 ・Q0 (x)}・G(x) +{k7 ・R7 (x)+k6 ・R6 (x)+・・・ +k0 ・R0 (x)} …(8)Here, x 16 · x 7 = Q 7 (x) · G
(X) + R 7 (x), x 16 · x 6 = Q 6 (x) · G
(X) + R 6 (x),..., X 16 × x 0 = Q 0 (x)
When G (x) + R 0 (x) is set, the above equation (7) can be transformed into the following equation (8). x 16 · M (x) = k 7 · {Q 7 (x) · G (x) + R 7 (x)} + k 6 · {Q 6 (x) · G (x) + R 6 (x)} + · ·· + k 0 · {Q 0 (x) · G (x) + R 0 (x)} = {k 7 · Q 7 (x) + k 6 · Q 6 (x) + ··· + k 0 · Q 0 ( x)} · G (x) + {k 7 · R 7 (x) + k 6 · R 6 (x) +... + k 0 · R 0 (x)} (8)
【0028】よって、上記式(6)で示される任意の8
ビットデータ単位のデータ列M(x)に対応する多項式
を剰余生成多項式G(x)で割った場合の剰余は、下記
式(9)で表される。 k7 ・R7 (x)+k6 ・R6 (x)+k5 ・R5 (x) +k4 ・R4 (x)+k3 ・R3 (x)+k2 ・R2 (x) +k1 ・R1 (x)+k0 ・R0 (x) …(9)Therefore, the arbitrary 8 shown in the above equation (6)
The remainder when the polynomial corresponding to the data sequence M (x) in bit data units is divided by the remainder generating polynomial G (x) is expressed by the following equation (9). k 7 · R 7 (x) + k 6 · R 6 (x) + k 5 · R 5 (x) + k 4 · R 4 (x) + k 3 · R 3 (x) + k 2 · R 2 (x) + k 1 · R 1 (x) + k 0 · R 0 (x) ... (9)
【0029】この式(9)におけるR7 (x),R
6 (x),R5 (x),R4 (x),R 3 (x),R2
(x),R1 (x),R0 (x)は、それぞれ、x7 ,
x6 ,x 5 ,x4 ,x3 ,x2 ,x1 ,x0 に対応する
多項式を剰余生成多項式G(x)で割った剰余である。
よって、1単位のデータが一定の8ビットで構成されて
いる場合、データ“10000000”,“01000000”,“0010
0000”,“00010000”,“00001000”,“00000100”,
“00000010”,“00000001”に対応する多項式を剰余生
成多項式G(x)で除算し、その剰余をそれぞれ、R7
(x),R6 (x),R5 (x),R4 (x),R
3 (x),R2 (x),R1 (x),R0 (x)とした
場合には、これらの8種類の剰余の組み合わせによっ
て、任意の1単位8ビットのデータにおける剰余(検査
ビット)を求めることができる。In the equation (9), R7(X), R
6(X), RFive(X), RFour(X), R Three(X), RTwo
(X), R1(X), R0(X) is x7,
x6, X Five, XFour, XThree, XTwo, X1, X0Corresponding to
This is the remainder obtained by dividing the polynomial by the remainder generating polynomial G (x).
Therefore, one unit of data is composed of a constant 8 bits.
Data, “10000000”, “01000000”, “0010
0000 "," 00010000 "," 00001000 "," 00000100 ",
Polynomials corresponding to “00000010” and “00000001” are surplus
Divide by the polynomial G (x) and calculate the remainder by R7
(X), R6(X), RFive(X), RFour(X), R
Three(X), RTwo(X), R1(X), R0(X)
In some cases, the combination of these eight types of remainders
The remainder (check) in any unit of 8-bit data
Bit).
【0030】8ビット符号であって、剰余生成多項式G
(x)がx16+x15+x2 +1となる16ビットCRCの
場合の具体的なRi (x)(i=7,…,0)の値を以
下の表1に示す。An 8-bit code, which is a remainder generating polynomial G
Table 1 below shows specific values of R i (x) (i = 7,..., 0) when (x) is a 16-bit CRC in which x 16 + x 15 + x 2 +1.
【0031】[0031]
【表1】 [Table 1]
【0032】一般的に、16ビットCRCにあって、ある
8ビットのデータについて考えると、このデータより以
前のデータ列に対する剰余(つまり16ビットの検査ビッ
ト)が加算されて被検査データが形成されるので、その
剰余を含めたものを被除数として除算しなければならな
い。In general, when considering a certain 8-bit data in a 16-bit CRC, a remainder (ie, 16-bit check bits) for a data string before this data is added to form data to be checked. Therefore, the sum including the remainder must be divided as the dividend.
【0033】1つ前までのデータ列,商,剰余をそれぞ
れM′(x),Q′(x),R′(x)とすると、下記
式(10)が成り立つ。 x16・M′(x)=Q′(x)・G(x)+R′(x) …(10)Assuming that the preceding data string, quotient, and remainder are M '(x), Q' (x), and R '(x), the following equation (10) holds. x 16 · M ′ (x) = Q ′ (x) · G (x) + R ′ (x) (10)
【0034】よって、これに新しいデータD(x)を加
えたデータ列M(x)について、下記式(11)が成り立
つ。 x16・M(x)=x16・{x8 ・M′(x)+D(x)} =x8 ・x16・M′(x)+x16・D(x) =x8 ・Q′(x)・G(x)+x8 ・R′(x) +x16・D(x) …(11)Therefore, the following equation (11) holds for a data string M (x) obtained by adding new data D (x) to the data string M (x). x 16 · M (x) = x 16 · {x 8 · M '(x) + D (x)} = x 8 · x 16 · M' (x) + x 16 · D (x) = x 8 · Q ' (X) · G (x) + x 8 · R ′ (x) + x 16 · D (x) (11)
【0035】ここで、R′(x)を上位8ビットのR′
up(x)と下位8ビットのR′lo(x)とに分けると、
R′(x)は下記式(12)のように表され、これを用い
て式(11)を書き換えると下記式(13)のようになる。 R′(x)=x8 ・R′up(x)+R′lo(x) …(12) x16・M(x)=x8 ・Q′(x)・G(x)+x16・R′up(x) +x8 ・R′lo(x)+x16・D(x) =x8 ・Q′(x)・G(x) +x16・{R′up(x)+D(x)} +x8 ・R′lo(x) …(13)Here, R '(x) is replaced with R' of the upper 8 bits.
Up (x) and lower 8 bits R ' lo (x)
R ′ (x) is represented by the following equation (12), and using this to rewrite equation (11) gives the following equation (13). R '(x) = x 8 · R' up (x) + R 'lo (x) ... (12) x 16 · M (x) = x 8 · Q' (x) · G (x) + x 16 · R 'up (x) + x 8 · R' lo (x) + x 16 · D (x) = x 8 · Q '(x) · G (x) + x 16 · {R' up (x) + D (x)} + X 8 · R ' lo (x) ... (13)
【0036】式(13)において、x16・{R′up(x)
+D(x)}の項は次数がx16より大きいので剰余生成
多項式G(x)で割ることができる。このときの商,剰
余をそれぞれQ″(x),R″(x)とすると、下記式
(14)が成り立つ。 x16・{R′up(x)+D(x)} =Q″(x)・G(x)+R″(x) …(14)In the equation (13), x 16 · {R ' up (x)
Since + term D (x)} is greater than x 16 degree can be divided by the remainder generator polynomial G (x). Assuming that the quotient and the remainder at this time are Q ″ (x) and R ″ (x), the following equation (14) holds. x 16 · {R ′ up (x) + D (x)} = Q ″ (x) · G (x) + R ″ (x) (14)
【0037】この式(14)の関係を用いて、式(13)を
書き換えると下記式(15)のようになる。 x16・M(x)=x8 ・Q′(x)・G(x)+Q″(x)・G(x) +R″(x)+x8 ・R′lo(x) ={x8 ・Q′(x)+Q″(x)}・G(x) +R″(x)+x8 ・R′lo(x) …(15) 式(15)における第1項{x8 ・Q′(x)+Q″
(x)}・G(x)はG(x)で割り切れるので、x16
・M(x)をG(x)で割った場合の剰余はR″(x)
+x8 ・R′lo(x)になっていることが判る。By rewriting equation (13) using the relationship of equation (14), the following equation (15) is obtained. x 16 · M (x) = x 8 · Q '(x) · G (x) + Q "(x) · G (x) + R" (x) + x 8 · R' lo (x) = {x 8 · Q ′ (x) + Q ″ (x)} · G (x) + R ″ (x) + x 8 · R ′ lo (x) (15) The first term {x 8 · Q ′ (x) in equation (15) ) + Q ″
Since (x)} · G (x) is divisible by G (x), x 16
The remainder when M (x) is divided by G (x) is R ″ (x)
+ X 8 · R ' lo (x).
【0038】よって、以上のことをまとめると、次のよ
うなステップを行うことにより、新しいデータD(x)
を加えた場合の新しい剰余を得ることができる。 (ステップ1):新しいデータD(x)と1つ前の剰余
の上位8ビットR′up(x)とをmod 2加算する。 (ステップ2):その加算結果を被除数とする16ビット
CRCでの剰余R″(x)を求める。 (ステップ3):求めたR″(x)と、1つ前の剰余の
下位8ビットR′lo(x)をx8 した値とをmod 2加算
し、その加算結果(R″(x)+x8 ・R′lo(x))
を新しい剰余とする。Therefore, to summarize the above, by performing the following steps, new data D (x)
To obtain a new remainder. (Step 1): mod 2 is added to the new data D (x) and the upper 8 bits R ′ up (x) of the previous residue. (Step 2): A residue R ″ (x) in a 16-bit CRC using the addition result as a dividend is calculated. (Step 3): The calculated R ″ (x) and the lower 8 bits R of the immediately preceding residue. ' Lo (x) by x 8 and mod 2 addition, and the addition result (R ″ (x) + x 8 · R ′ lo (x))
Is the new remainder.
【0039】本発明では、表1に示されるような16ビッ
トCRCの剰余の特徴、及び、ステップ1〜3に示され
るような16ビットCRCの剰余計算の特徴を利用して、
ビットシフト処理と論理演算とにより、剰余テーブルを
全く用いることなく新しい剰余を求める。In the present invention, utilizing the characteristics of the remainder of the 16-bit CRC as shown in Table 1 and the characteristics of the remainder calculation of the 16-bit CRC as shown in steps 1 to 3,
By bit shift processing and logical operation, a new remainder is obtained without using any remainder table.
【0040】以下、本発明の詳細について説明する。図
2,図3は、本発明の手順を示すフローチャート、図4
〜図6は、本発明におけるデータの流れを示す図であ
る。Hereinafter, the present invention will be described in detail. 2 and 3 are flowcharts showing the procedure of the present invention.
FIG. 6 to FIG. 6 are diagrams showing the flow of data in the present invention.
【0041】まず、直前のデータ列に対する16ビットの
剰余(検査ビット)を上位8ビットと下位8ビットとに
分割する(ステップS1)。この上位8ビットと新しい
8ビットのデータとをEX−OR処理(mod 2加算)し
て第1処理結果を求める(ステップS2)。その第1処
理結果を右へ1ビットだけシフトして第2処理結果を得
る(ステップS3)。第1処理結果と第2処理結果とを
EX−OR処理して第3処理結果を求める(ステップS
4)。その第3処理結果を左へ2ビットだけシフトして
第4処理結果を得る(ステップS5)。第3処理結果と
第4処理結果とをEX−OR処理して第5処理結果を求
める(ステップS6)。First, the 16-bit remainder (check bit) of the immediately preceding data string is divided into upper 8 bits and lower 8 bits (step S1). EX-OR processing (mod 2 addition) is performed on the upper 8 bits and the new 8-bit data to obtain a first processing result (step S2). The second processing result is obtained by shifting the first processing result to the right by one bit (step S3). EX-OR processing of the first processing result and the second processing result to obtain a third processing result (step S
4). The third processing result is shifted to the left by two bits to obtain a fourth processing result (step S5). EX-OR processing is performed on the third processing result and the fourth processing result to obtain a fifth processing result (step S6).
【0042】その第5処理結果を左へ4ビットだけシフ
トして第6処理結果を得る(ステップS7)。第5処理
結果と第6処理結果とをEX−OR処理して第7処理結
果を求める(ステップS8)。その第7処理結果を右へ
6ビットだけシフトして第8処理結果を得る(ステップ
S9)。第8処理結果と第4処理結果とをEX−OR処
理して第9処理結果を求める(ステップS10)。The fifth processing result is shifted to the left by 4 bits to obtain a sixth processing result (step S7). The fifth processing result and the sixth processing result are subjected to EX-OR processing to obtain a seventh processing result (step S8). The seventh processing result is shifted rightward by 6 bits to obtain an eighth processing result (step S9). The ninth processing result is obtained by performing the EX-OR processing on the eighth processing result and the fourth processing result (step S10).
【0043】第7処理結果を左へ1ビットだけシフトし
て第10処理結果を得る(ステップS11)。第10処理結果
とデータ“10000000”とをAND処理して第11処理結果
を求める(ステップS12)。第3処理結果を右へ6ビッ
トだけシフトして第12処理結果を得る(ステップS1
3)。第11処理結果と第12処理結果とをEX−OR処理
して第13処理結果を求める(ステップS14)。The tenth processing result is obtained by shifting the seventh processing result leftward by one bit (step S11). An AND process is performed on the tenth processing result and the data "10000000" to obtain an eleventh processing result (step S12). The twelfth processing result is obtained by shifting the third processing result rightward by 6 bits (step S1).
3). EX-OR processing is performed on the eleventh processing result and the twelfth processing result to obtain a thirteenth processing result (step S14).
【0044】第13処理結果と直前のデータ列に対する16
ビットの剰余の下位8ビットとをEX−OR処理し、そ
の処理結果を新しい16ビットの剰余の上位8ビットとす
る(ステップS15)。また、第9処理結果を新しい16ビ
ットの剰余の下位8ビットとして、これらの8ビットず
つのデータによって、新しい剰余を求める(ステップS
16)。The thirteenth processing result and the 16
EX-OR processing is performed on the lower 8 bits of the bit remainder and the processing result is set as the upper 8 bits of the new 16-bit remainder (step S15). In addition, the ninth processing result is set as the lower 8 bits of the new 16-bit remainder, and a new remainder is obtained from each of these 8-bit data (Step S
16).
【0045】このように、本発明のCRCでは、ビット
シフト操作と、EX−OR,ANDの論理演算との組合
せのみによって、新しいデータに対する新しい剰余を求
めることができる。上述したような処理にあっては、16
ビットCRCでの計算式らしいものが見られないが、前
述した表1の16ビットCRCの剰余の特徴、及び、ステ
ップ1〜3の16ビットCRCの剰余計算の特徴から、こ
のビットシフト操作と論理演算との組合せにより、新し
い剰余を求め得ることは明らかである。As described above, according to the CRC of the present invention, a new remainder for new data can be obtained only by a combination of a bit shift operation and a logical operation of EX-OR and AND. In the processing described above, 16
Although there is no such thing as a calculation formula in the bit CRC, the bit shift operation and the logical operation are performed based on the characteristics of the remainder of the 16-bit CRC shown in Table 1 and the characteristics of the residue calculation of the 16-bit CRC in steps 1 to 3. Obviously, a new remainder can be obtained in combination with the operation.
【0046】図7は、本発明の記録媒体の実施の形態の
構成を示すブロック図である。ここに例示するプログラ
ムは、図2,図3に示すステップS1〜S16を含んでお
り、以下に説明する記録媒体に記録されている。FIG. 7 is a block diagram showing the configuration of an embodiment of the recording medium of the present invention. The program exemplified here includes steps S1 to S16 shown in FIGS. 2 and 3, and is recorded on a recording medium described below.
【0047】図7において、コンピュータ10とオンライ
ン接続する記録媒体11は、コンピュータ10の設置場所か
ら隔たって設置される例えばWWW(World Wide Web)の
サーバコンピュータを用いてなり、記録媒体11には前述
の如きプログラム11a が記録されている。記録媒体11か
ら読み出されたプログラム11a がコンピュータ10を制御
することにより、コンピュータ10が16ビットCRCにお
ける剰余を演算する。In FIG. 7, a recording medium 11 that is connected online to the computer 10 is, for example, a WWW (World Wide Web) server computer that is installed separately from a place where the computer 10 is installed. The program 11a is recorded as follows. By controlling the computer 10 by the program 11a read from the recording medium 11, the computer 10 calculates the remainder in the 16-bit CRC.
【0048】コンピュータ10の内部に設けられた記録媒
体12は、内蔵設置される例えばハードディスクドライブ
またはROMなどを用いてなり、記録媒体12には前述の
如きプログラム12a が記録されている。記録媒体12から
読み出されたプログラム12aがコンピュータ10を制御す
ることにより、コンピュータ10が16ビットCRCにおけ
る剰余を演算する。The recording medium 12 provided inside the computer 10 uses a built-in hard disk drive or a ROM, for example, and the recording medium 12 stores the program 12a as described above. The program 12a read from the recording medium 12 controls the computer 10 so that the computer 10 calculates the remainder in the 16-bit CRC.
【0049】コンピュータ10に設けられたディスクドラ
イブ10a に装填して使用される記録媒体13は、運搬可能
な例えば光磁気ディスク,CD−ROMまたはフレキシ
ブルディスクなどを用いてなり、記録媒体13には前述の
如きプログラム13a が記録されている。記録媒体13から
読み出されたプログラム13a がコンピュータ10を制御す
ることにより、コンピュータ10が16ビットCRCにおけ
る剰余を演算する。The recording medium 13 used by being loaded into the disk drive 10a provided in the computer 10 is a transportable medium such as a magneto-optical disk, a CD-ROM or a flexible disk. The program 13a is recorded as follows. By controlling the computer 10 by the program 13a read from the recording medium 13, the computer 10 calculates the remainder in the 16-bit CRC.
【0050】なお、上記例では、ある8ビット(M=
8)のデータに、これより以前のデータ列に対する16ビ
ット(N=16)の剰余を加算して、被検査データを形成
することとしたが、これは一例である。1回の剰余計算
の結果に基づいてデータの誤りを検査する場合について
は、これらのM,Nの値は全く任意の数であってよい。
複数回の剰余計算の結果に基づいてデータの誤りを検査
する場合については、N=2Mの条件を満たす任意の
M,Nの値であってよい。In the above example, a certain 8 bits (M =
The data to be inspected is formed by adding a 16-bit (N = 16) remainder to the data sequence 8) to the data of 8), but this is an example. In the case where a data error is checked based on the result of one remainder calculation, the values of M and N may be completely arbitrary numbers.
In the case where a data error is checked based on the result of a plurality of remainder calculations, any value of M and N that satisfies the condition of N = 2M may be used.
【0051】[0051]
【発明の効果】以上のように、本発明では、ビットシフ
ト処理と論理演算とを行うだけで、ビットに対する剰余
を簡便に求めることができ、従来のようなループ計算及
びテーブル格納の何れもが不要であり、従来に比べて計
算負荷が小さくて高速な処理が可能となる。As described above, according to the present invention, the remainder of a bit can be easily obtained only by performing a bit shift process and a logical operation, and both the conventional loop calculation and table storage can be performed. This is unnecessary, and the calculation load is smaller than in the past, and high-speed processing can be performed.
【0052】このように本発明では、CRCにおける計
算負荷を低減できるので、計算負荷の大きいことが原因
でCRCが適用されていなかったメモリカード,フラッ
シュメモリなどの記録媒体へのCRCの適用を促進する
ことが可能となる。As described above, according to the present invention, the calculation load on the CRC can be reduced, so that the application of the CRC to a recording medium, such as a memory card or a flash memory, to which the CRC has not been applied due to a large calculation load, is promoted. It is possible to do.
【図1】データ誤りを検査する検査装置の機能ブロック
図である。FIG. 1 is a functional block diagram of an inspection device for inspecting a data error.
【図2】本発明の検査方法の手順を示すフロチャートで
ある。FIG. 2 is a flowchart showing the procedure of the inspection method of the present invention.
【図3】本発明の検査方法の手順を示すフロチャートで
ある。FIG. 3 is a flowchart showing the procedure of the inspection method of the present invention.
【図4】本発明の検査方法におけるデータの流れを示す
図である。FIG. 4 is a diagram showing a data flow in the inspection method of the present invention.
【図5】本発明の検査方法におけるデータの流れを示す
図である。FIG. 5 is a diagram showing a data flow in the inspection method of the present invention.
【図6】本発明の検査方法におけるデータの流れを示す
図である。FIG. 6 is a diagram showing a data flow in the inspection method of the present invention.
【図7】記録媒体の実施の形態の構成を示すブロック図
である。FIG. 7 is a block diagram illustrating a configuration of an embodiment of a recording medium.
1 検査装置 4 論理演算部 6 シフトジスタ 7 CPU 10 コンピュータ 11,12,13 記録媒体 DESCRIPTION OF SYMBOLS 1 Inspection apparatus 4 Logical operation part 6 Shift register 7 CPU 10 Computer 11, 12, 13 Recording medium
Claims (7)
データ列に対するNビットの剰余を含めたものを示すx
の多項式を所定のxの剰余生成多項式で割った際の剰余
を順次求めることにより、CRCに基づいてデータの誤
りを検査する方法において、ビットシフト処理と論理演
算とにより前記剰余を求めることを特徴とするCRCに
基づくデータ検査方法。1. x indicating a certain M-bit data including an N-bit remainder with respect to an earlier data string
In a method for checking data errors based on CRC by sequentially calculating the remainder when the polynomial in (1) is divided by a predetermined remainder generating polynomial in x, wherein the remainder is obtained by a bit shift process and a logical operation. A data inspection method based on CRC.
するNビットの剰余を上位Mビットの剰余データと下位
Mビットの剰余データとに分け、前記Mビットのデー
タ,前記上位Mビットの剰余データ及び前記下位Mビッ
トの剰余データに対するビットシフト処理と論理演算と
により前記剰余を求める請求項1記載のCRCに基づく
データ検査方法。2. N = 2M, and the N-bit remainder of the previous data sequence is divided into upper M-bit remainder data and lower M-bit remainder data, and the M-bit data and the upper M-bit 2. The CRC-based data inspection method according to claim 1, wherein the remainder is obtained by performing a bit shift process and a logical operation on the remainder data and the lower M-bit remainder data.
余データと前記8ビットのデータとをEX−OR処理し
て第1処理結果を求めるステップと、該第1処理結果を
右へ1ビットシフトして第2処理結果を得るステップ
と、前記第1処理結果と該第2処理結果とをEX−OR
処理して第3処理結果を求めるステップと、該第3処理
結果を左へ2ビットシフトして第4処理結果を得るステ
ップと、前記第3処理結果と該第4処理結果とをEX−
OR処理して第5処理結果を求めるステップと、該第5
処理結果を左へ4ビットシフトして第6処理結果を得る
ステップと、前記第5処理結果と該第6処理結果とをE
X−OR処理して第7処理結果を求めるステップと、該
第7処理結果を右へ6ビットシフトして第8処理結果を
得るステップと、該第8処理結果と前記第4処理結果と
をEX−OR処理して第9処理結果を求めるステップ
と、前記第7処理結果を左へ1ビットシフトして第10処
理結果を得るステップと、該第10処理結果とデータ“10
000000”とをAND処理して第11処理結果を求めるステ
ップと、前記第3処理結果を右へ6ビットシフトして第
12処理結果を得るステップと、前記第11処理結果と該第
12処理結果とをEX−OR処理して第13処理結果を求め
るステップと、該第13処理結果と前記下位8ビットの剰
余データとをEX−OR処理し、その処理結果を新しい
16ビットの剰余の上位8ビットとするステップと、前記
第9処理結果を新しい16ビットの剰余の下位8ビットと
するステップとを有する請求項2記載のCRCに基づく
データ検査方法。3. A step of EX-ORing the upper 8 bits of the surplus data and the 8 bits of data to obtain a first processing result, wherein M = 8, and shifting the first processing result to the right. Obtaining a second processing result by shifting by one bit, and EX-ORing the first processing result and the second processing result
Processing to obtain a third processing result, shifting the third processing result to the left by 2 bits to obtain a fourth processing result, and converting the third processing result and the fourth processing result to EX-
OR processing to obtain a fifth processing result;
Shifting the processing result to the left by 4 bits to obtain a sixth processing result; and converting the fifth processing result and the sixth processing result to E
X-OR processing to obtain a seventh processing result, shifting the seventh processing result to the right by 6 bits to obtain an eighth processing result, and calculating the eighth processing result and the fourth processing result. EX-OR processing to obtain a ninth processing result; shifting the seventh processing result by one bit to the left to obtain a tenth processing result;
000000 "to obtain an eleventh processing result; and shifting the third processing result to the right by 6 bits.
Obtaining the 12th processing result, the 11th processing result and the
EX-ORing the 12th processing result to obtain a 13th processing result; EX-ORing the 13th processing result and the lower 8-bit remainder data;
3. The CRC-based data inspection method according to claim 2, further comprising the steps of: setting upper 8 bits of a 16-bit remainder; and setting the ninth processing result to lower 8 bits of a new 16-bit remainder.
データ列に対するNビットの剰余を含めたものを示すx
の多項式を所定のxの剰余生成多項式で割った際の剰余
を順次求めることにより、CRCに基づいてデータの誤
りを検査する装置において、シフトレジスタと論理演算
器とを備え、前記シフトレジスタによるビットシフト処
理と前記論理演算器による論理演算とにより前記剰余を
求めるようにしたことを特徴とするCRCに基づくデー
タ検査装置。4. An x indicating a certain M-bit data including an N-bit remainder with respect to an earlier data string.
A device for checking data errors based on CRC by sequentially calculating the remainder when dividing the polynomial of a given x by a residue generation polynomial of x, comprising a shift register and a logical operation unit, A CRC-based data inspection device wherein the remainder is obtained by a shift process and a logical operation by the logical operation unit.
するNビットの剰余を上位Mビットの剰余データと下位
Mビットの剰余データとに分け、前記Mビットのデー
タ,前記上位Mビットの剰余データ及び前記下位Mビッ
トの剰余データに対する前記シフトレジスタによるビッ
トシフト処理と前記論理演算器による論理演算とにより
前記剰余を求めるようにした請求項4記載のCRCに基
づくデータ検査装置。5. N = 2M, the N-bit remainder of the previous data string is divided into upper M-bit remainder data and lower M-bit remainder data, and the M-bit data and the upper M-bit 5. The CRC-based data inspection device according to claim 4, wherein the remainder is obtained by performing bit shift processing on the remainder data and the remainder data of the lower M bits by the shift register and a logical operation by the logical operation unit.
び論理演算器は、前記上位8ビットの剰余データと前記
8ビットのデータとをEX−OR処理して第1処理結果
を求める第1論理演算器と、該第1処理結果を右へ1ビ
ットシフトして第2処理結果を得る第1シフトレジスタ
と、前記第1処理結果と該第2処理結果とをEX−OR
処理して第3処理結果を求める第2論理演算器と、該第
3処理結果を左へ2ビットシフトして第4処理結果を得
る第2シフトレジスタと、前記第3処理結果と該第4処
理結果とをEX−OR処理して第5処理結果を求める第
3論理演算器と、該第5処理結果を左へ4ビットシフト
して第6処理結果を得る第3シフトレジスタと、前記第
5処理結果と該第6処理結果とをEX−OR処理して第
7処理結果を求める第4論理演算器と、該第7処理結果
を右へ6ビットシフトして第8処理結果を得る第4シフ
トレジスタと、該第8処理結果と前記第4処理結果とを
EX−OR処理して第9処理結果を求める第5論理演算
器と、前記第7処理結果を左へ1ビットシフトして第10
処理結果を得る第5シフトレジスタと、該第10処理結果
とデータ“10000000”とをAND処理して第11処理結果
を求める第6論理演算器と、前記第3処理結果を右へ6
ビットシフトして第12処理結果を得る第6シフトレジス
タと、前記第11処理結果と該第12処理結果とをEX−O
R処理して第13処理結果を求める第7論理演算器と、該
第13処理結果と前記下位8ビットの剰余データとをEX
−OR処理する第8論理演算器とを有し、該第8論理演
算器での処理結果を新しい16ビットの剰余の上位8ビッ
トとし、前記第9処理結果を新しい16ビットの剰余の下
位8ビットとするようにした請求項5記載のCRCに基
づくデータ検査装置。6. M = 8, wherein the shift register and the logical operation unit perform an EX-OR process on the upper 8 bits of the remainder data and the 8 bits of data to obtain a first processing result. A logical operation unit, a first shift register that shifts the first processing result right by one bit to obtain a second processing result, and performs an EX-OR operation on the first processing result and the second processing result.
A second logical operation unit for processing to obtain a third processing result; a second shift register for shifting the third processing result to the left by 2 bits to obtain a fourth processing result; A third logical operation unit that performs an EX-OR operation on the processing result to obtain a fifth processing result, a third shift register that shifts the fifth processing result to the left by 4 bits to obtain a sixth processing result, A fourth logical operation unit that performs an EX-OR operation on the fifth processing result and the sixth processing result to obtain a seventh processing result; and a fourth logical operation unit that shifts the seventh processing result rightward by 6 bits to obtain an eighth processing result. A fourth shift register, a fifth logical operation unit for performing an EX-OR operation on the eighth processing result and the fourth processing result to obtain a ninth processing result, and shifting the seventh processing result left by one bit. Tenth
A fifth shift register for obtaining a processing result, a sixth logical operator for performing an AND operation on the tenth processing result and data "10000000" to obtain an eleventh processing result, and
A sixth shift register for performing a bit shift to obtain a twelfth processing result, and EX-O
R processing to obtain a thirteenth processing result, a seventh logical operation unit, and EX processing the thirteenth processing result and the lower 8 bits of the remainder data
An eighth logical operation unit for performing an OR operation, wherein the processing result of the eighth logical operation unit is set as the upper 8 bits of the new 16-bit remainder, and the ninth processing result is set as the lower 8 bits of the new 16-bit residue. 6. A data inspection device based on a CRC according to claim 5, wherein the data inspection device is configured to use bits.
データ列に対する16ビットの剰余を含めたものを示すx
の多項式を所定のxの剰余生成多項式で割った際の剰余
を順次求めることにより、16ビットCRCに基づいてデ
ータの誤りを検査するためのプログラムを記録してある
コンピュータでの読み取り可能な記録媒体において、以
前のデータ列に対する16ビットの剰余を上位8ビットの
剰余データと下位8ビットの剰余データとに分けること
を前記コンピュータにさせるプログラムコード手段と、
前記上位8ビットの剰余データと前記8ビットのデータ
とをEX−OR処理して第1処理結果を求めることを前
記コンピュータにさせるプログラムコード手段と、該第
1処理結果を右へ1ビットシフトして第2処理結果を得
ることを前記コンピュータにさせるプログラムコード手
段と、前記第1処理結果と該第2処理結果とをEX−O
R処理して第3処理結果を求めることを前記コンピュー
タにさせるプログラムコード手段と、該第3処理結果を
左へ2ビットシフトして第4処理結果を得ることを前記
コンピュータにさせるプログラムコード手段と、前記第
3処理結果と該第4処理結果とをEX−OR処理して第
5処理結果を求めることを前記コンピュータにさせるプ
ログラムコード手段と、該第5処理結果を左へ4ビット
シフトして第6処理結果を得ることを前記コンピュータ
にさせるプログラムコード手段と、前記第5処理結果と
該第6処理結果とをEX−OR処理して第7処理結果を
求めることを前記コンピュータにさせるプログラムコー
ド手段と、該第7処理結果を右へ6ビットシフトして第
8処理結果を得ることを前記コンピュータにさせるプロ
グラムコード手段と、該第8処理結果と前記第4処理結
果とをEX−OR処理して第9処理結果を求めることを
前記コンピュータにさせるプログラムコード手段と、前
記第7処理結果を左へ1ビットシフトして第10処理結果
を得ることを前記コンピュータにさせるプログラムコー
ド手段と、該第10処理結果とデータ“10000000”とをA
ND処理して第11処理結果を求めることを前記コンピュ
ータにさせるプログラムコード手段と、前記第3処理結
果を右へ6ビットシフトして第12処理結果を得ることを
前記コンピュータにさせるプログラムコード手段と、前
記第11処理結果と該第12処理結果とをEX−OR処理し
て第13処理結果を求めることを前記コンピュータにさせ
るプログラムコード手段と、該第13処理結果と前記下位
8ビットの剰余データとをEX−OR処理し、その処理
結果を新しい16ビットの剰余の上位8ビットとすること
を前記コンピュータにさせるプログラムコード手段と、
前記第9処理結果を新しい16ビットの剰余の下位8ビッ
トとすることを前記コンピュータにさせるプログラムコ
ード手段とを有することを特徴とする記録媒体。7. An x indicating a certain 8-bit data including a 16-bit remainder with respect to an earlier data string.
Is sequentially obtained by dividing the polynomial of the above by a predetermined remainder generating polynomial of x, and thereby a computer-readable recording medium storing a program for checking a data error based on a 16-bit CRC. A program code means for causing the computer to divide the 16-bit remainder with respect to the previous data string into upper 8 bits of remainder data and lower 8 bits of remainder data;
Program code means for causing the computer to EX-OR the upper 8 bits of the remainder data and the 8 bits of data to obtain a first processing result; and shift the first processing result to the right by one bit. Program code means for causing the computer to obtain a second processing result by using an EX-O
Program code means for causing the computer to perform R processing to obtain a third processing result; and program code means for causing the computer to shift the third processing result to the left by two bits to obtain a fourth processing result. Program code means for causing the computer to EX-OR the third processing result and the fourth processing result to obtain a fifth processing result; and shifting the fifth processing result to the left by 4 bits. Program code means for causing the computer to obtain a sixth processing result, and program code for causing the computer to perform an EX-OR operation on the fifth processing result and the sixth processing result to obtain a seventh processing result Means and program code means for causing the computer to shift the seventh processing result right by 6 bits to obtain an eighth processing result Program code means for causing the computer to EX-OR the eighth processing result and the fourth processing result to obtain a ninth processing result; and shifting the seventh processing result left by one bit. Program code means for causing the computer to obtain a tenth processing result; and storing the tenth processing result and data "10000000" in A
Program code means for causing the computer to perform ND processing to obtain an eleventh processing result; and program code means for causing the computer to shift the third processing result to the right by 6 bits to obtain a twelfth processing result. Program code means for causing the computer to perform an EX-OR operation on the eleventh processing result and the twelfth processing result to obtain a thirteenth processing result; and the thirteenth processing result and the lower 8-bit remainder data. And EX-OR processing of the above and program code means for causing the computer to make the processing result the upper 8 bits of a new 16-bit remainder;
A recording medium comprising program code means for causing the computer to make the ninth processing result the lower 8 bits of a new 16-bit remainder.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP35807898A JP3239866B2 (en) | 1998-12-16 | 1998-12-16 | Data inspection method and apparatus based on CRC and recording medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP35807898A JP3239866B2 (en) | 1998-12-16 | 1998-12-16 | Data inspection method and apparatus based on CRC and recording medium |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2000181733A true JP2000181733A (en) | 2000-06-30 |
JP3239866B2 JP3239866B2 (en) | 2001-12-17 |
Family
ID=18457431
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP35807898A Expired - Fee Related JP3239866B2 (en) | 1998-12-16 | 1998-12-16 | Data inspection method and apparatus based on CRC and recording medium |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3239866B2 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010272144A (en) * | 2000-07-06 | 2010-12-02 | Mcm Portfolio Llc | Flash memory card reading apparatus for reading plural kinds of flash memory cards |
US8337252B2 (en) | 2000-07-06 | 2012-12-25 | Mcm Portfolio Llc | Smartconnect flash card adapter |
-
1998
- 1998-12-16 JP JP35807898A patent/JP3239866B2/en not_active Expired - Fee Related
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010272144A (en) * | 2000-07-06 | 2010-12-02 | Mcm Portfolio Llc | Flash memory card reading apparatus for reading plural kinds of flash memory cards |
US8337252B2 (en) | 2000-07-06 | 2012-12-25 | Mcm Portfolio Llc | Smartconnect flash card adapter |
JP2013047996A (en) * | 2000-07-06 | 2013-03-07 | Mcm Portfolio Llc | Flash memory card reading apparatus for reading plural kinds of flash memory cards |
US9558135B2 (en) | 2000-07-06 | 2017-01-31 | Larry Lawson Jones | Flashcard reader and converter for reading serial and parallel flashcards |
Also Published As
Publication number | Publication date |
---|---|
JP3239866B2 (en) | 2001-12-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2580304B2 (en) | Data correction method and apparatus | |
US8689078B2 (en) | Determining a message residue | |
JPH0464211B2 (en) | ||
US6543026B1 (en) | Forward error correction apparatus and methods | |
US7162679B2 (en) | Methods and apparatus for coding and decoding data using Reed-Solomon codes | |
CN100442671C (en) | Method and apparatus for obtaining cyclic redundancy code for a message | |
EP0832520A1 (en) | Dedicated alu architecture for 10-bit reed-solomon error correction module | |
CN110166059A (en) | For handling the integrated circuit and method of the message word of coding | |
US8739006B2 (en) | Reduced circuit implementation of encoder and syndrome generator | |
JP2008011025A (en) | Remainder calculator for cyclic redundancy check | |
JP7116374B2 (en) | Reduced Latency Error Correction Decoding | |
CN114389752A (en) | Cyclic redundancy check code generation method, apparatus, device, medium, and program product | |
JP3245290B2 (en) | Decoding method and device | |
JP3343857B2 (en) | Decoding device, arithmetic device, and methods thereof | |
JP2000181807A (en) | Method and device for inspecting data in recording medium | |
US20080140740A1 (en) | Systems and methods for processing data sets in parallel | |
JP3239866B2 (en) | Data inspection method and apparatus based on CRC and recording medium | |
JP2810397B2 (en) | Error correction device | |
JP3255130B2 (en) | Data inspection method and apparatus, and recording medium | |
CN108628698A (en) | The method and apparatus for calculating CRC codings | |
WO2008069465A1 (en) | Method and apparatus for checking correction errors using cyclic redundancy check | |
JP3126973B2 (en) | Error correction processor | |
US10623018B2 (en) | Method of arrangement of an algorithm in cyclic redundancy check | |
JP2008112522A (en) | Error detection apparatus and error detection method | |
KR900000670Y1 (en) | Cord word generator of read-solomon encoder |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111012 Year of fee payment: 10 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111012 Year of fee payment: 10 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121012 Year of fee payment: 11 |
|
LAPS | Cancellation because of no payment of annual fees |