JPH05265713A - Four fundamental rule arithmetic operation unit - Google Patents

Four fundamental rule arithmetic operation unit

Info

Publication number
JPH05265713A
JPH05265713A JP4062244A JP6224492A JPH05265713A JP H05265713 A JPH05265713 A JP H05265713A JP 4062244 A JP4062244 A JP 4062244A JP 6224492 A JP6224492 A JP 6224492A JP H05265713 A JPH05265713 A JP H05265713A
Authority
JP
Japan
Prior art keywords
register
stored
mode
adder
result
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP4062244A
Other languages
Japanese (ja)
Inventor
Atsuyuki Igarashi
篤之 五十嵐
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.)
Omron Corp
Original Assignee
Omron 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 Omron Corp filed Critical Omron Corp
Priority to JP4062244A priority Critical patent/JPH05265713A/en
Publication of JPH05265713A publication Critical patent/JPH05265713A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To simplify the constitution and also to reduce the cost of an arithmetic unit by combining plural registers into a storage means in order to carry out the four fundamental rule arithmetic operations with a single adder. CONSTITUTION:An adder 6 adds the augend stored in a Z register 2c (Z) to the addend stored in a Y register 2b (Y) in an addition mode. The result of this addition is stored in the register (Z). Meanwhile the adder 6 adds the minuend stored in the register Z to the subtrahend stored in the register Y in a subtraction mode. Then, the result of this addition is stored in the register Z. In a multiplication mode, the adder 6 successively adds together the ORs secured of the bits of the multiplicand stored in an Z register 2a (X) with the multiplier stored in the register Y. The result of this addition is stored in the register Z as the result of multiplication. In a division mode, the adder 6 adds the dividend stored in the register Z and the divisor stored in the register Y. Then, the output of the adder 6 is stored in the register X as the result of division.

Description

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

【0001】[0001]

【産業上の利用分野】この発明は、入力された2数につ
いて加減乗除の四則演算を行う四則演算装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a four arithmetic operation device for performing four arithmetic operations of addition, subtraction, multiplication and division on input two numbers.

【0002】[0002]

【従来の技術】入力された2数について四則演算を行う
四則演算装置では、演算部をソフトウェアにより構成し
たものがある。このような構成の演算装置において特に
乗算及び除算の処理を行うためには、必要な命令コード
をメモリに予め記憶しておき、演算モードに応じた命令
コードをメモリから読み出して処理を実行しなければな
らず、演算処理時間が長時間化する問題がある。そこ
で、図11及び図12に示すように、ハードウエアによ
り演算処理を行うようにした四則演算装置がある。
2. Description of the Related Art In some four arithmetic operation devices for performing four arithmetic operations on an inputted two numbers, some arithmetic units are configured by software. In order to perform particularly multiplication and division processing in the arithmetic unit having such a configuration, necessary instruction codes must be stored in advance in the memory, and the instruction code according to the arithmetic mode must be read from the memory to execute the processing. Therefore, there is a problem that the processing time becomes long. Therefore, as shown in FIGS. 11 and 12, there is a four arithmetic operation device in which arithmetic processing is performed by hardware.

【0003】図11に示す乗算装置では、乗算可能なビ
ット幅分の個数の加算器を備え、被乗
The multiplication device shown in FIG. 11 is provided with adders whose number is equal to the bit width by which multiplication is possible.

【0004】数のビット毎に並列に演算処理を実行す
る。たとえば、
The arithmetic processing is executed in parallel for each number of bits. For example,

【数1】に示す乗算処理を行う場合、加算器の前段に設
けられたANDゲート50i(i=1〜n)のそれぞれ
に、乗数をその下位ビットから順に1ビットずつ入力す
るとともに、被乗数を1ビットずつシフトして入力し、
一段目の加算器601においてANDゲート501及び
502の出力を加算する。この一段目の加算器601に
おける加算結果を次段の加算器602に対して3つ目の
ANDゲート503の出力とともに入力する。この時、
加算器601における桁上がりの有無を示すキャリーア
ウトCoが次段の加算器602のキャリーインCiとし
て入力される。このように加算器60i(i=2〜n
1)において前段の加算器における加算結果を加えてい
くことにより、最終算の加算器60n−1の出力を乗算
結果として得ることができる。
When performing the multiplication process shown in [Formula 1], the multiplier is input to each of the AND gates 50i (i = 1 to n) provided in the preceding stage of the adder in order from the lower bit, and the multiplicand is set. Input by shifting 1 bit at a time,
The outputs of the AND gates 501 and 502 are added in the first-stage adder 601. The addition result of the first-stage adder 601 is input to the next-stage adder 602 together with the output of the third AND gate 503. At this time,
Carry-out Co indicating whether or not there is a carry in adder 601 is input as carry-in Ci of adder 602 at the next stage. In this way, the adder 60i (i = 2 to n
By adding the addition result of the previous stage adder in 1), the output of the final addition adder 60n-1 can be obtained as the multiplication result.

【0005】[0005]

【数1】 [Equation 1]

【0006】また、除算装置は図12に示すように、除
数のビット幅分の個数に対応する加
Further, as shown in FIG. 12, the dividing device adds an adder corresponding to the number of bit widths of the divisor.

【0007】算器を備えており、この除算装置において
例えば、
This divider is provided with a calculator, for example,

【数2】に示す除算を行う場合には、加算器70i(i
=1〜n)に対して被乗数の上位桁から順に入力すると
ともに、除数の2の補数または除数そのものを入力し、
それぞれの加算器における加算結果の最上ビットを反転
して除算結果を得るようにしている。この場合二段目の
加算器702以降の加算器においては、前段の加算器に
おける加算結果の最上位ビットをEXNORゲート80
i(i=1〜n−1)に除数とともに入力し、加算器の
入力として除数をそのまま使用するか除数の2の補数を
用いるかを選択するようにしている。
In the case of performing the division shown in Equation 2, the adder 70i (i
= 1 to n) in order from the highest digit of the multiplicand, and the 2's complement of the divisor or the divisor itself,
The most significant bit of the addition result in each adder is inverted to obtain the division result. In this case, in the adders after the second-stage adder 702, the most significant bit of the addition result in the previous-stage adder is set to the EXNOR gate 80.
i (i = 1 to n-1) is input together with the divisor, and it is selected whether the divisor is used as the input of the adder or the two's complement of the divisor is used.

【0008】[0008]

【数2】 [Equation 2]

【0009】[0009]

【発明が解決しようとする課題】しかしながら、上記従
来の四則演算装置では、乗算及び除算において被乗数及
び被除数のビット数に対応する加算器が必要になり、回
路構成が煩雑化および大型化するとともに、コストの上
昇を招く問題があった。
However, in the above-mentioned conventional four arithmetic unit, an adder corresponding to the number of bits of the multiplicand and the dividend is required in multiplication and division, and the circuit configuration becomes complicated and large in size. There was a problem that caused an increase in cost.

【0010】この発明の目的は、単一の加算器により四
則演算の全てを実行できるようにし、装置の構成を簡略
化するとともに、コストダウンを実現することができる
四則演算装置を提供することにある。
An object of the present invention is to provide a four arithmetic operation device capable of executing all four arithmetic operations by a single adder, simplifying the configuration of the device, and realizing cost reduction. is there.

【0011】[0011]

【課題を解決するための手段】この発明の四則演算装置
は、加算、減算、乗算又は除算のいずれかの演算モード
を指定する指定手段と、乗算モードにおける被乗数、又
は除算モードにおける除算結果を記憶する第1の記憶手
段と、加算モードにおける加数、減算モードにおける減
数、乗算モードにおける乗数、又は除算モードにおける
除数を記憶する第2の記憶手段と、加算モードにおける
被加数及び加算結果、減算モードにおける被減数及び減
算結果、乗算モードにおける乗算結果、又は除算モード
における被除数を記憶する第3の記憶手段と、前記第1
〜第3の記憶手段に接続され、各記憶手段に記憶された
データを加算する単一の加算器と、を備えたことを特徴
とする。
A four arithmetic operation device of the present invention stores designation means for designating an operation mode of addition, subtraction, multiplication or division, and a multiplicand in a multiplication mode or a division result in a division mode. And a second storage means for storing an addend in the addition mode, a subtraction in the subtraction mode, a multiplier in the multiplication mode, or a divisor in the division mode, and an augend and an addition result in the addition mode, and subtraction. Third storage means for storing a dividend and a subtraction result in the mode, a multiplication result in the multiplication mode, or a dividend in the division mode;
A single adder that is connected to the third storage means and adds the data stored in each storage means.

【0012】[0012]

【作用】この発明においては、加算モード時に、第3の
記憶手段に記憶された被加数と第2の記憶手段に記憶さ
れた加数とが加算器において加算され、この加算結果が
第3の記憶手段に記憶される。減算モード時には第3の
記憶手段における被減数と第2の記憶手段に記憶された
減数とが加算器において加算され、この加算結果が第2
の記憶手段に記憶される。
In the present invention, in the addition mode, the augend stored in the third storage means and the addend stored in the second storage means are added in the adder, and the addition result is the third addition result. Is stored in the storage means. In the subtraction mode, the minuend stored in the third storage means and the subtraction stored in the second storage means are added in the adder, and the addition result is the second addition result.
Is stored in the storage means.

【0013】乗算モード時には、第1の記憶手段に記憶
された被乗数と第2の記憶手段に記憶された乗数の各ビ
ットとの論理和が加算器において順に加算され、この加
算結果が乗算結果として第3の記憶手段に記憶される。
また、減算モード時には、第3の記憶手段に記憶された
被乗数第2の記憶手段に記憶されている除数とが加算器
において加算され、この加算器の出力が除算結果として
第1の記憶手段に記憶される。したがって、加減乗除の
各演算モードが単一の加算器により実行される。
In the multiplication mode, the logical sum of the multiplicand stored in the first storage means and each bit of the multiplier stored in the second storage means is sequentially added in the adder, and the addition result is the multiplication result. It is stored in the third storage means.
Further, in the subtraction mode, the multiplicand stored in the third storage means and the divisor stored in the second storage means are added in the adder, and the output of this adder is stored in the first storage means as the division result. Remembered. Therefore, each operation mode of addition, subtraction, multiplication and division is executed by a single adder.

【0014】[0014]

【実施例】図1は、この発明の実施例である四則演算装
置の構成を示す図である。四則演算装置1は、X,Y,
Zの3つのレジスタ2a〜2cを備えている。Xレジス
タ2aはこの発明の第1の記憶手段であり、乗算モード
における被乗数、または除算モードにおける除算結果を
記憶する。Yレジスタ2bはこの発明の第2の記憶手段
であり、加算モードにおける加数、減算モードにおける
減数、乗算モードにおける乗数、又は除算モードにおけ
る除数を記憶する。Zレジスタ2cはこの発明の第3の
記憶手段であり、加算モードにおける被加数及び加算結
果、減算モードにおける被減数及び減算結果、乗算モー
ドにおける乗算結果、又は除算モードにおける被除数を
記憶する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 is a diagram showing the configuration of a four arithmetic unit according to an embodiment of the present invention. The four arithmetic units 1 are X, Y,
It has three Z registers 2a to 2c. The X register 2a is the first storage means of the present invention, and stores the multiplicand in the multiplication mode or the division result in the division mode. The Y register 2b is the second storage means of the present invention, and stores the addend in the addition mode, the subtraction in the subtraction mode, the multiplier in the multiplication mode, or the divisor in the division mode. The Z register 2c is the third storage means of the present invention, and stores the augend and addition result in the addition mode, the subtraction and subtraction result in the subtraction mode, the multiplication result in the multiplication mode, or the dividend in the division mode.

【0015】Xレジスタ2aはセレクタ3を介して選択
的にANDゲート4a〜4hのそれぞれに一方の入力と
して供給される。このANDゲート4a〜4hは四則演
算装置1において演算可能なビット数に対応して設けら
れる。また、セレクタ3は演算モードの選択時に設定さ
れるスイッチング信号SW3に応じて開閉し、閉成状態
においてXレジスタ2aの出力であるセレクタ入力Si
をセレクタ出力Soとし、開成時にはセレクタ出力So
の値は“1”となる。
The X register 2a is selectively supplied via the selector 3 to each of the AND gates 4a to 4h as one input. The AND gates 4a to 4h are provided in correspondence with the number of bits that can be calculated in the four arithmetic unit 1. Further, the selector 3 opens and closes according to the switching signal SW3 set when the arithmetic mode is selected, and in the closed state, the selector input Si which is the output of the X register 2a.
Is the selector output So, and when it is opened, the selector output So
The value of is 1.

【0016】Yレジスタ2bが記憶しているデータはE
XNORゲート5a〜5hのそれぞれに一方の入力とし
て供給される。このEXNORゲート5a〜5hはAN
Dゲート4a〜4hと同様に、四則演算装置1において
演算されるビット数に対応して設けられており、その出
力がANDゲート4a〜4hのそれぞれの他方の入力と
される。ANDゲート4a〜4hは、セレクタ3のセレ
クタ出力SoとEXNORゲート5a〜5hの出力との
論理積をとり、この結果を加算器6に入力する。加算器
6にはZレジスタ2cの記憶内容が入力される。加算器
6はZレジスタ2cの記憶内容とANDゲート4a〜4
hの出力とを加算し、この加算結果がZレジスタ2cに
入力される。
The data stored in the Y register 2b is E
It is supplied as one input to each of the XNOR gates 5a to 5h. The EXNOR gates 5a-5h are AN
Similar to the D gates 4a to 4h, they are provided corresponding to the number of bits operated in the four arithmetic operation device 1, and the output thereof is the other input of the AND gates 4a to 4h. The AND gates 4a to 4h take the logical product of the selector output So of the selector 3 and the outputs of the EXNOR gates 5a to 5h, and input the result to the adder 6. The storage content of the Z register 2c is input to the adder 6. The adder 6 stores the contents stored in the Z register 2c and the AND gates 4a to 4
The output of h is added, and the addition result is input to the Z register 2c.

【0017】また、加算器6の出力のうち、最上位ビッ
トの出力信号はXレジスタ2aに入力されるとともに、
フリップフロップ7のD端子に入力される。フリップフ
ロップ7はスイッチング信号SW1,SW2によって設
定されるセット端子及びリセット端子の状態に応じたQ
出力をEXNORゲート5a〜5hの他方の入力として
供給する。また、Qbar出力は加算器6にキャリーイ
ンCiとして入力される。なお、Xレジスタ2aには演
算モードの選択時に設定されるスイッチング信号SW4
が入力され、このスイッチング信号SW4に応じて加算
器6の最上位ビットの出力信号を記憶するか否かを決定
する。
The output signal of the most significant bit of the output of the adder 6 is input to the X register 2a, and
It is input to the D terminal of the flip-flop 7. The flip-flop 7 has a Q according to the states of the set terminal and the reset terminal set by the switching signals SW1 and SW2.
The output is supplied as the other input of the EXNOR gates 5a to 5h. The Qbar output is input to the adder 6 as carry-in Ci. The X register 2a has a switching signal SW4 set when the arithmetic mode is selected.
Is input, and it is determined whether to store the output signal of the most significant bit of the adder 6 according to the switching signal SW4.

【0018】図2は、上記四則演算装置における各モー
ド時のスイッチング信号の設定状態を示す図である。同
図に示すように、加算モード時にはスイッチング信号S
W1のみが“1”にされ、残るスイッチング信号SW2
〜SW4は“0”にされる。
FIG. 2 is a diagram showing a setting state of the switching signal in each mode in the above four arithmetic operation device. As shown in the figure, in the addition mode, the switching signal S
Only W1 is set to "1" and the remaining switching signal SW2
~ SW4 is set to "0".

【0019】スイッチング信号SW1が“1”にされス
イッチング信号SW2が“0”にされることにより、フ
リップフロップ7のQ出力は常に“1”となる。また、
セレクタ3はスイッチング信号SW3が“0”であるこ
とから開成され、そのセレクタ出力Soは“1”とな
る。さらに、スイッチング信号SW4が“0”にされる
ことにより、加算器6の最上位ビットの出力であるXレ
ジスタ2aのレジスタ入力Riが無効とされる。
When the switching signal SW1 is set to "1" and the switching signal SW2 is set to "0", the Q output of the flip-flop 7 is always "1". Also,
The selector 3 is opened because the switching signal SW3 is "0", and the selector output So becomes "1". Further, by setting the switching signal SW4 to "0", the register input Ri of the X register 2a, which is the output of the most significant bit of the adder 6, is invalidated.

【0020】減算モードにおいてはスイッチング信号S
W1及びSW2が反転されることによりフリップフロッ
プ7のQ出力は常に“0”となる。セレクタ3及びXレ
ジスタ2aについては加算モードと同様である。除算モ
ードにおいてはフリップフロップ7のQ出力は加算モー
ドと同様に常時“1”となり、スイッチング信号SW3
が“1”であることからセレクタ3が閉成されてそのセ
レクタ出力Soはセレクタ入力Siの値となる。Xレジ
スタ2aの状態は加算モード及び減算モードと同様であ
る。
In the subtraction mode, the switching signal S
By inverting W1 and SW2, the Q output of the flip-flop 7 is always "0". The selector 3 and the X register 2a are the same as in the addition mode. In the division mode, the Q output of the flip-flop 7 is always "1" as in the addition mode, and the switching signal SW3
Is "1", the selector 3 is closed and its selector output So becomes the value of the selector input Si. The state of the X register 2a is similar to the addition mode and the subtraction mode.

【0021】除算モード時には、スイッチング信号SW
1,SW2がともに“1”にされることからフリップフ
ロップ7のQ出力はD入力の内容となる。また、セレク
タ3の状態は加算モード及び減算モードの状態と同様に
なり、そのセレクタ出力Soは常時“1”となる。加え
て、Xレジスタ2aはスイッチング信号SW4“1”に
されていることからレジスタ入力Riを有効にし、これ
を記憶する。
In the division mode, the switching signal SW
Since both 1 and SW2 are set to "1", the Q output of the flip-flop 7 becomes the content of the D input. The state of the selector 3 is similar to the states of the addition mode and the subtraction mode, and the selector output So thereof is always "1". In addition, since the X register 2a is set to the switching signal SW4 "1", it validates the register input Ri and stores it.

【0022】以上のように構成された四則演算装置を用
いて加算演算処理を行う場合には、Zレジスタ2cに被
加数を設定し、Yレジスタ2bに加数を設定する。これ
とともに、スイッチング信号SW1〜SW4を図2に示
す状態に設定する。これによって、EXNORゲート5
a〜5hのそれぞれに入力されるフリップフロップ7の
Q出力及びANDゲード4a〜4hに入力されるセレク
タ3のセレクタ出力Soはいずれも“1”であるため、
Yレジスタ2bに設定された加数はそのまま加算器6に
入力され、Zレジスタ2cに設定された被加数と加算さ
れ、この加算結果がZレジスタ2cに格納される。
When the addition arithmetic processing is performed using the four arithmetic operation device configured as described above, the augend is set in the Z register 2c and the addend is set in the Y register 2b. At the same time, the switching signals SW1 to SW4 are set to the state shown in FIG. As a result, the EXNOR gate 5
Since the Q output of the flip-flop 7 input to each of a to 5h and the selector output So of the selector 3 input to the AND gates 4a to 4h are both "1",
The addend set in the Y register 2b is input to the adder 6 as it is, added with the augend set in the Z register 2c, and the addition result is stored in the Z register 2c.

【0023】減算モード時には、被減数がZレジスタ2
cに設定され、減数がYレジスタ2bに設定される。こ
れとともに、スイッチング信号SW1〜SW4は図2に
示す状態に設定される。したがって、ANDゲート4a
〜4hに入力されるセレクタ出力Soは“1”である
が、EXNORゲート5a〜5hに入力されるフリップ
フロップ7のQ出力は“0”となり、Yレジスタ2bに
設定された減数は各ビット毎に反転されてEXNORゲ
ート5a〜5hから出力され、加算器6に入力される。
したがって加算器6はZレジスタ2cに設定された被減
数と、Yレジスタ2bに設定された減数の2の補数とを
加算し、結果的に被減数から減数を減算した値がZレジ
スタ2cに格納される。
In the subtraction mode, the minuend is Z register 2
c, and the decrement is set in the Y register 2b. At the same time, the switching signals SW1 to SW4 are set to the state shown in FIG. Therefore, the AND gate 4a
The selector output So input to ~ 4h is "1", but the Q output of the flip-flop 7 input to the EXNOR gates 5a to 5h becomes "0", and the subtraction set in the Y register 2b is set for each bit. Is output from the EXNOR gates 5a to 5h and input to the adder 6.
Therefore, the adder 6 adds the subtrahend set in the Z register 2c and the two's complement of the subtrahend set in the Y register 2b, and as a result, the value obtained by subtracting the subtrahend from the subtrahend is stored in the Z register 2c. ..

【0024】上記四則演算装置1を用いた乗算モード時
の処理を図3に示す。乗算モードの演算の開始にあたっ
て、まずレジスタ2a〜2cの全てを一旦クリアし、ス
イッチング信号SW1,SW2をそれぞれ“1”及び
“0”にしてフリップフロップ7のQ出力を“1”に固
定する。こののち、スイッチング信号SW3を“1”に
してセレクタ3を閉成し、セレクタ出力Soをセレクタ
入力Siとする(n1)。次いで、Xレジスタ2aに乗
数を設定し、Yレジスタ2bに被乗数を設定する(n
2)。
FIG. 3 shows the processing in the multiplication mode using the above four arithmetic unit 1. To start the operation in the multiplication mode, first, all of the registers 2a to 2c are once cleared, and the switching signals SW1 and SW2 are set to "1" and "0", respectively, and the Q output of the flip-flop 7 is fixed to "1". After that, the switching signal SW3 is set to "1" to close the selector 3 and the selector output So is used as the selector input Si (n1). Next, a multiplier is set in the X register 2a and a multiplicand is set in the Y register 2b (n
2).

【0025】この状態で例えば前述のIn this state, for example, the above-mentioned

【数1】に示す乗算処理を行う場合には、Xレジスタ2
aに設定されている乗数“1001”がその最下位ビッ
トから順に1ビットずつセレクタ3を介してANDゲー
ト4a〜4hのそれぞれに入力され、Yレジスタ2bに
設定された被乗数“1101”が1ビットずつEXNO
Rゲート5a〜5dのそれぞれを介してANDゲート4
a〜4dに入力される。いま、Xレジスタ2aに設定さ
れている乗数“1001”の最下位ビットは“1”であ
るため、ANDゲート4a〜4dを介して加算器6には
被乗数“1101”がそのまま入力され、クリア状態の
ままのZレジスタ2cの内容と加算される。したがっ
て、加算器6の出力は“1101”となり、この状態の
ままZレジスタ2cに格納される。(n3〜n5)。
When performing the multiplication process shown in [Formula 1], the X register 2
The multiplier "1001" set in a is input to the AND gates 4a to 4h one by one in order from the least significant bit through the selector 3, and the multiplicand "1101" set in the Y register 2b is 1 bit. EXNO
AND gate 4 via each of R gates 5a-5d
a to 4d. Now, since the least significant bit of the multiplier "1001" set in the X register 2a is "1", the multiplicand "1101" is directly input to the adder 6 via the AND gates 4a to 4d and is in the clear state. It is added to the contents of the Z register 2c as it is. Therefore, the output of the adder 6 becomes "1101" and is stored in the Z register 2c in this state. (N3-n5).

【0026】次いでYレジスタ2bに設定されている値
を左(上位側)に1ビットシフトする(n6)。このよ
うにしてシフトされた被乗数をEXNORゲート5b〜
5eを介してANDゲート4b〜4eに入力する。この
時、ANDゲート4b〜4eにはXレジスタ2aに記憶
されている最下位から二番目のビットのデータ“0”が
セレクタ3を介して入力されており、加算器6にはAN
Dゲート4b〜4eの出力として“0000”が1ビッ
ト分左へシフトした状態で入力される。このデータがZ
レジスタ2cに格納されている“1101”と加算さ
れ、再びZレジスタ2cに格納される。
Next, the value set in the Y register 2b is shifted to the left (upper side) by 1 bit (n6). The multiplicand shifted in this way is transferred to the EXNOR gates 5b ...
Input to the AND gates 4b to 4e via 5e. At this time, the data “0” of the second least significant bit stored in the X register 2a is input to the AND gates 4b to 4e through the selector 3 and the adder 6 receives the AN signal.
As an output of the D gates 4b to 4e, "0000" is input in a state of being shifted left by one bit. This data is Z
It is added to "1101" stored in the register 2c and stored again in the Z register 2c.

【0027】以上のようにして、乗数の各ビットについ
て被乗数との論理積をとり、この結果をZレジスタ2c
に格納されている前回の加算結果と加算する処理(n3
〜n6)を繰り返し行う。これによって、Zレジスタ2
cには最終的に被乗数と乗数との乗算結果が格納される
ことになる。
As described above, each bit of the multiplier is ANDed with the multiplicand, and the result is obtained in the Z register 2c.
Process of adding the previous addition result stored in (n3
~ N6) is repeated. This allows the Z register 2
Finally, the result of multiplication of the multiplicand and the multiplier is stored in c.

【0028】上記四則演算装置1を用いた除算モード時
の処理手順を図4に示す。除算モードの演算処理の開始
にあたって、まずレジスタ2a〜2cがクリアされると
ともに、スイッチング信号SW3を“0”としてセレク
タ3を開成する(n11)。
FIG. 4 shows a processing procedure in the division mode using the above four arithmetic unit 1. When the arithmetic processing in the division mode is started, the registers 2a to 2c are first cleared and the switching signal SW3 is set to "0" to open the selector 3 (n11).

【0029】これによってセレクタ3のセレクタ出力S
oは常に“1”にされる。次いで、Zレジスタ2cに被
除数を設定し、Yレジスタ2bに除数を設定する(n1
2)。
As a result, the selector output S of the selector 3
o is always set to "1". Next, the dividend is set in the Z register 2c and the divisor is set in the Y register 2b (n1
2).

【0030】例えば、前述のFor example, the above-mentioned

【数2】に示した除算演算を行う場合には、Zレジスタ
2cに“011010”が設定され、Yレジスタ2bに
“011”が設定される。次いで、Yレジスタ2bに設
定されている除数011の値とフリップフロップ7のQ
出力との排他的論理和否定をとり、EXNORゲート5
a〜5cの出力としてANDゲート4a〜4cを介して
加算器6に入力する。
When the division operation shown in Equation 2 is performed, "011010" is set in the Z register 2c and "011" is set in the Y register 2b. Then, the value of the divisor 011 set in the Y register 2b and the Q of the flip-flop 7 are set.
EXNOR gate 5
The outputs a to 5c are input to the adder 6 via the AND gates 4a to 4c.

【0031】一方、Zレジスタ2cから被除数の上位3
ビットのデータ“011”を加算器6に入力し、AND
ゲート4a〜4cの出力と加算する(n14)。除算モ
ードにおいては図2に示すようにスイッチング信号SW
1,SW2はいずれも“1”であるため、フリップフロ
ップ7のQ出力はD入力の値となる。演算処理の開始に
あたって加算器6の出力は全て“0”であり、EXNO
Rゲート5a〜5hに入力されるQ出力は“0”となっ
ている。
On the other hand, the upper 3 of the dividend from the Z register 2c
Input the bit data “011” to the adder 6 and perform AND
It is added to the outputs of the gates 4a to 4c (n14). In the division mode, the switching signal SW as shown in FIG.
Since both 1 and SW2 are "1", the Q output of the flip-flop 7 becomes the value of the D input. When the arithmetic processing is started, the outputs of the adder 6 are all "0", and the EXNO
The Q output input to the R gates 5a to 5h is "0".

【0032】したがって、最初のn13の処理において
EXNOR5a〜5cの出力はYレジスタ2Bに設定さ
れた除数“011”の2の補数“101”となり、加算
器6は被除数の上位3ビットのデータ“011”と除数
の2の補数“101”とを加算し、この加算結果である
加算器6の出力のうち最上位ビットのデータがXレジス
タ2aに格納される(n14)。なお、加算器6の出力
のうち最上位ビットのデータがフリップフロップ7のD
端子に入力される。
Therefore, in the first processing of n13, the outputs of EXNORs 5a to 5c become the two's complement "101" of the divisor "011" set in the Y register 2B, and the adder 6 outputs the data "011" of the upper 3 bits of the dividend. "And the two's complement of the divisor" 101 "are added, and the data of the most significant bit of the output of the adder 6 which is the addition result is stored in the X register 2a (n14). The data of the most significant bit of the output of the adder 6 is D of the flip-flop 7.
Input to the terminal.

【0033】上記n13,n14の処理は前段の加算結
果の下位2桁のデータと被除数の次の桁のデータとを用
いて順次実行されるが、各加算処理におけるEXNOR
ゲート5a〜5cからの出力は前回の加算結果の最上位
ビットの内容に応じて変化する。すなわち、前段の加算
結果における最上位ビットが“0”である場合には加算
器6には除数の2の補数“101”が入力され、前段の
加算結果の最上位ビットが“1”である場合には除数
“011”がそのまま加算器6に入力される。このよう
にして各加算結果の最上位ビットを順にXレジスタ2a
に格納し、Xレジスタ2aに格納されているデータを反
転して除算結果とすることができる。この反転に際して
はXレジスタ2aは公知のように複数のフリップフロッ
プによって構成されていることから、各フリップフロッ
プにおけるQbar出力を取り出すことによって容易に
得られる。
The processing of n13 and n14 is sequentially executed by using the data of the lower two digits of the addition result of the preceding stage and the data of the digit next to the dividend. EXNOR in each addition processing
The outputs from the gates 5a to 5c change according to the contents of the most significant bit of the previous addition result. That is, when the most significant bit in the previous addition result is "0", the two's complement "101" of the divisor is input to the adder 6, and the most significant bit of the previous addition result is "1". In this case, the divisor “011” is directly input to the adder 6. In this way, the most significant bit of each addition result is sequentially set to the X register 2a.
, And the data stored in the X register 2a can be inverted to obtain the division result. At the time of this inversion, since the X register 2a is composed of a plurality of flip-flops as is well known, it can be easily obtained by taking out the Qbar output from each flip-flop.

【0034】以上のようにしてこの実施例によれば、各
演算モードにおいてレジスタ2a〜2cに設定する内容
を変えるとともに、スイッチング信号SW1〜SW4を
図2に示すように設定することにより、単一の加算器6
を用いて四則演算の全てを実行することができる。
As described above, according to this embodiment, the contents set in the registers 2a to 2c in each operation mode are changed and the switching signals SW1 to SW4 are set as shown in FIG. Adder 6
Can be used to perform all four arithmetic operations.

【0035】図5は、上記四則演算装置を用いたファジ
ィ推論装置の構成を示すブロック図である。ファジィ推
論装置11は、ファジィルール及びメンバシップ関数を
記憶するROM12、このファジィルール及びメンバシ
ップ関数を用いた演算結果を一時記憶するRAM13、
ファジィルールの条件部を構成する入力データが入力さ
れるとともに、推論結果を出力する入出力部14ファジ
ィ推論に係る演算処理を行う四則演算部15及びファジ
ィ推論に係る順次処理を制御するシーケンス制御回路1
6とによって構成されている。このうち四則演算部15
がこの発明の四則演算装置によって構成されている。
FIG. 5 is a block diagram showing the configuration of a fuzzy inference device using the above four arithmetic operations device. The fuzzy inference apparatus 11 includes a ROM 12 for storing fuzzy rules and membership functions, a RAM 13 for temporarily storing results of operations using the fuzzy rules and membership functions,
An input / output unit 14 for inputting input data that constitutes a conditional unit of a fuzzy rule, and an input / output unit 14 for outputting an inference result. A four arithmetic unit 15 for performing arithmetic processing related to fuzzy inference and a sequence control circuit for controlling sequential processing related to fuzzy inference. 1
6 and 6. Of these, the four arithmetic operations section 15
Is configured by the four arithmetic operation device of the present invention.

【0036】図6は上記ファジィ推論装置におけるファ
ジィ推論に用いられる条件部メンバシップ関数を示す図
である。同図に示すように条件部メンバシップ関数は三
角形形状を呈し、各ラベルに対する適合度Yを各メンバ
シップ関数の最小の座標値と傾きとによって表してい
る。すなわち、入力データの適合度Yは、 Y=(PI−Pm)×Am で与えられる。この適合度Yを算出する処理手順を図7
に示す。入力データPIの入力を受け付けると(n2
1)、この入力PIが所属するラベルの検索を行う(n
22〜n25)。このラベルの検索にあたってはRAM
13の所定のメモリエリアに割り当てられたカウンタm
を用いて、入力データPIの値と各ラベルの座標Pmと
を比較し、入力PIの値が座標データPmを上回った際
のラベルを適合ラベルとする。
FIG. 6 is a diagram showing a conditional part membership function used for fuzzy inference in the fuzzy inference apparatus. As shown in the figure, the conditional part membership function has a triangular shape, and the goodness of fit Y for each label is represented by the minimum coordinate value and slope of each membership function. That is, the goodness of fit Y of the input data is given by Y = (PI-Pm) × Am. The processing procedure for calculating the goodness of fit Y is shown in FIG.
Shown in. When the input of the input data PI is accepted (n2
1), the label to which this input PI belongs is searched (n
22-n25). RAM for searching this label
Counter m allocated to 13 predetermined memory areas
Is used to compare the value of the input data PI with the coordinate Pm of each label, and the label when the value of the input PI exceeds the coordinate data Pm is set as the compatible label.

【0037】この後、前述の四則演算装置1を用いて前
記適合度Yの演算式のうち、まず、(PI−Pm)の演
算を行う。すなわち、図1に示すZレジスタ2cに入力
PIの値を設定し、Yレジスタ2bに入力PIが該当す
るラベルの左辺の入力軸との交点位置Pmの値を設定
し、スイッチング信号SW1〜SW4を図2に示す減算
モード時における状態に設定し、前述の減算モードの演
算処理を実行する(n27)。次いで、Yレジスタ2b
に該当するラベルの傾きAmをROM12から読み出し
て設定するとともに、Xレジスタ2aに(PI−Pm)
の減算結果であるZレジスタ2cの内容を設定する(n
27)。このXレジスタ2a,Yレジスタ2bを用いて
加算器6により傾きAmを乗算する演算処理を実行する
(n28,n29)。以上の処理により条件部における
入力データPIの適合度Yが求まる。
After that, using the above-mentioned arithmetic device 1 for four rules, first, in the arithmetic expression of the compatibility Y, (PI-Pm) is calculated. That is, the value of the input PI is set in the Z register 2c shown in FIG. 1, the value of the intersection position Pm with the input axis on the left side of the label to which the input PI corresponds is set in the Y register 2b, and the switching signals SW1 to SW4 are set. The subtraction mode shown in FIG. 2 is set to the state, and the above-described subtraction mode arithmetic processing is executed (n27). Then, the Y register 2b
The inclination Am of the label corresponding to is read out from the ROM 12 and set, and the X register 2a stores (PI-Pm)
Set the contents of the Z register 2c which is the subtraction result of (n
27). Using the X register 2a and the Y register 2b, the adder 6 executes the arithmetic processing for multiplying the gradient Am (n28, n29). Through the above processing, the conformance degree Y of the input data PI in the condition part is obtained.

【0038】図8は、上記ファジィ推論装置11におけ
るファジィ推論に用いられる結論部のシングルトンを示
す図である。このシングルトンを用いて条件部の適合度
yから重心値演算によりファジィ推論の確定値を求める
ための処理手順を図9に示す。図8に示すシングルトン
において重心Gは、 G=(ΣXY)/ΣY によって得られる。このため、重心値演算においてRA
M13に割当てられたレジスタBにおいて各シングルト
ンの高さymを順次加算する。次いで、Xレジスタ2a
にシングルトンの座標値xmを設定し、Yレジスタ2b
に高さymを設定する(n32)。このXレジスタ2a
及びYレジスタ2bを用いてx×yの乗算を行い、Zレ
ジスタ2cに乗算結果を格納する(n33)。このn3
1〜n33の処理を全てのシングルトンについて実行す
る(n34,n35)。
FIG. 8 is a diagram showing a singleton of the conclusion part used for the fuzzy inference in the fuzzy inference apparatus 11. FIG. 9 shows a processing procedure for obtaining a definite value of fuzzy inference by calculating the centroid value from the goodness of fit y of the conditional part using this singleton. The center of gravity G in the singleton shown in FIG. 8 is obtained by G = (ΣXY) / ΣY. Therefore, in the calculation of the center of gravity, RA
In the register B assigned to M13, the height ym of each singleton is sequentially added. Then, the X register 2a
Set the coordinate value xm of the singleton to Y register 2b
The height ym is set to (n32). This X register 2a
And the Y register 2b are used to perform x × y multiplication, and the multiplication result is stored in the Z register 2c (n33). This n3
The processes 1 to n33 are executed for all singletons (n34, n35).

【0039】この時、各シングルトンについてのx及び
yの値のみをXレジスタ2a及びYレジスタ2bに設定
することにより、各シングルトンについてのΣx×yの
演算結果をZレジスタ2cに累積的に格納していくこと
ができる。すなわち、各シングルトンにおけるx×yの
処理にあたって乗数の最下位ビットから順に被乗数との
論理積演算が行われ、各ビットの論理積演算結果がZレ
ジスタ2cにおいて加算されるため、一つのシングルト
ンについての乗算結果がZレジスタ2cに格納されてお
り、次のシングルトンについての乗算処理においても先
の乗算結果が格納されているZレジスタ2cの内容に、
今回の乗算処理における乗数のビット毎の論理積結果を
順次加算することでΣxyを求めることができる。
At this time, by setting only the x and y values for each singleton in the X register 2a and the Y register 2b, the operation result of Σx × y for each singleton is cumulatively stored in the Z register 2c. You can go. That is, in the process of x × y in each singleton, the logical product operation with the multiplicand is performed in order from the least significant bit of the multiplier, and the logical product operation result of each bit is added in the Z register 2c. The multiplication result is stored in the Z register 2c, and the contents of the Z register 2c in which the previous multiplication result is stored in the multiplication process for the next singleton also include:
Σxy can be obtained by sequentially adding the bitwise logical product results of the multipliers in this multiplication process.

【0040】以上の処理においてΣyの値がRAM13
内のレジスタBに記憶され、Σxyの値がZレジスタ2
cに記憶される。この記憶内容を用いて受信Gを求める
演算を次に行う。すなわち、Yレジスタ2bにレジスタ
Bの記憶内容を設定し(n36)、Σxyの演算処理に
おいて既にZレジスタ2cに記憶されている被除数をY
レジスタ2bの値で除算する。この除算結果における最
上位ビットMSB(Z/Y)をXレジスタ2aに格納す
る(n37)。この除算結果としてXレジスタ2aに格
納された値を反転した値がファジィ推論の推論結果であ
る重心値Gの値となる。
In the above processing, the value of Σy is the RAM 13
The value of Σxy stored in the register B in the Z register 2
stored in c. Next, a calculation for obtaining the reception G is performed using this stored content. That is, the storage content of the register B is set in the Y register 2b (n36), and the dividend already stored in the Z register 2c in the calculation process of Σxy is set to Y.
Divide by the value of register 2b. The most significant bit MSB (Z / Y) in this division result is stored in the X register 2a (n37). The value obtained by inverting the value stored in the X register 2a as the result of this division becomes the value of the center of gravity G which is the inference result of the fuzzy inference.

【0041】以上のようにしてこの実施例によれば、四
則演算部16に本発明の四則演算装置1を用いてファジ
ィ推論を実行することができる。このように、ファジィ
推論装置11の一部に本発明の四則演算装置1を用いる
ことにより、ファジィ推論装置11の構成を簡略化し、
省スペース化及びコストの低減を実現できる利点があ
る。また、乗算処理及び除算処理でビット幅の回路基板
に与える影響が小さいため、設計前の回路規模の見積も
りが容易で、また見積もり違いを起こし難い利点があ
る。
As described above, according to this embodiment, the four arithmetic operations device 16 of the present invention can be used in the four arithmetic operations unit 16 to execute fuzzy inference. As described above, by using the four arithmetic operations device 1 of the present invention as a part of the fuzzy inference device 11, the configuration of the fuzzy inference device 11 is simplified,
There is an advantage that space saving and cost reduction can be realized. Further, since the multiplication process and the division process have a small influence on the circuit board having the bit width, it is easy to estimate the circuit scale before designing, and there is an advantage that an estimation difference is unlikely to occur.

【0042】[0042]

【発明の効果】この発明によれば、単一の加算器によっ
て四則演算の全てを実行することができるため、乗算演
算及び除算演算において乗数及び除数のビット分の加算
器を必要としていた従来の演算装置に比べて構成を極め
て簡略化することができ、装置の小型化及びコストダウ
ンを実現できる利点がある。また、乗除演算におけるビ
ット幅が回路規模に与える影響が少なく、設計時におけ
る回路規模の見積もりが容易になる利点がある。
According to the present invention, since all four arithmetic operations can be executed by a single adder, it is necessary to use an adder for multiplier and divisor bits in multiplication and division operations. Compared with the arithmetic device, the configuration can be extremely simplified, and there is an advantage that the device can be downsized and the cost can be reduced. In addition, there is little influence that the bit width in the multiplication / division operation has on the circuit scale, and there is an advantage that the circuit scale can be easily estimated at the time of design.

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

【図1】この発明の実施例である四則演算装置の構成を
示す図である。
FIG. 1 is a diagram showing a configuration of a four arithmetic operation device according to an embodiment of the present invention.

【図2】同四則演算装置における各演算モードにおける
スイッチング信号の設定状態を示す図である。
FIG. 2 is a diagram showing a setting state of a switching signal in each arithmetic mode in the same four arithmetic operation device.

【図3】上記四則演算装置における乗算モードの処理手
順を示すフローチャートである。
FIG. 3 is a flowchart showing a processing procedure of a multiplication mode in the four arithmetic operation device.

【図4】同四則演算装置における除算モードの処理手順
を示すフローチャートである。
FIG. 4 is a flowchart showing a processing procedure of a division mode in the arithmetic device of the same four rules.

【図5】同四則演算装置を用いたファジィ推論装置の構
成を示す図である。
FIG. 5 is a diagram showing a configuration of a fuzzy inference device using the same four arithmetic operation device.

【図6】同ファジィ推論装置におけるファジィ推論に用
いられる条件部メンバシップ関数を表す図である。
FIG. 6 is a diagram showing a condition part membership function used for fuzzy inference in the fuzzy inference apparatus.

【図7】同ファジィ推論装置における条件部の所属度の
演算処理手順を示すフローチャートである。
FIG. 7 is a flowchart showing a procedure for calculating a degree of belonging to a conditional part in the fuzzy inference apparatus.

【図8】同ファジィ推論装置におけるファジィ推論に用
いられる結論部シングルトンを示す図である。
FIG. 8 is a diagram showing a conclusion part singleton used for fuzzy inference in the fuzzy inference apparatus.

【図9】同ファジィ推論装置における重心値演算処理手
順を示すフローチャートである。
FIG. 9 is a flowchart showing a procedure of a centroid value calculation processing in the fuzzy inference apparatus.

【図10】従来の四則演算装置における乗算処理部の構
成を示す図である。
FIG. 10 is a diagram showing a configuration of a multiplication processing unit in a conventional four arithmetic operation device.

【図11】同従来の四則演算装置の除算処理部の構成を
示す図である。
FIG. 11 is a diagram showing a configuration of a division processing unit of the conventional four arithmetic operation device.

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

1−四則演算装置 2a−Xレジスタ(第1の記憶手段) 2b−Yレジスタ(第2の記憶手段) 2c−Zレジスタ(第3の記憶手段) 3−セレクタ(指定手段) 6−加算器 7−フリップフロップ(指定手段) 1-Four arithmetic operation device 2a-X register (first storage means) 2b-Y register (second storage means) 2c-Z register (third storage means) 3-Selector (designating means) 6-Adder 7 -Flip-flop (designating means)

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】加算、減算、乗算又は除算のいずれかの演
算モードを指定する指定手段と、 乗算モードにおける被乗数、又は除算モードにおける除
算結果を記憶する第1の記憶手段と、 加算モードにおける加数、減算モードにおける減数、乗
算モードにおける乗数、又は除算モードにおける除数を
記憶する第2の記憶手段と、 加算モードにおける被加数及び加算結果、減算モードに
おける被減数及び減算結果、乗算モードにおける乗算結
果、又は除算モードにおける被除数を記憶する第3の記
憶手段と、 前記第1〜第3の記憶手段に接続され、各記憶手段に記
憶されたデータを加算する単一の加算器と、 を備えたことを特徴とする四則演算装置。
1. Designating means for designating an operation mode of addition, subtraction, multiplication or division; first storage means for storing a multiplicand in a multiplication mode or a division result in a division mode; and addition in an addition mode. Second storage means for storing a number, a subtraction in the subtraction mode, a multiplier in the multiplication mode, or a divisor in the division mode, and an augend and an addition result in the addition mode, a subtraction and subtraction result in the subtraction mode, and a multiplication result in the multiplication mode. , Or a third storage means for storing the dividend in the division mode, and a single adder connected to the first to third storage means and adding the data stored in each storage means. A four arithmetic unit characterized by the above.
JP4062244A 1992-03-18 1992-03-18 Four fundamental rule arithmetic operation unit Pending JPH05265713A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4062244A JPH05265713A (en) 1992-03-18 1992-03-18 Four fundamental rule arithmetic operation unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4062244A JPH05265713A (en) 1992-03-18 1992-03-18 Four fundamental rule arithmetic operation unit

Publications (1)

Publication Number Publication Date
JPH05265713A true JPH05265713A (en) 1993-10-15

Family

ID=13194538

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4062244A Pending JPH05265713A (en) 1992-03-18 1992-03-18 Four fundamental rule arithmetic operation unit

Country Status (1)

Country Link
JP (1) JPH05265713A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102428398B1 (en) * 2021-03-17 2022-08-02 주식회사 모르미 Parallel processing appratus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102428398B1 (en) * 2021-03-17 2022-08-02 주식회사 모르미 Parallel processing appratus
WO2022197091A1 (en) * 2021-03-17 2022-09-22 주식회사 모르미 Parallel processing device

Similar Documents

Publication Publication Date Title
US5357237A (en) In a data processor a method and apparatus for performing a floating-point comparison operation
US6349318B1 (en) Arithmetic processor for finite field and module integer arithmetic operations
US5440702A (en) Data processing system with condition code architecture for executing single instruction range checking and limiting operations
EP0530372B1 (en) Numerical expression converter and vector processor using the same
US5426600A (en) Double precision division circuit and method for digital signal processor
US5195052A (en) Circuit and method for performing integer power operations
JP3529622B2 (en) Arithmetic circuit
US5867413A (en) Fast method of floating-point multiplication and accumulation
US4979142A (en) Two-bit floating point divide circuit with single carry-save adder
US5297073A (en) Integer divide using shift and subtract
US4410956A (en) Exponential operation device
JP2857505B2 (en) Division device
US5377135A (en) High cardinal number type non-restoring divider reducing delay time for adding two numbers
JPH05265713A (en) Four fundamental rule arithmetic operation unit
US7206800B1 (en) Overflow detection and clamping with parallel operand processing for fixed-point multipliers
US7236999B2 (en) Methods and systems for computing the quotient of floating-point intervals
JP2972326B2 (en) Square root calculator
US6792442B1 (en) Signal processor and product-sum operating device for use therein with rounding function
US20030037088A1 (en) Speed of execution of a conditional subtract instruction and increasing the range of operands over which the instruction would be performed correctly
JP3074910B2 (en) Division device
JP3461706B2 (en) Digit serial multiplier
SU943709A1 (en) Arithmetic-logic device
Montuschi et al. Simple radix 2 division and square root with skipping of some addition steps
JPH04314126A (en) Inverse number generating device
JP3441847B2 (en) Processor with data memory