JPH02165326A - Non-recovery type divider - Google Patents

Non-recovery type divider

Info

Publication number
JPH02165326A
JPH02165326A JP63321183A JP32118388A JPH02165326A JP H02165326 A JPH02165326 A JP H02165326A JP 63321183 A JP63321183 A JP 63321183A JP 32118388 A JP32118388 A JP 32118388A JP H02165326 A JPH02165326 A JP H02165326A
Authority
JP
Japan
Prior art keywords
bit
register
dividend
remainder
negative
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
JP63321183A
Other languages
Japanese (ja)
Other versions
JP2605848B2 (en
Inventor
Ichiro Yamane
一郎 山根
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP63321183A priority Critical patent/JP2605848B2/en
Publication of JPH02165326A publication Critical patent/JPH02165326A/en
Application granted granted Critical
Publication of JP2605848B2 publication Critical patent/JP2605848B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Abstract

PURPOSE:To execute division by the same algorithm even when a dividend is negative by providing the divider with a register capable of setting/resetting one bit. CONSTITUTION:The divider is constituted of an n-bit register(SRH) 1, an m-bit register(SRL) 2, an n-bit register(DR) 3, an adder/subtractor 4, and the register 5 capable of setting/resetting one bit. The register 5 is set up when the operated result of each line is '0' to discriminate that a partial residual is '0' and is reset when '1' is inputted to the least significant bit of each line of a dividend and a quotient is corrected by using the result of the register 5. Since the register capable of setting/resetting one bit is provided, division can be executed by the same algorithm even when a dividend is negative.

Description

【発明の詳細な説明】 産業上の利用分野 本発明は、1ビツトのセット、リセット可能なレジスタ
を設けることにより、符号付きの除算を高速に行うこと
のできる非回復型除算器に関するものである。
DETAILED DESCRIPTION OF THE INVENTION Field of Industrial Application The present invention relates to a non-recovery divider that can perform signed division at high speed by providing a register that can set and reset one bit. .

従来の技術 第2図は、従来の非回復型除算器のブロック図である。Conventional technology FIG. 2 is a block diagram of a conventional non-recovery divider.

第2図において、1は、nビットのレジスタ(SRH)
、2は、mビットのレジスタ(SRL)、3は、nビッ
トのレジスタ(DR)、4は、上記5RHIに上記DR
3を加算または減算する加減算器である。
In Figure 2, 1 is an n-bit register (SRH)
, 2 is the m-bit register (SRL), 3 is the n-bit register (DR), and 4 is the DR to the 5RHI.
This is an adder/subtractor that adds or subtracts 3.

非回復型除算では回復のための加算が不要であるが、か
わりに前の行での加減算器出力の符号と被除数の符号が
一致するか否かによって、各行での演算を加算と減算に
切り変える必要がある。つまり、減算が失敗したために
部分剰余の符号が被除数と反対になったときには、商と
しては“0”を生成すると同時に、次の行では除数を加
算せねばならない。また、部分剰余の符号が反転しない
ときには、商を1とし、次の行では減算をしなければな
らない。
Non-recovery division does not require addition for recovery, but instead the operation in each row is divided into addition and subtraction depending on whether the sign of the adder/subtractor output in the previous row matches the sign of the dividend. It needs to change. In other words, when the sign of the partial remainder becomes opposite to the dividend due to a failure in subtraction, it is necessary to generate "0" as the quotient and at the same time add the divisor in the next line. Also, if the sign of the partial remainder is not reversed, the quotient must be set to 1 and subtraction must be performed in the next line.

表1に計算例を示す。Table 1 shows an example of calculation.

表1 例: 被除数S =(0,101001)2=(41/64)
10除数D=(0,111)2=(7/8)+。
Table 1 Example: Dividend S = (0,101001)2=(41/64)
10 divisor D=(0,111)2=(7/8)+.

TC:2の補数、  SF4:部分剰余。TC: Two's complement, SF4: Partial remainder.

符号ビット ↓ 被除数S        0.101001負0:)S
R1,110001<OQO=O5Rをシフト    
 1.10001DIを加算      0.111 正(7)SR0,01101>OQl =ISitをシ
フト     0.1101DRを減1      1
.OQl 負のSR1,1111<OQ2=O SRをシフト     1. l1l ORを加算      0.111 正(7)SR0,110>OQ3=1 商Q =QO,QIQ2Q3 =(Q、 101)t 
=(5/8)t。
Sign bit ↓ Dividend S 0.101001 negative 0:)S
Shift R1, 110001<OQO=O5R
Add 1.10001DI 0.111 Positive (7) SR0,01101>OQl = Shift ISit Decrease 0.1101DR 1 1
.. OQl Negative SR1, 1111<OQ2=O Shift SR 1. l1l Add OR 0.111 Positive (7) SR0,110>OQ3=1 Quotient Q =QO,QIQ2Q3 =(Q, 101)t
=(5/8)t.

剰余R=<0.00r3r4rsrs)z =(0,0
00110)2=(6/64)+。
Remainder R=<0.00r3r4rsrs)z=(0,0
00110)2=(6/64)+.

回復型除算 非回復型除算 第1 サイクル 一〇 +D(回復) 一〇 第2 サイクル −D/2 +D/2 本質的 演算 −D/2 D/2 試行演算が失敗したときに除数を右にシフト後−結果を
得ている。つまり、回復型2進除算において再び加算し
て部分剰余を回復後、除数を右にシフトして(除数のよ
)減算した場合と同一結果を得る。表2はこの対応を表
にしたものである。
Recoverable division Non-recoverable division 1st cycle 10 + D (recovery) 10th cycle - D/2 + D/2 Essential operation - D/2 D/2 Shift the divisor to the right when the trial operation fails After - getting results. In other words, in recovery binary division, after recovering the partial remainder by adding again, the divisor is shifted to the right (as in the divisor) to obtain the same result as subtraction. Table 2 shows this correspondence.

すなわち、第2図においての符号なし2進数の除算の動
作は次のようになる。5RHIは最初“0”が代入され
、5RL2は正の被除数Sが代入され、DR3は正の除
数りが代入される。次に、5RHI、5RL2は1ビツ
ト左ヘシフトされ、その後S RH1よりDR3を減算
し、その結果を5RHIへ返す。また、そのときの部分
剰余、即ち、加減算器の出力が負であれば減算失敗とし
て“0”を、そうでなければ“1°゛を5RL2の最下
位ビットに代入する。
That is, the operation of division of unsigned binary numbers in FIG. 2 is as follows. Initially, "0" is assigned to 5RHI, a positive dividend S is assigned to 5RL2, and a positive divisor S is assigned to DR3. Next, 5RHI and 5RL2 are shifted to the left by 1 bit, and then DR3 is subtracted from SRH1, and the result is returned to 5RHI. Further, if the partial remainder at that time, that is, the output of the adder/subtractor is negative, "0" is assigned as a failure of subtraction, otherwise "1°" is assigned to the least significant bit of 5RL2.

次に、また、5RHI、5RL2を1ビツト左ヘシフト
し、先の加減算結果に基づき、加減算を行い、その結果
をS R,H1へ返す。また部分剰余の正負により、“
1”又は”0”を5RL2の最下位ビットに代入する。
Next, 5RHI and 5RL2 are shifted to the left by 1 bit, addition and subtraction are performed based on the previous addition and subtraction results, and the results are returned to SR and H1. Also, depending on the sign of the partial remainder, “
1” or “0” is assigned to the least significant bit of 5RL2.

あとは、これを合計出回繰り返す。Then repeat this a total of times.

すると、商は5RL2に残り、余は5RHIに残る。但
し、余は負になることが考えられるので、負の場合は最
後の減算に失敗したとして余を回復、即ち、除数りを加
算してやらねばならない。
Then, the quotient remains in 5RL2 and the remainder remains in 5RHI. However, since the remainder may be negative, if it is negative, it is assumed that the last subtraction has failed and the remainder must be recovered, that is, the divisor must be added.

発明が解決しようとする課題 しかしながら上記従来の構成では、正の数しが扱えず負
の数の場合は一度正に直してから演算し、演算後、再び
、商余を必要であれば負へ戻すという操作が必要である
という欠点を有していた。
Problems to be Solved by the Invention However, the conventional configuration described above cannot handle positive numbers, and in the case of a negative number, it is first corrected to positive before calculation is performed, and after the calculation, the quotient and remainder are changed to negative again if necessary. It had the disadvantage that it required an operation to return it.

本発明は、上記従来の問題点を解決するもので、1ビツ
トのセット、リセット可能なレジスタを設けることによ
り、被除数が負である場合にも同一アルゴリズムで除算
が行える非回復型除算器を提供することを目的としてい
る。
The present invention solves the above conventional problems, and provides a non-recovery divider that can perform division using the same algorithm even when the dividend is negative by providing a register that can set and reset one bit. It is intended to.

課題を解決するための手段 この目的を達成するために、本発明の非回復型除算器は
部分剰余が“0′°であることを判別するための、各行
での演算結果が“0”のときセットされ、被除数の各行
での最下位ビットに“1 ”が入ってきたときリセット
される1ビツトのレジスタを持ち、このレジスタの結果
を用いて、商余の補正を行う。
Means for Solving the Problem In order to achieve this object, the non-recovery divider of the present invention calculates whether the operation result in each row is "0" in order to determine that the partial remainder is "0'°". It has a 1-bit register that is set when "1" is entered in the least significant bit of each row of the dividend, and is reset when "1" is entered in the least significant bit in each row of the dividend, and the result of this register is used to correct the quotient and remainder.

作用 この構成によって、被除数、または、除数が負であると
きも、簡単に商余の補正が可能であるため、被除数、ま
たは、除数を正の数に置き換え直すことなしに除算を実
行することができる。
Effect With this configuration, even when the dividend or divisor is negative, it is possible to easily correct the quotient remainder, so division can be performed without replacing the dividend or divisor with a positive number. can.

実施例 以下、本発明の一実施例について、図面を参照しながら
説明する。
EXAMPLE Hereinafter, an example of the present invention will be described with reference to the drawings.

第1図は本発明の一実施例における非回復型除算器のブ
ロック図であり、1〜4は上記従来例と同様であり、5
は加減算の結果が“O”であった場合、出力(ZFLG
)が“1”となり、5RHI。
FIG. 1 is a block diagram of a non-recovery type divider in one embodiment of the present invention, in which 1 to 4 are the same as in the conventional example, and 5
If the result of addition/subtraction is “O”, output (ZFLG
) becomes “1” and 5RHI.

5RL2のシフト時、5RHIの最下位ビットに“1″
が入ってきた場合ZFLGが“O”になるレジスタであ
る。
When shifting 5RL2, “1” is placed in the least significant bit of 5RHI.
This is a register in which ZFLG becomes "O" when input.

2の補数表現をとる符号つき数の除算は上記従来例の符
号なし数のアルゴリズムを拡張して実現する。
Division of signed numbers in two's complement representation is realized by extending the algorithm for unsigned numbers in the conventional example.

まず、除数の正負の対応については、加算と減算を反転
することで対応する。すなわち、減算であった場合、す
べてのビットを反転して“l”をキャリー人力として加
えるという手法をここでは用いる。
First, the correspondence between positive and negative divisors is handled by reversing addition and subtraction. That is, in the case of subtraction, a method is used here in which all bits are inverted and "l" is added as a carry.

被除数については、正の場合は、従来例と全く同じアル
ゴリズムが用いられ、m回の加減算と、1回の余り補正
が行われる。また、負の場合は、加算と減算の処理を反
転する。即ち、被除数が正のとき減算して“0”を越え
るか、越えないかで判定を下したのと同様に、被除数か
負の場合、加算して“0”を越えるか、越えないかで判
定する。ここで注意すべきことは、“O”の場合である
。2の補数表現においては“0”は正の数であるため、
被除数が正の時と同様には実現されず、“O”の検出と
補正が必要となる。
If the dividend is positive, the exact same algorithm as in the conventional example is used, and m additions and subtractions and one remainder correction are performed. If the value is negative, the addition and subtraction processes are reversed. In other words, in the same way that when the dividend is positive, the decision is made by subtracting and determining whether it exceeds "0" or not, when the dividend is negative, the decision is made whether or not it exceeds "0" by adding. judge. What should be noted here is the case of "O". Since “0” is a positive number in two’s complement representation,
This is not realized in the same way as when the dividend is positive, and it is necessary to detect and correct "O".

第3図に8ビツトの被除数(11011010)2−(
−38)+oを4ビツトの除数(1101)2=(−3
)+oで割った例の算出フローチャートを示す。被除数
は、SRL2(m=8)に収められ、5RHI(n=5
)には、5RL2が符号拡張され、(11111)2が
入る。除数は符号拡張され(11101)2か入る。
Figure 3 shows the 8-bit dividend (11011010)2-(
-38)+o is the 4-bit divisor (1101)2=(-3
)+o is shown as a calculation flowchart. The dividend is stored in SRL2 (m=8) and 5RHI (n=5
), 5RL2 is sign-extended and (11111)2 is entered. The divisor is sign extended (11101) and contains 2.

まず、左シフトが行われ、5RHIに (11111)2が入る。このとき、最下位ビットは“
1゛であるから、2にしGはリセットされる。次に、初
期qがO”として減算が行われる。ここでは減算の結果
は(00101)2であるため、ZFLGは保持された
ままである。次に、再び左シフトが行われ、5RHII
:(01011)2が入る。このとき、上記同様最下位
ビットは“1“であるため、ZFLGはリセットされる
。但し、値は実際には変化していないのと同じである。
First, a left shift is performed and (11111)2 is entered into 5RHI. At this time, the least significant bit is “
Since it is 1, it is set to 2 and G is reset. Next, a subtraction is performed with the initial q being O”. Here, the result of the subtraction is (00101)2, so ZFLG is retained. Next, a left shift is performed again, and 5RHII
:(01011) 2 is entered. At this time, since the least significant bit is "1" as described above, ZFLG is reset. However, the value is the same as if it had not actually changed.

次にqoが“1”であったので加算を行う。ここでは加
算の結果は(00010)2のためZにしGは保持され
る。以下は同様の過程を繰り返し、最終的に商(111
10011)2、余(0001)2を得る。ここで加減
算の対応と商余の補正を第3表に示す。
Next, since qo is "1", addition is performed. Here, the result of addition is (00010)2, so it is set to Z and G is retained. Below, the same process is repeated and finally the quotient (111
10011)2 and remainder (0001)2. Table 3 shows the addition/subtraction correspondence and the correction of the quotient and remainder.

(以 下 余 白) 商は、上記第3表より、被除数は負、除数は負、ZFL
Gは“O”であるから、ビット反転すればよい。また、
余は、余+除数を求めればよい。すると、商(0000
1100)2=12、余(0001)2+(1101)
2 =(1110)2=−2を得る。これは、(−38
)÷(−3)=12・・・(−2)の答えと一致してい
る。
(Margin below) The quotient is from Table 3 above, where the dividend is negative, the divisor is negative, and ZFL
Since G is "O", it is only necessary to invert the bits. Also,
For the remainder, just find the remainder + divisor. Then, the quotient (0000
1100)2=12, remainder (0001)2+(1101)
We get 2=(1110)2=-2. This is (-38
)÷(-3)=12...It matches the answer to (-2).

さて、第3表に示した論理であるが、各制御信号は簡単
である。
Now, regarding the logic shown in Table 3, each control signal is simple.

初期q信号は、被除数の符号ビットの反転をとればよい
。なた、加算/減算は、除数の符号ビット+q信号でよ
い。ZFLGは上記の通りであり、余の正負は余の符号
ビットで判別できる。
The initial q signal may be obtained by inverting the sign bit of the dividend. For addition/subtraction, the sign bit of the divisor + q signal may be used. ZFLG is as described above, and the sign bit of the remainder can be used to determine whether the remainder is positive or negative.

なお、被除数が“0”の場合、上記手順で商余を求める
とZFLGにセット、リセットが一度もかからず、値が
初期値のままであることが考えられる。この場合、初期
値はセットされていても、リセットされていても商余は
正しいのであるが、ZFLGの初期値を“1”にするこ
とで余の補正において、被除数が負であり、ZFLG−
“1″のとき、余に“O゛を代入するという補正を被除
数が正のときにも行っても支障がないため、回路を軽減
できる。また、シミュレーション等で不確定の信号を残
さないため、回路検討時の負担を軽減できる。
Note that when the dividend is "0" and the quotient remainder is calculated using the above procedure, it is conceivable that ZFLG is never set or reset and the value remains at the initial value. In this case, the quotient remainder is correct whether the initial value is set or reset, but by setting the initial value of ZFLG to "1", the dividend is negative when correcting the remainder, and ZFLG-
When “1”, the correction of substituting “O゛” into the remainder can be performed even when the dividend is positive, so the circuit can be reduced.Also, in order to avoid leaving uncertain signals in simulation etc. , the burden when considering circuits can be reduced.

発明の効果 本発明によれば、セット、リセット可能な1ビツトのレ
ジスタを設けることにより、被除数、又は、除数が負で
ある場合に、−反圧の数に置きなおして除算するという
過程を省略でき、高速に、また、符号によらない一定の
アルゴリズムで商余を求めることのできる優れた非回復
型除算器を実現できる。
Effects of the Invention According to the present invention, by providing a 1-bit register that can be set and reset, when the dividend or divisor is negative, the process of replacing it with the number of -counterpressure and performing division is omitted. It is possible to realize an excellent non-recovery type divider that can calculate the quotient remainder at high speed and using a constant algorithm that does not depend on the sign.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例非回復型除算器のブロック図
、第2図は従来例非回復型除算器のブロック図、第3図
は8ビット−4ビツト算出のフローチャートである。 1・・・・・・nビットのレジスタ(SRH)、2・・
・・・・mビットのレジスタ(SRL)、3・・・・・
・nビットのレジスタ(DR)、4・・・・・・加減算
器、5・・・・・・1ビツトのセットリセット、可能な
レジスタ(ZFLG)。
FIG. 1 is a block diagram of a non-recovery divider according to an embodiment of the present invention, FIG. 2 is a block diagram of a conventional non-recovery divider, and FIG. 3 is a flow chart of 8-bit to 4-bit calculation. 1... n-bit register (SRH), 2...
...m-bit register (SRL), 3...
- n-bit register (DR), 4...adder/subtractor, 5...1-bit set/reset register (ZFLG).

Claims (2)

【特許請求の範囲】[Claims] (1)非回復型の除算手段に、各行での演算結果が“0
”のときセットされ、被除数の各行での最下位ビットに
“1”が入ってきたとき、リセットされるレジスタを持
ち、このレジスタの結果を用いて、商及び余の補正を行
うことを特徴とする非回復型除算器。
(1) In the non-recovery type division means, the operation result in each row is “0”.
”, and has a register that is reset when “1” enters the least significant bit in each row of the dividend, and the result of this register is used to correct the quotient and remainder. A non-recovery divider.
(2)レジスタの初期値をセット状態に設定したことを
特徴とする請求項(1)記載の非回復型除算器。
(2) The non-recovery type divider according to claim (1), wherein the initial value of the register is set to a set state.
JP63321183A 1988-12-20 1988-12-20 Non-restoring divider Expired - Lifetime JP2605848B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63321183A JP2605848B2 (en) 1988-12-20 1988-12-20 Non-restoring divider

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63321183A JP2605848B2 (en) 1988-12-20 1988-12-20 Non-restoring divider

Publications (2)

Publication Number Publication Date
JPH02165326A true JPH02165326A (en) 1990-06-26
JP2605848B2 JP2605848B2 (en) 1997-04-30

Family

ID=18129715

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63321183A Expired - Lifetime JP2605848B2 (en) 1988-12-20 1988-12-20 Non-restoring divider

Country Status (1)

Country Link
JP (1) JP2605848B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2720172A1 (en) * 1994-05-20 1995-11-24 Sgs Thomson Microelectronics Device for digital implementation of a division operation.
JP2013142570A (en) * 2012-01-10 2013-07-22 Mitsumi Electric Co Ltd Sensor output correction circuit, sensor output correction device and sensor output correction method

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6349932A (en) * 1986-08-20 1988-03-02 Nec Corp Divider

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6349932A (en) * 1986-08-20 1988-03-02 Nec Corp Divider

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2720172A1 (en) * 1994-05-20 1995-11-24 Sgs Thomson Microelectronics Device for digital implementation of a division operation.
WO1995032465A1 (en) * 1994-05-20 1995-11-30 Sgs-Thomson Microelectronics S.A. Device for digitally carrying out a division operation
JP2013142570A (en) * 2012-01-10 2013-07-22 Mitsumi Electric Co Ltd Sensor output correction circuit, sensor output correction device and sensor output correction method

Also Published As

Publication number Publication date
JP2605848B2 (en) 1997-04-30

Similar Documents

Publication Publication Date Title
JPS5829539B2 (en) arithmetic unit
US5745399A (en) Decimal arithmetic apparatus and method
JP3544821B2 (en) Division circuit
JP2511527B2 (en) Floating point arithmetic unit
JPH02165326A (en) Non-recovery type divider
CZ294898B6 (en) Circuit arrangement for generating multiplicative inversion above final GF (p) body
JPH0511980A (en) Overflow detecting method and circuit
GB2116757A (en) Division apparatus
JP2664750B2 (en) Arithmetic device and arithmetic processing method
JP3329921B2 (en) Arithmetic unit
US3813623A (en) Serial bcd adder
JPH0426495B2 (en)
SU1541596A1 (en) Division device
JPS63259767A (en) Averaging circuit
JP2552086B2 (en) Floating point arithmetic unit
JPH06195206A (en) Divider
JPH025128A (en) Dividing circuit
JPH03176735A (en) Multiplication remainder computing element
JPH08263271A (en) Non-restoring division device
JPS6346539A (en) Dividing circuit
JPH02178833A (en) Adder for adding data different in bit length
JPS6129020B2 (en)
JPH03259330A (en) Two-input logical operation system for addition or subtraction and decimal addition/subtraction system
GB2115962A (en) Decimal arithmetic system
JPH01125625A (en) Division device