JPH0340129A - Floating point adder - Google Patents

Floating point adder

Info

Publication number
JPH0340129A
JPH0340129A JP1174256A JP17425689A JPH0340129A JP H0340129 A JPH0340129 A JP H0340129A JP 1174256 A JP1174256 A JP 1174256A JP 17425689 A JP17425689 A JP 17425689A JP H0340129 A JPH0340129 A JP H0340129A
Authority
JP
Japan
Prior art keywords
result
rounding
normalized
addition
floating point
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
JP1174256A
Other languages
Japanese (ja)
Inventor
Yuji Yoshida
裕司 吉田
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 JP1174256A priority Critical patent/JPH0340129A/en
Publication of JPH0340129A publication Critical patent/JPH0340129A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To improve the processing efficiency of a floating point adder by performing a rounding process after deciding that the result of addition is already normalized even though the normalizing process is suppressed. CONSTITUTION:A setting means 15 and a normalization suppressing means 19 are provided. Then the result of addition is not normalized and undergoes directly a rounding process by the means 19. Thus the result of addition is equal to a normalized number S itself if the exponent value of the number S is equal to or larger than the exponent value of a normalized number A. Thus the least significant bit of the number S is substantially defined as a bit (i) and a rounding process is carried out. In this case, the bits equivalent (g), (r) and (k) are all equal to 0 and therefore the result of addition is equal to the number S itself. Then the actual weight of the least significant bit of a valid numeric character of the number S is equal to >=2 deg.. Thus it is decided that a rounding process is correctly carried out to the integer value since no valid numeric character having the weight smaller than 2 deg. exists. As a result, the process steps are decreased and the processing efficiency is improved for a floating point adder.

Description

【発明の詳細な説明】 〔斗既  要〕 データ処理装置に使用する浮動小数点加算器に関し、 浮動小数点数の整数部取り出し命令において、正規化数
を整数値に丸める処理の処理ステップ数を削減し処理の
効率化を図ることを目的とし、11EIEB標準規格若
しくはこれに準拠した浮動小数点数の加算を行う浮動小
数点加算器であって、供給される2つのオペランドデー
タの少なくとも一方について、そのオペランドデータが
正規化数であっても、仮数部の上位に付加される整数ビ
ットを強制的に「0」に設定することがマイクロプログ
ラムによって制御可能な設定手段と、丸め処理前に行わ
れる加算結果の正規化処理を抑止することがマイクロプ
ログラムによって制御可能な抑止手段とを備え、前記抑
止手段により正規化処理が抑止された場合でも加算結果
が既に正規化されたものとして丸め処理を行うように構
成する。
[Detailed Description of the Invention] [Summary of the Invention] Regarding a floating-point adder used in a data processing device, the number of processing steps for rounding a normalized number to an integer value is reduced in an instruction to extract the integer part of a floating-point number. A floating-point adder that performs addition of floating-point numbers in accordance with the 11EIEB standard or compliant with the 11EIEB standard for the purpose of improving processing efficiency. A setting means that can be controlled by a microprogram to forcibly set the integer bit added to the upper part of the mantissa to "0" even if it is a normalized number, and a setting means that can be controlled by a microprogram to normalize the addition result before rounding. and an inhibiting means that can control inhibiting the normalization processing by a microprogram, and is configured to perform rounding processing on the assumption that the addition result has already been normalized even when the normalization processing is inhibited by the inhibiting means. .

(2) 〔産業上の利用分野〕 本発明は、データ処理装置に使用する浮動小数点加算器
に関する。
(2) [Industrial Application Field] The present invention relates to a floating point adder used in a data processing device.

浮動小数点加算器において、丸め処理とは有効数字のあ
るビット位置よりも下位にある有効数字を切り上げ若し
くは切り捨てる処理をいう。
In a floating-point adder, rounding refers to the process of rounding up or truncating the significant digits below a certain bit position of the significant digits.

IBEB標準規格において、無限大方向丸め、ゼロ方向
丸め、最近値方向丸め等の丸めモードにより丸め方向の
指定が可能な丸め方式や、非数(数値でないデータ)や
無限大数のような特殊なオペランドも表現する浮動小数
点表現形式が提唱されている。従って、これに準拠した
丸め方式や浮動小数点数を扱うデータ処理装置が増大し
つつある。
In the IBEB standard, there are rounding methods that allow you to specify the rounding direction using rounding modes such as rounding toward infinity, rounding toward zero, and rounding toward nearest value, and special rounding methods such as non-numbers (data that is not numerical) and infinity. A floating-point representation format that also represents operands has been proposed. Therefore, the number of data processing devices that handle rounding systems and floating point numbers that comply with this is increasing.

一方、データ処理装置の命令実行部は、算術論理演算器
(ALU)やシフタのような汎用演算器をマイクロプロ
グラムにより制御することで数多くの命令を高速に実行
することができる。
On the other hand, an instruction execution unit of a data processing device can execute a large number of instructions at high speed by controlling a general-purpose arithmetic unit such as an arithmetic logic unit (ALU) or a shifter using a microprogram.

又、大型電算機では科学技術計算の高速処理に対する要
求が強いため、浮動小数点加算器のような専用演算器を
設けることにより浮動小数点演算(3) の高速化が行われる。専用演算器は特定の命令やデータ
を対象とした処理を主にハードウェア制御により行うた
めさらに高速処理が可能である。
Furthermore, since there is a strong demand for high-speed processing of scientific and technical calculations in large-sized computers, the speed of floating-point calculations (3) is increased by providing a dedicated arithmetic unit such as a floating-point adder. Dedicated arithmetic units are capable of higher-speed processing because they process specific instructions and data primarily through hardware control.

このようにデータ処理装置の命令実行部では、汎用演算
器を使用して主にマイクロプログラムの制御により行う
処理と、専用演算器を使用して主にハードウェア制御に
より行う処理とを、命令の種類やデータによって最適に
使い分ける方式が一般的である。
In this way, the instruction execution unit of a data processing device uses a general-purpose arithmetic unit to perform processing mainly under the control of a microprogram, and a dedicated arithmetic unit to perform processing mainly under hardware control. Generally, a method is used that is optimally used depending on the type and data.

〔従来の技術〕[Conventional technology]

IEIEEE準規格に準拠した浮動小数点数表現形式を
用いるデータ処理装置では、浮動小数点数χは、第3図
に示すように、1ビツトの符号部S、mビットの指数部
E、及びnビットの仮数部で表現される。
In a data processing device that uses a floating point number representation format compliant with the IEEE semi-standard, the floating point number χ has a 1-bit sign part S, m-bit exponent part E, and n-bits It is expressed in the mantissa.

指数部Eの値は実際の指数値にバイアス値を加算したも
ので、通常、バイアス値として、2(m−1)   l が使用される。実際の指数値eは、 (4) e=E−バイアス値 から求められる。
The value of the exponent part E is obtained by adding a bias value to the actual exponent value, and 2(m-1) l is normally used as the bias value. The actual index value e is determined from (4) e=E−bias value.

仮数部Fを表す2進数のビット列を f、、f2 、 0.f、。The binary bit string representing the mantissa part F is f,, f2, 0. f.

とすると2進浮動小数点数Xは次式で与えられる。Then, the binary floating point number X is given by the following equation.

X=(1)5XL ’ fl  −f2  、”’、f
、、X2″ここで、Lは有効数字の最上位のビットであ
り、L=1であるような浮動小数点数を正規化浮動小数
点数若しくは正規化数という。
X=(1)5XL'fl-f2,"',f
,,X2''Here, L is the most significant bit of the significant digits, and a floating point number where L=1 is called a normalized floating point number or a normalized number.

指数値Eの最大値(すべてのビットが1)及び最小値く
すべてのビットが0)は非数、無限大数、不正規化数、
ゼロといった正規化数以外のデータを表現するために予
約されている。
The maximum value (all bits are 1) and the minimum value (all bits are 0) of the exponent value E are non-numbers, infinite numbers, unnormalized numbers,
Reserved to represent data other than normalized numbers such as zero.

指数部Eがその最大値でも最小値でもない場合が正規化
数である。このように、正規化数であるか否かは指数部
の値により識別でき、しかも正規化数ではnビットの値
は必ずlであるため、nビットは明示的には表現されな
い。従って、浮動小数点演算において、オペランドデー
タが正規化数の場合には明示的に表現されないnビット
が仮数(5) 部の上位に付加されて処理される。
If the exponent part E is neither its maximum value nor its minimum value, it is a normalized number. In this way, whether it is a normalized number or not can be identified by the value of the exponent part, and since the value of n bits in a normalized number is always l, the n bits are not explicitly expressed. Therefore, in floating point arithmetic, when the operand data is a normalized number, n bits that are not explicitly expressed are added to the upper part of the mantissa (5) and processed.

浮動小数点数の整数部取り出し命令は、ある浮動小数点
数が表す実際の値の2°より小さい有効数字部分を丸め
処理によって丸めることにより、整数値を持つ浮動小数
点数に変換する命令である。
The instruction to extract the integer part of a floating point number is an instruction that converts a floating point number into a floating point number having an integer value by rounding off the significant digits smaller than 2 degrees of the actual value represented by the floating point number.

前述のように、丸め処理とは有効数字のあるビット位置
(このビットを1ビツトとする)よりも下位にある有効
数字を切り上げ若しくは切り捨てる処理である。ここで
、1ビツトより1ビツト下位にあるビットをgビット、
さらに下位にあるビットをrビットとし、rビットより
も下位にあるすべてのビットの論理和をにビットとする
と、丸め処理は次のようになる。
As mentioned above, the rounding process is the process of rounding up or down the significant digits below a certain bit position of the significant digits (this bit is considered to be 1 bit). Here, the bit 1 bit lower than 1 bit is g bit,
If the further lower bits are r bits, and the logical sum of all bits lower than r bits is 2 bits, the rounding process is as follows.

■十無限大方向丸め g、r、にのいずれかが1で、かつデータの符号が正で
あれば切り上げ、それ以外ならば切り捨てる。
■Rounding toward infinity If either g, r, or is 1 and the sign of the data is positive, round up; otherwise, round down.

■−無限大方向丸め g・r、にのいずれかが1で、かつデータの符号が負で
あれば切り上げ、それ以外ならば切り捨(6) てる。
- Rounding toward infinity If either g or r is 1 and the sign of the data is negative, round up; otherwise, round down (6).

■ゼロ方向丸め g、l”+ kのいずれかが1であれば切り上げ、それ
以外なら切り捨てる。
■ Rounding toward zero If either g or l"+k is 1, round up; otherwise, round down.

■最近値方向先め g=1で、かつrとkのいずれかが1であるか、g=l
 、r=Q 、に=oで、i=1であれば切り上げ、そ
れ以外なら切り捨てる。
■If g=1 in the direction of the latest value, and either r or k is 1, or g=l
, r=Q, ni=o, and if i=1, round up, otherwise round down.

第8図はIBEE標準規格で規定された2つの浮動小数
点の加算を行う浮動小数点加算器の構成例である。この
回路は図示しない制御回路により制御され、3マシンサ
イクルで2つの正規化された浮動小数点数の加減算結果
を出力することができる。
FIG. 8 shows an example of the configuration of a floating point adder that performs addition of two floating point numbers specified by the IBEE standard. This circuit is controlled by a control circuit (not shown) and can output the results of addition and subtraction of two normalized floating point numbers in three machine cycles.

3マシンサイクルの第1のサイクルをTI、!2のサイ
クルをF2、第3のサイクルをF3とすると各サイクル
での動作は概略以下のようになる。
TI the first cycle of 3 machine cycles! Assuming that the second cycle is F2 and the third cycle is F3, the operations in each cycle are roughly as follows.

ここで、 Slオペランド1の符号部 El:オペランド1の指数部 Fl:オペランド1の仮数部 (7) Llオペランド1の仮数部の上位に付加される1ビツト
の整数部 S2;オペランド2の符号部 F2:オペランド2の指数部 F2:オペランド2の仮数部 F2:オペランド2の仮数部の上位に付加される1ビツ
トの整数部 SR1:オペランド1の符号部の値を保持するレジスタ SR2:オペランド2の符号部の値を保持するレジスタ BXPR:中間結果の指数部を保持するレジスクFRI
:加減算回路の第1の人力を保持するレジスタ PH2:加減算回路の第2の入力を保持するレジスタ S3:演算結果の符号部 F3:演算結果の指数部 F3:演算結果の仮数部 SAI:桁合せシフタ1のシフト量 (8) SA2:桁合せシフタ2のシフト量 また、指数部のビット数を11、仮数部のビット数を5
2とする。
Here, Sl sign part El of operand 1: exponent part Fl of operand 1: mantissa part of operand 1 (7) Ll 1-bit integer part S2 added to the upper part of the mantissa part of operand 1; sign part of operand 2 F2: Exponent part of operand 2 F2: Mantissa part of operand 2 F2: 1-bit integer part added to the upper part of the mantissa part of operand 2 SR1: Register that holds the value of the sign part of operand 1 SR2: Significant part of operand 2 Register BXPR that holds the value of the sign part: Register FRI that holds the exponent part of the intermediate result
: Register that holds the first input of the addition/subtraction circuit PH2: Register S3 that holds the second input of the addition/subtraction circuit: Sign part of the calculation result F3: Exponent part of the calculation result F3: Mantissa part of the calculation result SAI: Digit alignment Shift amount of shifter 1 (8) SA2: Shift amount of digit alignment shifter 2 Also, the number of bits in the exponent part is 11, and the number of bits in the mantissa part is 5.
Set it to 2.

(1)Tlサイクル(桁合わせ処理) 両オペランドの符号部SL、S2を各々レジスタSRI
 、 SR2に格納する。また、指数比較回路11によ
り指数部ElとF2の大小比較を行い、その結果により
E1≧E2であれば、Elを、El<F2であればF2
を選択して中間結果の指数部保持レジスタEXPRへと
格納するとともに、ElとF2の指数差を計算して桁合
わせシック16.17をシフトするシフト量SAI、S
へ2を生成する。仮数部の桁合わせシフトは指数値の小
さい方の仮数部を指数差の分だけ右にシフトすることに
より行われる。従って、E1≧E2であれば5A1−指
数差、5A2=0、El<F2であれば、5AIO1S
A2−指数差がそれぞれ出力される。
(1) Tl cycle (digit alignment processing) Sign parts SL and S2 of both operands are placed in registers SRI.
, stored in SR2. Further, the exponent comparison circuit 11 compares the exponent parts El and F2, and according to the result, if E1≧E2, El is used, and if El<F2, F2 is used.
is selected and stored in the exponent part holding register EXPR of the intermediate result, and the shift amount SAI, S to calculate the exponent difference between El and F2 and shift the digit alignment thick 16.17.
Generate 2 to. The digit alignment shift of the mantissa part is performed by shifting the mantissa part with the smaller exponent value to the right by the difference in exponents. Therefore, if E1≧E2, 5A1-exponential difference, 5A2=0, if El<F2, 5AIO1S
A2-index difference is output respectively.

両オペランドの仮数部Fl、F2は、整数部付加回路1
4.15により上位に1ビツトの整数ビットLl、L2
が付加され、それぞれLFI 、 LP2としく9) て桁合わせシフタ16.17へ送出される。桁合わせシ
ック16.17はシフト量Sへ1 、 SA2 に従っ
てLFILF2を右シフトし、仮数部の最下位ビット位
置よりも右へシフトされた部分は、仮数部の最下位ビッ
トより下位の2ビツトとさらに下位にあるすべてのビッ
トの論理和の1ビツトとして、計3ビットが付加されて
それぞれ加減算回路入力レジスタFRI 、 PH1に
格納する。
The mantissa parts Fl and F2 of both operands are integer part addition circuit 1.
4.15, the upper 1-bit integer bit Ll, L2
are added and sent to the digit alignment shifters 16 and 17 as LFI and LP2, respectively. Digit alignment thick 16.17 shifts LFILF2 to the right according to the shift amount S by 1, SA2, and the part shifted to the right from the least significant bit position of the mantissa is the 2 bits lower than the least significant bit of the mantissa. Further, a total of three bits are added as one bit of the logical sum of all the lower bits and stored in the adder/subtracter circuit input registers FRI and PH1, respectively.

(2)F2サイクル(加減算及び正規化処理)加減算回
路18はレジスタFR1とPH2の加算あるいは減算を
行い加減算結果の絶対値を出力する。第4図に示すよう
に加算か減算かは両オペランドの符号により図示しない
制御回路により決定される。符号部決定回路12はレジ
スタSRI 、 SR2に格納されている両オペランド
の組合せと命令の種類及び加減算回路の加減算結果によ
り算術的に演算結果の符号を決定しレジスクSRIに格
納する。第5図に示すようにレジスタFR1の各ビット
を上位から順にx1〜X56、PH2のそれをY1〜Y
56とすると、加減算回路18の絶対値出力(XO) はZO〜Z56となる。ここで、ZOは加減算回路18
で加算を行った場合に最上位ビットから発生ずる桁上げ
出力である。
(2) F2 cycle (addition/subtraction and normalization processing) The addition/subtraction circuit 18 adds or subtracts the registers FR1 and PH2 and outputs the absolute value of the addition/subtraction result. As shown in FIG. 4, whether it is addition or subtraction is determined by a control circuit (not shown) depending on the signs of both operands. The sign part determination circuit 12 arithmetically determines the sign of the operation result based on the combination of both operands stored in the registers SRI and SR2, the type of instruction, and the addition/subtraction results of the addition/subtraction circuit, and stores it in the register SRI. As shown in Fig. 5, each bit of register FR1 is set from high order to x1 to
56, the absolute value output (XO) of the addition/subtraction circuit 18 becomes ZO to Z56. Here, ZO is the addition/subtraction circuit 18
This is the carry output generated from the most significant bit when addition is performed.

正規化シフト制御回路19は加減算回路18の絶対値出
力20−256を正規化するのに必要なシフト量を生成
し、指数補正回路13と正規化シフタ20へ供給する。
The normalization shift control circuit 19 generates a shift amount necessary to normalize the absolute value outputs 20-256 of the addition/subtraction circuit 18, and supplies it to the exponent correction circuit 13 and the normalization shifter 20.

正規化はZO〜Z56の最も上位にある「1」であるビ
ットが21のビット位置に来るように右或いは左シフト
により行われる。右シフトが行われるのはZO=1のと
きだけであるから、右シフト量は最大でも1である。
Normalization is performed by right or left shifting so that the most significant "1" bit of ZO to Z56 comes to the 21st bit position. Since the right shift is performed only when ZO=1, the right shift amount is 1 at most.

Z1〜256のビット位置に対応して、正規化シックの
出力をN1〜N56とする。ただし、正規化シフタ20
において右シフトが行なわれた場合には、N56には2
55とZ56の論理和が出力される。
The normalized thick outputs are assumed to be N1 to N56 corresponding to the bit positions Z1 to 256. However, the normalization shifter 20
If a right shift is performed in , N56 contains 2
The logical sum of 55 and Z56 is output.

N1〜N53がFRIのX1〜X53のビット位置に格
納され、X54〜X56にはゼロが格納される。
N1 to N53 are stored in bit positions X1 to X53 of the FRI, and zeros are stored in X54 to X56.

丸め処理決定回路21はN54〜N56の3ビツトを切
り上げるか切り捨てるかの丸め処理を決定し、切り上げ
が選択された場合にはFR2のY53のビ(工1) ット位置に王を格納し、その他のビットにゼロを格納す
る。そのため、丸め処理決定回路21は、N53を1ビ
ツト、N54をgビット、N55をrビット、N56を
にビットとして前述のように丸め処理を決定する。
The rounding decision circuit 21 decides whether to round up or discard the three bits N54 to N56, and if rounding up is selected, stores the king in the bit position of Y53 of FR2, Store zeros in other bits. Therefore, the rounding process determination circuit 21 determines the rounding process as described above by setting N53 to 1 bit, N54 to g bits, N55 to r bits, and N56 to 2 bits.

また、指数補正回路13は正規化シフトによって右シフ
トが行なわれる場合には1ビツトにつき+1、左シフト
が行なわれる場合には1ビツトにつき−1の補正をEX
PHに保持されている中間結果の指数部に対して行ない
、この補正結果がIEXPRへと格納される。
Further, the exponent correction circuit 13 corrects +1 per bit when a right shift is performed by normalization shift, and -1 per bit when a left shift is performed.
This is performed on the exponent part of the intermediate result held in PH, and the correction result is stored in IEXPR.

(3)T3サイクル(丸め処理) 中間結果の符号部がレジスタSRIに、正規化された中
間結果の指数部がレジスタBXPRに、また正規化され
た仮数部演算結果の上位53ビツト(N1〜N53)が
レジスクFRIに保持されている。
(3) T3 cycle (rounding process) The sign part of the intermediate result is stored in register SRI, the exponent part of the normalized intermediate result is stored in register BXPR, and the upper 53 bits (N1 to N53) of the normalized mantissa calculation result are stored in register SRI. ) is held in Regisc FRI.

丸め処理による加算は加減算回路18でFRIとFR2
を加算することによって行なわれる。切り捨てによる丸
め処理が選択された場合にはFR2(12) はゼロであるからFRIのX1〜X53が加算結果とし
て得られ、また、切り上げによる丸め処理が選択された
場合にはFR2のY53が1であるからFRIのX53
のビット位置に1を加算した結果が得られる。つまり、
正規化された中間結果N1〜N53の下位3ビツトを丸
め処理によって丸めた結果が得られることになる。
Addition by rounding processing is performed by addition/subtraction circuit 18 between FRI and FR2.
This is done by adding . If rounding down is selected, FR2(12) is zero, so X1 to X53 of FRI is obtained as the addition result, and if rounding up is selected, Y53 of FR2 is 1. Therefore, FRI's X53
The result of adding 1 to the bit position is obtained. In other words,
A result is obtained by rounding the lower three bits of the normalized intermediate results N1 to N53.

正規化シフト制御回路19は加減算回路18の絶対値出
力20−256を正規するのに必要なシフ)Itを生成
し、指数補正回路13および正規化シック20へと供給
する。ZO−1の場合は、1ビツト右シフトすることに
よって正規化処理が行われるので指数補正回路13の出
力はレジスタEXPHに保持されている中間結果の指数
部に+■したものとなり、また正規化シフタ20出力は
ZO〜Z56を右へ1ビツトシフトしたものとなる。Z
O=0の場合にはZl−1であるから、正規化シフト量
はOとなる。
The normalization shift control circuit 19 generates a shift It necessary to normalize the absolute value outputs 20-256 of the addition/subtraction circuit 18, and supplies it to the exponent correction circuit 13 and the normalization thick 20. In the case of ZO-1, normalization processing is performed by shifting one bit to the right, so the output of the exponent correction circuit 13 is the exponent part of the intermediate result held in the register EXPH plus ■, and the normalization The output of the shifter 20 is obtained by shifting ZO to Z56 one bit to the right. Z
When O=0, since Zl-1, the normalized shift amount is O.

従って、指数補正回路13の出力はレジスタBXPRに
保持されている中間結果の指数部となり、また正規化シ
フタ20出力はZ1〜Z56の値となる。
Therefore, the output of the exponent correction circuit 13 becomes the exponent part of the intermediate result held in the register BXPR, and the output of the normalization shifter 20 becomes the values Z1 to Z56.

(13) また、符号部決定回路■2はレジスタSRIに保持され
ている中間結果の符号部を最終結果の符号部として出力
する。従って、最終的な演算結果の符号部S3、指数部
E3、および仮数部F3は、それぞれ符号部決定回路出
力、指数補正回路出力、正規化シフタ出力のN2〜N5
3として得られる。
(13) Further, the sign part determining circuit (2) outputs the code part of the intermediate result held in the register SRI as the code part of the final result. Therefore, the sign part S3, exponent part E3, and mantissa part F3 of the final calculation result are the sign part determination circuit output, the exponent correction circuit output, and the normalization shifter output N2 to N5, respectively.
Obtained as 3.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来、浮動小数点数の整数部取り出し命令において、正
規化数を整数値に丸める処理は、上記gr・kの値とデ
ータの符号、及び丸めモードに従って、マイクロプログ
ラムの条件分岐を繰り返すことにより行っていたため、
処理ステップ数が多く効率が悪いという問題があった。
Conventionally, in an instruction to extract the integer part of a floating-point number, the process of rounding a normalized number to an integer value is performed by repeating a conditional branch of the microprogram according to the value of gr/k, the sign of the data, and the rounding mode. Save,
There was a problem that the number of processing steps was large and efficiency was low.

本発明の目的は浮動小数点数の整数への丸め処理を高速
に行うことが可能な浮動小数点加算器を提供することに
ある。
SUMMARY OF THE INVENTION An object of the present invention is to provide a floating-point adder that can round floating-point numbers to integers at high speed.

〔課題を解決するための手段〕[Means to solve the problem]

本発明は、第1図に原理構成図を示すように、(↓4) 11EEE標準規格若しくはこれに準拠した浮動小数点
数の加算を行う浮動小数点加算器であって、供給される
2つのオペランドデータの少なくとも一方について、そ
のオペランドデータが正規化数であっても、仮数部F2
の上位に付加される整数ビットL2を強制的に「O」に
設定することがマイクロプログラムによって制御可能な
設定手段15と、丸め処理前に行われる加算結果の正規
化処理を抑止することがマイクロプログラムによって制
御可能な抑止手段19とを備え、前記抑止手段により正
規化処理が抑止された場合でも加算結果が既に正規化さ
れたものとして丸め処理を行うことを特徴とする。
The present invention, as shown in the principle block diagram in FIG. For at least one of the operand data, even if the operand data is a normalized number, the mantissa part F2
The setting means 15 is controllable by a microprogram to forcibly set the integer bit L2 added to the upper part of The present invention is characterized in that it comprises a program-controllable inhibiting means 19, and even when the normalization processing is inhibited by the inhibiting means, rounding processing is performed on the assumption that the addition result has already been normalized.

〔作 用〕[For production]

2つの正規化数を浮動小数点加算器で加算すると、通常
は加算結果を正規化し、この正規化された結果に対して
、人力オペランドデータの仮数部の最下位ビット位置に
相当するビットを1ビツトとする丸め処理を行う。
When two normalized numbers are added using a floating-point adder, the addition result is normally normalized, and the bit corresponding to the least significant bit position of the mantissa of the manually operand data is added to the normalized result by one bit. Rounding is performed as follows.

(15) 従って、ある正規化数Sを整数値に丸める場合には、仮
数部の最下位ビット位置の実際の重みが2°となるよう
な指数部を持ち、その仮数部がOであるような正の正規
化数Aを正規化数Sに加算する。このとき前記設定手段
により正規化数Aの仮数部に付加される1ビツトの1を
強制的にOとすれば、正規化数への有効数字はすべてO
となるから加算によって正規化数Sの有効数字は影響を
受けない。
(15) Therefore, when rounding a certain normalized number S to an integer value, it has an exponent part such that the actual weight of the lowest bit position of the mantissa part is 2°, and the mantissa part is O. A positive normalized number A is added to the normalized number S. At this time, if the 1-bit 1 added to the mantissa of the normalized number A is forced to O by the setting means, all significant digits to the normalized number are O.
Therefore, the significant figures of the normalized number S are not affected by the addition.

又、前記抑止手段によって、加算結果を正規化せずにそ
のまま丸め処理を行わせると、正規化数Sの指数値が正
規化数Aの指数値と等しいか大きい場合は、加算結果は
正規化数Sそのものとなるため、実質的に正規化数Sの
最下位ビットを1ビツトとした丸め処理が行われる。こ
の場合、g、r、kに相当するビットはすべてOである
から丸め処理の結果も正規化数Sそのものとなるが、正
規化数Sの指数値が正規化数Aの指数値と等しいか大き
いということは、正規化数Sの有効数字の最下位ビット
の実際の重みが2°以上である、即(16) ち、2°より小さい重みを持つ有効数字がないことを意
味するから、整数値への丸め処理が正しく行われたこと
になる。
Further, when the above-mentioned suppressing means causes the addition result to be rounded without being normalized, if the exponent value of the normalized number S is equal to or larger than the exponent value of the normalized number A, the addition result is not normalized. Since it becomes the number S itself, rounding processing is performed in which the least significant bit of the normalized number S is set as 1 bit. In this case, the bits corresponding to g, r, and k are all O, so the result of rounding is also the normalized number S itself, but is the exponent value of the normalized number S equal to the exponent value of the normalized number A? Large means that the actual weight of the least significant bit of the significant digits of the normalized number S is 2° or more, i.e. (16), that is, there is no significant digit with a weight less than 2°, so This means that rounding to an integer value was performed correctly.

一方、正規化数Sの指数値が正規化数Aの指数値より小
さい場合には実質的に正規化数Sの有効数字で2°の重
みを持つビットを1ビツトとした丸め処理が行われるこ
とになり、やはり、整数値への丸め処理を正しく行うこ
とができる。
On the other hand, if the exponent value of the normalized number S is smaller than the exponent value of the normalized number A, rounding is performed such that the bits with a weight of 2° in the significant figures of the normalized number S are treated as 1 bit. Therefore, rounding to an integer value can be performed correctly.

〔実施例〕 第2図は本発明の一実施例構成図である。図において第
8図と同一の構成要素には同一の番号を符す。
[Embodiment] FIG. 2 is a block diagram of an embodiment of the present invention. In the figure, the same components as in FIG. 8 are denoted by the same numbers.

本実施例では整数部付加回路15にオペランド2の仮数
部F2の上位に付加される整数ビットL2をマイクロプ
ログラムの制御によって強制的にL2=0とする設定手
段と、正規化シフト制御回路19にマイクロプログラム
によって制御可能な正規化抑止信号NISを追加し、正
規化抑止信号NISによって正規化処理が抑止された場
合には、(17) 正規化シフト制御回路19は加減算回路■8の結果に関
係なく正規化シフト量をOとすることによって実質的に
正規化処理を抑止する抑止手段を設けた。
In this embodiment, the integer part addition circuit 15 includes a setting means for forcibly setting the integer bit L2 added to the upper part of the mantissa part F2 of operand 2 to L2=0 under the control of a microprogram, and the normalization shift control circuit 19 includes If a normalization suppression signal NIS that can be controlled by a microprogram is added, and the normalization process is suppressed by the normalization suppression signal NIS, (17) the normalization shift control circuit 19 is related to the result of the addition/subtraction circuit ■8. By setting the normalization shift amount to O instead of 0, a suppressing means is provided to substantially suppress the normalization process.

なお、マイクロプログラムが設定手段および抑止手段を
それぞれ有効にしない限り、本実施例の浮動小数点加算
器は図8の浮動小数点加算器とまったく同一に動作する
Note that unless the microprogram enables the setting means and the inhibiting means, the floating point adder of this embodiment operates exactly the same as the floating point adder of FIG. 8.

図8の浮動小数点加算器と図2の本発明による浮動小数
点加算器の動作の違いを明確にするため、オペランド1
 =4238888888888888(符号部S 1
=O指数部E 1 =423仮数部F1−888888
888888) オペランド2 =433000()0000[)000
0(符号部52=O指数部E 2 =433仮数部F2
000000000000) のような2つの正規化浮動小数点数の加算を図8の浮動
小数点加算器と図2の浮動小数点加算で行なった場合の
動作例を図6および図7に示す。
To clarify the difference in operation between the floating point adder in FIG. 8 and the floating point adder according to the invention in FIG.
=4238888888888888 (sign part S 1
=O exponent part E 1 =423 mantissa part F1-888888
888888) Operand 2 =433000()0000[)000
0 (sign part 52 = O exponent part E 2 = 433 mantissa part F2
6 and 7 show examples of operations when two normalized floating point numbers such as 000000000000) are added using the floating point adder of FIG. 8 and the floating point addition of FIG. 2.

ただし、図7においてはT1サイクルで前記設定手段に
より強制的にL2−0とし、T2サイク(18) ルで前記抑止手段によって正規化処理を抑止している。
However, in FIG. 7, the setting means forcibly sets it to L2-0 in the T1 cycle, and the normalization process is suppressed by the inhibiting means in the T2 cycle (18).

またT3サイクルでは正規化抑止信号NISがオフとな
り、加減算回路18の結果が通常動作により正規化され
ている。また丸めモードは最近値方向丸めであるとし、
図においてレジスクFR1およびFR2などの値は16
進数で表現している。
Further, in the T3 cycle, the normalization inhibit signal NIS is turned off, and the result of the addition/subtraction circuit 18 is normalized by normal operation. Also, assume that the rounding mode is rounding towards the nearest value,
In the figure, the values of Regisc FR1 and FR2 are 16.
It is expressed in decimal numbers.

図6および図7から分るように従来の浮動小数点加算器
の結果および本発明による浮動小数点加算器の演算結果
はそれぞれ 従来の浮動小数点加算器の結果−4330001888
888889本発明の浮動小数点加算器の結果−423
8888888890000となる。なお、本発明の浮
動小数点加算器でも前記設定手段および抑止手段を使用
しなければ演算結果は従来と同じになる。従って、本発
明の浮動小数点加算器は前記設定手段および抑止手段を
使用することによって図7で示すような特殊な結果を出
力することができることが分る。
As can be seen from FIGS. 6 and 7, the results of the conventional floating-point adder and the calculation results of the floating-point adder according to the present invention are -4330001888, respectively.
888889 Result of floating point adder of the present invention-423
8888888890000. It should be noted that even in the floating point adder of the present invention, if the setting means and inhibiting means are not used, the calculation result will be the same as the conventional one. Therefore, it can be seen that the floating point adder of the present invention can output a special result as shown in FIG. 7 by using the setting means and inhibiting means.

次に本発明の浮動小数点加算器による特殊な結果がオペ
ランド1の整数部取り出し命令の結果となることを示す
。整数部取り出し命令は、ある浮(19) 動小数点数が表す実際の値の2°より小さい有効数字部
分を丸め処理によって丸めることにより、整数値を持つ
浮動小数点数に変換する命令である。
Next, it will be shown that a special result by the floating point adder of the present invention is the result of an instruction to fetch the integer part of operand 1. The integer part extraction instruction is an instruction that converts a certain floating point number into a floating point number having an integer value by rounding off the significant digit part smaller than 2 degrees of the actual value represented by a certain floating point number.

従って、与えられた浮動小数点数の有効数字の実際の重
みが2°であるビット位置を見つけて、それよりも下位
にあるビットを丸め処理によって丸めることによって得
られる。
Therefore, it can be obtained by finding the bit position where the actual weight of the significant digits of a given floating point number is 2 degrees, and rounding off the bits below that position.

本発明の実施例である浮動小数点加算器では、与えられ
た浮動小数点数をオペランド1とし、また、仮数部の最
下位ビット位置の実際の重みが2゜となるような指数部
を持ち仮数部のすべてのビットがOであるような浮動小
数点数をオペランド2として加算し、かつ加算処理にお
いて前記設定手段によってオペランド2の整数ビットを
強制的に0とし、また丸め処理前の加算結果の正規化処
理を前記抑止手段によって抑止することにより加算結果
を正規化せずに丸め処理を行ない、丸め処理結果を正規
化することによってオペランド1の整数部取り出し結果
を得ることができる。オペランド1の指数部がオペラン
ド2の指数部より大きい(20)・ か等しい場合には、桁合せシフトによりオペランド2の
仮数部が右シフトされて加算されるが、オペランド2の
整数ビットは前記設定手段により強制的に0となるから
オペランド2の有効数字はすべて0となるため、加算結
果はオペランド1そのものとなる。従って、加算結果の
254〜Z56はすべて0であり、丸め処理の結果得ら
れる最終結果もオペランド1そのものとなる。オペラン
ド1の指数部がオペランド2の指数部より大きいか等し
いということはオペランド1の仮数部の最下位ビットの
実際の重みが2°以上であることを意味するから、オペ
ランド1の整数部取り出し結果はオペランド1そのもの
である。
In the floating point adder which is an embodiment of the present invention, a given floating point number is used as operand 1, and the mantissa part has an exponent part such that the actual weight of the least significant bit position of the mantissa part is 2 degrees. Add a floating point number whose all bits are O as operand 2, force the integer bits of operand 2 to 0 by the setting means in the addition process, and normalize the addition result before rounding. By inhibiting the processing by the inhibiting means, rounding is performed without normalizing the addition result, and by normalizing the rounding result, the result of taking out the integer part of operand 1 can be obtained. If the exponent part of operand 1 is greater than or equal to the exponent part of operand 2 (20), the mantissa part of operand 2 is shifted to the right by digit alignment shift and added, but the integer bits of operand 2 are set as above. Since the value is forced to 0 by means of the means, all significant digits of operand 2 become 0, so the addition result becomes operand 1 itself. Therefore, the addition results 254 to Z56 are all 0, and the final result obtained as a result of the rounding process is also the same as operand 1. If the exponent part of operand 1 is greater than or equal to the exponent part of operand 2, it means that the actual weight of the least significant bit of the mantissa part of operand 1 is 2 degrees or more, so the result of extracting the integer part of operand 1 is is operand 1 itself.

オペランド1の指数部がオペランド2の指数部より小さ
い場合には、オペランド1の整数ビットおよび仮数部が
右シフトされて加算されるが、オペランド2の有効数字
はすべてOであるから、加算結果はオペランド1の桁合
せシフト結果そのものとなる。本発明の実施例では、こ
の加算結果を前記抑止手段により正規化せずに丸め処理
を行な(21) う。したがって加算結果の253のビット位置の実際の
重みは2°であるから、丸め処理によって254〜Z5
6を丸めることは2°より小さい重みを持つ有効数字部
分を丸めて整数値とすることに他ならない。つまり、本
発明による浮動小数点加算器を用いることによって、与
えられた浮動小数点数の整数部取り出し命令を処理する
ことが可能となる。図3で示すような浮動小数点形式の
場合、仮数部の最下位ビット位置の実際の重みが2°と
fヨるような指数部を持ち仮数部のすべてのビットがO
であるような浮動小数点数は433000000000
0000である。したがって、図7の動作例で得られた
結果はオペランド1の整数部取り出し結果である。
If the exponent part of operand 1 is smaller than the exponent part of operand 2, the integer bits and mantissa part of operand 1 are right-shifted and added, but since all the significant digits of operand 2 are O, the addition result is This is the result of the digit alignment shift of operand 1 itself. In the embodiment of the present invention, this addition result is rounded (21) without being normalized by the suppressing means. Therefore, since the actual weight of bit position 253 in the addition result is 2°, it is rounded to 254 to Z5.
Rounding 6 is nothing but rounding off the significant figures having a weight smaller than 2 degrees to an integer value. That is, by using the floating point adder according to the present invention, it is possible to process an instruction to fetch the integer part of a given floating point number. In the case of a floating point format as shown in Figure 3, the actual weight of the least significant bit position of the mantissa is 2°, which is the exponent part, and all bits of the mantissa part are 0.
The floating point number is 433000000000
It is 0000. Therefore, the result obtained in the operation example of FIG. 7 is the result of extracting the integer part of operand 1.

浮動小数点数4238888888888888の指数
部423が表す実際の指数値は 423−3FF =24 (16進数)  −36(1
0進数)であるから、浮動小数点数4’2388888
88888888は次のような2進数の数値を表現して
いる。
The actual exponent value represented by the exponent part 423 of the floating point number 4238888888888888 is 423-3FF = 24 (hexadecimal) -36 (1
0 base number), so the floating point number 4'2388888
88888888 represents the following binary number.

1、10001000100010001000100
0100010001000100010001000
1000 X 236(22) これを2°の重みを持つビットより下位にあるビットを
最近値方向丸めモードによって丸めると1、10001
0001000100010001000↓00010
0010010000000000000000 X 
2”となる。これを図3の浮動小数点形式で表現すると
4238888888890000となり、明らかに図
7で得られた結果と一致している。
1, 10001000100010001000100
0100010001000100010001000
1000 x 236 (22) Rounding this to 1, 10001 by rounding the bits lower than the bit with a weight of 2° using nearest rounding mode
0001000100010001000↓00010
0010010000000000000000 X
2". If this is expressed in the floating point format of FIG. 3, it becomes 4238888888890000, which clearly matches the result obtained in FIG.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明によれば、浮動小数点数の整
数部取り出し命令において、正規化数を整数値に丸める
処理の処理ステップ数を削減し丸め処理の高速化を図る
ことができる。
As described above, according to the present invention, in an instruction to extract the integer part of a floating point number, it is possible to reduce the number of processing steps for rounding a normalized number to an integer value and speed up the rounding process.

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

第1図は本発明の原理構成図、 第2図は本発明の一実施例構成図、 第3図は浮動小数点数のデータ形式例、第4図は加減算
回路の処理説明図、 第5図は加減算回路の出力説明図、 第6図は従来の浮動小数点加算器による加算器(23) 果説明図、 第7図は本発明の浮動小数点加算器による加算結果説明
図、および 第8図は従来の浮動小数点加算器の構成図である。 (符号の説明) 11・・・指数比較回路、  12・・・符号部決定回
路、13・・・指数補正回路、 14・15・・・整数部付加回路、 16.17・・・桁合せシフタ、18・・・加減算回路
、19・・・正規化シフト制御回路、 20・・・正規化シフタ、  21・・・丸め処理決定
回路、SRI、 SR2,FRl、 PH1,EXPR
・・・レジスタ。 (24)
Figure 1 is a diagram of the principle of the present invention; Figure 2 is a diagram of an embodiment of the present invention; Figure 3 is an example of a floating point data format; Figure 4 is an explanatory diagram of the processing of an addition/subtraction circuit; 6 is an explanatory diagram of the output of the adder/subtractor circuit, FIG. 6 is an explanatory diagram of the adder (23) result using a conventional floating-point adder, FIG. 7 is an explanatory diagram of the addition result by the floating-point adder of the present invention, and FIG. FIG. 1 is a configuration diagram of a conventional floating-point adder. (Explanation of symbols) 11...Exponent comparison circuit, 12...Sign part determination circuit, 13...Exponent correction circuit, 14, 15...Integer part addition circuit, 16.17...Digit alignment shifter , 18... Addition/subtraction circuit, 19... Normalization shift control circuit, 20... Normalization shifter, 21... Rounding process determination circuit, SRI, SR2, FRl, PH1, EXPR
···register. (24)

Claims (1)

【特許請求の範囲】 1、IEEE標準規格若しくはこれに準拠した浮動小数
点数の加算を行う浮動小数点加算器であって、供給され
る2つのオペランドデータの少なくとも一方について、
そのオペランドデータが正規化数であっても、仮数部(
F2)の上位に付加される整数ビット(L2)を強制的
に「0」に設定することがマイクロプログラムによって
制御可能な設定手段(15)と、 丸め処理前に行われる加算結果の正規化処理を抑止する
ことがマイクロプログラムによって制御可能な抑止手段
(19)とを備え、 前記抑止手段により正規化処理が抑止された場合でも加
算結果が既に正規化されたものとして丸め処理を行うこ
とを特徴とする浮動小数点加算器。
[Claims] 1. A floating-point adder that performs addition of floating-point numbers in accordance with the IEEE standard or compliant therewith, with respect to at least one of two supplied operand data:
Even if the operand data is a normalized number, the mantissa (
A setting means (15) that can be controlled by a microprogram to forcibly set the integer bit (L2) added to the upper part of F2) to "0", and a normalization process of the addition result performed before rounding process. a suppression means (19) whose suppression can be controlled by a microprogram, and even if the normalization processing is suppressed by the suppression means, rounding processing is performed on the assumption that the addition result has already been normalized. Floating point adder.
JP1174256A 1989-07-07 1989-07-07 Floating point adder Pending JPH0340129A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1174256A JPH0340129A (en) 1989-07-07 1989-07-07 Floating point adder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1174256A JPH0340129A (en) 1989-07-07 1989-07-07 Floating point adder

Publications (1)

Publication Number Publication Date
JPH0340129A true JPH0340129A (en) 1991-02-20

Family

ID=15975452

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1174256A Pending JPH0340129A (en) 1989-07-07 1989-07-07 Floating point adder

Country Status (1)

Country Link
JP (1) JPH0340129A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1992016891A1 (en) * 1991-03-19 1992-10-01 Fujitsu Limited Numerical expression converter and vector processor using the same
US8874630B2 (en) 2010-11-17 2014-10-28 Samsung Electronics Co., Ltd. Apparatus and method for converting data between a floating-point number and an integer

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1992016891A1 (en) * 1991-03-19 1992-10-01 Fujitsu Limited Numerical expression converter and vector processor using the same
US5508948A (en) * 1991-03-19 1996-04-16 Fujitsu Limited Numeric representation converting apparatus and vector processor unit such apparatus
US8874630B2 (en) 2010-11-17 2014-10-28 Samsung Electronics Co., Ltd. Apparatus and method for converting data between a floating-point number and an integer

Similar Documents

Publication Publication Date Title
TWI784980B (en) An apparatus and method for performing arithmetic operations to accumulate floating-point numbers
JP6487097B2 (en) Perform rounding according to instructions
TWI405126B (en) Microprocessors and methods for executing instruction
US20150347089A1 (en) Microarchitecture for floating point fused multiply-add with exponent scaling
WO2017081434A1 (en) Redundant representation of numeric value using overlap bits
US10061561B2 (en) Floating point addition with early shifting
GB2549153B (en) Apparatus and method for supporting a conversion instruction
US20200192633A1 (en) Arithmetic processing device and method of controlling arithmetic processing device
US6598065B1 (en) Method for achieving correctly rounded quotients in algorithms based on fused multiply-accumulate without requiring the intermediate calculation of a correctly rounded reciprocal
CN113377334B (en) Floating point data processing method and device and storage medium
JPH0340129A (en) Floating point adder
TWI822952B (en) Processing of iterative operation
JP2517064B2 (en) Denormalized number processing method
JP3174974B2 (en) Floating point arithmetic device and method
JPS58186840A (en) Data processor
JP3229057B2 (en) Exception handling device
JPS6149234A (en) Multiplier circuit for floating point
JP3295949B2 (en) Floating-point operation method and device
JP2552086B2 (en) Floating point arithmetic unit
JPS6371725A (en) Operation processing device
CN114637488A (en) Artificial intelligence arithmetic circuit
JP2007073061A (en) Data processing apparatus
JPH04160533A (en) Microprocessor
JP2001188670A (en) Arithmetic unit
JPH08263269A (en) Floating-point arithmetic circuit