JP2508269B2 - Square root calculator - Google Patents

Square root calculator

Info

Publication number
JP2508269B2
JP2508269B2 JP13816489A JP13816489A JP2508269B2 JP 2508269 B2 JP2508269 B2 JP 2508269B2 JP 13816489 A JP13816489 A JP 13816489A JP 13816489 A JP13816489 A JP 13816489A JP 2508269 B2 JP2508269 B2 JP 2508269B2
Authority
JP
Japan
Prior art keywords
register
value
square root
zero
bits
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
Application number
JP13816489A
Other languages
Japanese (ja)
Other versions
JPH033033A (en
Inventor
美小夜 中山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
Nippon Electric 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 Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP13816489A priority Critical patent/JP2508269B2/en
Publication of JPH033033A publication Critical patent/JPH033033A/en
Application granted granted Critical
Publication of JP2508269B2 publication Critical patent/JP2508269B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)
  • Executing Machine-Instructions (AREA)

Description

【発明の詳細な説明】 産業上の利用分野 本発明は、平方根演算装置に関する。より詳細には、
本発明は、浮動小数点演算を実行するシステム上で平方
根演算を行う際に、スティッキービット、(Sticky bi
t)を設定する処理を行う装置の新規な構成に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a square root calculation device. More specifically,
The present invention, when performing a square root operation on a system that performs floating point operations, uses a sticky bit (Sticky bi
t) relates to a new configuration of the device that performs the process of setting.

従来の技術 IEEE標準に従って丸めを行う浮動小数点演算装置にお
いて平方根演算を行う場合、精度落ちがあったかどうか
を調べるためのフラグが必要である。即ち、IEEE標準に
よる丸め処理においては、浮動小数点フォーマットの仮
数部最下位ビットより更に下位に、丸め処理のための2
ビット(Guard bitおよびRound bit)とRound bitより
下位のビットすべての論理和をとったビット(Sticky b
it)とが必要である。そして、これらのビットと4種類
の丸めモード(+00の方向、−00の方向、0への方向、
最近値への方向)とに基づいて、切り上げ処理または切
り捨て処理が実行される。
2. Description of the Related Art When performing a square root operation in a floating point arithmetic unit that performs rounding according to the IEEE standard, a flag is required to check whether or not there is a loss of precision. In other words, in the rounding process according to the IEEE standard, 2 bits for the rounding process are placed below the least significant bit of the mantissa part of the floating point format.
Bits (Guard bit and Round bit) and all bits below the Round bit are ORed (Sticky b
it) and are required. And these bits and four rounding modes (+00 direction, -00 direction, 0 direction,
Rounding-up processing or rounding-down processing is performed based on the (direction toward the nearest value).

第2図は、平方根演算処理の過程を示す図である。こ
こで、平方根演算を行った場合の本当の演算結果を無限
精度で表すものとするが、実際には、演算器が無限精度
で演算するのではなく、仮数部にGuard Bit、Round bit
まで平方根を求め、Sticky bitにRound bitより下位の
論理和を入れることにより、あたかも無限精度であった
かのように見せることができる。
FIG. 2 is a diagram showing a process of square root calculation processing. Here, it is assumed that the true operation result when the square root operation is performed is expressed with infinite precision, but in reality, the arithmetic unit does not operate with infinite precision, but the Guard Bit and Round bit in the mantissa part.
By finding the square root up to, and putting the logical OR of the Sticky bit lower than the Round bit, it can be made to appear as if it had infinite precision.

第6図および第7図は、それぞれ、上述のような丸め
のための3ビットを求めるための平方根引き放し法を実
行する装置の構成を示すブロック図と、この装置上で実
行される処理を示すフローチャートである。
FIG. 6 and FIG. 7 respectively show a block diagram showing a configuration of an apparatus for executing the square root ascending method for obtaining 3 bits for rounding as described above, and a process executed on this apparatus. It is a flowchart shown.

まず、第7図に処理701として示すように、入力数用
レジスタ601に入力数をA=a1 a2・・・anを格納した
後、入力数の上位2桁をR0=a1 a2として演算用レジス
タ602に、演算用レジスタ603に“1"をそれぞれ格納す
る。
First, as shown as a process 701 in FIG. 7, after storing the number of inputs A = a 1 a 2 ... a n in the register 601 for number of inputs, the upper two digits of the number of inputs are R 0 = a 1 “1” is stored in the arithmetic register 602 and “1” in the arithmetic register 603 as a 2 .

次に、処理702として示すように、演算用レジスタ602
から603の値を減算し、部分剰余を部分剰余用レジスタ6
05に格納する。
Next, as shown as process 702, the arithmetic register 602
The value of 603 is subtracted from
Store in 05.

ここで、処理703として示すように、部分剰余用レジ
スタのキャリーが“0"即ち、部分剰余が正またはゼロな
らば、処理704として示すように、演算結果用レジスタ
を1ビット左シフトさせ、最下位のビットに“1"をセッ
トする。また、処理704においては、レジスタ601を2ビ
ット左シフトさせ、上位2ビットをレジスタ602の下位
2ビットへ、レジスタ605の値を2ビット左シフトさせ
たものをレジスタ602へ格納する。更に、レジスタ606の
値を2ビット左シフトしたものに“01"を加えたものを
レジスタ603へ格納する。
Here, if the carry of the partial remainder register is “0”, that is, if the partial remainder is positive or zero, as shown as process 703, the operation result register is shifted to the left by 1 bit as shown at process 704, and Set "1" to the lower bit. Further, in the process 704, the register 601 is shifted to the left by 2 bits, the upper 2 bits are shifted to the lower 2 bits of the register 602, and the value of the register 605 is shifted to the left by 2 bits and stored in the register 602. Further, the value obtained by shifting the value of the register 606 by 2 bits to the left and adding “01” is stored in the register 603.

次に、処理705として示すように、レジスタ672から60
3の値を減算する。また、処理706として示すように、処
理702で行った演算結果、即ち、部分剰余が負ならば演
算結果用レジスタを1ビット左シフトさせ、最下位のビ
ットに0をセットする。
Next, as shown as operation 705, registers 672 through 60
Subtract the value of 3. Also, as shown as process 706, if the result of the operation performed in process 702, that is, the partial remainder is negative, the register for the operation result is shifted to the left by 1 bit and 0 is set to the least significant bit.

次に、処理706として示すように、レジスタ601を2ビ
ット左シフトさせ、上位2ビットをレジスタ602へ、レ
ジスタ605の値を2ビット左シフトさせたものをレジス
タ602へそれぞれ格納する。また、レジスタ606の値を2
ビット左シフトしたものに、“11"を加えたものをレジ
スタ6へ格納する。
Next, as shown as a process 706, the register 601 is left-shifted by 2 bits, the upper 2 bits are stored in the register 602, and the value of the register 605 left-shifted by 2 bits is stored in the register 602. In addition, the value of register 606 is set to 2
The value obtained by adding “11” to the bit-shifted one is stored in the register 6.

次に、処理707として示すように、レジスタ602と603
の値とを加算する。
Next, as shown as process 707, registers 602 and 603
And the value of are added.

これら、処理703から707までの処理を、レジスタの桁
数分繰り返すことによって、処理717に示すように、レ
ジスタ606に平方根が得られる。
By repeating these processes 703 to 707 for the number of digits in the register, the square root is obtained in the register 606 as shown in process 717.

続いて、演算結果が精度落ちしたかどうかを調ベる。
即ち、部分剰余レジスタ605の値により、次のように補
正する。
Then, it is checked whether the accuracy of the calculation result has deteriorated.
That is, the value of the partial remainder register 605 is corrected as follows.

(a) レジスタ605の値が0ならば何もしない。(A) If the value of the register 605 is 0, do nothing.

(b) レジスタ605の値が正ならば、処理711として示
すように、レジスタ602とレジスタ603の値を加算する。
(B) If the value of the register 605 is positive, the values of the register 602 and the register 603 are added, as indicated by process 711.

(c) レジスタ605の値が負ならば、処理712として示
すように、レジスタ606の値を2ビット左シフトしたも
のに“01"を加えたものをレジスタ603へ格納し、次に、
処理713として示すように、レジスタ602とレジスタ603
の値を加算する。
(C) If the value of the register 605 is negative, the value obtained by shifting the value of the register 606 by 2 bits to the left and adding “01” is stored in the register 603, as shown as processing 712, and then,
Register 602 and register 603, shown as operation 713.
Is added.

以上のようにして補正した結果を、処理714として示
すように検査し、“0"ならば処理715として示すようにS
ticky bit607を“0"にセットし、“1"ならば処理715と
して示すようにSticky bit607を“1"にセットする。
The result corrected in the above manner is inspected as shown as process 714, and if “0”, S is displayed as shown as process 715.
The ticky bit 607 is set to "0", and if it is "1", the sticky bit 607 is set to "1" as shown as a process 715.

尚、上述のような従来の装置では、これらの精度落ち
用フラグをセットする処理710から716までの処理を、マ
イクロプログラムによって行っていた。
In the conventional device as described above, the processes from 710 to 716 for setting these precision deterioration flags are performed by the microprogram.

発明が解決しようとする課題 上述のような従来の平方根演算処理において、精度落
ちがあったかどうかを調べるためのフラグであるSticky
bitは、演算終了後の部分剰余の値が正、負またはゼロ
の何れであるかの判定と、これが正または負であった場
合の部分剰余の補正と、補正されたものがゼロであるか
どうかの検出と、Sticky bitのセットとの各処理が必要
であり、これらは全てマイクロプログラムにより行われ
ていた。従って、マイクロプログラムのステップ数が多
く、実行クロック数が増加するという欠点があった。
Problems to be Solved by the Invention Sticky, which is a flag for checking whether or not there is a loss of precision in the conventional square root arithmetic processing as described above
bit determines whether the value of the partial remainder after the operation is positive, negative, or zero, corrects the partial remainder when this is positive or negative, and whether the corrected value is zero. It was necessary to detect whether or not the sticky bit was set, and these were all done by microprograms. Therefore, there is a drawback that the number of steps of the microprogram is large and the number of execution clocks is increased.

そこで、本発明の目的は、上記従来技術の問題点を解
決し、特定の回路を設けて、マイクロプログラムによる
処理の負担を軽減し、且つ、処理時間を短縮した新規な
平方根演算装置を提供することにある。
Therefore, an object of the present invention is to solve the above-mentioned problems of the prior art, provide a specific circuit, reduce the load of processing by a microprogram, and provide a novel square root calculation device that shortens the processing time. Especially.

課題を解決するための手段 即ち、本発明に従うと、丸めを含む浮動小数点演算装
置上で入力数の平方根演算処理を実行する平方根演算装
置において、精度落ちが発生したことを表示するフラグ
と、演算途中の部分剰余がゼロであることを検出する第
1のゼロ検出回路と、演算途中の入力数がゼロであるこ
とを検出する第2のゼロ検出回路とを備え、演算開始時
に該フラグを“1"にセットし、前記第1および第2のゼ
ロ検出回路により、部分剰余がゼロであり、且つ、入力
数もゼロである場合には、該第1および第2のゼロ検出
回路の出力により、該フラグを0にリセットする機能を
有することを特徴とする平方根演算装置が提供される。
Means for Solving the Problem That is, according to the present invention, in a square root arithmetic unit for executing a square root arithmetic processing of an input number on a floating point arithmetic unit including rounding, a flag indicating that a precision loss has occurred, and a calculation A first zero detection circuit that detects that the partial remainder on the way is zero and a second zero detection circuit that detects that the number of inputs during the operation is zero are provided, and the flag is set to " If the partial remainder is zero and the number of inputs is also zero by the first and second zero detection circuits, the output of the first and second zero detection circuits is set to 1 ". There is provided a square root operation device having a function of resetting the flag to 0.

作用 前述した従来の平方根演算装置に対して、本発明に係
る装置は、部分剰余がゼロであることを検出する第1の
ゼロ検出回路と、演算途中の入力数がゼロであることを
検出する第2のゼロ検出回路とを備えていることをその
主要な特徴としている。
Action In contrast to the conventional square root operation device described above, the device according to the present invention detects the first zero detection circuit that detects that the partial remainder is zero, and that the number of inputs during the operation is zero. Its main feature is that it has a second zero detection circuit.

即ち、この第1ゼロ検出回路1が出力する値と第2ゼ
ロ検出回路が出力する値との論理和を、Sticky bitにセ
ットすることにより、従来技術において、第7図に処理
710から716として示した処理が不用になり、更に、Stic
ky bitの設定も容易になる。従って、マイクロプログラ
ムのステップ数並びにクロック数を共に減少させること
ができる。
That is, by setting the logical sum of the value output by the first zero detection circuit 1 and the value output by the second zero detection circuit to the Sticky bit, the processing shown in FIG.
The processes shown as 710 to 716 are unnecessary, and
Setting ky bit is also easy. Therefore, both the number of steps and the number of clocks of the microprogram can be reduced.

以下、図面を参照して本発明をより具体的に説明する
が、以下の開示は本発明の一実施例に過ぎず、本発明の
技術的範囲を何ら限定するものではない。
Hereinafter, the present invention will be described more specifically with reference to the drawings, but the following disclosure is merely an example of the present invention and does not limit the technical scope of the present invention.

実施例1 第1図は、本発明に係る平方根演算装置の構成例を示
すブロック図である。
Embodiment 1 FIG. 1 is a block diagram showing a configuration example of a square root calculation device according to the present invention.

第1図に示すように、この平方根演算装置は、入力数
用レジスタ101と、演算用レジスタ103および104と、ALU
105と、部分剰余用レジスタ106と、演算結果用レジスタ
109と、フラグ110とを備えている。これらの構成並びに
機能は、第6図に示した従来の平方根演算装置と基本的
に同じである。さらに、この平方根演算装置は、第1お
よび第2のゼロ検出回路107および102と、NANDゲート10
8とを備えている。
As shown in FIG. 1, this square root arithmetic unit has an input number register 101, arithmetic registers 103 and 104, and an ALU.
105, partial remainder register 106, operation result register
109 and a flag 110. These configurations and functions are basically the same as those of the conventional square root operation device shown in FIG. Further, this square root arithmetic unit includes the first and second zero detection circuits 107 and 102, and the NAND gate 10
8 and.

ここで、第1のゼロ検出回路107は、部分剰余がゼロ
であることを検出する機能を有している。また、第2の
ゼロ検出回路102は、演算途中の入力数がゼロであるこ
とを検出機能を有している。更に、NANDゲート108は、
後述するように、第1ゼロ検出回路107と第2ゼロ検出
回路107とが出力する値の論理和を、Sticky bit110にセ
ットする機能を有している。
Here, the first zero detection circuit 107 has a function of detecting that the partial remainder is zero. Further, the second zero detection circuit 102 has a function of detecting that the number of inputs during the calculation is zero. Further, the NAND gate 108
As will be described later, it has a function of setting the logical sum of the values output by the first zero detection circuit 107 and the second zero detection circuit 107 to the Sticky bit 110.

第2図は、既に説明したように、Sticky bitを説明す
る図である。ここでは、無限精度の演算結果のうち、丸
め精度以下2bitがGuard bitおよびRound bitに格納され
る。また、Sticky bitは、Round bit以後の論理和が格
納され、精度落ちがある場合には“1"、ない場合には
“0"が格納される。
FIG. 2 is a diagram for explaining the sticky bit, as already described. Here, of the calculation results of infinite precision, 2 bits below the rounding precision are stored in Guard bit and Round bit. The Sticky bit stores a logical sum after the Round bit, and stores "1" when there is a loss of precision and "0" when there is no precision.

第3図は、第1図に示した装置において実行される処
理を示すフローチヤートである。
FIG. 3 is a flow chart showing the processing executed in the apparatus shown in FIG.

第3図に処理301として示すように、まず、入力数を
A=a1 a2・・・anとして入力数用レジスタ101に格納
し、入力数の上位2桁をR0=a1 a2を演算用レジスタ10
3に格納し、更に、演算用レジスタ104に1を格納する。
As shown as a process 301 in FIG. 3, first, the number of inputs is stored in the input number register 101 as A = a 1 a 2 ... A n , and the upper two digits of the number of inputs are R 0 = a 1 a 2 for arithmetic register 10
It is stored in 3, and 1 is further stored in the arithmetic register 104.

次に、処理302として示すように、フラグ110にSticky
bit=“1"をセットする。
Next, as shown as process 302, the flag 110 is Sticky.
Set bit = "1".

次に、処理305として示すように、演算用レジスタ103
の値からレジスタ104の値を減算し、部分剰余用レジス
タ106に格納する。
Next, as shown as a process 305, the arithmetic register 103
The value of the register 104 is subtracted from the value of, and the result is stored in the partial remainder register 106.

またこの時、処理304として示すように、部分剰余用
レジスタ106の値が“0"であるかどうかを検査し、“0"
であるときは、処理305として示すように、ゼロ検出回
路107の出力を“1"とし、入力数用レジスタ101を2ビッ
ト左シフトさせたものの値が“0"のとき、ゼロ検出器10
2の出力を“1"とし、ゼロ検出回路107および102の出力
をNANDゲート103によりフラグ110、即ち、Sticky bitを
“0"にセットする。これら処理304および305は、ハード
ウエアにより実行される。
Further, at this time, as shown as a process 304, it is checked whether the value of the partial remainder register 106 is “0”, and “0”
If the value of the output of the zero detection circuit 107 is "1" and the value of the input number register 101 is left-shifted by 2 bits is "0", the zero detector 10
The output of 2 is set to "1" and the outputs of the zero detection circuits 107 and 102 are set to "0" by the NAND gate 103 in the flag 110, that is, the Sticky bit. These processes 304 and 305 are executed by hardware.

次に、処理306として示すように、部分剰余レジスタ
の値を検査し、これが、正または“0"ならば、以下の処
理307および308を実行する。
Next, as shown as process 306, the value of the partial remainder register is checked, and if it is positive or "0", the following processes 307 and 308 are executed.

即ち、まず、処理307として示すように、演算結果用
レジスタ109を1ビットシフトさせ、最下位のビットに
“1"をセットする。続いて、レジスタ101を2ビット左
シフトさせ、上位2ビットをレジスタ103の下位2ビッ
トヘ、レジスタ106の値を2ビット左シフトさせたもの
をレジスタ103ヘそれぞれ格納する。また、レジスタ109
の値を2ビット左シフトしたものに“01"を加えたもの
をレジスタ104へ格納する。次に、処理308として示すよ
うに、レジスタ103の値からレジスタ104の値を減算す
る。
That is, first, as shown as a process 307, the operation result register 109 is shifted by 1 bit and "1" is set to the least significant bit. Then, the register 101 is shifted to the left by 2 bits, the upper 2 bits are stored to the lower 2 bits of the register 103, and the value of the register 106 is shifted to the left by 2 bits, and stored in the register 103. Also, register 109
The value obtained by adding "01" to the value obtained by shifting the value of 2 to the left by 2 bits is stored in the register 104. Next, as shown as process 308, the value in register 104 is subtracted from the value in register 103.

一方、処理306において、部分剰余が負であることが
検出された場合には、以下の処理309および310を実行す
る。
On the other hand, if it is detected in the process 306 that the partial remainder is negative, the following processes 309 and 310 are executed.

まず、処理309として示すように、演算結果用レジス
タ109を1ビット左シフトさせ、最下位ビットに“0"を
セットする。続いて、レジスタ101を2ビット左シフト
させ、上位2ビットをレジスタ103へ、レジスタ106の値
を2ビット左シフトさせたものをレジスタ103へそれぞ
れ格納する。
First, as shown as a process 309, the calculation result register 109 is left-shifted by 1 bit and "0" is set to the least significant bit. Then, the register 101 is shifted to the left by 2 bits, the upper 2 bits are stored to the register 103, and the value of the register 106 is shifted to the left by 2 bits to store it in the register 103.

また、レジスタ109の値を2ビット左シフトしたもの
に、“11"を加えたものをレジスタ104ヘ格納する。次
に、レジスタ103の値とレジスタ104の値とを加算する。
Also, the value obtained by adding "11" to the value obtained by shifting the value of the register 109 by 2 bits to the left is stored in the register 104. Next, the value of the register 103 and the value of the register 104 are added.

以上のような処理306から310までの処理を、処理311
および312として示すように、レジスタの桁数分繰り返
すことにより、処理313として示すように、入力数の平
方根が得られる。
The above processing from 306 to 310 is performed by processing 311
And 312, the number of digits in the register is repeated to obtain the square root of the number of inputs, as shown as process 313.

実施例2 第5図は、本発明に従って構成された平方根演算装置
の他の構成例を示すブロック図である。
Embodiment 2 FIG. 5 is a block diagram showing another configuration example of the square root calculation device constructed according to the present invention.

第5図に示すように、この装置の構成は、第1図に示
した実施例1の装置と基本的に同じであり、その詳細な
説明は省略するが、各構成要素の参照番号は、第1桁が
“1"から“5"に変化しただけで第1図と対応している。
尚、具体的に後述するように、本実施例の装置では、引
きもどし法により平方根を得る構成となっている。
As shown in FIG. 5, the configuration of this device is basically the same as that of the device of the first embodiment shown in FIG. 1, and a detailed description thereof will be omitted. It corresponds to Fig. 1 only by changing the first digit from "1" to "5".
As will be described later in detail, the apparatus of this embodiment has a configuration in which the square root is obtained by the return method.

第4図は、第5図に示した平方根演算装置における処
理の過程を示すフローチャートである。
FIG. 4 is a flow chart showing the steps of processing in the square root calculation device shown in FIG.

まず、第4図に処理401として示すように、入力数A
=a1,a2・・anを入力数用しジスタ501に格納した後、
演算用レジスタ503に入力数の上位2桁をR0=a1,a2,a
nとして格納し、演算用しジスタ504には“1"を格納す
る。
First, as shown as process 401 in FIG. 4, the number of inputs A
= A 1 , a 2 ··· a n is used for the number of inputs and stored in register 501,
The upper two digits of the number input to the arithmetic register 503 are R 0 = a 1 , a 2 , a
The value is stored as n , and “1” is stored in the register 504 for calculation.

次に、処理402として、フラグ501にSticky bit=1を
セットする。
Next, as processing 402, Sticky bit = 1 is set in the flag 501.

次に、処理403として、演算用レジスタ503に格納され
た値からレジスタ504に格納された値を減算し、部分剰
余用レジスタ506にその値を格納する。
Next, as a process 403, the value stored in the register 504 is subtracted from the value stored in the arithmetic register 503, and the value is stored in the partial remainder register 506.

このとき、部分剰余用レジスタ506の値が“0"の場合
は、処理405として、ゼロ検出回路507の出力を“1"と
し、入力数用レジスタ501を2ビット左シフトさせたも
のの値が“0"のとき、ゼロ検出回路502の出力を“1"と
し、ゼロ検出回路507および502の出力を、NANDゲート50
8を介してフラグ510に入力することにより、Sticky bit
を“0"にセットする。ここで、処理404および405は、ハ
ードウエアにより実行される。
At this time, when the value of the partial remainder register 506 is “0”, the output of the zero detection circuit 507 is set to “1”, and the value of the input number register 501 left-shifted by 2 bits is set to “405” in processing 405. When it is "0", the output of the zero detection circuit 502 is set to "1", and the outputs of the zero detection circuits 507 and 502 are connected to the NAND gate 50.
Sticky bit by entering the flag 510 via 8
Is set to “0”. Here, the processes 404 and 405 are executed by hardware.

次に部分剰余レジスタの値が正または“0"ならば、以
下の処理を実行する。
Next, if the value of the partial remainder register is positive or "0", the following processing is executed.

まず、処理407として、演算結果用のレジスタ509を1
ビットシフトさせて、最下位ビットに“1"をセットす
る。また、レジスタ501を2ビット左シフトさせ、上位
2ビットをレジスタ503の下位2ビットヘ、レジスタ506
の値を2ビット左シフトさせたものをレジスタ503へそ
れぞれ格納する。更に、レジスタ509の値を2ビット左
シフトしたものに“01"を加えたものをレジスタ504へ格
納する。次に、処理409として、レジスタ503の値からレ
ジスタ504の値を減算する。
First, as the process 407, the register 509 for the calculation result is set to 1
Bit shift and set "1" to the least significant bit. Also, the register 501 is shifted left by 2 bits, and the upper 2 bits are transferred to the lower 2 bits of the register 503 and the register 506.
The value obtained by shifting the value of 2 to the left by 2 bits is stored in the register 503. Further, the value obtained by adding "01" to the value of the register 509 left-shifted by 2 bits is stored in the register 504. Next, as a process 409, the value of the register 504 is subtracted from the value of the register 503.

また、処理403で行った演算結果、即ち、部分剰余が
負ならば以下の処理を実行する。
Further, if the calculation result performed in the process 403, that is, the partial remainder is negative, the following process is executed.

まず、処理408として、演算結果用レジスタ509を1ビ
ット左シフトさせ、最下位ビットに“0"をセットする。
また、レジスタ501を2ビット左シフトさせ、上位2ビ
ットをレジスタ503へ格納し、更に、レジスタ503を2ビ
ット左シフトする。次に、レジスタ509の値を2ビット
左シフトしたものに“01"を加えたものをレジスタ504へ
格納する。続いて、処理409として、レジスタ503の値か
らレジスタ504の値を減算する。
First, as a process 408, the operation result register 509 is left-shifted by 1 bit and "0" is set to the least significant bit.
Further, the register 501 is shifted to the left by 2 bits, the upper 2 bits are stored in the register 503, and the register 503 is further shifted to the left by 2 bits. Next, the value obtained by adding "01" to the value obtained by shifting the value of the register 509 by 2 bits to the left is stored in the register 504. Then, as a process 409, the value of the register 504 is subtracted from the value of the register 503.

処理410および411として、上述のような処理406から4
05までの処理を、レジスタの桁数分繰り返すとレジスタ
509に入力数の平方根が得られる。
As processes 410 and 411, processes 406 to 4 as described above are performed.
Repeat the processing up to 05 by the number of digits in the register to register
The square root of the input number is obtained in 509.

発明の効果 以上説明したように、本発明に係る平方根演算装置
は、部分剰余がゼロであることを検出する第1のゼロ検
出回路と、演算途中の入力数がゼロであることを検出す
る第2のゼロ検出回路とを備え、これら第1および第2
のゼロ検出回路の出力する値の論理和をSticky bitにセ
ットすることより、従来はマイクロプログラムで行って
いた処理を不用とし、且つ、Sticky bitの設定を容易と
している。従って、この装置においては、平方根演算に
際して、マイクロプログラムのステップ数およびクロッ
ク数を共に減少させることができる。
EFFECTS OF THE INVENTION As described above, the square root operation device according to the present invention includes the first zero detection circuit for detecting that the partial remainder is zero, and the first zero detection circuit for detecting that the number of inputs during the operation is zero. Two zero detection circuits, and the first and second
By setting the logical sum of the values output by the zero detection circuit of No. 1 to the Sticky bit, the processing conventionally performed by the microprogram is made unnecessary and the setting of the Sticky bit is facilitated. Therefore, in this device, both the number of steps and the number of clocks of the microprogram can be reduced in the square root calculation.

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

第1図は、本発明に係る平方根演算装置の構成例を示す
ブロック図であり、 第2図は、スティッキービット(Sticky bit)を説明す
る図であり、 第3図は、第1図に示した装置において実行さされる平
方根引き放し法の処理を説明するフローチャートであ
り、 第4図は、本発明に係る平方根演算装置の他の構成例を
示すブロック図であり、 第5図は、第4図に示した装置において実行さされる平
方根引きもどし法の処理を説明するフローチャートであ
り、 第6図は、従来の平方根演算装置の構成例を示すブロッ
ク図であり、 第7図は、第6図に示した装置において実行さされる平
方根引き放し法の処理を説明するフローチャートであ
る。 〔主な参照番号〕 101……入力用レジスタ、102、107……ゼロ検出回路、1
03、104……演算用レジスタ、105……ALU、106……部分
剰余用レジスタ、108……NANDゲート、109……演算結果
用レジスタ、110……フラグ
FIG. 1 is a block diagram showing a configuration example of a square root operation device according to the present invention, FIG. 2 is a diagram for explaining sticky bits, and FIG. 3 is shown in FIG. FIG. 4 is a flowchart for explaining the processing of the square root releasing method executed in the device, FIG. 4 is a block diagram showing another configuration example of the square root calculation device according to the present invention, and FIG. FIG. 6 is a flow chart for explaining the processing of the square root reverting method executed in the device shown in FIG. 6, FIG. 6 is a block diagram showing a configuration example of a conventional square root calculation device, and FIG. 7 is FIG. 6 is a flowchart illustrating processing of a square root release method executed in the apparatus shown in FIG. [Main reference numbers] 101 …… Input registers, 102,107 …… Zero detection circuit, 1
03, 104 ... Operation register, 105 ... ALU, 106 ... Partial remainder register, 108 ... NAND gate, 109 ... Operation result register, 110 ... Flag

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】丸めを含む浮動小数点演算装置上で入力数
の平方根演算処理を実行する平方根演算装置において、 精度落ちが発生したことを表示するフラグと、演算途中
の部分剰余がゼロであることを検出する第1のゼロ検出
回路と、演算途中の入力数がゼロであることを検出する
第2のゼロ検出回路とを備え、 演算開始時に該フラグを“1"にセットし、前記第1およ
び第2のゼロ検出回路により、部分剰余がゼロであり、
且つ、入力数もゼロである場合には、該第1および第2
のゼロ検出回路の出力により、該フラグを0にリセット
する機能を有することを特徴とする平方根演算装置。
1. A square root arithmetic unit for executing a square root arithmetic processing of an input number on a floating point arithmetic unit including rounding, a flag indicating that a precision loss has occurred, and a partial remainder in the middle of arithmetic operation being zero. And a second zero detection circuit for detecting that the number of inputs in the middle of the calculation is zero. The flag is set to "1" at the start of the calculation, and the first zero detection circuit And the second zero detection circuit, the partial remainder is zero,
If the number of inputs is also zero, the first and second
The square root calculation device having a function of resetting the flag to 0 according to the output of the zero detection circuit.
JP13816489A 1989-05-31 1989-05-31 Square root calculator Expired - Fee Related JP2508269B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13816489A JP2508269B2 (en) 1989-05-31 1989-05-31 Square root calculator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13816489A JP2508269B2 (en) 1989-05-31 1989-05-31 Square root calculator

Publications (2)

Publication Number Publication Date
JPH033033A JPH033033A (en) 1991-01-09
JP2508269B2 true JP2508269B2 (en) 1996-06-19

Family

ID=15215523

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13816489A Expired - Fee Related JP2508269B2 (en) 1989-05-31 1989-05-31 Square root calculator

Country Status (1)

Country Link
JP (1) JP2508269B2 (en)

Also Published As

Publication number Publication date
JPH033033A (en) 1991-01-09

Similar Documents

Publication Publication Date Title
JPH10207693A (en) Floating point arithmetic unit
US6199089B1 (en) Floating point arithmetic logic unit rounding using at least one least significant bit
KR950006580B1 (en) Divisional operation system
JPS62191926A (en) Arithmetic unit
US5615113A (en) Early signaling of no-overflow for nonrestoring twos complement division
JPH0520028A (en) Mantissa part processing circuit of floating-point arithmetic unit for addition and subtraction
JP2508269B2 (en) Square root calculator
JPH02294731A (en) Floating point arithmetic processor
US5675528A (en) Early detection of overflow and exceptional quotient/remainder pairs for nonrestoring twos complement division
JPH04350724A (en) Shift extent detecting circuit
GB882751A (en) Error detection system
US5432727A (en) Apparatus for computing a sticky bit for a floating point arithmetic unit
US5801978A (en) Overflow detection for integer-multiply instruction
JPH0553759A (en) Fixed decimal point arithmetic unit
JPH0797312B2 (en) Arithmetic unit
JP2998324B2 (en) Normalized shift device and normalized shift method
JP3137131B2 (en) Floating point multiplier and multiplication method
JPS5960637A (en) Arithmetic device for floating decimal point
JPS6194144A (en) Floating point adder circuit
JPS6126136A (en) Digit justifying circuit of floating point adder
JPS6129020B2 (en)
US20180329682A1 (en) Handling floating point operations
JPS60235241A (en) Floating point adding circuit
JPH0413734B2 (en)
KR0175358B1 (en) Status Flag Detection Circuit of Computer for High Speed

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees