Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP2519288B2 - Multiplier / divider - Google Patents
[go: Go Back, main page]

JP2519288B2 - Multiplier / divider - Google Patents

Multiplier / divider

Info

Publication number
JP2519288B2
JP2519288B2 JP63038723A JP3872388A JP2519288B2 JP 2519288 B2 JP2519288 B2 JP 2519288B2 JP 63038723 A JP63038723 A JP 63038723A JP 3872388 A JP3872388 A JP 3872388A JP 2519288 B2 JP2519288 B2 JP 2519288B2
Authority
JP
Japan
Prior art keywords
mod
result
modulo
adder
register
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.)
Expired - Lifetime
Application number
JP63038723A
Other languages
Japanese (ja)
Other versions
JPH01214927A (en
Inventor
保弘 石井
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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP63038723A priority Critical patent/JP2519288B2/en
Publication of JPH01214927A publication Critical patent/JPH01214927A/en
Application granted granted Critical
Publication of JP2519288B2 publication Critical patent/JP2519288B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、乗除算器に係り、特に、整数x,y,nに対
し、x×y(mod n)を求めるために用いて好適な乗除
算器に関する。
The present invention relates to a multiplier / divider, and is particularly suitable for use in obtaining x × y (mod n) for integers x, y, n. Regarding the multiplier / divider.

〔従来の技術〕[Conventional technology]

一般に、整数x,y,nを、 x<n,y<n、 y=(ym,ym-1,ym-2,…,y1,y0 但し、m≧0 とすると、x×y(mod n)は、 x×y(mod n)= {{{…{{{{{x×ym}(mod n)} ×2}(mod n)+x×ym-1}(mod n)} ×2}(mod n)+……+x×y1}(mod n)} ×2}(mod n)x×y0}(mod n) ……(1) として表わされる演算式により求めることができる。In general, integers x, y, n are x <n, y <n, y = (y m , y m-1 , y m-2 , ..., y 1 , y 0 ) 2, where m ≧ 0 , X × y (mod n) is: x × y (mod n) = {{{... {{{{{x × y m } (mod n)} × 2} (mod n) + x × y m-1 } (Mod n)} × 2} (mod n) + ... + x × y 1 } (mod n)} × 2} (mod n) x × y 0 } (mod n) ...... (1) It can be calculated by an arithmetic expression.

このような演算式を演算器として実現し、前述の演算
を行う従来技術として、例えば、特開昭57−206964号公
報等に記載された技術が知られている。
As a conventional technique for realizing such an arithmetic expression as an arithmetic unit and performing the above-described arithmetic operation, for example, a technique described in JP-A-57-206964 is known.

第5図は前述した演算式(1)に基づいて演算を行う
従来技術による乗除算器の構成を示すブロツク図であ
る。第2図において、1はx×yi演算器、2は加算器、
4は2倍器、5,6はmod n(モジユロn)演算器である。
FIG. 5 is a block diagram showing the structure of a multiplier / divider according to the prior art which performs an operation based on the above-mentioned arithmetic expression (1). In FIG. 2, 1 is an x × y i calculator, 2 is an adder,
Reference numeral 4 is a doubler, and 5 and 6 are mod n (modulo n) arithmetic units.

第5図に示す乗除算器において、x×yi演算器1は、
入力される整数x,yにより、x×yiを演算し、加算器2
は、この乗算結果x×yiと、今までの演算結果とを加算
する。モジユロn演算器5は、この加算結果のモジユロ
nを求め、2倍器4は、このモジユロnの結果を2倍す
る。モジユロn演算器6は、2倍器4の結果をさらにモ
ジユロn演算する。これにより、モジユロn演算器6
は、 {{{…+x×yi}(mod n)}×2}(mod n)を出力
する。この結果は、前述した加算器に戻され、x×yi-1
と加算され、前述と同様に演算される。
In the multiplier / divider shown in FIG. 5, the x × y i calculator 1 is
The adder 2 calculates x × y i from the input integers x and y.
Adds this multiplication result x × y i and the operation result up to now. The modulo n calculator 5 finds the modulo n of the addition result, and the doubler 4 doubles the result of the modulo n. The modulo n calculator 6 further modulos the result of the doubler 4. As a result, the module 6
Outputs {{{... + x × y i } (mod n)} × 2} (mod n). This result is returned to the adder described above, and x × y i-1
Is calculated and is calculated in the same manner as described above.

このような演算を、iをmから0までとして、m+1
回繰返し実行することにより、第5図に示す乗除算器
は、演算式(1)の演算を実行し、モジユロn演算器5
よりx×y(mod n)を出力する。
Such an operation is performed by setting m from 0 to m and m + 1.
By repeatedly performing the operation twice, the multiplier / divider shown in FIG. 5 executes the operation of the arithmetic expression (1), and the modular n operator 5
Output x × y (mod n).

第5図に示す乗除算器において、モジユロn演算器5,
6は、夫々1回のnの減算を行う演算器であり、夫々の
入力に与えられる入力値tは、0≦t<2nの範囲に納め
る必要がある。この条件を満たすため、第2図に示す乗
除算器は、モジユロn演算器が2組設けられている。
In the multiplier / divider shown in FIG. 5, a modular n calculator 5,
Reference numeral 6 is an arithmetic unit that performs subtraction of n once, and the input value t given to each input must be within the range of 0 ≦ t <2n. In order to satisfy this condition, the multiplier / divider shown in FIG. 2 is provided with two sets of modulo n arithmetic units.

〔発明が解決しようとする課題〕[Problems to be Solved by the Invention]

前記従来技術は、1桁の演算を行うために、前述した
ように、2回のnの減算すなわち、2回のモジユロn演
算を行う必要があり、このため演算スピードが遅くな
り、また、乗除算器の回路規模が大きくなるという問題
点を有していた。
In the prior art, as described above, in order to perform a one-digit operation, it is necessary to perform n subtraction twice, that is, two modulo n arithmetic operations, which results in a slower operation speed and multiplication and division. There is a problem that the circuit scale of the calculator becomes large.

本発明の目的は、前記従来技術の問題点を解決し、1
桁の演算において、1回の加算あるいは減算を行うこと
によるモジユロ演算を行うのみで、x×y(mod n)の
演算を実行することのできる乗除算器を提供することに
ある。
The object of the present invention is to solve the above-mentioned problems of the prior art.
An object of the present invention is to provide a multiplier / divider that can execute x × y (mod n) operations only by performing modulo operations by performing addition or subtraction once in digit operations.

〔課題を解決するための手段〕[Means for solving the problem]

本発明によれば、前記目的は、x×y(mod n)の演
算を行う乗除算器を、x×y(mod−n)を求める演算
部と、この演算結果にnを加えることによりx×y(mo
d n)とする変換部とにより構成することにより達成さ
れる。
According to the present invention, the object is to provide a multiplier / divider that performs an operation of x × y (mod n), an operation unit that obtains x × y (mod-n), and an n by adding n to the operation result. Xy (mo
dn) and a conversion unit.

〔作 用〕[Work]

x×y(mod−n)は、次に示す演算式のように展開
することができる。
xx (mod-n) can be expanded as the following arithmetic expression.

x×y(mod−n)= {{{…{{{x×ym}(mod−n)}×2 +x×ym-1}(mod−n)}×2+…… +x×y1}(mod−n)}×2+x×y0}(mod−n)…
…(2) 第2式において、注意すべき点は…×2の後に、(mo
d−n)を必要としない点である。この理由は、×2の
前で実行する(mod−n)の演算結果tが、−n<t≦
0の範囲にあることによる。この結果を2倍し、x×yi
を加算しても、その結果である2t+x×yiは、−2n<2t
+x×yi<nの範囲にある。そして、この2t+x×yi
モジユロ(−n)は、次のように1回の加算あるいは減
算により求めることができる。すなわち、 (1) 2t+x×yi>0の場合、−nの演算を実行する
ことにより、モジユロ(−n)の結果を得ることができ
る。
x × y (mod-n) = {{{... {{{x × y m } (mod-n)} × 2 + x × y m-1 } (mod-n)} × 2 + ... + x × y 1 } (mod-n)} × 2 + x × y 0} (mod-n) ...
(2) In the second formula, the point to be careful is that after × 2, (mo
d-n) is not required. This is because the calculation result t of (mod-n) executed before x2 is -n <t≤
Because it is in the range of 0. This result is doubled and x × y i
Even if is added, the result 2t + x × y i is −2n <2t
Within the range of + x × y i <n. Then, the modulo (−n) of 2t + x × y i can be obtained by one addition or subtraction as follows. That is, (1) When 2t + x × y i > 0, the result of modulo (−n) can be obtained by executing the operation of −n.

(2) 2t+x×yi<0の場合、+nの演算を実行し、
その結果が正の場合、+nの演算を行う前の元の値をモ
ジユロ(−n)の結果とし、前述の結果が負の場合、そ
の負の値をモジユロ(−n)の結果とする。
(2) When 2t + x × y i <0, the operation of + n is executed,
When the result is positive, the original value before the calculation of + n is the result of modulo (-n), and when the result is negative, the negative value is the result of modulo (-n).

前述のように、1桁のモジユロ(−n)の演算は、1
回の加算または減算によるモジユロ(−n)の演算によ
り行うことが可能であり、従つて、x×y(mod−n)
の演算は、y=ym,ym-1,…y0としたとき、1個のモジユ
ロ(−n)演算器をm+1回繰返し使用することにより
実行できる。
As mentioned above, the calculation of 1-digit modulo (-n) is 1
It is possible to perform the calculation of modulo (-n) by adding or subtracting twice, and therefore x × y (mod-n)
Operation of, when the y = y m, y m- 1, ... y 0, can be executed by one modulo (-n) calculator m + 1 iterations used.

〔実施例〕〔Example〕

以下、本発明による乗除算器の一実施例を図面により
詳細に説明する。
Hereinafter, an embodiment of a multiplier / divider according to the present invention will be described in detail with reference to the drawings.

第1図は本発明の一実施例の概略構成を示すブロツク
図、第2図は第1図におけるmod−n演算部の構成を示
すブロツク図、第3図は第2図におけるx×yi演算器の
ブロツク図、第4図は第1図におけるmod−n演算器の
ブロツク図である。第1図〜第4図において、3はmod
−n(モジユロ(−n))演算器、7はx×y(mod−
n)を求める演算部、8は変換部、201はXレジスタ、2
02はYレジスタ、203はシフタ、211は入力レジスタ、21
2はNレジスタ、213は加減算器、214はアキユムレー
タ、215はセレクタであり、他の符号は第5図の場合と
同一である。
FIG. 1 is a block diagram showing a schematic configuration of an embodiment of the present invention, FIG. 2 is a block diagram showing a configuration of a mod-n arithmetic unit in FIG. 1, and FIG. 3 is x × y i in FIG. FIG. 4 is a block diagram of the arithmetic unit, and FIG. 4 is a block diagram of the mod-n arithmetic unit in FIG. 1 to 4, 3 is a mod
-N (modulo (-n)) computing unit, 7 is xxy (mod-
n) calculating unit, 8 conversion unit, 201 X register, 2
02 is a Y register, 203 is a shifter, 211 is an input register, 21
Reference numeral 2 is an N register, 213 is an adder / subtractor, 214 is an accumulator, 215 is a selector, and other symbols are the same as those in FIG.

第1図において、x×y(mod−n)を求める演算部
7には、整数x,y,nが与えられる。この演算部7は与え
られる整数x,yに対して、x×y(mod−n)の演算を実
行する。このモジユロ(−n)の演算結果Tは、一般
に、0≦T<−nとなる。変換部8は、前記演算部7の
演算結果Tに+nの演算を行うことにより、演算結果T
であるx×y(mod−n)をx×y(mod−n)に変換す
る。その際、この変換部8は、与えられる演算結果Tが
“0"の場合、+n演算を行わず、“0"を出力するように
動作する。
In FIG. 1, an integer x, y, n is given to a calculation unit 7 for obtaining x × y (mod-n). The calculation unit 7 executes a calculation of x × y (mod-n) on the given integers x and y. The calculation result T of this modulo (-n) is generally 0≤T <-n. The conversion unit 8 performs an operation of + n on the operation result T of the operation unit 7 to obtain an operation result T
Xxy (mod-n) is converted into xxy (mod-n). At this time, the conversion unit 8 operates so as to output "0" without performing + n calculation when the given calculation result T is "0".

前述においては、x×y(mod−n)を求める演算部
7の演算結果Tが“0"の場合、変換部8は、その演算結
果“0"をそのまま出力したが、変換部8を単に、+n加
算を行う演算器のみで構成し、前述の演算部7におい
て、その演算結果Tが“0"となる場合、“−n"を出力す
るようにしてもよい。この場合、変換部8の構成を加算
器のみの簡易な構成とすることができる。
In the above description, when the calculation result T of the calculation unit 7 for obtaining x × y (mod−n) is “0”, the conversion unit 8 outputs the calculation result “0” as it is, but the conversion unit 8 is simply , + N addition, it is possible to output "-n" when the calculation result T becomes "0" in the calculation unit 7 described above. In this case, the configuration of the conversion unit 8 can be a simple configuration including only the adder.

前述した、x×y(mod−n)を求める演算部7は、
第2図に示すように、x×yi演算器1と、加算器2と、
モジユロ(−n)演算器3と、2倍器4とにより構成さ
れている。第2図において、整数x,yは、データ線11,12
を介して、x×yi演算器1に入力され、該演算器1の出
力は、データ線13を介して加算器2の左側入力端子に与
えられる。加算器2の出力は、データ線14を介してモジ
ユロ(−n)演算器3に入力され、このモジユロ(−
n)演算器3の出力は、データ線16を介して2倍器4に
与えられる。2倍器4の出力は、データ線18を介して、
前述の加算器2の右側入力端子に与えられる。また、モ
ジユロ(−n)演算器3には、データ線15を介して整数
nが与えられており、その出力は、データ線17を介して
x×y(mod−n)の演算結果として出力される。
The operation unit 7 for obtaining x × y (mod-n) described above is
As shown in FIG. 2, an x × y i calculator 1, an adder 2, and
It is composed of a module (-n) arithmetic unit 3 and a doubler 4. In FIG. 2, integers x and y are data lines 11 and 12,
Is input to the x × y i calculator 1 and the output of the calculator 1 is given to the left input terminal of the adder 2 via the data line 13. The output of the adder 2 is input to the module (-n) calculator 3 via the data line 14 and the module (-n)
n) The output of the arithmetic unit 3 is given to the doubler 4 via the data line 16. The output of the doubler 4 is sent via the data line 18.
It is applied to the right input terminal of the adder 2 described above. An integer n is given to the modulo (-n) computing unit 3 via the data line 15, and the output thereof is output as the computation result of x × y (mod-n) via the data line 17. To be done.

次に、前述のように構成されたx×y(mod−n)を
求める演算部7の動作を説明する。
Next, the operation of the arithmetic unit 7 for obtaining x × y (mod-n) configured as described above will be described.

(1) 全回路をリセツトする。これにより各演算器の
出力は、全て“0"となる。
(1) Reset all circuits. As a result, the output of each computing unit becomes "0".

(2) データ線11,12,15に夫々、整数x,y,nをのせ、
入力する。
(2) Put the integers x, y, n on the data lines 11, 12, 15 respectively,
input.

(3) i=mとする。(3) i = m.

(4) x×yi演算器1で、x×ymを計算する。(4) The x × y i calculator 1 calculates x × y m .

(5) 加算器2で、0+x×ymを計算する。(5) The adder 2 calculates 0 + x × y m .

(6) モジユロ(−n)演算器3で、(−n)のモジ
ユロを計算する。これにより、データ線16に{x×ym
(mod−n)が得られる。
(6) The modulo (-n) calculator 3 calculates the modulo of (-n). As a result, {x × y m } on the data line 16
(Mod-n) is obtained.

(7) この結果を2倍器4で2倍する。この結果、デ
ータ線18上に、{{x×ym}(mod−2)}×2が得ら
れる。
(7) This result is doubled by the doubler 4. As a result, {{x × y m } (mod-2)} × 2 is obtained on the data line 18.

(8) i=m−1とする。(8) Let i = m-1.

(9) x×yi演算器1で、x×ym-1を計算する。(9) The x × y i calculator 1 calculates x × y m−1 .

(10) 加算器2で、2倍器4の出力と、x×ym-1を加
算する。この結果、データ線14上に、 {{x×ym}(mod−n)}×2+x×ym-1が得られ
る。
(10) The adder 2 adds the output of the doubler 4 and x × y m−1 . As a result, {{x × y m } (mod-n)} × 2 + x × y m-1 is obtained on the data line 14.

(11) モジユロ(−n)演算器3で、(−n)のモジ
ユロを計算する。この結果、データ線16上に、 {{{x×ym}(mod−n)}×2+x×ym-1}(mod−
n)が得られる。
(11) The module (-n) calculator 3 calculates the module (-n). As a result, on the data line 16, {{{x × y m } (mod−n)} × 2 + x × y m−1 } (mod−
n) is obtained.

(12) 2倍器4で、この結果を2倍する。この結果、
データ線18上に、 {{{{x×ym}(mod−n)}×2+x×ym-1}(mod
−n)}×2が得られる。
(12) Double the result with the doubler 4. As a result,
On the data line 18, {{{{x × y m } (mod-n)} × 2 + x × y m-1 } (mod
-N)} * 2 is obtained.

(13) iをm−2から0まで変化させながら、前述の
(8)〜(12)をm−1回繰返し実行する。これによ
り、データ線18上に、 {{{…{{{{x×ym}(mod−n)×2+x×
ym-1}(mod−n)}×2+……+x×y1}(mod−
n)}×2+x×y0}(mod−n)が得られる。
(13) The above steps (8) to (12) are repeated m-1 times while changing i from m-2 to 0. As a result, on the data line 18, {{{... {{{{x × y m } (mod-n) × 2 + xx
y m-1 } (mod-n)} × 2 + ... + x × y 1 } (mod-
n)} × 2 + x × y 0} (mod-n) is obtained.

(14) このとき、データ線17上には、x×y(mod−
n)が出力される。
(14) At this time, x × y (mod−
n) is output.

x×y(mod−n)を求める演算部7は、前述のよう
に動作して、x×y(mod−n)を求めることができ、
この演算結果は、第1図に示す変換部8により、nのモ
ジユロに変換され、x×y(mod−n)として出力され
る。
The operation unit 7 for obtaining x × y (mod−n) can operate as described above to obtain x × y (mod−n),
The calculation result is converted into n modules by the conversion unit 8 shown in FIG. 1 and output as x × y (mod−n).

次に、前述の演算部7を構成するブロツクについて、
その詳細を説明する。加算器2及び2倍器4は自明の構
成であるので、ここでは、x×yi演算器1及びモジユロ
(−n)演算器3について説明する。
Next, regarding the blocks constituting the above-mentioned arithmetic unit 7,
The details will be described. Since the adder 2 and the doubler 4 have a trivial configuration, the x × y i calculator 1 and the modulo (−n) calculator 3 will be described here.

x×yi演算器1は、第3図に示すように、整数xを格
納するXレジスタ201と、整数yを格納するYレジスタ2
02と、シフト203と、ANDゲート204とにより構成され
る。演算開始時、整数xは、データ線11を介してXレジ
スタ201に格納され、整数yは、データ線12を介してY
レジスタ202に格納される。その後、まずXレジスタ201
内の全ビツトと、Yレジスタ202の最上位ビツト、すな
わち、ymとが、ANDゲート204に与えられ、論理積をとら
れてデータ線13に出力される。これにより、データ線13
上にx×ymが得られたことになる。次に、Yレジスタ20
2内の値が、シフタ203により上位ビツト方向へ1ビツト
シフトされ、Yレジスタ202に再セツトされる。これに
より、Yレジスタ202の最上位ビツトは、ym-1となる。
このYレジスタ202の最上位ビツトと、Xレジスタ201の
全ビツトをANDゲート204に与えることにより、データ線
13上にx×ym-1が得られる。このような動作を繰返すこ
とにより、x×yi演算器13は、データ線13上に順次、x
×ym,x×ym-1,……x×y1,x×y0を出力することができ
る。
As shown in FIG. 3, the x × y i calculator 1 has an X register 201 for storing an integer x and a Y register 2 for storing an integer y.
02, shift 203, and AND gate 204. At the start of the calculation, the integer x is stored in the X register 201 via the data line 11, and the integer y is Y via the data line 12.
It is stored in the register 202. After that, first, X register 201
All the bits in the above and the most significant bit of the Y register 202, that is, y m , are given to the AND gate 204, logically ANDed and output to the data line 13. This allows data line 13
That is, x × y m is obtained above. Next, the Y register 20
The value in 2 is shifted one bit in the upper bit direction by the shifter 203 and reset in the Y register 202. As a result, the highest bit of the Y register 202 becomes y m-1 .
By giving the most significant bit of the Y register 202 and all the bits of the X register 201 to the AND gate 204, the data line
We get x × y m−1 on 13. By repeating such an operation, the x × y i calculator 13 sequentially outputs x on the data line 13.
It is possible to output xy m , xxy m-1 , ... xxy 1 , xxy 0 .

モジユロ(−n)演算器3は、第4図に示すように、
入力データ線14からの値を格納する入力レジスタ211
と、整数nを格納するNレジスタ212と、両レジスタ21
1,212の値の加減算を行う加減算器213と、加減算器213
の出力をラツチするアキユムレータ214と、入力レジス
タ211の出力と、アキユムレータ214の出力の一方を選択
するセレクタ215とにより構成されている。
The module (-n) arithmetic unit 3 is, as shown in FIG.
Input register 211 that stores the value from input data line 14
And an N register 212 that stores an integer n, and both registers 21
An adder / subtractor 213 that performs addition and subtraction of 1,212 values and an adder / subtractor 213
Of the input register 211 and a selector 215 for selecting one of the outputs of the accumulator 214.

演算開始時、整数nがデータ線15を介してNレジスタ
212に格納される。データ線14を介して、第2図に示す
加算器2からの加算結果値データが与えられると、この
入力データは、入力レジスタ211にラツチされる。入力
レジスタ211内のサインビツトs1は、信号線216を介し
て、加減算器213に演算指示信号として与えられる。
At the start of calculation, the integer n is registered in the N register via the data line 15.
Stored in 212. When the addition result value data from the adder 2 shown in FIG. 2 is given via the data line 14, this input data is latched in the input register 211. The sign bit s 1 in the input register 211 is given to the adder / subtractor 213 as a calculation instruction signal via the signal line 216.

このサインビツトs1が“0"場合、すなわち、加算結果
値である入力データ値が正の場合、加減算器213は、減
算が指示され、サインビツトs1が“1"の場合、すなわ
ち、加算結果値である入力データ値が負の場合、加減算
器213は、加算が指示される。加減算器213は、前述のサ
インビツトs1による演算指示に応じて、入力レジスタ21
1の値からNレジスタ212の値を減算し、あるいは、入力
レジスタ211の値とNレジスタ212の値とを加算し、その
結果をアキユムレータ214に出力する。このアキユムレ
ータ214のサインビツトs2は、信号線217を介してセレク
タ215に対する選択信号として与えられる。このサイン
ビツトs2が“0"の場合、すなわち、加減算器213による
演算結果が正の場合、セレクタ215は、入力レジスタ211
内の値を選択し、サインビツトs2が“1"の場合、すなわ
ち、加減算器213による演算結果が負の場合、セレクタ2
15は、アキユムレータ214内の値を選択する。この結果
が、モジユロ(−n)の演算結果として、データ線16に
出力される。
If the sign bit s 1 is “0”, that is, if the input data value that is the addition result value is positive, the adder / subtractor 213 is instructed to subtract, and if the sign bit s 1 is “1”, that is, the addition result value. If the input data value of is negative, the adder / subtractor 213 is instructed to perform addition. The adder / subtractor 213 receives the input register 21 according to the operation instruction by the sine bit s 1.
The value of the N register 212 is subtracted from the value of 1, or the value of the input register 211 and the value of the N register 212 are added, and the result is output to the accumulator 214. The sign bit s 2 of the accumulator 214 is given as a selection signal to the selector 215 via the signal line 217. When the sign bit s 2 is “0”, that is, when the operation result of the adder / subtractor 213 is positive, the selector 215 determines that the input register 211
When the sign bit s 2 is “1”, that is, when the operation result of the adder / subtractor 213 is negative, the selector 2
15 selects the value in the accumulator 214. This result is output to the data line 16 as the calculation result of module (-n).

前述のように動作するモジユロ(−n)演算器3の動
作をまとめると、入力データ線14上の入力値の大きさに
応じて、次のような演算を行っていることになる。
To summarize the operation of the modulo (-n) calculator 3 which operates as described above, the following calculation is performed according to the magnitude of the input value on the input data line 14.

(1) 0≦入力値<nの場合、 出力=入力値−n (2) −n≦入力値<0の場合、 出力=入力値 (3) −2n≦入力値<−nの場合、 出力=入力+n 前述した第4図に示したモジユロ(−n)演算器3の
演算において、注意すべき点は、(−n)のモジユロの
結果として“0"となる場合に、“0"に代わり“−n"を出
力する点である。このため、前記実施例は、第1図の説
明図でもすでに述べたように、x×y(mod−n)をx
×y(mod n)に変換する変換部8を単にtn回路で構成
でき、しかも、モジユロ(−n)演算器3自身の回路構
成も簡単にできるという利点を有する。
(1) If 0 ≤ input value <n, output = input value -n (2) -n ≤ input value <0, output = input value (3) -2n ≤ input value <-n, output = Input + n In the calculation of the module (-n) calculator 3 shown in FIG. 4, the point to be noted is that when the result of the module (-n) is "0", it becomes "0". Instead, it outputs "-n". Therefore, in the above-described embodiment, as already described in the explanatory diagram of FIG. 1, x × y (mod-n) is set to x.
The conversion unit 8 for converting to xy (mod n) can be simply configured by a tn circuit, and further, the circuit configuration of the modulo (-n) computing unit 3 itself can be simplified.

前述した本発明の実施例によれば。x×y(mod n)
の演算を1個のモジユロ演算器を用いるのみで行うこと
ができるので、演算速度の向上を図ることができるとと
もに、そのための述除算器を構成するに必要な論理ゲー
ト量を減少させることが可能となる。
According to the embodiments of the present invention described above. x × y (mod n)
Can be performed by using only one modulo arithmetic unit, so that the arithmetic speed can be improved and the amount of logic gates necessary for constructing the predicate divider can be reduced. Becomes

〔発明の効果〕〔The invention's effect〕

以上説明したように、本発明によれば、x×y(mod
n)の演算を1個のモジユロ演算器で行うことが可能と
なり、演算速度の向上を図ることができるとともに、モ
ジユロnで行う述除算器の論理ゲート量を減少させた簡
易なものとすることができる。
As described above, according to the present invention, x × y (mod
n) can be performed by one modulo arithmetic unit, which can improve the operation speed and reduce the number of logic gates of the predicate-divider performed by modulo n. You can

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

第1図は本発明の一実施例の概略構成を示すブロツク
図、第2図は第1図におけるmod−n演算部の構成を示
すブロツク図、第3図は第2図におけるx×yi演算器の
ブロツク図、第4図は第1図におけるmod−n演算器の
ブロツク図、第5図は従来技術の一例を示すブロツク図
である。 1……x×yi演算器、2……加算器、3……mod−n演
算器、4……2倍器、5,6……mod n演算器、7……x×
y(mod−n)を求める演算部、8……変換部、201……
Xレジスタ、202……Yレジスタ、203……シフタ、204
……ANDゲート、211……入力レジスタ、212……Nレジ
スタ、213……加減算器、214……アキユムレータ、215
……セレクタ。
FIG. 1 is a block diagram showing a schematic configuration of an embodiment of the present invention, FIG. 2 is a block diagram showing a configuration of a mod-n arithmetic unit in FIG. 1, and FIG. 3 is x × y i in FIG. FIG. 4 is a block diagram of the arithmetic unit, FIG. 4 is a block diagram of the mod-n arithmetic unit in FIG. 1, and FIG. 5 is a block diagram showing an example of the prior art. 1 …… x × y i calculator, 2 …… adder, 3 …… mod-n calculator, 4 …… doubler, 5,6 …… mod n calculator, 7 …… xx
Calculation unit for y (mod-n), 8 ... conversion unit, 201 ...
X register, 202 ... Y register, 203 ... shifter, 204
...... AND gate, 211 …… Input register, 212 …… N register, 213 …… Adder / subtractor, 214 …… Akymulator, 215
……selector.

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】与えられた整数x,y,n{但し、x<n,y<n,
y=(ym,ym-1,ym-2,…,y1,y0)}に対して、x×y(mo
d n)を計算する乗除算器において、x×y(mod−n)
を求める演算部と、該演算部により求められた演算結果
をx×y(mod n)に変換する変換部とを備えることを
特徴とする乗除算器。
1. A given integer x, y, n (where x <n, y <n,
y = (y m , y m-1 ,, y m-2 , ..., y 1 , y 0 )}, x × y (mo
In the multiplier / divider that calculates dn), x × y (mod−n)
A multiplier / divider, comprising: a calculation unit for calculating the calculation result and a conversion unit for converting the calculation result calculated by the calculation unit into x × y (mod n).
【請求項2】前記x×y(mod−n)を求める演算部
は、x×yi(但し、i=m,m−1,…,1,0)演算器と、加
算器と、2倍器と、(−n)のモジユロ演算器とから成
り、前記x×yi演算器の出力と前記2倍器の出力とを前
記加算器により加算し、この加算器の出力とを前記(−
n)のモジユロ演算器によりモジユロし、さらに、その
モジユロ出力を前記2倍器により2倍する処理を、iを
mから0までのm+1回繰返すことにより、(−n)の
モジユロ演算器よりx×y(mod−n)を出力すること
を特徴とする特許請求の範囲第1項記載の乗除算器。
2. An arithmetic unit for obtaining the x × y (mod-n) comprises an x × y i (where i = m, m−1, ..., 1,0) arithmetic unit, an adder, and 2 It is composed of a multiplier and a (-n) module operator, and the output of the x × y i calculator and the output of the doubler are added by the adder, and the output of the adder is added to the above ( −
n) is repeated by the modulo arithmetic unit of n), and the process of doubling the modulo output by the doubler is repeated m + 1 times from m to 0 to obtain x from the modulo arithmetic unit of (-n). The multiplier / divider according to claim 1, which outputs xy (mod-n).
JP63038723A 1988-02-23 1988-02-23 Multiplier / divider Expired - Lifetime JP2519288B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63038723A JP2519288B2 (en) 1988-02-23 1988-02-23 Multiplier / divider

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63038723A JP2519288B2 (en) 1988-02-23 1988-02-23 Multiplier / divider

Publications (2)

Publication Number Publication Date
JPH01214927A JPH01214927A (en) 1989-08-29
JP2519288B2 true JP2519288B2 (en) 1996-07-31

Family

ID=12533246

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63038723A Expired - Lifetime JP2519288B2 (en) 1988-02-23 1988-02-23 Multiplier / divider

Country Status (1)

Country Link
JP (1) JP2519288B2 (en)

Also Published As

Publication number Publication date
JPH01214927A (en) 1989-08-29

Similar Documents

Publication Publication Date Title
US4891781A (en) Modulo arithmetic processor chip
JPH1195981A (en) Multiplication circuit
JPH0713742A (en) Multiplier
KR20040092376A (en) Montgomery modular multiplier and method thereof using carry save addition
US7921149B2 (en) Division and square root arithmetic unit
JP2508784B2 (en) Exponential function calculator
JP2519288B2 (en) Multiplier / divider
JP3660075B2 (en) Dividing device
US5258945A (en) Method and apparatus for generating multiples of BCD number
EP0281303A2 (en) Modulo arithmetic processor chip
JP4223819B2 (en) Power residue calculation apparatus and program
JPH0326114A (en) Multiplication remainder operator
JP2951685B2 (en) Fixed-point arithmetic unit
JP2777265B2 (en) High radix square root arithmetic unit
JP2529890B2 (en) Multiplicative remainder calculator
SU960807A2 (en) Function converter
JP4042215B2 (en) Arithmetic processing apparatus and method
JP2803442B2 (en) Square root device
JPH0427587B2 (en)
JPH1049347A (en) Multiplicator
JPH0371332A (en) Remainder multiplying circuit and remainder multiplying method
RU1784975C (en) Arithmetic-integrating device
JP3277497B2 (en) Divider
JPH0253819B2 (en)
JP3277220B2 (en) Operation method of remainder multiplication device