[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

JPH0635671A - Floating point adder-subtracter - Google Patents

Floating point adder-subtracter

Info

Publication number
JPH0635671A
JPH0635671A JP4187039A JP18703992A JPH0635671A JP H0635671 A JPH0635671 A JP H0635671A JP 4187039 A JP4187039 A JP 4187039A JP 18703992 A JP18703992 A JP 18703992A JP H0635671 A JPH0635671 A JP H0635671A
Authority
JP
Japan
Prior art keywords
mantissa
bit
subtraction
addition
exponent
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP4187039A
Other languages
Japanese (ja)
Inventor
Hideyo Tsuruta
英世 鶴田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP4187039A priority Critical patent/JPH0635671A/en
Publication of JPH0635671A publication Critical patent/JPH0635671A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/483Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers
    • G06F7/485Adding; Subtracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/499Denomination or exception handling, e.g. rounding or overflow
    • G06F7/49942Significance control
    • G06F7/49947Rounding

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Nonlinear Science (AREA)
  • General Engineering & Computer Science (AREA)

Abstract

PURPOSE:To execute the addition and subtraction of a floating point accompanying a rounding-off at a high speed in a circuit constitution whose scale is smaller than used to be. CONSTITUTION:A floating point adder-subtracter is constituted of three fixed- point part inverting means 115-117 which are operated mainly in parallel, and two fixed-point part adders 118 and 119, and the rounding-off and absolute value of a fixed-point part in the floating point addition and subtraction is exclusively generated in the following cases. In the case of a real addition or a real subtraction in which the difference of excomponents is not 0, two rounded results are simultaneously calculated, and the correctly rounded results are selected by the constituting elements. In the case of the real subtraction in which the difference of the excomponents is 0, the difference of fixed-point parts and the number of the code inversion are simultaneously calculated, and the absolute value of the difference of the fixed-point parts is selected by the constituting elements. Therefore, it is not necessary to provide a borrow predicting mechanism, so that the scale of the circuit can be sharply reduced. And also, a critical path is shortened according to it, so that the high speed of an operating frequency can be attained.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、情報処理機器において
浮動小数点数同士の和または差を計算する浮動小数点加
減算装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a floating point addition / subtraction device for calculating the sum or difference of floating point numbers in information processing equipment.

【0002】[0002]

【従来の技術】近年、ディジタル信号処理や数値計算な
ど多くの情報処理分野において高速な浮動小数点演算が
求められている。ワークステーションなどの小型計算機
において高速に浮動小数点演算を処理するマイクロプロ
セッサが続々と開発されている。浮動小数点加減算は整
数加減算に比べ処理量が膨大であるため、浮動小数点加
減算の1クロック処理は大幅な面積と素子数の増加を招
く。最新の浮動小数点演算ユニットを内蔵するマイクロ
プロセッサでは、パイプライン処理技術を採用すること
により数年前までマイクロプロセッサや信号処理プロセ
ッサでは困難であった浮動小数点加減算の1クロック実
行が実現されている。
2. Description of the Related Art In recent years, high-speed floating point arithmetic is required in many information processing fields such as digital signal processing and numerical calculation. Microprocessors that process floating-point arithmetic at high speed in small computers such as workstations are being developed one after another. Since the floating-point addition / subtraction has a larger processing amount than the integer addition / subtraction, the one-clock processing of the floating-point addition / subtraction causes a large increase in the area and the number of elements. In the microprocessor incorporating the latest floating point arithmetic unit, by adopting the pipeline processing technique, one clock execution of the floating point addition / subtraction which has been difficult for the microprocessor and the signal processor until several years ago has been realized.

【0003】従来の浮動小数点加減算装置は、例えばLe
slie Kohn, Sai-Wai Fu:"WAM3.6: A1,000,000 Transist
or Microprocessor",IEEE International Solid-State
Circuits Conference,pp.54〜55,1989及びHon P. Sit,
Monica Rosenrauch Nofal,Sunhyuk Kimn:"An 80MFLOPS
Floating-point Engine in the Intel i860(TM) Proces
sor",IEEE International Conference on Computer Des
ign,pp.374〜379,1989に示されている。
A conventional floating point addition / subtraction device is, for example, Le
slie Kohn, Sai-Wai Fu: "WAM3.6: A1,000,000 Transist
or Microprocessor ", IEEE International Solid-State
Circuits Conference, pp.54-55,1989 and Hon P. Sit,
Monica Rosenrauch Nofal, Sunhyuk Kimn: "An 80MFLOPS
Floating-point Engine in the Intel i860 (TM) Proces
sor ", IEEE International Conference on Computer Des
ign, pp.374-379,1989.

【0004】浮動小数点数演算に関し例えばアンシ/アイトリフ゜
ルイー P754-1985規格(シ゛ インスティテュート オフ゛ イレクトリカル アント゛ イレ
クトロニクス エンシ゛ニアス゛ インク:"アイトリフ゜ルイー スタンタ゛ート゛ フォー ハ゛イナリ
フローティンク゛ホ゜イント アリスメティック",1985)(ANSI/IEEE Std 754-19
85(The Institute of Electrical and Electronics Eng
ineers,Inc:"IEEE Standard for Binary Floating-Poin
t Arithmetic",1985))に則り説明する。浮動小数点数が
非正規化数や特殊数である場合もしくは加減算の途中で
上位桁あふれなどの浮動小数点例外が発生する場合など
は以下の説明と異なる動作を招くが、このような特殊な
状況に関して省略する。発明の詳細な説明中では、例え
ば正規化数同士の加減算が丸めを伴ってあふれることな
く遂行され正規化数または0の和または差が得られる状
況のみを記述する。また丸めのアルゴリズムは本発明の
本質的な部分でないため、ここでは上記IEEE754 規格で
規定された4つの丸めモードの内最も複雑で頻繁に使用
される最近値丸め(RNモード)に限り記述するが、他の
3つの丸め方式がこの記述からの類推により容易に実現
できることは明らかである。以下単に丸めと言えば、最
近値丸め(RNモード丸め)を指す。
Regarding floating point arithmetic, for example, the ANSI / ITER PURIE P754-1985 standard (the Institute of Electrical and Electronics Electronics Inc.)
Floating Point Arismatic ", 1985) (ANSI / IEEE Std 754-19
85 (The Institute of Electrical and Electronics Eng
ineers, Inc: "IEEE Standard for Binary Floating-Poin
t Arithmetic ", 1985)). If the floating-point number is a denormalized number or a special number, or if a floating-point exception such as high-order overflow occurs during addition or subtraction, it differs from the following explanation. In the detailed description of the invention, for example, additions and subtractions of normalized numbers are performed without rounding and overflow, and the sum or difference of the normalized numbers or 0 is generated. Only the situation that can be obtained is described, and since the rounding algorithm is not an essential part of the present invention, the most complex and frequently used nearest rounding (of the four rounding modes defined in the above IEEE754 standard is used here. RN mode), but it is clear that the other three rounding methods can be easily realized by analogy with this description. It is.

【0005】以下の説明中で次の記号を定義する。浮動
小数点数は符号,指数部,仮数部から構成されているも
のとする。被演算数(被加数または被減数)A の符号ビ
ットを sA で、指数部を eA で、仮数部をfA で表す。
同様に演算数(加数または減数)B の符号ビット,指数
部,仮数部をそれぞれ sB , eB , fB で、和または差
R の符号ビット,指数部,仮数部をそれぞれ sR
eR , fR で表す。
The following symbols are defined in the following description. Floating-point numbers shall consist of a sign, exponent, and mantissa. The sign bit of the operand (augend or minuend) A is represented by s A , the exponent part is represented by e A , and the mantissa part is represented by f A.
Similarly, the sign bit, exponent part, and mantissa part of the operation number (addition or subtraction) B are summed or subtracted by s B , e B , and f B , respectively.
The sign bit, exponent, and mantissa of R are s R ,
Expressed as e R and f R.

【0006】論理変数に対する‘!’及び上線(表中で
用いる)は論理否定を、演算子‘+’は論理和を意味す
る。演算子‘>>1’は1ビット右論理シフトを、‘<<
1’は1ビット左論理シフトを表す。記号‘*’はdon'
t care、即ち0でも1でもよい論理であることを表す。
記号X ,x ,y ,z ,w などは論理0及び1のいずれか
を表す論理変数である。
'!' For a logical variable 'And the overline (used in the table) means logical negation, and the operator' + 'means logical sum. The operator '>>1' is a 1-bit right logical shift, and '<<
1'represents a 1-bit left logical shift. The symbol '*' is don '
t care, that is, it indicates that the logic may be 0 or 1.
The symbols X, x, y, z, w, etc. are logical variables representing either logic 0 or 1.

【0007】加減算の対象となる浮動小数点数の仮数部
精度(有効桁数)の範囲内における最下位ビットを記号
L で表し、ビットL より1桁下位のビットを記号G で表
し、ビットG より1桁下位のビットを記号R で表し、ビ
ットR より下位である該仮数部の全ビットの論理和即ち
スティッキービットを記号S で表す。仮数部中の1の位
の整数ビットは仮数部の最上位ビットであり、これを記
号M で表し、ビットMより1桁下位のビットを記号U で
表し、ビットM より1桁上位のビットを記号Vで表す。
正規化数に対する特定のビット位置とそれらに付けられ
た名前との関係を(図3)に示す。ここで仮数部精度
(有効桁数)をn で表す。IEEE754 規格によれば正規化
数中のM ビットは表現上隠れているが、浮動小数点加減
算装置中の内部表現ではこの限りではない。
The least significant bit within the range of mantissa precision (the number of significant digits) of the floating point number to be added and subtracted is a symbol
Represented by L, the bit one digit lower than bit L is represented by symbol G, the bit one digit less than bit G is represented by symbol R, and the logical sum of all bits of the mantissa that are lower than bit R, that is, sticky bit Is represented by the symbol S. The 1's integer bit in the mantissa is the most significant bit of the mantissa and is represented by the symbol M, the bit one digit lower than the bit M is represented by the symbol U, and the bit one digit higher than the bit M. Represented by the symbol V.
The relationship between specific bit positions for normalized numbers and the names given to them is shown in FIG. Here, the mantissa precision (the number of significant digits) is represented by n. According to the IEEE754 standard, the M bits in the normalized number are hidden in the representation, but this is not the case in the internal representation in the floating-point adder / subtractor.

【0008】また以下の説明の記述中において次の用語
を定義する。浮動小数点数は符号と指数部と仮数部で構
成されているものとする。仮数部なる術語はその隠れた
最上位ビットを含む仮数全体を指すものとする。(表
1)に示すように真の加算と真の減算なる術語を、符号
sA 及び sB と加減算の組み合わせとの関係により定義
する。一般に浮動小数点加減算装置の処理手順は真の加
算の場合と真の減算の場合とに大別でき、その仮数部処
理において真の加算,真の減算の場合それぞれ加算,減
算を行なう。
The following terms will be defined in the following description. A floating point number is assumed to be composed of a sign, an exponent part, and a mantissa part. The term mantissa refers to the entire mantissa, including its hidden most significant bits. As shown in (Table 1), the terms of true addition and true subtraction are
It is defined by the relationship between s A and s B and the combination of addition and subtraction. Generally, the processing procedure of the floating-point addition / subtraction device can be roughly divided into the case of true addition and the case of true subtraction. In the mantissa processing, true addition and true subtraction are added and subtracted, respectively.

【0009】仮数上位あふれは、仮数部の和が2 以上
(V ビットが1の状態)になること、桁落ちは、仮数部
の差の絶対値が1 未満(M ビットが0の状態)になるこ
とと定義する。シフトは0拡張を伴う論理シフトを意味
する。桁合わせは指数差のビット数だけ指数の小さい方
の浮動小数点数の仮数部を右へシフトすること、正規化
は桁落ちが発生したときに仮数部の最上位ビットが1と
なるまで仮数部を左シフトすると共に指数値よりそのシ
フトしたビット数を減ずる動作を指す。
In the mantissa upper overflow, the sum of the mantissas becomes 2 or more (V bit is 1), and the digit loss is that the absolute value of the difference of the mantissa is less than 1 (M bit is 0). It is defined as becoming. Shift means a logical shift with zero extension. The digit alignment is to shift the mantissa part of the floating-point number with the smaller exponent to the right by the number of bits of the exponent difference, and the normalization is when the digit loss occurs until the most significant bit of the mantissa part becomes 1. Indicates the operation of shifting left and subtracting the shifted number of bits from the exponent value.

【0010】[0010]

【表1】 [Table 1]

【0011】以下本発明の従来例について、図面を参照
しながら説明する。(図2)は従来の浮動小数点加減算
装置の構成図を示す。201はソースAバスで、浮動小
数点数Aが供給される。202はソースBバスで、浮動小
数点数Bが供給される。203はディスティネーション
バスで、浮動小数点加減算装置が計算した結果Rを出力
する。
A conventional example of the present invention will be described below with reference to the drawings. FIG. 2 shows a configuration diagram of a conventional floating point addition / subtraction device. A source A bus 201 is supplied with a floating point number A. A source B bus 202 is supplied with a floating point number B. A destination bus 203 outputs a result R calculated by the floating point addition / subtraction device.

【0012】204は符号生成器で、2つの浮動小数点
数の符号,演算の種別,2つの指数の大小関係,2つの
仮数の大小関係から真の演算結果の符号を生成し、ま
た、真の加算か真の減算かを判定する。205は指数減
算器で、2つの指数の大小を判別し、指数差を求める。
206は指数選択器で、2つの指数の内小さくない方を
選択する。
Reference numeral 204 denotes a code generator which generates a true operation result code from the two floating-point number codes, the operation type, the two exponent magnitude relationships, and the two mantissa magnitude relationships. Determine if addition or true subtraction. An exponent subtractor 205 discriminates the magnitude of the two exponents and obtains the exponent difference.
An index selector 206 selects one of the two indexes which is not smaller.

【0013】207は指数補正器で、小さくない方の指
数よりあらかじめ予測した演算後正規化ビット数を減ず
る。208は指数増減器で、演算後正規化に関する指数
値予測の±1 だけの食い違いを補正する。209は仮数
比較器で、2つの仮数の大小関係を判定する。
An exponent corrector 207 reduces the number of post-computation normalized bits predicted in advance from the exponent which is not smaller. Reference numeral 208 denotes an exponent adjuster, which corrects a discrepancy of ± 1 in exponent value prediction related to post-computation normalization. A mantissa comparator 209 determines the magnitude relationship between two mantissas.

【0014】210,211,212はそれぞれ指数差
1 検出器検出器,指数差0 検出器,指数差−1 検出器
で、それぞれ指数差(eA − eB) が1 ,0 ,−1 である
ことを検出する。213は指数差判別器で、指数差が1
,0 ,−1 ないしそれ以外のいずれであるかを判別す
る。
210, 211 and 212 are index differences
1 detector Detector, exponent difference 0 detector, exponent difference −1 detector detects that the exponent difference (e A − e B ) is 1, 0, −1, respectively. An index difference discriminator 213 has an index difference of 1
, 0, −1 or any other value.

【0015】214は右シフトエンコーダーで、指数差
の絶対値を求め演算前正規化における右シフト量を計算
する。215は左シフトエンコーダー(桁落ち予測器)
で、指数差判別器213により指数差が1 ,0 ,−1 の
いずれかであると判別された場合に、両仮数 fA ,fB
上位ビットからスキャンし、指数差1 ,0 ,−1 に応じ
て減算後に仮数の桁落ちするビット数を予測する。
Reference numeral 214 is a right shift encoder, which is an index difference
Calculates the right shift amount in pre-computation normalization by obtaining the absolute value of
To do. 215 is a left shift encoder (digit loss predictor)
Then, the exponent difference discriminator 213 determines that the exponent difference is 1, 0, −1.
Both mantissas f if determined to be eitherA, FB To
Scan from the upper bit, depending on the exponent difference 1, 0, −1
Predict the number of bits that the mantissa loses after the subtraction.

【0016】216,217は仮数バレルシフタで、そ
れぞれ両仮数 fA , fB の桁合わせあるいは演算前正規
化のために仮数を左または右へシフトする。218はS
ビット生成器で、桁合わせ時にS ビットを生成する。2
19はR ビット生成器で、仮数桁合わせ・演算前正規化
後のR ビットを求める。
Reference numerals 216 and 217 denote mantissa barrel shifters, which shift the mantissa left or right for digit alignment of both mantissas f A and f B or normalization before operation. 218 is S
The bit generator generates S bits when aligning digits. Two
An R bit generator 19 obtains R bits after mantissa digit alignment and pre-operation normalization.

【0017】220は仮数交換器で、真の減算の場合に
差が正になるように桁合わせあるいは演算前正規化され
た両仮数を入れ替える。221は仮数反転器で、真の減
算の場合に減数の1の補数を取る。222,223は仮
数加算器で、実質的に仮数部を加減算し丸める。224
は仮数選択器で、2つの加減算結果の内正しいビット位
置に丸め用の1が加えられた方を選択する。
Reference numeral 220 denotes a mantissa exchanger, which exchanges both mantissas which have been digit-aligned or normalized before operation so that the difference becomes positive in the case of true subtraction. Reference numeral 221 denotes a mantissa inverter, which takes the one's complement of the subtraction in the case of true subtraction. Mantissa adders 222 and 223 substantially add and subtract the mantissa part and round it. 224
Is a mantissa selector, and selects one of the two addition / subtraction results, which has been added with 1 for rounding at the correct bit position.

【0018】225は丸め補正器で、仮に丸められた加
減算結果の最下位1ビットを補正して正確な丸めを実現
する。以上のように構成された従来技術における浮動小
数点加減算装置の動作を以下に説明する。本浮動小数点
加減算装置は3段のパイプライン処理により浮動小数点
数同士を加減算する。ソースA バス201とソースB バ
ス202より2つの浮動小数点数A とB を受け取り、こ
れらの加算または減算を行なった後結果の和(A + B)
または差(A − B)をディスティネーションバス203
へ出力する。前記3段のパイプライン処理の概要を次に
述べる。
A rounding compensator 225 corrects the least significant 1 bit of the provisionally rounded addition / subtraction result to realize accurate rounding. The operation of the floating point adder / subtractor according to the prior art configured as described above will be described below. The floating-point addition / subtraction device adds / subtracts floating-point numbers to each other by three-stage pipeline processing. Receives two floating-point numbers A and B from source A bus 201 and source B bus 202, adds or subtracts them, and then sums the results (A + B)
Or the difference (A-B) to the destination bus 203
Output to. The outline of the three-stage pipeline processing will be described below.

【0019】<第1段> ・指数部によりA とB の大小を比較する。 ・指数差が0であれば仮数部によりA とB の大小を比較
する。 ・指数差が1 ,0 ,−1 であり且つ真の減算の場合桁落
ちするビット数を予測する。
<First stage> -The magnitude of A and B are compared by the exponent part.・ If the index difference is 0, the magnitudes of A and B are compared using the mantissa. • Predict the number of bits with precision loss when the exponent difference is 1, 0, −1 and true subtraction.

【0020】・2つの浮動小数点数の符号,大小関係,
演算の種別より結果の符号を決定する。 <第2段> ・桁落ち予測に基づき仮数を演算前に正規化、ないし桁
合わせする。 ・指数差が1 ,0 ,−1 であり且つ真の減算の場合桁落
ち予測に基づき指数値を調整する。
The sign of the two floating point numbers, the magnitude relationship,
The sign of the result is determined according to the type of operation. <2nd stage> ・ Based on the precision cancellation, the mantissa is normalized or aligned before calculation.・ If the index difference is 1, 0, −1 and true subtraction, the index value is adjusted based on the precision loss.

【0021】<第3段> ・実質的な仮数部の加減算と丸めを行なう。 ・1ビットだけ演算後正規化を行ない、指数部・仮数部
を補正する。 本従来例により浮動小数点数A とB を加減算する場合、
本従来例の具体的な動作を真の加算の場合と真の減算の
場合とに分けて以下に説明する。下記の動作の説明中で
は実際の回路の動作を念頭に置き、各部の論理がdon't
careであったり何も行なわない場合でもその旨を明記し
た。各機能ブロックの動作論理中、仮数部の差が0 にな
る場合については、動作に幾つかの選択肢がありここで
は省略する。
<Third stage> -Substantially adding and subtracting mantissa and rounding. -Corrects only one bit and then normalizes it to correct the exponent and mantissa. When adding and subtracting floating point numbers A and B by this conventional example,
The specific operation of the conventional example will be described below separately for the case of true addition and the case of true subtraction. In the following explanation of the operation, keep in mind the actual operation of the circuit, and the logic of each part is don't
Even if it was care or nothing was done, it was clearly stated. In the operation logic of each functional block, when the difference of the mantissa is 0, there are some options for the operation and are omitted here.

【0022】1.真の加算の場合 仮数上位あふれの発生は第1の仮数加算器118で求め
た和のV ビットが1 になることで判定できる。 <第1段> (1.1) 指数減算器205において指数差 (eA − eB) を
計算する。 (1.2) 右シフトエンコーダー214において指数差の絶
対値|eA − eB|を計算する。 (1.3) 指数を比較した結果、指数選択器206により e
A と eB の内小さくない方を選択し、 max( eA , eB)
を出力する。 (1.4) 仮数比較器209において両仮数 fA と fB の大
小を比較する。 (1.5) 符号生成器204において(表2)に基づき結果
の符号 sR を決定する。 ここで和の符号は sA である。 (1.6) 指数差1 検出器210,指数差0 検出器211,
指数差−1 検出器212で、それぞれ指数差が1 ,0 ,
−1 であることを検出する。 (1.7) 指数差選択器213で、指数差が1 ,0 ,−1 な
いしそれら以外のいずれであるかを選択する。
1. In the case of true addition: Occurrence of overflow of the mantissa can be determined by setting the V bit of the sum obtained by the first mantissa adder 118 to 1. Exponent difference in <First stage> (1.1) Index subtractor 205 (e A - e B) is calculated. (1.2) the absolute value of the exponent difference in right shift encoder 214 | e A - e B | is calculated. (1.3) As a result of comparing the exponents, e
Select not smaller of A and e B, max (e A, e B)
Is output. (1.4) The mantissa comparator 209 compares the magnitudes of both mantissas f A and f B. (1.5) The code generator 204 determines the resulting code s R based on (Table 2). Where the sign of the sum is s A. (1.6) Index difference 1 detector 210, index difference 0 detector 211,
The exponent difference −1 detector 212 has exponent differences of 1, 0,
-1 is detected. (1.7) The exponent difference selector 213 selects whether the exponent difference is 1, 0, −1 or other.

【0023】<第2段> (2.1) 左シフトエンコーダー215は、ここでは実効的
に動作しない。 (2.2) (表3)に基づき第1の仮数バレルシフタ216
により、指数 eB が指数eA より大きい場合仮数 fA
桁合わせし、さもなければ仮数 fA を素通しさせる。こ
の出力を fA' で表す。 (2.3) (表3)に基づき第2の仮数バレルシフタ217
により、指数 eA が指数eB より大きい場合仮数 fB
指数差の絶対値のビット数だけ右へシフトし(桁合わせ
し)、さもなければ仮数 fB を素通しさせる。この出力
を fB' で表す。 (2.3) (表3)に基づき第2の仮数バレルシフタ217
により、指数 eB が指数eA より大きい場合仮数 fA
桁合わせし、さもなければ仮数 fA を素通しさせる。こ
の出力を fA' で表す。 (2.4) S ビット生成器218により、上記桁合わせ時に
仮数部のR ビットより右にこぼれた全ビットの論理和を
取りこれをS ビットとする。 (2.5) R ビット生成器219で、桁合わせされた仮数部
のR ビットを求める。 (2.6) 指数補正器207で、値max(eA , eB) を通過さ
せる。この出力を enormで表す。 (2.7) (表4)に基づき仮数交換器220により2つの
仮数部 fA' と fB' のいずれか一方を選択し fs として
出力し、他方を fl として出力する。 (2.8) (表5)に基づき仮数反転器221で、加数 fs
を素通しさせ、この出力を fs' で表す。
<Second Stage> (2.1) The left shift encoder 215 does not operate effectively here. (2.2) Based on (Table 3), the first mantissa barrel shifter 216
Thus, if the exponent e B is greater than the exponent e A, the mantissa f A is aligned, otherwise the mantissa f A is passed through. Denote this output by f A '. (2.3) Second mantissa barrel shifter 217 based on (Table 3)
Thus, if the exponent e A is greater than the exponent e B, the mantissa f B is shifted to the right by the number of bits of the absolute value of the exponent difference (digit matching), otherwise the mantissa f B is passed through. Denote this output by f B '. (2.3) Second mantissa barrel shifter 217 based on (Table 3)
Thus, if the exponent e B is greater than the exponent e A, the mantissa f A is aligned, otherwise the mantissa f A is passed through. Denote this output by f A '. (2.4) The S bit generator 218 takes the logical sum of all the bits spilled to the right from the R bits of the mantissa at the time of the above digit alignment, and sets this as the S bit. (2.5) The R bit generator 219 obtains the R bits of the digit-matched mantissa part. (2.6) The index corrector 207 passes the values max (e A , e B ). This output is represented by e norm . (2.7) Based on (Table 4), the mantissa exchanger 220 selects one of the two mantissa parts f A 'and f B ', outputs it as f s , and outputs the other as f l . (2.8) Based on (Table 5), the mantissa inverter 221 calculates the addend f s
And let this output be represented by f s '.

【0024】<第3段> (3.1) (表7)に基づき第2の仮数加算器223により
fl と fs' とL ビットに対する1 を同時に加算して丸
める。 (3.2) (表6)に基づき第1の仮数加算器222により
fl と fs' とG ビットに対する1 を同時に加算して丸
める。仮数上位あふれが発生すれば(3.5) へ飛び、さも
なければ次へ進む。 (3.3) (表8)に基づき仮数選択器224において、第
1の仮数加算器222で求めた和を選択する。 (3.4) (表8)に基づき指数増減器208において、値
enormを通過させ、この値を eR とする。(3.7) へ行
く。 (3.5) (表8)に基づき仮数選択器224において、第
2の仮数加算器223で求めた和を1 ビット右シフトし
た値を選択する。 (3.6) (表8)に基づき指数増減器208において、値
enormを1増やした値をeR とする。 (3.7) 丸め補正器225により、(表9)に基づき丸め
に関し和のL ビットを補正する。(終わり) 2.真の減算の場合 本パイプライン第2段における一連の処理は、一般に演
算前正規化と呼ばれる。左シフトエンコーダー215に
おける桁落ちビット数予測は最大1ビットの予測誤差を
生じるため、予測が失敗した場合仮数選択器224と指
数増減器208によりそれぞれ指数部と仮数部の1ビッ
ト補正を行なう。
<Third stage> By the second mantissa adder 223 based on (3.1) (Table 7)
Rounds f l and f s ' and 1 for L bits at the same time. (3.2) By the first mantissa adder 222 based on (Table 6)
Rounds f l and f s ' and 1 for G bits at the same time. If mantissa upper overflow occurs, jump to (3.5), otherwise proceed to the next. (3.3) Based on (Table 8), the mantissa selector 224 selects the sum obtained by the first mantissa adder 222. (3.4) Value in the index adjuster 208 based on (Table 8)
Let e norm pass and let this value be e R. Go to (3.7). (3.5) Based on (Table 8), the mantissa selector 224 selects a value obtained by shifting the sum obtained by the second mantissa adder 223 by 1 bit to the right. (3.6) Value in the index adjuster 208 based on (Table 8)
Let e R be the value obtained by incrementing e norm by 1. (3.7) The rounding corrector 225 corrects the L bit of the sum for rounding based on (Table 9). (End) 2. Case of True Subtraction The series of processing in the second stage of the pipeline is generally called pre-operation normalization. Since prediction of the number of precision loss bits in the left shift encoder 215 causes a prediction error of 1 bit at the maximum, when the prediction fails, the mantissa selector 224 and the exponent adjuster 208 respectively correct the exponent part and the mantissa part by 1 bit.

【0025】<第1段> (1.1) 指数減算器205において指数差(eA − eB) を
計算する。 (1.2) 右シフトエンコーダー214において指数差の絶
対値|eA − eB |を計算する。 (1.3) 指数を比較した結果、指数選択器206により e
A と eB の内小さくない方を選択し、max(eA , eB) を
出力する。 (1.4) 仮数比較器209において両仮数 fA と fB の大
小を比較する。 (1.5) 符号生成器204において(表2)に基づき sA
と sB と(eA − eB) 及び( fA − fB )の符号より差
の符号 sR を決定する。 (1.6) 指数差1 検出器210,指数差0 検出器211,
指数差−1 検出器212で、それぞれ指数差が1 ,0 ,
−1 であることを検出する。 (1.7) 指数差選択器213で、指数差が1 ,0 ,−1 な
いしそれら以外のいずれであるかを選択する。指数差が
1 ,0 ,−1 のいずれかであれば(2.9) へ飛び、さもな
ければ次へ進む。
<First Stage> (1.1) The exponent subtractor 205 calculates the exponent difference (e A -e B ). (1.2) the absolute value of the exponent difference in right shift encoder 214 | e A - e B | is calculated. (1.3) As a result of comparing the exponents, e
Select A or e B , whichever is not smaller, and output max (e A , e B ). (1.4) The mantissa comparator 209 compares the magnitudes of both mantissas f A and f B. (1.5) In the code generator 204, based on (Table 2) s A
And s B and the sign of the difference s R is determined from the signs of (e A − e B ) and (f A − f B ). (1.6) Index difference 1 detector 210, index difference 0 detector 211,
The exponent difference −1 detector 212 has exponent differences of 1, 0,
-1 is detected. (1.7) The exponent difference selector 213 selects whether the exponent difference is 1, 0, −1 or other. Index difference
If it is 1, 0 or -1, jump to (2.9), otherwise proceed to the next.

【0026】<第2段> (2.1) 左シフトエンコーダー215は、ここでは実効的
に動作しない。 (2.2) (表3)に基づき第1の仮数バレルシフタ216
により、指数 eB が指数eA より大きい場合仮数 fA
桁合わせし、さもなければ仮数 fA を素通しさせる。こ
の出力を fA' で表す。 (2.3) (表3)に基づき第2の仮数バレルシフタ217
により、指数 eA が指数eB より大きい場合仮数 fB
指数差の絶対値のビット数だけ右へシフトし(桁合わせ
し)、さもなければ仮数 fB を素通しさせる。この出力
を fB' で表す。 (2.4) S ビット生成器218により、上記桁合わせ時に
仮数部のR ビットより右にこぼれた全ビットの論理和を
取りこれをS ビットとする。 (2.5) R ビット生成器219で、桁合わせされた仮数部
のR ビットを求める。 (2.6) 指数補正器207で、値max(eA , eB) を通過さ
せる。この出力を enormで表す。 (2.7) (表4)に基づき仮数交換器220により2つの
仮数部 fA' と fB' のいずれか一方を選択し fs として
出力し、他方を fl として出力する。 (2.8) (表5)に基づき仮数反転器221で、加数 fs
を素通しさせ、この出力を fs' で表す。
<Second Stage> (2.1) The left shift encoder 215 does not operate effectively here. (2.2) Based on (Table 3), the first mantissa barrel shifter 216
Thus, if the exponent e B is greater than the exponent e A, the mantissa f A is aligned, otherwise the mantissa f A is passed through. Denote this output by f A '. (2.3) Second mantissa barrel shifter 217 based on (Table 3)
Thus, if the exponent e A is greater than the exponent e B, the mantissa f B is shifted to the right by the number of bits of the absolute value of the exponent difference (digit matching), otherwise the mantissa f B is passed through. Denote this output by f B '. (2.4) The S bit generator 218 takes the logical sum of all the bits spilled to the right from the R bits of the mantissa at the time of the above digit alignment, and sets this as the S bit. (2.5) The R bit generator 219 obtains the R bits of the digit-matched mantissa part. (2.6) The index corrector 207 passes the values max (e A , e B ). This output is represented by e norm . (2.7) Based on (Table 4), the mantissa exchanger 220 selects one of the two mantissa parts f A 'and f B ', outputs it as f s , and outputs the other as f l . (2.8) Based on (Table 5), the mantissa inverter 221 calculates the addend f s
And let this output be represented by f s '.

【0027】<第3段> (3.1) (表7)に基づき第2の仮数加算器223により
fl と fs' とR ビットに対する1 と2の補数化のため
の1 を同時に加算して丸める。 (3.2) (表6)に基づき第1の仮数加算器222により
fl と fs' とG ビットに対する1 と2の補数化のため
の1 を同時に加算して丸める。1ビットの桁落ちが発生
すれば(3.5) へ飛び、さもなければ次へ進む。 (3.3) (表8)に基づき仮数選択器224において、第
1の仮数加算器222で求めた差を選択する。 (3.4) (表8)に基づき指数増減器208において、値
enormを通過させ、この値を eR とする。(3.7) へ行
く。 (3.5) (表8)に基づき仮数選択器224において、第
2の仮数加算器223で求めた差を1 ビット左シフトし
た値を選択する。 (3.6) (表8)に基づき指数増減器208において、値
enormを1減らした値をeR とする。 (3.7) 丸め補正器225により、(表9)に基づき丸め
に関し差のLビットを補正する。(終わり) <(1.7) の分岐(指数差が1 , 0 , −1のいずれかであ
る場合)> (2.9) 左シフトエンコーダー215は、両仮数 fA , f
B の上位ビットをスキャンし、指数差1 ,0 ,−1 に応
じて仮数部減算後に桁落ちするビット数を予測する。 (2.10)(表3)に基づき第1の仮数バレルシフタ216
により、仮数 fB を予測された桁落ちビット数だけ左へ
シフトし(演算前正規化し)、更に指数 eA が指数 eB
より大きい場合右へ1ビットシフト(桁合わせ)する。
この出力を fB'で表す。 (2.11)(表3)に基づき第2の仮数バレルシフタ217
により、仮数 fA を演算前正規化し、更に指数 eB が指
数 eA より大きい場合右へ1ビットシフト(桁合わせ)
する。この出力を fA' 表す。 (2.12) Sビット生成器218において生成するS ビット
は0である。 (2.13) Rビット生成器219において生成するR ビット
は0である。 (2.14)指数補正器207で、値max(eA , eB) より桁落
ちビット数を減ずる。この出力を enormで表す。 (2.15)(表4)に基づき2つの仮数部 fA' と fB' の
内、仮数交換器220により指数の小さい方の仮数部を
選択しこれを fs として出力し、指数の大きい方の仮数
部を選択しこれを fl として出力する。2つの指数値 e
A と eB が等しい場合、 fA' (ここでは fA に等し
い)と fB' (ここでは fB に等しい)の内小さい方を
fs として、大きい方を fl として出力する。(2.8) へ
行く。
<Third stage> By the second mantissa adder 223 based on (3.1) (Table 7)
f l and f s ' and 1 for complementing 1 and 2 for R bits are added together and rounded. (3.2) By the first mantissa adder 222 based on (Table 6)
Rounds f l and f s ' and 1 for complementing 1 and 2 for G bits at the same time. If a 1-bit precision loss occurs, jump to (3.5), otherwise proceed to the next. (3.3) Based on (Table 8), the mantissa selector 224 selects the difference calculated by the first mantissa adder 222. (3.4) Value in the index adjuster 208 based on (Table 8)
Let e norm pass and let this value be e R. Go to (3.7). (3.5) Based on (Table 8), the mantissa selector 224 selects a value obtained by shifting the difference obtained by the second mantissa adder 223 by 1 bit to the left. (3.6) Value in the index adjuster 208 based on (Table 8)
Let e R be the value obtained by reducing e norm by 1. (3.7) The rounding corrector 225 corrects the L bit of the difference regarding rounding based on (Table 9). (End) <Branch of (1.7) (when the index difference is 1, 0, or -1)> (2.9) The left shift encoder 215 uses both mantissas f A , f.
The upper bit of B is scanned, and the number of bits to be lost after mantissa subtraction is predicted according to the exponent difference of 1, 0, −1. Based on (2.10) (Table 3), the first mantissa barrel shifter 216
Shifts the mantissa f B to the left by the expected number of precision loss bits (pre-operation normalization), and the exponent e A becomes the exponent e B
If it is larger, shift 1 bit to the right (digit alignment).
This output is represented by f B '. Second mantissa barrel shifter 217 based on (2.11) (Table 3)
, The mantissa f A is normalized before the operation, and if exponent e B is greater than exponent e A, shift 1 bit to the right (digit alignment)
To do. Represent this output as f A '. (2.12) The S bit generated by the S bit generator 218 is 0. (2.13) The R bit generated by the R bit generator 219 is 0. (2.14) In the exponent corrector 207, the number of precision loss bits is reduced from the value max (e A , e B ). This output is represented by e norm . Based on (2.15) (Table 4), of the two mantissa parts f A 'and f B ', the mantissa exchanger 220 selects the mantissa part with the smaller exponent and outputs it as f s. Select the mantissa part of and output it as f l . Two exponential values e
If A and e B are equal, then the smaller of f A '(here equal to f A ) and f B ' (here equal to f B )
The larger one is output as f l as f s . Go to (2.8).

【0028】[0028]

【表2】 [Table 2]

【0029】[0029]

【表3】 [Table 3]

【0030】[0030]

【表4】 [Table 4]

【0031】[0031]

【表5】 [Table 5]

【0032】[0032]

【表6】 [Table 6]

【0033】[0033]

【表7】 [Table 7]

【0034】[0034]

【表8】 [Table 8]

【0035】[0035]

【表9】 [Table 9]

【0036】[0036]

【発明が解決しようとする課題】しかしながら従来の浮
動小数点加減算装置によれば、回路規模が増大するとい
う問題点があった。具体的には、演算後正規化するの
を避けるために、第1段において桁落ちを予測する回路
(指数差1,0,-1検出器、左シフトエンコーダー)、減
算結果が負であればその2の補数をとる必要があるが、
減算結果を必ず正にして2の補数化を避けるために、第
1段において両仮数部を大小比較する回路(仮数比較
器)を備えることにより、回路規模が増大している。な
ぜなら、これらの回路は一般的に非常に大きな規模だか
らである。
However, the conventional floating point adder / subtractor has a problem that the circuit scale increases. Specifically, in order to avoid normalization after the operation, a circuit for predicting cancellation of digits in the first stage (exponent difference 1,0, -1 detector, left shift encoder), if the subtraction result is negative It is necessary to take the two's complement,
The circuit scale is increased by providing a circuit (mantissa comparator) for comparing the magnitudes of both mantissa parts in the first stage in order to always make the subtraction result positive and to avoid 2's complementation. This is because these circuits are generally very large.

【0037】また、回路規模の増大により、ゲート段数
が増えることになり処理速度が遅くなるという問題点が
あった。これらの課題に鑑み本発明は、従来の浮動小数
点加減算装置と同等の機能を持ちながらより高速に且つ
より少ないハードウェア量で足りる新規の浮動小数点加
減算装置を提供することを目的とする。
Further, there has been a problem that the number of gate stages is increased due to the increase of the circuit scale and the processing speed is slowed down. In view of these problems, an object of the present invention is to provide a novel floating point addition / subtraction device that has a function equivalent to that of a conventional floating point addition / subtraction device and that is faster and requires less hardware.

【0038】[0038]

【課題を解決するための手段】上記課題を解決するため
本発明の浮動小数点加減算装置は、符号,指数,仮数で
表される浮動小数点形式の2数の和又は差を計算する浮
動小数点加減算装置であって、指数が小さい方の浮動小
数点の仮数を指数差だけ下位側(以下右と呼ぶ)へシフ
トすることにより桁合わせする桁合わせ部と、桁合わせ
された仮数と他方の仮数とを加算又は減算し、指数差が
0であれば減算時に一方の仮数から他方の仮数を減算し
同時に他方から一方を減算する加減算部と、減算された
仮数に対して桁落ちしたビット数を求め、そのビット数
だけ仮数を上位側にシフトし、指数からそのビット数を
減ずることによって正規化する正規化部とを備え、前記
桁合わせ部は、浮動小数点形式の2数の指数を減算する
ことによって、両指数の大小関係を判別し、指数差の絶
対値を求める指数減算器と、2つの浮動小数点数のうち
指数が小さい方の浮動小数点数の仮数を選択し、または
2数の指数の差が0ならばいずれかの仮数を選択する小
仮数選択手段と、小仮数選択手段の選択と異なる他方の
仮数部を選択する大仮数選択手段と、小仮数選択手段で
選択された仮数を指数差の絶対値だけ右へ論理シフトす
る仮数右シフト手段とからなり、前記加減算部は、同符
号の2数の減算または異符号の2数の加算(以後真の減
算と略す)であれば仮数右シフト手段の出力を反転さ
せ、同符号の2数の加算または異符号の2数の減算(以
後真の加算と略す)であれば仮数右シフト手段の出力を
素通しさせる第1の仮数反転手段と、真の減算の場合で
且つ指数差が0でない場合に仮数右シフト手段の出力を
反転させ、それ以外の場合には素通しさせる第2の仮数
反転手段と、真の減算の場合で且つ指数差が0である場
合に大仮数選択手段の出力を反転させ、それ以外の場合
には素通しさせる第3の仮数反転手段と、真の加算の場
合に第1の仮数反転手段の出力と大仮数選択手段の出力
を加算し、真の減算の場合に第1の仮数反転手段の出力
と大仮数選択手段の出力を2の補数化用の1と共に加算
する第1の仮数加算手段と、真の加算の場合に第2の仮
数反転手段の出力と第3の仮数反転手段の出力を加算
し、真の減算の場合に第2の仮数反転手段の出力と第3
の仮数反転手段の出力を2の補数化用の1と共に加算す
る第2の仮数加算手段と、真の減算の場合で且つ指数差
が0である場合には、第1,第2の仮数加算手段から得
られる正負2つの減算結果から正の値である方を選択す
る加減算結果選択手段とからなり、前記正規化部は、真
の減算の場合に加減算部の出力について桁落ちビット数
を求める先行1検出手段と、先行1検出手段の検出結果
が求めたビット数に基づき、加減算部の出力を左にシフ
トする仮数左シフト手段と、からなる構成となってい
る。
In order to solve the above-mentioned problems, a floating-point addition / subtraction device of the present invention calculates a sum or difference of two floating-point numbers represented by a sign, an exponent, and a mantissa. And the digit-matching unit that aligns digits by shifting the mantissa of the floating-point number with the smaller exponent to the lower side (hereinafter referred to as right) by the exponent difference, and adds the digit-matched mantissa and the other mantissa. Alternatively, if the exponent difference is 0, the addition / subtraction unit that subtracts the other mantissa from the one mantissa and simultaneously subtracts one from the other at the time of the subtraction, and the number of bits with which the mantissa has been subtracted And a normalization unit for normalizing by shifting the mantissa to the upper side by the number of bits and subtracting the number of bits from the exponent, and the digit matching unit subtracting the exponent of two numbers in floating point format, Both Select an exponent subtractor that determines the absolute value of the exponent difference and determine the mantissa of the floating-point number with the smaller exponent of the two floating-point numbers, or set the difference between the exponents of two numbers to 0. If so, a small mantissa selecting means for selecting one of the mantissas, a large mantissa selecting means for selecting the other mantissa part different from the selection of the small mantissa selecting means, and a mantissa selected by the small mantissa selecting means for the absolute difference of exponents. The mantissa right shift means logically shifts to the right by a value, and the addition / subtraction unit subtracts two numbers having the same sign or adds two numbers having different signs (hereinafter abbreviated as true subtraction). If the addition of two numbers with the same sign or the subtraction of two numbers with different signs (hereinafter abbreviated as true addition) is performed, the first mantissa inverting means for passing the output of the mantissa right shift means through And subtraction of exponent is not 0, the mantissa right shift Second mantissa inverting means for inverting the output of the output means and passing through otherwise, and inverting the output of the large mantissa selecting means in the case of true subtraction and when the exponent difference is 0, In the other cases, the third mantissa inverting means for passing through, the output of the first mantissa inverting means and the output of the large mantissa selecting means in the case of true addition are added, and the first mantissa in the case of true subtraction. First mantissa adding means for adding the output of the inverting means and the output of the large mantissa selecting means together with 1 for 2's complement, and the output of the second mantissa inverting means and the third mantissa inversion in the case of true addition. The outputs of the means are added, and in the case of true subtraction, the outputs of the second mantissa inversion means and the third
Second mantissa adding means for adding the output of the mantissa inverting means of 1 together with 1 for the two's complement, and first and second mantissa addition in the case of true subtraction and when the exponent difference is 0. And a subtraction result selecting unit that selects a positive value from two positive and negative subtraction results obtained from the unit, and the normalization unit obtains the number of precision loss bits for the output of the addition and subtraction unit in the case of true subtraction. It is composed of leading 1 detection means and mantissa left shifting means for shifting the output of the addition / subtraction unit to the left based on the number of bits obtained by the detection result of the leading 1 detection means.

【0039】また、符号,指数,仮数で表される浮動小
数点形式の2数の和又は差を計算する浮動小数点加減算
装置であって、指数が小さい方の浮動小数点の仮数を指
数差だけ右へシフトすることにより桁合わせする桁合わ
せ部と、桁合わせされた仮数と他方の仮数とを加算又は
減算し、指数差が0であれば減算時に一方の仮数から他
方の仮数を減算し同時に他方から一方を減算する加減算
部と、減算された仮数に対して桁落ちしたビット数を求
め、そのビット数だけ仮数を上位側にシフトし、指数か
らそのビット数を減ずることによって正規化する正規化
部とを備え、前記桁合わせ部は、浮動小数点形式の2数
の指数を減算することによって、両指数の大小関係を判
別し、指数差の絶対値を求める指数減算器と、2つの浮
動小数点数のうち指数が小さい方の浮動小数点数の仮数
を選択し、または2数の指数の差が0ならばいずれかの
仮数を選択する小仮数選択手段と、小仮数選択手段の選
択と異なる他方の仮数部を選択する大仮数選択手段と、
小仮数選択手段で選択された仮数を指数差の絶対値だけ
右へ論理シフトする仮数右シフト手段とからなり、前記
加減算部は、真の減算の場合で且つ指数差が0でない場
合に仮数右シフト手段の出力を反転させ、それ以外の場
合には素通しさせる第1の仮数反転手段と、真の減算の
場合で且つ指数差が0である場合に大仮数選択手段の出
力を反転させ、それ以外の場合には素通しさせる第2の
仮数反転手段と、真の減算の場合に仮数右シフト手段の
出力を反転させ、真の加算の場合に仮数右シフト手段の
出力を素通しさせる第3の仮数反転手段と、真の加算の
場合に第1の仮数反転手段の出力と第2の仮数反転手段
の出力を加算し、真の減算の場合に第1の仮数反転手段
の出力と第2の仮数反転手段の出力を2の補数化用の1
と共に加算する第1の仮数加算手段と、真の加算の場合
に第3の仮数反転手段の出力と大仮数選択手段の出力を
加算し、真の減算の場合に第3の仮数反転手段の出力と
大仮数選択手段の出力を2の補数化用の1と共に加算す
る第2の仮数加算手段と、真の減算の場合で且つ指数差
が0である場合には、第1,第2の仮数加算手段から得
られる正負2つの減算結果から正の値である方を選択す
る加減算結果選択手段とからなり、前記正規化部は、真
の減算の場合に加減算部の出力について桁落ちビット数
を求める先行1検出手段と、先行1検出手段の検出結果
が求めたビット数に基づき、加減算部の出力を左にシフ
トする仮数左シフト手段と、からなる構成であってもよ
い。
A floating-point addition / subtraction device for calculating the sum or difference of two floating-point numbers represented by a sign, an exponent, and a mantissa, in which the floating-point mantissa having a smaller exponent is moved to the right by the exponent difference. The digit alignment unit that performs digit alignment by shifting, and the digit-matched mantissa and the other mantissa are added or subtracted, and if the exponent difference is 0, the other mantissa is subtracted from one mantissa at the time of subtraction, and at the same time from the other. An adder / subtractor that subtracts one, and a normalizer that normalizes by finding the number of bits that have been dropped for the subtracted mantissa, shifting the mantissa to the upper side by that number, and subtracting that number from the exponent The digit aligning unit determines the magnitude relationship between two exponents by subtracting two exponents in floating-point format, and an exponent subtractor that obtains the absolute value of the exponent difference; and two floating-point numbers. Out of A small mantissa selecting means for selecting a mantissa of a floating point number having a smaller number, or for selecting one of the mantissas if the difference between the exponents of two numbers is 0, and another mantissa part different from the selection of the small mantissa selecting means. A large mantissa selecting means for selecting
The mantissa right shift means logically shifts the mantissa selected by the small mantissa selection means to the right by the absolute value of the exponent difference. The adder / subtractor unit shifts the mantissa right when the subtraction is true and the exponent difference is not zero. The first mantissa reversing means for inverting the output of the shift means, and passing through otherwise, and the output of the large mantissa selecting means for true subtraction and an exponent difference of 0, and In the case other than the above, the second mantissa inverting means for passing through and the third mantissa for inverting the output of the mantissa right shifting means in the case of true subtraction and passing the output of the mantissa right shifting means in the case of true addition. The output of the first mantissa inversion means and the output of the second mantissa inversion means are added in the case of true addition, and the output of the first mantissa inversion means and the second mantissa in the case of true subtraction The output of the inverting means is 1 for 2's complement
Together with the first mantissa adding means, the output of the third mantissa inverting means and the output of the large mantissa selecting means in the case of true addition, and the output of the third mantissa inverting means in the case of true subtraction And second mantissa adding means for adding the output of the large mantissa selecting means together with 1 for 2's complement, and the first and second mantissas in the case of true subtraction and the exponent difference being 0. And a subtraction result selection unit that selects a positive value from the two positive and negative subtraction results obtained from the addition unit, and the normalization unit determines the number of precision loss bits for the output of the addition and subtraction unit in the case of true subtraction. It may be configured by the leading 1 detection means to be obtained and the mantissa left shifting means for shifting the output of the addition / subtraction unit to the left based on the number of bits obtained by the detection result of the leading 1 detection means.

【0040】前記第1の仮数加算手段は、加算時に丸め
用の1を予め最下位ビットより1桁下位のビットに加え
ておき、前記第2の仮数加算手段は、真の加算の場合に
加算時に丸め用の1を第1の仮数加算手段より1桁上位
のビットに予め加えておき、真の減算の場合には加算時
に丸め用の1を第1の仮数加算手段より1桁下位ビット
に予め加えておき、前記加減算部は、さらに、加減算結
果選択手段の出力の最下位ビットを補正することによっ
て正しく丸められた加減算結果を得る丸め補正手段を備
えていてもよい。
The first mantissa adding means adds 1 for rounding to the bit one digit lower than the least significant bit in advance at the time of addition, and the second mantissa adding means adds in the case of true addition. Sometimes, a rounding 1 is added in advance to the bit one digit higher than the first mantissa adding means, and in the case of true subtraction, a rounding 1 is set to the one digit lower bit from the first mantissa adding means at the time of addition. In addition, the addition / subtraction unit may further include rounding correction means for obtaining a correctly rounded addition / subtraction result by correcting the least significant bit of the output of the addition / subtraction result selection means.

【0041】さらに、前記第1及び第2の仮数加算手段
は、仮数部の最上位ビットをMビット、Mビットより1
桁上位のビットをVビット、Mビットより1桁下位のビ
ットをUビット、最下位ビットをLビット、Lビットよ
り1桁下位のビットをGビット、Gビットより1桁下位
のビットをRビットとするとき、VビットからRビット
までのビット幅で加算し、前記桁合わせ部は、さらに、
右シフト手段よる桁合わせ時にRビットより下位にはみ
出た仮数の全ビットの論理和(以下Sビットと呼ぶ)を
求めるSビット生成手段を備え、前記第1の仮数加算手
段は、真の加算の場合に丸め用の1をGビットに加え、
真の減算の場合で且つ指数差が0でない場合に丸め用の
1をGビットに加えると共に2の補数化用の1としてS
ビットの論理否定値をRビットに加え、真の減算の場合
で且つ指数差が0である場合に丸め用の1を加えず、2
の補数化用の1としてSビットの論理否定値をRビット
に加え、前記第2の仮数加算手段は、真の加算の場合に
丸め用の1をLビットに加え、真の減算の場合で且つ指
数差が0でない場合に丸め用の1をRビットに加えると
共に2の補数化用の1としてSの論理否定値をRビット
に加え、真の減算であり且つ指数差が0である場合に丸
め用の1を加えず、2の補数化用の1としてSビットの
論理否定値をRビットに加え、前記加減算結果選択手段
は、第1の仮数加算手段の演算結果(以下甲と略す)、
第2の仮数加算手段の演算結果(以下乙と略す)、1ビ
ット左シフトされた乙(以下丙と略す)とが入力され、
真の加算の場合に、Mビットからオーバーフローしてい
なければ(Vが0であれば)甲を選択し、Mビットから
オーバーフローしていれば(Vが1であれば)丙を選択
し、真の減算の場合で且つ指数差が0でない場合に、M
ビットが桁落ちしていなければ(Mが1であれば)甲を
選択し、1ビット桁落ちしていれば(Mが0且つUが1
であれば)乙を選択し、2ビット以上桁落ちしていれば
(Mが0且つUが0であれば)甲を選択し、真の減算の
場合で指数差が0である場合に、甲が正であれば甲を選
択し、甲が値であれば乙を選択し、前記丸め補正手段
は、前記Sビットと甲に基づいて甲が1以上ならば(M
が1であれば)前記加減算結果選択手段の出力(以下丁
と略す)のLビットに対して補正し、甲が1/2以上1
未満ならば(Mが0且つUが1であれば)丁のGビット
に対して補正し、いずれでもなければ丁を素通しさせる
構成であってもよい。
Further, the first and second mantissa adding means are M bits for the most significant bit of the mantissa part, and 1 from M bits.
The upper bit of the digit is V bit, the lower bit of M bit is U bit, the least significant bit is L bit, the lower bit of L digit is G bit, and the lower digit of G bit is R bit. In this case, the bit widths from V bits to R bits are added, and the digit alignment unit further
The first mantissa adding means is provided with S-bit generating means for obtaining a logical sum (hereinafter referred to as S bits) of all bits of the mantissa protruding below the R bits when the digits are aligned by the right shift means. In this case, add 1 for rounding to G bit,
In the case of true subtraction and when the exponent difference is not 0, 1 for rounding is added to G bits, and S is set as 1 for 2's complementing.
The logical negation of the bits is added to the R bits, and in the case of true subtraction and the exponent difference is 0, 1 for rounding is not added and 2
The S-bit logical negation value is added to the R bit as 1 for complementation of, and the second mantissa adding means adds 1 for rounding to the L bit in the case of true addition, and in the case of true subtraction. And when the exponent difference is not 0, 1 for rounding is added to the R bit, the logical negation of S is added to the R bit as 1 for 2's complementing, and true subtraction and the exponent difference is 0 No rounding 1 is added to the R bit, and a logical negation value of S bit is added to the R bit as 1 for 2's complementation, and the addition / subtraction result selection means is the calculation result of the first mantissa addition means (hereinafter abbreviated as A). ),
The operation result of the second mantissa adding means (hereinafter abbreviated as “B”) and the 1-bit left-shifted B (hereinafter abbreviated as “B”) are input,
In the case of true addition, if it does not overflow from M bits (if V is 0), select instep A; if it overflows from M bits (if V is 1), select 丙. , And the exponent difference is not 0, M
If there is no loss of digits (if M is 1), select A, and if there is 1 loss of digits (M is 0 and U is 1)
If it is), select B, and if it has more than 2 bits of digits missing (if M is 0 and U is 0), select A. If true subtraction and the exponent difference is 0, If the instep is positive, the instep is selected, and if the instep is a value, the instep is selected. If the instep is 1 or more based on the S bit and the instep, the rounding correction means (M
Is 1), the L-bit of the output (hereinafter abbreviated as "D") of the addition / subtraction result selecting means is corrected, and the instep is 1/2 or more 1
If it is less than (when M is 0 and U is 1), the G bit of the Ding is corrected, and if neither, the Ding may be passed through.

【0042】前記丸め補正手段は、Lビットに対して補
正する場合、Lビットが1であり且つGビットとRビッ
トとSの値の論理和が0であれば、Lビットを0にし、
Gビットに対して補正する場合、Gビットが1であり且
つRビットとSの値の論理和が0であれば、Gビットを
0にする構成であってもよい。
When correcting the L bit, the rounding correction means sets the L bit to 0 when the L bit is 1 and the logical sum of the values of the G bit, the R bit and the S is 0.
When the G bit is corrected, the G bit may be 0 if the logical sum of the R bit and the S value is 0.

【0043】[0043]

【作用】本発明の浮動小数点加減算装置は上記の構成に
より、真の加算の場合、小仮数選択手段と仮数右シフト
手段により指数が小さい方の浮動小数点数の仮数部を桁
合わせし、大仮数選択手段により指数が大きい方の浮動
小数点数の仮数部を選択し、第1の仮数加算器により仮
数桁あふれが起こらないものとした仮数加算と丸めを同
時に行ない、第2の仮数加算器により仮数桁あふれを想
定した仮数加算と丸めを同時に行ない、加減算結果選択
手段により2つの仮数加算結果の内正しいビット位置に
丸めの1が加えられた方(桁あふれがないときは第1の
仮数加算器の加算結果、桁あふれが発生したときは第2
の仮数加算器の加算結果)を選択し、丸め補正手段によ
り該和のL ビットを丸めに関し補正する。
In the floating point adder / subtractor of the present invention having the above-mentioned configuration, in the case of true addition, the mantissa part of the floating point number having the smaller exponent is digitized by the small mantissa selecting means and the mantissa right shifting means, and the large mantissa is obtained. The mantissa part of the floating-point number having the larger exponent is selected by the selecting means, and the mantissa addition and rounding are performed at the same time by the first mantissa adder so that the mantissa digit overflow does not occur, and the second mantissa adder is used. Mantissa addition and rounding that assume overflow are performed at the same time, and the rounding 1 is added to the correct bit position of the two mantissa addition results by the addition / subtraction result selection means (the first mantissa adder when there is no overflow). As a result of addition, if a digit overflow occurs, the second
(The addition result of the mantissa adder) is selected, and the L bit of the sum is corrected by the rounding correction means.

【0044】真の減算の場合且つ指数差が0でない場
合、小仮数選択手段と仮数右シフト手段により指数が小
さい方の浮動小数点数の仮数部を桁合わせし、大仮数選
択手段により指数が大きい方の浮動小数点数の仮数部を
選択し、第1の仮数反転手段と第1の仮数加算器により
桁落ちが起こらないものとした仮数減算と丸めを同時に
行ない、第2の仮数反転手段と第2の仮数加算器により
1ビットの桁落ちを想定した仮数減算と丸めを同時に行
ない、加減算結果選択手段により2つの仮数減算結果の
内正しいビット位置に丸めの1が加えられた方を選択
し、丸め補正手段により該和の桁落ちが起きなければ L
ビットを1ビットの桁落ちが起きれば Gビットを丸めに
関し補正し、正規化手段により1ビット以上の桁落ちが
起きた場合に演算後正規化を施す。
In the case of true subtraction and the exponent difference is not 0, the small mantissa selecting means and the mantissa right shifting means align the digits of the mantissa part of the floating-point number having the smaller exponent, and the large mantissa selecting means increase the exponent. The mantissa part of one of the floating-point numbers is selected, and mantissa subtraction and rounding are performed at the same time so that precision cancellation does not occur by the first mantissa inverting means and the first mantissa adder. The mantissa adder of 2 simultaneously performs mantissa subtraction assuming rounding of 1 bit and rounding, and the addition / subtraction result selecting means selects one of the two mantissa subtraction results to which the rounding 1 is added at the correct bit position, If the rounding correction means does not cause cancellation of the sum, L
If a bit loss of 1 bit occurs, the G bit is corrected for rounding, and if a digit loss of 1 bit or more occurs by the normalizing means, post-operation normalization is performed.

【0045】真の減算の場合且つ指数差が0である場合
に小仮数選択手段と大仮数選択手段によりそれぞれ別の
浮動小数点数の仮数部を選択し、第1の仮数反転手段と
第1の仮数加算器により大仮数選択手段の出力から小仮
数選択手段の出力を減じ、逆に第2の仮数反転手段と第
3の仮数反転手段と第2の仮数加算器により小仮数選択
手段の出力から大仮数選択手段の出力を減じ、加減算結
果選択手段により2つの仮数同士の差の内それらの絶対
値である方を選択し、正規化手段により1ビット以上の
桁落ちが起きた場合に演算後正規化を施す。
In the case of true subtraction and when the exponent difference is 0, the small mantissa selecting means and the large mantissa selecting means respectively select different mantissa parts of the floating point number, and the first mantissa inverting means and the first mantissa inverting means. The mantissa adder subtracts the output of the small mantissa selection means from the output of the large mantissa selection means, and conversely the second mantissa inversion means, the third mantissa inversion means, and the second mantissa adder subtracts the output of the small mantissa selection means. After subtracting the output of the large mantissa selection means, the addition / subtraction result selection means selects one of the absolute values of the two mantissas which is the absolute value of them, and the normalization means performs calculation when a digit loss of 1 bit or more occurs. Apply normalization.

【0046】以上により正しく丸められた浮動小数点数
同士の和または差を計算することを可能とする。
As described above, it is possible to calculate the sum or difference between the correctly rounded floating point numbers.

【0047】[0047]

【実施例】以下本発明の一実施例について、図面を参照
しながら説明する。(図1)は本実施例の浮動小数点加
減算装置の構成図を示す。101はソースA バスで、浮
動小数点数A の供給元である。バス上の浮動小数点数に
ついては、符号部 sA は1 ビット、指数部 eA はいわゆ
るゲタばき表現でIEEE規格の指数部所定のビット長、仮
数部 fA はU ビットからL ビットまでのビット長(Mビッ
トは隠れている) で表される。ただし、本実施例におけ
る浮動浮動小数点加減算装置の内部では、V,M,G,R の各
ビットが付加されてV,M,U 〜L,G,R,ビットが一括して取
扱われる。
DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 shows the configuration of the floating point addition / subtraction device of this embodiment. A source A bus 101 is a source of the floating point number A 1. For floating-point numbers on the bus, the sign part s A is 1 bit, the exponent part e A is the so-called gettering representation, and the exponent part of the IEEE standard has a predetermined bit length, and the mantissa part f A is from U bits to L bits. It is represented by the bit length (M bits are hidden). However, in the floating floating point addition / subtraction device according to the present embodiment, V, M, G, R bits are added and V, M, U to L, G, R, bits are collectively handled.

【0048】102はソースB バスで、浮動小数点数B
を供給元である。ビット長はソースA バス101と同じ
である。103はディスティネーションバスで、浮動小
数点加減算装置の加減算結果Rが出力される。ビット長
はソースA バス101と同じである。104は符号生成
器で、2つの浮動小数点数の符号,演算の種別,2つの
指数の大小関係から仮の演算結果の符号を生成し、真の
加算であるか真の減算であるかを判定する。
A source B bus 102 is a floating point number B
Is the supplier. The bit length is the same as the source A bus 101. A destination bus 103 outputs an addition / subtraction result R of the floating point addition / subtraction device. The bit length is the same as the source A bus 101. Reference numeral 104 denotes a code generator, which generates a tentative calculation result code from the relationship between the two floating-point number codes, the operation type, and the two exponent magnitudes, and determines whether it is true addition or true subtraction. To do.

【0049】105は符号反転器で、2つの仮数の大小
比較から真の演算結果の符号を決定する。106は指数
減算器で、2数の指数を減算することによって両指数の
大小関係を判別すると共に指数差を求める。107は指
数差絶対値化器で、指数差の絶対値を求める。
Reference numeral 105 denotes a sign inverter, which determines the sign of the true operation result from the magnitude comparison of two mantissas. An exponent subtractor 106 subtracts two exponents to discriminate the magnitude relationship between the two exponents and obtain an exponent difference. An exponent difference absolute value converter 107 obtains the absolute value of the exponent difference.

【0050】108は指数選択器で、2つの指数の内小
さくない方を選択する。109は指数増分器で、指数値
に1を加える。110は指数補正器で、指数値から演算
後正規化の補正値を減ずる。111は第1の仮数選択器
(小仮数選択手段)で、指数が小さい方の浮動小数点数
の仮数を選択し、または2数の指数の差が0ならばいず
れかの仮数を選択する。
An exponent selector 108 selects one of the two exponents which is not smaller. An exponent incrementer 109 adds 1 to the exponent value. Reference numeral 110 denotes an exponent corrector, which subtracts the post-computation normalization correction value from the exponent value. Reference numeral 111 denotes a first mantissa selector (small mantissa selecting means) which selects a mantissa of a floating-point number having a smaller exponent, or selects one of the mantissas if the difference between the exponents of the two numbers is zero.

【0051】112は第2の仮数選択器(大仮数選択手
段)で、第1の仮数選択器の選択と異なる方の仮数部を
選択する。113は仮数右シフタで、第1の仮数選択部
で選択された仮数を指数差の絶対値だけ下位側(以下右
と呼ぶ)へ論理シフトする。114はS ビット生成器
で、桁合わせ時にS ビットを生成する手段である。
A second mantissa selector 112 (large mantissa selecting means) 112 selects a mantissa part different from the selection of the first mantissa selector. A mantissa right shifter 113 logically shifts the mantissa selected by the first mantissa selection unit to the lower side (hereinafter referred to as right) by the absolute value of the exponent difference. Reference numeral 114 is an S-bit generator, which is means for generating S-bits at the time of digit alignment.

【0052】115は第1の仮数反転手段で、真の減算
の場合に仮数右シフト手段の出力を反転させ、真の加算
の場合に仮数右シフト手段の出力を素通しさせる。11
6は第2の仮数反転手段で、真の減算の場合で且つ指数
差が0でない場合には仮数右シフト手段の出力を反転さ
せ、それ以外の場合に素通しさせる。117は第3の仮
数反転手段で、真の減算の場合で且つ指数差が0である
場合には大仮数選択手段の出力を反転させ、それ以外の
場合に素通しさせる。
Reference numeral 115 denotes a first mantissa inverting means which inverts the output of the mantissa right shift means in the case of true subtraction and passes the output of the mantissa right shift means in the case of true addition. 11
The second mantissa inverting means 6 inverts the output of the mantissa right shift means in the case of true subtraction and when the exponent difference is not 0, and passes it through in other cases. Reference numeral 117 denotes a third mantissa inverting means which inverts the output of the large mantissa selecting means in the case of true subtraction and when the exponent difference is 0, and passes it through in other cases.

【0053】118は第1の仮数加算手段で、真の加算
の場合に第1の仮数反転手段の出力と大仮数選択手段の
出力を加算し、真の減算の場合に第1の仮数反転手段の
出力と大仮数選択手段の出力を2の補数化用の1と共に
加算する。このとき同時に丸め用の1を予め最下位ビッ
トより1桁下位のビットに加える。119は第2の仮数
加算手段で、真の加算の場合に第2の仮数反転手段の出
力と第3の仮数反転手段の出力を加算し、真の減算の場
合に第2の仮数反転手段の出力と第3の仮数反転手段の
出力を2の補数化用の1と共に加算する。このとき真の
加算の場合に加算時に丸め用の1を第1の仮数加算手段
より1桁上位のビットに予め加えておき、真の減算の場
合には加算時に丸め用の1を第1の仮数加算手段より1
桁下位ビットに予め加える。
Reference numeral 118 denotes a first mantissa adding means, which adds the output of the first mantissa inverting means and the output of the large mantissa selecting means in the case of true addition, and the first mantissa inversion means in the case of true subtraction. And the output of the large mantissa selecting means are added together with 1 for 2's complement conversion. At this time, at the same time, a rounding 1 is added to the bit one digit lower than the least significant bit. A second mantissa adding unit 119 adds the output of the second mantissa inverting unit and the output of the third mantissa inverting unit in the case of true addition, and the second mantissa inverting unit in the case of true subtraction. The output and the output of the third mantissa inverting means are added together with 1 for 2's complement conversion. At this time, in the case of true addition, a rounding 1 is added in advance to a bit one digit higher than the first mantissa adding means in the case of addition, and in the case of true subtraction, a rounding 1 is added in the first digit. 1 from the mantissa adding means
It is added to the lower bits of the digit beforehand.

【0054】120は第3の仮数選択器で、2つの加減
算結果の内正しいビット位置に丸め用の1が加えられた
方を選択し、または真の減算であり且つ指数差が0であ
る場合に正の値の仮数差を選択する手段である。121
は丸め補正器で、仮に丸められた加減算結果の最下位1
ビットを補正して正確な丸めを実現する手段である。
Reference numeral 120 denotes a third mantissa selector which selects one of the two addition / subtraction results with a correct bit position added with a 1 for rounding, or a true subtraction and an exponent difference of 0. Is a means for selecting a positive mantissa difference. 121
Is a rounding corrector, which is the lowest 1 of the temporarily rounded addition / subtraction result
It is a means to correct bits and realize accurate rounding.

【0055】122は先行1検出器で、真の減算の場合
に仮数差の桁落ちしたビット数を検出する手段である。
123は仮数左シフタで、桁落ちが発生したときに仮数
部を正規化する手段である。上記のように構成された本
実施例におけるの浮動小数点加減算装置の動作を以下に
説明する。本実施例は3段のパイプライン処理により浮
動小数点数同士を加減算する。本実施例はソースA バス
101とソースB バス102より2つの浮動小数点数A
とB を受け取り、これらの加算または減算を行なった後
結果の和(A+B )または差(A −B )をディスティネ
ーションバス103へ出力する。前記3段のパイプライ
ン処理の概要を次に述べる。
Reference numeral 122 denotes a leading one detector, which is a means for detecting the number of bits in which the mantissa difference has been canceled in the case of true subtraction.
A mantissa left shifter 123 is a means for normalizing the mantissa part when a digit loss occurs. The operation of the floating point addition / subtraction device according to the present embodiment configured as described above will be described below. In this embodiment, floating point numbers are added and subtracted by a three-stage pipeline process. In this embodiment, two floating-point numbers A are supplied from the source A bus 101 and the source B bus 102.
And B, and after adding or subtracting them, the result sum (A + B) or difference (A-B) is output to the destination bus 103. The outline of the three-stage pipeline processing will be described below.

【0056】<第1段> ・指数部によりA とB の大小を比較し、小さい方の仮数
部を桁合わせする。 ・2つの浮動小数点数の符号,大小関係,演算の種別よ
り結果の符号を仮に決定する。
<First stage> -The magnitudes of A and B are compared by the exponent part, and the mantissa part of the smaller one is aligned. -Temporarily determine the sign of the result based on the sign of the two floating-point numbers, the magnitude relationship, and the type of operation.

【0057】<第2段> ・実質的な仮数部の加減算と丸めを行なう。 ・真の減算の場合且つ指数差が0であれば仮数の大小判
定により最終的な符号を決定する。 <第3段> ・桁落ちした場合、仮数部と指数部の正規化を行なう。
<Second stage> -Substantially adding and subtracting mantissa and rounding. In the case of true subtraction and if the exponent difference is 0, the final sign is determined by the mantissa magnitude judgment. <Third stage> ・ If a digit is lost, the mantissa part and the exponent part are normalized.

【0058】本実施例により浮動小数点数A とB を加減
算する場合、本実施例の具体的な動作を真の加算の場合
と真の減算の場合とに分けて以下に説明する。本実施例
の浮動小数点加減算装置の丸めのアルゴリズムは従来例
のそれと同じである。下記の動作の説明中では実際の回
路の動作を念頭に置き、各部の論理がdon't careであっ
たり何も行なわない場合でもその旨を明記した。 1.真の加算の場合 仮数上位あふれの発生は第1の仮数加算器118で求め
た和のV ビットが1 になることで判定できる。第3段は
真の加算の場合には実質的に動作せず、符号・指数部・
仮数部は第3段を素通りする。 <第1段> (1.1) 指数減算器106において指数差(eA − eB) を
計算する。 (1.2) 指数差絶対値化器107において指数差の絶対値
|eA − eB |を計算する。 (1.3) 指数を比較した結果、指数選択器108により e
A と eB の内小さくない方を選択し、max ( eA , eB)
を出力する。 (1.4) 符号生成器104において(表2)に基づき符号
を決定する。ここで和の符号は sA である。 (1.5) 2つの仮数部 fA と fB の内、第1の仮数選択器
111により指数の小さい方の仮数部を選択し、これを
fs とする。2つの指数値 eA と eB が等しい場合、第
1の仮数選択器111はいずれの仮数部を選択してもよ
いが、第2の仮数選択器112とは別の方を選択する。 (1.6) 2つの仮数部 fA と fB の内、第2の仮数選択器
112により指数の大きい方の仮数部を選択し、これを
fl とする。2つの指数値 eA と eB が等しい場合、第
2の仮数選択器112はいずれの仮数部を選択してもよ
いが、(1.5) で述べたように第1の仮数選択器111と
は別の方を選択する。 (1.7) 仮数右シフタ113により fs を|eA − eB|ビ
ット右へシフトする。これを桁合わせと呼び、桁合わせ
された fs を fs' で表す。 (1.8) S ビット生成器114により、上記桁合わせ時に
仮数部のR ビットより右にこぼれた全ビットの論理和を
取りこれをS ビットとする。 (1.9) (表10)に基づき3つの仮数ビット反転器11
5,116,117を素通しさせる。 <第2段> (2.1) (表12)に基づき第2の仮数加算器119によ
り fl と fs' とL ビットに対する1 を同時に加算して
丸める。(2の補数化用の1を加えるビット位置につい
ては、後述する。) (2.2) (表11)に基づき第1の仮数加算器118によ
り fl と fs' とG ビットに対する1 を同時に加算して
丸める。仮数上位あふれが発生すれば(2.5) へ飛び、さ
もなければ次へ進む。 (2.3) (表13)に基づき第3の仮数選択器120にお
いて、第1の仮数加算器118で求めた和を選択する。 (2.4) (表13)に基づき指数増分器109において、
値max(eA , eB) を通過させる。(2.7) へ行く。 (2.5) (表13)に基づき第3の仮数選択器120にお
いて、第2の仮数加算器119で求めた和を1 ビット右
シフトした値を選択する。 (2.6) (表13)に基づき指数増分器109において、
max(eA , eB) を1増やす。(2.7) 丸め補正器121に
より、(表14)に基づき丸めに関し和のL ビットを補
正する。 (2.8) 符号反転器105は第1段において決定した符号
を素通しさせ、これをsR とする。 <第3段> (3.1) 先行1検出器122は、丸められた和のM ビット
より右へスキャンして最初にビット1が現われるビット
位置を探索し、そのビット位置とM ビットとの距離を2
進数にエンコードする。真の加算ではこの距離は0であ
る。 (3.2) 仮数左シフタ123は、先行1検出器122で求
めたビット数だけ和を左へシフトすることにより、和の
M ビットが1となるように仮数部を調整する。シフトし
た仮数部を fR とする。真の加算では既に仮数部のM ビ
ットは1であるため、シフトしない。 (3.3) 指数補正器110において、補正された指数部よ
り前記エンコードされた左シフト数を減じた差を eR
する。真の加算ではエンコードされた左シフト数より0
を減ずる。(終わり) 2.真の減算の場合 本パイプライン第3段における一連の処理は、一般に演
算後正規化と呼ばれる。 <第1段> (1.1) 指数減算器106において指数差(eA − eB) を
計算する。 (1.2) 指数差絶対値化器107において指数差の絶対値
|eA − eB |を計算する。指数差が0ならば(1.10)へ
飛びさもなければ次へ進む。 (1.3) 指数を比較した結果、指数選択器108により e
A と eB の内大きい方を選択し、max(eA , eB) を出力
する。 (1.4) 符号生成器104において(表2)に基づき sA
と sB と(eA − eB) の符号より差の符号を決定する。 (1.5) 2つの仮数部 fA と fB の内、第1の仮数選択器
111により指数の小さい方の仮数部を選択し、これを
fs とする。 (1.6) 2つの仮数部 fA と fB の内、第2の仮数選択器
112により指数の大きい方の仮数部を選択し、これを
fl とする。 (1.7) 仮数右シフタ113により fs を桁合わせする。
桁合わせされた fs をfs' で表す。 (1.8) S ビット生成器114により、上記桁合わせ時に
仮数部のR ビットより右にこぼれた全ビットの論理和を
取りこれをS ビットとする。 (1.9) (表10)に基づき仮数ビット反転器115,1
16により fs' の全ビットを反転させる。ビット反転
された fs' を!fs' で表す。仮数ビット反転117によ
り fl の全ビットを素通しさせる。 <第2段> (2.1) (表12)に基づき第2の仮数加算器119によ
り fl と!fs' とR ビットに対する1 と2の補数化のた
めの1 を同時に加算して丸める。 (2.2) (表11)に基づき第1の仮数加算器118によ
り fl と!fs' とG ビットに対する1 と2の補数化のた
めの1 を同時に加算して丸める。 (2.3) (表13)に基づき第3の仮数選択器120にお
いて、第1の仮数加算器118において求めた差に桁落
ちが発生すれば第2の仮数加算器119で求めた差を選
択し、さもなければ第1の仮数加算器118で求めた差
を選択する。 (2.4) (表13)に基づき指数増分器109において、
値max(eA , eB) を通過させる。 (2.5) 丸め補正器121により、(表14)に基づき丸
めに関し差のL ビットもしくはG ビットを補正する。 (2.6) 符号反転器105は第1段において決定した符号
を素通しさせ、これをsR とする。 <第3段> (3.1) 先行1検出器122は、丸められた差のMビット
より右へスキャンして最初にビット1が現われるビット
位置を探索し、そのビット位置とMビットとの距離を2
進数にエンコードする。 (3.2) 仮数左シフタ123は、先行1検出器122で求
めたビット数だけ差を左へシフトすることにより、差の
最上位ビットが1となるように仮数部を調整する。シフ
トした仮数部を fR とする。 (3.3) 指数補正器110において、補正された指数部よ
り前記エンコードされた左シフト数を減じた差を eR
する。(終わり) <(1.2) の続き(指数差が0の場合)> (1.10)指数選択器108により eA と eB のいずれかを
選択し、出力する。 (1.11)符号生成器104において(表2)に基づき sA
と sB より差の符号を決定する。 (1.12)2つの仮数部 fA と fB の内、第1の仮数選択器
111はいずれの仮数部を選択してもよいが、第2の仮
数選択器112とは別の方を選択する。 (1.13)2つの仮数部 fA と fB の内、第2の仮数選択器
112はいずれの仮数部を選択してもよいが、(1.11)で
述べたように第1の仮数選択器111とは別の方を選択
する。 (1.14)仮数右シフタ113により fs を桁合わせする。
ここではシフト数は0である。 (1.15) Sビット生成器114において、ここでは0であ
るS ビットを発生させる。 (1.16)(表10)に基づき仮数ビット反転器115によ
り fs の全ビットを反転させる。仮数ビット反転器11
7により fl の全ビットを反転させる。ビット反転され
た fs を!fs で、ビット反転された fl を!fl で表す。
仮数ビット反転器116により fs の全ビットを素通し
させる。
When the floating point numbers A and B are added or subtracted according to the present embodiment, the specific operation of the present embodiment will be described below separately for the case of true addition and the case of true subtraction. The rounding algorithm of the floating point addition / subtraction device of this embodiment is the same as that of the conventional example. In the following explanation of the operation, the actual operation of the circuit is kept in mind, and the fact is clearly stated even if the logic of each part is don't care or nothing is done. 1. In the case of true addition: Occurrence of overflow of the mantissa can be determined by setting the V bit of the sum obtained by the first mantissa adder 118 to 1. The third stage does not work in the case of true addition, and the sign, exponent,
The mantissa part passes through the third stage. Exponent difference in <First stage> (1.1) Index subtractor 106 (e A - e B) is calculated. (1.2) The absolute value of the index difference | e A −e B | is calculated in the index difference absolute value converter 107. (1.3) As a result of comparing the indices, the index selector 108
Select not smaller of A and e B, max (e A, e B)
Is output. (1.4) The code generator 104 determines a code based on (Table 2). Where the sign of the sum is s A. (1.5) Of the two mantissa parts f A and f B , the first mantissa selector 111 selects the mantissa part with the smaller exponent, and selects it.
Let f s . When the two exponent values e A and e B are equal, the first mantissa selector 111 may select any mantissa part, but selects a different one from the second mantissa selector 112. (1.6) Of the two mantissa parts f A and f B , the second mantissa selector 112 selects the mantissa part having the larger exponent, and selects it.
Let f l . When the two exponent values e A and e B are equal, the second mantissa selector 112 may select any mantissa part, but as described in (1.5), the first mantissa selector 111 is Choose another one. (1.7) The mantissa right shifter 113 shifts f s to the right by | e A − e B | bits. This is called digit alignment, representing a digit alignment has been f s at f s'. (1.8) The S-bit generator 114 takes the logical sum of all the bits spilled to the right of the R-bit of the mantissa at the time of the digit alignment and sets this as the S-bit. (1.9) Three mantissa bit inverters 11 based on (Table 10)
5,116,117 are passed through. <Second Stage> Based on (2.1) (Table 12), the second mantissa adder 119 simultaneously adds f l and f s ' and 1 for the L bit and rounds. (The bit position for adding 1 for complementing 2 will be described later.) (2.2) Based on (Table 11), the first mantissa adder 118 simultaneously adds 1 for f l and f s ' and G bits. And then round. If mantissa upper overflow occurs, jump to (2.5), otherwise proceed to the next. (2.3) Based on (Table 13), the third mantissa selector 120 selects the sum obtained by the first mantissa adder 118. (2.4) In the exponent incrementer 109 based on (Table 13),
Pass the value max (e A , e B ). Go to (2.7). (2.5) Based on (Table 13), the third mantissa selector 120 selects a value obtained by shifting the sum obtained by the second mantissa adder 119 by 1 bit to the right. (2.6) In the exponent incrementer 109 based on (Table 13),
Increase max (e A , e B ) by 1. (2.7) The rounding corrector 121 corrects the sum L bit for rounding based on (Table 14). (2.8) The code inverter 105 passes through the code determined in the first stage and sets it as s R. <Third stage> (3.1) The leading 1 detector 122 scans to the right from the M bits of the rounded sum to search for the bit position where bit 1 first appears, and finds the distance between the bit position and the M bit. Two
Encode to a base number. In true addition, this distance is zero. (3.2) The mantissa left shifter 123 shifts the sum to the left by the number of bits obtained by the preceding 1 detector 122, thereby calculating the sum.
Adjust the mantissa so that the M bit is 1. Let f R be the shifted mantissa. In true addition, the M bits of the mantissa are already 1, so no shift is performed. (3.3) In the exponent corrector 110, the difference obtained by subtracting the encoded left shift number from the corrected exponent part is taken as e R. 0 for the number of left shifts encoded in true addition
Reduce. (End) 2. Case of True Subtraction The series of processing in the third stage of the pipeline is generally called post-operation normalization. Exponent difference in <First stage> (1.1) Index subtractor 106 (e A - e B) is calculated. (1.2) The absolute value of the index difference | e A −e B | is calculated in the index difference absolute value converter 107. If the index difference is 0, skip to (1.10), otherwise proceed to the next step. (1.3) As a result of comparing the indices, the index selector 108
Select whichever larger of A and e B, and outputs the max (e A, e B) . (1.4) In the code generator 104, based on (Table 2) s A
And s B and the sign of (e A − e B ) determines the sign of the difference. (1.5) Of the two mantissa parts f A and f B , the first mantissa selector 111 selects the mantissa part with the smaller exponent, and selects it.
Let f s . (1.6) Of the two mantissa parts f A and f B , the second mantissa selector 112 selects the mantissa part having the larger exponent, and selects it.
Let f l . (1.7) Digitization of f s is performed by the mantissa right shifter 113.
The digit alignment has been f s represented by f s'. (1.8) The S-bit generator 114 takes the logical sum of all the bits spilled to the right of the R-bit of the mantissa at the time of the digit alignment and sets this as the S-bit. (1.9) Based on (Table 10), the mantissa bit inverter 115,1
Invert all bits of f s ' by 16. Bit inverted 'the! F s' f s represented by. Mantissa bit inversion 117 passes through all bits of f l . <Second Stage> Based on (2.1) (Table 12), the second mantissa adder 119 simultaneously adds f 1 and! F s ' and 1 for complementing 1 and 2 for the R bit and rounds. (2.2) Based on (Table 11), the first mantissa adder 118 simultaneously adds f 1 and! F s ' and 1 for complementing 1 and 2 for G bits and rounds them. (2.3) On the basis of (Table 13), in the third mantissa selector 120, if the difference found in the first mantissa adder 118 has a precision loss, the difference found in the second mantissa adder 119 is selected. , Otherwise select the difference determined by the first mantissa adder 118. (2.4) In the exponent incrementer 109 based on (Table 13),
Pass the value max (e A , e B ). (2.5) The rounding corrector 121 corrects the difference L bit or G bit for rounding based on (Table 14). (2.6) The code inverter 105 passes through the code determined in the first stage and sets it as s R. <Third Stage> (3.1) The leading 1 detector 122 scans to the right from the M bits of the rounded difference to search for the bit position where bit 1 first appears, and finds the distance between the bit position and M bits. Two
Encode to a base number. (3.2) The mantissa left shifter 123 adjusts the mantissa part so that the most significant bit of the difference becomes 1 by shifting the difference to the left by the number of bits obtained by the leading 1 detector 122. Let f R be the shifted mantissa. (3.3) In the exponent corrector 110, the difference obtained by subtracting the encoded left shift number from the corrected exponent part is taken as e R. (End) <Continuation of (1.2) (when index difference is 0)> (1.10) Either e A or e B is selected by the index selector 108 and output. (1.11) In the code generator 104, based on (Table 2) s A
And s B determine the sign of the difference. (1.12) Of the two mantissa parts f A and f B , the first mantissa selector 111 may select any mantissa part, but it selects a different one from the second mantissa selector 112. . (1.13) Of the two mantissa parts f A and f B , the second mantissa selector 112 may select any mantissa part, but as described in (1.11), the first mantissa selector 111 Choose a different one from. (1.14) to align digits the f s by the temporary number right shifter 113.
Here, the shift number is 0. (1.15) In the S bit generator 114, the S bit, which is 0 in this case, is generated. Based on (1.16) (Table 10), the mantissa bit inverter 115 inverts all bits of f s . Mantissa bit inverter 11
Invert all bits of f l by 7. Bit inverted the f s! At f s, representing bit inverted the f l at! F l.
The mantissa bit inverter 116 allows all bits of f s to pass through.

【0059】<第2段> (2.7) (表11)に基づき第1の仮数加算器118によ
り fs と fl と2の補数化のための1 を同時に加算す
る。 (2.8) (表12)に基づき第2の仮数加算器119によ
り fs と fl と2の補数化のための1 を同時に加算す
る。 (2.9) (表13)に基づき第3の仮数選択器120にお
いて、第1の仮数加算器118で求めた差が正(V ビッ
トが1のとき正である)ならば第1の仮数加算器118
で求めた差が負(V ビットが0のとき負である)ならば
第2の仮数加算器119で求めた差を選択する。 (2.10)(表13)に基づき指数増分器109において、
値max(eA , eB) を 過させる。 (2.11)(表14)に基づいて丸め補正器121により、
選択された差を通過させる。 (2.12)第2の仮数加算器119で求めた差が負であれば
符号反転器105は第1段において決定した符号を反転
させ、さもなければ符号反転器105は第1段において
決定した符号を素通しさせ、これを sR とする。以降、
(3.1) へ続く。
<Second Stage> (2.7) Based on (Table 11), the first mantissa adder 118 simultaneously adds f s , f l, and 1 for 2's complement. (2.8) Based on (Table 12), the second mantissa adder 119 simultaneously adds f s , f l, and 1 for complementing 2. (2.9) Based on (Table 13), in the third mantissa selector 120, if the difference obtained by the first mantissa adder 118 is positive (positive when the V bit is 1), the first mantissa adder 118
If the difference obtained in step 1 is negative (negative when the V bit is 0), the difference obtained in the second mantissa adder 119 is selected. In the exponent incrementer 109 based on (2.10) (Table 13),
Exceed the value max (e A , e B ). Based on (2.11) (Table 14), the rounding compensator 121
Pass the selected difference. (2.12) If the difference obtained by the second mantissa adder 119 is negative, the sign inverter 105 inverts the sign determined in the first stage, otherwise the sign inverter 105 determines the sign determined in the first stage. And let this be s R. Or later,
Continue to (3.1).

【0060】[0060]

【表10】 [Table 10]

【0061】[0061]

【表11】 [Table 11]

【0062】[0062]

【表12】 [Table 12]

【0063】[0063]

【表13】 [Table 13]

【0064】[0064]

【表14】 [Table 14]

【0065】[0065]

【表15】 [Table 15]

【0066】[0066]

【表16】 [Table 16]

【0067】[0067]

【表17】 [Table 17]

【0068】本発明にかかる上記実施例の浮動小数点演
算算法の正当性を数学的に考察する。一例として前記実
施例のRN丸めモードの場合に関して丸め論理の正当性を
考察する。2浮動小数点数A,B について、 1 ≦ fA < 2 1 ≦ fB < 2 より (数1) 1 ≦ fs < 2 1 ≦ fl < 2 である。 fs を桁合わせした後の値を fs' とすると、 (数2) 0 ≦ fs' < 2 ここで fs' =0 となるのは fs の有効ビットが全て情
報落ちしてしまった場合である。2浮動小数点数A,Bの
真の加算において、(数1)と(数2)より 1 ≦ fl + fs' < 4 となる。 第1に仮数部の和 fl + fs' が 1 ≦ fl + fs' < 2 の場合、演算後正規化は必要ない。また丸め用の1 はG
ビットに加算される。第2に 2 ≦ fl + fs' < 4 の場合、仮数部は仮数上位あふれを起こしているので仮
数部を右に1ビットシフトし指数に1を加算する。丸め
用の1があらかじめL ビットに加えられる。(表18)
に示すように仮数上位あふれはV ビットにより判別でき
る。
The validity of the floating point arithmetic method of the above embodiment according to the present invention will be mathematically examined. As an example, consider the legitimacy of the rounding logic for the case of the RN rounding mode of the previous embodiment. For two floating-point numbers A and B, 1 ≤ f A <2 1 ≤ f B <2 (Equation 1) 1 ≤ f s <2 1 ≤ f l <2. If f s ' is the value after f s is aligned, (Equation 2) 0 ≤ f s '<2 where f s ' = 0, all the valid bits of f s are lost. That is the case. In the true addition of the two floating-point numbers A and B, 1 ≦ f l + f s ′ <4 from (Equation 1) and (Equation 2). First, when the sum of mantissas f l + f s 'is 1 ≤ f l + f s '<2, post-operation normalization is not necessary. Also, 1 for rounding is G
Is added to the bits. Secondly, in the case of 2 ≤ f l + f s '<4, the mantissa part overflows the mantissa, so the mantissa part is shifted to the right by 1 bit and 1 is added to the exponent. A 1 for rounding is added to the L bit beforehand. (Table 18)
As shown in, the mantissa upper overflow can be identified by the V bit.

【0069】次に、2浮動小数点数A ,B の真の減算に
ついて、基本的な手順を述べる。第1に減数の全ビット
を反転する(1の補数を取る)。第2に被減数と上記減
数のビット反転数と丸め用の1 と2の補数化用の1 を加
算する。真の減算アルゴリズムは指数差が0か否かによ
り大きく異なる。まず、指数差が0のとき、 −1 < fl − fs < 1 となる。この場合、正確な差が得られるため丸めは不要
である。上記手順の第2において丸め用の1を加算せ
ず、2の補数化用の1をLビットに加える。
Next, the basic procedure for the true subtraction of the two floating point numbers A and B will be described. First, it inverts all bits of the divisor (takes the complement of 1). Second, add the minuend, the bit-reversal number of the above-mentioned subtrahend, 1 for rounding, and 1 for 2's complement. The true subtraction algorithm greatly differs depending on whether the exponent difference is 0 or not. First, when the exponent difference is 0, -1 <f l - a f s <1. In this case, rounding is not necessary as an accurate difference is obtained. In the second step above, the rounding 1's are not added, but the 2's complementing 1's are added to the L bits.

【0070】−1 < fl − fs < 0 の場合、本実施例では第2の仮数加算器119において
fs − fl を計算しているためこれを選択することによ
り| fl − fs |を得る。一方、 0 ≦ fl − fs < 1 の場合、本実施例では第1の仮数加算器118において
fl − fs を計算しているためこれを選択することによ
り| fl − fs |を得る。
In the case of −1 <f l −f s <0, in the second mantissa adder 119 in this embodiment.
Since f s − f l has been calculated, selecting it yields | f l − f s |. On the other hand, when 0 ≦ f l −f s <1, in the present embodiment, the first mantissa adder 118
Since f l − f s has been calculated, selecting it yields | f l − f s |.

【0071】[0071]

【表18】 [Table 18]

【0072】次に指数差が0でないときについて考察す
る。この場合 0 ≦ fs' < 1 だから差の範囲は、 0 < fl − fs' <2 である。この範囲を次の3つの部分に分ける。 (1) 0< fl − fs' <1/2 指数差が0 又は1 である場合にのみ起こり得る。丸めの
必要はないので上記指数差が0である場合と同じであ
る。 (2) 1/2 ≦ fl − fs' < 1 仮数差のビットRに対し丸め用の1を加えた後、仮数部
を左に1ビットシフトし指数から1を減算すれば正規化
された仮数部の差が得られる。左に1ビットシフトされ
た仮数差のビットGに対する丸め用の1の加算と同じこ
とである。 (3) 1 ≦ fl − fs' <2 仮数差のビットG に対し丸め用の1を加えればよい。
Next, consider the case where the index difference is not zero. In this case 0 ≦ f s '<range of 1 So differences, 0 <f l - f s ' is <2. This range is divided into the following three parts. (1) 0 <f l - f s'< can only occur if 1/2 exponent difference is 0 or 1. Since there is no need for rounding, it is the same as when the index difference is 0. (2) 1/2 ≤ f l − f s '<1 After adding 1 for rounding to the bit R of the mantissa difference, shift the mantissa part 1 bit to the left and subtract 1 from the exponent to normalize. The difference of the mantissa is obtained. This is the same as the addition of 1 for rounding to the bit G of the mantissa difference which is shifted to the left by 1 bit. (3) 1 ≤ f l − f s '<2 It is sufficient to add 1 for rounding to the bit G of the mantissa difference.

【0073】更に真の減算の場合の丸めと減数の2の補
数化について考察する。減数 fs は桁合わせされた後、
第1及び第2の仮数反転器115,116によってその
全ビットが反転される。減算のためには被減数に減数 f
s' の1の補数と減数 fs' のLSB における1の3者を加
算する。即ち減数 fs' の2の補数を取るためにその1
の補数のLSB に1を足さねばならない。問題は減数が桁
合わせされてしまっているためにその下位側の数ビット
が失われていることである。このため桁合わせされた減
数 fs' の1の補数のLSB に1を足すことはできない。
Consider further rounding and 2's complementing of the subtrahend in the case of true subtraction. After the reduction f s is aligned,
All the bits are inverted by the first and second mantissa inverters 115 and 116. For subtraction, the minuend is reduced to f
'and the one's complement of meiotic f s' s adds one of three parties in the LSB of. That is, to take the two's complement of the divisor f s ' 1
You must add 1 to the LSB of the complement of. The problem is that some of the lower bits are lost because the divisors have been aligned. So we cannot add one to the LSB of the one's complement of the digitized fraction f s '.

【0074】減数のS ビットを使ってこの問題を解決で
きる。(図4(a) ),(図4(b) ),(図5(a) ),
(図5(b) )に差の範囲が上記(3) の場合に関し仮数部
における真の減算の仕組みを示し、これに沿って説明す
る。図4(a) において、被減数fl は正規化された正数
であり、減数 fs' は既に桁合わせされた正数で、そのL
ビットより右に仮想的にこぼれたビットが示されてお
り、これらは実際には既に消滅した情報である。まず差
の範囲が上記(3) の場合を考えると、丸めのために差の
G ビットに1 が加えられる。
This problem can be solved by using the S bit of the reduction. (Fig. 4 (a)), (Fig. 4 (b)), (Fig. 5 (a)),
FIG. 5 (b) shows the mechanism of true subtraction in the mantissa part in the case where the difference range is the above (3), and description will be given along this line. In Fig. 4 (a), the minuend f l is a normalized positive number, and the minuend f s ' is a positive number already aligned, and its L
Bits that are virtually spilled to the right of the bits are shown, and these are actually the information that has already disappeared. First, considering the case where the difference range is (3) above, the difference
1 is added to the G bit.

【0075】次に減数 fs' の1の補数を取り、仮想的
に減数 fs' のLSB に1を加算して2の補数を取る(図
4(b) )。実際に仮想的なLSB に1を加算することはで
きないが、その仮想的な1の加算を行なった結果、それ
による桁上げが現実のLSB にまで伝播して来るかどうか
を判定することはできる。この現実のLSB とは、次に考
察する仮数範囲(2) をも考慮してここではR ビットであ
るとする。桁上げが2の補数化用の1の桁からRビット
にまで伝播して来る場合は桁合わせで減数 fs' のL
ビットより右にこぼれた全ビットz3,z4 ‥‥ zr の反
転が1 である場合に限る。
Next, the 1's complement of the subtraction f s 'is taken, and 1 is virtually added to the LSB of the subtraction f s ' to obtain the 2's complement (FIG. 4 (b)). Although it is not possible to actually add 1 to the virtual LSB, it is possible to determine whether or not the carry by that virtual propagates up to the actual LSB as a result of adding the virtual 1 . This actual LSB is assumed to be R bits in consideration of the mantissa range (2) to be considered next. When the carry propagates from the 1's digit for 2's complement to the R bit, the digit is adjusted to the L of the reduction f s '.
Only when the inversion of all bits z 3 , z 4 ... z r spilled to the right of the bit is 1.

【0076】(数3) !z3 !z4 ‥‥ !zr = 11 ‥‥1 従って z3 z4 ‥‥ zr = 00 ‥‥0 (図5(a) )より全ての zi (i=3,4, ‥‥,r−1,r)の論
理和はS であるから S =0 よってS が0のときのみ現実のLSB に1を加算すれば正
しい桁合わせされた減数の2の補数が得られる。この条
件は現実のLSB に !S を加算することと等価である。同
時に丸め用の1 をG ビットに加える(図5(a) )。結局
G ビットとR ビットにそれぞれ1 と !S を同時に加えれ
ばよい(図5(b) )。
[0076] (number 3)! Z 3! Z 4 ‥‥! Z r = 11 ‥‥ 1 Therefore z 3 z 4 ‥‥ z r = 00 ‥‥ 0 ( FIG. 5 (a)) than all of the z i ( The logical sum of i = 3,4, ..., r−1, r) is S, so S = 0 Therefore, if 1 is added to the actual LSB only when S is 0, the correct digit 2 The complement of is obtained. This condition is equivalent to adding! S to the actual LSB. At the same time, add 1 for rounding to the G bit (Fig. 5 (a)). After all
You can add 1 and! S to the G and R bits at the same time (Fig. 5 (b)).

【0077】同様の考察により、差の範囲が上記(2) の
場合、(図6(a) )に示す論理により真の減算の丸めが
実現できる。R ビットに !S と丸め用の1を同時に加え
ることは、G ビットとR ビットにそれぞれS と !S を同
時に加えることと等価である(図6(b) )。(表19)
に2つの仮数加算器における丸めと2の補数化用のビッ
トを加えるビット位置と、それらのSビットに基づく論
理値をまとめる。
From the same consideration, when the difference range is (2), true subtraction rounding can be realized by the logic shown in FIG. 6 (a). Adding! S and 1 for rounding to the R bit at the same time is equivalent to adding S and! S to the G bit and R bit at the same time (Fig. 6 (b)). (Table 19)
The bit positions for adding bits for rounding and 2's complementation in the two mantissa adders and the logical values based on those S bits are summarized.

【0078】[0078]

【表19】 [Table 19]

【0079】本実施例では3段のパイプラインで処理す
るので、上述の動作の記述のように浮動小数点数の符号
・指数部・仮数部をパイプライン1段毎に同期させなが
ら処理を進行させる。パイプライン処理の各段において
符号・指数部・仮数部の3つの部分を処理するタイミン
グの組み合わせは上記以外にも幾つか考えられるが、本
発明に関して本実施例とその各段における処理のタイミ
ングをずらした本実施例の変形との本質的な違いはな
い。本実施例ではパイプライン各段の回路遅延がなるべ
く均等になるような構造を意図して設計したが、他の回
路構成法によれば別の段区分があり得る。パイプライン
段数も3である必然性はなく、本実施例のパイプライン
構成は本発明のアルゴリズムの一実現例に過ぎない。
In this embodiment, since processing is carried out in a three-stage pipeline, the processing proceeds while synchronizing the sign / exponent part / mantissa part of the floating-point number for each pipeline stage as described in the above operation. . Several combinations of timings for processing the three parts of the sign, exponent part, and mantissa part in each stage of the pipeline processing are conceivable in addition to the above. However, regarding the present invention, the processing timings in this embodiment and each stage thereof will be described. There is essentially no difference from the modified version of this embodiment. In this embodiment, the structure was designed with the intention that the circuit delays of the respective stages of the pipeline are as uniform as possible, but there may be different stage divisions according to other circuit configuration methods. The number of pipeline stages does not necessarily have to be 3, and the pipeline configuration of this embodiment is merely one implementation example of the algorithm of the present invention.

【0080】ここでは正規化数同士を加減算して正規化
数の和または差を得る状況のみに関し記述したが、被演
算数の一方が非正規化数や0である場合、あるいは演算
結果が非正規化数や0である場合でも上述の算法を変更
することなく、正しく計算できることは明らかである。
但し指数下位あふれ検出機構など若干の回路追加は必要
である。
Here, only the situation where the normalized numbers are added or subtracted to obtain the sum or difference of the normalized numbers has been described. However, when one of the operands is a denormalized number or 0, or the operation result is non- It is clear that even if the number is a normalized number or 0, the calculation can be performed correctly without changing the above-mentioned arithmetic method.
However, it is necessary to add some circuits such as the exponent lower overflow detection mechanism.

【0081】詳細に本実施例を従来例の浮動小数点加減
算装置と比較する。実施例の第2段は従来例の第3段と
同等であり、実施例の第1段は従来例の第2段にほぼ相
当する。実施例の第3段と従来例の第1段は互いに固有
の処理を実現する部分であるので、これら相違箇所にお
ける個々の機能部品の回路規模の比較を試みる。第1に
仮数シフタは実施例・従来例共2つ備えるが実施例の仮
数シフタは左または右一方向にのみシフトするのに対
し、従来例のそれは左右両方向シフトする。第2に実施
例の2つの仮数選択器は従来例の仮数交換器と同等の規
模である。第3に従来例の左シフトエンコーダーは実施
例の先行1検出器の機能を含み更に仮数減算器の機能を
も持つため先行1検出器より規模が大きい。第4に実施
例は従来例にない2つの仮数反転器を持つが、これらは
単に1段の排他的論理和ゲートのみにより構成される。
一方、第5に従来例は実施例にない特別の指数差検出機
構や仮数加算器の規模に匹敵する仮数比較器を持つ。以
上の検討により実施例が従来例より大幅に回路規模を減
らしていることが実証される。また実際に回路を設計す
る際においても、実施例の第3段は従来例の第1段より
高速に動作させられる。全体として本実施例の算法によ
れば従来例のクリティカルパスを大幅に短縮した回路構
成が可能である。
The present embodiment will be compared in detail with the conventional floating point addition / subtraction device. The second stage of the embodiment is equivalent to the third stage of the conventional example, and the first stage of the embodiment is substantially equivalent to the second stage of the conventional example. Since the third stage of the embodiment and the first stage of the conventional example are portions for realizing processing unique to each other, an attempt is made to compare the circuit scales of the individual functional components at these different points. First, although two mantissa shifters are provided in both the embodiment and the conventional example, the mantissa shifter in the embodiment shifts only in one direction, left or right, whereas that in the conventional example shifts in both left and right directions. Secondly, the two mantissa selectors of the embodiment have the same scale as the conventional mantissa exchanger. Thirdly, the left shift encoder of the conventional example has a function larger than that of the preceding one detector because it includes the function of the preceding one detector of the embodiment and also has the function of the mantissa subtractor. Fourthly, the embodiment has two mantissa inverters which are not present in the prior art, but these are composed of only one stage of exclusive OR gates.
On the other hand, fifthly, the conventional example has a special exponent difference detection mechanism and a mantissa comparator comparable to the scale of the mantissa adder, which are not in the embodiment. From the above examination, it is proved that the embodiment significantly reduces the circuit scale as compared with the conventional example. Also, when actually designing the circuit, the third stage of the embodiment can be operated at a higher speed than the first stage of the conventional example. As a whole, according to the arithmetic method of this embodiment, a circuit configuration in which the critical path of the conventional example is greatly shortened can be realized.

【0082】上述の様に浮動小数点加減算の際、従来は
演算後正規化及び仮数部の演算後2の補数化を演算前に
予測するために多くのハードウェアを投入しなければな
らなかった。本実施例の浮動小数点加減算装置によれ
ば、従来の方式に比べ大幅にハードウェア量を減らすこ
とが可能であり、結果として回路のクリティカルパスを
緩和し回路を高速動作させることが可能になる。
As described above, in the case of floating point addition / subtraction, conventionally, a lot of hardware had to be put in order to predict post-computation normalization and post-computation 2's complementation of the mantissa before computation. According to the floating-point addition / subtraction device of this embodiment, the amount of hardware can be significantly reduced as compared with the conventional method, and as a result, the critical path of the circuit can be relaxed and the circuit can be operated at high speed.

【0083】[0083]

【発明の効果】従来第1段において桁落ちと演算結果の
符号を予測するために大量の演算回路を投入せねばなら
なかったが、本発明の浮動小数点加減算装置によればこ
れら第1段における予測機構を不要にすることができ
る。従って、従来と同等の浮動小数点加減算処理を非常
に小さい回路規模で集積することを可能にするという効
果がある。
According to the floating point adder / subtractor of the present invention, a large number of arithmetic circuits had to be put in the first stage to predict the sign cancellation and the sign of the operation result. The prediction mechanism can be eliminated. Therefore, there is an effect that it is possible to integrate the floating point addition / subtraction processing equivalent to the conventional one with a very small circuit scale.

【0084】しかも従来の浮動小数点加減算装置よりク
リティカルパスを短縮するため同じパイプライン段数で
あってもクロック周波数を向上させることにより高速化
された演算が可能になるという効果がある。本発明は従
来の浮動小数点加減算装置をより少ないコストでしかも
より高速に実現するのでその実用的効果は大きい。
Moreover, in order to shorten the critical path as compared with the conventional floating point adder / subtractor, even if the number of pipeline stages is the same, there is an effect that a faster operation is possible by improving the clock frequency. The present invention realizes the conventional floating point adder / subtractor at a lower cost and at a higher speed, and therefore has a great practical effect.

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

【図1】本発明の実施例の構成図である。FIG. 1 is a configuration diagram of an embodiment of the present invention.

【図2】従来例の構成図である。FIG. 2 is a configuration diagram of a conventional example.

【図3】仮数部のビット位置の名称を説明する模式図で
ある。
FIG. 3 is a schematic diagram for explaining names of bit positions of a mantissa part.

【図4】真の減算における最近値丸め算法を説明する模
式図である。
FIG. 4 is a schematic diagram illustrating a nearest-value rounding method in true subtraction.

【図5】同上(図4の続き)。FIG. 5 Same as above (continued from FIG. 4).

【図6】真の減算における最近値丸め算法を説明する模
式図である。
FIG. 6 is a schematic diagram illustrating a nearest-value rounding method in true subtraction.

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

101 ソースAバス 102 ソースBバス 103 ディスティネーションバス 104 符号生成器 105 符号反転器 106 指数減算器 107 指数差絶対値化器 108 指数選択器 109 指数増分器 110 指数補正器 111,112,120 仮数選択器 113 仮数右シフタ 114 Sビット生成器 115,116,117 仮数反転器 118,119 仮数加算器 121 丸め補正器 122 先行1検出器 123 仮数左シフタ 101 Source A Bus 102 Source B Bus 103 Destination Bus 104 Code Generator 105 Sign Inverter 106 Exponent Subtractor 107 Exponential Difference Absolute Quantizer 108 Exponent Selector 109 Exponent Incrementer 110 Exponent Corrector 111, 112, 120 Mantissa Selection Unit 113 Mantissa Right Shifter 114 S Bit Generator 115, 116, 117 Mantissa Inverter 118, 119 Mantissa Adder 121 Rounding Corrector 122 Preceding 1 Detector 123 Mantissa Left Shifter

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】符号,指数,仮数で表される浮動小数点形
式の2数の和又は差を計算する浮動小数点加減算装置で
あって、 指数が小さい方の浮動小数点の仮数を指数差だけ下位側
(以下右と呼ぶ)へシフトすることにより桁合わせする
桁合わせ部と、 桁合わせされた仮数と他方の仮数とを加算又は減算し、
指数差が0であれば減算時に一方の仮数から他方の仮数
を減算し同時に他方から一方を減算する加減算部と、 減算された仮数に対して桁落ちしたビット数を求め、そ
のビット数だけ仮数を上位側にシフトし、指数からその
ビット数を減ずることによって正規化する正規化部とを
備え、 前記桁合わせ部は、 浮動小数点形式の2数の指数を減算することによって、
両指数の大小関係を判別し、指数差の絶対値を求める指
数減算器と、 2つの浮動小数点数のうち指数が小さい方の浮動小数点
数の仮数を選択し、または2数の指数差が0ならばいず
れかの仮数を選択する小仮数選択手段と、 小仮数選択手段の選択と異なる他方の仮数を選択する大
仮数選択手段と、 小仮数選択手段で選択された仮数を指数減算器で得られ
た指数差の絶対値だけ右へ論理シフトする仮数右シフト
手段とからなり、 前記加減算部は、 同符号の2数の減算または異符号の2数の加算(以下真
の減算と略す)の場合に仮数右シフト手段の出力を反転
させ、同符号の2数の加算または異符号の2数の減算
(以下真の加算と略す)の場合に仮数右シフト手段の出
力を素通しさせる第1の仮数反転手段と、 真の減算の場合で且つ指数差が0でない場合に仮数右シ
フト手段の出力を反転させ、それ以外の場合には素通し
させる第2の仮数反転手段と、 真の減算の場合で且つ指数差が0である場合に大仮数選
択手段の出力を反転させ、それ以外の場合には素通しさ
せる第3の仮数反転手段と、 真の加算の場合に第1の仮数反転手段の出力と大仮数選
択手段の出力を加算し、真の減算の場合に第1の仮数反
転手段の出力と大仮数選択手段の出力を2の補数化用の
1と共に加算する第1の仮数加算手段と、 真の加算の場合に第2の仮数反転手段の出力と第3の仮
数反転手段の出力を加算し、真の減算の場合に第2の仮
数反転手段の出力と第3の仮数反転手段の出力を2の補
数化用の1と共に加算する第2の仮数加算手段と、 真の減算の場合で且つ指数差が0である場合には、第
1,第2の仮数加算手段から得られる正負2つの減算結
果から正の値である方を選択する加減算結果選択手段と
からなり、 前記正規化部は、 真の減算の場合に加減算部の出力について桁落ちビット
数を求める先行1検出手段と、 先行1検出手段の検出結果が求めたビット数に基づき、
加減算部の出力を左にシフトする仮数左シフト手段と、
からなることを特徴とする浮動小数点加減算装置。
1. A floating-point addition / subtraction device for calculating the sum or difference of two floating-point numbers represented by signs, exponents, and mantissas, wherein the floating-point mantissa with the smaller exponent is on the lower side by the exponent difference. (Hereinafter referred to as the right), the digit alignment unit that aligns digits by shifting to, and the addition or subtraction of the digit-matched mantissa and the other mantissa,
If the exponent difference is 0, the addition / subtraction unit that subtracts the other mantissa from the other mantissa and simultaneously subtracts one from the other when subtraction is performed, and the number of bits that have been omitted for the subtracted mantissa is calculated. And a normalization unit that normalizes by subtracting the number of bits from the exponent, and the digit alignment unit subtracts two exponents in floating-point format,
Select the exponent subtracter that determines the absolute value of the exponent difference and the mantissa of the floating-point number with the smaller exponent of the two floating-point numbers, or select the exponent difference between the two numbers is 0. Then, a small mantissa selecting means for selecting one of the mantissas, a large mantissa selecting means for selecting the other mantissa different from the selection of the small mantissa selecting means, and a mantissa selected by the small mantissa selecting means are obtained by an exponent subtractor. And a mantissa right shift means for logically right-shifting the absolute value of the calculated exponent difference. The addition / subtraction unit subtracts two numbers with the same sign or adds two numbers with different signs (hereinafter abbreviated as true subtraction). In this case, the output of the mantissa right shift means is inverted, and the output of the mantissa right shift means is passed through in the case of addition of two numbers with the same sign or subtraction of two numbers with different signs (hereinafter abbreviated as true addition). Mantissa inversion means and in case of true subtraction and exponent difference If not, the second mantissa inverting means for inverting the output of the mantissa right shift means and passing through otherwise, and the output of the large mantissa selecting means for true subtraction and when the exponent difference is 0 A third mantissa inverting means for inverting, and otherwise passing through, and for true addition, adding the output of the first mantissa inverting means and the output of the large mantissa selecting means, and for true subtraction First mantissa adding means for adding the output of the first mantissa inverting means and the output of the large mantissa selecting means together with 1 for the 2's complement, and the output of the second mantissa inverting means in the case of true addition. A second mantissa that adds the outputs of the third mantissa inverting means and, in the case of true subtraction, adds the outputs of the second mantissa inverting means and the outputs of the third mantissa inverting means together with 1 for 2's complement conversion. In the case of true subtraction and the exponent difference is 0, the addition means The addition / subtraction result selection means for selecting a positive value from the two positive / negative subtraction results obtained from the mantissa addition means, and the normalization unit outputs a precision loss bit for the output of the addition / subtraction unit in the case of true subtraction. Based on the leading 1 detection means for obtaining the number and the number of bits obtained by the detection result of the leading 1 detection means,
A mantissa left shift means for shifting the output of the adder / subtractor to the left,
A floating-point adder / subtractor characterized by comprising.
【請求項2】符号,指数,仮数で表される浮動小数点形
式の2数の和又は差を計算する浮動小数点加減算装置で
あって、 指数が小さい方の浮動小数点の仮数を指数差だけ下位側
(以下右と呼ぶ)へシフトすることにより桁合わせする
桁合わせ部と、 桁合わせされた仮数と他方の仮数とを加算又は減算し、
指数差が0であれば減算時に一方の仮数から他方の仮数
を減算し同時に他方から一方を減算する加減算部と、 減算された仮数に対して桁落ちしたビット数を求め、そ
のビット数だけ仮数を上位側にシフトし、指数からその
ビット数を減ずることによって正規化する正規化部とを
備え、 前記桁合わせ部は、 浮動小数点形式の2数の指数を減算することによって、
両指数の大小関係を判別し、指数差の絶対値を求める指
数減算器と、 2つの浮動小数点数のうち指数が小さい方の浮動小数点
数の仮数を選択し、または2数の指数差が0ならばいず
れかの仮数を選択する小仮数選択手段と、 小仮数選択手段の選択と異なる他方の仮数を選択する大
仮数選択手段と、 小仮数選択手段で選択された仮数を指数減算器で得られ
た指数差の絶対値だけ右へ論理シフトする仮数右シフト
手段とからなり、 前記加減算部は、 真の減算の場合で且つ指数差が0でない場合に仮数右シ
フト手段の出力を反転させ、それ以外の場合には素通し
させる第1の仮数反転手段と、 真の減算の場合で且つ指数差が0である場合に大仮数選
択手段の出力を反転させ、それ以外の場合には素通しさ
せる第2の仮数反転手段と、 真の減算の場合に仮数右シフト手段の出力を反転させ、
真の加算の場合に仮数右シフト手段の出力を素通しさせ
る第3の仮数反転手段と、 真の加算の場合に第1の仮数反転手段の出力と第2の仮
数反転手段の出力を加算し、真の減算の場合に第1の仮
数反転手段の出力と第2の仮数反転手段の出力を2の補
数化用の1と共に加算する第1の仮数加算手段と、 真の加算の場合に第3の仮数反転手段の出力と大仮数選
択手段の出力を加算し、真の減算の場合に第3の仮数反
転手段の出力と大仮数選択手段の出力を2の補数化用の
1と共に加算する第2の仮数加算手段と、 真の減算の場合で且つ指数差が0である場合には、第
1,第2の仮数加算手段から得られる正負2つの減算結
果から正の値である方を選択する加減算結果選択手段と
からなり、 前記正規化部は、 真の減算の場合に加減算部の出力について桁落ちビット
数を求める先行1検出手段と、 先行1検出手段の検出結果が求めたビット数に基づき、
加減算部の出力を左にシフトする仮数左シフト手段と、
からなることを特徴とする浮動小数点加減算装置。
2. A floating-point addition / subtraction device for calculating the sum or difference of two floating-point numbers represented by a sign, exponent, and mantissa, wherein the floating-point mantissa with the smaller exponent is on the lower side by the exponent difference. (Hereinafter referred to as the right), the digit alignment unit that aligns digits by shifting to, and the addition or subtraction of the digit-matched mantissa and the other mantissa,
If the exponent difference is 0, the addition / subtraction unit that subtracts the other mantissa from the other mantissa and simultaneously subtracts one from the other when subtraction is performed, and the number of bits with which the mantissa is subtracted is calculated. And a normalization unit that normalizes by subtracting the number of bits from the exponent, and the digit alignment unit subtracts two exponents in floating-point format,
Select the exponent subtracter that determines the absolute value of the exponent difference and the mantissa of the floating-point number with the smaller exponent of the two floating-point numbers, or select the exponent difference between the two numbers is 0. Then, a small mantissa selecting means for selecting one of the mantissas, a large mantissa selecting means for selecting the other mantissa different from the selection of the small mantissa selecting means, and a mantissa selected by the small mantissa selecting means are obtained by an exponent subtractor. And a mantissa right shift means that logically shifts to the right by the absolute value of the exponent difference, wherein the addition / subtraction unit inverts the output of the mantissa right shift means when true subtraction and when the exponent difference is not 0, In the other cases, the first mantissa inverting means for passing through, and in the case of true subtraction and when the exponent difference is 0, the output of the large mantissa selecting means is inverted, and in the other cases, for passing through. 2 mantissa inverting means and true subtraction In the case of inverting the output of the mantissa right shift means,
A third mantissa inverting means for passing the output of the mantissa right shift means through in the case of true addition, and an output of the first mantissa inverting means and an output of the second mantissa inversion means for the case of true addition, A first mantissa adding means for adding the output of the first mantissa inverting means and the output of the second mantissa inverting means together with a 1 for 2's complementation in the case of true subtraction, and a third mantissa in the case of true addition Output of the mantissa inverting means and the output of the large mantissa selecting means are added, and in the case of true subtraction, the output of the third mantissa inverting means and the output of the large mantissa selecting means are added together with 1 for 2's complement. In the case of true subtraction and the exponent difference is 0, the mantissa addition means of 2 is selected from the positive and negative subtraction results obtained from the first and second mantissa addition means. The normalization unit outputs the output of the addition / subtraction unit in the case of true subtraction. A leading one detector means for determining the number of canceling bits with the detection result of the leading one detection means based on the number of bits determined,
A mantissa left shift means for shifting the output of the adder / subtractor to the left,
A floating-point adder / subtractor characterized by comprising.
【請求項3】前記第1の仮数加算手段は、加算時に丸め
用の1を予め最下位ビットより1桁下位のビットに加え
ておき、 前記第2の仮数加算手段は、真の加算の場合に加算時に
丸め用の1を第1の仮数加算手段より1桁上位のビット
に予め加えておき、真の減算の場合には加算時に丸め用
の1を第1の仮数加算手段より1桁下位ビットに予め加
えておき、 前記加減算部は、さらに、加減算結果選択手段の出力の
最下位ビットを補正することによって正しく丸められた
加減算結果を得る丸め補正手段を備えたことを特徴とす
る請求項1又は2記載の浮動小数点加減算装置。
3. The first mantissa adding means adds 1 for rounding to the bit one digit lower than the least significant bit in advance at the time of addition, and the second mantissa adding means in the case of true addition. When adding, a rounding 1 is added in advance to a bit one digit higher than the first mantissa adding means, and in the case of true subtraction, a rounding 1 is added by one digit lower than the first mantissa adding means when adding. The addition / subtraction unit is further provided in advance, and the addition / subtraction unit further comprises rounding correction means for obtaining a correctly rounded addition / subtraction result by correcting the least significant bit of the output of the addition / subtraction result selection means. 1. The floating point addition / subtraction device according to 1 or 2.
【請求項4】前記第1及び第2の仮数加算手段は、 仮数部の最上位ビットをMビット、Mビットより1桁上
位のビットをVビット、Mビットより1桁下位のビット
をUビット、最下位ビットをLビット、Lビットより1
桁下位のビットをGビット、Gビットより1桁下位のビ
ットをRビットとするとき、VビットからRビットまで
のビット幅で加算し、 前記桁合わせ部は、さらに、 右シフト手段による桁合わせ時にRビットより下位には
み出た仮数の全ビットの論理和(以下Sビットと呼ぶ)
を求めるSビット生成手段を備え、 前記第1の仮数加算手段は、 真の加算の場合に丸め用の1をGビットに加え、 真の減算の場合で且つ指数差が0でない場合に丸め用の
1をGビットに加えると共に2の補数化用の1としてS
の論理否定値をRビットに加え、 真の減算の場合で且つ指数差が0である場合に丸め用の
1を加えず、2の補数化用の1としてSビットの論理否
定値をRビットに加え、 前記第2の仮数加算手段は、 真の加算の場合に丸め用の1をLビットに加え、 真の減算の場合で且つ指数差が0でない場合に丸め用の
1をRビットに加えると共に2の補数化用の1としてS
ビットの論理否定値をRビットに加え、 真の減算の場合で且つ指数差が0である場合に丸め用の
1を加えず、2の補数化用の1としてSビットの論理否
定値をRビットに加え、 前記加減算結果選択手段は、 第1の仮数加算手段の演算結果(以下甲と略す)、第2
の仮数加算手段の演算結果(以下乙と略す)、1ビット
左シフトされた乙(以下丙と略す)とが入力され、 真の加算の場合に、Mビットからオーバーフローしてい
なければ(Vが0であれば)甲を選択し、Mビットから
オーバーフローしていれば(Vが1であれば)丙を選択
し、 真の減算の場合で且つ指数差が0でない場合に、Mビッ
トが桁落ちしていなければ(Mが1であれば)甲を選択
し、1ビット桁落ちしていれば(Mが0且つUが1であ
れば)乙を選択し、2ビット以上桁落ちしていれば(M
が0且つUが0であれば)甲を選択し、 真の減算の場合で且つ指数差が0である場合に、甲が正
であれば甲を選択し、甲が負であれば乙を選択し、 前記丸め補正手段は、 前記Sビットと甲に基づいて甲が1以上ならば(Mが1
であれば)前記加減算結果選択手段の出力(以下丁と略
す)のLビットに対して補正し、甲が1/2以上1未満
ならば(Mが0且つUが1であれば)丁のGビットに対
して補正し、いずれでもなければ丁を素通しさせること
を特徴とする請求項3記載の浮動小数点加減算装置。
4. The first and second mantissa adding means are: M bits for the most significant bit of the mantissa, V bits for a bit one digit higher than M bits, and U bits for a bit one digit lower than M bits. , Least significant bit is L bit, 1 from L bit
When the lower bit of the digit is G bit and the bit lower by one digit than the G bit is R bit, the bits are added with a bit width from V bit to R bit, and the digit aligning unit further performs digit aligning by the right shift means. Occasionally, the logical sum of all bits of the mantissa protruding below the R bit (hereinafter referred to as S bit)
The first mantissa adding means adds 1 for rounding to G bits in the case of true addition, and rounds in the case of true subtraction and if the exponent difference is not 0 1 of G is added to G bits, and S is used as 1 for complementing 2
The logical negation value of R bit is added to the R bit, and in the case of true subtraction and when the exponent difference is 0, 1 for rounding is not added and the logical negation value of S bit is set as R bit as 1 for complementing 2 In addition, the second mantissa adding means adds 1 for rounding to L bits in case of true addition, and 1 for rounding in case of true subtraction and exponent difference is not 0 to R bits. Add and add S as 1 for 2's complement
The logical negation value of the bit is added to the R bit, the 1 for rounding is not added in the case of true subtraction and the exponent difference is 0, and the logical negation value of the S bit is set as 1 for complementing 2 In addition to the bits, the addition / subtraction result selection means is configured to calculate the calculation result of the first mantissa addition means (hereinafter abbreviated as “step A”),
The calculation result of the mantissa adding means (hereinafter, abbreviated as “B”) and 1-bit left-shifted “B” (hereinafter abbreviated as “B”) are input, and in the case of true addition, if M bits do not overflow (V is If it is 0, select A, if it overflows from M bits, select V (if V is 1), and if true subtraction and the exponent difference is not 0, the M bits are digits. If it is not dropped (if M is 1), select Instep. If it is dropped by 1-bit digit (If M is 0 and U is 1), select B. If (M
If A is 0 and U is 0), choose A, and if true subtraction and the exponent difference is 0, choose A if A is positive, and choose A if A is negative. The rounding correction means selects if the instep is 1 or more based on the S bit and the instep (M is 1).
If the L-bit of the output of the addition / subtraction result selection means (hereinafter abbreviated as "D") is corrected to 1/2 or more and less than 1 (M is 0 and U is 1) 4. The floating point adder / subtractor according to claim 3, wherein the G bit is corrected, and if it is neither of them, the Ding is passed through.
【請求項5】前記丸め補正手段は、 Lビットに対して補正する場合、Lビットが1であり且
つGビットとRビットとSビットの値の論理和が0であ
れば、Lビットを0にし、 Gビットに対して補正する場合、Gビットが1であり且
つRビットとSビットの値の論理和が0であれば、Gビ
ットを0にすることを特徴とする請求項4記載の浮動小
数点加減算装置。
5. The rounding correction means sets the L bit to 0 when the L bit is 1 and the logical sum of the values of the G bit, the R bit and the S bit is 0 when correcting the L bit. The G bit is set to 0 when the G bit is 1 and the logical sum of the values of the R bit and the S bit is 0 when correcting the G bit. Floating point adder / subtractor.
JP4187039A 1992-07-14 1992-07-14 Floating point adder-subtracter Pending JPH0635671A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4187039A JPH0635671A (en) 1992-07-14 1992-07-14 Floating point adder-subtracter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4187039A JPH0635671A (en) 1992-07-14 1992-07-14 Floating point adder-subtracter

Publications (1)

Publication Number Publication Date
JPH0635671A true JPH0635671A (en) 1994-02-10

Family

ID=16199108

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4187039A Pending JPH0635671A (en) 1992-07-14 1992-07-14 Floating point adder-subtracter

Country Status (1)

Country Link
JP (1) JPH0635671A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5831884A (en) * 1994-12-02 1998-11-03 Mitsubishi Denki Kabushiki Kaisha Apparatus for performing arithmetic operation of floating point numbers capable of improving speed of operation by performing canceling prediction operation in parallel
KR100824189B1 (en) * 2006-03-23 2008-04-21 후지쯔 가부시끼가이샤 Method and computer system for processing total operation of floating point data
JP2011090623A (en) * 2009-10-26 2011-05-06 Nec Computertechno Ltd Floating-point retrieval calculation apparatus, method and program
JP2012174269A (en) * 2011-02-17 2012-09-10 Arm Ltd Apparatus and method for executing floating point addition

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5831884A (en) * 1994-12-02 1998-11-03 Mitsubishi Denki Kabushiki Kaisha Apparatus for performing arithmetic operation of floating point numbers capable of improving speed of operation by performing canceling prediction operation in parallel
KR100824189B1 (en) * 2006-03-23 2008-04-21 후지쯔 가부시끼가이샤 Method and computer system for processing total operation of floating point data
JP2011090623A (en) * 2009-10-26 2011-05-06 Nec Computertechno Ltd Floating-point retrieval calculation apparatus, method and program
JP2012174269A (en) * 2011-02-17 2012-09-10 Arm Ltd Apparatus and method for executing floating point addition

Similar Documents

Publication Publication Date Title
US5027308A (en) Circuit for adding/subtracting two floating point operands
EP0483864B1 (en) Hardware arrangement for floating-point addition and subtraction
US5010508A (en) Prenormalization for a floating-point adder
JP4388543B2 (en) 3-input floating-point adder / subtracter
US6895423B2 (en) Apparatus and method of performing product-sum operation
KR100203468B1 (en) Arithmetic apparatus for floating point numbers
US5623435A (en) Arithmetic unit capable of performing concurrent operations for high speed operation
WO1999040508A1 (en) Fast adder/subtractor for signed floating point numbers
JPH09212337A (en) Floating-point arithmetic processor
JP7285966B2 (en) Multi-input floating point adder
US20070038693A1 (en) Method and Processor for Performing a Floating-Point Instruction Within a Processor
JPH0635671A (en) Floating point adder-subtracter
US20030115236A1 (en) Elimination of rounding step in the short path of a floating point adder
US6571264B1 (en) Floating-point arithmetic device
US7552165B2 (en) Method and system to implement an improved floating point adder with integrated adding and rounding
US20030050948A1 (en) Floating-point remainder computing unit, information processing apparatus and storage medium
JPH05173759A (en) Device and method for rounding numerical valve, device and method for converting floating point number/integer
JPH07121353A (en) Floating point adder-substracter
JPS63158626A (en) Arithmetic processing unit
US20230289140A1 (en) Floating-point adder with in-path subnormal handling
JPH0644048A (en) Floating point arithmetic unit and method
JPH0778724B2 (en) Divider
JP2003029960A (en) Elimination of rounding steps in short path of floating point adders
JP3100868B2 (en) Arithmetic unit for floating point numbers
JP3124286B2 (en) Floating point arithmetic unit