JPH03100723A - Processing system for accuracy conversion instruction - Google Patents
Processing system for accuracy conversion instructionInfo
- Publication number
- JPH03100723A JPH03100723A JP1238214A JP23821489A JPH03100723A JP H03100723 A JPH03100723 A JP H03100723A JP 1238214 A JP1238214 A JP 1238214A JP 23821489 A JP23821489 A JP 23821489A JP H03100723 A JPH03100723 A JP H03100723A
- Authority
- JP
- Japan
- Prior art keywords
- conversion
- exponent
- processing
- bits
- format
- 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
Links
Abstract
Description
【発明の詳細な説明】
〔概 要〕
浮動小数点演算処理装置において、浮動小数点数の精度
形式を変換する精度変換命令の処理方式に関し。DETAILED DESCRIPTION OF THE INVENTION [Summary] The present invention relates to a method for processing a precision conversion instruction for converting the precision format of a floating point number in a floating point arithmetic processing device.
浮動小数点数の精度形式の変換処理を簡単化し。Simplifies the process of converting precision formats for floating point numbers.
処理の高速化を図ることを目的とし。The purpose is to speed up processing.
ある精度形式で表現された浮動小数点数を他の精度形式
の浮動小数点数へ変換する精度変換命令を処理する場合
であって仮数部のビット数が変換前の形式よりも少ない
ような形式への変換を行うときには、仮数部の余分な下
位ビットを切り上げるかあるいは切り捨てる丸め処理お
よび丸め処理結果の正規化処理を含む前処理を実行し、
この前処理結果を使用して実際の変換処理を行うように
構成した。When processing a precision conversion instruction that converts a floating point number expressed in one precision format to a floating point number in another precision format, and the number of bits in the mantissa is smaller than the format before conversion. When performing the conversion, preprocessing is performed including rounding up or down to round up or truncate the extra lower bits of the mantissa and normalization of the rounding result;
This preprocessing result is used to perform the actual conversion process.
本発明は、浮動小数点演算処理装置において。 The present invention relates to a floating point arithmetic processing device.
浮動小数点数の精度形式を変換する精度変換命令の処理
方式に関する。This paper relates to a method for processing precision conversion instructions that convert precision formats of floating point numbers.
ある浮動小数点数を1ビットの符号部S、mビットの指
数部E、およびnビットの指数部Fで表現し、また、仮
数部のビット数、つまり表現できる有効桁数のビット数
の違いによって単精度形式。A floating point number is expressed by a 1-bit sign part S, an m-bit exponent part E, and an n-bit exponent part F, and also by the difference in the number of bits of the mantissa part, that is, the number of significant digits that can be expressed. Single precision format.
倍精度形式、拡張精度形式といった複数の浮動小数点デ
ータ形式を扱う浮動小数点演算処理装置が従来から広く
使われている。Floating point arithmetic processing devices that handle multiple floating point data formats such as double precision format and extended precision format have been widely used.
従来は単精度形式1倍精度形式、拡張精度形式のいずれ
の形式においても、指数部Eのビット数は同じであり、
仮数部Fのビット数が異なるだけの浮動小数点表現形式
が広く用いられていた。従って9例えば倍精度形式で表
現された浮動小数点数を単精度形式の浮動小数点数に変
換するといった精度変換命令を処理する場合は、基本的
に仮数部のビット数を変換先のビット数に合わせる処理
だけを行えばよかった。Conventionally, the number of bits in the exponent part E is the same in both single-precision format, double-precision format, and extended-precision format.
Floating point representation formats in which the number of bits of the mantissa part F differed were widely used. Therefore, for example, when processing a precision conversion instruction such as converting a floating point number expressed in double precision format to a floating point number in single precision format, the number of bits in the mantissa is basically adjusted to the number of bits in the destination. All I had to do was process it.
近年、仮数部のビット数が多くなるにつれて指数部のビ
ット数も増えるような精度形式を用いる浮動小数点表現
形式がIEEE標準規格として提唱され、これに準拠し
た浮動小数点表現形式を扱う浮動小数点演算処理装置が
増えつつある。In recent years, a floating point representation format that uses a precision format in which the number of bits in the exponent part increases as the number of bits in the mantissa increases, has been proposed as an IEEE standard, and floating point arithmetic processing that handles floating point representation formats based on this has been proposed. The number of devices is increasing.
IEEE標準規格あるいはこれに準拠した浮動小数点表
現形式を扱う浮動小数点演算処理装置では、浮動小数点
数Xは1ビットの符号部S、 mビットの指数部E、お
よびnビットの仮数部Fによって表現され、指数部Eの
値は実際の指数値eに所定の指数バイアス値を加算した
ものである。−般にバイアス価としては2 (@1−1
1 −1が用いられている。In a floating-point arithmetic processing unit that handles the IEEE standard or a floating-point representation format that conforms to it, a floating-point number X is represented by a 1-bit sign S, an m-bit exponent E, and an n-bit mantissa F. , the value of the exponent part E is the actual exponent value e plus a predetermined exponent bias value. -Generally, the bias value is 2 (@1-1
1-1 is used.
Xが正規化浮動小数点数の場合には、Xは次式で示され
る値を表しでいる。When X is a normalized floating point number, X represents the value shown by the following equation.
X= (−1)’ x 1 、 f+ f宜
fs ・ f、 X2”ここで有効数字の小数
点以下のflb h・・・f。X= (-1)' x 1, f+ f
fs・f,
は仮数部Fを構成する2進数のビット列である。is a binary bit string forming the mantissa part F.
また有効数字の最上位ビット(整数部)は、正規化数で
あれば1であることが暗黙に仮定される。Further, it is implicitly assumed that the most significant bit (integer part) of the significant digits is 1 if it is a normalized number.
従って、実際の有効数字はn+tビットとなる。Therefore, the actual significant digits are n+t bits.
このような浮動小数点表現形式を扱う浮動小数点演算処
理装置において、ある精度形式で表現された浮動小数点
数を他の形式に変換するような形式変換命令を処理する
場合には仮数部のビット数を変換先の形式に合わせる処
理だけでなく指数部も変換先の形式に変換する処理が必
要となる。In a floating-point arithmetic processing unit that handles such floating-point representation formats, when processing a format conversion instruction that converts a floating-point number expressed in a certain precision format to another format, the number of bits in the mantissa is In addition to processing to match the format of the conversion destination, processing to convert the exponent part to the format of the conversion destination is also required.
仮数部の変換処理は5変換先の仮数部のビット数の方が
多い場合は不足するビット数だけゼロを付加し、変換先
の仮数部のビット数の方が少ない場合には余分な下位ビ
ットを切り捨であるいは切り上げることによって行われ
る。The conversion process for the mantissa part is 5. If the number of bits in the mantissa part of the destination part is greater than the number of bits in the mantissa part, zeros are added for the missing number of bits, and if the number of bits in the mantissa part of the destination part is less than the number of bits, the extra lower bits are added. This is done by rounding down or rounding up.
また、指数部の変換処理は、変換前の形式でのバイアス
値を指数部から減算して、変換先の形式でのバイアス値
を加算するか、それらの差分をあらかじめ用意しておき
変換前の指数部に加算あるいは減算することによって行
うことができる。To convert the exponent part, either subtract the bias value in the pre-conversion format from the exponent part and add the bias value in the destination format, or prepare the difference in advance and convert it to the exponent part. This can be done by adding or subtracting from the exponent part.
変換先の形式での指数部のビット数が変換前の形式での
指数部のビット数よりも少ないような形式への変換を行
う場合には、変換結果が変換先の指数部で表現可能な最
大値より大きくなり指数オーバフローとなるか、あるい
は変換先の指数部で表現できる最小値より小さくなり指
数アンダフローとなることがある。このような場合には
必要であればバイアス調整が行われる。When converting to a format where the number of bits in the exponent part in the destination format is less than the number of bits in the exponent part in the format before conversion, the conversion result must be expressible in the exponent part in the destination format. It may become larger than the maximum value, resulting in exponent overflow, or it may become smaller than the minimum value that can be expressed by the exponent part of the conversion destination, resulting in exponent underflow. In such a case, bias adjustment is performed if necessary.
バイアス調整とは指数オーバフロー状態の指数値から所
定のバイアス調整値を減算するか、あるいは指数アンダ
フロー状態の指数値に所定のバイアス調整値を加算する
ことによって変換先の指数部で表現できる指数値に変換
する処理である。バイアス調整値は一般に3 X 21
m−!l が用いられている。Bias adjustment is an exponent value that can be expressed in the destination exponent part by subtracting a predetermined bias adjustment value from an exponent value in an exponent overflow state, or by adding a predetermined bias adjustment value to an exponent value in an exponent underflow state. This is the process of converting it into Bias adjustment value is generally 3 x 21
m-! l is used.
単精度形式と倍精度形式の標準的なm、nの値。Standard m, n values for single-precision and double-precision formats.
指数バイアス値、およびバイアス調整値を以下に示す。The index bias value and bias adjustment value are shown below.
単精度形式 m−8,n−23
指数バイアス値−127
バイアス調整値−192
倍精度形式 m−11,n=52
指数バイアス値−1023
バイアス調整値−1536
また、IEEE標準規格では指数部の最大値(指数部の
全てのビットが1)と最小値(指数部の全てのビットが
O)は、非数(数値でないデータ)や無限大数のような
特殊なデータや、不正規化数、ゼロといった正規化数以
外の数値を表現するために予約されている。従って、上
記の標準的なm、 nの値を使用した場合の単精度形
式および倍精度形式の指数部が表現できる実際の指数値
eの範囲は次のようになる。Single precision format m-8, n-23 Exponential bias value - 127 Bias adjustment value - 192 Double precision format m-11, n = 52 Exponential bias value - 1023 Bias adjustment value - 1536 Also, in the IEEE standard, the maximum of the exponent part The value (all bits in the exponent part are 1) and the minimum value (all bits in the exponent part are O) are special data such as non-numbers (data that is not numerical values) and infinite numbers, unnormalized numbers, Reserved to represent numbers other than normalized numbers, such as zero. Therefore, the range of actual exponent values e that can be expressed by the exponent part in single-precision format and double-precision format when using the above standard values of m and n is as follows.
単精度形式 −126〜+127
倍精度形式 −1022〜+1023
ここで9例えば倍精度形式の浮動小数点数を単精度形式
に変換する場合、指数値が一320以上のときは指数オ
ーバフローが発生し、しかもバイアス調整を行っても単
精度形式の指数部で表現することができない、また指数
値が一319以下のときは指数アンダフローが発生し、
しかもバイアス調整を行っても単精度形式の指数部で表
現することができない、このようにバイアス調整を行っ
ても変換先の指数部で表現できない場合には、−船釣に
は非数のような特殊なデータを結果としている。Single precision format -126 to +127 Double precision format -1022 to +1023 Here 9 For example, when converting a floating point number in double precision format to single precision format, if the exponent value is 1320 or more, exponent overflow will occur, and Even if bias adjustment is performed, the exponent cannot be expressed in single-precision format, and when the exponent value is less than 1319, exponent underflow occurs.
Moreover, even if the bias is adjusted, it cannot be expressed in the exponent part of the single-precision format.If the exponent part of the conversion destination cannot be expressed even if the bias adjustment is made in this way, then - The result is special data.
また、仮数部の余分な下位ビットを切り上げによって丸
める処理が選択される場合には、切り上げによる有効数
字への加算処理によって有効数字の最上位ビットから桁
上げが発生することがあり。Furthermore, if processing is selected to round up the extra low-order bits of the mantissa, a carry may occur from the most significant bit of the significant digits due to the rounding-up process of addition to the significant digits.
このような場合は有効数字への加算結果を全体に1ビッ
ト右シフトして、指数値を+1する正規化処理が必要と
なる。従って、正規化処理が必要となる場合には変換後
の指数値は変換前の指数値よりも1だけ大きくなる。In such a case, it is necessary to perform normalization processing by right-shifting the entire result of addition to the significant figures by 1 bit and adding 1 to the exponent value. Therefore, if normalization processing is required, the exponent value after conversion will be larger by 1 than the exponent value before conversion.
正規化処理を変換後の形式において処理する従来の精度
形式の変換方式では、正規化処理前の中間結果で指数ア
ンダフローが発生していても正規化処理によって指数ア
ンダフローとならない場合。In the conventional precision format conversion method, which processes normalization processing in the converted format, even if exponent underflow occurs in the intermediate result before normalization processing, the exponent underflow does not occur due to normalization processing.
正規化処理前の中間結果で指数アンダフローが発生して
いてかつ指数バイアス調整が不可能であっても、正規化
処理によって指数バイアス調整が可能となる場合、正規
化処理前の中間結果で指数オーバフローが発生していな
くとも正規化処理によって指数オーバフローが発生する
場合、正規化処理前の中間結果で指数オーバフローが発
生してかつ指数バイアス調整が可能であっても、正規化
処理によって指数バイアス調整が不可能になる場合があ
り、それぞれの場合によって変換結果が異なるために、
正規化処理後にも指数オーバフローあるいは指数アンダ
フローの検出およびバイアス調整の可否を検出する処理
が必要となり、処理が繁雑であるという問題があった。Even if index underflow occurs in the intermediate results before normalization processing and index bias adjustment is not possible, if index bias adjustment is possible through normalization processing, the index underflow will occur in the intermediate results before normalization processing. If an exponential overflow occurs due to normalization processing even if no overflow occurs, even if exponential overflow occurs in the intermediate result before normalization processing and it is possible to adjust the exponential bias, the normalization processing will adjust the exponential bias. may not be possible, and the conversion results will be different in each case.
Even after the normalization process, processes for detecting exponent overflow or underflow and detecting whether or not bias adjustment is possible are required, which poses a problem in that the process is complicated.
本発明は、浮動小数点数の精度形式の変換処理を簡単化
し、処理の高速化を図ることを目的としている。An object of the present invention is to simplify the precision format conversion process for floating point numbers and speed up the process.
(課題を解決するための手段〕
本発明は、変換先の仮数部のビット数が変換前の仮数部
のビット数より少ないような形式への変換を行う場合に
は、変換前の形式において仮数部の丸め処理と必要であ
れば丸め処理結果の正規化処理とを行う前処理を実行し
、前処理結果で得られる変換前の形式で表現された中間
結果を使用して実際の変換処理を行うことによって、変
換後の正規化処理を不要にするものであり、変換結果の
指数オーバフロー、指数アンダフローおよび4マイアス
調整の可否は指数部変換処理時に正しく検出することを
可能にする。(Means for Solving the Problems) In the present invention, when converting to a format in which the number of bits of the mantissa part of the conversion destination is smaller than the number of bits of the mantissa part before conversion, the mantissa in the format before conversion is Perform pre-processing to round the part and normalize the rounding result if necessary, and use the intermediate result expressed in the pre-conversion format obtained as the pre-processing result to perform the actual conversion process. This eliminates the need for normalization processing after conversion, and enables correct detection of exponent overflow, exponent underflow, and 4-minus adjustment in the conversion result during exponent part conversion processing.
第1図は2本発明の原理説明図である。FIG. 1 is an explanatory diagram of the principle of the present invention.
第1図において。In FIG.
lは浮動小数点数の精度変換命令である。l is a precision conversion instruction for floating point numbers.
2は精度変換命令lの処理内容であり、1ビットの符号
部Sと2mビットの指数部Eと、nビットの仮数部Fを
もつ精度形式を、1ビットの符号部S′とm′ビットの
指数部E′と、n′ビットの仮数部F′をもつ精度形式
に変換することを示す。2 is the processing content of the precision conversion instruction l, which converts a precision format with a 1-bit sign part S, a 2m-bit exponent part E, and an n-bit mantissa part F into a 1-bit sign part S' and m' bits. This shows conversion to a precision format having an exponent part E' of , and a mantissa part F' of n' bits.
3は本発明による精度形式変換処理部であり。3 is a precision format conversion processing unit according to the present invention.
精度変換命令1により、変換後の仮数部F′のビット数
n′が、変換前の仮数部Fのビット数nより小さいよう
な精度形式の変換指示が行われたとき(nun’)、仮
数部Fの余分な下位ビットを切り上げあるいは切り捨て
る丸め処理と、丸め処理結果の正規化処理とを含む前処
理を実行し、その後で実際の変換処理を行い、他方n′
がnよりも大きくなるような精度形式の変換指示が行わ
れたときには(nun’)、前処理なしに従来と同様な
変換処理を行う。When precision conversion instruction 1 instructs conversion to a precision format such that the number of bits n' of the mantissa part F' after conversion is smaller than the number n of bits of the mantissa part F before conversion (nun'), the mantissa Preprocessing including rounding up or down to round up or truncate the extra low-order bits of part F, and normalization processing of the rounding result is performed, after which the actual conversion processing is performed, and the other n′
When a conversion instruction is given for a precision format in which n is greater than n (nun'), conversion processing similar to the conventional one is performed without preprocessing.
本発明によれば、変換後の仮数部のビット数が少なくな
るような精度形式変換を行う場合において、仮数部の下
位の余分なビット数を削除するための丸め処理と、必要
な場合に丸め処理に伴う正規化処理とを変換処理に先立
って行うことにより。According to the present invention, when performing precision format conversion that reduces the number of bits in the mantissa after conversion, rounding processing is performed to delete the extra number of lower bits of the mantissa, and rounding is performed when necessary. By performing the normalization process that accompanies the process prior to the conversion process.
変換処理後の正規化処理が不要となる。そのため従来の
方式のように変換処理後の正規化処理の結果さらに指数
部のオーバフロー、アンダフローの検出やバイアス調整
等を行う必要がなくなり、処理が簡単になる。There is no need for normalization processing after conversion processing. Therefore, it is no longer necessary to perform normalization processing after conversion processing, detection of overflow or underflow of the exponent part, bias adjustment, etc., as in the conventional method, and the processing becomes simpler.
本発明方式により、IEEE標準規格に準拠した浮動小
数点数表現形式で表された単精度形式の倍精度形式間の
形式変換命令の実施例を示す。An example of a format conversion instruction between a single-precision format and a double-precision format expressed in a floating-point number representation format compliant with the IEEE standard will be described according to the method of the present invention.
IEEE標準規格あるいはこれに準拠した浮動小数点数
表現形式を扱う演算処理装置では、浮動小数点数Xは1
ビットの符号部S、 mビットの指数部E、およびnビ
ットの仮数部Fによりて表現され、指数部Eの値は実際
の指数部eに所定の指数バイアス値を加算したものであ
る。Xが正規化浮動小数点数の場合には、Xは次式で示
される値を表している。In an arithmetic processing unit that handles the IEEE standard or a floating point number representation format compliant with this standard, the floating point number X is 1.
It is expressed by a sign part S of bits, an exponent part E of m bits, and a mantissa part F of n bits, and the value of the exponent part E is the sum of the actual exponent part e and a predetermined exponent bias value. When X is a normalized floating point number, X represents a value expressed by the following equation.
X= (1)” X 1. f+ b ts ・・・
fs X2”ここで有効数字の小数点以下のh b f
s・・・f。X= (1)” X 1. f+ b ts...
fs X2” where h b f after the decimal point of significant figures
s...f.
は仮数部Fを構成する2進数のビット列である。is a binary bit string forming the mantissa part F.
また有効数字の最上位ビット(整数部)は、正規化数で
あればlであることが暗黙に仮定される。Further, it is implicitly assumed that the most significant bit (integer part) of the significant digits is l if it is a normalized number.
従って、実際の有効数字はn+1ビットとなる。Therefore, the actual significant number is n+1 bits.
いま第2図の(a)、(ロ)に示すように、単精度形式
では、 m−8,n=23.指数バイアス値−127゜
バイアス調整値=192とし1倍精度形式では。As shown in Fig. 2 (a) and (b), in single precision format, m-8, n=23. Exponential bias value - 127° Bias adjustment value = 192 in single precision format.
m=11.nm52.指数バイアス値−1023゜バイ
アス調整値−1536であるものとする。m=11. nm52. It is assumed that the index bias value is −1023° and the bias adjustment value −1536.
また第3図は本発明による精度形式変換処理部の実施例
構成図で、変換方向指定信号によって制御され、単精度
形式から倍精度形式への変換処理か1倍精度形式から単
精度形式への変換処理のいずれかを選択的に行う。FIG. 3 is a block diagram of an embodiment of the precision format conversion processing unit according to the present invention, which is controlled by a conversion direction designation signal and converts from single precision format to double precision format or from single precision format to single precision format. Selectively perform one of the conversion processes.
第3図において指数部変換回路の出力のEXOは指数オ
ーバフロー検出信号であり、指数部変換出力において指
数オーバフローが発生する場合に1を送出し、そうでな
い場合にはOを送出する。In FIG. 3, the output EXO of the exponent part conversion circuit is an exponent overflow detection signal, which sends out 1 when an exponent overflow occurs in the exponent part conversion output, and sends out O otherwise.
またEXUは指数アンダフロー検出信号であり。Also, EXU is an exponential underflow detection signal.
指数部変換出力において指数アンダフローが発生する場
合に1を送出し、そうでない場合に0を送出する。また
OBはバイアス調整不可検出信号であり、指数部変換回
路は所定のに1およびに2の値に対して、入力された指
数部がkl<E<k2の範囲にある場合にはOを送出し
、そうでない場合には1を出力する。If an exponent underflow occurs in the exponent part conversion output, 1 is sent; otherwise, 0 is sent. OB is a bias adjustment failure detection signal, and the exponent conversion circuit sends O when the input exponent is in the range of kl<E<k2 for the predetermined values of 1 and 2. Otherwise, it outputs 1.
倍精度形式の指数部と仮数部のビット数は、いずれも単
精度形式の指数部および仮数部のビット数より多いから
、単精度形式から倍精度形式への変換においで指数オー
バフローあるいは指数アンダフローが発生する事はない
、従って、EXO。Since the number of bits in the exponent and mantissa parts of the double-precision format are both greater than the number of bits in the exponent and mantissa parts of the single-precision format, exponent overflow or exponent underflow occurs when converting from single-precision format to double-precision format. will never occur, therefore, EXO.
EXU、およびOBはいずれも0に強制される。EXU and OB are both forced to 0.
変換方向指定信号によって単精度形式から倍精度形式へ
の変換処理が選択された場合、指数部変換回路は8ビッ
トの指数部入力に対応して第4図に示されるような11
ビットの指数部変換出力およびEXO,EXU、OBを
出力する。When the conversion process from single-precision format to double-precision format is selected by the conversion direction designation signal, the exponent conversion circuit converts the 11 bits as shown in FIG. 4 in response to the 8-bit exponent input.
Outputs bit exponent part conversion output and EXO, EXU, and OB.
第4図の指数部変換出力は9例えば、8ビットの指数部
入力に対して11ビットの2進数011100oooo
oつまり896(10進)を加算した結果として得るこ
とができる。896は倍精度形式での指数バイアス値と
単精度形式での指数バイアス値との差に相当する(10
23−127−896)。The exponent conversion output in Figure 4 is 9. For example, for an 8-bit exponent input, the 11-bit binary number 011100oooo
It can be obtained as a result of adding o, that is, 896 (decimal). 896 corresponds to the difference between the exponential bias value in double precision format and the exponential bias value in single precision format (10
23-127-896).
最終的な変換結果は、変換前の符号部の値、指数部変換
出力、および変換前の仮数部の下位に29ビット(52
−23−29)の0を付加したものをそれぞれ倍精度形
式の符号部、指数部、および仮数部とすることによって
得ることができる。The final conversion result includes the value of the sign part before conversion, the exponent part conversion output, and the lower 29 bits (52 bits) of the mantissa part before conversion.
-23-29) by adding 0 to them as the sign part, exponent part, and mantissa part in double-precision format, respectively.
変換方向指定信号によって倍精度形式から単精度形式へ
の変換処理が選択された場合、指数部変換回路は11ビ
ットの指数部入力に対応して、第5図に示されるような
8ビットの指数部変換出力およびEXO,EXU、OB
を出力する。When conversion processing from double-precision format to single-precision format is selected by the conversion direction designation signal, the exponent conversion circuit converts an 8-bit exponent as shown in FIG. 5 in response to the 11-bit exponent input. part conversion output and EXO, EXU, OB
Output.
第5図の指数部変換出力は1例えば、11ビットの指数
部入力に対して11ビットの2進数0111ooooo
oo 、つまり896 (10進)を減算した結果の下
位8ビットとして得ることができる。The exponent conversion output in Fig. 5 is 1. For example, for an 11-bit exponent input, an 11-bit binary number 0111ooooo
It can be obtained as the lower 8 bits of the result of subtracting oo, that is, 896 (decimal).
倍精度形式から単精度形式への変換においては。In converting from double precision format to single precision format.
指数値が+128以上のときは指数オーバフローが発生
し、指数値が一127以下の場合には指数アンダフロー
が発生する。さらに指数値が+320以上あるいは一3
19以下のときは、バイアス調整を行っても単精度形式
の指数部で表現することができない、従って、入力され
た倍精度形式の指数部の値が10001111111
(2進)以上であることを検出してEXO−1とし、ま
?、: 0IIIOQOOOOQ(2進)以下であるこ
とを検出してEXLI−1となる。When the exponent value is +128 or more, an exponent overflow occurs, and when the exponent value is less than -127, an exponent underflow occurs. Furthermore, the index value is +320 or more or -3
19 or less, it cannot be expressed by the exponent part in single precision format even if bias adjustment is performed. Therefore, the value of the input exponent part in double precision format is 10001111111.
(binary) or higher is detected and set as EXO-1, and then? ,: Detects that it is less than or equal to 0IIIOQOOOOQ (binary) and becomes EXLI-1.
さらに、klは指数値の−319に対応して。Furthermore, kl corresponds to the exponent value of -319.
またに2は指数値の+320に対応して決定されている
。Further, 2 is determined corresponding to the index value of +320.
即ちk 1−01011000000 、 k 2−1
0100111111として指数部入力データEと比較
され、kl<E<k2のとき0B=0となり、それ以外
のとき0B=1となる。That is, k 1-01011000000, k 2-1
It is compared with the exponent part input data E as 0100111111, and when kl<E<k2, 0B=0, and otherwise, 0B=1.
また2倍精度形式から単精度形式への変換では。Also, when converting from double precision format to single precision format.
変換先の仮数部のビット数の方が少ないため、実際の変
換処理に先立って次のような前処理が行われる。つまり
、変換前の浮動小数点数データの仮数部の下位29ビッ
トをすべてOとした中間結果をT1とすると、仮数部の
余分な下位ビットを切り捨てる丸め処理が選択される場
合には、TIが前処理結果となる。Since the number of bits in the mantissa part of the conversion destination is smaller, the following preprocessing is performed prior to the actual conversion processing. In other words, if T1 is the intermediate result in which all the lower 29 bits of the mantissa of the floating-point number data before conversion are O, then if rounding is selected to truncate the extra lower bits of the mantissa, TI is This is the processing result.
これに対して仮数部の余分な下位ビットを切り上げる丸
め処理が選択される場合には、TIの仮数部の上位から
23ビット目に1を加算し必要であれば正規化した結果
T2が前処理結果となる。On the other hand, if rounding is selected to round up the extra lower bits of the mantissa, 1 is added to the 23rd bit from the top of the mantissa of TI, normalization is performed if necessary, and the result T2 is the preprocessed result.
このようにして得られる前処理結果を使用して実際の変
換は以下のようにして処理できる。ただし。Using the preprocessing results obtained in this way, the actual conversion can be performed as follows. however.
変換結果において指数オーバフローまたは指数アンダフ
ローが発生した場合にどのような変換結果を出力すべき
かは浮動小数点演算処理装置によって異なる場合がある
が1本実施例ではバイアス調整可能なときにはバイアス
調整した結果5バイアス調整が不可能な場合は所定の非
数値を結果とするものとして説明する。What kind of conversion result should be output when exponent overflow or underflow occurs in the conversion result may differ depending on the floating point arithmetic processing device, but in this embodiment, when bias adjustment is possible, the result after bias adjustment 5 In the case where bias adjustment is not possible, a predetermined non-numeric value is assumed to be the result.
(1)前処理において指数オーバフローが発生する場合
前処理における正規化処理においては指数オーバフロー
が発生することがあるが1倍精度形式で指数オーバフロ
ーが発生するような指数値は、単精度形式では表現でき
ず、従って、変換結果でも指数オーバフローが発生し、
しかもバイアス調整が不可能なことは明らかである。従
って、変換結果は非数値となる。(1) When exponent overflow occurs in preprocessing Exponent overflow may occur in normalization processing in preprocessing, but exponent values that would cause exponent overflow in single precision format cannot be expressed in single precision format. Therefore, an exponential overflow will occur in the conversion result as well.
Moreover, it is clear that bias adjustment is impossible. Therefore, the conversion result will be a non-numeric value.
(2)前処理において指数オーバフローが発生しない場
合
前処理結果の指数部を指数部変換回路の入力とし、変換
方向指定信号によって倍精度形式から単精度形式へ変換
を指定することによって第5図で示されるような指数部
変換出力、EXO,EXU。(2) When exponent overflow does not occur in preprocessing The exponent part of the preprocessing result is input to the exponent part conversion circuit, and the conversion from double precision format to single precision format is specified by the conversion direction designation signal. Exponent conversion output, EXO, EXU as shown.
OBの値によって選択的に次のようにして得ることがで
きる。It can be selectively obtained as follows depending on the value of OB.
■ EXOおよびEXUがともに0であるとき前処理結
果の符号部、指数部変換出力、および前処理結果の仮数
部の上位23ビットをそれぞれ単精度形式の符号部指数
部、および仮数部としたものが変換結果となる。■ When EXO and EXU are both 0, the sign part of the preprocessing result, the exponent part conversion output, and the upper 23 bits of the mantissa part of the preprocessing result are used as the sign part, exponent part, and mantissa part in single precision format, respectively. is the conversion result.
■ EXOあるいはEXUのどちらかが1で、OBが0
のとき
前処理結果の符号部、指数部変換出力をバイアス調整し
た結果、および前処理結果の仮数部の上位23ビットを
それぞれ単精度形式の符号部、指数部、および仮数部と
したものが変換結果となる。■ Either EXO or EXU is 1 and OB is 0
When , the result of bias adjustment of the sign part and exponent part conversion output of the preprocessing result, and the upper 23 bits of the mantissa part of the preprocessing result are converted into the sign part, exponent part, and mantissa part in single precision format, respectively. result.
■ OBが1であるとき
OBが1である場合には、バイアス調整が不可能である
から変換結果は所定の非数値である。(2) When OB is 1 If OB is 1, the conversion result is a predetermined non-numeric value because bias adjustment is impossible.
本発明による前処理を含む変換方式では、変換後の正規
化処理が不要となるため、変換後に正規化処理を行う方
式では必要となる変換後の正規化処理結果の指数オーバ
フロー、指数アンダフロー検出処理、およびバイアス調
整可否検出処理も全て不要とすることができ、変換処理
の高速化を図ることができる。Since the conversion method including preprocessing according to the present invention does not require post-conversion normalization processing, exponential overflow and underflow detection of the post-conversion normalization processing results, which is necessary in the post-conversion normalization method, is unnecessary. It is also possible to eliminate the need for the processing and the bias adjustment possibility detection processing, and it is possible to speed up the conversion processing.
また1本実施例に示すような指数部変換回路を備えるこ
とによって、指数部変換処理における指数オーバフロー
および指数アンダフローの検出。Furthermore, by providing an exponent conversion circuit as shown in this embodiment, exponent overflow and underflow can be detected in exponent conversion processing.
さらにバイアス調整の可否検出を効率よく行うことがで
き、変換処理をさらに高速化することができる。Furthermore, it is possible to efficiently detect whether bias adjustment is possible, and the conversion process can be further speeded up.
第1図は本発明の原理説明図、第2図は単精度形式と倍
精度形式の例の説明図、第3図は本発明による精度形式
変換処理部の実施例構成図、第4図は単精度形式から倍
精度形式への指数部変換実施例の説明図、第5図は倍精
度形式から単精度形式への指数部変換実施例の説明図で
ある。
第1図中
1:精度変換命令
2:精度変換命令の処理内容
3:精度形式変換処理部FIG. 1 is an explanatory diagram of the principle of the present invention, FIG. 2 is an explanatory diagram of examples of single-precision format and double-precision format, FIG. 3 is a configuration diagram of an embodiment of the precision format conversion processing section according to the present invention, and FIG. FIG. 5 is an explanatory diagram of an example of exponent part conversion from single precision format to double precision format. FIG. 5 is an explanatory diagram of an example of exponent part conversion from double precision format to single precision format. 1 in Figure 1: Precision conversion instruction 2: Processing details of precision conversion instruction 3: Precision format conversion processing section
Claims (2)
ビットの仮数部によって浮動小数点数を表現し、また指
数部および仮数部のビット数が異なる複数の精度形式を
持つ浮動小数点データを扱う浮動小数点演算処理装置に
おいて、 ある精度形式で表現された浮動小数点数を他の精度形式
の浮動小数点数へ変換する精度変換命令を処理する場合
であって仮数部のビット数が変換前の形式よりも少ない
ような形式への変換を行うときには、仮数部の余分な下
位ビットを切り上げるかあるいは切り捨てる丸め処理お
よび丸め処理結果の正規化処理を含む前処理を実行し、
この前処理結果を使用して実際の変換処理を行うことを
特徴とする精度変換命令の処理方式。(1) 1-bit sign part, m-bit exponent part, and n
In a floating-point arithmetic processing unit that represents a floating-point number using a mantissa of bits and handles floating-point data with multiple precision formats in which the number of bits of the exponent and mantissa differs, a floating-point number expressed in a certain precision format is used. When processing a precision conversion instruction that converts a number to a floating point number in another precision format, and when converting to a format where the number of bits in the mantissa is smaller than the format before conversion, the excess mantissa perform preprocessing including rounding processing to round up or truncate the lower bits and normalization processing of the rounding result;
A precision conversion instruction processing method characterized by performing actual conversion processing using this preprocessing result.
指定された形式へと変換した指数部を変換結果として出
力するとともに、指数部の変換結果において指数オーバ
フローあるいは指数アンダフローが発生する場合には、
それぞれに対応して指数オーバフロー検出信号および指
数アンダフロー検出信号を発生し、また、入力された指
数部の値Eが所定の下限値k1と上限値k2に対してk
1<E<k2の範囲にあるか否かを調べて、対応する状
態を示す状態検出信号を出力する指数部変換回路を備え
、該指数部変換回路の出力を使用して変換処理を行うこ
とを特徴とする請求項(1)に記載の精度変換命令の処
理方式。(2) Input the exponent part expressed in the format before conversion,
Outputs the exponent part converted to the specified format as the conversion result, and if an exponent overflow or underflow occurs in the conversion result of the exponent part,
An exponent overflow detection signal and an exponent underflow detection signal are generated correspondingly, and the value E of the input exponent part is k with respect to a predetermined lower limit value k1 and upper limit value k2.
An exponent conversion circuit that checks whether or not 1<E<k2 is in the range and outputs a state detection signal indicating a corresponding state, and performs conversion processing using the output of the exponent conversion circuit. The precision conversion instruction processing method according to claim 1, characterized in that:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1238214A JPH03100723A (en) | 1989-09-13 | 1989-09-13 | Processing system for accuracy conversion instruction |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP1238214A JPH03100723A (en) | 1989-09-13 | 1989-09-13 | Processing system for accuracy conversion instruction |
Publications (1)
Publication Number | Publication Date |
---|---|
JPH03100723A true JPH03100723A (en) | 1991-04-25 |
Family
ID=17026843
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP1238214A Pending JPH03100723A (en) | 1989-09-13 | 1989-09-13 | Processing system for accuracy conversion instruction |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPH03100723A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012084142A (en) * | 2007-12-07 | 2012-04-26 | Nvidia Corp | Merged product sum operation functional unit |
JP2012205005A (en) * | 2011-03-24 | 2012-10-22 | Semiconductor Components Industries Llc | Bit length converting circuit for floating-point numbers, and vibration correction control circuit using the same |
-
1989
- 1989-09-13 JP JP1238214A patent/JPH03100723A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012084142A (en) * | 2007-12-07 | 2012-04-26 | Nvidia Corp | Merged product sum operation functional unit |
JP2012205005A (en) * | 2011-03-24 | 2012-10-22 | Semiconductor Components Industries Llc | Bit length converting circuit for floating-point numbers, and vibration correction control circuit using the same |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11698772B2 (en) | Prepare for shorter precision (round for reround) mode in a decimal floating-point instruction | |
JPH0644225B2 (en) | Floating point rounding normalization circuit | |
JPH02201645A (en) | Exception detecting circuit | |
WO2022052625A1 (en) | Fixed-point and floating-point converter, processor, method, and storage medium | |
CN112711441B (en) | Converter, chip, electronic device and method for converting data types | |
CN113625990B (en) | Floating point-to-fixed point device, method, electronic equipment and storage medium | |
CN112711440A (en) | Converter, chip, electronic device and method for converting data type | |
US4590584A (en) | Method and system for processing exponents in floating-point multiplication | |
CN111310909B (en) | Floating point number conversion circuit | |
JPH03100723A (en) | Processing system for accuracy conversion instruction | |
JPH03100722A (en) | Processing system for accuracy conversion instruction | |
CN112667197B (en) | A Parameterized Addition and Subtraction Operation Circuit Based on POSIT Floating Point Format | |
KR101922462B1 (en) | A data processing apparatus and method for performing a shift function on a binary number | |
JP2747267B2 (en) | 3-input floating point adder | |
JP2565730B2 (en) | Overflow detection circuit | |
US6128636A (en) | Method for interfacing floating point and integer processes in a computer system | |
JPH1091396A (en) | Floating-point number detection device and circuit | |
JP2006318382A (en) | Arithmetic device and type conversion device | |
JPS59139448A (en) | Floating-point multiplying device | |
US20240036824A1 (en) | Methods and systems employing enhanced block floating point numbers | |
JPH0216632A (en) | Fixed-point number - floating point number conversion circuit | |
JP2764975B2 (en) | Precision floating point arithmetic processing unit | |
JP2752948B2 (en) | Floating point arithmetic unit | |
JP2801472B2 (en) | Floating point arithmetic unit | |
JP2890412B2 (en) | Code conversion circuit |