JPH0831028B2 - Divider for programmable controller - Google Patents
Divider for programmable controllerInfo
- Publication number
- JPH0831028B2 JPH0831028B2 JP2152256A JP15225690A JPH0831028B2 JP H0831028 B2 JPH0831028 B2 JP H0831028B2 JP 2152256 A JP2152256 A JP 2152256A JP 15225690 A JP15225690 A JP 15225690A JP H0831028 B2 JPH0831028 B2 JP H0831028B2
- Authority
- JP
- Japan
- Prior art keywords
- signal
- output
- divisor
- storage means
- dividend
- 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 - Fee Related
Links
- 238000004364 calculation method Methods 0.000 description 30
- 230000000295 complement effect Effects 0.000 description 11
- 238000012544 monitoring process Methods 0.000 description 8
- 230000000630 rising effect Effects 0.000 description 8
- 238000000034 method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 230000001360 synchronised effect Effects 0.000 description 4
- 230000008901 benefit Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 101100110009 Caenorhabditis elegans asd-2 gene Proteins 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Landscapes
- Programmable Controllers (AREA)
Description
【産業上の利用分野】 本発明は、プログラマブルコントローラ用除算器に関
するものである。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a divider for a programmable controller.
一般に、プログラマブルコントローラ(以下、PCと略
称する)では、外部入力機器や外部出力機器を制御する
処理と四則演算とを同一のCPUによって実行しているも
のであるから、CPUへの負荷が大きく実時間制御が要求
されるPCにおいて、四則演算はボルトネックになってい
る。四則演算のうちでも、とくに乗算や除算は、アルゴ
リズムが複雑であって処理時間が長くかかるという問題
がある。 このような問題を解決するために、高速性を要求され
るPCでは、乗算専用のハードウェアを内蔵したものも提
供されつつあるが、除算については複雑な制御が必要で
あり、かつCPUと連動させることが必要であるから、い
まだ専用のハードウェアを有していないのが現状であ
る。 ところで、除算法としては、第5図に示すような手順
が考えられている。まず、被除数Ddと除数Dsとが与えら
れると、被除数Ddの上位部分(0010)から除数Dsを減算
する。減算の結果が負となる場合には、商Mのその桁に
0をたて、被除数Ddを1桁だけ左へシフトする(また
は、除数Dsを1桁だけ右へシフトする)。また、減算の
結果が正または0となる場合には(上記減算の3回目に
相当)、商Mのその桁に1をたて、減算の結果得られた
部分被除数Dpを1桁だけ左へシフトする(または、除数
Dsを1桁だけ右へシフトする)。このような演算を所定
の繰り返し回数だけ繰り返し、商Mと剰余Rとを求める
のである。繰り返し回数は、被除数Ddと除数Dsとの桁数
の差によって決定される。 大型コンピュータ等において用いられている汎用の除
算器では、上記アルゴリズムをハードウェアとして実現
するために、第6図に示すような構成を有している。こ
こでは、正数のみの除算を行うハードウェアを示す。す
なわち、被除数Ddと除数Dsと繰り返し回数Nとが外部か
ら与えられ、それぞれ被除数シフトレジスタ71、除数レ
ジスタ72、カウンタ73にセットされる。また、演算が終
了した時点では、商Mは商シフトレジスタ74に格納さ
れ、剰余Rは被除数シフトレジスタ71に格納されるよう
になっている。除数レジスタ72にセットされた除数Ds
は、コンプリメンタ75に入力されて除数Dsの2の補数が
求められる。除数Dsの2の補数を求めているのは、被除
数Ddとの加算により被除数Ddから除数Dsを減算した部分
被除数Dpを求めるためである。コンプリメンタ75の出力
値は加算器76に入力される。加算器76では、被除数シフ
トレジスタ71にセットされている値に除数Dsの2の補数
を加算する。 加算器76の出力値が正数または0であるときには、加
算器76の出力値の符号ビットに対応して発生する選択信
号selにより制御されるセレクタ77を介して加算結果を
被除数シフトレジスタ71に返し、次段階の部分被除数Dp
とする。また、同時に選択信号selによって商シフトレ
ジスタ74の最下位ビットに1を格納する。 一方、加算器76の出力値が負数であるときには、選択
信号selを受けたセレクタ77は被除数シフトレジスタ71
に格納されている内容をそのまま被除数シフトレジスタ
71に戻し、次段階の部分被除数Dpとする。また、選択信
号selによって、商シフトレジスタ74の最下位ビットに
0を格納する。 加算器76による加算はPCのCPUからの加算制御信号add
が入力されるたびに実行され、加算が1回行われるたび
に、CPUからのディクリメント信号decを受けてカウンタ
73に格納されている繰り返し回数Nは1ずつ減らされ
る。また、被除数シフトレジスタ71および商シフトレジ
スタ74に格納されている値は、CPUからのシフト信号sft
を受けて左へ1桁シフトする。 以上の演算を繰り返し、カウンタ73の格納値が0にな
ると、PCのCPUに演算終了信号endが返されて、演算の終
了が知らされ、この時点で商シフトレジスタ74に格納さ
れている値が商M、被除数シフトレジスタ71に格納され
ている値が剰余Rになるのである。Generally, in a programmable controller (hereinafter, abbreviated as PC), the same CPU executes the processing for controlling the external input device and the external output device and the four arithmetic operations. In a PC that requires time control, the four arithmetic operations are a bolt neck. Among the four arithmetic operations, multiplication and division have a problem that the algorithm is complicated and the processing time is long. In order to solve such problems, PCs that require high speed are also being provided with hardware dedicated to multiplication, but division requires complicated control and is linked with the CPU. Since it is necessary to do so, the current situation is that we do not yet have dedicated hardware. By the way, as a division method, a procedure as shown in FIG. 5 is considered. First, when the dividend Dd and the divisor Ds are given, the divisor Ds is subtracted from the upper part (0010) of the dividend Dd. If the result of the subtraction is negative, 0 is added to that digit of the quotient M and the dividend Dd is shifted left by one digit (or the divisor Ds is shifted right by one digit). If the result of the subtraction is positive or 0 (corresponding to the third time of the above subtraction), 1 is added to that digit of the quotient M, and the partial dividend Dp obtained as a result of the subtraction is moved to the left by one digit. Shift (or divisor
Shift Ds one digit to the right). This calculation is repeated a predetermined number of times to obtain the quotient M and the remainder R. The number of repetitions is determined by the difference in the number of digits between the dividend Dd and the divisor Ds. A general-purpose divider used in a large computer or the like has a configuration shown in FIG. 6 in order to realize the above algorithm as hardware. Here, the hardware for dividing only a positive number is shown. That is, the dividend Dd, the divisor Ds, and the number of repetitions N are given from the outside and set in the dividend shift register 71, the divisor register 72, and the counter 73, respectively. Further, when the calculation is completed, the quotient M is stored in the quotient shift register 74, and the remainder R is stored in the dividend shift register 71. Divisor Ds set in divisor register 72
Is input to the complementer 75 and the two's complement of the divisor Ds is obtained. The 2's complement of the divisor Ds is obtained because the partial dividend Dp is obtained by subtracting the divisor Ds from the dividend Dd by adding the dividend Dd. The output value of the complementer 75 is input to the adder 76. The adder 76 adds the 2's complement of the divisor Ds to the value set in the dividend shift register 71. When the output value of the adder 76 is a positive number or 0, the addition result is sent to the dividend shift register 71 via the selector 77 controlled by the selection signal sel generated corresponding to the sign bit of the output value of the adder 76. Return, next-stage partial dividend Dp
And At the same time, 1 is stored in the least significant bit of the quotient shift register 74 by the selection signal sel. On the other hand, when the output value of the adder 76 is a negative number, the selector 77 receiving the selection signal sel causes the dividend shift register 71
The contents stored in the dividend shift register
The value is returned to 71, and the partial dividend of the next stage is set to Dp. Also, 0 is stored in the least significant bit of the quotient shift register 74 by the selection signal sel. The addition by adder 76 is performed by the addition control signal add from the CPU of the PC.
Is executed each time is input, and the counter receives the decrement signal dec from the CPU each time an addition is performed.
The repeat count N stored in 73 is decremented by one. The value stored in the dividend shift register 71 and the quotient shift register 74 is the shift signal sft from the CPU.
In response, shift to the left by one digit. When the value stored in the counter 73 becomes 0 by repeating the above calculation, the calculation end signal end is returned to the CPU of the PC to notify the end of the calculation, and the value stored in the quotient shift register 74 at this point is The quotient M and the value stored in the dividend shift register 71 become the remainder R.
上述のように除算器を構成すると、PCのCPUから除算
器に対して、被除数Dd、除数Ds、繰り返し回数N、加算
制御信号add、シフト制御信号sft、ディクリメント信号
decを与える必要があり、また、除算器からCPUに対して
は、商Q、剰余R、演算終了信号endを返す必要があ
る。このように除算器の制御には、複数の制御信号が必
要であって、CPUで各種制御信号のタイミングを取るよ
うにすると、除算器を設けているにもかかわらずCPUの
負荷があまり軽減されないことになる。とくに、上記構
成の除算器では除算の演算途中でもCPUから加算制御信
号add、シフト制御信号sft、ディクリメント信号decな
どの制御信号を受ける必要があり、演算途中でもCPUが
完全には解放されないから、他の処理と並行して処理を
行うとすれば、CPUでは時分割処理等によって負荷分散
を図る必要があり、PCにおいてこのような処理を応用命
令としてプログラムするのは非常に面倒になる。 一方、上記除算器について考察すると、繰り返し回数
Nは、被除数Ddと除数Dsとの最大ビット数が制限されて
いれば、除数Dsによって決定できることがわかる。ま
た、PCに用いる除算器では、演算開始時に、被除数Ddと
除数Dsと演算開始時点とをCPUから与え、演算終了時
に、演算終了時点と商Qと剰余RとをCPUに返すように
して、演算途中でのCPUとの信号の授受をなくすのが望
ましい。 本発明は上記観点に鑑みてなされたものであって、PC
のCPUとの間では、被除数、除数、商、剰余、演算開始
時点、演算終了時点のみを授受し、演算途中ではCPUと
の信号の授受をなくし、CPUの負荷を最小にして除算を
高速に行うことができるようにしたプログラマブルコン
トローラ用除算器を提供しようとするものである。When the divider is configured as described above, the CPU of the PC tells the divider that the dividend Dd, the divisor Ds, the number of repetitions N, the addition control signal add, the shift control signal sft, and the decrement signal.
It is necessary to give dec, and it is necessary to return the quotient Q, the remainder R, and the operation end signal end from the divider to the CPU. In this way, the control of the divider requires multiple control signals, and if the timing of various control signals is set in the CPU, the load on the CPU will not be significantly reduced despite the provision of the divider. It will be. In particular, in the divider having the above configuration, it is necessary to receive control signals such as addition control signal add, shift control signal sft, and decrement signal dec from the CPU even during the division calculation, and the CPU is not completely released during the calculation. If processing is performed in parallel with other processing, it is necessary for the CPU to achieve load distribution by time-division processing, etc., and it becomes very troublesome to program such processing as application instructions on the PC. On the other hand, considering the divider, it can be seen that the number of iterations N can be determined by the divisor Ds if the maximum number of bits of the dividend Dd and the divisor Ds is limited. Further, in the divider used for the PC, the dividend Dd, the divisor Ds, and the operation start point are given from the CPU at the start of the operation, and the operation end point, the quotient Q, and the remainder R are returned to the CPU at the end of the operation. It is desirable to eliminate the exchange of signals with the CPU during calculation. The present invention has been made in view of the above viewpoint, and PC
With the CPU, only the dividend, divisor, quotient, remainder, calculation start point, and calculation end point are exchanged, and the exchange of signals with the CPU is eliminated during the calculation to minimize CPU load and speed up division. It is intended to provide a programmable controller divider that can be implemented.
本発明では、上記目的を達成するために、それぞれ格
納される値の最大ビット長が規定された第1記憶手段お
よび第2記憶手段と、第1記憶手段に格納された値から
第2記憶手段に格納された値を減算する減算手段と、減
算結果が正または0のときには減算結果を第1記憶手段
に格納し減算結果が負のときには第1記憶手段の出力値
を第1記憶手段に格納する選択手段と、減算を行った後
に第1記憶手段に格納される値に対して第2記憶手段の
格納値を相対的に1桁右にシフトさせるシフト手段と、
減算結果が正または0のときには対応する桁に1が格納
され負のときには対応する桁に0が格納される第3記憶
手段と、減算を所定の繰り返し回数だけ繰り返した後の
減算結果が格納される第4記憶手段と、減算が上記繰り
返し回数だけ行われると減算を停止させるコントローラ
とを具備し、コントローラは、プログラマブルコントロ
ーラより第1記憶手段と第2記憶手段とに対してそれぞ
れ被除数と除数とが引き渡された状態でプログラマブル
コントローラより演算開始信号を受けると、除数の最上
位ビットから連続する0を除去して第2記憶手段の最上
位ビットが1になるように設定するとともに、除数の最
上位から連続する0を除去した残りの桁数を被除数の桁
数から引いた数に1を加えた値を繰り返し回数として設
定して、設定された繰り返し回数をプログラマブルコン
トローラに返し、繰り返し回数の減算が終了するとプロ
グラマブルコントローラに対して演算終了信号を送出し
て第3記憶手段に格納された商と第4記憶手段に格納さ
れた剰余とを引き渡すようにしている。In the present invention, in order to achieve the above object, the first storage means and the second storage means in which the maximum bit lengths of the respective stored values are defined, and the second storage means based on the values stored in the first storage means And a subtraction means for subtracting the value stored in the first storage means, and a subtraction result is stored in the first storage means when the subtraction result is positive or zero, and an output value of the first storage means is stored in the first storage means when the subtraction result is negative. Selecting means, and shift means for shifting the value stored in the second storage means to the right by one digit relative to the value stored in the first storage means after subtraction.
The third storage means stores 1 in the corresponding digit when the subtraction result is positive or 0 and stores 0 in the corresponding digit when the subtraction result is negative, and stores the subtraction result after the subtraction is repeated a predetermined number of times. And a controller that stops the subtraction when the subtraction is performed by the number of repetitions, and the controller uses the programmable controller to divide the dividend and the divisor into the first storage unit and the second storage unit, respectively. When the operation start signal is received from the programmable controller in the state that the value is delivered to the programmable controller, consecutive 0s are removed from the most significant bit of the divisor and the most significant bit of the second storage means is set to 1. It is set by setting the value obtained by adding 1 to the number obtained by subtracting the number of remaining digits after removing consecutive 0s from the upper rank from the number of digits of the dividend, as the number of iterations. The number of times of repetition is returned to the programmable controller, and when the subtraction of the number of times of repetition is completed, an operation end signal is sent to the programmable controller to deliver the quotient stored in the third storage means and the remainder stored in the fourth storage means. I have to.
上記構成によれば、被除数および除数より商およひ剰
余を求める除算部を制御するコントローラを設けてお
り、コントローラでは、被除数および除数がプログラマ
ブルコントローラより与えられて演算開始信号が入力さ
れると、被除数および除数に基づいて繰り返し回数を求
めるとともに、繰り返し回数だけ減算が行われたことを
判定して演算終了信号を出力して商および除数を引き渡
すようにしているので、プログラマブルコントローラは
演算開始信号を出力してから演算終了信号を受け取るま
での間に除算に関する信号を授受する必要がないのであ
って、除算中に他の処理を行うことができるのである。
すなわち、パイプライン化によって高速な演算が可能に
なるのである。また、繰り返し回数が設定されると、そ
の繰り返し回数をプログラマブルコントローラに返すよ
うにしているので、プログラマブルコントローラでは、
繰り返し回数に基づいて除算の終了までに要する時間を
予測することができ、除算が終了するまでにプログラマ
ブルコントローラで行う処理の内容を予測時間に基づい
て選択できるのである。According to the above configuration, the controller for controlling the division unit for obtaining the quotient and the remainder from the dividend and the divisor is provided, and in the controller, when the dividend and the divisor are given from the programmable controller and the operation start signal is input, The programmable controller determines the number of iterations based on the dividend and the divisor, determines that subtraction has been performed by the number of iterations, and outputs a computation end signal to pass the quotient and divisor. Since it is not necessary to send and receive a signal regarding division between the output and the reception of the operation end signal, other processing can be performed during the division.
In other words, pipeline processing enables high-speed calculation. When the number of repetitions is set, the number of repetitions is returned to the programmable controller.
It is possible to predict the time required until the end of the division based on the number of repetitions, and it is possible to select the content of the processing performed by the programmable controller before the end of the division based on the estimated time.
本実施例では、除算器内部の各種制御を行う制御信号
を発生するコントローラ10を設け、演算途中ではPC(プ
ログラマブルコントローラ)のCPUとの信号の授受を不
要にしている。コントローラ10を除く各部の構成は、
「従来の技術」の項で説明した第6図の構成とほぼ同様
である。ただし、本実施例では、符号付きの除算を行う
ように構成し、被除数および除数をともに32ビットとし
ている。また、負数は2の補数で表現されているものと
する。 第1図に示すように、被除数Ddはセレクタ6を介して
被除数レジスタ1にセットされ、除数Dsは除数シフトレ
ジスタ2にセットされる。また、被除数Ddおよび除数Ds
の符号ビットである最上位ビットは、被除数符号ラッチ
11、除数符号ラッチ12にそれぞれラッチされる。被除数
Ddおよび除数Dsは、PCのCPUから演算開始を指示する演
算開始信号startがコントローラ10に与えられるのに先
立って、コントローラ10から出力されるロード信号ld1
に同期してPCから与えられており、演算開始信号start
が出力された後にコントローラ10から出力されるロード
信号ld1に同期して、それぞれ被除数レジスタ1、除数
シフトレジスタ2にラッチされる。ここに、被除数レジ
スタ1、除数シフトレジスタ2、被除数符号ラッチ11、
除数符号ラッチ12は、演算開始信号startによってリセ
ットされるようになっている。演算結果である商Mおよ
び剰余Rは、それぞれ商シフトレジスタ4、剰余シフト
レジスタ5に格納される。ここに、商シフトレジスタ4
および剰余シフトレジスタ5は、被除数Ddおよび除数Ds
のラッチの直後に出力される初期化信号initによりリセ
ットされる。商Mおよび剰余Rが求められると、演算終
了信号endがコントローラ10より外部に出力されて演算
の終了がPCに対して示される。 被除数レジスタ1の前段に設けたセレクタ6は、コン
トローラ10からの切換信号sw1に応じて、被除数Ddと部
分被除数Dpとのどちらを被除数レジスタ1に入力するか
を選択する。切換信号sw1は、被除数Ddが被除数レジス
タ1にラッチされるまでは被除数Ddを通過させ、その後
は、部分被除数Dpを通過させるようにセレクタ6を切り
換えるのである。また、被除数レジスタ1にデータをラ
ッチするタイミングを設定する書込許可入力WEには、上
述したロード信号ld1と後述するロード信号ld2とが論理
回路21を介して入力される。この論理回路21は、ロード
信号ld2の否定とロード信号ld1との論理積の否定を出力
し、ロード信号ld1の立ち上がりと、ロード信号ld2の立
ち下がりとにおいて、被除数レジスタ1へのデータのラ
ッチが行われるようにしている。内部演算は正数で行わ
れ、被除数Ddが負数であるときには、コンプリメンタ13
によって被除数Ddの2の補数が求められる。ただし、2
の補数は演算開始時に1回だけ求め、以後、コンプリメ
ンタ13はデータを通過させるだけになる。また、被除数
Ddが正数であるときには、コンプリメンタ13はデータを
通過させるだけになる。コンプリメンタ13の動作は、コ
ントローラ10から出力される切換信号sw2によって切り
換えられる。この切換信号sw2は、被除数符号ラッチ11
の出力である被除数符号信号sign1に基づいて設定され
る。 一方、除数Dsは、上述したように除数シフトレジスタ
2に取り込まれる。除数シフトレジスタ2は、コントロ
ーラ10からの切換信号sw1によってラッチモードとシフ
トモードとが選択されるように構成され、ラッチモード
ではクロック入力CKへの信号に同期してデータをラッチ
し、シフトモードではクロック入力CKへの信号に同期し
てデータを左へ1桁ずつシフトする。除数シフトレジス
タ2のクロック入力CKには、ロード信号ld1とコントロ
ーラ10からのカウント信号cntとが論理回路22を介して
入力される。論理回路22は、ロード信号ld1とカウント
信号cntとの論理積の否定を出力する。ロード信号ld1が
出力されるときには切換信号sw1によってラッチモード
が選択されており、除数Dsが除数シフトレジスタ2にラ
ッチされる。また、カウント信号cntが入力されるとき
には切換信号sw1によってシフトモードが選択されてお
り、除数シフトレジスタ2にセットされている除数Dsが
カウント信号cntに同期して1桁ずつ左にシフトされ、
その間、コントローラ10では、除数シフトレジスタ2の
最上位ビットが1になるかどうかをレジスタ監視信号ri
nによって監視する。コントローラ10では、除数シフト
レジスタ2の最上位ビットが1になった時点でカウント
信号cntを停止し、カウント信号cntの停止時点までのカ
ウント信号cntの発生個数に1を加えた値を繰り返し回
数Nとする。 繰り返し回数Nが決定されると、コントローラ10はフ
ラグ信号flgをPCに返し、PCではフラグ信号flgを受け取
るとコントローラ10に対して繰り返し回数Nに対応した
回数信号numを要求する。この回数信号numに基づいてPC
では除算に要する時間を推定し、その時間内で行うのに
適した処理を選択して実行するのである。 繰り返し回数Nが決定されると、「従来の技術」の項
で説明したような手順で演算が行われる。除数Dsが正数
であれば除数Dsの2の補数が求められ、除数Dsが負数で
あれば除数シフトレジスタ2の出力がそのまま加算器3
に入力される。ここに、除数Dsの2の補数は、コンプリ
メンタを用いずに求められる。すなわち、除数シフトレ
ジスタ2の各ビットは、出力選択信号によって非反転出
力と反転出力とを選択できるように構成されており、除
数Dsが正数であれば除数シフトレジスタ2の出力として
反転出力が選択されるとともに、加算器3のキャリー入
力CINに1を出力する。すなわち、除数Dsが正数である
と、除数Dsの各ビットの1,0が反転されるとともに1が
加算されるから、除数Dsの2の補数が求められるのであ
る。除数シフトレジスタ2への出力選択信号と、加算器
3のキャリー入力CINへの信号とは、除数符号ラッチ12
の出力である除数符号信号sign2であって、除数Dsが正
数のときに1になるように設定してある。除数Dsが負数
ならば、除数シフトレジスタ2の出力は非反転出力にな
り、加算器3のキャリー入力CINは0になる。 加算器3は、コンプリメンタ13の出力値と除数シフト
レジスタ2の出力値とを加算する。また、キャリー入力
CINが1であれば、キャリー入力CINを最下位ビットに加
算する。加算器3の出力値は33ビットであって、最上位
ビットが符号ビットになる。加算器3の出力値のうち符
号ビットはセレクタ7への選択信号selになり、残りの3
2ビットはセレクタ7への入力になる。セレクタ7で
は、選択信号selによって、加算器3の出力値が正数ま
たは0であることが示されれば加算器3の出力値を出力
し、負数であることが示されればコンプリメンタ13の出
力値を出力する。すなわち、セレクタ7の出力値が部分
被除数Dpになる。セレクタ7の出力値は1桁だけ左へシ
フトされ、セレクタ6を介して被除数レジスタ1にセッ
トされる。ここにおいて、セレクタ7の出力とセレクタ
6の入力とは1桁ずつずらして結線されており、この結
線によってセレクタ7の出力値を左へ1桁シフトした値
がセレクタ6に入力される。また、この時点ではセレク
タ6への切換信号sw1は、部分被除数Dpを被除数レジス
タ1に取り込むように設定されているのはいうまでもな
い。部分被除数Dpは、コントローラ10から出力されるロ
ード信号ld2に同期して被除数レジスタ1にラッチされ
る。また、上記選択信号selは、加算器3による加算結
果が正数または0であれば0、負数であれば1になるか
ら、選択信号selをノット回路23を介して商シフトレジ
スタ4の最下位ビットにセットする。すなわち、部分被
除数Dpが、正数または0であれば商シフトレジスタ4の
最下位ビットに1をたて、負数であれば商シフトレジス
タ4の最下位ビットに0をたてるのである。コントロー
ラ10からは、ロード信号ld2とともに商シフト信号msft
が出力され、部分被除数Dpが被除数レジスタ1にセット
されると商シフトレジスタ4にセットされた値が1桁だ
け左へシフトされるようにしてある。商シフト信号msft
は加算器3による加算演算のたびに出力されるのであ
り、繰り返し回数Nと同数出力され、一方、ロード信号
ld2は繰り返し回数Nから1を引いた数だけ出力され
る。ここに、被除数レジスタ1では、ロード信号ld2に
先立ってロード信号ld1によるデータのラッチが行われ
ているから、結果的には繰り返し回数Nだけデータがラ
ッチされることになる。 コントローラ10は、除数Dsに基づいてコントローラ10
が求めた繰り返し回数Nだけ上記手順を繰り返すように
各部の制御を行う。演算が繰り返し回数Nだけ行われる
と、商シフトレジスタ4には商Mが格納されることにな
る。ところで、商Mが正数になるか負数になるかは、被
除数Dd、除数Dsの正負によって決定されるから(被除数
と除数とが同符号ならば正数、異符号ならば負数)、被
除数符号ラッチ11および除数符号ラッチ12の出力の排他
的論理和を出力する論理回路24の出力によって、商Mの
正負を決定することができる。したがって、商Mが負数
になるときは、論理回路24の出力値に基づき、コンプリ
メンタ14によって商シフトレジスタ4の出力値の2の補
数を求めて商Mとする。商Mが正数になるときには、コ
ンプリメンタ14は商シフトレジスタ4の出力値をそのま
ま通過させて商Mとする。被除数Ddが最大数で、かつ除
数Dsが−1であるとき商Mはオーバフローになるから、
コンプリメンタ14の最上位ビットと論理回路24の出力と
に基づいて、オーバフローかどうかを判定し、オーバフ
ローが生じているときにはオーバフローラッチ16にオー
バフロー信号overをラッチする。 一方、剰余シフトレジスタ5は、加算器3による加算
が行われるたびに、ロード信号ld2に同期してセレクタ
7の出力値をラッチする。剰余シフトレジスタ5は、ラ
ッチモードとシフトモードとが切換信号sw3によって選
択されるように構成され、ラッチモードではクロック入
力CKへの信号に同期してデータをラッチし、シフトモー
ドではクロック入力CKへの信号に同期してデータを右へ
1桁ずつシフトする。剰余シフトレジスタ5のクロック
入力CKには、ロード信号ld2と後述する演算停止信号sto
pおよび剰余シフト信号rsftとが論理回路25を介して入
力される。論理回路25は、ロード信号ld2の否定と演算
停止信号stopと剰余シフト信号rsftの論理積の否定を出
力する。ロード信号ld2および演算停止信号stopが入力
されるときには切換信号sw3によってラッチモードが選
択されており、加算器3による加算演算のたびにセレク
タ7の出力値がラッチされる。したがって、ロード信号
ld2と演算停止信号stopとによって繰り返し回数Nだけ
セレクタ7の出力値をラッチすることになる。また、剰
余シフトレジスタ5は、演算停止信号stopが出力された
直後にコントローラ10から出力される切換信号sw3によ
ってシフトモードになり、その時点で剰余シフトレジス
タ5に格納されているデータを剰余シフト信号rsftに同
期して1桁ずつ右にシフトさせるのである。すなわち、
演算停止信号stopが出力された時点で剰余シフトレシズ
タ5に格納されている剰余は、繰り返し回数Nから1を
引いた桁数だけ左に桁ずれしているから、剰余シフト信
号rsftにより(N−1)桁だけ右にシフトさせるのであ
る。被除数Ddが負数であるときには剰余も負数になるか
ら、被除数符号信号sign1に基づいて、コンプリメンタ1
5で剰余シフトレジスタ5の出力値の2の補数を求めて
剰余Rとする。被除数Ddが正数であるときには、コンプ
リメンタ15は、剰余シフトレジスタ5の出力値をそのま
ま通過させて剰余Rとする。 以上のようにして、剰余シフト信号rsftによる剰余の
桁合わせが終了すると、コントローラ10からPCに対して
演算終了信号endが外部に出力され、PCのCPUでは商Mお
よび剰余Rを受け取るのである。したがって、PCは、除
算器に対して、同期用の信号、被除数Dd、除数Ds、演算
開始信号startを与えた後は、除算器から演算終了信号e
ndが出力されるまでの間、除算とは無関係に他の処理を
実行することができるのであって、除算に関してパイプ
ライン処理が可能になるのである。 以上のような手順で各部を動作させるための信号を出
力するために、コントローラ10は第2図のように構成さ
れる。コントローラ10に対してPCから入力される同期用
の信号は、システムクロック信号clkと3種のフェイズ
信号ph2,ph4,ph6とであり、PCのCPUから被除数Dd、除数
Ds、演算開始信号startが与えられると、除算を開始す
るように各信号を順次出力する。フェイズ信号ph2,ph4,
ph6は、システムクロック信号clk(第3図(b)、第4
図(a)参照)の各半周期を1フェイズとして6フェイ
ズで1サイクルとなる6個のフェイズ信号のうち、第2
フェイズ信号ph2、第4フェイズ信号ph4、第6フェイズ
信号ph6を用いる。各フェイズ信号ph2,ph4,ph6は、第3
図(c)〜(e)、第4図(b)〜(d)に示すよう
に、対応するフェイズにおいて“L"になる。 PCのCPUが除算を要求する際には、第3図(a)のよ
うに被除数Ddおよび除数Dsを与えてから(第3図(a)
において線が交差している部位)、第3図(f)、第4
図(e)のように。演算開始信号startを与える(立ち
下げる)。演算開始信号startが与えられると、上述し
たように、被除数レジスタ1、除数シフトレジスタ2、
被除数符号ラッチ11、除数符号ラッチ12がそれぞれリセ
ツト解除される。第3図(g)、第4図(f)に示すよ
うに、演算開始信号startが与えられる前にコントロー
ラ10から発生しているのはロード信号ld1のみであっ
て、このロード信号ld1は、第2フェイズ信号ph2の立ち
上がりで演算開始信号startの否定をラッチするラッチ
回路31の反転出力と第2フェイズ信号ph2との論理和
を出力する論理回路32の出力信号として得られるように
なっている。すなわち、演算開始信号startが入力され
る前にはラッチ回路31の反転出力は“L"であるから、
第2フェイズ信号ph2がロード信号ld1になり、演算開始
信号startが入力された後の最初の第2フェイズ信号ph2
がロード信号ld1として出力された後は、第2フェイズ
信号ph2の立ち上がりによってラツチ回路31の反転出力
が“H"になり、以後、ロード信号ld1は変化しなくな
る。ラッチ回路31の非反転出力Qは初期化信号initであ
って、第3図(h)、第4図(g)のように反転出力
が“H"になった時点で出力される(立ち下がる)。初期
化信号initが出力されると、商シフトレジスタ4、剰余
シフトレジスタ5、後述する回数カウンタ41,51などが
リセット解除される。 被除数Ddおよび除数Dsが、ロード信号ld1の立ち上が
りで、それぞれ被除数レジスタ1および除数シフトレジ
スタ2にラッチされると、第3図(i)、第4図(h)
のように、切換信号sw1が“L"から“H"になるのであっ
て、上述したように、被除数シフトレジスタ2をラッチ
モードからシフトモードに切り換えるとともに、セレク
タ6の出力がセレクタ7の出力となるように切り換え
る。切換信号sw1は、初期化信号initの発生後に第6フ
ェイズ信号ph6の立ち上がりで出力を“H"にラッチする
ラッチ回路33の出力として得られる。すなわち、初期化
信号initが出力されたサイクル内の第6フェイズ信号ph
6の立ち上がりに伴って切換信号sw1が立ち上がるのであ
る。その後、切換信号sw1は、演算の終了まで“H"に保
たれる。 切換信号sw1により除数シフトレジスタ2がシフトモ
ードに切り換えられると、第3図(j)、第4図(i)
のようなカウント信号cntに同期して除数シフトレジス
タ2にラッチされている除数Dsが左に1桁ずつシフトさ
れる。カウント信号cntは、論理回路34の出力として得
られる。論理回路34では、初期化信号initの発生後の最
初の第2フェイズ信号ph2の立ち下がりで出力を“H"に
ラッチするラッチ回路35の出力と、除数シフトレジスタ
2の最上位ビットが1になると“L"になるレジスタ監視
信号rin(第4図(j)参照)と、システムクロック信
号clkとの論理積の否定を出力する。すなわち、初期化
信号initは後述する他の信号とともに論理回路36を介し
てラッチ回路35に入力され、初期化信号initの発生前
か、後述する他の信号が“L"であると、ラッチ回路35の
出力は“L"に保たれる。初期化信号initは第2フェイズ
信号ph2の立ち上がりに伴って発生し、切換信号sw1は初
期化信号initの発生と同じサイクル内の第6フェイズ信
号ph6の立ち上がりに伴って立ち上がるから、ラッチ回
路35の出力は、切換信号sw1が立ち上がるサイクルの次
のサイクル内の第2フェイズ信号ph2の立ち下がりによ
って“H"になる。一方、レジスタ監視信号rinは除数シ
フトレジスタ2の最上位ビットが1になると発生する
(立ち下がる)のであって、それまでは“H"であるか
ら、カウント信号cntは、切換信号sw1が立ち上がった
後、ラッチ回路35の出力が“H"になってからレジスタ監
視信号が発生する(“L"になる)までの間、システムク
ロック信号clkを反転した信号として出力される。除数
シフトレジスタ2の最上位ビットが1になると、レジス
タ監視信号rinが発生して(“L"になって)カウント信
号cntが停止し(“H"に保たれ)、除数シフトレジスタ
2は除数Dsのシフトを停止する。 カウント信号cntは、出力が5ビットのアップダウン
カウンタよりなる一対の回数カウンタ41,51のアップ入
力UPにも入力され、各回数カウンタ41,51ではカウント
信号cntが立ち下がる回数をアップカウントする。各回
数カウンタ41,51は、それぞれクリア入力CLEARに入力さ
れる初期化信号initによって初期化される(出力値が00
000になる)から、両回数カウンタ41,51にはカウント信
号cntの発生回数がセットされる。すなわち、回数カウ
ンタ41,51に、繰り返し回数Nから1を引いた値がセッ
トされる。 一方の回数カウンタ41のダウン入力DOWNには、カウン
トダウン信号が入力される。カウントダウン信号は、論
理回路37の出力として得られる。論理回路37は、ラッチ
回路35の出力と、ラッチ回路38の出力と、第4フェイズ
信号ph4の否定との論理積の否定を出力する。ラッチ回
路38には、ラッチ回路35の出力の否定とレジスタ監視信
号rinとの論理和の否定を出力する論理回路39の出力が
データとして入力されており、初期化信号initの発生
後、第6フェイズ信号の立ち上がりによってデータがラ
ッチされるようになっている。したがって、カウント信
号cntの出力が開始された後、除数シフトレジスタ2の
最上位ビットが1になりレジスタ監視信号rinが発生す
る(立ち下がる)と、論理回路39の出力が“H"になり、
その後に出力される最初の第6フェイズ信号ph6の立ち
上がりによって、ラッチ回路38の出力が“H"になるので
ある。要するに、論理回路37の出力であるカウントダウ
ン信号は、カウント信号cntの出力が終了したサイクル
の次のサイクルから、第4フェイズ信号ph4に伴って出
力されることになる。また、ラッチ回路38の出力は繰り
返し回数Nが決定されると“H"になるから、繰り返し回
数が決定されたことをPCに返すフラグ信号flgとして出
力され、このフラグ信号flgが発生すると、PCでは回数
カウンタ41の出力値を繰り返し回数Nに対応する回数信
号numとして読み出して、除算に要する時間を推定す
る。 ところで、切換信号sw2は、システムクロック信号clk
の立ち下がりで被除数符号信号sign1をラッチするラッ
チ回路42の出力として得られる。このラッチ回路42は、
初期化信号initと回数カウンタ41のダウン入力DOWNへの
カウントダウン信号とに基づいて動作状態が設定され
る。すなわち、初期化信号initが発生すると出力を“H"
にして初期化信号initが発生した後にカウントダウン信
号の立ち下がりで出力を“L"にラッチするラッチ回路43
と、ラッチ回路43の出力と初期化信号initとを入力とす
る論理回路44とを設け、論理回路44の出力が“H"である
とラッチ回路42の出力が“L"に保たれるようにし、論理
回路44の出力が“L"であるとシステムクロック信号clk
の立ち下がりで被除数符号信号sign1がラッチ回路42に
ラッチされるようにしてある。論理回路44は、ラッチ回
路43の出力と初期化信号initの否定との論理積の否定を
出力する。したがって、論理回路44の出力は、初期化信
号initの発生に伴って“L"になり、1つ目のカウントダ
ウン信号が立ち下がった時点で“H"になる。その結果、
切換信号sw2は、初期化信号initが発生した後の最初の
システムクロック信号clkの立ち下がりによって被除数
符号信号sign1に対応する出力となり、その後、1つ目
のカウントダウン信号が立ち下がった時点で“L"になる
のである。 回数カウンタ41の出力端Q0〜Q4からの出力は、論理回
路45に入力される。この論理回路45では、回数カンウタ
41の5ビットの出力がすべて“L"(すなわち、出力値が
0)になるまでカウントダウン信号を反転した信号を出
力する。この論理回路45の出力がロード信号ld2になる
(第4図(k)参照)。要するに、ロード信号ld2は、
回数カウンタ41に対するカウントダウン信号の出力が開
始されてから回数カンウタ41の出力値が1になるまでの
間、繰り返し回数Nに対して(N−1)個のロード信号
ld2を出力するのである。また、回数カウンタ41は、出
力がオーバフローすると、キャリー出力端COからの出力
(以下、キャリー出力COと略称する)を“L"にし、出力
がアンダフローすると、ボロー出力端BOからの出力(以
下、ボロー出力BOと略称する)を“L"にするようになっ
ている。すなわち、出力端Q0〜Q4からの出力値が0〜11
111の範囲であれば、キャリー出力COとボロー出力BOと
はともに“H"であるが、出力値が上記範囲を越えると一
方が“L"になるのである。キャリー出力COとボロー出力
BOとは論理積の否定を出力する論理回路46に入力され、
論理回路46の出力はラッチ回路47に入力される。ラッチ
回路47では、初期化信号initの発生後、論理回路46の出
力の立ち上がりによって出力を反転させる。したがっ
て、ラッチ回路47の出力は、初期化信号initが発生した
ときには“L"であって、キャリー出力COとボロー出力BO
とのいずれかが“L"になると“H"になる。 演算停止信号stopは、ボロー出力BOとラッチ回路46の
出力との論理和を出力する論理回路48の出力であって、
ボロー出力BOが発生すると、論理回路46およびラッチ回
路47による時間遅れ分だけ“L"になる信号を演算停止信
号stopとして出力する(第4図(l)参照)。演算停止
信号stopは初期化信号initとともにRSフリップフロップ
49に入力される。このRSフリップフロップ49は、初期状
態では非反転出力Qを“L"にしており、初期化信号init
の発生後、演算停止信号stopの発生(立ち下がり)で非
反転出力Qを“H"にする。RSフリップフロップ49の非反
転出力Qは論理回路45に入力され、ボロー出力BOによっ
てRSフリップフロップ49の非反転出力Qが“H"になる
と、以後はロード信号ld2を“L"に保つようにしてあ
る。また、論理回路45にはRSフリップフロップ49の出力
とともにラッチ回路46の出力も入力されており、回数カ
ウンタ41よりキャリー出力COが発生したときには、ロー
ド信号ld2が出力されるようにしてある。 回数カンウタ41の出力端QO〜Q4の出力は、ロード信号
ld2を作成する論理回路45とは別に設けた論理回路51に
も入力される。論理回路51には、RSフリップフロップ49
の非反転出力Qも入力されている。回数カウンタ41から
ボロー出力BOが発生した時点では、回数カウンタ41の出
力端Q0〜Q4の出力はすべて“H"(すなわち、出力値が11
111)になるから、論理回路51では、このような状態が
検出されたときに、出力を“H"にする。論理回路51の出
力は初期化信号initとともにRSフリップフロップ52に入
力される。このRSフリップフロップ52の反転出力は、
カウントダウン信号との論理和の否定を出力する論理回
路53に入力される。RSフリップフロップ52の反転出力
は初期化状態では“L"であって、論理回路51の出力が立
ち上がると“H"になる。したがって、論理回路53は、カ
ウントダウン信号が発生するとカウントダウン信号を反
転した信号を商シフト信号msftとして出力し(第4図
(m)参照)、ボロー出力BOの発生により商シフト信号
msftを停止させるのである。したがって、商シフト信号
はmsftは、繰り返し回数Nと同数だけ出力されることに
なる。ここに、RSフリップフロップ52の非反転出力Q
は、回数カウンタ41のボロー出力が立ち下がるまで“H"
になっているのであって、上述した論理回路36に入力さ
れており、商シフト信号msftの終了と同時にカウントダ
ウン信号が停止するようにラッチ回路35を制御する。 ところで、除数Dsが0であるときには、除算結果は不
能または不定になるから、このような状態はエラーとし
て検出することが必要である。除数Dsが0ならば、除数
符号信号sign2は“L"であり、回数カウンタ41のキャリ
ー出力COは“L"になり、さらに、キャリー出力COが“L"
になってもレジスタ監視信号rinは発生していない
(“H"に保たれている)から、論理回路54において、こ
れらの信号の組み合わせにより除数Dsが0かどうかを判
定する。すなわち、論理回路54は、除数符号信号sign2
が“L"、キャリー出力COが“L"レジスタ監視信号が“H"
であると出力を“H"にするのであって、カウント信号cn
tにより除数Dsの全桁をシフトした後にキャリー出力CO
が“L"になると、除数Dsが0であると判定して出力を
“H"にする。論理回路54の出力は初期化信号initととも
にRSフリップフロップ55に入力される。RSフリップフロ
ップ55は、初期状態では反転出力を“L"にしており、
論理回路54によって除数Dsが0であると判定されると、
反転出力をエラー信号errとして“H"にするのであ
る。エラー信号errが発生しない限りは、RSフリップフ
ロップ55の非反転出力Qが“H"であり、非反転出力Qは
上述した論理回路36に入力されていて、エラー信号err
が発生していないときには、カウントダウン信号が出力
されるようにラッチ回路35を制御する。 ところで、演算停止信号stopは、演算停止信号stopの
立ち上がりで出力を“H"にするラッチ回路56にも入力さ
れており、このラッチ回路56の出力は切換信号sw3にな
る(第4図(n)参照)。すなわち、上述したように、
回数カウンタ41には繰り返し回数Nから1を引いた値が
設定されるのであって、この値に基づいて加算器3によ
る所定回数の加算を終了すると演算停止信号stopが短時
間だけ“L"になるから、演算停止信号stopの立ち上がり
で切換信号sw3を立ち上げて剰余シフトレジスタ5をシ
フトモードに切り換えるのである。 切換信号sw3が“H"になった後は、回数カウンタ61に
設定された値に基づいて、剰余シフト信号rsftと演算終
了信号endとを発生させる。すなわち、回数カウンタ61
には繰り返し回数Nから1を引いた値が設定されている
から、回数カウンタ61の出力端Q0〜Q4からの出力値が1
になるまでは、剰余シフト信号rsftを出力し、出力値が
0になった時点で剰余シフト信号rsftを停止し、演算終
了信号endを出力すればよいのである。回数カウンタ61
のダウン入力DONWには、RSフリップフロップ52の反転出
力と、論理回路62の出力と、第4フェイズ信号ph4を
反転した信号との論理積の否定を出力する論理回路63を
通した信号が入力される。論理回路63は、回数カウンタ
61の出力値が0以外のときには出力を“H"にする。除数
Dsが0でなければ、商シフト信号msftが停止した時点で
は、RSフリップフロップ52の反転出力と論理回路62の
出力とはともに“H"であるから、商シフト信号msftが停
止した後、論理回路63の出力であるカウントダウン信号
は、第4フェイズ信号ph4と同じ信号になる。このカウ
ントダウン信号が剰余シフト信号rsftとして剰余シフト
レジスタ5に入力されるのであって(第4図(o)参
照)、このカウントダウン信号によって回数カウンタ44
の出力値が0になると論理回路63の出力が“H"になるか
ら、剰余シフト信号rsftは、繰り返し回数Nに対して
(N−1)個発生して停止することになる。 剰余シフト信号rsftの出力が停止すると、演算終了信
号endが立ち上がる(第4図(p)参照)。すなわち、
商シフト信号msftが停止してRSフリップフロップ52の非
反転出力Qが“L"になると、この非反転出力Qと初期化
信号initとの論理和を出力する論理回路64の出力が立ち
下がり、論理回路62の出力を反転した値を第4フェイズ
信号ph4の立ち下がりでラッチするラッチ回路65を動作
可能にする。要するに、ラッチ回路65は、回数カウンタ
61にカウントダウン信号が入力されるたびに論理回路62
の出力の反転値をラッチするのであって、回数カウンタ
61の出力値が0になると、ラッチ回路65の出力は、第4
フェイズ信号ph4の立ち下がりに伴って“H"になる。ラ
ッチ回路65の出力はRSフリップフロップ55の出力との論
理和の否定を出力する論理回路66に入力されているか
ら、エラー信号errが立ち上がっていなければ、回数カ
ウンタ61に対するカウントダウン信号の終了に伴って論
理回路66の出力は立ち下がる。また、エラー信号errが
立ち上がれば、回数カウンタ61の出力値にかかわらず論
理回路66の出力は立ち下がる。この論理回路66の出力が
演算終了信号endとして出力されるのである。要する
に、回数カウンタ61へのカウントダウン信号が剰余シフ
ト信号rsftとして出力され、回数カウンタ61の出力値が
0になって、剰余シフトレジスタ5の内容のシフトが完
了すると、演算終了信号endが発生するのである。 PCのCPUでは、演算終了信号endによる割り込みを受け
ると、商Mおよび剰余Rを除算器から受け取るのであ
る。In this embodiment, control signals for performing various controls inside the divider
A controller 10 that generates
Do not exchange signals with CPU of programmable controller)
I need it. The configuration of each part except the controller 10 is
Almost the same as the configuration of FIG. 6 described in the section “Prior Art”
Is. However, in this embodiment, signed division is performed.
And the dividend and divisor are both 32 bits.
ing. In addition, negative numbers are expressed in 2's complement.
To do. As shown in FIG. 1, the dividend Dd is passed through the selector 6
The dividend register 1 is set and the divisor Ds is the divisor shift level.
It is set in Dista 2. Also, the dividend Dd and the divisor Ds
The most significant bit, which is the sign bit of
11 and divisor code latch 12 respectively. dividend
Dd and divisor Ds are the instructions to start the calculation from the CPU of the PC.
Before the calculation start signal start is given to the controller 10,
Stand up and load signal ld1 output from controller 10
It is given from the PC in synchronization with the operation start signal start
Is output from controller 10 after is output
Synchronized with signal ld1, dividend register 1 and divisor respectively
It is latched in the shift register 2. Here, the dividend register
Star 1, divisor shift register 2, dividend code latch 11,
The divisor code latch 12 is reset by the operation start signal start.
It is supposed to be. The quotient M and the calculation result
And the remainder R are the quotient shift register 4 and the remainder shift, respectively.
It is stored in the register 5. Here, the quotient shift register 4
And the remainder shift register 5 has a dividend Dd and a divisor Ds.
The initialization signal init output immediately after the latch of
Is set. When the quotient M and the remainder R are obtained, the operation end
Completion signal end is output from controller 10 to the outside
Is indicated to the PC. The selector 6 provided before the dividend register 1 is
Depending on the switching signal sw1 from the tracker 10, the dividend Dd and the part
Which of the fractional dividend Dp is to be input to the dividend register 1
Select In the switching signal sw1, the dividend Dd is the dividend register
Pass the dividend Dd until it is latched by
Cuts the selector 6 so that it passes the partial dividend Dp.
Change it. In addition, data is stored in dividend register 1.
The write enable input WE that sets the timing for
The load signal ld1 described above and the load signal ld2 described later are logical
It is input via the circuit 21. This logic circuit 21 loads
Outputs the negation of the AND of the signal ld2 and the load signal ld1
The load signal ld1 rises and the load signal ld2 rises.
When falling, the data in the dividend register 1
Is being done. Internal calculation is a positive number
When the dividend Dd is a negative number, the complementer 13
Thus, the two's complement of the dividend Dd is obtained. However, 2
The complement of is calculated only once at the start of calculation,
Interface 13 will only pass data. Also, the dividend
When Dd is a positive number, complementer 13
I will only let it pass. The operation of complementer 13 is
The switching signal sw2 output from the controller 10
Can be replaced. This switching signal sw2 is used for the dividend code latch 11
Is set based on the dividend code signal sign1 which is the output of
It On the other hand, the divisor Ds is the divisor shift register as described above.
Taken in 2. The divisor shift register 2 is
Latch mode and shift by switching signal sw1
And the latch mode
Then, latch the data in synchronization with the signal to the clock input CK.
However, in shift mode, it is synchronized with the signal to clock input CK.
Shift the data to the left one digit at a time. Divisor shift register
The load signal ld1 and the control signal
Of the count signal cnt from the controller 10 via the logic circuit 22
Is entered. Logic circuit 22 counts with load signal ld1
Outputs the negation of the logical product with the signal cnt. Load signal ld1
Latch mode by switching signal sw1 when output
Is selected and the divisor Ds is stored in the divisor shift register 2.
Be cut. When the count signal cnt is input
Shift mode is selected by the switching signal sw1.
The divisor Ds set in the divisor shift register 2 is
One digit is shifted to the left in synchronization with the count signal cnt,
Meanwhile, in the controller 10, the divisor shift register 2
Register monitoring signal ri is used to determine whether the most significant bit is 1.
monitor by n. Divisor shift in controller 10
Counts when the most significant bit of register 2 becomes 1.
Stop the signal cnt and wait until the count signal cnt stops.
The value obtained by adding 1 to the number of generated unt signal cnt is repeated.
Let N be the number. When the number of iterations N is determined, the controller 10
Returns the lag signal flg to the PC, and the PC receives the flag signal flg
Then, the controller 10 corresponds to the number of repetitions N.
Request the number signal num. PC based on this frequency signal num
Then, estimate the time required for division, and
The appropriate process is selected and executed. Once the number of iterations N has been determined, the section of "Prior Art"
The calculation is performed according to the procedure described in. Divisor Ds is a positive number
If so, the two's complement of the divisor Ds is obtained, and the divisor Ds is a negative number.
If there is, the output of the divisor shift register 2 is directly added to the adder 3
Is input to Here, the two's complement of the divisor Ds is the complement
It is required without using a mentor. That is, the divisor shift level
Each bit of the register 2 is not inverted by the output selection signal.
Force and inverting output.
If the number Ds is a positive number, the output of the divisor shift register 2
Inverted output is selected and carry in adder 3
Output 1 to force CIN. That is, the divisor Ds is a positive number
And 1,0 of each bit of divisor Ds is inverted and 1 is
Since they are added, the two's complement of the divisor Ds is obtained.
It Output selection signal to divisor shift register 2 and adder
The signal to the carry input CIN of 3 is the divisor sign latch 12
Of the divisor code signal sign2, which is the output of
It is set to be 1 when it is a number. Divisor Ds is negative
Then, the output of the divisor shift register 2 becomes a non-inverted output.
Therefore, the carry input CIN of the adder 3 becomes 0. The adder 3 outputs the output value of the complementer 13 and the divisor shift
The output value of register 2 is added. Also carry input
If CIN is 1, add carry-in CIN to the least significant bit.
Calculate. The output value of adder 3 is 33 bits,
The bit becomes the sign bit. Sign of output value of adder 3
No. bit becomes the selection signal sel to the selector 7, and the remaining 3
2 bits are input to the selector 7. With selector 7
Depending on the selection signal sel, the output value of the adder 3
Or output 0, the output value of the adder 3 is output.
However, if it is shown to be a negative number, the complementer 13
Output the force value. That is, the output value of the selector 7 is a partial
It becomes the dividend Dp. The output value of the selector 7 shifts to the left by one digit.
Is set in the dividend register 1 via the selector 6.
To be Here, the output of the selector 7 and the selector
The input of 6 and the input are shifted by one digit and are connected.
A value obtained by shifting the output value of the selector 7 to the left by one digit by a line
Is input to the selector 6. Also, at this point
The switching signal sw1 to the controller 6 indicates the partial dividend Dp
Needless to say, it is set so that
Yes. The partial dividend Dp is the log output from the controller 10.
Latched in dividend register 1 in synchronization with the read signal ld2
It Also, the selection signal sel is added by the adder 3
Whether the result is 0 if the result is positive or 0, and 1 if it is negative
The selection signal sel via the knot circuit 23.
Set to the least significant bit of star 4. That is, the partial coverage
If the divisor Dp is a positive number or 0, the quotient shift register 4
The least significant bit is incremented by 1, and if it is a negative number, the quotient shift register
0 is set in the least significant bit of data 4. control
From La10, quotient shift signal msft together with load signal ld2
Is output and the partial dividend Dp is set in the dividend register 1.
The value set in the quotient shift register 4 is 1 digit
It is designed to be shifted to the left. Quotient shift signal msft
Is output each time the addition operation is performed by the adder 3.
The same number of times as the number of repetitions N, while the load signal
ld2 is output by the number of iterations N minus 1.
It Here, in the dividend register 1, the load signal ld2
Data is latched by the load signal ld1 in advance.
Therefore, as a result, the data of
Will be switched. The controller 10 is based on the divisor Ds.
Repeat the above procedure for the number of repetitions N calculated by
Controls each part. The calculation is repeated N times.
Then, the quotient M is stored in the quotient shift register 4.
It By the way, whether the quotient M becomes a positive number or a negative number depends on
It is determined by the sign of divisor Dd and divisor Ds (dividend
If the divisor and the divisor have the same sign, a positive number;
Exclusive output of divisor code latch 11 and divisor code latch 12
The output of the logic circuit 24 that outputs the logical OR is
Positive or negative can be determined. Therefore, the quotient M is a negative number
When it becomes, it is completed based on the output value of the logic circuit 24.
The mentor 14 complements the output value of the quotient shift register 4 by 2.
Calculate the number and set it as the quotient M. When the quotient M becomes a positive number,
The implementer 14 keeps the output value of the quotient shift register 4 as it is.
And let it be a quotient M. The dividend Dd is the maximum number and
Since the quotient M overflows when the number Ds is -1,
With the most significant bit of complementer 14 and the output of logic circuit 24
It is determined whether there is an overflow based on the
Overflow latch 16 is closed when low occurs.
Latch the buffalo signal over. On the other hand, the remainder shift register 5 is added by the adder 3.
Is selected, the selector is synchronized with the load signal ld2.
Latch the output value of 7. The remainder shift register 5 is
Switch mode and shift mode are selected by the switching signal sw3.
Selected, and clock input in latch mode.
Data is latched in synchronization with the signal to the
Mode, the data is moved to the right in synchronization with the signal to the clock input CK.
Shift one digit at a time. Clock of remainder shift register 5
Input signal CK has load signal ld2 and operation stop signal sto
p and the remainder shift signal rsft are input via the logic circuit 25.
I will be forced. The logic circuit 25 calculates and negates the load signal ld2.
Outputs the negation of the logical product of the stop signal stop and the remainder shift signal rsft
Force Load signal ld2 and operation stop signal stop are input
Latch mode is selected by the switching signal sw3.
Has been selected and is selected each time the adder 3 performs an addition operation.
The output value of the data 7 is latched. Therefore, the load signal
Repeated times N by ld2 and operation stop signal stop
The output value of the selector 7 will be latched. In addition,
The arithmetic shift signal stop is output to the extra shift register 5.
Immediately after that, the switching signal sw3 output from the controller 10
Shift mode, at which point the remainder shift register
Data stored in data 5 into the remainder shift signal rsft.
It shifts to the right one digit at a time. That is,
Residue shift residue at the time when the operation stop signal stop is output
The remainder stored in data 5 is 1 from the number of repetitions N
The digit shifts to the left by the number of subtracted digits.
No. rsft shifts to the right by (N-1) digits.
It If the dividend Dd is negative, is the remainder also negative?
Based on the dividend code signal sign1
Find the 2's complement of the output value of the remainder shift register 5 at 5
Let the remainder be R. When the dividend Dd is a positive number, the comp
The rementer 15 outputs the output value of the remainder shift register 5 as it is.
And let it be the remainder R. In this way, the remainder of the remainder shift signal rsft
When the digit alignment is complete, the controller 10
The calculation end signal end is output to the outside, and the CPU of the PC
And the remainder R. Therefore, the PC
Signals for synchronization, dividend Dd, divisor Ds, calculation for calculator
After the start signal start is given, the operation end signal e from the divider
Until nd is output, other processing is performed regardless of division.
Can be executed and pipes for division
Line processing becomes possible. Signals for operating each part are output by the above procedure.
In order to apply the force, the controller 10 is configured as shown in FIG.
Be done. For synchronization input from the PC to the controller 10
The system clock signal clk and three types of phase
Signals ph2, ph4, ph6, and dividend Dd, divisor from the CPU of the PC
When Ds and the operation start signal start are given, the division is started.
So that each signal is sequentially output. Phase signal ph2, ph4,
ph6 is a system clock signal clk (Fig. 3 (b), 4th).
Each half cycle in Fig. (A)) is defined as 1 phase and 6 phases
The second of the six phase signals that make up one cycle
Phase signal ph2, 4th phase signal ph4, 6th phase
The signal ph6 is used. Each phase signal ph2, ph4, ph6 is the third
As shown in Figures (c) to (e) and Figures 4 (b) to (d).
, Becomes "L" in the corresponding phase. When the CPU of the PC requests division, refer to Fig. 3 (a).
After giving the dividend Dd and the divisor Ds as shown in Fig. 3 (a)
(Part where the lines intersect), FIG. 3 (f), 4
As in Figure (e). Give the calculation start signal start (standing
Lower). Given the calculation start signal start,
As above, dividend register 1, divisor shift register 2,
The dividend code latch 11 and the divisor code latch 12 are reset respectively.
It is canceled. As shown in Fig. 3 (g) and Fig. 4 (f).
Control signal before the operation start signal start is given.
Only the load signal ld1 is generated from LA10.
Then, the load signal ld1 is the rising edge of the second phase signal ph2.
Latch that latches the negative of the operation start signal start when rising
OR of inverted output of circuit 31 and second phase signal ph2
To be obtained as the output signal of the logic circuit 32 that outputs
Has become. That is, the calculation start signal start is input.
Before the reset, the inverted output of the latch circuit 31 is "L",
Second phase signal ph2 becomes load signal ld1 and calculation starts
The first second phase signal ph2 after the signal start is input
2nd phase after is output as the load signal ld1
Inverted output of latch circuit 31 due to rising of signal ph2
Becomes “H”, and the load signal ld1 does not change after that.
It The non-inverted output Q of the latch circuit 31 is the initialization signal init.
Inverted output as shown in Fig. 3 (h) and Fig. 4 (g)
Is output (falls) when becomes “H”. initial
When the conversion signal init is output, the quotient shift register 4, the remainder
The shift register 5, the number counters 41, 51 described later, etc.
Reset is released. The dividend Dd and the divisor Ds rise when the load signal ld1 rises.
The dividend register 1 and the divisor shift register respectively.
When latched by the star 2, FIG. 3 (i) and FIG. 4 (h)
, The switching signal sw1 changes from "L" to "H".
Then, as described above, the dividend shift register 2 is latched.
Mode to shift mode and select
Switch so that the output of the controller 6 becomes the output of the selector 7.
It The switching signal sw1 is the sixth signal after the initialization signal init is generated.
Latch the output to "H" at the rising edge of phase signal ph6
It is obtained as the output of the latch circuit 33. Ie initialization
The sixth phase signal ph in the cycle in which the signal init is output
The switching signal sw1 rises with the rise of 6.
It After that, the switching signal sw1 is kept at "H" until the calculation is completed.
Be drunk The divisor shift register 2 is shifted by the switching signal sw1.
3 (j) and 4 (i) when switched to the mode
Divisor shift register synchronized with count signal cnt like
The divisor Ds latched in data 2 is shifted one digit to the left.
Be done. The count signal cnt is obtained as the output of the logic circuit 34.
To be In the logic circuit 34, after the initialization signal init is generated,
The output goes to "H" at the first fall of the second phase signal ph2
The output of the latch circuit 35 for latching and the divisor shift register
Register monitoring that becomes "L" when the most significant bit of 2 becomes 1
Signal rin (see Fig. 4 (j)) and system clock signal
Outputs the negation of the logical product with No. clk. Ie initialization
The signal init goes through the logic circuit 36 along with other signals described later.
Input to the latch circuit 35 before the initialization signal init is generated.
Alternatively, if another signal described later is “L”, the latch circuit 35
The output is held at "L". Initialization signal init is the second phase
It occurs at the rising edge of the signal ph2, and the switching signal sw1 is the first
The sixth phase signal within the same cycle as the generation of the period signal init
Since it rises with the rise of No. ph6, the latch
The output of the path 35 is output after the cycle when the switching signal sw1 rises.
The falling edge of the second phase signal ph2 in the cycle
Becomes "H". On the other hand, the register monitoring signal rin
Occurs when the most significant bit of shift register 2 becomes 1.
(Falls down), and is it "H" until then?
As for the count signal cnt, the switching signal sw1 has risen.
After that, after the output of the latch circuit 35 becomes "H", register monitoring
Until the visual signal is generated (“L”), the system clock
It is output as an inverted signal of the lock signal clk. divisor
When the most significant bit of shift register 2 becomes 1, the register
Data count signal rin is generated (becomes "L")
No. cnt stopped (maintained at “H”), divisor shift register
2 stops shifting the divisor Ds. The count signal cnt has a 5-bit up / down output.
A pair of counters 41 and 51 consisting of counters
It is also input to the force UP, and it is counted by each number counter 41, 51
Count up the number of times the signal cnt falls. each time
Number counters 41 and 51 are input to CLEAR input CLEAR respectively.
Is initialized by the initialization signal init (output value is 00
000), both count counters 41 and 51 receive a count signal.
The number of occurrences of signal cnt is set. That is, the number of times cow
The value obtained by subtracting 1 from the number of repetitions N is set in the
To be The count input of one counter 41, DOWN,
The down signal is input. Countdown signal
It is obtained as the output of the logic circuit 37. The logic circuit 37 is a latch
The output of the circuit 35, the output of the latch circuit 38, and the fourth phase
Outputs the negation of the logical product with the negation of the signal ph4. Latch times
The output of the latch circuit 35 is negated and the register monitoring signal is
The output of the logic circuit 39 that outputs the negation of the logical sum with the signal rin is
Input as data, generation of initialization signal init
After that, the data is changed by the rising edge of the sixth phase signal.
It is supposed to be. Therefore, the counting signal
After the output of signal cnt is started, the divisor shift register 2
The most significant bit becomes 1 and the register monitoring signal rin is generated.
When it falls (falls), the output of the logic circuit 39 becomes “H”,
The rise of the first 6th phase signal ph6 output after that
As the output rises, the output of the latch circuit 38 becomes "H".
is there. In short, the count down which is the output of the logic circuit 37
Is the cycle in which the count signal cnt has been output.
From the next cycle of, output with the 4th phase signal ph4.
Will be forced. The output of the latch circuit 38 is
When the number of returns N is decided, it becomes "H", so it is repeated
Issued as a flag signal flg that returns to the PC that the number has been determined.
When this flag signal flg is generated, the number of times
The output value of the counter 41 corresponds to the number of repetitions N
Estimate the time required for division by reading it as No. num
It By the way, the switching signal sw2 is the system clock signal clk.
Latch that latches the dividend code signal sign1 at the falling edge of
It is obtained as the output of the H circuit 42. This latch circuit 42 is
Initialization signal init and down input of frequency counter 41 to DOWN
The operating state is set based on the countdown signal and
It That is, when the initialization signal init is generated, the output is "H".
The countdown signal after the initialization signal init is generated.
Latch circuit 43 that latches the output at "L" at the falling edge of the signal
And the output of the latch circuit 43 and the initialization signal init.
And a logic circuit 44 that is provided, and the output of the logic circuit 44 is “H”.
And the output of the latch circuit 42 is kept at "L"
System clock signal clk when the output of circuit 44 is low
The dividend code signal sign1 is input to the latch circuit 42 at the falling edge of
It is designed to be latched. Logic circuit 44 latches
The negation of the logical product of the output of path 43 and the negation of the initialization signal init
Output. Therefore, the output of the logic circuit 44 is the initialization signal.
It goes to "L" with the occurrence of No. init and the first counter
It goes to "H" when the down signal falls. as a result,
The switching signal sw2 is the first signal after the initialization signal init is generated.
Dividend due to falling of system clock signal clk
It becomes the output corresponding to the code signal sign1, and then the first
Goes to "L" when the countdown signal of falls
Of. The output from the output terminals Q0 to Q4 of the frequency counter 41
Entered on road 45. In this logic circuit 45,
41 5-bit outputs are all "L" (that is, the output value is
It outputs a signal that is the countdown signal inverted until it reaches 0).
Force The output of this logic circuit 45 becomes the load signal ld2.
(See FIG. 4 (k)). In short, the load signal ld2 is
The countdown signal output to the frequency counter 41 opens.
From the start until the output value of the counter 41 becomes 1
In between, (N-1) load signals for the number of repetitions N
It outputs ld2. In addition, the frequency counter 41
Output from carry output CO when force overflows
(Hereafter, carry output CO) is set to "L" and output
When the underflow occurs, the output from the borrow output terminal BO (below
Below, borrow output BO is abbreviated)
ing. That is, the output values from the output terminals Q0 to Q4 are 0 to 11
Within the 111 range, carry output CO and borrow output BO
Are both "H", but when the output value exceeds the above range,
One becomes "L". Carry output CO and borrow output
BO is input to the logic circuit 46 that outputs the negation of the logical product,
The output of the logic circuit 46 is input to the latch circuit 47. latch
The circuit 47 outputs the logic circuit 46 after the initialization signal init is generated.
The output is inverted when the force rises. According to
The output of the latch circuit 47 is the initialization signal init.
Sometimes "L", carry output CO and borrow output BO
When either of the two becomes "L", it becomes "H". Computation stop signal stop is based on borrow output BO and latch circuit 46.
The output of the logic circuit 48 that outputs the logical sum of the output and
When the borrow output BO occurs, the logic circuit 46 and latch
A signal that becomes "L" only for the time delay due to path 47
No. stop is output (see FIG. 4 (l)). Computation stop
The signal stop is the RS flip-flop with the initialization signal init
Entered in 49. This RS flip-flop 49 is
In the state, the non-inverting output Q is set to “L”, and the initialization signal init
After the occurrence of the
The inverted output Q is set to "H". Non flip of RS flip-flop 49
The inverted output Q is input to the logic circuit 45, and the borrow output BO
The non-inverted output Q of the RS flip-flop 49 becomes "H".
After that, keep the load signal ld2 at "L".
It Further, the output of the RS flip-flop 49 is output to the logic circuit 45.
At the same time, the output of the latch circuit 46 is also input.
When carry output CO is generated from the Unta 41,
The output signal ld2 is output. The output terminals QO to Q4 of the frequency counter 41 are loaded with the load signal.
In the logic circuit 51 provided separately from the logic circuit 45 that creates ld2
Is also entered. The logic circuit 51 includes an RS flip-flop 49
The non-inverted output Q of is also input. From the counter 41
When the borrow output BO occurs, the counter 41 outputs
The outputs of the input terminals Q0 to Q4 are all “H” (that is, the output value is 11
111), logic circuit 51
When detected, the output is set to "H". Output of logic circuit 51
Force enters the RS flip-flop 52 with the initialization signal init.
I will be forced. The inverted output of this RS flip-flop 52 is
A logic circuit that outputs the negation of the logical sum with the countdown signal
Entered on path 53. Inverted output of RS flip-flop 52
Is "L" in the initialized state, and the output of the logic circuit 51 rises.
It rises to "H". Therefore, the logic circuit 53 is
When a countdown signal is generated, the countdown signal is
The inverted signal is output as the quotient shift signal msft (Fig. 4
(See (m)), quotient shift signal due to occurrence of borrow output BO
Stop msft. Therefore, the quotient shift signal
Means that msft will be output as many times as the number of repetitions N
Become. Here, the non-inverted output Q of the RS flip-flop 52
Is “H” until the borrow output of the frequency counter 41 falls.
Is input to the logic circuit 36 described above.
When the quotient shift signal msft ends,
The latch circuit 35 is controlled so that the down signal is stopped. By the way, when the divisor Ds is 0, the division result is not
This is an error because it will be indeterminate or indeterminate.
It is necessary to detect it. If divisor Ds is 0, divisor
The code signal sign2 is "L", and the carrier of the frequency counter 41 is
ー Output CO becomes “L” and carry output CO becomes “L”
Register monitoring signal rin is not generated
(Hold to “H”)
The combination of these signals determines whether the divisor Ds is 0 or not.
Set. That is, the logic circuit 54 uses the divisor code signal sign2
Is “L”, carry output CO is “L”, register monitoring signal is “H”
, The output is set to “H” and the count signal cn
Carry output CO after shifting all digits of divisor Ds by t
When becomes "L", it is determined that the divisor Ds is 0 and the output is
Set to “H”. The output of the logic circuit 54 is
Is input to the RS flip-flop 55. RS flip flow
In the initial state, the up 55 sets the inverted output to "L",
When the logic circuit 54 determines that the divisor Ds is 0,
The inverted output is set to "H" as the error signal err.
It As long as the error signal err does not occur, the RS flip-flop
The non-inverting output Q of the lop 55 is “H”, and the non-inverting output Q is
The error signal err that has been input to the logic circuit 36 described above
A countdown signal is output when is not generated
The latch circuit 35 is controlled as described above. By the way, the calculation stop signal stop is
It is also input to the latch circuit 56 that sets the output to “H” at the rising edge.
The output of this latch circuit 56 becomes the switching signal sw3.
(See FIG. 4 (n)). That is, as mentioned above,
The value obtained by subtracting 1 from the repeat count N is displayed in the count counter 41.
It is set, and the adder 3 is based on this value.
When the calculation stop signal stop is short after the addition of the specified number of times
Since it goes to "L" only for a while, the rising edge of the calculation stop signal stop
The switching signal sw3 is raised by and the remainder shift register 5 is switched.
Switch to soft mode. After the switching signal sw3 becomes "H", the counter 61
Based on the set value, the remainder shift signal rsft and the operation end
Generate the end signal end. That is, the frequency counter 61
Is set to the value obtained by subtracting 1 from the number of repetitions N
The output value from the output terminals Q0 to Q4 of the number counter 61 is 1
Until, the remainder shift signal rsft is output and the output value is
When the value becomes 0, the remainder shift signal rsft is stopped and the operation ends.
It is sufficient to output the end signal end. Counter 61
Down input DONW of RS flip-flop 52
Force, the output of the logic circuit 62, and the fourth phase signal ph4
Set the logic circuit 63 that outputs the negative of the logical product with the inverted signal.
The passed signal is input. The logic circuit 63 is a frequency counter
When the output value of 61 is other than 0, the output is set to "H". divisor
If Ds is not 0, when the quotient shift signal msft stops
Is the inverted output of the RS flip-flop 52 and the logic circuit 62
Since both output and “H”, quotient shift signal msft is stopped.
After stopping, the countdown signal which is the output of the logic circuit 63
Becomes the same signal as the fourth phase signal ph4. This cow
Shift-down signal is remainder-shifted as remainder shift signal rsft
It is input to the register 5 (see Fig. 4 (o)).
), The counter 44 by this countdown signal
When the output value of is 0, does the output of the logic circuit 63 become "H"?
, The remainder shift signal rsft is
(N-1) pieces are generated and stopped. When the output of the remainder shift signal rsft stops, the operation end signal
No. end rises (see Fig. 4 (p)). That is,
The quotient shift signal msft stops and the RS flip-flop 52
When the inverted output Q becomes "L", this non-inverted output Q and initialization
The output of the logic circuit 64 that outputs the logical sum of the signal init and
The value obtained by inverting and inverting the output of the logic circuit 62 decreases in the fourth phase.
Operates the latch circuit 65 that latches at the falling edge of the signal ph4
enable. In short, the latch circuit 65 is
Each time a countdown signal is input to 61, logic circuit 62
The inverted value of the output of
When the output value of 61 becomes 0, the output of the latch circuit 65 becomes the fourth
It goes to "H" with the falling edge of the phase signal ph4. La
The output of the switch circuit 65 is the same as the output of the RS flip-flop 55.
Is it input to the logic circuit 66 that outputs the negative of Riwa?
If the error signal err has not risen, the
With the end of the countdown signal for the Unta 61
The output of the logic circuit 66 falls. Also, the error signal err
If it rises, it will be discussed regardless of the output value of the frequency counter 61.
The output of the logic circuit 66 falls. The output of this logic circuit 66 is
It is output as the operation end signal end. Take
The countdown signal to the frequency counter 61
Output as the output signal rsft and the output value of the frequency counter 61
It becomes 0 and the shift of the contents of the remainder shift register 5 is completed.
When completed, the operation end signal end is generated. The CPU of the PC receives an interrupt from the operation end signal end.
Then, the quotient M and the remainder R are received from the divider.
It
本発明は上述のように、被除数および除数より商およ
び剰余を求める除算部を制御するコントローラを設けて
おり、コントローラでは、被除数および除数がプログラ
マブルコントローラより与えられて演算開始信号が入力
されると、被除数および除数に基づいて繰り返し回数を
求めるとともに、繰り返し回数だけ減算が行われたこと
を判定して演算終了信号を出力して商および除数を引き
渡すようにしているので、プログラマブルコントローラ
は演算開始信号を出力してから演算終了信号を受け取る
までの間に除算に関する信号を授受する必要がないので
あって、除算中に他の処理を行うことができるのであ
る。すなわち、パイプライン化によって高速な演算が可
能になるという利点を有するのである。また、繰り返し
回数が設定されると、その繰り返し回数をプログラマブ
ルコントローラに返すようにしているので、プログラマ
ブルコントローラでは、繰り返し回数に基づいて除算の
終了までに要する時間を予測することができ、除算が終
了するまでにプログラマブルコントローラで行う処理の
内容を予測時間に基づいて選択できるという利点があ
る。As described above, the present invention is provided with a controller that controls a division unit that obtains a quotient and a remainder from a dividend and a divisor, and in the controller, when the dividend and the divisor are given by a programmable controller and a calculation start signal is input, The programmable controller determines the number of iterations based on the dividend and the divisor, determines that subtraction has been performed by the number of iterations, and outputs a computation end signal to pass the quotient and divisor. Since it is not necessary to send and receive a signal regarding division between the output and the reception of the operation end signal, other processing can be performed during the division. That is, there is an advantage that a high-speed operation becomes possible by using the pipeline. Also, when the number of repeats is set, the number of repeats is returned to the programmable controller, so the programmable controller can predict the time required to complete the division based on the number of repeats, and the division ends. Before that, there is an advantage that the contents of the processing performed by the programmable controller can be selected based on the estimated time.
第1図は本発明の全体構成を示すブロック図、第2図は
同上に用いるコントローラを示す回路図、第3図および
第4図は同上の動作説明図、第5図は除算の原理を説明
する説明図、第6図は従来例を示すブロック図である。 1……被除数レジスタ、2……除数シフトレジスタ、3
……加算器、4……商シフトレジスタ、5……剰余シフ
トレジスタ、6,7……セレクタ、10……コントローラ。FIG. 1 is a block diagram showing an overall configuration of the present invention, FIG. 2 is a circuit diagram showing a controller used in the same as above, FIGS. 3 and 4 are operation explanatory diagrams of the same as above, and FIG. 5 is a principle of division. FIG. 6 is a block diagram showing a conventional example. 1 ... dividend register, 2 ... divisor shift register, 3
... Adder, 4 ... quotient shift register, 5 ... remainder shift register, 6, 7 ... selector, 10 ... controller.
Claims (1)
定された第1記憶手段および第2記憶手段と、第1記憶
手段に格納された値から第2記憶手段に格納された値を
減算する減算手段と、減算結果が正または0のときには
減算結果を第1記憶手段に格納し減算結果が負のときに
は第1記憶手段の出力値を第1記憶手段に格納する選択
手段と、減算を行った後に第1記憶手段に格納される値
に対して第2記憶手段の格納値を相対的に1桁右にシフ
トさせるシフト手段と、減算結果が正または0のときに
は対応する桁に1が格納され負のときには対応する桁に
0が格納される第3記憶手段と、減算を所定の繰り返し
回数だけ繰り返した後の減算結果が格納される第4記憶
手段と、減算が上記繰り返し回数だけ行われると減算を
停止させるコントローラとを具備し、コントローラは、
プログラマブルコントローラより第1記憶手段と第2記
憶手段とに対してそれぞれ被除数と除数とが引き渡され
た状態でプログラマブルコントローラより演算開始信号
を受けると、除数の最上位ビットから連続する0を除去
して第2記憶手段の最上位ビットが1になるように設定
するとともに、除数の最上位から連続する0を除去した
残りの桁数を被除数の桁数から引いた数に1を加えた値
を繰り返し回数として設定して、設定された繰り返し回
数をプログラマブルコントローラに返し、繰り返し回数
の減算が終了するとプログラマブルコントローラに対し
て演算終了信号を送出して第3記憶手段に格納された商
と第4記憶手段に格納された剰余とを引き渡すことを特
徴とするプログラマブルコントローラ用除算器。1. A first storage means and a second storage means in which a maximum bit length of each stored value is defined, and a value stored in the second storage means is subtracted from a value stored in the first storage means. Subtraction means for storing the subtraction result in the first storage means when the subtraction result is positive or 0, and storing the output value of the first storage means in the first storage means when the subtraction result is negative, and the subtraction After performing, the shift means for relatively shifting the value stored in the second storage means to the right by one digit with respect to the value stored in the first storage means, and when the subtraction result is positive or 0, the corresponding digit has 1 When stored and negative, 0 is stored in the corresponding digit; third storage means; fourth storage means for storing a subtraction result after repeating subtraction a predetermined number of times; Control to stop the subtraction ; And a over La, controller,
When an arithmetic start signal is received from the programmable controller with the dividend and the divisor being delivered from the programmable controller to the first storage means and the second storage means, respectively, consecutive 0s are removed from the most significant bit of the divisor. The most significant bit of the second storage means is set to 1, and the value obtained by subtracting 1 from the number of digits of the dividend and adding 1 to the number of digits remaining after removing consecutive 0s from the most significant digit of the divisor is repeated. It is set as the number of times, the set number of repetitions is returned to the programmable controller, and when the subtraction of the number of repetitions is completed, an operation end signal is sent to the programmable controller and the quotient stored in the third storage means and the fourth storage means. A programmable controller divider that delivers the remainder stored in the.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2152256A JPH0831028B2 (en) | 1990-06-11 | 1990-06-11 | Divider for programmable controller |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2152256A JPH0831028B2 (en) | 1990-06-11 | 1990-06-11 | Divider for programmable controller |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH0444121A JPH0444121A (en) | 1992-02-13 |
| JPH0831028B2 true JPH0831028B2 (en) | 1996-03-27 |
Family
ID=15536509
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2152256A Expired - Fee Related JPH0831028B2 (en) | 1990-06-11 | 1990-06-11 | Divider for programmable controller |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0831028B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2001034472A (en) * | 1999-07-16 | 2001-02-09 | Mitsubishi Electric Corp | Data processing unit and division and remainder algorithm |
-
1990
- 1990-06-11 JP JP2152256A patent/JPH0831028B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH0444121A (en) | 1992-02-13 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5128891A (en) | High speed divider with square root capability | |
| KR940007543B1 (en) | High speed programmable divider | |
| US4893268A (en) | Circuit and method for accumulating partial products of a single, double or mixed precision multiplication | |
| JP2835153B2 (en) | High radix divider | |
| JP3714570B2 (en) | Division circuit for parallel processing | |
| US9009209B2 (en) | Processor, control method of processor, and computer readable storage medium storing processing program for division operation | |
| US3249745A (en) | Two-register calculator for performing multiplication and division using identical operational steps | |
| US8533246B2 (en) | Carry bucket-aware multiplication having bits with most significant bits set to zero | |
| JPH0479015B2 (en) | ||
| JPH0831028B2 (en) | Divider for programmable controller | |
| JPH04291418A (en) | Pre-processor for division circuit | |
| JPH04270415A (en) | High-performance adder | |
| JPH0831027B2 (en) | Divider for programmable controller | |
| JPH0346024A (en) | Floating point computing element | |
| EP0498450A2 (en) | Serial clock generating circuit | |
| US3328566A (en) | Input-output system for a digital computer | |
| Lu et al. | A programmable VLSI architecture for computing multiplication and polynomial evaluation modulo a positive integer | |
| US5313600A (en) | System for controlling the number of data pieces in a queue memory | |
| Elshoff et al. | The binary floating point digital differential analyzer | |
| JP2664750B2 (en) | Arithmetic device and arithmetic processing method | |
| Mayerwieser et al. | Testing a high-speed data path the design of the rsaβ crypto chip | |
| RU2018933C1 (en) | Divider | |
| JP2581131B2 (en) | Transmission queue management method | |
| JPS6027025A (en) | division circuit | |
| Oberman | Division |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| LAPS | Cancellation because of no payment of annual fees |