JP2002175178A - Dividing method, dividing circuit and multiplying and dividing circuit - Google Patents

Dividing method, dividing circuit and multiplying and dividing circuit

Info

Publication number
JP2002175178A
JP2002175178A JP2000371567A JP2000371567A JP2002175178A JP 2002175178 A JP2002175178 A JP 2002175178A JP 2000371567 A JP2000371567 A JP 2000371567A JP 2000371567 A JP2000371567 A JP 2000371567A JP 2002175178 A JP2002175178 A JP 2002175178A
Authority
JP
Japan
Prior art keywords
subtraction
register
carry
bit
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2000371567A
Other languages
Japanese (ja)
Other versions
JP4306121B2 (en
Inventor
Michinaga Nagura
道長 名倉
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.)
Denso Corp
Original Assignee
Denso Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Corp filed Critical Denso Corp
Priority to JP2000371567A priority Critical patent/JP4306121B2/en
Publication of JP2002175178A publication Critical patent/JP2002175178A/en
Application granted granted Critical
Publication of JP4306121B2 publication Critical patent/JP4306121B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a dividing method, a dividing circuit and a multiplying and dividing circuit capable of executing a division of a large figure at a high speed. SOLUTION: In the dividing circuit, a subtraction processing part 22 for executing a subtraction of a divisor from a dividend repeatedly is constituted of a plurality of subtraction blocks DBi for dividing data of an object of the subtraction into a plurality of data and performing a parallel processing for the data, and a carry to be transmission information to a higher rank block which is generated in each block DBi at the time of the subtraction is processed at the next time subtraction. Namely, because each data of a small bit width are independently processed in each block DBi, transmission time for the carry generated within each block, that is the time required for a subtraction of one time is shortened. A processing for the generated transmission information is performed together at the next time calculation without performing a new and independent calculation and thereby the repeating times of calculations is not increased.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、通信データの暗号
処理等で必要となる大きな桁数の除算を高速に実行する
ための除算方法、除算回路、乗除算回路に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a division method, division circuit, and multiplication / division circuit for performing high-speed division of a large number of digits required for encryption processing of communication data and the like.

【0002】[0002]

【従来の技術】従来より、通信データの漏洩,改竄を防
止するために、暗号技術を用いて、通信相手の正当性を
確認する認証を行ったり、通信データを暗号化すること
が行われている。
2. Description of the Related Art Hitherto, in order to prevent leakage or tampering of communication data, authentication for confirming the validity of a communication partner or encryption of communication data has been performed by using encryption technology. I have.

【0003】このようなシステムに使用される暗号方式
の一つとして、RAS公開鍵暗号方式(以下単に「RA
S方式」という)が知られている。RAS方式にて認証
を行う場合、平文をC,暗号文をS,秘密鍵をd,公開
鍵をe,n(=p×q:但しp,qは素数)とすると、
署名作成の際に、平文Cは(1)式により暗号文Sに暗
号化され、署名検証の際に、暗号文Sは(2)式により
平文Cに復号化される。
One of the encryption systems used in such a system is a RAS public key encryption system (hereinafter simply referred to as “RA
S method) is known. When performing authentication by the RAS method, assuming that the plaintext is C, the ciphertext is S, the secret key is d, and the public key is e, n (= p × q: where p and q are prime numbers),
At the time of signature creation, the plaintext C is encrypted into the ciphertext S by the formula (1), and at the time of signature verification, the ciphertext S is decrypted into the plaintext C by the formula (2).

【0004】S=Cd mod n (1) C=Se mod n (2) 例えば、秘密鍵d及び公開鍵nを1024ビットに設定
した場合、署名作成の際には、1024ビット×102
4ビットの乗算、及び2048ビット÷1024ビット
の除算が、それぞれ約1500回ずつ繰り返されること
になる。
S = C d mod n (1) C = S e mod n (2) For example, when the secret key d and the public key n are set to 1024 bits, 1024 bits × 102
The multiplication of 4 bits and the division of 2048 bits divided by 1024 bits are repeated about 1500 times each.

【0005】即ち、2進数で表された秘密鍵dは(3)
式にて表現でき、これを用いてCのd乗は、(4)式に
て表現することができる。 d =Σ{2ii} (但し、di=0 or1、Di=2ii) =210231023+210221022+…+211+200 =D1023+D1022+…+D1+D0 (3) Cd=CD1023・CD1022・…・CD1・CD0 (4) また、剰余を求める計算では、(5)式に示すように、
乗算後に剰余を求めても、剰余を求めてから乗算を行っ
ても結果は同じである。
That is, the secret key d expressed by a binary number is (3)
The d power of C can be expressed by equation (4). d = Σ {2 i d i } ( where, d i = 0 or1, Di = 2 i d i) = 2 1023 d 1023 +2 1022 d 1022 + ... + 2 1 d 1 +2 0 d 0 = D1023 + D1022 + ... + D1 + D0 (3) C d = C D1023 · C D1022 · ... · C D1 · C D0 (4) Further, in the calculation for obtaining a remainder, as shown in (5),
The result is the same whether the remainder is obtained after multiplication or the multiplication is performed after obtaining the remainder.

【0006】 (A・B) mod C = [(A mod C)・(B mod C)] mod C (5) 従って、d0 =1とした場合のCD0についてのnを法と
する剰余X0 をCとし、以下、di =1とした場合のC
Diについてのnを法とする剰余Xi (但しi=1〜10
23)を、剰余Xi-1 を用いて順次算出し、その中か
ら、実際にdi =1である剰余のみを順次抽出して、
積,及びその剰余を繰り返し算出することで、(1)式
の結果を得ることができる。
(A · B) mod C = [(A mod C) · (B mod C)] mod C (5) Therefore, when d 0 = 1, the remainder X modulo n on C D0 when d 0 = 1. 0 is C, and hereafter C in the case of d i = 1
The remainder X i modulo n for Di (where i = 1 to 10
23) are sequentially calculated by using the remainder X i−1, and only the remainder of which is actually d i = 1 is sequentially extracted therefrom.
By repeatedly calculating the product and its remainder, the result of equation (1) can be obtained.

【0007】 X0=C (=CD0:但しd0=1の場合) X1=C2 mod n (=CD1:但しd1=1の場合) X2=C4 mod n=X1 2 mod n (=CD2:但しd2=1の場合) X3=C8 mod n=X2 2 mod n (=CD3:但しd3=1の場合) … … Xi=C(2i)mod n=Xi-1 2 mod n(=CDi:但しdi=1の場合) … … つまり、Xi-1 2を算出するための乗算、及びその乗算結
果からnを法とした剰余を算出するための除算を約10
00回(実際は1023回)ずつ、及び、2進数で表さ
れた秘密鍵dの各桁の値を表すd0 〜d1023のうち、d
i =1となるものが約半数あるとすれば、これらを抽出
して互いに掛け合わせて、その剰余を求めるための乗
算,除算を約500回ずつ実行することになるため、結
局、Cのd乗の剰余を求める署名作成の際には、102
4ビット×1024ビットの乗算、及び2048ビット
÷1024ビットの除算を、約1500回ずつ行う必要
があるのである。
X 0 = C (= C D0 : where d 0 = 1) X 1 = C 2 mod n (= C D1 : where d 1 = 1) X 2 = C 4 mod n = X 1 2 mod n (= C D2 : when d 2 = 1) X 3 = C 8 mod n = X 2 2 mod n (= C D3 : where d 3 = 1) ... X i = C (2 Roh i th power) mod n = X i-1 2 mod n (= C Di: However, if the d i = 1) ... ... in other words, the multiplication for calculating the X i-1 2, and n from the multiplication result Divide by about 10 to calculate the remainder
00 times (actually 1023 times) and d 0 to d 1023 representing the value of each digit of the secret key d expressed in binary
If there are about half of the cases where i = 1, these are extracted and multiplied by each other, and multiplication and division for obtaining the remainder are executed about 500 times, so that the d of C is eventually obtained. When creating a signature for the remainder of the power,
The multiplication of 4 bits × 1024 bits and the division of 2048 bits ÷ 1024 bits need to be performed about 1500 times.

【0008】[0008]

【発明が解決しようとする課題】ところで、1000ビ
ットを越えるような多桁の乗除算を行う場合には、従来
は、これよりデータバスサイズの小さいCPU(例えば
16ビットや32ビット)により、ソフトウェアを用い
て処理をしており、処理に時間がかかり過ぎるという問
題があった。
By the way, when performing multi-digit multiplication / division exceeding 1000 bits, conventionally, a CPU (for example, 16 bits or 32 bits) having a smaller data bus size uses software. And the processing takes too much time.

【0009】そこで、これらの乗除算をハードウェアに
て実行することが考えられるが、演算対象となる数値の
桁(ビット)数が大きいことから、一般に、構成の単純
な逐次的な方法にて積や剰余を算出する回路が用いられ
ている。即ち、乗算の場合、2進数で表された乗数の各
桁の値に応じて、被乗数のシフト及び加算処理を繰り返
すことにより積を算出し、一方、除算の場合、被除数の
シフト及び減算処理を繰り返すことにより、商及び剰余
を算出する周知の乗算回路及び除算回路が用いられてい
る。
Therefore, it is conceivable that these multiplications and divisions are performed by hardware. However, since the number of digits (bits) of a numerical value to be operated is large, generally, a simple sequential method having a simple structure is used. A circuit for calculating a product or a remainder is used. That is, in the case of multiplication, the product is calculated by repeating the shift and addition processes of the multiplicand according to the value of each digit of the multiplier represented by the binary number, while in the case of division, the shift and subtraction processes of the dividend are performed. By repeating, a well-known multiplication circuit and division circuit for calculating a quotient and a remainder are used.

【0010】これらの乗算回路及び除算回路では、いず
れの場合も、1回の乗算或いは除算の中で、加算或いは
減算が繰り返し実行される。そして、1回の加減算に要
する時間は、最下位ビット(LSB)から発生したキャ
リー或いはボローが最上位ビット(MSB)まで伝達さ
れるのに要する時間が支配的であり、従って、被乗数や
除数のデータ幅(桁数)にほぼ比例して大きくなる。例
えば、キャリーやボローの1ビット当たりの伝達時間を
1nsとし、被乗数や除数のデータ幅が1024ビット
あるとした場合、1回の加減算に要する時間は1μs以
上必要となる。
In each of these multiplication circuits and division circuits, addition or subtraction is repeatedly performed in one multiplication or division. The time required for one addition / subtraction is dominated by the time required for the carry or borrow generated from the least significant bit (LSB) to be transmitted to the most significant bit (MSB). It increases almost in proportion to the data width (number of digits). For example, if the transmission time per bit of carry or borrow is 1 ns and the data width of the multiplicand or divisor is 1024 bits, the time required for one addition / subtraction is 1 μs or more.

【0011】また、この逐次的な方法を用いた場合、上
述した1024ビット×1024ビットの乗算では、最
大で1023回もの加算が、また、2048ビット÷1
024ビットの除算では、最大で1025回もの減算が
実行される。つまり、1回の乗算或いは除算に1ms
(≒1μs×約1000回)以上の時間を要することに
なり、従って、上述の署名作成の場合のように、乗算及
び除算を約1500回ずつ繰り返すと、3秒以上かかっ
てしまうことになる。
In addition, when this sequential method is used, in the above-described 1024-bit × 1024-bit multiplication, as many as 1023 additions at the maximum and 2048 bits ま た 1
In the 024-bit division, as many as 1025 subtractions are performed. In other words, 1 ms for one multiplication or division
(≒ 1 μs × approximately 1000 times) or more, and therefore, when the multiplication and division are repeated about 1500 times as in the case of the above-described signature creation, it takes 3 seconds or more.

【0012】このようにICカードの認証に、上述のR
AS方式の暗号技術が使用されている場合、ICカード
を装着してから目的の処理が開始されるまでに、秒単位
で時間が費やされることになり、使い勝手が悪いという
問題があった。なお、乗算回路については、例えば、特
開平5ー289851号公報や特開平5−298072
号公報に開示されているように、高速化するための提案
がなされている。
As described above, the above-mentioned R
In the case where the AS-type encryption technology is used, there is a problem that the time is consumed in seconds from the mounting of the IC card to the start of the target processing, resulting in poor usability. Note that the multiplication circuit is described in, for example, Japanese Patent Application Laid-Open No.
As disclosed in Japanese Unexamined Patent Publication (Kokai) No. H11-284, proposals have been made to increase the speed.

【0013】そこで本発明は、上記問題点を解決するた
めに、桁数の大きな除算を高速に実行することが可能な
除算方法,及び除算回路,乗除算回路を提供することを
第1の目的とする。また、暗号技術等で用いられる多桁
の剰余計算を行うための回路では、乗算回路と除算回路
とがいずれも必要となり、回路規模が極めて大きなもの
となってしまうという問題もあった。
Accordingly, it is a first object of the present invention to provide a division method, a division circuit, and a multiplication / division circuit capable of performing a division with a large number of digits at a high speed in order to solve the above problems. And In addition, a circuit for performing multi-digit remainder calculation used in encryption technology or the like requires both a multiplication circuit and a division circuit, and has a problem that the circuit scale becomes extremely large.

【0014】そこで本発明では、小型の乗除算回路を提
供することを第2の目的とする。
It is a second object of the present invention to provide a small multiplication / division circuit.

【0015】[0015]

【課題を解決するための手段】上記目的を達成するため
になされた請求項1記載の発明は、被除数からの除数の
減算を繰り返し実行することより、除算結果を得る除算
方法において、除数を複数に分割してなる各ブロック毎
に減算を実行し、該減算時に各ブロックにて生成される
伝達情報(加算器を使用する場合はキャリー,減算器を
使用する場合はボロー)を、次回の減算時に処理するこ
とを特徴とする。
According to a first aspect of the present invention, there is provided a method for obtaining a division result by repeatedly executing a subtraction of a divisor from a dividend, the method comprising the steps of: The subtraction is performed for each of the divided blocks, and transmission information (carry when using an adder, borrow when using a subtractor) generated at the time of the subtraction is used for the next subtraction. It is characterized in that it is sometimes processed.

【0016】このように、本発明の除算方法では、処理
するデータのビット幅が除数のビット幅より小さくなる
よう設定されたブロック毎に、それぞれ独立した減算を
実行するようにされているので、減算によって各ブロッ
クにて生成される伝達情報(キャリー/ボロー)の伝達
時間、ひいては1回の減算に要する時間が短縮される。
しかも、生成された伝達情報の処理は、新たに独立した
演算を行うのではなく、次回の減算時に一緒に処理され
るため、演算の繰り返し回数を増加させることもない。
As described above, in the division method of the present invention, independent subtraction is executed for each block set so that the bit width of the data to be processed is smaller than the bit width of the divisor. The transmission time of the transmission information (carry / borrow) generated in each block by the subtraction, and hence the time required for one subtraction, is reduced.
Moreover, the processing of the generated transmission information is not performed by a new independent calculation but is performed together at the next subtraction, so that the number of repetitions of the calculation does not increase.

【0017】従って、本発明によれば、除算に要する処
理時間を大幅に短縮することができ、その効果は、除数
のビット数が大きいほど、また、減算の繰り返し回数が
多いほど大きくなるため、桁数の大きなデータの剰余計
算を繰り返し実行する暗号処理等に好適に用いることが
できる。
Therefore, according to the present invention, the processing time required for division can be greatly reduced, and the effect increases as the number of bits of the divisor increases and the number of repetitions of subtraction increases. The present invention can be suitably used for encryption processing in which the remainder calculation of data having a large number of digits is repeatedly executed.

【0018】なお、各ブロックが処理するデータのビッ
ト幅は、伝達情報の伝達待ち時間が一定となるように、
全て同じ大きさとすることが望ましい。例えば、204
8ビット÷1024ビットの除算の場合、1024ビッ
トの除数を32ビットずつ32個のブロックに分割して
処理した場合、ボローの伝達時間を1ビット当たり1n
sとすると、ブロックに分割しない従来の方法では、1
回の減算に要する時間は約1μsとなるのに対して、本
発明では、1回の減算(即ち、各ブロック内でのボロー
の伝達時間)に要する時間は約32ns、つまり約1/
30に抑えることができる。
The bit width of data processed by each block is set so that the transmission waiting time of transmission information is constant.
It is desirable that all have the same size. For example, 204
In the case of 8-bit / 1024-bit division, when the 1024-bit divisor is divided into 32 blocks of 32 bits and processed, the borrow transmission time is 1n per bit.
In the conventional method that does not divide into blocks, 1
The time required for one subtraction is about 1 μs, whereas in the present invention, the time required for one subtraction (that is, the transmission time of a borrow in each block) is about 32 ns, that is, about 1 /.
30.

【0019】しかも、回路規模は、従来の方法がMビッ
トの除算を行う回路が一つであるのに対し、本発明で
は、Nビットの除算を行う回路がM/N個であり、ブロ
ック間の伝達情報を処理するための回路が僅かに増加す
る以外は、ほぼ同程度となる。但し、各ブロックのデー
タサイズNを小さくし過ぎると、伝達情報を処理するた
めの回路部分が大きくなるだけでなく、各ブロック内に
おける伝達情報の伝達時間が、減算処理全体の中で占め
る割合が相対的に小さくなり、回路の規模の増大に対す
る処理時間の短縮効果が小さくなる。そのため、各ブロ
ックのデータサイズNは、8ビット以上とすることが望
ましい。
In addition, the conventional method has a single circuit for performing M-bit division in the conventional method, whereas the present invention employs M / N circuits for performing N-bit division, and Except that the number of circuits for processing the transmitted information is slightly increased. However, if the data size N of each block is too small, not only the circuit portion for processing the transmission information becomes large, but also the transmission time of the transmission information in each block accounts for the proportion of the entire subtraction process. It is relatively small, and the effect of reducing the processing time with respect to the increase in the circuit scale is reduced. Therefore, the data size N of each block is desirably 8 bits or more.

【0020】次に、請求項2記載の除算回路では、Mビ
ットの被除数を格納し、格納値をビット単位でシフトさ
せることが可能な被除数レジスタと、この被除数レジス
タの格納値を上位側にシフトさせた時にあふれる1ビッ
トの値を保持する保持手段とを備えており、減算手段
が、被除数レジスタの上位N(<M)ビットの格納値を
対象データとして、該対象データから、予め設定された
Nビットの除数を減算し、その減算の可否を、判定手段
が、減算手段での減算結果及び前記保持手段の記憶内容
に基づいて判定し、減算可能と判定された場合、データ
更新手段が、減算手段での減算結果にて被除数レジスタ
の上位Nビットを更新する。
Next, in the dividing circuit according to the present invention, a dividend register capable of storing an M-bit dividend and shifting a stored value in bit units, and shifting a stored value of the dividend register to a higher order side Holding means for holding a 1-bit value which overflows when the setting is made, and the subtracting means sets a stored value of the upper N (<M) bits of the dividend register as target data and sets a preset value from the target data. The N-bit divisor is subtracted, and the determination unit determines whether the subtraction is possible or not based on the result of the subtraction by the subtraction unit and the storage content of the holding unit. If it is determined that the subtraction is possible, the data updating unit determines The upper N bits of the dividend register are updated with the result of the subtraction by the subtractor.

【0021】そして、再起制御手段が、被除数レジスタ
の格納値を上位側にシフトさせ減算手段を再起動する制
御を、被除数レジスタに初期設定された被除数の最下位
ビットが前記被除数レジスタの上位Nビット中の最下位
ビットの位置に移動するまで繰り返す。これにより、対
象データからの除数の減算及び被除数レジスタの格納値
の更新,シフトを繰り返すことにより除算結果が得ら
れ、具体的には、最終的に被除数レジスタの上位Nビッ
トに剰余が格納されることになる。
The restart control means shifts the stored value of the dividend register to the upper side and restarts the subtraction means by controlling the least significant bit of the dividend initially set in the dividend register to the upper N bits of the dividend register. It repeats until it moves to the position of the least significant bit. As a result, the division result is obtained by repeating the subtraction of the divisor from the target data and the updating and shifting of the stored value of the dividend register. Specifically, the remainder is finally stored in the upper N bits of the dividend register. Will be.

【0022】特に本発明では、減算手段が、被除数のデ
ータ幅Nより小さいR(<N)ビットの減算を実行する
複数の減算ブロック、及び減算ブロックのそれぞれにて
生成される伝達情報を記憶する伝達情報記憶手段からな
り、減算ブロックは、前回の減算時に伝達情報記憶手段
に記憶された各減算ブロックの伝達情報を反映させた減
算を実行するようにされている。
In particular, in the present invention, the subtraction means stores a plurality of subtraction blocks for performing subtraction of R (<N) bits smaller than the data width N of the dividend, and transmission information generated in each of the subtraction blocks. The subtraction block is configured to execute subtraction reflecting transmission information of each subtraction block stored in the transmission information storage unit during the previous subtraction.

【0023】このように構成された本発明の除算回路
は、上述した請求項1記載の除算方法を実現するもので
あり、従って、これと全く同様の効果を得ることができ
る。なお、除算結果として、剰余だけでなく商も必要な
場合には、請求項3記載のように、商出力手段が、判定
手段にて減算可能と判定された場合には1、減算不能と
判定された場合には0を出力し、この出力を商レジスタ
が順次記憶するように構成すればよい。
The dividing circuit of the present invention configured as described above realizes the above-described dividing method according to claim 1, and therefore, can achieve exactly the same effect. If the division result requires not only the remainder but also the quotient, the quotient output means determines 1 if the determination means determines that the subtraction is possible, and determines that the subtraction is impossible. In such a case, 0 may be output, and the output may be stored in the quotient register sequentially.

【0024】ところで、減算ブロックは、請求項4記載
のように、ボロー付き減算を実行する減算器にて構成し
てもよいし、請求項5記載のように、キャリー付き加算
を実行する加算器にて構成してもよい。そして、前者
(請求項4)の場合、判定手段は、保持手段の記憶内容
が1であるか、或いは最上位に位置する減算ブロック
(以下「最上位減算ブロック」という)にて、伝達情報
としてのボローが発生していない場合に減算可能と判定
し、一方、後者(請求項5)の場合、減算ブロックに
は、除数を2の補数形式に変換して供給し、判定手段
は、保持手段の記憶内容が1であるか、或いは最上位減
算ブロックにて、伝達情報としてのキャリーが発生した
場合に減算可能と判定すればよい。
Incidentally, the subtraction block may be constituted by a subtractor which performs subtraction with borrow as described in claim 4, or an adder which performs addition with carry as described in claim 5. May be configured. In the case of the former (Claim 4), the determination unit determines whether the storage content of the holding unit is 1 or in a subtraction block located at the highest level (hereinafter, referred to as a “highest level subtraction block”) as transmission information. In the latter case (claim 5), the divisor is converted into a two's complement format and supplied to the subtraction block, and the determination means comprises a holding means. May be determined to be subtractable if the stored content of is 1 or if carry as transmission information occurs in the uppermost subtraction block.

【0025】つまり、実際に除数による減算の対象とな
るデータは、被除数レジスタの上位nビットの格納値及
び保持手段の記憶内容からなるN+1ビットのデータで
あり、従って、保持手段の記憶内容が1であれば、Nビ
ットの除数で減算を行った結果は必ず正値となるため、
この場合には無条件に減算可能とすることができる。
That is, the data to be actually subtracted by the divisor is N + 1-bit data consisting of the stored value of the upper n bits of the dividend register and the storage contents of the holding means. , The result of subtraction with an N-bit divisor always becomes a positive value.
In this case, subtraction can be performed unconditionally.

【0026】また、最上位減算ブロックにボローが発生
していない場合、又はキャリーが発生している場合は、
ほとんどの場合は減算可能となる。但し、最上位減算ブ
ロックの伝達情報(ボロー/キャリー)は、各減算ブロ
ックの減算結果の内容によっては、伝達情報記憶手段に
記憶された伝達情報(ボロー/キャリー)を反映させる
ことによって変化する可能性がある。従って、保持手段
の記憶内容が0であり、且つ上述のように最上位減算ブ
ロックの伝達情報が変化する可能性があれば、補助演算
手段が、減算結果に伝達情報を反映させる演算を各減算
ブロックに実行させ、その結果、やはりボローが発生し
なかった場合(前者の場合)や、新たにキャリーが発生
した場合(後者の場合)に減算可能と判定すればよい。
If no borrow has occurred in the uppermost subtraction block or if a carry has occurred,
In most cases, subtraction is possible. However, the transmission information (borrow / carry) of the uppermost subtraction block can be changed by reflecting the transmission information (borrow / carry) stored in the transmission information storage means depending on the content of the subtraction result of each subtraction block. There is. Therefore, if the storage content of the holding unit is 0 and the transmission information of the uppermost subtraction block may change as described above, the auxiliary operation unit performs an operation for reflecting the transmission information on the subtraction result by each subtraction. The block may be executed, and as a result, when a borrow does not occur (the former case) or when a new carry occurs (the latter case), it may be determined that subtraction is possible.

【0027】次に、請求項6記載の乗除算回路は、Mビ
ットの積或いは被除数を格納し、格納値をビット単位で
シフトさせることが可能な第1レジスタと、N(<M)
ビットの被乗数或いは除数を格納する第2レジスタと、
Nビットの乗数或いは商を格納し、格納値をビット単位
でシフトさせることが可能な第3レジスタと、第1レジ
スタの格納値を上位側にシフトさせた時にあふれる1ビ
ットの値を保持する保持手段とを備えている。
Next, a multiplication / division circuit according to a sixth aspect of the present invention includes a first register capable of storing an M-bit product or a dividend and shifting a stored value in units of bits, and N (<M).
A second register for storing a bit multiplicand or divisor;
A third register capable of storing an N-bit multiplier or quotient and shifting the stored value in bit units, and holding a 1-bit value overflowing when the stored value of the first register is shifted upward. Means.

【0028】そして、演算手段が、供給データ選択手段
の出力と、第1レジスタの上位Nビットに格納された演
算対象データとの演算を行い、判定手段が、この演算手
段での演算結果,保持手段の記憶内容,及び動作モード
に基づいて、この演算の可否を判定し、その結果、演算
可能と判定された場合には、データ更新手段が、演算手
段での演算結果にて第1レジスタの上位Nビットを更新
する。
The operation means performs an operation on the output of the supply data selection means and the operation target data stored in the upper N bits of the first register. Based on the storage contents of the means and the operation mode, it is determined whether or not the calculation can be performed. As a result, if it is determined that the calculation is possible, the data updating means determines whether or not the calculation is possible by the data updating means. Update the upper N bits.

【0029】なお、外部から設定される動作モードが乗
算モードである場合、第2レジスタには被乗数、第3レ
ジスタには乗数が設定され、供給データ選択手段は、第
3レジスタの格納値(乗数)の最下位ビットが1であれ
ば第2レジスタの格納値(被乗数)を、最下位ビットが
0であればNビットのゼロ値を演算手段に供給すると共
に、乗算制御手段が、第1及び第3レジスタの格納値を
いずれも下位側に1ビットシフトさせて前記演算手段を
再起動する制御を、前記第3レジスタに初期設定された
格納値の最上位ビットが、該第3レジスタの最下位ビッ
トの位置に移動するまで繰り返す。
When the operation mode set from the outside is the multiplication mode, the multiplicand is set in the second register and the multiplier is set in the third register, and the supply data selection means sets the value stored in the third register (multiplier). ) Is supplied to the arithmetic means if the least significant bit is 1 and the stored value (multiplicand) of the second register is 0 if the least significant bit is 0, and the multiplication control means The control for shifting the stored value of the third register by one bit to the lower side and restarting the arithmetic means is performed by controlling the most significant bit of the stored value initialized in the third register to the most significant bit of the third register. Repeat until moving to the lower bit position.

【0030】その結果、乗数を表す各ビットに対応した
被乗数の加算が繰り返され、その加算結果により第1レ
ジスタの格納値が逐次更新されることにより、最終的に
第1レジスタに乗算結果である積が格納されることにな
る。一方、動作モードが除算モードである場合、第1レ
ジスタには被除数、第2レジスタには除数が設定され、
供給データ選択手段は、第2レジスタの格納値(除数)
を2の補数形式に変換して演算手段に供給すると共に、
除算制御手段が、第1レジスタの格納値(被除数)を上
位側に1ビットシフトさせて前記演算手段を再起動する
制御を、第2レジスタに初期設定された被除数の最下位
ビットが第1レジスタの上位Nビット中の最下位ビット
の位置に移動するまで繰り返す。
As a result, the addition of the multiplicand corresponding to each bit representing the multiplier is repeated, and the value stored in the first register is sequentially updated based on the addition result, so that the multiplication result is finally added to the first register. The product will be stored. On the other hand, when the operation mode is the division mode, the dividend is set in the first register and the divisor is set in the second register.
The supply data selection means is configured to store the value of the second register (divisor)
Into two's complement form and supply it to the arithmetic means,
The division control means shifts the stored value (dividend) of the first register by one bit to the upper side and restarts the arithmetic means, and controls the least significant bit of the dividend initially set in the second register to the first register. Is repeated until the position moves to the position of the least significant bit in the upper N bits.

【0031】その結果、被除数からの除数の減算が繰り
返され、その減算結果である中間剰余により第1レジス
タの格納値が逐次更新されることにより、最終的に第1
レジスタに除算結果である剰余が格納されることにな
る。この動作は、請求項2記載の除算回路と同様のもの
である。
As a result, the subtraction of the divisor from the dividend is repeated, and the stored value of the first register is sequentially updated by the intermediate remainder as the result of the subtraction.
The remainder resulting from the division is stored in the register. This operation is the same as that of the division circuit according to the second aspect.

【0032】特に本発明では、演算手段が、被乗数や除
数が格納される第2レジスタのデータ幅Nより小さいR
(<N)ビットのキャリー付き加算を行う複数の加算
器、及び減算器のそれぞれにて生成されるキャリーを記
憶するキャリー記憶手段からなり、加算器は、前回の演
算時にキャリー記憶手段に記憶された内容を反映した演
算を実行するようにされている。
In particular, according to the present invention, the calculating means determines that R is smaller than the data width N of the second register in which the multiplicand and the divisor are stored.
(<N) A plurality of adders for performing addition with carry of bits and carry storage means for storing the carry generated by each of the subtractors, and the adder is stored in the carry storage means at the time of the previous operation. An operation reflecting the contents is performed.

【0033】このように本発明の乗除算回路によれば、
共通の第1〜第3レジスタ及び共通の演算手段を用い、
動作モードの切替によって、乗算及び除算のいずれも可
能なように構成されているので、乗算及び除算のいずれ
もを実行する必要のある回路の規模を約半分に削減する
ことができる。
As described above, according to the multiplication / division circuit of the present invention,
Using common first to third registers and common arithmetic means,
Since the configuration is such that both multiplication and division can be performed by switching the operation mode, the scale of a circuit that needs to execute both multiplication and division can be reduced to about half.

【0034】しかも演算手段として、処理するデータの
ビット幅が第2レジスタの格納値(被乗数/除数)のビ
ット幅より小さくなるよう設定された複数の加算器を用
いて、それぞれ独立した演算(加算)を実行するように
されているので、演算によって各ブロックにて生成され
るキャリーの伝達時間、ひいては1回の演算に要する時
間が短縮される。しかも、生成された伝達情報の処理
は、新たに独立した演算を行うのではなく、次回の減算
時に一緒に処理されるため、演算の繰り返し回数を増加
させることもない。
In addition, independent arithmetic operations (additions) are performed by using a plurality of adders which are set so that the bit width of the data to be processed is smaller than the bit width of the stored value (multiplicand / divisor) of the second register. ), The transmission time of the carry generated in each block by the calculation and, consequently, the time required for one calculation are reduced. Moreover, the processing of the generated transmission information is not performed by a new independent calculation but is performed together at the next subtraction, so that the number of repetitions of the calculation does not increase.

【0035】従って、本発明によれば、動作モードによ
らず、演算手段での演算(乗算/除算)に要する処理時
間を大幅に短縮することができ、桁数の大きなデータの
剰余計算を繰り返し実行する暗号処理等に好適に用いる
ことができる。ところで、請求項6記載の乗除算回路に
おける判定手段は、請求項7記載のように、動作モード
が乗算モードであれば、常に演算可能と判定すればよ
く、一方、動作モードが除算モードであれば、先に説明
した請求項5の場合と全く同様に判定すればよい。即
ち、保持手段の記憶内容が1である場合、或いは最上位
に位置する加算器にて、キャリーが発生しているか、又
は前記補助演算手段の実行により新たにキャリーが発生
した場合に演算可能と判定すればよい。
Therefore, according to the present invention, the processing time required for the operation (multiplication / division) by the operation means can be greatly reduced irrespective of the operation mode, and the remainder calculation of data having a large number of digits can be repeated. It can be suitably used for an encryption process to be executed. By the way, the determination means in the multiplication / division circuit according to the sixth aspect should always determine that the operation can be performed if the operation mode is the multiplication mode, while the operation mode is the division mode. For example, the determination may be made in exactly the same manner as in the case of claim 5 described above. That is, when the storage content of the holding means is 1, or when the carry is generated in the highest-order adder, or when the carry is newly generated by the execution of the auxiliary calculation means, the calculation can be performed. What is necessary is just to judge.

【0036】[0036]

【発明の実施の形態】以下に本発明の実施形態を図面と
共に説明する。 [第1実施形態]図1は、周知のRAS公開鍵暗号方式
により、平文を暗号化、或いは暗号文を復号化する第1
実施形態の暗号処理モジュールの構成を表すブロック図
である。
Embodiments of the present invention will be described below with reference to the drawings. [First Embodiment] FIG. 1 shows a first embodiment in which a plaintext is encrypted or a ciphertext is decrypted by a known RAS public key cryptosystem.
It is a block diagram showing the composition of the cryptographic processing module of an embodiment.

【0037】図1に示すように、本実施形態の暗号処理
モジュール2は、Nビット(本実施形態ではN=102
4)の被乗数MX,乗数MYを入力し、(Nビット)×
(Nビット)の乗算を行ってMビット(本実施形態では
M=2048)の積MZを出力する乗算回路4と、Mビ
ットの被除数DX,及びNビットの除数DYを入力し、
(Mビット)÷(Nビット)の除算を行ってNビットの
商DS及び剰余DZを出力する除算回路6と、Nビット
の入力文(平文/暗号文)C、及び同じくNビットの秘
密鍵d,公開鍵nを入力し、乗算回路4及び除算回路6
を用いて暗号化/復号化のための演算を実行して、出力
文(暗号文/平文)Sを生成する制御回路8とを備えて
いる。
As shown in FIG. 1, the cryptographic processing module 2 of this embodiment has N bits (N = 102 in this embodiment).
4) Input the multiplicand MX and the multiplier MY in (N bits) ×
A multiplication circuit 4 that performs multiplication of (N bits) and outputs a product MZ of M bits (M = 2048 in this embodiment), a dividend DX of M bits, and a divisor DY of N bits are input.
(M bits) ÷ (N bits) division circuit 6 for outputting N-bit quotient DS and remainder DZ, N-bit input sentence (plaintext / ciphertext) C, and N-bit secret key d, the public key n, the multiplication circuit 4 and the division circuit 6
And a control circuit 8 for executing an operation for encryption / decryption using the. And generating an output text (ciphertext / plaintext) S.

【0038】このうち、制御回路8は、先の(1)式に
示した演算を、を従来技術の欄にて説明した手法を用い
て実現するものであり、その処理を、図2に示すフロー
チャートに沿って説明する。なお、制御回路8には、予
め秘密鍵d及び公開鍵nが与えられており、入力文Cの
入力によって処理が起動するものとする。
The control circuit 8 realizes the operation shown in the equation (1) by using the method described in the section of the prior art, and the processing is shown in FIG. Description will be given along a flowchart. Note that the secret key d and the public key n are given to the control circuit 8 in advance, and the processing is started by input of the input sentence C.

【0039】本処理が起動すると、まず、Mビットのレ
ジスタRmの下位Nビット(以下「レジスタRmL」とい
う)に入力文Cを格納し、カウンタiを0に初期化する
(S110)。次に、秘密鍵dのi桁目の値di(ここ
ではi=0)が1であるか否かを判断し(S120)、
di=1であれば、最終的に出力文Sが格納されるMビ
ットのレジスタRsの下位Nビット(以下「レジスタR
sL」という)に、入力文Cを格納し(S130)、一
方、di≠1であれば、レジスタRsを1に初期化する
(S140)。
When this process is started, first, the input sentence C is stored in the lower N bits (hereinafter, referred to as “register RmL”) of the M-bit register Rm, and the counter i is initialized to 0 (S110). Next, it is determined whether or not a value di (here, i = 0) of the i-th digit of the secret key d is 1 (S120),
If di = 1, the lower N bits of the M-bit register Rs (hereinafter referred to as “register R
sL ”) (S130), and if di ≠ 1, the register Rs is initialized to 1 (S140).

【0040】その後、カウンタiをインクリメントし
(S150)、カウンタiが秘密鍵dのビット数Nより
小さい(i<N)か否かを判断する(S160)。カウ
ンタiが公開鍵nのビット数Nより小さければ、被乗数
MX及び乗数MYとしてレジスタRmLの格納値を設定し
て乗算回路4を動作させ、乗算回路4から出力される積
MZを、レジスタRmに格納する(S170)。
Thereafter, the counter i is incremented (S150), and it is determined whether or not the counter i is smaller than the number N of bits of the secret key d (i <N) (S160). If the counter i is smaller than the number N of bits of the public key n, the multiplication circuit 4 is operated by setting the stored values of the register RmL as the multiplicand MX and the multiplier MY, and the product MZ output from the multiplication circuit 4 is stored in the register Rm. It is stored (S170).

【0041】引き続き、被除数DXとしてレジスタRm
の格納値、除数DYとして公開鍵nを設定して除算回路
6を動作させ、除算回路6から出力される剰余DZをレ
ジスタRmLに格納する(S180)。これらのS17
0,S180の乗算及び除算により、レジスタRmLに
は、nを法としたCの2i 乗の剰余が格納されることに
なる。
Subsequently, a register Rm is set as the dividend DX.
And the public key n is set as the divisor DY to operate the divider 6, and the remainder DZ output from the divider 6 is stored in the register RmL (S180). These S17
As a result of the multiplication and division of 0 and S180, the remainder of C 2 i raised to the modulus n is stored in the register RmL.

【0042】ここで、秘密鍵のi桁目の値diが1であ
るか否かを判断し(S190)、di≠1であれば、そ
のままS150に戻り、一方、di=1であれば、被乗
数MXとしてレジスタRmLの格納値、乗数MYとしてレ
ジスタRsLの格納値を設定して乗算回路4を動作させ、
乗算回路4から出力される積MZを、レジスタRsに格
納する(S200)。
Here, it is determined whether or not the value di of the i-th digit of the secret key is 1 (S190). If di ≠ 1, the process directly returns to S150. The multiplication circuit 4 is operated by setting the value stored in the register RmL as the multiplicand MX and the value stored in the register RsL as the multiplier MY,
The product MZ output from the multiplication circuit 4 is stored in the register Rs (S200).

【0043】引き続き、被除数DXとしてレジスタRs
の格納値、除数DYとして公開鍵nを設定して除算回路
6を動作させ、除算回路6から出力される剰余DZを、
レジスタRsLに格納した(S210)後、S150に戻
り、i<Nである間、S150〜S210の処理を繰り
返し実行する。これにより、レジスタRsLには、i桁目
までのdj=1となるCの2j 乗の剰余を全て乗じた値
のnを法とする剰余が格納されることになる。
Subsequently, as the dividend DX, the register Rs
, The public key n is set as the divisor DY, the division circuit 6 is operated, and the remainder DZ output from the division circuit 6 is
After the data is stored in the register RsL (S210), the process returns to S150, and the processes of S150 to S210 are repeatedly executed while i <N. Thus, the register RsL, so that the remainder of the n of dj = 1 and becomes all multiplied value of 2 j-th power of the remainder C until i th digit modulo is stored.

【0044】先のS160にて、カウンタiが公開鍵n
のビット数N以上となった場合には、レジスタRsLに格
納されているNビットの値を、出力文Sとして外部に出
力して(S220)、本処理を終了する。このように、
S170,S180の乗算及び除算が1023回ずつ、
S200,S210の乗算及び除算が、秘密鍵dの値が
1となる桁の数だけ繰り返されることになる。
At S160, the counter i is set to the public key n.
If the number of bits N is not less than N, the value of N bits stored in the register RsL is output to the outside as an output sentence S (S220), and this processing ends. in this way,
The multiplication and division of S170 and S180 are performed 1023 times,
The multiplication and division in S200 and S210 are repeated by the number of digits where the value of the secret key d is 1.

【0045】次に、乗算回路4及び除算回路6の詳細に
ついて説明する。まず乗算回路4は、図3に示すよう
に、被乗数MX格納用に設けられた被乗数レジスタ10
と、乗数MY格納用に設けられ、格納値をビット単位で
シフトする機能を有する乗数レジスタ11と、乗数レジ
スタ11の格納値の最下位ビット(LSB)が1であれ
ば、被乗数レジスタ10の格納値を出力し、LSBが0
であれば、ゼロ値を出力する供給データ選択回路12
と、内部に設けられた出力レジスタ(後述する)の格納
値と、供給データ選択回路12から供給されるデータを
順次加算することにより、被乗数MXと乗数MYとの積
MZを求める加算処理部13と、乗数レジスタ11およ
び加算処理部13の動作タイミングを制御するタイミン
グ制御部14とを備えている。
Next, details of the multiplication circuit 4 and the division circuit 6 will be described. First, as shown in FIG. 3, the multiplication circuit 4 includes a multiplicand register 10 provided for storing a multiplicand MX.
And a multiplier register 11 provided for storing the multiplier MY and having a function of shifting the stored value in bit units. If the least significant bit (LSB) of the stored value of the multiplier register 11 is 1, the storage of the multiplicand register 10 is performed. Output value and LSB is 0
If so, the supply data selection circuit 12 that outputs a zero value
And a value stored in an output register (to be described later) provided therein and data supplied from the supply data selection circuit 12 are sequentially added to obtain a product MZ of the multiplicand MX and the multiplier MY. And a timing control unit 14 for controlling operation timings of the multiplier register 11 and the addition processing unit 13.

【0046】ここで、加算処理部13は、図4(a)に
示すように、供給データ選択回路12を介して供給され
る1024ビットのデータDIを32等分した32ビッ
ト幅の分割データDI0〜DI31に対して、それぞれ
が加算処理を行うよう並列接続された32個の加算ブロ
ックMB0〜MB31と、加算ブロックMB0〜MB3
1にて算出される積の下位1024ビットを格納するた
めの結果レジスタ15とを備えている。
Here, as shown in FIG. 4A, the addition processing unit 13 divides the 1024-bit data DI supplied through the supply data selection circuit 12 into 32 equal parts, and generates 32-bit width divided data DI0. To DI31, 32 addition blocks MB0 to MB31 connected in parallel to perform addition processing, and addition blocks MB0 to MB3.
And a result register 15 for storing the lower 1024 bits of the product calculated in 1.

【0047】なお、加算ブロックMBiは、図4(b)
に示すように、32ビットの二つの入力データ間のキャ
リー付き加算を行う算術演算ユニット(ALU)16
と、ALU16にて生成される2ビットのキャリーを記
憶するキャリー用レジスタ17と、ALU16での演算
結果を記憶する32ビット幅の出力レジスタ18とを備
え、ALU16は、供給データ選択回路12からの分割
データDIiと出力レジスタ18の格納値DOiとを入
力データとするように構成されている。
The addition block MBi is shown in FIG.
As shown in the figure, an arithmetic operation unit (ALU) 16 for performing addition with carry between two input data of 32 bits.
A carry register 17 for storing a 2-bit carry generated by the ALU 16, and a 32-bit width output register 18 for storing the operation result of the ALU 16. The divided data DIi and the value DOi stored in the output register 18 are used as input data.

【0048】また、キャリー用レジスタ17に格納され
たALU16の出力キャリーのうち、上位ビットは上位
の加算ブロックMBi+1 に供給され、下位ビットは、下
位の加算ブロックMBi-1 から供給されるキャリーと共
に、加算ブロックMBi内のALU16への入力キャリ
ーとなるように構成されている。但し、ALU16で
は、下位の加算ブロックMBi-1 からの入力キャリーを
最下位ビットに加算し、同一加算ブロックMBiからの
入力キャリーを最上位ビットに加算するように構成され
ている。
In the output carry of ALU 16 stored in carry register 17, the upper bit is supplied to upper adder block MBi + 1 and the lower bit is the carry supplied from lower adder block MBi-1. At the same time, it is configured to be an input carry to the ALU 16 in the addition block MBi. However, the ALU 16 is configured to add the input carry from the lower addition block MBi-1 to the least significant bit and add the input carry from the same addition block MBi to the most significant bit.

【0049】更に、出力レジスタ18は、格納値をビッ
ト単位で下位側にシフトする機能を有しており、シフト
動作によってあふれた最下位ビットが、下位の加算ブロ
ックMBi-1 の出力レジスタ18の最上位ビットとして
入力され、また、最下位の加算ブロックMB0の出力レ
ジスタ18からあふれた最下位ビットは、結果レジスタ
15の最上位ビットとして入力されるように連結されて
いる。但し、最上位の加算ブロックMB31では、シフ
ト動作時に最上位ビットに0を入力するようにされてい
る。
Further, the output register 18 has a function of shifting the stored value to the lower side in bit units, and the least significant bit overflowed by the shift operation is stored in the output register 18 of the lower addition block MBi-1. The least significant bit that is input as the most significant bit and overflows from the output register 18 of the least significant addition block MB0 is connected so as to be input as the most significant bit of the result register 15. However, in the most significant addition block MB31, 0 is input to the most significant bit during the shift operation.

【0050】そして、タイミング制御部14は、ALU
16にて演算が実行される毎に、乗算レジスタ11,各
加算ブロックMB0〜MB31の出力レジスタ18,及
び結果レジスタ15の格納値を、それぞれ下位側に1ビ
ットシフトさせる処理をN回繰り返し、乗数レジスタ1
1に格納された全てのビットがシフト動作によって出力
されると、最後に、分割データDI0〜DI31をいず
れもゼロとして、出力レジスタ18の格納値とキャリー
用レジスタ17の格納値との加算を行って、乗算処理を
終了する。
Then, the timing control section 14
Each time the operation is performed at step 16, the process of shifting the values stored in the multiplication register 11, the output register 18 of each of the addition blocks MB0 to MB31, and the result register 15 by 1 bit to the lower side is repeated N times, and the multiplier Register 1
When all the bits stored in 1 are output by the shift operation, finally, the divided data DI0 to DI31 are all set to zero, and the value stored in the output register 18 and the value stored in the carry register 17 are added. Then, the multiplication process ends.

【0051】このとき、乗算結果である積MZのうち、
上位1024ビットは、各加算ブロックMB0〜MB3
1の出力レジスタ18に、下位1024ビットは、結果
レジスタ15に格納されている。これら各出力レジスタ
18及び結果レジスタ15を総称して積レジスタともい
う。
At this time, of the product MZ which is the multiplication result,
The upper 1024 bits correspond to each of the addition blocks MB0 to MB3.
The lower 1024 bits are stored in the result register 15 in the 1 output register 18. These output registers 18 and result registers 15 are also collectively referred to as product registers.

【0052】ここで、乗算処理の様子を図5に示す説明
図を用いて具体的に説明する。但し、説明を簡単にする
ため、被乗数MX(1101110111011101)及び乗数MY
(1000110011101111)のデータ幅が16ビット、各加算
ブロックMBが処理するデータ幅が4ビットであるもの
とする。
Here, the state of the multiplication process will be specifically described with reference to the explanatory diagram shown in FIG. However, in order to simplify the explanation, the multiplicand MX (1101110111011101) and the multiplier MY
It is assumed that the data width of (1000110011101111) is 16 bits and the data width processed by each addition block MB is 4 bits.

【0053】図5に示すように、各加算ブロックMBi
において、出力レジスタ18の4ビットの格納値DO
i、及び2ビットのキャリー(但し、最上位の加算ブロ
ックのみ1ビット)は、いずれも0に設定されている。
このため、乗数MYの最下位ビットが1である場合、1
回目演算では、被乗数MXがそのまま出力レジスタ18
に格納される。当然、キャリーは発生しないため、キャ
リー用レジスタ17の格納値はいずれもゼロとなる。
As shown in FIG. 5, each addition block MBi
, The 4-bit stored value DO of the output register 18
The carry of i and the 2-bit carry (however, only the highest-order addition block has 1 bit) are both set to 0.
Therefore, if the least significant bit of the multiplier MY is 1, 1
In the third calculation, the multiplicand MX is output to the output register 18 as it is.
Is stored in As a matter of course, no carry occurs, so the values stored in the carry register 17 are all zero.

【0054】その後、各出力レジスタ18の格納値DO
iが下位側に1ビットシフトされ、最下位に位置する加
算ブロックMB0の出力レジスタ18のLSB(ここで
は1)が、結果レジスタ15に格納されると共に、乗数
レジスタ11の格納値が下位側に1ビットシフトされ
る。
Thereafter, the stored value DO of each output register 18 is obtained.
i is shifted by one bit to the lower side, the LSB (here, 1) of the output register 18 of the addition block MB0 located at the lowest order is stored in the result register 15, and the stored value of the multiplier register 11 is shifted to the lower side. It is shifted one bit.

【0055】以下、同様に、乗数レジスタ11のLSB
が1であれば被乗数(図中の2〜4回目演算を参照)
を、LSBが0であればゼロ値(図中の5回目演算を参
照)を入力データDIとして、この入力データDIと、
出力レジスタ18の格納値DO,キャリー用レジスタ1
7の格納値との加算、及び出力レジスタ18,結果レジ
スタ15,乗数レジスタ11のシフトが繰り返し実行さ
れる。最後に、出力レジスタ18の格納値DOと、キャ
リー用レジスタ17の格納値のみの加算(図示せず)を
行うことで、出力レジスタ18及び結果レジスタ15内
に、積MZが格納されることになる。
Hereinafter, similarly, the LSB of the multiplier register 11
If multiplied by 1, the multiplicand (see the second to fourth calculations in the figure)
If the LSB is 0, a zero value (see the fifth calculation in the figure) is used as the input data DI, and the input data DI
Stored value DO of output register 18, register 1 for carry
7 and the shift of the output register 18, the result register 15, and the multiplier register 11 are repeatedly executed. Finally, by adding (not shown) only the stored value DO of the output register 18 and the stored value of the carry register 17, the product MZ is stored in the output register 18 and the result register 15. Become.

【0056】次に、除算回路6は、図6に示すように、
除数DY格納用に設けられた除数レジスタ20と、除数
レジスタ20の格納値を2の補数形式に変換して出力す
る補数変換回路21と、被除数DX格納用の被除数レジ
スタ(後述する)を有し、被除数レジスタの格納値と補
数変換回路21の出力との演算により、被除数DXを除
数DYにて除算した除算結果を求める減算手段としての
減算処理部22と、減算処理部22からの商出力DSB
を格納するための商レジスタ23と、減算処理部22及
び商レジスタ23の動作タイミングを制御するタイミン
グ制御部24とを備えている。
Next, as shown in FIG. 6, the dividing circuit 6
It has a divisor register 20 provided for storing the divisor DY, a complement conversion circuit 21 for converting the value stored in the divisor register 20 into a two's complement format and outputting the result, and a dividend register (described later) for storing the dividend DX. , A subtraction processing section 22 as a subtraction means for obtaining a division result of dividing the dividend DX by the divisor DY by an operation of the stored value of the dividend register and the output of the complement conversion circuit 21, and a quotient output DSB from the subtraction processing section 22
And a timing control unit 24 that controls the operation timing of the subtraction processing unit 22 and the quotient register 23.

【0057】ここで、減算処理部22は、図7(a)に
示すように、補数変換回路21を介して供給される2の
補数形式に変換された除数、或いは被除数DXの上位1
024ビットのいずれかを選択して出力する入力データ
選択回路26と、入力データ選択回路26にて選択され
た1024ビットの入力データDIを32等分した32
ビット幅の分割データDI0〜DI31に対応して、そ
れぞれが減算処理を行うよう並列接続された32個の減
算ブロックDB0〜DB31と、被除数DXの下位10
24ビットを格納するために設けられ、格納値を上位側
にビット単位でシフトさせる機能を有する下位被除数レ
ジスタ25と、後述するシフト動作により最上位の減算
ブロックDB31からあふれた最上位ビットを格納する
保持手段としての最上位レジスタ27と、最上位レジス
タ27の格納値,及び最上位の減算ブロックDB31か
らの伝達信号(本実施形態ではキャリー)のうち少なく
ともいずれか一方が1である場合に1となる商出力DS
Bとして生成する論理和回路28と、タイミング制御部
24からのタイミング信号,論理和回路28からの商出
力DSB,及び各減算ブロックDBiから供給される各
種データに基づいて、減算処理部22内の各部の動作を
制御する演算実行制御部29とを備えている。
Here, as shown in FIG. 7 (a), the subtraction unit 22 converts the divisor or the dividend DX supplied to the two's complement format supplied through the complement conversion circuit 21 into the highest one.
An input data selection circuit 26 for selecting and outputting any of the 024 bits, and a 1024-bit input data DI selected by the input data selection circuit 26 divided into 32 equal parts,
Corresponding to the bit width divided data DI0 to DI31, 32 subtraction blocks DB0 to DB31 each connected in parallel so as to perform subtraction processing, and the lower 10 of the dividend DX
A lower dividend register 25 provided for storing 24 bits and having a function of shifting the stored value to the upper side in bit units, and stores the most significant bit overflowing from the most significant subtraction block DB31 by a shift operation described later. When at least one of the highest-order register 27 as a holding unit, the value stored in the highest-order register 27, and the transfer signal (carry in this embodiment) from the highest-order subtraction block DB31 is 1, 1 is set. Naru quotient output DS
Based on the OR circuit 28 generated as B, the timing signal from the timing controller 24, the quotient output DSB from the OR circuit 28, and various data supplied from each subtraction block DBi, A calculation execution control unit 29 for controlling the operation of each unit.

【0058】なお、減算ブロックDBiは、図7(b)
に示すように、32ビットの二つの入力データ間のキャ
リー付き加算を行う算術演算ユニット(ALU)30
と、ALU30にて生成される1ビットのキャリーを記
憶する伝達情報記憶手段としてのキャリー用レジスタ3
1と、ALU30での演算結果を記憶する32ビット幅
の出力レジスタ32と、ALU30の出力DAi及び出
力レジスタ32の格納値DOiのいずれかを、ALU3
0の入力として選択する加算データ選択回路33とを備
えている。
The subtraction block DBi is shown in FIG.
As shown in the figure, an arithmetic operation unit (ALU) 30 for performing addition with carry between two input data of 32 bits.
And carry register 3 as transmission information storage means for storing 1-bit carry generated by ALU 30
1, an output register 32 having a width of 32 bits for storing the operation result of the ALU 30, and one of the output DAi of the ALU 30 and the stored value DOi of the output register 32.
And an addition data selection circuit 33 for selecting as an input of 0.

【0059】つまり、減算ブロックDBiでは、除数に
よる減算を、2の補数形式で表された除数を加算するこ
とで実行するようにされている。そして、ALU30
は、入力データ選択回路26からの分割データDIiと
加算データ選択回路33が選択したデータとの加算を実
行し、ALU30の出力DAi及び出力キャリーCi
を、演算実行制御部29に供給するように構成されてい
る。
That is, in the subtraction block DBi, the subtraction by the divisor is performed by adding the divisor expressed in a two's complement format. And ALU30
Performs addition of the divided data DIi from the input data selection circuit 26 and the data selected by the addition data selection circuit 33, and outputs the output DAi and the output carry Ci of the ALU 30.
Is supplied to the arithmetic execution control unit 29.

【0060】また、キャリー用レジスタ31に格納され
たキャリーCiは、上位の減算ブロックDBi+1 に供給
され、下位の減算ブロックDBi-1 から供給されるキャ
リーCi-1 がALU30への入力キャリーとなるように
接続されている。但し、ALU30では、入力キャリー
を、最下位ビットではなく、下位から2ビット目に加算
するように構成されている。
The carry Ci stored in the carry register 31 is supplied to the upper subtraction block DBi + 1, and the carry Ci-1 supplied from the lower subtraction block DBi-1 is used as the input carry to the ALU 30. It is connected to become. However, the ALU 30 is configured to add the input carry not to the least significant bit but to the second least significant bit.

【0061】更に、各減算ブロックDB0〜DB31の
出力レジスタ18、及び下位被除数レジスタ25は、格
納値をビット単位で上位側にシフトする機能を有してお
り、シフト動作によってあふれた最上位ビットが、上位
の減算ブロックDBi+1 の出力レジスタ32の最下位ビ
ットとして入力されるように連結されている。但し、最
上位の減算ブロックDB31の出力レジスタ32からあ
ふれた最上位ビットは、図7(a)に示すように、最上
位レジスタ27に格納されるように構成されている。
Further, the output register 18 and the lower dividend register 25 of each of the subtraction blocks DB0 to DB31 have a function of shifting the stored value to the upper side in bit units. , Are connected so as to be input as the least significant bit of the output register 32 of the upper subtraction block DBi + 1. However, the most significant bit overflowing from the output register 32 of the most significant subtraction block DB31 is configured to be stored in the most significant register 27 as shown in FIG.

【0062】そして、タイミング制御部24では、下位
被除数レジスタ25,及び各減算ブロックDB0〜MB
31の出力レジスタ32をシフトさせるタイミングを生
成する。また、演算実行制御部29では、減算処理部2
2が動作を開始するに当たり、各減算ブロックDB0〜
DB31の出力レジスタ32,及びキャリー用レジスタ
31の格納値をゼロクリアした後、各減算ブロックDB
0〜DB31の出力レジスタ32,及び下位被除数レジ
スタ25に、被除数DXを設定する初期化処理を実行す
る。この初期化処理では、入力データ選択回路26を、
被除数DXの上位1024ビットを入力データDIとし
て出力する設定とすると共に、減算ブロックDBi内の
加算データ選択回路33を、出力レジスタ32の格納値
DOi(即ちここではゼロ値)がALU30に供給され
る設定として、ALU30に演算を実行させることによ
り、被除数DXの上位1024ビットにゼロを加算した
結果(即ち被除数DXの上位1024ビットそのもの)
が出力レジスタ32に格納され、これと同時に、被除数
DXの下位1024ビットが下位被除数レジスタ25に
格納される。これら出力レジスタ32及び下位被除数レ
ジスタ25を総称して被除数レジスタともいう。
Then, the timing controller 24 controls the lower dividend register 25 and each of the subtraction blocks DB0 to MB
The timing for shifting the output register 32 is generated. In addition, in the arithmetic execution control unit 29, the subtraction processing unit 2
2 starts operation, each of the subtraction blocks DB0 to DB0
After clearing the values stored in the output register 32 of the DB 31 and the carry register 31 to zero, each subtraction block DB
An initialization process for setting the dividend DX in the output register 32 of 0 to DB31 and the lower dividend register 25 is performed. In this initialization process, the input data selection circuit 26
The upper 1024 bits of the dividend DX are set to be output as the input data DI, and the addition data selection circuit 33 in the subtraction block DBi is supplied to the ALU 30 with the value DOi stored in the output register 32 (that is, the zero value here). As a setting, a result of adding zero to the upper 1024 bits of the dividend DX by causing the ALU 30 to execute an operation (that is, the higher 1024 bits of the dividend DX itself)
Is stored in the output register 32, and at the same time, the lower 1024 bits of the dividend DX are stored in the lower dividend register 25. The output register 32 and the lower dividend register 25 are collectively referred to as a dividend register.

【0063】この初期化処理の後、演算実行制御部29
では、入力データ選択回路26を、除数DYを2の補数
形式に変換したデータを入力データDIとして出力する
設定とし、ALU30にて演算が実行される毎に、最上
位レジスタ27の格納値、上位ブロックALU30での
演算結果DAi,及びキャリーCiに基づいて、演算結
果DAiとキャリーCi-1 との演算(以下「キャリー演
算」という)の要否を判定する(判定手段に相当)。そ
して、キャリー演算が必要であれば、加算データ選択回
路33を、ALU30の演算結果DAiをALU30に
供給する設定として、ALU30にて、DAiに下位の
減算ブロックDBi-1 からのキャリーCi-1 を加算する
処理を実行し、その演算結果DAi,及びキャリーCi
に基づいて、再度、キャリー演算の要否を判定する。
After this initialization processing, the operation execution control unit 29
Then, the input data selection circuit 26 is set to output the data obtained by converting the divisor DY into the two's complement format as the input data DI, and every time the ALU 30 performs an operation, the stored value of the uppermost register 27, Based on the operation result DAi and the carry Ci in the block ALU30, it is determined whether or not the operation of the operation result DAi and the carry Ci-1 (hereinafter referred to as "carry operation") is necessary (corresponding to a determination unit). If a carry operation is necessary, the addition data selection circuit 33 is set to supply the operation result DAi of the ALU 30 to the ALU 30. The ALU 30 stores the carry Ci-1 from the lower subtraction block DBi-1 in the DAi. Addition processing is performed, and the operation result DAi and carry Ci
, It is determined again whether the carry calculation is necessary.

【0064】一方、キャリー演算を必要としない場合に
は、ALU30の演算結果DAiを出力レジスタ32に
格納(データ更新手段に相当)した後、出力レジスタ3
2及び下位被除数レジスタ25の格納値を、それぞれ上
位側に1ビットシフトさせると共に、商出力DSBを商
レジスタに記憶させる。更に、加算データ選択回路33
を、出力レジスタ32の格納値DOiをALU30に供
給する設定として、同様の処理を繰り返し実行させる
(再起制御手段に相当)。
On the other hand, when the carry operation is not required, the operation result DAi of ALU 30 is stored in output register 32 (corresponding to data updating means), and then output register 3
The values stored in the 2 and lower dividend registers 25 are each shifted upward by one bit, and the quotient output DSB is stored in the quotient register. Further, the addition data selection circuit 33
Is set to supply the stored value DOi of the output register 32 to the ALU 30 and a similar process is repeatedly executed (corresponding to a restart control unit).

【0065】これを、下位被除数レジスタ25の初期格
納値が、1024回のシフト動作によってすべて最下位
の減算ブロックDB0に入力されるまで繰り返し、最後
に、キャリー演算を行って除算処理を終了する。この
時、除算結果として、商DSは商レジスタ23に、剰余
DZは各減算ブロックDB0〜DB31の出力レジスタ
32に格納されている。
This operation is repeated until the initial storage value of the lower dividend register 25 is input to the lowermost subtraction block DB0 by 1024 shift operations, and finally, the carry operation is performed and the division processing ends. At this time, as a result of the division, the quotient DS is stored in the quotient register 23, and the remainder DZ is stored in the output register 32 of each of the subtraction blocks DB0 to DB31.

【0066】ここで、演算実行制御部29が、キャリー
演算の要否を判定する方法について、図8に示すフロー
チャートに沿って説明する。まず、論理和回路28が生
成する商出力DSBが1であるか否か、即ち最上位レジ
スタ27の格納値が1であるか、又は最上位の減算ブロ
ックDB31にてキャリーC31が生成されたか否かを
判定し(S310)、DSB≠1であれば、他の減算ブ
ロックDB0〜DB30のいずれかにてキャリーCiが
生成されているか否かを判断する(S320)。
Here, a method in which the calculation execution control unit 29 determines whether or not the carry calculation is necessary will be described with reference to the flowchart shown in FIG. First, whether the quotient output DSB generated by the OR circuit 28 is 1, that is, whether the value stored in the uppermost register 27 is 1 or whether the carry C31 is generated in the uppermost subtraction block DB31 (S310), and if DSB ≠ 1, it is determined whether or not carry Ci has been generated in any of the other subtraction blocks DB0 to DB30 (S320).

【0067】そして、DSB=1であるか、或いはいず
れの減算ブロックDBiでもキャリーCiが生成されて
いなければ、キャリー演算は不要であるものとして本処
理を終了する。一方、減算ブロックDBi(i=0〜3
0)のいずれかにてキャリーCiが生成されている場
合、i=31として(S330)、減算ブロックDBi
からの演算結果DAiが1023、即ち全てのビットが
1であるか否かを判断し(S340)、DAi=102
3であれば、下位の減算ブロックDBi-1 にてキャリー
Ci-1 が生成されているか否かを判断する(S35
0)。
Then, if DSB = 1 or if no carry Ci has been generated in any of the subtraction blocks DBi, it is determined that the carry operation is unnecessary, and this processing ends. On the other hand, the subtraction block DBi (i = 0-3)
0), the carry Ci is generated, i = 31 (S330), and the subtraction block DBi
It is determined whether or not the operation result DAi is 1023, that is, whether all the bits are 1 (S340), and DAi = 102
If it is 3, it is determined whether the carry Ci-1 is generated in the lower subtraction block DBi-1 (S35).
0).

【0068】キャリーCi-1 が生成されていなければ、
iをデクリメントして(S360)、S340に戻り、
S340〜S360の処理を繰り返す。そして、S35
0にてキャリーCi-1 が生成されていると判定された場
合、即ち、減算ブロックDBi-1 より上位に位置する減
算ブロックDBj(j=i〜31)での演算結果DAj
が、いずれも1023(オール1)であり、キャリーC
i-1 を加算することにより、最上位に位置する減算ブロ
ックDB31にてキャリーが生成され、その結果、商出
力DSBが0から1に変化してしまう場合には、ALU
30の演算結果DAiの出力レジスタ32への格納,出
力レジスタ32や下位被除数レジスタ25のシフト動
作,商レジスタ23への商出力DSBの格納を禁止し、
キャリー演算を実行する設定にして(S370)、本処
理を終了する。
If carry Ci-1 has not been generated,
i is decremented (S360), and the process returns to S340.
The processing of S340 to S360 is repeated. And S35
0, it is determined that the carry Ci-1 has been generated, that is, the operation result DAj in the subtraction block DBj (j = i to 31) located higher than the subtraction block DBi-1.
Are 1023 (all 1) and carry C
If the carry is generated in the uppermost subtraction block DB31 by adding i-1 and the quotient output DSB changes from 0 to 1, the ALU
30, the operation result DAi stored in the output register 32, the shift operation of the output register 32 and the lower dividend register 25, and the storage of the quotient output DSB in the quotient register 23 are prohibited.
The setting is made to execute the carry operation (S370), and the present process ends.

【0069】また、キャリーCi-1 が生成されている減
算ブロックDBi-1 より上位に位置する減算ブロックD
Bj(j=i〜31)での演算結果DAjが、いずれか
一つでも1023より小さいものがある場合(S340
−NO)は、キャリー演算を実行したとしても、商出力
DSBの値が変化することはないため、キャリー演算を
実行することなく、そのまま本処理を終了する。
Further, the subtraction block D located higher than the subtraction block DBi-1 in which the carry Ci-1 is generated.
When any one of the calculation results DAj in Bj (j = i to 31) is smaller than 1023 (S340)
-NO), the value of the quotient output DSB does not change even if the carry operation is executed, and thus the present process is terminated without executing the carry operation.

【0070】なお、ここでは、キャリー演算の要否を判
定する方法を、フローチャートを用いて説明したが、実
際には、例えば図9に示すような論理回路の組合せによ
って、判定結果を高速に得ることができる。ここで、除
算処理の様子を、図10に示す説明図を用いて具体的に
説明する。但し、説明を簡単にするため、被除数DX
(1010101010101010)のデータ幅が16ビット、除数D
Y(10011000)のデータ幅が8ビット、各加算ブロック
DB0〜DB31が処理するデータ幅が4ビットである
ものとする。
Here, the method of determining whether or not the carry operation is necessary has been described with reference to a flowchart. However, in practice, the determination result is obtained at high speed by, for example, a combination of logic circuits as shown in FIG. be able to. Here, the state of the division process will be specifically described with reference to the explanatory diagram shown in FIG. However, in order to simplify the explanation, the dividend DX
(1010101010101010) has a data width of 16 bits and a divisor D
It is assumed that the data width of Y (10011000) is 8 bits and the data width processed by each of the addition blocks DB0 to DB31 is 4 bits.

【0071】また、除数DYを、2の補数形式に変換さ
れた値(01100111)が入力データDIとして使用され、
各減算ブロックDB0〜DB31の出力レジスタ32に
は、DOの初期値として被除数DXの上位8ビット(10
101010)が格納され、最上位レジスタ27及び各減算ブ
ロックDB0〜DB31のキャリー用レジスタ31の格
納値は、ゼロクリアされているものとする。
A value (01100111) obtained by converting the divisor DY into a two's complement format is used as input data DI.
The output register 32 of each of the subtraction blocks DB0 to DB31 stores the upper 8 bits (10
101010) is stored, and the values stored in the uppermost register 27 and the carry register 31 of each of the subtraction blocks DB0 to DB31 are cleared to zero.

【0072】図10に示すように、1回目演算では、最
上位の減算ブロックにてキャリーが発生し、商出力DS
Bが減算可能であることを示す1となっているため、A
LU30での演算結果DAにより、出力レジスタ32の
格納値DOが更新され、更新後の格納値DOが、上位側
に1ビットシフトされる。この時、DOの最上位ビット
は0であるため、最上位レジスタ27には0が格納さ
れ、また、最下位の減算ブロックの出力レジスタ32の
最下位ビットには、下位被除数レジスタ25の最上位ビ
ットの値(ここでは1)が入力されることになる。
As shown in FIG. 10, in the first operation, a carry occurs in the uppermost subtraction block, and the quotient output DS
Since B is 1 indicating that subtraction is possible, A
The stored value DO of the output register 32 is updated by the operation result DA in the LU 30, and the updated stored value DO is shifted by one bit to the upper side. At this time, since the most significant bit of DO is 0, 0 is stored in the most significant register 27, and the least significant bit of the output register 32 of the least significant subtraction block is the most significant bit of the least significant dividend register 25. A bit value (1 in this case) will be input.

【0073】2回目演算では、最上位ブロックにてキャ
リーが発生せず、しかも最上位レジスタ27の格納値は
0であるため、商出力DSBが減算不能であることを示
す0となっており、キャリー演算を必要とする結果にも
なっていないため、演算結果DAによる出力レジスタ3
2の更新は行われず、出力レジスタ32の格納値DOの
シフトのみが行われる。
In the second operation, no carry occurs in the uppermost block, and the value stored in the uppermost register 27 is 0. Therefore, the quotient output DSB is set to 0 indicating that the subtraction cannot be performed. Since the result does not require a carry operation, the output register 3 based on the operation result DA
2 is not updated, and only the shift of the stored value DO of the output register 32 is performed.

【0074】3回目及び4回目演算では、2回目と同様
の処理が行われる。但し、4回目演算では、出力レジス
タ32の格納値DOの最上位ビットが1であるため、こ
の格納値DOをシフトした際に、最上位レジスタ27に
1が格納される。このため、5回目演算では、最上位ブ
ロックにてキャリーが発生しないものの、最上位レジス
タ27の値が1であることにより、商出力DSBが1と
なり、1回目演算の時と同様に、ALU30での演算結
果DAによる出力レジスタ32の格納値DOの更新、及
び更新後の格納値DOのシフトが行われる。
In the third and fourth calculations, the same processing as in the second calculation is performed. However, in the fourth operation, since the most significant bit of the stored value DO of the output register 32 is 1, when this stored value DO is shifted, 1 is stored in the most significant register 27. Therefore, in the fifth operation, although no carry occurs in the uppermost block, the value of the uppermost register 27 is 1, so that the quotient output DSB becomes 1, and the ALU 30 performs the same operation as in the first operation. , The stored value DO of the output register 32 is updated based on the calculation result DA, and the updated stored value DO is shifted.

【0075】以下、同様に、商出力DSBの値に応じた
処理が繰り返され、下位被除数レジスタ25の最下位ビ
ットが、最下位に位置する減算ブロックの出力レジスタ
32に入力された9回目演算が終了すると、最後に、キ
ャリー用レジスタ31の内容を、出力レジスタ32の格
納値DOに反映させるための10回目演算(キャリー演
算)を実行することで、商レジスタ23には商DSが、
各減算ブロックの出力レジスタ32には、剰余DZが格
納されていることになる。
Thereafter, similarly, the processing according to the value of the quotient output DSB is repeated, and the ninth operation in which the least significant bit of the lower dividend register 25 is input to the output register 32 of the subtraction block located at the lowest order is performed. When the processing is completed, finally, the quotient register 23 stores the quotient DS by executing the tenth operation (carry operation) for reflecting the contents of the carry register 31 to the stored value DO of the output register 32.
The remainder DZ is stored in the output register 32 of each subtraction block.

【0076】なお、図10には示されていないが、例え
ば、出力レジスタ32の格納値DO及びキャリー用レジ
スタ31の格納値と入力データDIとの加算の結果、商
出力DSBが0であるが、最上位に位置する減算ブロッ
クのALU30での演算結果DAがオール1(ここでは
15)となり、且つ隣接する下位の減算ブロックにてキ
ャリーが生成されている場合には、演算結果DAにキャ
リーを反映させるキャリー演算が挿入され、その演算に
より得られた結果が、商出力DSBの値や、出力レジス
タ32を更新する際の値として用いられる。
Although not shown in FIG. 10, for example, the quotient output DSB is 0 as a result of adding the storage value DO of the output register 32 and the storage value of the carry register 31 to the input data DI. If the arithmetic result DA of the ALU 30 of the uppermost subtraction block is all 1 (here, 15) and a carry is generated in an adjacent lower subtraction block, the carry is added to the arithmetic result DA. A carry operation to be reflected is inserted, and a result obtained by the operation is used as a value of the quotient output DSB or a value when updating the output register 32.

【0077】以上説明したように、本実施形態の暗号処
理モジュール2において、乗算回路4では、被乗数の加
算を繰り返し実行する加算処理部13を、除算回路6で
は、被除数から除数の減算を繰り返し実行する減算処理
部22を、加減算の対象となるデータを複数に分割して
並列処理する複数の加算ブロックMBi、及び減算ブロ
ックDBiにより構成し、加算或いは減算時に、各ブロ
ックMBi,DBiにて生成される上位ブロックへの伝
達情報であるキャリーを、次回の加算或いは減算時に処
理するようにされている。
As described above, in the cryptographic processing module 2 of this embodiment, the multiplying circuit 4 repeatedly performs the addition of the multiplicand, and the division circuit 6 repeatedly performs the subtraction of the divisor from the dividend. The subtraction processing unit 22 is composed of a plurality of addition blocks MBi and a subtraction block DBi that divide data to be added / subtracted into a plurality of pieces and perform parallel processing, and are generated by the blocks MBi and DBi at the time of addition or subtraction. The carry, which is information transmitted to the upper block, is processed at the time of the next addition or subtraction.

【0078】つまり、各ブロックMBi,DBiでは、
ビット幅の小さいデータを、それぞれ独立に処理するよ
うにされているので、各ブロック内で生成される伝達情
報(キャリー)の伝達時間、ひいては1回の演算(加算
或いは減算)に要する時間が短縮され、しかも、生成さ
れた伝達情報の処理は、新たに独立した演算を行うので
はなく、次回の演算時に一括して処理されるため、演算
の繰り返し回数を増加させることもない。
That is, in each block MBi, DBi,
Since the data having a small bit width is processed independently, the transmission time of the transmission information (carry) generated in each block and the time required for one operation (addition or subtraction) are reduced. In addition, the processing of the generated transmission information is not performed by a new independent calculation but is performed collectively at the next calculation, so that the number of repetitions of the calculation is not increased.

【0079】従って、本実施形態の暗号処理モジュール
2によれば、乗算及び除算に要する処理時間を大幅に短
縮することができ、暗号化或いは復号化処理を、短時間
にて実行することができる。なお、本実施形態では、除
算回路6に商レジスタ23を設けているが、剰余DZの
みを使用し、商DSを必要としない場合には、この商レ
ジスタ23を省略してもよい。
Therefore, according to the encryption processing module 2 of the present embodiment, the processing time required for multiplication and division can be greatly reduced, and the encryption or decryption processing can be executed in a short time. . In the present embodiment, the division circuit 6 is provided with the quotient register 23. However, when only the remainder DZ is used and the quotient DS is not required, the quotient register 23 may be omitted.

【0080】また、本実施形態では、除算回路6におい
て減算ブロックDBiを、キャリー付き加算を実行する
ALU30にて構成したが、ボロー付き減算を実行する
ALUにより構成してもよい。この場合、補数変換回路
21を省略すると共に、論理和回路28の代わりに、最
上位レジスタ27の格納値が1であるか、最上位に位置
する減算ブロックDB31にてボローが発生していない
場合に、商出力DSBを1とする論理回路を設ける必要
がある。また、演算実行制御部29では、ボローを反映
させることにより、商出力DSBが変化する可能性があ
る場合に、具体的には、減算ブロックDBi-1 にてボロ
ーが発生しており、且つ、この減算ブロックDBi-1 よ
り上位に位置するすべての減算ブロックDBj(j=i
〜31)での演算結果DAjが、いずれも0である場合
に、キャリー演算を実行するようにすればい。
Further, in the present embodiment, the subtraction block DBi in the division circuit 6 is constituted by the ALU 30 executing the addition with carry, but may be constituted by the ALU executing the subtraction with borrow. In this case, the complement conversion circuit 21 is omitted, and the value stored in the highest-order register 27 is 1 instead of the OR circuit 28, or no borrow occurs in the highest-order subtraction block DB31. It is necessary to provide a logic circuit for setting the quotient output DSB to 1. When the quotient output DSB is likely to change by reflecting the borrow, the calculation execution control unit 29 specifically generates a borrow in the subtraction block DBi-1, and All the subtraction blocks DBj (j = i
The carry operation may be executed when the operation results DAj in the steps 31 to 31) are all 0.

【0081】この場合、除算処理の経過は、図11に示
すようなものとなり、キャリー付き加算を実行するAL
Uを用いた場合と比較して(図10参照)、演算の途中
における出力レジスタ32の格納値DOは互いに異なっ
たものとなるが、最終的には、同じ演算結果(商DS,
剰余DZ)が得られる。
In this case, the progress of the division process is as shown in FIG.
Compared with the case where U is used (see FIG. 10), the stored values DO of the output register 32 during the operation are different from each other, but finally, the same operation result (quotient DS,
The remainder DZ) is obtained.

【0082】また、本実施形態では、除算回路4におい
て、キャリー演算の要否を判定する際に、最上位に位置
する減算ブロックDB31のキャリーが、0から1に確
実に変化する場合にのみ、キャリー演算を行っている
が、例えば、いずれかの減算ブロックにてキャリーが発
生しており、且つ最上位に位置する減算ブロックDB3
1での演算結果DA31が1023であれば、キャリー
演算を行う等、条件を緩めるようにしてもよい。この場
合、判定回路をより簡易なものとすることができ、判定
に要する時間を短縮できる。
In the present embodiment, when the division circuit 4 determines whether or not a carry operation is necessary, only when the carry of the uppermost subtraction block DB31 changes from 0 to 1 surely, The carry operation is performed. For example, a carry has occurred in any one of the subtraction blocks, and the subtraction block DB3 located at the highest position
If the operation result DA31 in step 1 is 1023, the condition may be relaxed, such as performing a carry operation. In this case, the determination circuit can be simplified, and the time required for the determination can be reduced.

【0083】更に、本実施形態では、乗算回路4におい
て乗数の各桁に対応して1桁ずつ加算を繰り返すように
構成されているが、一度に2桁分ずつ加算するように構
成してもよい。この場合、図12に計算過程が示されて
いるように、加算を実行する毎に、出力レジスタ18の
格納値DOを2ビットずつシフトし、各加算ブロックM
Biにて生成されるキャリーは、次の加算時に、同じ加
算ブロックMBi内で、最上位ビット及び最上位から2
番目のビットに加えるように構成すればよい。 [第2実施形態]次に、第2実施形態について説明す
る。
Further, in the present embodiment, the multiplication circuit 4 is configured to repeat addition one digit at a time corresponding to each digit of the multiplier, but it may be configured to add two digits at a time. Good. In this case, as shown in the calculation process in FIG. 12, each time the addition is performed, the stored value DO of the output register 18 is shifted by 2 bits, and each addition block M
The carry generated by Bi is, at the time of the next addition, within the same addition block MBi, the most significant bit and 2 bits from the most significant bit.
What is necessary is just to comprise so that it may be added to the number bit. [Second Embodiment] Next, a second embodiment will be described.

【0084】図2は、第2実施形態の暗号処理モジュー
ルの構成を表すブロック図である。なお、本実施形態の
暗号処理モジュールは、第1実施形態と同様の暗号処理
を行うものであり、独立した乗算回路4及び除算回路6
の代わりに、共通の乗除算回路44を用いている点が異
なっている。
FIG. 2 is a block diagram showing the configuration of the cryptographic processing module of the second embodiment. Note that the cryptographic processing module of the present embodiment performs the same cryptographic processing as in the first embodiment, and includes an independent multiplication circuit 4 and division circuit 6
In that a common multiplication / division circuit 44 is used instead of

【0085】図2に示すように、本実施形態の暗号処理
モジュール42は、動作モードの指定に従って、(被乗
数MX:Nビット)×(乗数MY:Nビット)の乗算,
或いは(被除数DX:Mビット)÷(除数DY:Nビッ
ト)の除算を実行して、積MZ,或いは商DSと剰余D
Zを出力する乗除算回路44と、Nビットの入力文(平
文/暗号文)C、及び同じくNビットの秘密鍵d,公開
鍵nを入力し、乗算回路4及び除算回路6を用いて暗号
化/復号化のための演算を実行して、出力文(暗号文/
平文)Sを生成する制御回路48とを備えている。
As shown in FIG. 2, the cryptographic processing module 42 of this embodiment performs multiplication of (multiplicand MX: N bits) × (multiplier MY: N bits) according to the designation of the operation mode.
Alternatively, a division of (dividend DX: M bits) ÷ (divisor DY: N bits) is executed, and the product MZ or the quotient DS and the remainder D
A multiplication / division circuit 44 that outputs Z, an N-bit input sentence (plaintext / encrypted text) C, and an N-bit secret key d and a public key n are input and encrypted using a multiplication circuit 4 and a division circuit 6. Performs an operation for encryption / decryption, and outputs an output sentence (ciphertext /
(Plaintext) S.

【0086】但し、本実施形態では、第1実施形態と同
様に、M=2048,N=1024であるものとする。
このうち、制御回路48は、乗除算回路44に乗算を実
行させる場合(図2中S170,S200)には、動作
モードを乗算モードとし、同じく除算を実行させる場合
(図2中S180,S210)には、動作モードを除算
モードに設定する以外は、第1実施形態の制御回路8と
全く同様に動作するので、ここでは説明を省略する。
In this embodiment, however, it is assumed that M = 2048 and N = 1024, as in the first embodiment.
When the control circuit 48 causes the multiplication / division circuit 44 to execute multiplication (S170 and S200 in FIG. 2), the operation mode is set to the multiplication mode, and the division is executed (S180 and S210 in FIG. 2). Operates exactly the same as the control circuit 8 of the first embodiment except that the operation mode is set to the division mode, and the description is omitted here.

【0087】次に、乗除算回路44は、図14に示すよ
うに、被乗数MX又は除数DY格納用に設けられた第2
レジスタ50と、乗数MY又は商DS格納用に設けら
れ、格納値をビット単位でシフトする機能を有する第3
レジスタ51と、動作モードが乗算モードの場合には、
入力される制御信号が1であれば、第2レジスタ50の
格納値を出力し、制御信号が0であればゼロ値を出力
し、動作モードが除算モードの場合には、制御信号によ
らず、第2レジスタ50の格納値を2の補数形式に変換
して出力する供給データ選択回路52と、内部に設けら
れた出力レジスタの格納値と、供給データ選択回路52
から供給されるデータとの演算を実行する演算処理部5
3と、動作モードが乗算モードの時に、第3レジスタ5
1の格納値の最下位ビットを制御信号として供給データ
選択回路52に供給し、動作モードが除算モードの時
に、演算処理部53が出力する商出力DSBを、第3レ
ジスタ51に供給するセレクタ54と、第3レジスタ5
1及び演算処理部53の動作タイミングを制御するタイ
ミング制御部55とを備えている。
Next, as shown in FIG. 14, the multiplication / division circuit 44 includes a second multiplication / division DY provided for storing the multiplicand MX or the divisor DY.
A register 50 for storing the multiplier MY or the quotient DS and having a function of shifting the stored value in units of bits;
When the register 51 and the operation mode are the multiplication mode,
If the input control signal is 1, the value stored in the second register 50 is output, and if the control signal is 0, a zero value is output. If the operation mode is the division mode, the control signal does not depend on the control signal. , A supply data selection circuit 52 for converting the storage value of the second register 50 into a two's complement format and outputting the converted value, a storage value of an output register provided therein, and a supply data selection circuit 52.
Processing unit 5 for performing an operation with data supplied from
3 and the third register 5 when the operation mode is the multiplication mode.
The selector 54 supplies the least significant bit of the stored value of 1 to the supply data selection circuit 52 as a control signal, and supplies the quotient output DSB output by the arithmetic processing unit 53 to the third register 51 when the operation mode is the division mode. And the third register 5
1 and a timing control unit 55 for controlling the operation timing of the arithmetic processing unit 53.

【0088】ここで、演算処理部53は、図7に示し
た、減算処理部22とほぼ同様の構成を有している。但
し、出力レジスタ32及び下位被除数レジスタ25(こ
れらを総称して第1レジスタともいう)は、乗算モード
の時には、下位側にシフトし、除算モードの時には、上
位側にシフトするようにされ、また、加算データ選択回
路33は、乗算モードの時には、出力レジスタ32の格
納値DOiを固定的にALU30に供給するように構成
されている。
Here, the arithmetic processing section 53 has substantially the same configuration as the subtraction processing section 22 shown in FIG. However, the output register 32 and the lower dividend register 25 (collectively referred to as a first register) are shifted to the lower side in the multiplication mode, and shifted to the upper side in the division mode. , The addition data selection circuit 33 is configured to fixedly supply the stored value DOi of the output register 32 to the ALU 30 in the multiplication mode.

【0089】また、キャリー用レジスタ31は、乗算モ
ードの時には、2ビットのキャリーを保持し、上位ビッ
トは上位ブロックDBi+1 に供給し、下位ビットは下位
ブロックDBi-1 からのキャリーと共に、ALU30の
入力キャリーとし、除算モードの時には、1ビットのキ
ャリーを保持し、上位ブロックDBi+1 に供給するよう
に構成されている。
The carry register 31 holds a 2-bit carry in the multiplication mode, supplies the upper bits to the upper block DBi + 1, and the lower bits together with the carry from the lower block DBi-1. In the division mode, a 1-bit carry is held and supplied to the upper block DBi + 1.

【0090】更に、ALU30は、乗算モードの時に
は、キャリー用レジスタ31からのキャリーは最上位ビ
ットに、下位ブロックDBi-1 からのキャリーは最下位
ビットに加算し、除算モードの時には、下位ブロックD
Bi-1 からのキャリーを最下位から2ビット目に加算す
るように構成されている。
In the multiplication mode, the ALU 30 adds the carry from the carry register 31 to the most significant bit and the carry from the lower block DBi-1 to the least significant bit. In the division mode, the lower block D
The carry from Bi-1 is added to the second least significant bit.

【0091】このように構成された乗除算回路44は、
動作モードが乗算モードの時には、第1実施形態におけ
る乗算回路4と全く同様に動作し、動作モードが除算モ
ードの時には、第1実施形態における除算回路6と全く
同様に動作する。従って、本実施形態の暗号処理モジュ
ール42によれば、第1実施形態の暗号処理モジュール
2と全く同様の効果を得ることができる。
The multiplication / division circuit 44 configured as described above
When the operation mode is the multiplication mode, the operation is exactly the same as the multiplication circuit 4 in the first embodiment. When the operation mode is the division mode, the operation is exactly the same as the division circuit 6 in the first embodiment. Therefore, according to the cryptographic processing module 42 of the present embodiment, exactly the same effects as those of the cryptographic processing module 2 of the first embodiment can be obtained.

【0092】しかも、本実施形態の暗号処理モジュール
42によれば、乗除算回路44は、第1実施形態の除算
回路6にわずかな構成を追加するだけで、乗算処理も可
能としているため、装置構成を大幅に小型化することが
できる。
Moreover, according to the cryptographic processing module 42 of the present embodiment, the multiplication / division circuit 44 can perform multiplication processing by adding only a small configuration to the division circuit 6 of the first embodiment. The configuration can be significantly reduced in size.

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

【図1】 第1実施形態の暗号処理モジュールの構成を
表すブロック図である。
FIG. 1 is a block diagram illustrating a configuration of a cryptographic processing module according to a first embodiment.

【図2】 制御回路が実行する処理の概要を表すフロー
チャートである。
FIG. 2 is a flowchart illustrating an outline of a process executed by a control circuit.

【図3】 乗算回路の構成を表すブロック図である。FIG. 3 is a block diagram illustrating a configuration of a multiplication circuit.

【図4】 加算処理部及び加算ブロックの内部構成を表
すブロック図である。
FIG. 4 is a block diagram illustrating an internal configuration of an addition processing unit and an addition block.

【図5】 加算処理部の動作を理解するための説明図で
ある。
FIG. 5 is an explanatory diagram for understanding the operation of an addition processing unit.

【図6】 乗算回路の構成を表すブロック図である。FIG. 6 is a block diagram illustrating a configuration of a multiplication circuit.

【図7】 減算処理部及び減算ブロックの内部構成を表
すブロック図である。
FIG. 7 is a block diagram illustrating an internal configuration of a subtraction processing unit and a subtraction block.

【図8】 演算実行制御部におけるキャリー演算の要否
の判定方法を表すフローチャートである。
FIG. 8 is a flowchart illustrating a method of determining whether or not a carry operation is necessary in an operation execution control unit.

【図9】 キャリー演算の要否の判定を、論理回路にて
行う場合の構成例を表す回路図である。
FIG. 9 is a circuit diagram illustrating an example of a configuration in which a determination as to whether a carry operation is necessary is performed by a logic circuit.

【図10】 減算処理部の動作を理解するための説明図
である。
FIG. 10 is an explanatory diagram for understanding the operation of a subtraction processing unit.

【図11】 減算ブロックを、ボロー付き減算を実行す
るALUにて構成した場合の動作を表す説明図である。
FIG. 11 is an explanatory diagram illustrating an operation when the subtraction block is configured by an ALU that performs subtraction with borrow.

【図12】 加算処理部の他の構成例の動作を表す説明
図である。
FIG. 12 is an explanatory diagram illustrating an operation of another configuration example of the addition processing section.

【図13】 第2実施形態の暗号処理モジュールの構成
を表すブロック図である。
FIG. 13 is a block diagram illustrating a configuration of a cryptographic processing module according to a second embodiment.

【図14】 乗除算回路の構成を表すブロック図であ
る。
FIG. 14 is a block diagram illustrating a configuration of a multiplication / division circuit.

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

2,42…暗号処理モジュール、4…乗算回路、6…除
算回路、8,48…制御回路、10…被乗数レジスタ、
11…乗数レジスタ、12,52…供給データ選択回
路、13…加算処理部、14,24,55…タイミング
制御部、15…結果レジスタ、16,30…算術演算ユ
ニット(ALU)、17,31…キャリー用レジスタ、
18,32…出力レジスタ、20…除数レジスタ、21
…補数変換回路、22…減算処理部、23…商レジス
タ、25…下位被除数レジスタ、26…入力データ選択
回路、27…最上位レジスタ、28…論理和回路、29
…演算実行制御部、33…加算データ選択回路、44…
乗除算回路、50…第2レジスタ、51…第3レジス
タ、53…演算処理部、54…セレクタ、DB0〜31
…減算ブロック、MB0〜31…加算ブロック
2, 42 cryptographic processing module, 4 multiplication circuit, 6 division circuit, 8, 48 control circuit, 10 multiplicand register,
11 Multiplier register, 12, 52 Supply data selection circuit, 13 Addition processing unit, 14, 24, 55 Timing control unit, 15 Result register, 16, 30 Arithmetic operation unit (ALU), 17, 31 ... Register for carry,
18, 32 ... output register, 20 ... divisor register, 21
... Complement conversion circuit, 22 ... Subtraction processing unit, 23 ... Squotient register, 25 ... Lower dividend register, 26 ... Input data selection circuit, 27 ... Top register, 28 ... OR circuit, 29
... Calculation execution control unit, 33 ... added data selection circuit, 44 ...
Multiplication / division circuit, 50: second register, 51: third register, 53: arithmetic processing unit, 54: selector, DB0 to 31
... subtraction block, MB0 to 31 ... addition block

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 被除数からの除数の減算を繰り返し実行
することより、除算結果を得る除算方法において、 前記除数を複数に分割してなる各ブロック毎に前記減算
を実行し、該減算時に各ブロックにて生成される伝達情
報を、次回の減算時に処理することを特徴とする除算方
法。
1. A division method for obtaining a division result by repeatedly executing a subtraction of a divisor from a dividend, wherein the subtraction is executed for each block obtained by dividing the divisor into a plurality of blocks. Wherein the transmission information generated in step (1) is processed at the time of the next subtraction.
【請求項2】 Mビットの被除数を格納し、格納値をビ
ット単位でシフトさせることが可能な被除数レジスタ
と、 該被除数レジスタの格納値を上位側にシフトさせた時に
あふれる1ビットの値を保持する保持手段と、 前記被除数レジスタの上位N(<M)ビットの格納値を
対象データとして、該対象データから、予め設定された
Nビットの除数を減算する減算手段と、 該減算手段での減算結果及び前記保持手段の記憶内容に
基づいて、該減算の可否を判定する判定手段と、 該判定手段にて減算可能と判定された場合、前記減算手
段での減算結果にて前記被除数レジスタの上位Nビット
を更新するデータ更新手段と、 前記被除数レジスタの格納値を上位側にシフトさせ前記
減算手段を再起動する制御を、前記被除数レジスタに初
期設定された被除数の最下位ビットが前記被除数レジス
タの上位Nビット中の最下位ビットの位置に移動するま
で繰り返す再起制御手段と、 を備え、前記対象データからの前記除数の減算及び前記
被除数レジスタの格納値の更新,シフトを繰り返すこと
により除算結果を得る除算回路であって、 前記減算手段は、 R(<N)ビットの減算を実行する複数の減算ブロック
と、 該減算ブロックのそれぞれにて生成される伝達情報を記
憶する伝達情報記憶手段と、 を備え、前記減算ブロックは、前回の減算時に前記伝達
情報記憶手段に記憶された各減算ブロックの伝達情報を
反映させた減算を実行することを特徴とする除算回路。
2. A dividend register capable of storing an M-bit dividend and shifting a stored value in bit units, and holding a 1-bit value overflowing when the stored value of the dividend register is shifted to a higher order side. Holding means for performing the above operation; subtracting a preset N-bit divisor from the target data using the stored value of the upper N (<M) bits of the dividend register as target data; Determining means for determining whether or not the subtraction is possible based on the result and the contents stored in the holding means; and when the determining means determines that the subtraction is possible, the higher order of the dividend register is determined by the result of the subtraction by the subtracting means. Data updating means for updating N bits, and control for shifting the stored value of the dividend register to the upper side and restarting the subtraction means are initialized in the dividend register. Reoccurrence control means for repeating until the least significant bit of the divisor moves to the position of the least significant bit in the upper N bits of the dividend register.Subtraction of the divisor from the target data and calculation of the stored value of the dividend register A division circuit for obtaining a division result by repeating an update and a shift, wherein the subtraction means includes: a plurality of subtraction blocks for performing subtraction of R (<N) bits; and a transmission generated by each of the subtraction blocks. Transmission information storage means for storing information, wherein the subtraction block performs subtraction reflecting transmission information of each subtraction block stored in the transmission information storage means at the time of previous subtraction. Division circuit.
【請求項3】 前記判定手段にて減算可能と判定された
場合には1、減算不能と判定された場合には0を出力す
る商出力手段と、 該商出力手段の出力を順次記憶する商レジスタと、 を備えることを特徴とする請求項2記載の除算回路。
3. A quotient output means for outputting 1 when the determination means determines that subtraction is possible, and outputting a 0 when it is determined that subtraction is impossible, and a quotient for sequentially storing outputs of the quotient output means. The division circuit according to claim 2, further comprising: a register.
【請求項4】 請求項2又は請求項3記載の除算回路に
おいて、 前記減算ブロックは、ボロー付き減算を実行する減算器
からなり、 前記判定手段は、 前記保持手段の記憶内容が0であり、且つ各減算ブロッ
クでの減算結果に、前記伝達情報記憶手段に記憶された
伝達情報を反映させると、最上位に位置する減算ブロッ
クでの伝達情報の発生状態が変化する可能性がある場
合、前記減算結果に前記伝達情報を反映させる演算を、
各減算ブロックに実行させる補助演算手段を備えると共
に、 前記保持手段の記憶内容が1である場合、或いは最上位
に位置する減算ブロックに、前記伝達情報としてのボロ
ーが発生していないか、又は前記補助演算手段の実行に
よってもボロー発生しなかった場合に減算可能と判定す
ることを特徴とする除算回路。
4. The division circuit according to claim 2, wherein the subtraction block includes a subtractor that performs a subtraction with borrow, wherein the storage unit stores 0, In addition, when the transmission information stored in the transmission information storage unit is reflected in the subtraction result in each subtraction block, when the occurrence state of the transmission information in the uppermost subtraction block may change, An operation for reflecting the transmission information in the subtraction result,
In addition to having an auxiliary arithmetic unit to be executed by each subtraction block, if the storage content of the holding unit is 1, or if a borrow as the transmission information does not occur in the uppermost subtraction block, or A division circuit that determines that subtraction is possible when no borrow occurs even by execution of the auxiliary calculation means.
【請求項5】 請求項2又は請求項3記載の除算回路に
おいて、 前記減算ブロックは、キャリー付き加算を実行する加算
器からなると共に、該減算ブロックには、除数を2の補
数形式に変換して供給し、 前記判定手段は、 前記保持手段の記憶内容が0であり、且つ各減算ブロッ
クでの減算結果に、前記伝達情報記憶手段に記憶された
伝達情報を反映させると、最上位に位置する減算ブロッ
クでの伝達情報の発生状態が変化する可能性がある場
合、前記減算結果に前記伝達情報を反映させる演算を、
各減算ブロックに実行させる補助演算手段を備えると共
に、 前記保持手段の記憶内容が1である場合、或いは最上位
に位置する減算ブロックに、前記伝達情報としてのキャ
リーが発生しているか、又は前記補助演算手段の実行に
よって新たにキャリーが発生した場合に減算可能と判定
することを特徴とする除算回路。
5. The division circuit according to claim 2, wherein the subtraction block includes an adder that performs addition with carry, and the subtraction block converts the divisor into a two's complement format. When the storage content of the holding unit is 0 and the subtraction result in each subtraction block reflects the transmission information stored in the transmission information storage unit, the determination unit is positioned at the highest position. When there is a possibility that the occurrence state of the transmission information in the subtraction block to be changed, an operation of reflecting the transmission information in the subtraction result,
Auxiliary calculation means to be executed by each subtraction block is provided, and if the storage content of the holding means is 1, or if the carry as the transmission information is generated in the topmost subtraction block, or A division circuit for determining that subtraction is possible when a carry is newly generated by execution of the arithmetic means.
【請求項6】 Mビットの積或いは被除数を格納し、格
納値をビット単位でシフトさせることが可能な第1レジ
スタと、 N(<M)ビットの被乗数或いは除数を格納する第2レ
ジスタと、 Nビットの乗数或いは商を格納し、格納値をビット単位
でシフトさせることが可能な第3レジスタと、 前記第1レジスタの格納値を上位側にシフトさせた時に
あふれる1ビットの値を保持する保持手段と、 外部から設定される動作モードに従い、該動作モードが
乗算モードである場合、前記第3レジスタの格納値の最
下位ビットが1であれば前記第2レジスタの格納値を、
最下位ビットが0であればMビットのゼロ値を出力し、
一方、前記動作モードが除算モードである場合、前記第
2レジスタの格納値を2の補数形式に変換して出力する
供給データ選択手段と、 該供給データ選択手段の出力と、前記第1レジスタの上
位Nビットに格納された演算対象データとの演算を実行
する演算手段と、 該演算手段での演算結果,前記保持手段の記憶内容,及
び前記動作モードに基づいて、該演算の可否を判定する
判定手段と、 該判定手段にて演算可能と判定された場合、前記演算手
段での演算結果にて前記第1レジスタの上位Nビットを
更新するデータ更新手段と、 前記動作モードが乗算モードである場合に、前記第1及
び第3レジスタの格納値をいずれも下位側に1ビットシ
フトさせて前記演算手段を再起動する制御を、前記第3
レジスタに初期設定された格納値の最上位ビットが、該
第3レジスタの最下位ビットの位置に移動するまで繰り
返す乗算制御手段と、 前記動作モードが除算モードである場合に、前記第1レ
ジスタの格納値を上位側に1ビットシフトさせて前記演
算手段を再起動する制御を、前記第2レジスタに初期設
定された被除数の最下位ビットが前記第1レジスタの上
位Mビット中の最下位ビットの位置に移動するまで繰り
返す除算制御手段と、 を備え、外部から設定された動作モードで動作する乗除
算回路であって、 前記演算手段は、 R(<N)ビットのキャリー付き加算を行う複数の加算
器と、 該減算器のそれぞれにて生成されるキャリーを記憶する
キャリー記憶手段と、 を備え、前記加算器は、前回の演算時に前記キャリー記
憶手段に記憶された内容を反映した加算処理を実行する
ことを特徴とする乗除算回路。
6. A first register for storing a product or dividend of M bits and capable of shifting a stored value in bit units, a second register for storing a multiplicand or divisor of N (<M) bits, A third register capable of storing an N-bit multiplier or quotient and shifting the stored value in bit units; and holding a 1-bit value overflowing when the stored value of the first register is shifted upward. In accordance with an operation mode set from the outside, when the operation mode is a multiplication mode, if the least significant bit of the stored value of the third register is 1, the stored value of the second register is
If the least significant bit is 0, an M-bit zero value is output,
On the other hand, when the operation mode is the division mode, supply data selection means for converting the value stored in the second register into a two's complement format and outputting the result, output of the supply data selection means, An operation means for executing an operation with the operation target data stored in the upper N bits; and determining whether or not the operation is possible based on the operation result of the operation means, the storage content of the holding means, and the operation mode. Judging means; data updating means for updating upper N bits of the first register based on the operation result of the operation means when the operation means judges that the operation is possible; and the operation mode is a multiplication mode. In this case, the control of shifting the stored values of the first and third registers by one bit to the lower side and restarting the arithmetic means is performed by the third control.
Multiplication control means for repeating until the most significant bit of the stored value initialized in the register moves to the position of the least significant bit of the third register; and when the operation mode is the division mode, the multiplication control means The control for shifting the stored value by one bit to the upper side and restarting the arithmetic means is performed by setting the least significant bit of the dividend initially set in the second register to the least significant bit in the upper M bits of the first register. A multiplication / division circuit operating in an operation mode set from the outside, comprising: a plurality of division control means for performing an addition with carry of R (<N) bits. An adder; and carry storage means for storing the carry generated by each of the subtractors, wherein the adder is stored in the carry storage means at the time of the previous operation. Multiplication and division circuit and executes the addition processing that reflects the contents were.
【請求項7】 前記判定手段は、 前記動作モードが除算モードである場合、前記保持手段
の記憶内容が0であり、且つ各加算器での加算結果に、
前記キャリー記憶手段に記憶されたキャリーを反映させ
ると、最上位に位置する加算器でのキャリーの発生状態
が変化する可能性があれば、前記加算結果に前記キャリ
ーを反映させる演算を、各加算器に実行させる補助演算
手段を備えると共に、 前記動作モードが乗算モードであれば、常に演算可能と
判定し、前記動作モードが除算モードであれば、前記保
持手段の記憶内容が1である場合、或いは最上位に位置
する加算器にて、キャリーが発生しているか、又は前記
補助演算手段の実行により新たにキャリーが発生した場
合に演算可能と判定することを特徴とする請求項6記載
の乗除算回路。
7. When the operation mode is the division mode, the determination unit determines that the storage content of the holding unit is 0 and the addition result of each adder is:
When the carry stored in the carry storage means is reflected, if there is a possibility that the occurrence state of the carry in the uppermost adder may change, an operation for reflecting the carry in the addition result is performed by each addition. And if the operation mode is the multiplication mode, it is always determined that the operation is possible. If the operation mode is the division mode, if the storage content of the holding unit is 1, 7. The multiplication / division according to claim 6, wherein if the carry is generated in the uppermost adder, or if the carry is newly generated by the execution of the auxiliary calculation means, it is determined that the calculation can be performed. Arithmetic circuit.
JP2000371567A 2000-12-06 2000-12-06 Division circuit, multiplication and division circuit Expired - Fee Related JP4306121B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000371567A JP4306121B2 (en) 2000-12-06 2000-12-06 Division circuit, multiplication and division circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000371567A JP4306121B2 (en) 2000-12-06 2000-12-06 Division circuit, multiplication and division circuit

Publications (2)

Publication Number Publication Date
JP2002175178A true JP2002175178A (en) 2002-06-21
JP4306121B2 JP4306121B2 (en) 2009-07-29

Family

ID=18841272

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000371567A Expired - Fee Related JP4306121B2 (en) 2000-12-06 2000-12-06 Division circuit, multiplication and division circuit

Country Status (1)

Country Link
JP (1) JP4306121B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117806592A (en) * 2024-02-29 2024-04-02 蓝象智联(杭州)科技有限公司 Large integer data division operation method and system for privacy calculation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117806592A (en) * 2024-02-29 2024-04-02 蓝象智联(杭州)科技有限公司 Large integer data division operation method and system for privacy calculation
CN117806592B (en) * 2024-02-29 2024-05-10 蓝象智联(杭州)科技有限公司 Large integer data division operation method and system for privacy calculation

Also Published As

Publication number Publication date
JP4306121B2 (en) 2009-07-29

Similar Documents

Publication Publication Date Title
US5982900A (en) Circuit and system for modulo exponentiation arithmetic and arithmetic method of performing modulo exponentiation arithmetic
US7831650B2 (en) Method for modular multiplication
US20050198093A1 (en) Montgomery modular multiplier
US7831651B2 (en) Method and apparatus for modular inversion for information security and recording medium with a program for implementing the method
CN109039640B (en) Encryption and decryption hardware system and method based on RSA cryptographic algorithm
JPH08263316A (en) Execution method of modular multiplication by montgomery method
JP2002521720A (en) Circuits and methods for modulo multiplication
JP4302640B2 (en) Apparatus and method for calculating multiplication using multiplicand shift, and recording medium storing program code for executing the apparatus
KR100436814B1 (en) apparatus for RSA Crypto Processing of IC card
US7024560B2 (en) Power-residue calculating unit using Montgomery algorithm
US6567832B1 (en) Device, method, and storage medium for exponentiation and elliptic curve exponentiation
JP5143817B2 (en) Hash encryption apparatus and method
US5751620A (en) Method for the production of an error correction parameter associated with the implementation of modular operations according to the Montgomery method
US6341299B1 (en) Modular arithmetic coprocessor enabling the performance of non-modular operations at high speed
CN113193962A (en) SM2 digital signature generation and verifier based on lightweight modular multiplication
JP2004004341A (en) Apparatus and method for modulo exponentiation calculation, and program
US7016927B2 (en) Method and apparatus for modular multiplication
JP2002175178A (en) Dividing method, dividing circuit and multiplying and dividing circuit
US7590235B2 (en) Reduction calculations in elliptic curve cryptography
WO2004055664A1 (en) A method for generating the multiplicative inverse in a finite field gf(p)
KR100297110B1 (en) Modular multiplier
US7472154B2 (en) Multiplication remainder calculator
JP2003216411A (en) Multiple length arithmetic processor and ic device
US20230261851A1 (en) Method of defense against cryptosystem timing attack, associated cryptosystem processing circuit, and associated electronic device
JPH11282351A (en) Inverse element computing method in security technique, computing device using the method and recording medium recording program for executing the method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070223

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20081216

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090120

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20090414

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090427

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20120515

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20120515

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20130515

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20140515

Year of fee payment: 5

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees