JP3295949B2 - Floating-point operation method and device - Google Patents

Floating-point operation method and device

Info

Publication number
JP3295949B2
JP3295949B2 JP25899391A JP25899391A JP3295949B2 JP 3295949 B2 JP3295949 B2 JP 3295949B2 JP 25899391 A JP25899391 A JP 25899391A JP 25899391 A JP25899391 A JP 25899391A JP 3295949 B2 JP3295949 B2 JP 3295949B2
Authority
JP
Japan
Prior art keywords
input
value
mantissa
floating
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP25899391A
Other languages
Japanese (ja)
Other versions
JPH05100823A (en
Inventor
冬樹 岡本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP25899391A priority Critical patent/JP3295949B2/en
Publication of JPH05100823A publication Critical patent/JPH05100823A/en
Application granted granted Critical
Publication of JP3295949B2 publication Critical patent/JP3295949B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

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 arithmetic system and a device therefor, and more particularly to a floating-point arithmetic system having a function of executing a data conversion instruction for converting floating-point data into integer data.

【0002】[0002]

【従来の技術】ここで対象とする浮動小数点データフォ
ーマットは、図2(A)に示すように、符号部Sが1ビ
ット、指数部Eが15ビットでバイアス値16384、
仮数部Mは48ビットの絶対値正規化表現で示されるも
のと仮定する。Mのビット列をM012 ・・・M47
とすると、この浮動小数点データは以下の値を表してい
る。
2. Description of the Related Art As shown in FIG. 2A, a floating-point data format to be used here has a sign part S of 1 bit, an exponent part E of 15 bits, and a bias value of 16384,
It is assumed that the mantissa M is represented by a 48-bit absolute value normalized expression. The bit string of M is represented by M 0 M 1 M 2 ... M 47
Then, the floating point data represents the following values.

【0003】 [0003]

【0004】また、対象とする整数データフォーマット
は、図2(B)に示すように、形式上64ビットである
が、下位32ビットが符号付2の補数表現の2進数であ
り、上位の32ビットは不定であるとするものと仮定す
る。この整数データは以下の値を表している。
As shown in FIG. 2B, the target integer data format is 64 bits in format, but the lower 32 bits are a binary number in a signed two's complement representation, and the upper 32 bits. Assume that the bits are undefined. This integer data represents the following values.

【0005】 [0005]

【0006】従来の浮動小数点演算装置である浮動小数
点加減算装置1は、図3に示すように、仮数部が絶対値
表現である浮動小数点データである2つの入力オペラン
ドOP1,OP2を入力しその大小を比較する比較選択
器11と、比較選択器11の比較結果小さい方のオペラ
ンドの仮数部MSを入力し桁合せのための右シフトを行
なう右シフタ12と、右シフタ12の出力を入力し加算
実行時には入力値をそのまま出力し減算実行時には入力
値の1の補数を出力する反転器13と、反転器13の出
力と比較選択器11の比較結果大きい方のオペランドの
仮数部MLを入力し加算実行時には両者の和を出力し減
算実行時には両者の和にさらに最下位ビットの重さを持
った’1’を加算した値を出力する仮数加算器14と、
仮数加算器14の出力における最上位の’1’のビット
の位置を検出するビット位置デコーダ15と、大きい方
のオペランドの指数部ELを入力しビット位置デコーダ
15の出力値にもとずき指数部の更新を行なう更新器1
6と、ビット位置デコーダ15の出力値にもとずき正規
化のため仮数加算器14の出力のシフトを行なう正規化
用シフタ17と、入力オペランドOP1,OP2の指数
部を減算し指数の差を出力する指数減算器18とを備え
て構成されていた。
As shown in FIG. 3, a floating-point adder / subtractor 1 as a conventional floating-point arithmetic unit inputs two input operands OP1 and OP2, which are floating-point data whose mantissa is an absolute value, and the magnitude of the input operands OP1 and OP2. , A right shifter 12 for inputting the mantissa MS of the smaller operand of the comparison result of the comparison selector 11 and performing a right shift for digit alignment, and an output of the right shifter 12 for addition. An inverter 13 that outputs the input value as it is at the time of execution and outputs the one's complement of the input value at the time of subtraction, and inputs and adds the mantissa part ML of the operand of the larger operand which is the output of the inverter 13 and the comparison result of the comparison selector 11 A mantissa adder 14 that outputs a sum of the two at the time of execution and outputs a value obtained by adding “1” having the weight of the least significant bit to the sum of the two at the time of subtraction;
A bit position decoder 15 for detecting the position of the most significant '1' bit in the output of the mantissa adder 14, and an exponent based on the output value of the bit position decoder 15 by inputting the exponent part EL of the larger operand. Updater 1 for updating part
6, a normalizing shifter 17 for shifting the output of the mantissa adder 14 for normalization based on the output value of the bit position decoder 15, and the difference between the exponents of the input operands OP1 and OP2. And an exponent subtractor 18 that outputs

【0007】次に、従来の浮動小数点演算方式とその装
置の動作について説明する。
Next, the operation of the conventional floating-point arithmetic system and its device will be described.

【0008】比較器選択器11は、図4で示すフォーマ
ットを持つ浮動小数点データを2つの入力オペランドO
P1,OP2として入力し、その大小を判定して小さい
方のオペランドの仮数部MSを右シフタ12の入力とし
て出力する。また、指数減算器18は、入力オペランド
OP1,OP2の指数部を減算し指数の差を出力する。
その値、すなわち、指数の差をシフト量として、右シフ
タ12は、入力された小さい方のオペランドの仮数部M
Sを桁合せのために右シフトする。右シフタ12の出力
は反転器13に入力される。
The comparator selector 11 converts floating-point data having the format shown in FIG.
P1 and OP2 are input, the magnitude is determined, and the mantissa MS of the smaller operand is output as an input to the right shifter 12. The exponent subtractor 18 subtracts the exponent parts of the input operands OP1 and OP2 and outputs a difference between exponents.
Using that value, that is, the difference between exponents as the shift amount, the right shifter 12 calculates the mantissa M of the input smaller operand.
S is shifted right for digit alignment. The output of the right shifter 12 is input to the inverter 13.

【0009】実行命令が加算のときは反転器13は入力
をそのまま出力する。また、実行命令が減算のときは反
転器13は入力の1の補数を出力する。
When the execution instruction is addition, the inverter 13 outputs the input as it is. When the execution instruction is subtraction, the inverter 13 outputs the one's complement of the input.

【0010】仮数加算器14は、反転器13の出力と比
較選択器11の出力である大きい方のオペランドの仮数
部MLとを加算する。このとき、実行命令が加算のとき
は両方の入力の和を出力する。また、実行命令が減算の
ときは両方の入力の和に、さらに、LSBの重みを持
つ’1’を加えることにより、反転器13の動作と合せ
て2の補数を用いての減算を実行する。
[0010] The mantissa adder 14 adds the output of the inverter 13 and the mantissa part ML of the larger operand which is the output of the comparison and selector 11. At this time, when the execution instruction is addition, the sum of both inputs is output. When the execution instruction is a subtraction, a subtraction using a two's complement is executed in addition to the operation of the inverter 13 by adding “1” having the LSB weight to the sum of both inputs. .

【0011】ビット位置デコーダ15は、仮数加算器1
4の出力データを検索し最上位の’1’のビット位置、
すなわち、最上位の’1’のビットがMSBから下位に
数えて何番目の位置かを検出する。
The bit position decoder 15 has a mantissa adder 1
4 is searched, and the most significant bit position of "1" is retrieved.
That is, the position of the most significant '1' bit counted from the MSB to the lower position is detected.

【0012】正規化用シフタ17は、ビット位置デコー
ダ15の出力にもとずいて、最上位ビットが’1’にな
るまで仮数加算器14の出力データをシフトする。この
とき、加算実行時には桁あふれの補正のための1ビット
右シフトし、減算実行時には左バレルシフトが必要とな
る。
The normalization shifter 17 shifts the output data of the mantissa adder 14 based on the output of the bit position decoder 15 until the most significant bit becomes '1'. At this time, when performing addition, a right shift is required by one bit for correction of overflow, and when performing subtraction, a left barrel shift is required.

【0013】以上の処理に並行して、指数部の更新が更
新器16により行なわれる。これは、比較選択器11か
ら大きい方のオペランドの指数部ELを入力して、これ
から正規化用シフタ17が実行した左シヘト量分を減算
することで実現される。
In parallel with the above processing, the updating of the exponent is performed by the updater 16. This is realized by inputting the exponent part EL of the larger operand from the comparison selector 11 and subtracting the left shift amount executed by the normalization shifter 17 therefrom.

【0014】以上の処理により浮動小数点加減算が実行
され、結果データRを出力するというものであった。
With the above processing, the floating point addition / subtraction is executed, and the result data R is output.

【0015】しかし、コンピュータシステムでは、浮動
小数点データだけではなく整数データをも扱う。したが
って、場合によっては浮動小数点データを整数データに
変換するデータ変換命令を実行する必要がある。
However, the computer system handles not only floating-point data but also integer data. Therefore, in some cases, it is necessary to execute a data conversion instruction for converting floating point data to integer data.

【0016】従来のコンピュータシステムでは、浮動小
数点演算装置は浮動小数点演算専用としてのみ用いられ
ており、素子数のオーバヘッドを抑えるためにデータ変
換用のハードウェアをコンピュータシステム内に搭載せ
ずに、整数用の演算器やシフト回路をマイクロプログラ
ム等により制御してデータ変換命令を実行していたの
で、変換命令の実行を高速化できないというものであっ
た。
In a conventional computer system, a floating-point arithmetic unit is used only for floating-point arithmetic. In order to suppress the overhead of the number of elements, hardware for data conversion is not installed in the computer system, and an integer is used. Since the data conversion instruction is executed by controlling the arithmetic unit and the shift circuit for use by a microprogram or the like, the speed of execution of the conversion instruction cannot be increased.

【0017】[0017]

【発明が解決しようとする課題】上述した従来の浮動小
数点演算方式とその装置は、コンピュータシステムの高
速化に有効である浮動小数点データの整数データへのデ
ータ変換命令を実行することができないという欠点があ
った。
The above-mentioned conventional floating-point arithmetic method and its apparatus cannot execute a data conversion instruction for converting floating-point data into integer data which is effective for increasing the speed of a computer system. was there.

【0018】本発明の目的は、ごくわずかのハードウェ
アを追加するだけで、データ変換命令を実行できる浮動
小数点演算方式とその装置を提供することにある。
It is an object of the present invention to provide a floating-point arithmetic method and a device capable of executing a data conversion instruction by adding a very small amount of hardware.

【0019】第一の発明の浮動小数点演算方式は、指数
減算器と右シフタと仮数加算器と反転器とを備え、浮動
小数点データフォーマットでは負値に対し絶対値表現を
用い整数データフォーマットでは負値に対し2の補数表
現を用い、仮数部が絶対値表現である浮動小数点データ
の第一および第二の入力オペランドを入力し加減算を行
なう浮動小数点加減算装置を用いる浮動小数点演算方式
において、前記指数減算器により入力した前記浮動小数
点データの指数部の値から前記指数部のバイアス値と前
記仮数部のビット長を減算し、前記減算結果をシフト量
として桁合せ用の前記右シフタにより前記仮数部をシフ
トし、前記右シフタの出力を前記反転器と前記仮数加算
器とを用いて2の補数表現に変換することにより前記浮
動小数点データを整数データに変換することを特徴とす
るものである。
The floating-point arithmetic method of the first invention is provided with a reverser exponent subtracter and right shifter and mantissa adder, floating
In the decimal point data format, absolute values are expressed for negative values.
In the integer data format used, two's complement table for negative values
In the floating-point arithmetic system using a floating-point adder / subtracter for performing addition and subtraction by inputting first and second input operands of floating-point data whose mantissa is an absolute value representation , the mantissa part is input by the exponent subtractor. The bias value of the exponent part and the bit length of the mantissa part are subtracted from the value of the exponent part of the floating-point data, and the mantissa is shifted by the right shifter for digit alignment using the result of the subtraction as a shift amount, and the right The floating-point data is converted into integer data by converting the output of the shifter into a two's complement representation using the inverter and the mantissa adder.

【0020】また、第2の発明の浮動小数点演算装置
は、浮動小数点データフォーマットでは負値に対し絶対
値表現を用い整数データフォーマットでは負値に対し2
の補数表現を用い、仮数部が絶対値表現である浮動小数
点データの第一および第二の入力オペランドをそれぞれ
入力する第一および第二の入力部を有し前記第一および
第二の入力オペランドの大小を比較し前記第一および第
二の入力オペランドの大きい方のオペランドの仮数部を
第一の仮数部とし小さい方のオペランドの仮数部を第二
の仮数部とし大きい方のオペランドの指数部を第一の指
数部としてそれぞれ出力する比較選択器と、前記第一お
よび第二の入力オペランドのそれぞれの指数部同志の減
算を行ない前記指数部の差である指数差を出力する指数
減算器と、前記第二の仮数部を入力し前記指数差をシフ
ト量として桁合せのための右シフトを行なう右シフタ
と、前記右シフタの出力を入力し加算実行時には入力値
をそのまま出力し減算実行時には前記入力値の1の補数
を出力する反転器と、前記反転器の出力と前記第一の仮
数部とを入力し加算実行時には前記反転器の出力と前記
第一の仮数部との和を出力し減算実行時には前記和にさ
らに最下位ビットの重さを持った’1’を加算した値を
出力する仮数加算器と、前記仮数加算器の出力における
最上位の’1’のビットの位置を検出するビット位置デ
コーダと、前記ビット位置デコーダの出力値にもとずき
正規化のため前記仮数加算器の出力のシフトを行なう正
規化用シフタと、前記第一の指数部を入力し前記ビット
位置デコーダの出力値にもとずき前記指数部の更新を行
なう更新器とを備えた浮動小数点加減算装置と、前記第
一の入力部に挿入する第一の入力オペランドおよび全ビ
ットが0であるデータとのいずれか一方を選択的に出力
する第一の選択器と、前記指数減算器の入力部に挿入す
る前記第一の入力オぺランドの指数部とこの指数部のバ
イアス値から決定される定数値とのいずれか一方を選択
的に出力する第二の選択器とを備え、制御信号により前
記比較選択器および前記反転器および前記仮数加算器を
制御して前記第二の入力オペランドを前記右シフタの入
力とし、前記正規化用シフタが前記シフト演算を行なわ
ず入力値をそのまま出力し、前記第二の入力オペランド
の符号が負であるならば前記反転器は前記入力値の1の
補数を出力するとともに前記仮数加算器は前記入力値に
最下位ビットの重さを持った’1’を加算し、前記符号
が正であるならば前記反転器および前記仮数加算器は前
記入力値をそのまま出力することを特徴とするものであ
る。
In the floating-point arithmetic device according to the second aspect of the present invention, the floating-point data format has an absolute value for a negative value.
2 for negative values in integer data format using value representation
Having first and second input units for inputting first and second input operands of floating-point data whose mantissa is an absolute value expression, respectively, wherein the first and second input operands are used. The mantissa of the larger operand of the first and second input operands is the first mantissa, the mantissa of the smaller operand is the second mantissa, and the exponent of the larger operand As a first exponent part, and an exponent subtraction for subtracting the respective exponent parts of the first and second input operands and outputting an exponent difference which is the difference between the exponent parts. And a right shifter for inputting the second mantissa and performing a right shift for digit alignment using the exponent difference as a shift amount. An inverter that outputs a one's complement of the input value during execution, an output of the inverter and the first mantissa part are input, and a sum of the output of the inverter and the first mantissa part is performed during addition; And a mantissa adder that outputs a value obtained by adding “1” having the weight of the least significant bit to the sum when the subtraction is executed, and a most significant bit “1” in the output of the mantissa adder. A bit position decoder for detecting a position, a shifter for normalization for shifting an output of the mantissa adder for normalization based on an output value of the bit position decoder, and the first exponent part. A floating-point adder / subtractor having an updater for updating the exponent part based on the output value of the bit position decoder; a first input operand to be inserted into the first input part; One of the data One of a first selector that outputs the first output, an exponent part of the first input operand that is inserted into an input part of the exponent subtractor, and a constant value that is determined from a bias value of the exponent part. And a second selector for selectively outputting the second input operand as the input of the right shifter by controlling the comparison selector and the inverter and the mantissa adder by a control signal, If the shifter for normalization outputs the input value without performing the shift operation and the sign of the second input operand is negative, the inverter outputs the one's complement of the input value and adds the mantissa. Adder having a weight of the least significant bit to the input value, and if the sign is positive, the inverter and the mantissa adder output the input value as it is. Is what you do.

【0021】[0021]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。
Next, embodiments of the present invention will be described with reference to the drawings.

【0022】本実施例においても従来例と同様に、図2
(A)で示した浮動小数点データフォーマットと、図2
(B)に示した整数データフォーマットとを仮定して説
明する。
In this embodiment, as in the prior art, FIG.
The floating-point data format shown in FIG.
Description will be made assuming the integer data format shown in FIG.

【0023】図2(A)で示す浮動小数点データフォー
マットで表される数値は、Mのビット列をM012
・・・M47とすると、下記に示す(1)のようになる。
The numerical value represented by the floating-point data format shown in FIG. 2A is obtained by converting the bit string of M to M 0 M 1 M 2
When · · · M 47, becomes as shown in the following (1).

【0024】 [0024]

【0025】この値は、小数点を最下位まで移動して、
下記に示す(2)のように書直すことができる。
This value is obtained by moving the decimal point to the lowest place,
It can be rewritten as shown in (2) below.

【0026】 [0026]

【0027】ここで、Y=|E−16384−48|と
する。E−16384−48が零または負であれば、数
値(2)はさらに小数点位置を移動して下記に示す
(3)のように書直すことができる。
Here, it is assumed that Y = | E-16384-48 |. If E-16384-48 is zero or negative, numerical value (2) can be rewritten as shown in (3) below by further shifting the decimal point position.

【0028】 [0028]

【0029】このM01 ・・・M46-Yが求める整数で
ある。
[0029] is an integer that the M 0 M 1 ··· M 46- Y seek.

【0030】ここで、整数データフォーマットは、図2
(B)に示したように、64ビット長データの下位32
ビットが実際の値を表す。したがって、浮動小数点デー
タフォーマットでは、上位から数えて17ビット目から
始まるM01 ・・・M46-Yというビット列を、整数デ
ータに変換する際には上位から数えて33ビット目以降
にシフトしなければならない。そのためのシフト量がY
である。つまり、入力された浮動小数点データの仮数部
を|E−16384−48|ビット分右シフトすること
により整数データに変換できることになる。なお、上位
から数えて32ビット目は符号ビットをいれることにな
る。
Here, the integer data format is shown in FIG.
As shown in (B), the lower 32 bits of the 64-bit length data
The bits represent the actual value. Therefore, floating in the point data format, shifting the bit string of counting from the upper starting from the 17th bit M 0 M 1 ··· M 46- Y, 33 and subsequent bits counted from the upper is in the conversion to an integer data Must. The shift amount for that is Y
It is. That is, the mantissa part of the input floating-point data can be converted to integer data by right shifting by | E-16384-48 | bits. Note that the 32nd bit counted from the higher order includes a sign bit.

【0031】ここで、数値(1)が負値を表していると
すると、これを2の補数表現にする必要がある。この理
由は、浮動小数点データフォーマットでは負値に対し絶
対値表現を使うが、整数データフォーマットでは負値に
対し2の補数表現を使うからである。
Here, assuming that the numerical value (1) represents a negative value, it is necessary to convert this to a two's complement expression. This is because the floating point data format uses the absolute value representation for negative values, while the integer data format uses two's complement representation for negative values.

【0032】数値の2の補数化のためには、まず、反転
器により1の補数を生成し、その値とLSBの重みを持
った’1’とを仮数加算器により加算すればよい。
In order to convert a numerical value into a two's complement number, first, a one's complement number is generated by an inverter, and the value and '1' having an LSB weight may be added by a mantissa adder.

【0033】なお、以上の説明からわかるように、E−
16384−48が正値の場合には、浮動小数点データ
を整数データに変換するとオーバフローが発生する。ま
た、E−16384−48が負値の場合であっても46
−Yが30より大きい場合にはオーバフローが発生す
る。の理由は、M01 ・・・M46-Yが32個以上のビ
ット列になってしまうからである。オーバフローが発生
したときの結果は不定値となる。
As can be seen from the above description, E-
When the value of 16384-48 is a positive value, overflow occurs when converting floating-point data to integer data. Even if E-16384-48 is a negative value, 46
If -Y is greater than 30, an overflow occurs. The reason is that M 0 M 1 ... M 46-Y becomes 32 or more bit strings. The result when an overflow occurs is an undefined value.

【0034】次に、本発明の浮動小数点演算装置の実施
例について図面を参照して説明する。
Next, an embodiment of the floating point arithmetic unit according to the present invention will be described with reference to the drawings.

【0035】図1は本発明の浮動小数点演算装置の一実
施例を示すブロック図である。
FIG. 1 is a block diagram showing an embodiment of a floating point arithmetic unit according to the present invention.

【0036】本実施例の浮動小数点演算装置は、図1に
示すように、従来の浮動小数点演算装置である浮動小数
点加減算装置1と、比較選択器11のオペランドOP1
の入力部側に挿入した選択器2と、指数減算器18の入
力部に挿入した選択器4とを備えて構成されている。
As shown in FIG. 1, the floating-point arithmetic unit of this embodiment includes a floating-point addition / subtraction unit 1 which is a conventional floating-point arithmetic unit and an operand OP1 of a comparison / selection unit 11.
And a selector 4 inserted at the input of the exponent subtractor 18.

【0037】浮動小数点加減算装置1は、前述のよう
に、比較選択器11と、右シフタ12と、反転器13
と、仮数加算器14と、ビット位置デコーダ15と、更
新器16と、正規化用シフタ17と、指数減算器18と
を備えて構成されている。
As described above, the floating-point addition / subtraction apparatus 1 includes a comparison selector 11, a right shifter 12, and an inverter 13
, A mantissa adder 14, a bit position decoder 15, an updater 16, a normalization shifter 17, and an exponent subtractor 18.

【0038】次に、本実施例の動作について説明する。Next, the operation of this embodiment will be described.

【0039】まず、浮動小数点加減算について説明す
る。
First, the floating point addition / subtraction will be described.

【0040】図1において、選択器2は、図2(A)で
示したフォーマットを持つ浮動小数点データの2つの入
力オペランドOP1,OP2のうちのOP1を入力して
そのまま出力する。浮動小数点加減算装置1の比較選択
器11は、入力オペランドOP1,OP2の大小を判定
して小さい方のオペランドの仮数部MSを桁合せのため
に右シフタ12の入力として出力する。右シフタ12の
出力は反転器13に入力される。
In FIG. 1, the selector 2 inputs and outputs OP1 of two input operands OP1 and OP2 of floating-point data having the format shown in FIG. 2A. The comparison selector 11 of the floating-point addition / subtraction apparatus 1 determines the magnitude of the input operands OP1 and OP2 and outputs the mantissa MS of the smaller operand as an input to the right shifter 12 for digit alignment. The output of the right shifter 12 is input to the inverter 13.

【0041】以下、指数減算器18に入力する入力オペ
ランドOP1の指数部が選択器3を経由するすることの
ほかは、前述の従来例と全く同一であり、説明が重複す
るので冗長とならないよう省略する。
Hereinafter, except that the exponent part of the input operand OP1 input to the exponent subtractor 18 passes through the selector 3, it is completely the same as the above-mentioned conventional example. Omitted.

【0042】次に、浮動小数点データを整数データに変
換する動作について説明する。
Next, the operation of converting floating point data into integer data will be described.

【0043】浮動小数点データは、入力オペランドOP
2として入力され、その仮数部は比較選択器11を経由
して右シフタ12に入力されるように、制御信号Cによ
り制御される。選択器2は、全ビットが’0’のデータ
を出力する。このデータは比較選択器11を経由して仮
数加算器14に入力される。選択器3は、定数値164
32(=16384+48)を選択的に出力する。指数
減算器18は、選択器3の出力である定数値16432
と、入力された浮動小数点データの指数部Eとの減算を
行ない両者の差値を出力する。この差値は前述のYに相
当する。
The floating-point data is input operand OP
2 and the mantissa is controlled by the control signal C so as to be input to the right shifter 12 via the comparison selector 11. The selector 2 outputs data in which all bits are “0”. This data is input to the mantissa adder 14 via the comparison selector 11. The selector 3 has a constant value 164
32 (= 16384 + 48) is selectively output. The exponent subtractor 18 outputs a constant value 16432, which is the output of the selector 3.
Is subtracted from the exponent part E of the input floating-point data, and the difference between the two is output. This difference value corresponds to the aforementioned Y.

【0044】右シフタ12は、指数減算器18の出力Y
をシフト量として、入力された浮動小数点データの仮数
部を右シフトし、結果を反転器13に出力する。
The right shifter 12 outputs the output Y of the exponent subtractor 18
Is shifted to the right, the mantissa of the input floating-point data is shifted to the right, and the result is output to the inverter 13.

【0045】反転器13は、絶対値表現の整数データを
2の補数表現の整数データに変換する役割を果たす。そ
のために、入力された浮動小数点データフォーマットの
符号ビットSの値に対応して、入力データが負の場合に
はデータの各ビットを反転して1の補数データを出力す
るように制御される。
The inverter 13 plays a role of converting the integer data of the absolute value representation into the integer data of the two's complement representation. Therefore, in accordance with the value of the sign bit S of the input floating-point data format, when the input data is negative, each bit of the data is inverted to output one's complement data.

【0046】仮数加算器14は、比較選択器11から全
ビットが’0’のデータと、反転器13から整数データ
あるいはその1の補数データとを入力し両者を加算す
る。ただし、入力整数データが負である場合にはさらに
LSBの重さを持った’1’を加算した値を出力する。
The mantissa adder 14 receives the data of which all bits are “0” from the comparison selector 11 and the integer data or its one's complement data from the inverter 13 and adds them. However, when the input integer data is negative, a value obtained by further adding “1” having the weight of LSB is output.

【0047】以上のようにして、絶対値表現が2の補数
表現に変換される。
As described above, the absolute value expression is converted into a two's complement expression.

【0048】正規化用シフタ17は、制御信号Cの制御
により、ビット位置デコーダ15の出力と無関係に入力
データをそのまま通過させて出力する。
Under the control of the control signal C, the normalization shifter 17 passes the input data as it is and outputs the data as it is regardless of the output of the bit position decoder 15.

【0049】以上により浮動小数点データから整数デー
タへの変換が実行される。当然、浮動小数点データの符
号が整数データの符号となる。また、オーバフローが発
生したときは不定値が出力される。
As described above, conversion from floating point data to integer data is executed. Naturally, the sign of the floating-point data is the sign of the integer data. When an overflow occurs, an undefined value is output.

【0050】[0050]

【発明の効果】以上説明したように、本発明の浮動小数
点演算方式とその装置は、従来の浮動小数点演算装置で
ある浮動小数点加減算装置に2つの選択器というわずか
の回路を追加することにより、コンピュータシステムの
高速化に有効な浮動小数点データの整数データへの変換
であるデータ変換命令を実行することが可能となるとい
う効果がある。
As described above, the floating-point arithmetic method and apparatus according to the present invention can be realized by adding a small circuit of two selectors to a floating-point addition / subtraction apparatus which is a conventional floating-point arithmetic apparatus. There is an effect that it is possible to execute a data conversion instruction which is a conversion of floating-point data into integer data which is effective for speeding up a computer system.

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

【図1】本発明の浮動小数点演算装置の一実施例を示す
ブロック図である。
FIG. 1 is a block diagram illustrating an embodiment of a floating-point arithmetic device according to the present invention.

【図2】浮動小数点データと整数データのフォーマット
を示す図である。
FIG. 2 is a diagram showing formats of floating-point data and integer data.

【図3】従来の浮動小数点演算装置の一例を示すブロッ
ク図である。
FIG. 3 is a block diagram illustrating an example of a conventional floating-point arithmetic device.

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

1 浮動小数点加減算装置 2,3 選択器 11 比較選択器 12 右シフタ 13 反転器 14 仮数加算器 15 ビット位置デコーダ 16 更新器 17 正規化用シフタ 18 指数減算器 DESCRIPTION OF SYMBOLS 1 Floating-point addition and subtraction apparatus 2, 3 selector 11 Comparison selector 12 Right shifter 13 Inverter 14 Mantissa adder 15 Bit position decoder 16 Updater 17 Normalization shifter 18 Exponent subtractor

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 指数減算器と右シフタと仮数加算器と反
転器とを備え、浮動小数点データフォーマットでは負値
に対し絶対値表現を用い整数データフォーマットでは負
値に対し2の補数表現を用い、仮数部が絶対値表現であ
る浮動小数点データの第一および第二の入力オペランド
を入力し加減算を行なう浮動小数点加減算装置を用いる
浮動小数点演算方式において、 前記指数減算器により入力した前記浮動小数点データの
指数部の値から前記指数部のバイアス値と前記仮数部の
ビット長を減算し、 前記減算結果をシフト量として桁合せ用の前記右シフタ
により前記仮数部をシフトし、 前記右シフタの出力を前記反転器と前記仮数加算器とを
用いて2の補数表現に変換することにより前記浮動小数
点データを整数データに変換することを特徴とする浮動
小数点演算方式。
An exponent subtractor, a right shifter, a mantissa adder, and an inverter, and a negative value in a floating-point data format.
Is negative for integer data format using absolute value representation
In a floating-point arithmetic system using a floating-point addition / subtraction device for performing addition and subtraction by inputting and subtracting first and second input operands of floating-point data whose mantissa part is an absolute value expression using a two's complement representation for a value, The bias value of the exponent part and the bit length of the mantissa part are subtracted from the value of the exponent part of the floating-point data input by the subtractor, and the mantissa part is shifted by the right shifter for digit alignment using the result of the subtraction as a shift amount. Converting the output of the right shifter into a two's complement representation using the inverter and the mantissa adder, thereby converting the floating-point data into integer data. .
【請求項2】 浮動小数点データフォーマットでは負値
に対し絶対値表現を用い整数データフォーマットでは負
値に対し2の補数表現を用い、仮数部が絶対値表現であ
る浮動小数点データの第一および第二の入力オペランド
をそれぞれ入力する第一および第二の入力部を有し前記
第一および第二の入力オペランドの大小を比較し前記第
一および第二の入力オペランドの大きい方のオペランド
の仮数部を第一の仮数部とし小さい方のオペランドの仮
数部を第二の仮数部とし大きい方のオペランドの指数部
を第一の指数部としてそれぞれ出力する比較選択器と、
前記第一および第二の入力オペランドのそれぞれの指数
部同志の減算を行ない前記指数部の差である指数差を出
力する指数減算器と、前記第二の仮数部を入力し前記指
数差をシフト量として桁合せのための右シフトを行なう
右シフタと、前記右シフタの出力を入力し加算実行時に
は入力値をそのまま出力し減算実行時には前記入力値の
1の補数を出力する反転器と、前記反転器の出力と前記
第一の仮数部とを入力し加算実行時には前記反転器の出
力と前記第一の仮数部との和を出力し減算実行時には前
記和にさらに最下位ビットの重さを持った’1’を加算
した値を出力する仮数加算器と、前記仮数加算器の出力
における最上位の’1’のビットの位置を検出するビッ
ト位置デコーダと、前記ビット位置デコーダの出力値に
もとずき正規化のため前記仮数加算器の出力のシフトを
行なう正規化用シフタと、前記第一の指数部を入力し前
記ビット位置デコーダの出力値にもとずき前記指数部の
更新を行なう更新器とを備えた浮動小数点加減算装置
と、 前記第一の入力部に挿入する第一の入力オペランドおよ
び全ビットが0であるデータとのいずれか一方を選択的
に出力する第一の選択器と、 前記指数減算器の入力部に挿入する前記第一の入力オぺ
ランドの指数部とこの指数部のバイアス値から決定され
る定数値とのいずれか一方を選択的に出力する第二の選
択器とを備え、 制御信号により前記比較選択器および前記反転器および
前記仮数加算器を制御して前記第二の入力オペランドを
前記右シフタの入力とし、 前記正規化用シフタが前記シフト演算を行なわず入力値
をそのまま出力し、 前記第二の入力オペランドの符号が負であるならば前記
反転器は前記入力値の1の補数を出力するとともに前記
仮数加算器は前記入力値に最下位ビットの重さを持っ
た’1’を加算し、 前記符号が正であるならば前記反転器および前記仮数加
算器は前記入力値をそのまま出力することを特徴とする
浮動小数点演算装置。
2. A negative value in a floating-point data format.
Is negative for integer data format using absolute value representation
A first and second input unit for inputting first and second input operands of floating-point data whose mantissa part is an absolute value expression using a two's complement representation for the value; The magnitudes of the two input operands are compared, and the mantissa of the larger operand of the first and second input operands is the first mantissa, and the mantissa of the smaller operand is the second mantissa and the larger A comparison selector for outputting the exponent part of the operand as a first exponent part,
An exponent subtractor for subtracting the respective exponent parts of the first and second input operands and outputting an exponent difference which is a difference between the exponent parts; and inputting the second mantissa part and shifting the exponent difference A right shifter that performs a right shift for digit alignment as an amount, an inverter that receives an output of the right shifter, outputs an input value as it is when performing addition, and outputs a one's complement of the input value when performing subtraction, The output of the inverter and the first mantissa are input and the sum of the output of the inverter and the first mantissa is output at the time of addition and the weight of the least significant bit is further added to the sum at the time of subtraction. A mantissa adder that outputs a value obtained by adding the value “1”, a bit position decoder that detects the position of the most significant bit “1” in the output of the mantissa adder, and an output value of the bit position decoder. Before for Motozuki normalization A normalizing shifter for shifting the output of the mantissa adder; and an updater for inputting the first exponent part and updating the exponent part based on an output value of the bit position decoder. A floating-point addition / subtraction device; a first selector for selectively outputting one of a first input operand to be inserted into the first input unit and data in which all bits are 0; A second selector for selectively outputting one of an exponent part of the first input operand to be inserted into the input part and a constant value determined from a bias value of the exponent part, The control selector controls the comparison / selector, the inverter, and the mantissa adder to use the second input operand as the input of the right shifter, and the normalization shifter does not perform the shift operation and keeps the input value as it is. Output, If the sign of the second input operand is negative, the inverter outputs the one's complement of the input value, and the mantissa adder outputs the input value with the least significant bit weight '1'. , And if the sign is positive, the inverter and the mantissa adder output the input value as it is.
JP25899391A 1991-10-07 1991-10-07 Floating-point operation method and device Expired - Fee Related JP3295949B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25899391A JP3295949B2 (en) 1991-10-07 1991-10-07 Floating-point operation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP25899391A JP3295949B2 (en) 1991-10-07 1991-10-07 Floating-point operation method and device

Publications (2)

Publication Number Publication Date
JPH05100823A JPH05100823A (en) 1993-04-23
JP3295949B2 true JP3295949B2 (en) 2002-06-24

Family

ID=17327866

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25899391A Expired - Fee Related JP3295949B2 (en) 1991-10-07 1991-10-07 Floating-point operation method and device

Country Status (1)

Country Link
JP (1) JP3295949B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9519456B2 (en) * 2014-03-14 2016-12-13 Arm Limited Data processing apparatus and method for performing a shift function on a binary number

Also Published As

Publication number Publication date
JPH05100823A (en) 1993-04-23

Similar Documents

Publication Publication Date Title
US7720898B2 (en) Apparatus and method for adjusting exponents of floating point numbers
JP3178746B2 (en) Format converter for floating point numbers
US5303174A (en) Floating pointing arithmetic operation system
JPH09212337A (en) Floating-point arithmetic processor
KR890004307B1 (en) Floating point adding and subtracting devices
US10310809B2 (en) Apparatus and method for supporting a conversion instruction
JP3295949B2 (en) Floating-point operation method and device
JP2558669B2 (en) Floating point arithmetic unit
JP2517064B2 (en) Denormalized number processing method
JP2507183B2 (en) Floating point addition / subtraction unit
JP4163967B2 (en) Floating point arithmetic unit
JPH05204606A (en) Floating point arithmetic system and unit
JPS61131123A (en) Floating point arithmetic unit
JPS63158626A (en) Arithmetic processing unit
JP3174974B2 (en) Floating point arithmetic device and method
JP2508868B2 (en) Floating point addition / subtraction unit
JP3229057B2 (en) Exception handling device
JP2512939B2 (en) Fixed floating data conversion circuit
JP2801472B2 (en) Floating point arithmetic unit
JP2530504B2 (en) Floating point arithmetic unit
JPH0540609A (en) Floating point divider
JPH0887399A (en) Normalizing device using redundant shift number prediction and shift error correction
JPH05313857A (en) Floating-point adding/subtracting device and its control system
JP2621494B2 (en) Floating point addition / subtraction unit
JPH0377534B2 (en)

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20020312

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080412

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090412

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100412

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees