JP2558799B2 - Floating point normalized rounding device - Google Patents

Floating point normalized rounding device

Info

Publication number
JP2558799B2
JP2558799B2 JP63073587A JP7358788A JP2558799B2 JP 2558799 B2 JP2558799 B2 JP 2558799B2 JP 63073587 A JP63073587 A JP 63073587A JP 7358788 A JP7358788 A JP 7358788A JP 2558799 B2 JP2558799 B2 JP 2558799B2
Authority
JP
Japan
Prior art keywords
mantissa
bit
rounding
output
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP63073587A
Other languages
Japanese (ja)
Other versions
JPH01245328A (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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP63073587A priority Critical patent/JP2558799B2/en
Publication of JPH01245328A publication Critical patent/JPH01245328A/en
Application granted granted Critical
Publication of JP2558799B2 publication Critical patent/JP2558799B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 産業上の利用分野 本発明は浮動小数点演算において、演算結果の正規化
処理と丸め処理を行なう浮動小数点正規化丸め装置に関
するものである。
Description: BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a floating-point normalization rounding device that performs normalization processing and rounding processing on operation results in floating-point operations.

従来の技術 演算後に正規化とそれに続く丸め処理を行なう浮動小
数点演算では、正規化された仮数部を丸めた時点で仮数
部オーバーフローが発生する場合がある。この場合、さ
らに仮数部右シフト及び指数インクリメント操作による
補正が必要になり、高速演算の妨げとなる。そこでこの
補正を高速化することを実現した従来の浮動小数点正規
化丸め装置としては、例えば特開昭60−97436号公報に
示されている。本従来例は、正規化した結果が1.111・
・・11でありかつ丸めを行なう場合を検出し、この場
合、仮数部の丸めは実際には行なわず、別に設けたレジ
スタ内に予め設定した1.000・・・00を出力し、指数部
は実際に1インクリメントして補正を行なうものであ
る。
2. Description of the Related Art In a floating-point operation in which normalization and subsequent rounding processing are performed after operation, a mantissa overflow may occur when the normalized mantissa is rounded. In this case, correction by mantissa right shift and exponent increment operation is further required, which hinders high-speed calculation. Therefore, a conventional floating-point normalized rounding device that realizes the speedup of this correction is disclosed in, for example, Japanese Patent Laid-Open No. 60-97436. In this conventional example, the normalized result is 1.111.
Detects the case where 11 and rounding is performed, and in this case, rounding of the mantissa part is not actually performed, and 1.000 ... 00 set in advance in a separately provided register is output, and the exponent part is actually The correction is performed by incrementing by 1.

発明が解決しようとする課題 しかしながら本従来例では、補正が必要な場合を検出
した時、仮数部はすぐに補正結果が出力できるが、指数
部はこの時点からさらに補正演算が必要であり、また補
正結果の仮数1.000・・・00を格納しておくためのレジ
スタも必要である、という問題点を有していた。
However, in the conventional example, when the case where the correction is necessary is detected, the mantissa part can immediately output the correction result, but the exponent part needs further correction calculation from this point, and There is a problem in that a register for storing the mantissa 1.000 ... 00 of the correction result is also necessary.

本発明はかかる点に鑑み、ハードウェア規模が小さく
かつ処理速度の速い浮動小数点丸め正規化装置を提供す
ることを目的とする。
In view of the above point, the present invention has an object to provide a floating-point rounding normalization device having a small hardware scale and a high processing speed.

課題を解決するための手段 正規化されていない仮数部及びこれに対応する指数部
からなる浮動小数点数のうち、仮数部を入力とし正規化
に必要なシフト数を求める第1の手段と、前記仮数部を
入力とし、前記仮数部の正規化及びその後の丸め処理を
行なうと仮数部オーバーフローが発生することを検出す
る第2の手段と、前記第1の手段、前記第2の手段の出
力から、前記仮数部を丸めた状態で正規化数とするのに
必要なシフト数を決定しこれ出力する第3の手段と、前
記仮数部を入力とし、前記第3の手段の出力に従ってシ
フトを行なうシフト手段と、前記第3の手段の主力に従
って前記指数部を補正する補正手段と、前記シフト手段
の出力である仮数部に丸め処理を施す丸め手段とを備え
た演算装置である。
Means for Solving the Problem First means for obtaining a shift number necessary for normalization by inputting the mantissa part of a floating-point number consisting of an unnormalized mantissa part and a corresponding exponent part, From the outputs of the second means, the first means, and the second means that detect that a mantissa overflow occurs when the mantissa is input and the mantissa normalization and subsequent rounding processing are performed. , Third means for determining and outputting the number of shifts necessary for making the mantissa part a normalized number in a rounded state, and the mantissa part as an input, and shifting according to the output of the third means The arithmetic unit comprises a shift means, a correction means for correcting the exponent part according to the main force of the third means, and a rounding means for rounding the mantissa part which is the output of the shift means.

作用 本発明は前記した構成により、第1の手段で仮数正規
化に必要なシフト数をもとめ、シフト手段で仮数の正規
化を、補正手段で指数の補正を行ない、正規化された仮
数はさらに丸め手段で丸め処理を行なうが、丸めた結果
が仮数部オーバーフローとなる場合については、第2の
手段で予め検出しておき、第3の手段からは常に、丸め
手段の出力が正規化数となるのに必要なシフト数をシフ
ト手段に出力することができるものである。
With the above-described configuration, the present invention obtains the shift number required for mantissa normalization by the first means, normalizes the mantissa by the shift means, and corrects the exponent by the correction means. Rounding processing is performed by the rounding means, but when the rounded result is a mantissa overflow, it is detected by the second means in advance, and the output of the rounding means is always a normalized number from the third means. The number of shifts required to achieve the above can be output to the shift means.

実 施 例 第1図は本発明の一実施例のブロック図を示すもので
ある。本実施例の浮動小数点正規化丸め装置に入力され
る浮動小数点数のフォーマットを、第5図に示す。第5
図のフォーマットはIEEE P754規格に従って加減算さ
れ、次に正規化及び丸め処理を受ける単精度の浮動小数
点数であり、50は、バイアス表現された8ビットの指数
eu、51は、最上位ビットは21の重みをもつビット、最下
位側3ビットはガードビット(以下Guビットと記す)、
ラウンドビット(以下Ruビットと記す)、スティッキビ
ット(以下Suビットと記す)であり、28ビットの幅をも
つ仮数fuである。52は、仮数の符号を示す符号ビットで
あり、0で正数を、1で負数を示す。
Embodiment FIG. 1 shows a block diagram of an embodiment of the present invention. The format of the floating point number input to the floating point normalization rounding device of this embodiment is shown in FIG. Fifth
The format of the figure is a single-precision floating point number that is added and subtracted according to the IEEE P754 standard, and then subjected to normalization and rounding processing. 50 is a biased 8-bit exponent.
eu and 51, the most significant bit has a weight of 2 1 , the least significant 3 bits are guard bits (hereinafter referred to as Gu bits),
Round bits (hereinafter referred to as Ru bits), sticky bits (hereinafter referred to as Su bits), and a mantissa fu having a width of 28 bits. Reference numeral 52 is a sign bit indicating the sign of the mantissa, where 0 indicates a positive number and 1 indicates a negative number.

第1図において、10は、仮数fu51を入力として正規化
シフト処理を行なうバレルシフタであり、第6図に示し
た最上位ビットが20の重みをもつビット、最下位側3ビ
ットはガードビット(以下Gnビットと記す)、ラウンド
ビット(以下Rnビットと記す)、スティッキビット(以
下Snビットと記す)である仮数fn60を出力する。11は、
仮数fu51の21の重みを持つビットとGu、Ru、Suビットを
除く全てのビットを入力とし、第7図に示すように先行
する零の数をカウントしその結果αを2進数で出力する
先行零検出回路、12は、仮数fuの21を重みを持つビット
とGu、Ru、Suビットを除くビットパターンが第8図に示
すビットパターンである場合、パターンA検出信号を出
力するパターンA検出回路、13は、仮数fuの21の重みを
持つビットとGu、Ru、Suビットを除くビットパターンが
第9図に示すビットパターンである場合、パターンB検
出信号を出力するパターンB検出回路、14は、先行零検
出回路11、パターンA検出回路12、パターンB検出回路
13の出力、仮数fu51の21を重みを持つビット、仮数fu51
の符号ビット52、Gu、Ru、Suビット、外部から与えられ
る丸めモード信号から、第10図に示す関係をもつ制御信
号L16、L8、L4、L2、L1、R1、CMP、Cを出力する制御回
路、15は、バレルシフタ10の出力である仮数fn60の、2
-23の重みを持つビット、Gn、Rn、Snビット、仮数fu51
の符号ビット52、外部から与えられる丸めモード信号を
入力とし、IEEE P754規格に基づき、第11図に示す関係
で丸め信号を出力する丸め判定回路である。16は、バレ
ルシフタ10出力である仮数fn60の、20から2-23の重みを
もつビットに、丸め判定回路15の出力を2-23の重みをも
つビットとして加算し、丸めを行なう加算器であり、第
12図に示した少なくとも20の重みを持つビットが1であ
る正規化仮数fr19を出力する。17は、制御回路14の出力
のCMPが1の時、同じく制御回路14の出力のL16、L8、L
4、L2、L1をインバートするコンプリメンタ、18は、制
御回路14の出力のCを最下位へのキャリ入力とし、指数
eu50とコンプリメンタ17の出力の加算を行なう加算器で
あり、補正された指数er20を出力する。
In Figure 1, 10 is a barrel shifter for performing a normalization shift processing mantissa fu51 as input, bits most significant bits as shown in FIG. 6 has a weight of 2 0, least significant three bits guard bits ( The mantissa fn60, which is a Gn bit), a round bit (hereinafter Rn bit), and a sticky bit (hereinafter Sn bit), is output. 11 is
All the bits except the Gu, Ru, and Su bits of mantissa fu51 having a weight of 2 1 are input, the number of leading zeros is counted, and α is output in binary as shown in FIG. 7. The leading zero detection circuit 12 outputs a pattern A detection signal when the bit pattern excluding the bits having the mantissa fu 2 1 of weight 2 and the Gu, Ru, and Su bits is the bit pattern shown in FIG. The detection circuit 13 outputs a pattern B detection signal when the bit pattern excluding the bits of mantissa fu having a weight of 2 1 and the Gu, Ru, and Su bits is the bit pattern shown in FIG. , 14 are leading zero detection circuit 11, pattern A detection circuit 12, pattern B detection circuit
13 output, mantissa fu51 2 1 1 bits with weight, mantissa fu51
Control to output control signals L16, L8, L4, L2, L1, R1, CMP, C having the relationship shown in FIG. 10 from the sign bits 52, Gu, Ru, Su bits of R, and the rounding mode signal given from the outside. The circuit, 15 is the output of the barrel shifter 10, the mantissa fn60, 2
-23 bits with weight, Gn, Rn, Sn bits, mantissa fu51
Is a rounding determination circuit that inputs the sign bit 52 of the rounding mode signal given from the outside and outputs the rounding signal in the relationship shown in FIG. 11 based on the IEEE P754 standard. 16, the mantissa fn60 a barrel shifter 10 outputs, to the bit having the weight of 2 0 to 2 -23, adds the outputs of the rounding decision circuit 15 as a bit having the weight of 2 -23, an adder for performing rounding Yes, first
Bit with at least 2 0 weight shown in FIG. 12 outputs a normalized mantissa fr19 1. 17 is the output L16, L8, L of the control circuit 14 when CMP of the output of the control circuit 14 is 1.
A complementer that inverts 4, L2, and L1, and 18 uses C of the output of the control circuit 14 as a carry input to the lowest order, and an exponent.
It is an adder that adds eu50 and the output of the complementer 17, and outputs the corrected exponent er20.

第2図は、バレルシフタ10の構造を示すブロック図で
ある。第2図において20は仮数fu51の21から2-23の重み
を持つビット、Gu、Ruビットを入力とし制御回路14の出
力R1が1の時、右1ビットシフトを行なう右1ビットシ
フタ、21、22、23、24、25は、制御回路14の出力L1、L
2、L4、L8、L16が1の時それぞれ左1、2、4、8、16
ビットシフトを行なうシフタ、26は、左1ビットシフタ
20で右1ビットシフトを行なった時、シフトアウトされ
る1ビットと仮数fu51のSuビットの論理和をとり、新た
なスティッキビットであるSnビットを生成する論理和ゲ
ートである。
FIG. 2 is a block diagram showing the structure of the barrel shifter 10. In FIG. 2, reference numeral 20 is a right 1-bit shifter for performing right 1-bit shift when the bit R having a weight of 2 1 to 2 -23 of mantissa fu51, Gu, Ru bits is input and the output R1 of the control circuit 14 is 1, 21 , 22, 23, 24, 25 are the outputs L1, L of the control circuit 14.
When 2, L4, L8, L16 are 1, left 1, 2, 4, 8, 16 respectively
Shifter for bit shift, 26 is left 1-bit shifter
It is a logical sum gate that, when a right 1 bit shift is performed at 20, logically sums the shifted out 1 bit and the Su bit of the mantissa fu51 to generate a new sticky bit Sn bit.

第3図はパターンA検出回路の論理図である。第3図
において、300から323は排他的論理和ゲートであり、20
から2-23の重みを持つ入力信号の夫々のビットが第8図
に示したビットに一致するか否かを検出し、全て一致し
た場合は論理積ゲート31出力のパターンA検出信号が1
となる。
FIG. 3 is a logic diagram of the pattern A detection circuit. In FIG. 3, 300 from 323 are exclusive OR gates, 2 0
It is detected whether or not each bit of the input signal having a weight of 2 to 23 coincides with the bit shown in FIG. 8, and if all coincide, the pattern A detection signal of the AND gate 31 output is 1
Becomes

第4図はパターンB検出回路の論理図である。第4図
において400から423は排他的論理和ゲートであり、20
ら2-23の重みを持つ入力信号の夫々のビットが第9図に
示したビットに一致するか否かを検出し、全て一致した
場合は論理積ゲート41出力のパターンB検出信号が1と
なる。
FIG. 4 is a logic diagram of the pattern B detection circuit. In 400 from 423 Figure 4 is an exclusive OR gate, bit of each of the input signals with the 2 0 2 -23 weight detects whether matching bits shown in FIG. 9, When all match, the pattern B detection signal of the output of the AND gate 41 becomes 1.

以上のように構成された浮動小数点正規化丸め装置に
ついて、その動作を説明する。動作の大筋の流れは、正
規化と丸め処理を行なう仮数fu51をバレルシフタ10と先
行零検出回路11に入力し、先行零検出回路11で求めたビ
ット数に従ってバレルシフタ10では仮数fuの正規化シフ
ト、加算器18では指数euの補正を行ない、さらに丸め判
定回路15で丸め処理が必要か否かを判定しその結果に基
づき、加算器16で丸め処理を行なうものである。そして
さらに、正規化された仮数を丸めると仮数がオーバーフ
ローする場合を、パターンA検出回路12、パターンB検
出回路13の出力、仮数fu51のGu、Ru、Suビットをもとに
制御回路14で検出し、バレルシフタ10のシフト数を制御
回路14で制御することで、仮数部オーバーフローを防止
している。また丸め方法については、IEEE P754規定に
定められたものに従っているが、説明の簡単化のため以
下では最近値丸めモード(RNモードと記す)について説
明する。しかし、第1図に示した浮動小数点正規化丸め
装置は、規定で定められた全ての丸めモードに対応して
いる。ここでRNモードとは第11図に示すように基本的に
バレルシフタ10で正規化された仮数fn60のGnビットが1
の時、仮数fn60の2-23の重みをもつビットに1を加えて
丸めを行なう丸め方法である。
The operation of the floating-point normalized rounding device configured as above will be described. The main flow of operation is to input a mantissa fu51 for normalization and rounding to the barrel shifter 10 and the leading zero detection circuit 11, and according to the number of bits obtained by the leading zero detection circuit 11, the normalized shift of the mantissa fu in the barrel shifter 10, The adder 18 corrects the exponent eu, and the rounding determination circuit 15 determines whether rounding processing is necessary. Based on the result, the adder 16 performs the rounding processing. Further, when the mantissa overflows when the normalized mantissa is rounded, the control circuit 14 detects the output of the pattern A detection circuit 12 and the pattern B detection circuit 13 and the Gu, Ru, and Su bits of the mantissa fu51. However, by controlling the shift number of the barrel shifter 10 by the control circuit 14, the mantissa part overflow is prevented. Also, the rounding method is in accordance with the one defined in the IEEE P754 standard, but in order to simplify the description, the nearest rounding mode (described as RN mode) will be described below. However, the floating point normalized rounding device shown in FIG. 1 is compatible with all rounding modes defined in the regulations. Here, the RN mode is basically that the Gn bit of the mantissa fn60 normalized by the barrel shifter 10 is 1 as shown in FIG.
At the time of, the rounding method is to add 1 to the bit of the mantissa fn60 having the weight of 2 -23 to perform rounding.

本実施例の動作は、正規化のためバレルシフタ10に入
力される仮数fu51とビットパターンにより次の4つに分
類できる。
The operation of this embodiment can be classified into the following four types according to the mantissa fu51 and bit pattern input to the barrel shifter 10 for normalization.

1)21の重みを持つビットが1の場合。1) When the bit with a weight of 2 1 is 1.

制御回路14は第10図のタイプ1と記した行の制御信号
を出力する。すなわちR1=1によりバレルシフタ10で仮
数fu51の右1ビットシフトを行ない、C=1により加算
器18で指数eu50に1を加え指数補正を行なう。ここでシ
フト結果がGnビットを含めて全て1である第13図に示す
ものになる事はない。何故なら、このような数の右1ビ
ットシフト前の状態は第14図に示すものであるが、この
ビットパターンは、 N1=22−2-23 である数N1を示している。一方、24ビットで表現できる
最大数を加算した場合でもその結果N2は、 N2=(21−2-23)+(21−2-23)=22−2-22 であり、 N1>N2 が成り立つ。すなわち第14図に示した数は存在しない。
すなわち、右シフト後のGnビットが1である数は存在せ
ず、従って丸め判定回路15の出力は0、加算器16の加算
は0との加算となり、仮数オーバーフローが発生するこ
とはない。
The control circuit 14 outputs the control signal of the row marked Type 1 in FIG. That is, when R1 = 1, the barrel shifter 10 shifts the mantissa fu51 to the right by 1 bit, and when C = 1, the adder 18 adds 1 to the exponent eu50 to perform exponential correction. Here, the shift result does not become the one shown in FIG. 13 in which all are 1 including Gn bits. This is because the state before shifting such a number to the right by one bit is as shown in FIG. 14, but this bit pattern shows the number N1 where N1 = 2 2 −2 −23 . On the other hand, even if the maximum number that can be represented by 24 bits is added, the result N2 is N2 = (2 1-2 -23 ) + (2 1-2 -23 ) = 2 2-22 -22 , and N1> N2 holds. That is, the numbers shown in FIG. 14 do not exist.
That is, there is no number whose Gn bit is 1 after the right shift, and therefore the output of the rounding determination circuit 15 is 0 and the addition of the adder 16 is 0, and mantissa overflow does not occur.

2)20の重みを持つビットからGuビットが全て1の場
合。
2) If the bit having the weight of 2 0 Gu bits are all 1.

第15図に示したこの数は、パターンA検出回路とGuビ
ットでにより制御回路14で検出される。そして制御回路
14は第10図のタイプ2と記した行の制御信号を出力す
る。すなわちR1=1によりバレルシフタ10で右1ビット
シフトを行ない、C=1により加算器18で指数euに1を
加える。
This number shown in FIG. 15 is detected by the control circuit 14 by the pattern A detection circuit and the Gu bit. And the control circuit
Reference numeral 14 outputs the control signal of the row marked Type 2 in FIG. That is, when R1 = 1, the barrel shifter 10 shifts right one bit, and when C = 1, the adder 18 adds 1 to the exponent eu.

ここで右1ビットシフトを行なう理由は次の通りであ
る。このパターンの数は第15図に示したように、Guビッ
トが1であることから丸め処理を行なうが、その結果は
オーバーフローが発生し、第16図に示したような21の重
みを持つビットのみが1である仮数となってしまい再び
右シフトが必要になる。しかし仮数fu51をバレルシフタ
10で予め右1ビットシフトを行なっておくと、シフト結
果は第17図に示すようにGnビットが1である数となる。
そこで丸め判定回路15の出力は1となりシフトしない場
合と同様に、加算器16で1との加算が行なわれるが、オ
ーバーフローは発生せず、第18図に示したような20の重
みを持つビットのみが1である正規化された仮数fr19が
得られる。
The reason why the right one bit shift is performed is as follows. As shown in FIG. 15, the number of this pattern is rounded because the Gu bit is 1, but as a result, an overflow occurs and the weight has a weight of 2 1 as shown in FIG. The mantissa has only one bit, which requires a right shift again. But mantissa fu51 is barrel shifter
If the right 1-bit shift is performed in advance in step 10, the shift result will be a number in which the Gn bit is 1, as shown in FIG.
Therefore rounded as in the case where no 1 next shift output of the decision circuit 15, but the addition of 1 in adder 16 is performed, the overflow does not occur, with a 2 0 weight as shown in FIG. 18 A normalized mantissa fr19 with only one bit is obtained.

3)少なくとも20、2-1の重みをもつビットが0である
場合。
3) The bit having a weight of at least 2 0 and 2 -1 is 0.

この場合は正規化に必要なシフト数が先行零検出回路
11で得られ、制御回路14は第10図のタイプ3と記した行
の制御信号を出力する。すなわち先行零検出回路11で第
7図に従って得られた数αはそのまま、 α=L16・24+L8・23+L4・22+L2・21+L1・20 の関係を持つ、L16、L8、L4、L2、L1信号として出力さ
れる。そして制御信号L1、L2、L4、L8、L16は対応する
左シフタ21〜25を動作させ仮数fuの左シフトを行ない正
規化された仮数fn60を出力する。また、指数の補正eu−
αは、制御信号CMPでコンプリメンタ17を動作させαの
1の補数をとりさらに、制御信号C=1により最下位ビ
ットに1を加えることで加算器18で処理する。
In this case, the number of shifts required for normalization is the leading zero detection circuit.
11, the control circuit 14 outputs the control signal of the row labeled type 3 in FIG. That is, the number α obtained according to FIG. 7 in the leading zero detection circuit 11 remains as it is, L = L16 · 2 4 + L8 · 2 3 + L4 · 2 2 + L2 · 2 1 + L1 · 2 0 , L16, L8, It is output as L4, L2, and L1 signals. Then, the control signals L1, L2, L4, L8 and L16 operate the corresponding left shifters 21 to 25 to shift the mantissa fu to the left and output the normalized mantissa fn60. Also, the correction of the index eu−
The α is processed by the adder 18 by operating the complementer 17 with the control signal CMP, taking the 1's complement of α, and adding 1 to the least significant bit by the control signal C = 1.

正規化された仮数fnは、さらに丸め判定回路15及び加
算器16で丸め処理が施されるが、少なくとも左2ビット
シフトが行なわれているのでGnビットは常に0であり、
加算器16では0との加算が行なわれ、仮数オーバーフロ
ーが発生することはない。
The normalized mantissa fn is further rounded by the rounding decision circuit 15 and the adder 16, but since the left two bits are shifted at least, the Gn bit is always 0,
The adder 16 performs addition with 0, and mantissa overflow does not occur.

4)20の重みを持つビットが0、2-1の重みを持つビッ
トからRuビットまで全て1の場合。
4) If all the bits having the weights of bits 0,2 -1 with a weight of 2 0 and Ru bits 1.

第19図に示したこの数は、パターンB検出回路13とG
u、Ruビットから制御回路14で検出される。そして制御
回路14は第10図のタイプ4と記した行の制御信号を出力
する。すなわち仮数の正規化も、指数の補正もしない。
そこでバレルシフタ10から出力された仮数fn60のGnビッ
トは第19図に示すように1であることから、加算器16で
必ず丸め処理が行なわれ、第18図に示した20の重みを持
つビットだけが1である仮数fr19が得られる。
This number shown in FIG. 19 corresponds to the pattern B detection circuit 13 and G
The control circuit 14 detects the u and Ru bits. Then, the control circuit 14 outputs the control signal of the row marked Type 4 in FIG. That is, neither mantissa normalization nor exponent correction is performed.
So since the Gn-bit mantissa fn60 output is 1 as shown in FIG. 19 from the barrel shifter 10, always rounding the adder 16 is performed, bits having a 2 0 weight shown in FIG. 18 We get the mantissa fr19, which is only 1.

ここで、仮数fuをバレルシフタ10で左1ビットシフト
し正規化しない理由は次の通りである。第19図に示した
数を左1ビットシフトして正規化すると、第20図に示し
た数となる。しかしこの数のGnビットは1であることか
ら、加算器16で必ず丸め処理が行なわれ仮数fr19は、第
16図に示した21の重みを持つビットだけが1であるオー
バーフローした数となり、再び右1ビットシフトが必要
となる。
Here, the reason why the mantissa fu is shifted left 1 bit by the barrel shifter 10 and is not normalized is as follows. When the numbers shown in FIG. 19 are shifted to the left by 1 bit and normalized, the numbers shown in FIG. 20 are obtained. However, since the Gn bit of this number is 1, rounding is always performed in the adder 16, and the mantissa fr19 is
Only the bit with the weight of 2 1 shown in Fig. 16 becomes the overflowed number which is 1, and the right 1 bit shift is necessary again.

以上のように本実施例に発明によれば、パターンA検
出回路12、パターンB検出回路13、制御回路14を設け、
正規化及びその後の丸め処理の両処理を行なった時点で
仮数部オーバーフローが発生する場合を制御回路14で予
め検出しておき、制御回路14でバレルシフタ10でのシフ
ト数を制御することで、加算器16で丸めを行なった結果
を常に正規化数とすることができる。また、指数の補正
も仮数の丸めと並行して加算器18での1回の加減算で処
理することができる。さらに、これらの処理の実現に必
要な新たなハードウェアは、パターンA検出回路12、パ
ターンB検出回路13、制御回路14、だけでありこれらは
簡単な組合せ回路で構成することができる。
As described above, according to the present invention, the pattern A detection circuit 12, the pattern B detection circuit 13, and the control circuit 14 are provided,
The case where a mantissa overflow occurs at the time of performing both normalization and subsequent rounding processing is detected in advance by the control circuit 14, and the control circuit 14 controls the number of shifts in the barrel shifter 10 to add. The result of rounding by the device 16 can always be a normalized number. Further, the correction of the exponent can be processed by one addition / subtraction in the adder 18 in parallel with the rounding of the mantissa. Furthermore, the only new hardware required to implement these processes is the pattern A detection circuit 12, the pattern B detection circuit 13, and the control circuit 14, and these can be configured by a simple combinational circuit.

発明の効果 以上説明したように本発明によれば、仮数の正規化処
理と丸め処理を一体として制御し、丸めた結果の仮数部
がオーバーフローする場合は正規化処理を調整すること
で、これを未然に防ぐことができる。しかも仮数の正規
化処理及び丸め処理と、指数の補正処理は並行して処理
することができ、仮数、指数をほぼ同時に得ることがで
き、その実用的効果は大きい。
As described above, according to the present invention, the normalization process and the rounding process of the mantissa are integrally controlled, and when the mantissa part of the rounded result overflows, the normalization process is adjusted to adjust the normalization process. It can be prevented. In addition, the mantissa normalization process and the rounding process and the exponent correction process can be processed in parallel, and the mantissa and the exponent can be obtained almost at the same time, which has a large practical effect.

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

第1図は本発明の一実施例における浮動小数点正規化丸
め装置のブロック図、第2図はバレルシフタのブロック
図、第3図はパターンA検出回路の論理図、第4図はパ
ターンB検出回路の論理図、第5図は本装置へ入力され
る浮動小数点数のフォーマットを示すパターン図、第6
図はバレルシフタ出力のフォーマットを示すパターン
図、第7図は先行零検出回路の入出力関係図、第8図は
パターンA検出回路で検出するビットパターンを示すパ
ターン図、第9図はパターンB検出回路で検出するビッ
トパターンを示すパターン図、第10図は制御回路の入出
力関係図、第11図は丸め判定回路の入出力図、第12図は
丸められた仮数のフォーマットを示すパターン図、第13
図から第20図は正規化処理あるいは丸め処理された仮数
のビッドパターンを示すパター図である。 10……バレルシフタ、11……先行零検出回路、 12……パターンA検出回路、 13……パターンB検出回路、14……制御回路、 15……丸め判定回路、16……加算器、 17……コンプリメンタ、18……加算器。
FIG. 1 is a block diagram of a floating-point normalized rounding device according to an embodiment of the present invention, FIG. 2 is a block diagram of a barrel shifter, FIG. 3 is a logic diagram of a pattern A detection circuit, and FIG. 4 is a pattern B detection circuit. FIG. 5 is a pattern diagram showing the format of a floating point number input to this device, FIG.
FIG. 7 is a pattern diagram showing the format of the barrel shifter output, FIG. 7 is an input / output relationship diagram of the leading zero detection circuit, FIG. 8 is a pattern diagram showing a bit pattern detected by the pattern A detection circuit, and FIG. 9 is a pattern B detection. FIG. 10 is a pattern diagram showing a bit pattern detected by the circuit, FIG. 10 is an input / output relationship diagram of the control circuit, FIG. 11 is an input / output diagram of the rounding judgment circuit, and FIG. 12 is a pattern diagram showing a format of a rounded mantissa. Thirteenth
FIG. 20 to FIG. 20 are pattern diagrams showing a mantissa bid pattern that has been normalized or rounded. 10 ... Barrel shifter, 11 ... Leading zero detection circuit, 12 ... Pattern A detection circuit, 13 ... Pattern B detection circuit, 14 ... Control circuit, 15 ... Rounding judgment circuit, 16 ... Adder, 17 ... … Complementer, 18 …… Adder.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】正規化されていない仮数部及びこれに対応
する指数部と符号部からなる浮動小数点数のうち、仮数
部を入力とし正規化に必要なシフト数を求める第1の手
段と、前記仮数部を入力とし、前記仮数部の正規化及び
その後の丸め処理を行なうと仮数部オーバーフローが発
生する可能性のあるビットパターン群を検出する第2の
手段と、前記第1の手段、前記第2の手段の出力と前記
仮数部の一部のビットとを少なくとも入力とし、前記仮
数部を丸めた状態で正規化数とするのに必要なシフト数
を決定しこれを出力する第3の手段と、前記仮数部を入
力とし、前記第3の手段の出力に従ってシフトを行うシ
フト手段と、前記第3の手段の出力に従って前記指数部
を補正する補正手段と、前記シフト手段の出力である仮
数部に丸め処理を施す丸め手段とから構成されることを
特徴とする浮動小数点正規化丸め装置。
1. A first means for obtaining a shift number required for normalization, by inputting a mantissa part of a floating point number consisting of an unnormalized mantissa part and a corresponding exponent part and sign part. Second means for detecting a bit pattern group that may cause a mantissa overflow when the mantissa is input and the mantissa normalization and subsequent rounding processing are performed; the first means; At least the output of the second means and a part of the bits of the mantissa part are input, and the shift number necessary for making the mantissa part a normalized number in a rounded state is determined and output. Means, shift means for inputting the mantissa part and shifting according to the output of the third means, correction means for correcting the exponent part according to the output of the third means, and output of the shift means. Rounding the mantissa part Floating-point normalized rounding apparatus, characterized in that it is composed of a to rounding means.
JP63073587A 1988-03-28 1988-03-28 Floating point normalized rounding device Expired - Fee Related JP2558799B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63073587A JP2558799B2 (en) 1988-03-28 1988-03-28 Floating point normalized rounding device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63073587A JP2558799B2 (en) 1988-03-28 1988-03-28 Floating point normalized rounding device

Publications (2)

Publication Number Publication Date
JPH01245328A JPH01245328A (en) 1989-09-29
JP2558799B2 true JP2558799B2 (en) 1996-11-27

Family

ID=13522592

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63073587A Expired - Fee Related JP2558799B2 (en) 1988-03-28 1988-03-28 Floating point normalized rounding device

Country Status (1)

Country Link
JP (1) JP2558799B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100465371B1 (en) * 2001-01-26 2005-01-13 학교법인연세대학교 apparatus and method for design of the floating point ALU performing addition and round operations in parallel

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0616961B2 (en) * 1986-03-11 1994-03-09 住友電気工業株式会社 Processing method of thin-walled cylinder made of fiber reinforced plastics
JPS62245433A (en) * 1986-04-18 1987-10-26 Oki Electric Ind Co Ltd Floating point arithmetic circuit

Also Published As

Publication number Publication date
JPH01245328A (en) 1989-09-29

Similar Documents

Publication Publication Date Title
EP0973089B1 (en) Method and apparatus for computing floating point data
US5568412A (en) Rounding-off method and apparatus of floating point arithmetic apparatus for addition/subtraction
EP0483864B1 (en) Hardware arrangement for floating-point addition and subtraction
US4758972A (en) Precision rounding in a floating point arithmetic unit
US5027308A (en) Circuit for adding/subtracting two floating point operands
US8185570B2 (en) Three-term input floating-point adder-subtractor
US5128889A (en) Floating-point arithmetic apparatus with compensation for mantissa truncation
US4922446A (en) Apparatus and method for floating point normalization prediction
US5010508A (en) Prenormalization for a floating-point adder
EP0381403A2 (en) Pipelined floating point adder for digital computer
US5136536A (en) Floating-point ALU with parallel paths
JPH0695851A (en) Method and device for accurate prediction of preceding zero for floating point adder
JPH05324270A (en) Method and device for converting format for floating point number
US7437400B2 (en) Data processing apparatus and method for performing floating point addition
US20070038693A1 (en) Method and Processor for Performing a Floating-Point Instruction Within a Processor
JPH09204295A (en) Sticky bit detecting circuit
JP2558799B2 (en) Floating point normalized rounding device
US5432727A (en) Apparatus for computing a sticky bit for a floating point arithmetic unit
KR101922462B1 (en) A data processing apparatus and method for performing a shift function on a binary number
JP2919386B2 (en) Floating-point detector and floating-point detector
JPH09114641A (en) Apparatus and method for decision of most significant digit
JP2517064B2 (en) Denormalized number processing method
US7386580B2 (en) Data processing apparatus and method for computing an absolute difference between first and second data elements
JP3174974B2 (en) Floating point arithmetic device and method
JP2723707B2 (en) Normalization circuit

Legal Events

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