JPH05241784A - Device for floating point arithmetic and method therefor - Google Patents

Device for floating point arithmetic and method therefor

Info

Publication number
JPH05241784A
JPH05241784A JP4042663A JP4266392A JPH05241784A JP H05241784 A JPH05241784 A JP H05241784A JP 4042663 A JP4042663 A JP 4042663A JP 4266392 A JP4266392 A JP 4266392A JP H05241784 A JPH05241784 A JP H05241784A
Authority
JP
Japan
Prior art keywords
exponent
mantissa
specified
input
shifted
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.)
Withdrawn
Application number
JP4042663A
Other languages
Japanese (ja)
Inventor
Minoru Usui
稔 臼井
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP4042663A priority Critical patent/JPH05241784A/en
Publication of JPH05241784A publication Critical patent/JPH05241784A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To correct the exponent part and mantissa part of an output value so that a meaningless integer part is not generated. CONSTITUTION:When the exponent part of a multiplication result exceeds a specified exponent N, a floating point arithmetic device 1 fixes the exponent part at the specified exponent N and corrects the mantissa part. When the exponent parts of input parts have a relation A>B and the exponent part of one input value A exceeds the specified exponent N, a floating point addition device fixes the exponent part of the input part A at the specified exponent N, shifts the mantissa part to the left as to the difference and discards shifted- out bits, and also fixes the exponent part of the other input part B at the specified exponent N and shifts the mantissa to the right; when the exponent parts of both the input values exceed the specified exponent N, the exponent parts of both the input values are fixed at the specified exponent N and the mantissa parts of both the input values are shifted to the left and shifted-out bits are discarded. When the exponent part of the addition result after the operation exceeds the specified exponent N, the exponent part is fixed at the specified exponent N and the mantissa part is corrected.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、浮動小数点演算装置に
係り、特に、該浮動小数点演算の入力値,及び出力値の
指数部が、指定された指数Nと異なるときの処理と、そ
れにともなう仮数部の処理を行う浮動小数点演算装置に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a floating point arithmetic unit, and more particularly, to a process when an exponent part of an input value and an output value of the floating point arithmetic is different from a designated exponent N, and a process therefor. The present invention relates to a floating point arithmetic unit for processing a mantissa part.

【0002】浮動小数点演算装置で、角度関数の引数
(角度2πラジアンの何倍であるかを示す数)を算出す
る場合、該引数は小数の値であり、整数部は意味をもた
ないことになる。
When calculating an argument of an angle function (a number indicating how many times the angle is 2π radians) in a floating point arithmetic unit, the argument is a decimal value and the integer part has no meaning. become.

【0003】従って、該浮動小数点演算装置で、必要と
しない指数の値が、演算結果として発生することのない
浮動小数点演算装置が必要とされる。
Therefore, there is a need for a floating point arithmetic unit that does not generate an unnecessary exponent value as a result of the arithmetic operation.

【0004】[0004]

【従来の技術】図4,図5は、従来の浮動小数点演算装
置を説明する図である。例えば、従来の浮動小数点乗算
においては、図4に示した浮動小数点乗算装置 1で、先
ず、入力値に関わらず、乗算結果の指数部は、指数部加
算部 10 において、入力値のそれぞれの指数部の和によ
り求められ、更に、仮数部乗算部 11 において、仮数部
どうしが乗算され、該乗算の結果のオーバ・フロー、ア
ンダフローだけを、指数補正・仮数補正部 12 で検出し
て、指数, 及び仮数部の補正を行っていた。
2. Description of the Related Art FIGS. 4 and 5 are views for explaining a conventional floating point arithmetic unit. For example, in the conventional floating-point multiplication, in the floating-point multiplication device 1 shown in FIG. 4, the exponent part of the multiplication result is first calculated by the exponent adder 10 regardless of the input value. The mantissa multiplication unit 11 multiplies the mantissa parts together, and only the overflow or underflow resulting from the multiplication is detected by the exponent correction / mantissa correction unit 12 to obtain the exponent. , And the mantissa part were corrected.

【0005】浮動小数点加算においては、図5に示した
浮動小数点加算装置 2で、指数部比較・選択部 20 にお
いて、入力値に係わらず、入力のそれぞれの指数部を比
較し、大きい方の指数に小さい方の指数をあわせ、小さ
い方の指数をもつ入力の仮数部を、仮数部桁合わせ部 2
1 において、大きい方の指数との差分だけ右シフトし、
さらには補正された仮数部どうしの加算を、仮数部加算
部 22 で行って、該加算結果のオーバ・フロー、アンダ
フローだけを、指数補正・仮数補正部 23 で検出して、
指数部, 及び仮数部の補正を行っていた。
In floating-point addition, in the floating-point adder 2 shown in FIG. 5, the exponent comparison / selection unit 20 compares the exponents of the inputs regardless of the input value, and the larger exponent. The smaller exponent, and the mantissa part of the input with the smaller exponent
At 1, shift right by the difference from the larger exponent,
Further, the corrected mantissas are added together by the mantissa adder 22, and only the overflow or underflow of the addition result is detected by the exponent correction / mantissa corrector 23.
The exponent part and the mantissa part were corrected.

【0006】そして、浮動小数点演算の最中に固定小数
点の演算が必要になったときは、浮動小数点の演算装置
の他に、浮動小数点から固定小数点への変換装置, 並び
に、固定小数点の演算装置がさらに必要となっていた。
When fixed-point arithmetic is required during floating-point arithmetic, a floating-point arithmetic unit, a floating-point-to-fixed-point converter, and a fixed-point arithmetic unit. Was even needed.

【0007】[0007]

【発明が解決しようとする課題】従来の浮動小数点演算
装置では、該演算の算出結果は、必ずしも、必要とする
桁幅を示しているとは限らない。
In the conventional floating-point arithmetic unit, the calculation result of the arithmetic does not always indicate the required digit width.

【0008】例えば、前述のように、角度関数の引数
(角度2πラジアンの何倍であるかを示す数)を算出す
る場合、その整数部は意味をもたないことになる。従っ
て、浮動小数点の演算結果を固定小数点に変換したとき
に、整数部が存在することは、意味のない浮動小数点演
算を行っていることになる。
For example, as described above, when the argument of the angle function (the number indicating the multiple of the angle 2π radian) is calculated, the integer part thereof has no meaning. Therefore, the existence of the integer part when the floating-point operation result is converted into the fixed-point means that the floating-point operation is meaningless.

【0009】本発明は上記従来の欠点に鑑み、必要とす
る浮動小数点演算の結果の指数Nを予め指定することに
より、演算の結果の指数が指定された指数N以下なら
ば、従来の浮動小数点演算を行い、演算結果の指数が指
定された指数Nを越えるときには、指数を指定された指
数Nに固定し、仮数部は左にシフトし、そのとき、シフ
ト・アウトしたものは切捨て、必要とされる部分のみを
演算結果として出力する浮動小数点演算装置を提供する
ことを目的とするものである。
In view of the above-mentioned conventional drawbacks, the present invention preliminarily specifies an exponent N as a result of a required floating-point operation, so that if the exponent as a result of the operation is less than or equal to the specified exponent N, the conventional floating-point When an operation is performed and the exponent of the operation result exceeds the specified exponent N, the exponent is fixed to the specified exponent N, the mantissa part is shifted to the left, and at that time, the one that is shifted out is truncated and necessary. It is an object of the present invention to provide a floating-point arithmetic unit that outputs only the portion to be operated as an arithmetic result.

【0010】[0010]

【課題を解決するための手段】図1,図2は、本発明の
浮動小数点演算装置の構成例を示した図である。上記の
問題点は、下記の如くに構成した浮動小数点演算装置に
よって解決される。
FIGS. 1 and 2 are diagrams showing a configuration example of a floating point arithmetic unit of the present invention. The above problems are solved by a floating point arithmetic unit configured as follows.

【0011】(1) 浮動小数点乗算装置 1において、指数
Nを指定する指数指定部 3と, 乗算結果の指数部が、上
記指数指定部 3が指定する指数Nを越えたとき、該乗算
結果の指数を上記指数Nに固定し、その差分について、
仮数部を左シフトし、シフトアウトされたビットは切り
捨てを行う指数部判別・仮数部処理部 13 とを設けるよ
うに構成する。
(1) In the floating point multiplication device 1, when the exponent designating section 3 designating the exponent N and the exponent section of the multiplication result exceed the exponent N designated by the exponent designating section 3, the multiplication result of the multiplication result is calculated. The index is fixed to the above index N, and the difference is
A mantissa part is shifted to the left and an exponent part discriminating / mantissa part processing part 13 for truncating the shifted out bits is provided.

【0012】(2) 浮動小数点加算装置 2において、指数
Nを指定する指数指定部 3と, 該指数指定部 3から入力
された指数Nと、該浮動小数点加算装置に入力された浮
動小数点データの指数とを比較して、入力値の指数部ど
うしの関係がA>Bであって、一方の入力値Aの指数部
が指定された指数Nを越えている場合、該入力値Aの指
数部を指定された指数Nに固定し、差分について、仮数
部を左シフトして、シフトアウトされたビットは切り捨
て、他方の入力値Bも、指定された指数Nに固定し仮数
部を右シフトし、両方の入力値が指定された値を越えて
いる場合は、両入力値の指数部を指定された指数Nに固
定し、両入力値の仮数部を左シフトして、シフトアウト
されたビットを切り捨てる処理を行う指数部比較・選択
部 20aと仮数部桁合わせ部 21aと, 加算結果の指数部
が、上記指数指定部 3が指定する指数Nを越えたとき、
該乗算結果の指数を上記指定された指数Nに固定し、そ
の差分について、仮数部を左シフトし、シフトアウトさ
れたビットは切り捨てを行う指数部判別・仮数部処理部
24 とを設けるように構成する。
(2) In the floating-point adder 2, the exponent designating section 3 for designating the exponent N, the exponent N input from the exponent designating section 3, and the floating-point data input to the floating-point adder When the exponents of the input values are compared with each other by A> B and the exponent of one input value A exceeds the designated exponent N, the exponent of the input value A is compared. Is fixed to the specified exponent N, the mantissa part of the difference is left-shifted, the shifted out bits are discarded, the other input value B is also fixed to the specified exponent N, and the mantissa part is right-shifted. , If both input values exceed the specified value, fix the exponent part of both input values to the specified exponent N, shift the mantissa part of both input values to the left, and shift out the bits. Truncate the exponent part comparison / selection part 20a and mantissa digit alignment When the part 21a and the exponent part of the addition result exceed the exponent N specified by the exponent specifying part 3,
The exponent as a result of the multiplication is fixed to the designated exponent N, the mantissa part of the difference is left-shifted, and the shifted-out bits are cut off.
24 and so on.

【0013】[0013]

【作用】即ち、本発明では、図1, 図2に示したよう
に、浮動小数点乗算装置においては、指数指定部 3から
の指数の指定指数Nにより、その演算結果の指数を指定
指数N以下にすることにより、必要としない指数の値が
演算結果として発生することのないようにしている。
That is, in the present invention, as shown in FIGS. 1 and 2, in the floating-point multiplication device, the exponent designated by the exponent designating unit 3 causes the exponent designated by the exponent designating unit 3 to make the exponent of the operation result less than the designated exponent N. By doing so, it is possible to prevent an unnecessary exponent value from being generated as a calculation result.

【0014】従って、演算結果の指数が、該指数指定部
3からの指定された指数Nを越えていなければそのまま
出力し、演算結果の指数が指定された指数Nを越えてい
る場合には、演算結果の指数を指定された指数Nに固定
して、演算結果の仮数部を演算結果の指数と、上記指数
指定部 3からの指数の指定Nとの差だけ左にシフトし
て、シフト・アウトされた仮数部については切捨てを行
う。この為、出力される値は必要とする指数の幅をもつ
値となる。
Therefore, the exponent of the operation result is the exponent designating part.
If it does not exceed the specified exponent N from 3, output it as it is. If the calculated exponent exceeds the specified exponent N, fix the calculated exponent to the specified exponent N, The mantissa part of the operation result is shifted to the left by the difference between the exponent of the operation result and the exponent designation N from the exponent designating part 3, and the shifted out mantissa part is truncated. Therefore, the output value has a required exponent width.

【0015】又、浮動小数点加算装置においては、上記
指数部比較・選択部 20 において、浮動小数点加算の仮
数部入力A,被仮数部入力Bの指数部どうしの関係がA
>Bであり、一方の入力値Aの指数部のみが、上記指定
された指数Nを超えている場合、その入力値Aの指数部
を、上記指数指定部 3で指定された指数Nに固定し、仮
数部を左シフトして、シフトアウトされたビットは切捨
て、もう一方の入力値Bについても、その指数を、上記
指定された指数Nに固定し、その仮数部を右シフトし
て、アンダ・フローされたビットは切捨を行い、両方の
入力値の指数部が指定された指数Nを超えている場合、
その両入力値の指数部を指定された指数Nに固定し、両
入力の仮数部を左シフトして、シフト・アウトされたビ
ットは切捨てを行い、上記の操作を施した入力値の仮数
部どうしの加算結果が、上記指数指定部 3で指定された
指数Nを越えることがなければ、通常の浮動小数点乗算
を行い、該加算結果が指定された指数Nを越える場合に
は、上記指数部判別・仮数部処理部 24 において、指数
部を指定された指数Nに固定し、その差分について、仮
数部を左シフトし、シフトアウトされたビットを切り捨
てた結果を出力するように動作する。
In the floating point adder, in the exponent comparison / selection unit 20, the relationship between the exponents of the mantissa input A and the mantissa input B of the floating point addition is A.
> B, and if only the exponent part of one input value A exceeds the specified exponent N, fix the exponent part of the input value A to the exponent N specified by the exponent specifying part 3 above. Then, the mantissa part is left-shifted, the bits shifted out are discarded, the exponent of the other input value B is fixed to the specified exponent N, and the mantissa part thereof is right-shifted, The underflowed bits are rounded down, and if the exponent part of both input values exceeds the specified exponent N,
The exponent part of both input values is fixed to the specified exponent N, the mantissa part of both inputs is left-shifted, the bits shifted out are truncated, and the mantissa part of the input value subjected to the above operation If the result of addition between them does not exceed the exponent N designated by the exponent designating unit 3, normal floating point multiplication is performed. If the result of addition exceeds the designated exponent N, the exponent unit In the discrimination / mantissa part processing unit 24, the exponent part is fixed to the designated exponent N, the mantissa part is shifted to the left with respect to the difference, and the result of truncating the shifted out bits is output.

【0016】この結果、演算結果には、必要としない指
数の値が発生することがなくなるという効果が得られ
る。即ち、該演算結果が指数指定部で指定した指数Nを
越えない範囲では、通常の浮動小数点演算装置として作
用し、該演算結果が指数指定部で指定した指数Nを越え
る場合には、指数Nの固定小数点の演算装置として作用
する。
As a result, it is possible to obtain an effect that an unnecessary exponent value does not occur in the calculation result. That is, within the range in which the operation result does not exceed the exponent N specified by the exponent designating section, it operates as a normal floating point arithmetic unit, and when the operation result exceeds the exponent N specified by the exponent designating section, the exponent N Acts as a fixed-point arithmetic unit of.

【0017】[0017]

【実施例】以下本発明の実施例を図面によって詳述す
る。前述の図1〜図2は本発明の浮動小数点演算装置の
構成例を示した図であり、図3は、本発明の他の構成例
を示した図である。
Embodiments of the present invention will now be described in detail with reference to the drawings. 1 and 2 described above are diagrams showing a configuration example of the floating point arithmetic unit of the present invention, and FIG. 3 is a diagram showing another configuration example of the present invention.

【0018】本発明においては、浮動小数点乗算装置に
おいて、乗算結果の指数部が指数指定部 3で指定された
指数Nを越える場合、該指数部を該指定された指数Nに
固定して、仮数部を補正する指数部判別・仮数部処理部
13 、又、浮動小数点加算装置において、入力値の指数
部どうしの関係がA>Bであって、一方の入力値Aの指
数部が指定された指数Nを越えている場合、該入力値A
の指数部を指定された指数Nに固定し、差分について、
仮数部を左シフトして、シフトアウトされたビットは切
り捨て、他方の入力値Bも、指定された指数Nに固定し
仮数部を右シフトし、両方の入力値が指定された指数N
を越えている場合は、両入力値の指数部を指定された指
数Nに固定し、両入力値の仮数部を左シフトして、シフ
トアウトされたビットを切り捨てる指数部比較・選択部
20aと仮数部桁合わせ部 21aと,該操作後の加算結果の
指数部が、上記指数指定部 3から指定された指数Nを越
える場合、該指数部を該指定された指数Nに固定して、
仮数部を補正する指数部判別・仮数部処理部 24 が、本
発明を実施するのに必要な手段である。尚、全図を通し
て同じ符号は同じ対象物を示している。
According to the present invention, when the exponent part of the multiplication result exceeds the exponent N designated by the exponent designating part 3 in the floating point multiplication device, the exponent part is fixed to the designated exponent N and the mantissa is Exponential part discrimination / mantissa part processing part for correcting parts
13. In the floating-point adder, if the relation between the exponent parts of input values is A> B and the exponent part of one input value A exceeds the specified exponent N, the input value A
The exponent part of is fixed to the specified exponent N, and the difference is
The mantissa is left-shifted, the bits shifted out are discarded, the other input value B is also fixed to the specified exponent N, and the mantissa is right-shifted, so that both input values are the specified exponent N.
If it exceeds, the exponent part of both input values is fixed to the specified exponent N, the mantissa part of both input values is left-shifted, and the shifted-out bits are discarded.
If the exponent part of the addition result after the operation 20a and the mantissa digit aligning part 21a exceeds the exponent N designated by the exponent designating part 3, the exponent part is fixed to the designated exponent N. ,
The exponent part discriminating / mantissa part processing unit 24 for correcting the mantissa part is a means necessary for carrying out the present invention. The same reference numerals denote the same objects throughout the drawings.

【0019】以下、図1〜図3を用いて、本発明の浮動
小数点演算装置の構成と動作を説明する。図1は、本発
明による浮動小数点乗算装置の構成例である。図1中、
A(exp),A(fr)は、それぞれ、該浮動小数点乗算装置 1
に対する入力Aの指数部及び仮数部を示し、B(exp) B
(fr)は入力Bの指数部及び仮数部を、C(exp),C(fr)は
該浮動小数点乗算装置 1の出力Cの指数部及び仮数部を
示している。
The structure and operation of the floating point arithmetic unit according to the present invention will be described below with reference to FIGS. FIG. 1 is a configuration example of a floating point multiplication device according to the present invention. In Figure 1,
A (exp) and A (fr) are the floating point multipliers 1
Shows the exponent part and the mantissa part of the input A with respect to B (exp) B
(fr) indicates the exponent part and the mantissa part of the input B, and C (exp) and C (fr) indicate the exponent part and the mantissa part of the output C of the floating point multiplication device 1.

【0020】本浮動小数点乗算装置 1に入力された値
は、該指数部加算部 10 により指数部どうしが加算さ
れ、仮数乗算部 11 により仮数部どうしが乗算される。
仮数部どうしの乗算された結果は指数補正・仮数補正部
12 に入力され、仮数部の乗算結果のオーバ・フロー、
アンダ・フローを判別し、その値をビット・シフトする
とともにそれに応じた指数部の補正を行う。即ち、オー
バ・フローの場合には、乗算結果の仮数部の右シフトを
行い、アンダ・フローの場合には、乗算結果の仮数部の
左シフトを行い、そのシフト量に従って、指数部の補正
を行う。
The values input to the floating-point multiplication apparatus 1 are added together by the exponent part adder 10 and the mantissa part 11 is multiplied by the mantissa parts.
The result of multiplication of mantissas is the exponent correction / mantissa correction unit.
Input to 12 and overflow of mantissa multiplication result,
The underflow is discriminated, the value is bit-shifted, and the exponent part is corrected accordingly. That is, in the case of overflow, the mantissa part of the multiplication result is right-shifted, and in the case of underflow, the mantissa part of the multiplication result is left-shifted, and the exponent part is corrected according to the shift amount. To do.

【0021】補正された乗算結果は、本発明の指数部判
別・仮数部処理部 13 に入力され、その指数の値が指数
指定部 3で指定された指数N以下であるときは、指数部
・仮数部ともにC(exp),C(fr)にそれぞれそのまま出力
する。
The corrected multiplication result is input to the exponent part discrimination / mantissa part processing unit 13 of the present invention, and when the exponent value is less than or equal to the exponent N designated by the exponent designation unit 3, the exponent unit The mantissa part is output as it is to C (exp) and C (fr).

【0022】然しながら、その指数の値が指定される指
数Nより大きい場合、入力された指数は、指数指定部 3
から入力された指数の指定指数Nに固定され、入力され
た値の指数とNとの差により仮数部を左ビット・シフト
する。このシフト動作で、シフト・アウトされたビット
は切捨てを行う。以上により得られた指数部、仮数部を
C(exp),C(fr)にそれぞれ出力をする。
However, when the value of the exponent is larger than the designated exponent N, the inputted exponent is set to the exponent designating part 3
The exponent input from is fixed to the designated exponent N, and the mantissa is bit-shifted to the left by the difference between the exponent of the input value and N. This shift operation truncates the bits shifted out. The exponent part and the mantissa part obtained as described above are output to C (exp) and C (fr), respectively.

【0023】今、1例として、入力A:21 ×0.101,
入力B:21 ×0.110 とすると、,上記指数加算部 12
では、入力Aと入力Bの指数が加算、即ち、「1+1=2 」
され、仮数乗算部 17 では、仮数どうしが乗算、即ち
「0.101 ×0.110=0.01111 」される。
Now, as an example, input A: 2 1 × 0.101,
Input B: 2 1 × 0.110, the above exponent addition unit 12
Then, the exponents of input A and input B are added, that is, "1 + 1 = 2"
Then, in the mantissa multiplication unit 17, the mantissas are multiplied, that is, “0.101 × 0.110 = 0.01111”.

【0024】次の指数補正・仮数補正部 12 において
は、上記仮数の乗算結果に、アンダ・フローが存在する
ことを検知して、「0.01111 →0.1111」のように左シフ
トが行われ、指数部は「22 →21 」に補正される。
In the next exponent correction / mantissa correction unit 12, it is detected that there is an underflow in the multiplication result of the mantissa, and left shift is performed as "0.01111 → 0.1111", and the exponent part is obtained. Is corrected to “2 2 → 2 1 ”.

【0025】該補正された乗算結果は、本発明の指数判
別・仮数部処理部 13 に入力される。ここで、角度関数
の引数 (角度2πラジアンの何倍であるかを示す数)の
算出を例にすると、その引数は「1.XXXXX 」であるの
で、上記指数指定部 3で指定される指数は「0」であ
る。
The corrected multiplication result is input to the exponent discrimination / mantissa part processing unit 13 of the present invention. Here, taking the example of the calculation of the argument of the angle function (the number indicating how many times the angle is 2π radians), the argument is "1.XXXXX", so the exponent specified by the exponent specification unit 3 above. Is "0".

【0026】従って、上記の例での乗算結果の指数
「1」は、指定された指数「0」より大きいので、
「0」に固定される。即ち、乗算結果の指数部は
「20 」となり、仮数部は1桁左シフトされ、「0.1111
→1.1110」となる。このとき、オーバ・フロー分は切り
捨てられる。
Therefore, since the exponent "1" of the multiplication result in the above example is larger than the designated exponent "0",
It is fixed at "0". That is, the exponent part of the multiplication result becomes “2 0 ”, the mantissa part is shifted left by one digit, and
→ 1.1110 ” At this time, the overflow is truncated.

【0027】若し、角度関数をπラジアンとすると、そ
の引数は「2.XXXXX 」となり、上記指数指定部 3で指定
される指数は「1」である。従って、この場合には、仮
数部の左シフトは行われない。
If the angle function is π radians, its argument is "2.XXXXX", and the exponent designated by the exponent designating section 3 is "1". Therefore, in this case, the mantissa part is not left-shifted.

【0028】次に、図2により、本発明の浮動小数点加
算装置について説明する。図2中、A(exp),A(fr)は、
それぞれ、浮動小数点加算装置 2への入力Aの指数部及
び仮数部を示し、B(exp) B(fr)は、該入力Bの指数部
及び仮数部を、C(exp),C(fr)は浮動小数点加算装置 2
の出力Cの指数部及び仮数部を示している。
Next, the floating point adder of the present invention will be described with reference to FIG. In Fig. 2, A (exp) and A (fr) are
The exponent part and the mantissa part of the input A to the floating point adder 2 are shown, respectively, and B (exp) and B (fr) are the exponent part and the mantissa part of the input B, respectively, C (exp) and C (fr). Is a floating point adder 2
The exponent part and the mantissa part of the output C of are shown.

【0029】該浮動小数点加算装置 2に入力された値
は、本発明の指数部比較・選択部 20aにより指数部が比
較される。入力された両方の指数の値が、指数指定部 3
から指定された指数N以下の場合には、通常の浮動小数
点加算と同じように、大きい方の指数が選択出力され、
この時小さい方の指数を持つ仮数は、仮数桁合わせ部 2
1 において、上記大きい方の指数と小さい方の指数の差
分だけ右シフトされる。
The exponent part of the value input to the floating point addition device 2 is compared by the exponent part comparison / selection part 20a of the present invention. The values of both entered exponents will be
If the exponent N specified by is less than or equal to N, the larger exponent is selected and output, as in normal floating point addition.
At this time, the mantissa with the smaller exponent is the mantissa digit alignment part 2
At 1, it is right-shifted by the difference between the larger exponent and the smaller exponent.

【0030】又、入力値の指数部どうしの関係がA>B
であって、入力されたどちらか一方、上記の例では、入
力Aの指数の値が、上記指数指定部 3からの指数の指定
指数Nを越える場合、本発明の指数部比較・選択部 20a
では、該指定された指数Nが出力され、仮数桁合わせ部
21aにおいては、入力される仮数部は、それに対応する
指数と指定された指数Nとの差分だけ、それぞれ左シフ
トされ、シフト・アウトされたビットは切り捨てられ
る。
Further, the relationship between the exponent parts of the input value is A> B
In the above example, when the value of the index of the input A exceeds the designated index N of the index from the index designating unit 3, the exponent comparing / selecting unit 20a of the present invention is used.
Then, the specified exponent N is output, and the mantissa digit matching unit is output.
In 21a, the input mantissa part is left-shifted by the difference between the corresponding exponent and the designated exponent N, and the shifted out bits are truncated.

【0031】そして、もう一方の上記指定された指数N
より小さい指数を持つ入力Bについても、その指数を、
上記指数指定部 3からの指定された指数Nに固定し、仮
数部を右シフトして、シフト・アウトされたビットは、
例えば、切り捨てを行う。
Then, the other specified index N
For input B with a smaller exponent,
Bits shifted out by fixing the exponent N designated by the exponent designating part 3 to the right and shifting the mantissa part are
For example, truncation is performed.

【0032】両方の入力値A,Bの指数部が、上記指数
指定部 3から指定された指数Nを越えている場合には、
その両方の入力値A,Bの指数部を指定された指数Nに
固定し、両入力値の仮数部を左シフトし、シフト・アウ
トされたビットは切り捨てを行う。
If the exponent parts of both input values A and B exceed the exponent N specified by the exponent specifying part 3,
The exponent parts of both input values A and B are fixed to the specified exponent N, the mantissa part of both input values is left-shifted, and the bits shifted out are truncated.

【0033】以上のようにして、シフトされた仮数は仮
数加算部 22 に送られ、仮数どうしの加算が行われる。
仮数部どうしの加算された結果は、指数補正・仮数補正
部 23 に入力され仮数加算結果のオーバ・フロー、アン
ダ・フローを判別し、その値をビット・シフトするとと
もにそれに応じた指数部の補正を行う。
As described above, the shifted mantissa is sent to the mantissa adder 22 and the mantissas are added.
The result of addition of the mantissas is input to the exponent correction / mantissa correction unit 23, which determines the overflow or underflow of the mantissa addition result, bit shifts the value, and corrects the exponent accordingly. I do.

【0034】補正された加算結果は、本発明の指数部判
別・仮数部処理部 24 に入力され、その指数の値が、上
記指数指定部 3で指定される指数N以下であるときは、
指数部・仮数部ともにC(exp),C(fr)にそれぞれそのま
ま出力する。該指数の値が該指定された指数Nより大き
い場合、入力された指数は指定された指数Nに固定さ
れ、入力された値の指数と、上記指定された指数Nとの
差により仮数部を左シフトし、シフト・アウトされたビ
ットは切捨てを行う。以上により得られた指数部、仮数
部をC(exp),C(fr)にそれぞれ出力をする。この場合の
具体例については、上記乗算の場合に準じるので省略す
る。
The corrected addition result is input to the exponent part discrimination / mantissa part processing unit 24 of the present invention, and when the value of the exponent is less than or equal to the exponent N designated by the exponent designating unit 3,
Both the exponent part and the mantissa part are directly output to C (exp) and C (fr), respectively. When the value of the exponent is larger than the designated exponent N, the input exponent is fixed to the designated exponent N, and the mantissa part is determined by the difference between the exponent of the input value and the designated exponent N. Bits shifted left and shifted out are truncated. The exponent part and the mantissa part obtained as described above are output to C (exp) and C (fr), respectively. A specific example in this case is similar to the case of the above-mentioned multiplication, and therefore will be omitted.

【0035】図3は、本発明の他の構成例であり、浮動
小数点演算装置を示している。この浮動小数点演算器は
3つの入力A、B、Cに対して(A×B)+Cの浮動小
数点演算の解を求めるものであり、その出力はDとして
出力されるものである。図中、A(exp),A(fr)はそれぞ
れ浮動小数点演算装置の入力Aの指数部及び仮数部を示
し、B(exp) B(fr)は入力Bの指数部及び仮数部を、C
(exp),C(fr)は入力Cの指数部及び仮数部を示めしてい
る。D(exp),D(fr)は、該浮動小数点演算装置の出力D
の指数部及び仮数部を示している。
FIG. 3 shows another example of the configuration of the present invention, showing a floating point arithmetic unit. This floating point arithmetic unit obtains a solution of a floating point arithmetic operation of (A × B) + C with respect to three inputs A, B and C, and its output is output as D. In the figure, A (exp) and A (fr) respectively indicate the exponent part and mantissa part of the input A of the floating point arithmetic unit, B (exp) B (fr) indicate the exponent part and mantissa part of the input B, and C
(exp) and C (fr) indicate the exponent part and the mantissa part of the input C. D (exp) and D (fr) are the output D of the floating point arithmetic unit.
The exponent part and the mantissa part of are shown.

【0036】本図において、動作モードは、浮動小数点
演算において、指数指定部 3から指定された指数Nに、
演算結果の指数をあわせるかどうかを決定するものであ
る。例えば、前述の角度関数の引数(角度2πラジアン
の何倍であるかを示す数)を算出する場合、その整数部
は意味をもたないため、上記動作モードを有効にする。
In the figure, the operation mode is set to the exponent N designated by the exponent designating unit 3 in the floating point arithmetic.
It determines whether or not to match the exponents of the calculation results. For example, when the argument of the above-mentioned angle function (the number indicating how many times the angle is 2π radians) is calculated, since the integer part thereof has no meaning, the above operation mode is enabled.

【0037】該動作モードが有効になると、上記浮動小
数点演算装置の、乗算部分(A×B), 加算部分{(A
×B)+C}において、上記図1,図2で説明した動作
が行われ、浮動小数点演算結果の指数は、上記指数指定
部 3からの指定された指数N以下の出力となる。
When the operation mode becomes valid, the multiplication part (A × B) and the addition part {(A
XB) + C}, the operation described with reference to FIGS. 1 and 2 is performed, and the exponent of the floating point operation result is an output equal to or less than the specified exponent N from the exponent designating unit 3.

【0038】そのため、整数部分の切捨てられた演算結
果が出力される。上記の実施例では、浮動小数点乗算と
浮動小数点加算の演算動作を同時に行っているが、浮動
小数点乗算と浮動小数点加算を別々にして演算動作を実
現してもよいことはいう迄もないことである。
Therefore, the truncated operation result of the integer part is output. In the above embodiment, the floating point multiplication and floating point addition arithmetic operations are performed at the same time. However, it goes without saying that the floating point multiplication and floating point addition may be separately performed to realize the arithmetic operations. is there.

【0039】又、上記の例のような乗算、加算に限ら
ず、浮動小数点の四則演算の各々について実現してもよ
いことも明らかである。又、上記実施例では、動作モー
ドにより、従来の動作と本発明の動作を制御している
が、本発明のみの演算動作であってもよいことも明らか
である。
Further, it is apparent that the present invention is not limited to multiplication and addition as in the above example, but may be realized for each of the four arithmetic operations of floating point. Further, in the above embodiment, the conventional operation and the operation of the present invention are controlled by the operation mode, but it is clear that the arithmetic operation of the present invention only may be performed.

【0040】このような浮動小数点演算の最中に、固定
小数点演算が必要になったとき、従来の浮動小数点演算
装置では、該浮動小数点演算装置の他に、演算結果の指
数を指定値Nに固定する為の固定小数点演算装置が必要
であったが、上記のような構成の浮動小数点演算装置を
設けることにより、浮動小数点演算装置で、固定小数点
の機能を持たせることができる。
When fixed-point arithmetic is required during such floating-point arithmetic, in the conventional floating-point arithmetic unit, the exponent of the arithmetic result is set to the designated value N in addition to the floating-point arithmetic unit. A fixed-point arithmetic unit for fixing is required, but by providing the floating-point arithmetic unit having the above-described configuration, the floating-point arithmetic unit can have a fixed-point function.

【0041】[0041]

【発明の効果】以上説明したように、本発明によれば、
実施例に示すように角度関数の引数(角度2π, 又は、
πラジアンの何倍であるかを示す数)を算出する場合、
その整数部は意味をもたないため、演算結果に整数部が
存在することは、意味のない演算結果を出力してしまう
ことになるものが、本発明の演算動作を行うことによ
り、小数部分のみを演算結果として得ることができる。
As described above, according to the present invention,
As shown in the embodiment, the argument of the angle function (angle 2π, or
When calculating a number that indicates how many times π radians),
Since the integer part has no meaning, the existence of the integer part in the operation result will output a meaningless operation result. However, by performing the operation of the present invention, the decimal part Only the result can be obtained.

【0042】又、本発明の浮動小数点演算装置では、該
浮動小数点演算装置の機能を拡張することにより固定小
数点の機能を実現しているため、本演算装置を計算機シ
ステムに組み込む場合、同じ機能をもつ固定小数点演算
装置で実現した場合と比較して、部品の点数を少なくす
ることができる効果がある。
Further, since the floating point arithmetic unit of the present invention realizes the fixed point function by expanding the function of the floating point arithmetic unit, when the present arithmetic unit is incorporated into a computer system, the same function is provided. The number of parts can be reduced as compared with the case where it is realized by the fixed-point arithmetic unit.

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

【図1】本発明の浮動小数点演算装置の構成例を示した
図(その1)
FIG. 1 is a diagram showing a configuration example of a floating point arithmetic unit of the present invention (No. 1).

【図2】本発明の浮動小数点演算装置の構成例を示した
図(その2)
FIG. 2 is a diagram showing a configuration example of a floating point arithmetic unit of the present invention (No. 2).

【図3】本発明の他の構成例を示した図FIG. 3 is a diagram showing another configuration example of the present invention.

【図4】従来の浮動小数点演算装置を説明する図(その
1)
FIG. 4 is a diagram (part 1) illustrating a conventional floating-point arithmetic unit.

【図5】従来の浮動小数点演算装置を説明する図(その
2)
FIG. 5 is a diagram (part 2) explaining a conventional floating-point arithmetic unit.

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

1 浮動小数点乗算装置 10 指数部加
算部 11 仮数部乗算部 12 指数補正
・仮数補正部 13 指数部判別・仮数部処理部 2 浮動小数点加算装置 20,20a 指数
部比較・選択部 21,21a 仮数部桁合わせ部 22 仮数部加
算部 23 指数補正・仮数補正部 24 指数部判
別・仮数部処理部 3 指数指定部
1 Floating point multiplier 10 Exponent part adder 11 Mantissa part Multiplier 12 Exponential correction / mantissa corrector 13 Exponent part discrimination / mantissa part processing part 2 Floating point adder 20,20a Exponent part comparison / selection part 21,21a Mantissa part Digit alignment section 22 Mantissa addition section 23 Exponential correction / mantissa correction section 24 Exponential section discrimination / mantissa processing section 3 Exponent designation section

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】浮動小数点乗算装置(1) であって、指数N
を指定する指数指定部(3) と, 入力に関わらず、乗算結
果の指数部が、上記指数指定部(3) が指定する指数Nを
越えたとき、該乗算結果の指数を上記指数Nに固定し、
その差分について、仮数部を左シフトし、シフトアウト
されたビットの切り捨てを行う指数部判別・仮数部処理
部(13)とを設けたことを特徴とする浮動小数点乗算装
置。
1. A floating point multiplication device (1) comprising an exponent N.
When the exponent part of the multiplication result exceeds the exponent N specified by the exponent specifying part (3) regardless of the input, the exponent of the multiplication result is set to the above exponent N. Fixed,
The floating-point multiplication device is provided with an exponent part determination / mantissa part processing unit (13) for shifting the mantissa part to the left with respect to the difference and truncating the shifted out bits.
【請求項2】浮動小数点の乗算方法であって、入力に関
わらず、乗算結果が上記指数指定部(3) で指定された指
数Nを越えることがなければ、通常の浮動小数点乗算を
行い、該乗算結果が指定された指数Nを越える場合に
は、指数部を指定された指数Nに固定し、その差分につ
いて、仮数部を左シフトし、シフトアウトされたビット
を切り捨てた結果を出力することを特徴とする浮動小数
点乗算方法。
2. A floating-point multiplication method, wherein regardless of the input, if the multiplication result does not exceed the exponent N designated by the exponent designating section (3), normal floating-point multiplication is performed, When the multiplication result exceeds the designated exponent N, the exponent part is fixed to the designated exponent N, the mantissa part is left shifted with respect to the difference, and the result of truncating the shifted out bits is output. A floating point multiplication method characterized by the above.
【請求項3】浮動小数点加算装置(2) であって、指数N
を指定する指数指定部(3) と, 該指数指定部(3) から入
力された指数Nと、該浮動小数点加算装置(2) に入力さ
れた浮動小数点データの指数とを比較して、入力値の指
数部どうしの関係がA>Bであって、一方の入力値Aの
指数部が指定された指数Nを越えている場合、該入力値
Aの指数部を指定された指数Nに固定し、差分につい
て、仮数部を左シフトして、シフトアウトされたビット
は切り捨て、他方の入力値Bも、指定された指数Nに固
定し仮数部を右シフトし、両方の入力値が指定された指
数Nを越えている場合は、両入力値の指数部を指定され
た指数Nに固定し、両入力値の仮数部を左シフトして、
シフトアウトされたビットを切り捨てる処理を行う指数
部比較・選択部(20a) と仮数部桁合わせ部(21a) と, 加
算結果の指数部が、上記指数指定部(3) が指定する指数
Nを越えたとき、該乗算結果の指数を上記指定された指
数Nに固定し、その差分について、仮数部を左シフト
し、シフトアウトされたビットの切り捨てを行う指数部
判別・仮数部処理部(24)とを設けたことを特徴とする浮
動小数点加算装置。
3. A floating point adder (2) comprising an exponent N.
The exponent designating part (3) for designating, the exponent N input from the exponent designating part (3) and the exponent of the floating point data input to the floating point adder (2) are compared and input. If the relationship between the exponents of the values is A> B and the exponent of one input value A exceeds the specified exponent N, the exponent of the input value A is fixed to the specified exponent N. Then, with respect to the difference, the mantissa part is left-shifted, the shifted out bits are discarded, the other input value B is also fixed to the specified exponent N, and the mantissa part is right-shifted to specify both input values. If it exceeds the exponent N, fix the exponent part of both input values to the specified exponent N, shift the mantissa part of both input values to the left,
The exponent comparison / selection unit (20a) and the mantissa digit alignment unit (21a) that perform the process of truncating the shifted out bits, and the exponent part of the addition result are the exponent N specified by the exponent specification unit (3). When it exceeds, the exponent of the multiplication result is fixed to the designated exponent N, the mantissa part of the difference is left-shifted, and the shifted-out bit is cut off. ) And a floating point adder.
【請求項4】浮動小数点加算方法であって、浮動小数点
加算の仮数部入力A,被仮数部入力Bの指数部どうしの
関係がA>Bであり、一方の入力値Aの指数部のみが、
上記指定された指数Nを超えている場合、その入力値A
の指数部を、上記指数指定部(3) で指定された指数Nに
固定し、仮数部を左シフトして、シフトアウトされたビ
ットは切捨て、もう一方の入力値Bについても、その指
数を、上記指定された指数Nに固定し、仮数部を右シフ
トして、アンダ・フローされたビットは切捨てを行い、
両方の入力値の指数部が指定された指数Nを超えている
場合、その両入力値の指数部を指定された指数Nに固定
し、両入力の仮数部を左シフトして、シフト・アウトさ
れたビットは切捨てを行い、 上記の操作を施した入力値の仮数部どうしの加算結果
が、上記指数指定部(3)で指定された指数Nを越えるこ
とがなければ、通常の浮動小数点乗算を行い、該加算結
果の指数部が指定された指数Nを越える場合には、上記
指数部判別・仮数部処理部(24)において、該指数部を指
定された指数Nに固定し、その差分について、仮数部を
左シフトし、シフトアウトされたビットを切り捨てた結
果を出力することを特徴とする浮動小数点加算方法。
4. A floating point addition method, wherein the relationship between the exponent parts of the mantissa part input A and the mantissa part input B of the floating point addition is A> B, and only the exponent part of one input value A is ,
If the index N specified above is exceeded, the input value A
The exponent part of is fixed to the exponent N specified in the exponent specification part (3), the mantissa part is left shifted, the bits shifted out are discarded, and the exponent of the other input value B is also changed. , Fixed to the specified exponent N, right shifting the mantissa, and truncating the underflowed bits,
If the exponent parts of both input values exceed the specified exponent N, fix the exponent parts of both input values to the specified exponent N, shift the mantissa part of both inputs left, and shift out. If the result of addition of the mantissa parts of the input values that have been subjected to the above operation does not exceed the exponent N specified in the exponent specification part (3), then normal floating point multiplication is performed. When the exponent part of the addition result exceeds the specified exponent N, the exponent part determination / mantissa part processing unit (24) fixes the exponent part to the specified exponent N, and the difference between them. The floating-point addition method is characterized in that the mantissa part is left-shifted, and the result of truncating the bits shifted out is output.
【請求項5】上記の浮動小数点演算装置が、四則演算装
置であることを特徴とする浮動小数点演算装置。
5. A floating point arithmetic unit, wherein the floating point arithmetic unit is a four arithmetic unit.
JP4042663A 1992-02-28 1992-02-28 Device for floating point arithmetic and method therefor Withdrawn JPH05241784A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4042663A JPH05241784A (en) 1992-02-28 1992-02-28 Device for floating point arithmetic and method therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4042663A JPH05241784A (en) 1992-02-28 1992-02-28 Device for floating point arithmetic and method therefor

Publications (1)

Publication Number Publication Date
JPH05241784A true JPH05241784A (en) 1993-09-21

Family

ID=12642258

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4042663A Withdrawn JPH05241784A (en) 1992-02-28 1992-02-28 Device for floating point arithmetic and method therefor

Country Status (1)

Country Link
JP (1) JPH05241784A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012198666A (en) * 2011-03-18 2012-10-18 Fujitsu Ltd Value rounding method, value rounding program, computer and compiling program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012198666A (en) * 2011-03-18 2012-10-18 Fujitsu Ltd Value rounding method, value rounding program, computer and compiling program

Similar Documents

Publication Publication Date Title
EP0973089B1 (en) Method and apparatus for computing floating point data
EP0483864B1 (en) Hardware arrangement for floating-point addition and subtraction
US4941120A (en) Floating point normalization and rounding prediction circuit
EP0351242B1 (en) Floating point arithmetic units
US4562553A (en) Floating point arithmetic system and method with rounding anticipation
US7698353B2 (en) Floating point normalization and denormalization
KR100232962B1 (en) Fused floating point multiply and accumulate unit with carry correction
US8463834B2 (en) Floating point multiplier with first and second partial product shifting circuitry for result alignment
US5602769A (en) Method and apparatus for partially supporting subnormal operands in floating point multiplication
KR100264962B1 (en) Combined leading one and leading zero anticipator
US5369607A (en) Floating-point and fixed-point addition-subtraction assembly
JPH10207693A (en) Floating point arithmetic unit
EP0684548A1 (en) Method and apparatus for integer division
US6895423B2 (en) Apparatus and method of performing product-sum operation
US5943249A (en) Method and apparatus to perform pipelined denormalization of floating-point results
US20050228844A1 (en) Fast operand formatting for a high performance multiply-add floating point-unit
US20070038693A1 (en) Method and Processor for Performing a Floating-Point Instruction Within a Processor
JPH05241784A (en) Device for floating point arithmetic and method therefor
JPH09204295A (en) Sticky bit detecting circuit
US11366638B1 (en) Floating point multiply-add, accumulate unit with combined alignment circuits
EP0332215B1 (en) Operation circuit based on floating-point representation
JP2919386B2 (en) Floating-point detector and floating-point detector
JPH0540605A (en) Floating point multiplier
JPH09204294A (en) Three-input floating point adder
JPS5960637A (en) Arithmetic device for floating decimal point

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19990518