Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JPS6252330B2 - - Google Patents
[go: Go Back, main page]

JPS6252330B2 - - Google Patents

Info

Publication number
JPS6252330B2
JPS6252330B2 JP55131278A JP13127880A JPS6252330B2 JP S6252330 B2 JPS6252330 B2 JP S6252330B2 JP 55131278 A JP55131278 A JP 55131278A JP 13127880 A JP13127880 A JP 13127880A JP S6252330 B2 JPS6252330 B2 JP S6252330B2
Authority
JP
Japan
Prior art keywords
data
point data
floating
point
fixed
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
Application number
JP55131278A
Other languages
Japanese (ja)
Other versions
JPS5755447A (en
Inventor
Haruyasu Ito
Akisuke Mori
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 JP55131278A priority Critical patent/JPS5755447A/en
Publication of JPS5755447A publication Critical patent/JPS5755447A/en
Publication of JPS6252330B2 publication Critical patent/JPS6252330B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/483Computations with numbers represented by a non-linear combination of denominational numbers, e.g. rational numbers, logarithmic number system or floating-point numbers

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Nonlinear Science (AREA)
  • General Engineering & Computer Science (AREA)

Description

【発明の詳細な説明】[Detailed description of the invention]

本発明は条件処理を行なわないで固定小数点デ
ータから浮動小数点データに変換するデータ変換
回路に関する。 従来、固定小数点データを浮動小数点データに
変換するアルゴリズムでは、被変換データの正、
負の符号によつて処理が分かれており、たとえば
フローチヤートにて処理プロセスを示せば正、負
の条件を判定して、パスを分枝していた。このた
め、条件判定のオーバーヘツドが起り、演算処理
速度がきわめて遅かつた。固定小数点データから
浮動小数点データへの変換のソフトウエアも条件
判定を行うため簡単ではなかつた。 本発明は従来の上記欠点を除去し、固定小数点
データの正、負の符号を判定する必要なく1個の
ハードウエア命令で高速に演算処理を行うことの
できる固定小数点データから浮動小数点データへ
の変換方式を提供することを目的とする。 本発明の特徴とするところは、入力データバス
に接続され、浮動小数点データの仮数部に対応す
るデータ幅を持つた第1のレジスタ部と、前記デ
ータバスから第1のレジスタ部に送られるデータ
のうち固定小数点データの符号ビツトに対応する
ビツトのみ反転する反転回路と、入力データバス
に接続され浮動小数点データの指数部に対応する
データを格納する第2のレジスタ部と前記第1お
よび第2のレジスタ部の全出力をAオペランドと
して入力する浮動小数点減算回路とよりなり、第
1のレジスタ部に前記反転回路によつて符号ビツ
トのみ反転した固定小数点データを置数し、前記
第2のレジスタ部には固定小数点データの小数点
位置を浮動小数点データの仮数部の小数点位置に
移動するための調整データを入力し、前記浮動小
数点減算回路のBオペランドとしては固定小数点
データの符号ビツトに対応するビツトのみ論理ま
で他の浮動小数点データの仮数部に対応するビツ
トは全て論理0とし浮動小数点データの指数部に
対応するビツトは前記第2のレジスタ部に加えら
れる調整データと同様のデータがそれぞれ固定的
に入力され、前記浮動小数点減算回路においてA
オペランドとBオペランドによつて浮動小数点減
算を行なつて正規化された浮動小数点データを出
力データバスに出力して固定小数点データから浮
動小数点データへのデータ変換回路である。 以下図面を参照して本発明の一実施例を説明す
る。 固定小数点データを正規化された浮動小数点デ
ータに変換するデータ変換回路は、データバス1
0に入力かつ接続されたA番地レジスタ20、A
+1番地レジスタ30、A+2番地レジスタ4
0、A+3番地レジスタ50と、A+2番地レジ
スタ40の最上位ビツト入力に接続された反転回
路60を有し、各レジスタ20,30,40,5
0の出力は浮動小数点減算回路70に接続されて
なる。 今、固定小数点データDIは2バイト長(16ビ
ツト)であつて、これを4ビツトを1単位とする
16進法を使つて DI=H3H2H1H0 と書くことする。ここでHi(i=3、2、1、
0)はdij(j=3、2、1、0)を1または0
のデジツトとするとHi=di3di2di1di0である4ビ
ツト1単位の16進数である。固定小数点表示は小
数点の位置が1語の特定な位置に決められている
表示であり、ここでは、小数点の位置は最下位部
H0の右はしにあるものとする。Hiのとりえる値
は24個あり、これらの16個の数字を表1に示すよ
うな10個の数字と5個の英文字を使つて示すこと
はよく行なわれている。
The present invention relates to a data conversion circuit that converts fixed point data to floating point data without performing conditional processing. Traditionally, algorithms for converting fixed-point data to floating-point data have
Processing is divided by negative signs; for example, if a flowchart shows a processing process, positive and negative conditions are determined and paths are branched. Therefore, overhead of condition determination occurred, and the calculation processing speed was extremely slow. The software for converting fixed-point data to floating-point data was not easy to use because it required conditional judgment. The present invention eliminates the above-mentioned drawbacks of the conventional method and enables high-speed arithmetic processing from fixed-point data to floating-point data with one hardware instruction without the need to determine the positive or negative sign of fixed-point data. The purpose is to provide a conversion method. The present invention is characterized by a first register section connected to an input data bus and having a data width corresponding to the mantissa part of floating point data; an inverting circuit that inverts only the bit corresponding to the sign bit of the fixed-point data; a second register section connected to the input data bus and storing data corresponding to the exponent part of the floating-point data; and the first and second register sections. The floating point subtraction circuit inputs all the outputs of the register section as the A operand, and the fixed point data whose sign bit is inverted by the inverting circuit is placed in the first register section, and the fixed point data is inputted into the first register section. Adjustment data for moving the decimal point position of the fixed-point data to the decimal point position of the mantissa part of the floating-point data is input into the part, and the B operand of the floating-point subtraction circuit is a bit corresponding to the sign bit of the fixed-point data. The bits corresponding to the mantissa part of the floating point data up to the logic level are all logic 0, and the bits corresponding to the exponent part of the floating point data are fixed data similar to the adjustment data added to the second register part. A is input into the floating point subtraction circuit.
This is a data conversion circuit from fixed-point data to floating-point data by performing floating-point subtraction using operands and B operands and outputting normalized floating-point data to an output data bus. An embodiment of the present invention will be described below with reference to the drawings. A data conversion circuit that converts fixed-point data to normalized floating-point data is connected to data bus 1.
A address register 20 input and connected to 0, A
+1 address register 30, A+2 address register 4
It has an inverting circuit 60 connected to the most significant bit input of the 0, A+3 address register 50 and the A+2 address register 40, and each register 20, 30, 40, 5
The output of 0 is connected to a floating point subtraction circuit 70. Now, fixed-point data D I is 2 bytes long (16 bits), and 4 bits is one unit.
Using hexadecimal notation, write D I = H 3 H 2 H 1 H 0 . Here, H i (i=3, 2, 1,
0) is di j (j=3, 2, 1, 0) 1 or 0
If the digit is H i =di 3 di 2 di 1 di 0 , it is a hexadecimal number of 4 bits per unit. Fixed-point display is a display in which the position of the decimal point is determined at a specific position in one word.
Assume that it is on the right side of H 0 . There are 24 possible values for H i , and it is common practice to represent these 16 numbers using 10 numbers and 5 alphabetic characters as shown in Table 1.

【表】 固定小数点データDIの第1の具体例として DI =(0001)16=(0000 0000 0000 0001)2 =(+1)10 を挙げる。ここで(……)16、(……)、(…
…)10はそれぞれ16進数表示、2進数表示10進数
表示を表わすものとする。従つて、DI は、小
数点が右はしにあるので DI =0×163+0×162+0×161+1×160(16
進法) =0×215+0×214+……+0×23+0×22 +0×21+1×20(2進法) =+1×100(10進法) となり、DI は10進法で+1を表わす。 16ビツトの固定小数点データDIの最上位ビツ
トd33は符号ビツトであつて、d33=0のときデー
タDIは正の数であり、d33=1のときはデータD
Iは負の数である。負である固定小数点データDI
は2の補数表示で表わすことにする。 たとえば、固定小数点データDIの第2の具体
例として DI =(FFFF)16=(1111 1111 1111 1111)2 =(−1)10 を挙げる。すなわち、+1の2進表示(0000 0000
0000 0001)2を2の補数をとつて10進数の−1に
対応させるためにはすべてのデジツトを反転して
最下位ビツトに“1”を加えればよいからであ
る。 DI =F×163+F×162+F×161+F×160(16
進法) =1×215+……1×22+1×21+1×20(2進
法) =−1×100(10進法) となり、DI は10進法で−1を表わす。 図において、各レジスタ20,30,40,5
0はそれぞれが1バイト分の書き込みデータ信号
201,301,401,501を入力し、かつ
読み書き制御信号80を共通に入力し、さらにデ
コード制御信号202,302,402,502
を入力し、それぞれが1バイト分の読み出しデー
タ信号203,303,403,503を出力し
ている。それぞれのレジスタ20,30,40,
50は読み書き制御信号80が論理0でかつそれ
ぞれのデコード信号202,302,402,5
02が論理1になるときそれぞれの1バイトの書
き込みデータ信号201,301,401,50
1を書き込み、前記読み書き制御信号80が論理
1になるとそれぞれが1バイトの読み出しデータ
信号203,303,403,503を読み出
す。ただし、(A+2)番地レジスタ40の入力
としての書き込みデータ信号401の最上位ビツ
ト信号DW7は、反転回路60を構成する排他的
論理和回路の1入力端子601に入力し、他の入
力端子602が抵抗604を通して電源Vccに接
続されて論理1に固定されているので、反転され
て出力端子603に現われ、この反転された信号
603がA+2番地レジスタ40の最上位ビツト
端子4017に入力する。 本発明の上記実施例のデータ変換回路において
は、第1のステツプとしてCPUがA+2番地お
よびA+3番地の2バイトの固定小数点データD
Iを書き込むように命令することから始まる。こ
の書き込み命令が指令されると読み書き制御信号
80が書き込み状態の論理0になり、かつ、20
2,302,402,502の4つのデコード信
号DEC0,DEC1,DEC2,DEC3が唯一の論
理1を含む論理(0、0、1、0)となるので、
A+2番地レジスタ40に1バイトの書き込みデ
ータ401がDW6,DW5,DW4,……DW0の7
ビツトはそのままで、最上位ビツトDW7のみが
反転回路60によつて反転されて置数される。前
記書き込み命令は2バイトのデータを書き込む命
令であるから、次の時刻に、読み書き制御信号8
0が論理0で前記4つのデコード信号DEC0,
DEC1,DEC2,DEC3が唯一の論理1を含む
論理(0、0、0、1)となつてA+3番地レジ
スタ50にも1バイトの書き込みデータ501が
そのまま置数される。このようにして、2バイト
の固定小数点データDI=H3H2H1H0がA+2番
地レジスタ40とA+3番地レジスタ50に置数
される。固定小数点データDIが、DI
(0001)16であるときは符号ビツトが反転されて表
1より明らかなように(8001)16の形で、またDI
=(FFFF)16であるときは符号ビツトが反転さ
れて表1より明らかなように(7FFF)16の形で、
レジスタ40,50に置数される。 次に、第2のステツプとして、CPUはA番地
レジスタ20とA+1番地レジスタ30にあらか
じめ決められた2バイトのデータ(4600)16を書
き込むように命令する。ここで、(46)16は固定小
数点データの小数点位置を浮動小数点データの仮
数部の小数点位置に移動させるための浮動小数点
データの指数部の調整値であり、(00)16は浮動小
数点データの仮数部のデータ幅が固定小数点デー
タ幅よりも長い部分に対応するレジスタに格納す
るデータである。なお、固定データ(4600)16
意味については後に詳述する。上記書き込み命令
が指令されると、前述と同様に読み書き制御信号
80が書き込み状態の論理0になつたまま、20
2,302,402,502、の4つのデコード
信号DEC0,DEC1,DEC2,DEC3が(1、
0、0、0)と(0、1、0、0)となつて前記
2バイトのデータ(4600)16のうち1バイトのデ
ータ(46)16をA番地レジスタ20に、1バイト
のデータ(00)16をA+1番地レジスタ30に置
数する。このようにして、レジスタ20,30,
40,50には固定小数点データがDI =(+
1)10のときは4バイトのデータ F =(46008001)16 が置数され、固定小数点データがDI =(−1)
10のときは、4バイトのデータ F =(46007FFF)16 が置数される。 ここで、2バイトの固定データ(4600)16の意
味について説明する。本実施例では、浮動小数点
データDFの1語は4バイトの32ビツトから構成
され、下に示すように最上位ビツトf31を正負を
表わす符号ビツトとし、これとf30,f29……f24
7ビツトを加えた上位8ビツトを指数部とし、以
下3バイトの24ビツトを仮数部として表わされる
ものとする。
[Table] As a first specific example of fixed-point data DI , DI + = (0001) 16 = (0000 0000 0000 0001) 2 = (+1) 10 is given. Here (...) 16 , (...) 2 , (...
...) 10 represents hexadecimal representation, binary representation, and decimal representation, respectively. Therefore, since the decimal point is on the right side of D I + , D I + =0×16 3 +0×16 2 +0×16 1 +1×16 0 (16
decimal system) =0×2 15 +0×2 14 +...+0×2 3 +0×2 2 +0×2 1 +1×2 0 (binary system) =+1×10 0 (decimal system), and D I + represents +1 in decimal notation. The most significant bit d 33 of the 16-bit fixed-point data DI is a sign bit, and when d 33 = 0, the data DI is a positive number, and when d 33 = 1, the data D
I is a negative number. Negative fixed-point data D I
will be expressed in two's complement notation. For example, as a second specific example of fixed-point data D I , DI = (FFFF) 16 = (1111 1111 1111 1111) 2 = (-1) 10 is given. In other words, the binary representation of +1 (0000 0000
0000 0001) In order to take the two 's complement of 2 and make it correspond to -1 in decimal, all the digits need to be inverted and "1" added to the least significant bit. D I =F×16 3 +F×16 2 +F×16 1 +F×16 0 (16
1×2 15 +……1×2 2 +1×2 1 +1×2 0 (binary) = −1×10 0 (decimal), and D I is − in decimal. Represents 1. In the figure, each register 20, 30, 40, 5
0 each inputs write data signals 201, 301, 401, 501 for 1 byte, and also inputs read/write control signal 80 in common, and decode control signals 202, 302, 402, 502.
are input, and each outputs read data signals 203, 303, 403, and 503 of 1 byte. respective registers 20, 30, 40,
50, the read/write control signal 80 is logic 0 and the respective decode signals 202, 302, 402, 5
When 02 becomes logic 1, each 1-byte write data signal 201, 301, 401, 50
1 is written, and when the read/write control signal 80 becomes logic 1, each read data signal 203, 303, 403, 503 of 1 byte is read out. However, the most significant bit signal DW 7 of the write data signal 401 as an input to the (A+2) address register 40 is input to one input terminal 601 of the exclusive OR circuit constituting the inverting circuit 60, and the other input terminal 602 is connected to the power supply Vcc through a resistor 604 and is fixed at logic 1, so it is inverted and appears at the output terminal 603, and this inverted signal 603 is input to the most significant bit terminal 4017 of the A+2 address register 40. In the data conversion circuit of the above embodiment of the present invention, as a first step, the CPU converts the 2-byte fixed-point data D at addresses A+2 and A+3.
It starts with a command to write I. When this write command is issued, the read/write control signal 80 becomes a write state of logic 0, and
Since the four decoded signals DEC0, DEC1, DEC2, and DEC3 of 2, 302, 402, and 502 have a logic (0, 0, 1, 0) that includes only logic 1,
One byte of write data 401 is written to the A+2 address register 40 as DW 6 , DW 5 , DW 4 , . . . 7 of DW 0
The bits remain unchanged, and only the most significant bit DW7 is inverted by the inverting circuit 60 and set. Since the write command is a command to write 2 bytes of data, at the next time, the read/write control signal 8
0 is logic 0 and the four decode signals DEC0,
DEC1, DEC2, and DEC3 become logics (0, 0, 0, 1) including only logic 1, and 1-byte write data 501 is also placed in the A+3 address register 50 as it is. In this way, 2-byte fixed point data D I =H 3 H 2 H 1 H 0 is placed in the A+2 address register 40 and the A+3 address register 50. Fixed-point data D I is D I + =
(0001) 16 , the sign bit is inverted, and as is clear from Table 1, it becomes (8001) 16 , and D I
= (FFFF) 16 , the sign bit is inverted, and as is clear from Table 1, it is in the form of (7FFF) 16 ,
The numbers are placed in registers 40 and 50. Next, as a second step, the CPU instructs the A address register 20 and the A+1 address register 30 to write predetermined 2-byte data (4600) 16 . Here, (46) 16 is the adjustment value of the exponent part of the floating-point data to move the decimal point position of the fixed-point data to the decimal point position of the mantissa part of the floating-point data, and (00) 16 is the adjustment value of the exponent part of the floating-point data. This is data to be stored in the register corresponding to the part where the data width of the mantissa part is longer than the fixed point data width. The meaning of fixed data (4600) 16 will be explained in detail later. When the above-mentioned write command is issued, the read/write control signal 80 remains in the write state of logic 0, and the 20
The four decoded signals DEC0, DEC1, DEC2, DEC3 of 2,302,402,502 are (1,
0, 0, 0) and (0, 1, 0, 0), and the above 2 bytes of data (4600) 1 byte of data out of 16 (46) 16 is stored in the A address register 20, and 1 byte of data ( 00) Place 16 in the A+1 address register 30. In this way, registers 20, 30,
40 and 50 have fixed point data D I + = (+
1) When it is 10 , 4 bytes of data F + = (46008001) 16 is placed and the fixed point data is D I - = (-1)
When it is 10 , 4-byte data F = (46007FFF) 16 is set. Here, the meaning of the 2-byte fixed data (4600) 16 will be explained. In this embodiment, one word of the floating point data DF consists of 4 bytes of 32 bits, and as shown below, the most significant bit f31 is used as a sign bit to indicate positive or negative, and this and f30 , f29 ... The upper 8 bits obtained by adding the 7 bits of f24 are the exponent part, and the following 3 bytes of 24 bits are the mantissa part.

【表】 すなわち、指数をn、仮数をpとすると浮動小
数点データDFは基底を16として DF=±p×16n で表わされる。このとき仮数pは 0.1≦p<1 を満足する。すなわち、仮数部の小数点はx5の左
側にあるものとしているため、仮数pは、xi
(i=5、4……0)を16進数とすれば p=x5×16-1+x4×16-2+x3×16-3+…+x0×
16-6 となるからである。 一方、指数部に関しては、符号ビツトを除いた
計7ビツトで表現できる数は0から127までであ
るから、その中間である64を中心として、それよ
りも大きい数は正の指数とし、小さい数は負の指
数と決める。そこで、浮動小数点データの指数部
の正負の基準を(0100 0000)としたとき、指数
nの正負の基準点は、E1、E0を16進数字として (E1E016=(40)16=(0100 000)2=(64)10 であるから、これをn=0として、160に対応す
るように決めればよい。 そして、正のデータの正の指数に対しては (E1E016=(0100 0001)2 がn=1として161に対応し、最大指数が (E1E016=(0111 1111)2=(127)10 であるn=26−1=63が1663に対応する。 また、正のデータの負の指数に対しては、n=
0に対応する (E1E016=(0100 0000)2=(64)10 より1少ない (E1E016=(0011 1111)2 がq=−1として16-1に対応し、1つずつ減じて
最小指数が (E1E016=(0000 0000)2 であるn=−26=−64が16-64に対応するように
する。 従つて指数nは −64≦q≦+63 を満足する。 前記2バイトの固定データ(46 00)16は (E1E0x5x416=(46 00)16 =(0100 0110 0000 0000)2=(64+6 0)10 であることを表わすのでn=+6とすることを意
味する。そこで、固定小数点データを浮動小数点
データに変換するためには、データが正の場合、
下位2バイト長の浮動小数点データの仮数部
(x3x2x1x016と与えられた2バイト長の固定小数
点データ(H3H2H1H016とのビツト構成を同じに
する。しかし、ここで小数点位置がH0の右側に
ある2バイト長の固定小数点データDI
(H3H2H1H016の小数点位置がx5の左側にある4
バイト長の正の浮動小数点データDF
(E1E0x5x4x3x2x1x016と同じ数になるためには、
この上位の2バイト長(E1E0x5x416を(4600)16
として、仮数部(x3x2x1x0)を16+6倍しておかな
くてはならない。 例えば、固定小数点データDIが(+1)10
表わすDI =(0001)16であるとき、これと同じ
数(+1)10を表わす浮動小数点データ DF は DF =(4600 0001)16=16+6×(0×16-1 +0×16-2+……+1×16-6)=(+1)10 となる。 ところが、この浮動小数点データDF は仮数
部の最上位桁のx5がx5=(0)16であるので、正
規化されていない。浮動小数点データDF の正
規化については、浮動小数点減算回路70に関し
て説明する。 浮動小数点減算回路70は32ビツトのAオペラ
ンド入力データA=(A31、A30、……、A0)と32
ビツトのBオペランド入力データB=(B31
B30、……、B0)を入力し、Aオペランドの下位24
ビツトAxとBオペランドの下位24ビツトBxの仮
数部に関零する2進減算(Ax−Bx)を行い、仮
数部に対応するその結果のQxの4ビツト長上位
桁が(0)16でない数字がくるように、指数部に
対応するAオペランドの上位8ビツトAEとBオ
ペランドの上位8ビツトBEを使つて演算し、正
しい指数部QEを出し、全体で32ビツトの正規化
された浮動小数点データFを出力データバス90
に出力するものである。 図に示されるように、浮動小数点減算回路70
のBオペランド入力データB=(B31、B30、…
…、B0)には固定化されたデータBI=(0100
0110 0000 0000 1000 0000 0000 0000)2が入力さ
れている。前記固定化されたデータBIは16進数
表示ではBI=(4600 8000)16となる。また、レジ
スタ20,30,40,50の8ビツトの出力2
03,303,403,503は浮動小数点減算
回路70のAオペランド入力に結線されている。
レジスタ20,30,40,50には非正規化浮
動小数点データDF そのものではなく、固定小
数点データの符号ビツトが反転されているデータ F =(4600 8001)16 が格納されている。ここで、読み書き制御信号8
0を読み出し状態の論理1にすることによつて、
レジスタ20,30,40,50に格納されてい
る32ビツトデータ(この場合F
(46008001)16とする)をAオペランドとし、前記
固定化された32ビツトデータBI=(46008000)16
をBオペランドとして浮動小数点減算が実行され
る。 Aオペランドの下位24ビツトAx=(008001)16
とBオペランドの下位24ビツトBx=(008000)16
との仮数部に関する演算はAxにBxの2の補数値
x=(FF7FFF)16+(000001)16=(FF8000)16
加算することによつて行なわれるので、その結果
xは Qx=(008001)16+(FF8000)16=(000001)16 =(+1)10 となる。 このままであると、Qx=(000001)16の最上位
桁x5は(0)16であるから、この桁x5に(0)16
ではない数字すなわちこの場合は最下位の桁(1)16
が来るように、小数点を6桁分上位に移動するこ
とが必要である。このために、浮動小数点減算回
路70は、指数部に対応するAオペランドの上位
8ビツトAE=(46)16とBオペランドの上位8ビ
ツトBE=(46)16を使つて演算して結果Fの指数
部に対応する上位8ビツトFEをFE=(41)16とし
て全体の結果FをF=(41100000)16として出力す
る。この32ビツトの出力結果F=(41100000)16
は、最上位桁が(0)16でない仮数部Fx
(100000)16を有する(+1)10の正規化された浮
動小数点データとなつている。すなわち、16ビツ
トの与えられた固定小数点データ(0001)16が32
ビツトの正規化された浮動小数点データ
(41100000)16に正しく変換される。最終的には、
この演算結果FをCPUで読み取る。 また、固定小数点データDIが負の(−1)10
を表わすDI =(FFFF)16であるとき、やはり
レジスタ20,30,40,50には上位16ビツ
トに(4600)16が格納され下位16ビツトに固定小
数点データに符号ビツトf15が反転されたデータ F =(4600 7FFF)16 が格納される。浮動小数点減算回路70の32ビツ
トのAオペランド入力には前記レジスタの内容
F が入力し、Bオペランド入力には図示される
ように固定化されたデータBI=(0100 0110 0000
0000 1000 0000 0000 0000)2=(46008000)16が入
力されている。そこで読み書き制御信号80を読
み出し状態の論理1にすることによつて、レジス
タ20,30,40,50に格納されている32ビ
ツトのデータF =(4600 7FFF)16と前記固定
化された32ビツトデータBI=(46008000)16に対
する浮動小数点減算が実行される。 Aオペランドの仮数部に対応する下位24ビツト
x=(007FFF)16とBオペランドの仮数部に対応
する下位24ビツトBx=(008000)16との演算は、
xにBxの2の補数値x=(FF7FFF)16
(000001)16=(FF8000)16を加算することによつて
行なわれるので、その結果Qxは Qx=(007FFF)16+(FF8000)16 =(FFFFFF)16=(−1)10 となる。 これと同時に、浮動小数点減算回路70は、指
数部に対応するAオペランドの上位8ビツトAE
=(46)16とBオペランドの上位8ビツトBE
(46)16を使つて演算し、結果Fの指数部に対応す
る上位8ビツトFEを FE=(C1)16=(1100 0001)2 とし、結果Fの仮数部に対応する下位24ビツトF
xを Fx=(100000)16 =(0001 0000 0000 0000 0000 0000)2 とし、全体で正規化された浮動小数点データ F=(C1100000)16 を出力する。結果Fの指数部はFE=(1100
0001)2であるから、最上位ビツトが1となる。こ
れはFは負の数であることを示し、n=
(000001)2=(+1)10であるからこの指数部FE
は−16+1であることを表現している。一方、正規
化された浮動小数点データFの仮数部Fx
(100000)16は(+0.1)10であることを表わしてい
るので、前記出力F=0.1×161となる。すなわ
ち、16ビツトの負の固定小数点データ
(FFFF)16が32ビツトの正規化された浮動小数点
データF=(C1100000)16に正しく変換されてい
る。最終的には、この演算結果をCPUで読み取
るようにすればよい。 以上詳述したように本発明にかかるデータ変換
回路を用いれば固定小数点データの正、負の条件
判定を行なうソフトウエアを用いることなく、固
定小数点データから浮動小数点データへと変換す
る1個のハードウエア命令だけによつて、プログ
ラムの処理が行える。したがつて、本発明はソフ
トウエアの軽減化および固定小数点データから浮
動小数点データへの変換速度の高速化に寄与する
ものである。
[Table] That is, when the exponent is n and the mantissa is p, floating point data D F is expressed as D F =±p×16 n with base 16. At this time, the mantissa p satisfies 0.1≦p<1. In other words, since the decimal point of the mantissa is to the left of x 5 , the mantissa p is x i
If (i=5, 4...0) is a hexadecimal number, p=x 5 ×16 -1 +x 4 ×16 -2 +x 3 ×16 -3 +...+x 0 ×
This is because it becomes 16 -6 . On the other hand, regarding the exponent part, since the number that can be expressed with a total of 7 bits excluding the sign bit is from 0 to 127, the middle value is 64, and larger numbers are treated as positive exponents, and smaller numbers are treated as positive exponents. is determined to be a negative exponent. Therefore , when the reference point for the positive/negative of the exponent part of floating point data is (0100 0000), the reference point for the positive/negative of the exponent n is (E 1 E 0 ) 16 = (40 ) 16 = (0100 000) 2 = (64) 10 , so this can be set as n=0 and determined to correspond to 16 0 . Then, for a positive exponent of positive data, (E 1 E 0 ) 16 = (0100 0001) 2 corresponds to 16 1 with n = 1, and the maximum exponent is (E 1 E 0 ) 16 = (0111 1111) 2 = (127) 10 , n = 2 6 - 1 = 63, corresponds to 16 63 . Also, for negative exponents of positive data, n=
Corresponds to 0 (E 1 E 0 ) 16 = (0100 0000) 2 = (64) 1 less than 10 (E 1 E 0 ) 16 = (0011 1111) 2 corresponds to 16 -1 as q = -1 , one by one so that n=-2 6 =-64, where the minimum exponent is (E 1 E 0 ) 16 = (0000 0000) 2 , corresponds to 16 -64 . Therefore, the index n satisfies -64≦q≦+63. The 2-byte fixed data (46 00) 16 represents (E 1 E 0 x 5 x 4 ) 16 = (46 00) 16 = (0100 0110 0000 0000) 2 = (64 + 6 0) 10 , so n =+6. Therefore, in order to convert fixed point data to floating point data, if the data is positive,
The mantissa part of the lower 2-byte floating-point data (x 3 x 2 x 1 x 0 ) 16 has the same bit configuration as the given 2-byte fixed-point data (H 3 H 2 H 1 H 0 ) 16 Make it. However, here, the 2-byte length fixed-point data D I = where the decimal point position is to the right of H 0
(H 3 H 2 H 1 H 0 ) 4 where the decimal point position of 16 is to the left of x 5
Byte length positive floating point data D F =
(E 1 E 0 x 5 x 4 x 3 x 2 x 1 x 0 ) To get the same number as 16 ,
This upper 2 byte length (E 1 E 0 x 5 x 4 ) 16 (4600) 16
As such, the mantissa (x 3 x 2 x 1 x 0 ) must be multiplied by 16 +6 . For example, when the fixed point data D I is (+1) 10 (D I + = (0001) 16) , the floating point data D F + representing the same number (+1) 10 is D F + = (4600 0001 ) 16 = 16 +6 × (0 × 16 -1 + 0 × 16 -2 + ... + 1 × 16 -6 ) = (+1) 10 . However, this floating point data D F + is not normalized because the most significant digit x 5 of the mantissa part is x 5 =(0) 16 . The normalization of the floating point data D F + will be explained with respect to the floating point subtraction circuit 70. The floating point subtraction circuit 70 receives 32-bit A operand input data A = (A 31 , A 30 , ..., A 0 ) and 32
Bit B operand input data B = (B 31 ,
B 30 , ..., B 0 ), and input the lower 24 of the A operand.
Binary subtraction (A x - B x ) is performed on the mantissa part of bit A x and the lower 24 bits of B x in the B operand, and the 4-bit length upper digit of the resulting Q x corresponding to the mantissa part is ( 0) Calculate using the upper 8 bits A E of the A operand and the upper 8 bits B E of the B operand corresponding to the exponent part so that a number that is not 16 will come out, and calculate the correct exponent part Q E , resulting in a total of 32 bits. A data bus 90 outputs normalized floating point data F.
This is what is output to. As shown, floating point subtraction circuit 70
B operand input data B = (B 31 , B 30 ,...
..., B 0 ) has fixed data B I = (0100
0110 0000 0000 1000 0000 0000 0000) 2 is entered. The fixed data B I is expressed as B I =(4600 8000) 16 in hexadecimal notation. Also, the 8-bit output 2 of registers 20, 30, 40, and 50
03, 303, 403, and 503 are connected to the A operand input of the floating point subtraction circuit 70.
The registers 20, 30, 40, and 50 store not the non-normalized floating point data D F + itself, but data F + =(4600 8001) 16 in which the sign bit of the fixed point data is inverted. Here, read/write control signal 8
By making 0 a logical 1 in the read state,
32-bit data stored in registers 20, 30, 40, and 50 (in this case, F =
(46008001) 16 ) is the A operand, and the fixed 32-bit data B I = (46008000) 16
Floating-point subtraction is performed with B as the operand. Lower 24 bits of A operand A x = (008001) 16
and the lower 24 bits of the B operand B x = (008000) 16
The operation regarding the mantissa part of A x is the two's complement value of B x .
x = (FF7FFF) 16 + (000001) 16 = (FF8000) Since it is done by adding 16 , the result Q x is Q x = (008001) 16 + (FF8000) 16 = (000001) 16 = (+1) becomes 10 . If this continues, Q x = (000001) The most significant digit x 5 of 16 is (0) 16 , so this digit x 5 is (0) 16
A number that is not i.e. the least significant digit (1) in this case 16
It is necessary to move the decimal point six digits higher so that . For this purpose, the floating point subtraction circuit 70 calculates the result by using the upper 8 bits of the A operand, A E = (46) 16 , and the upper 8 bits of the B operand, B E = (46) 16 , which correspond to the exponent part. The upper 8 bits F E corresponding to the exponent part of F are set as F E =(41) 16 , and the entire result F is output as F=(41100000) 16 . This 32-bit output result F = (41100000) 16
The most significant digit is (0) and the mantissa part F x =
(100000) has 16 (+1) 10 normalized floating point data. That is, given 16 bits of fixed point data (0001) 16 becomes 32
Normalized floating point data of 16 bits (41100000) is converted correctly. eventually,
This calculation result F is read by the CPU. Also, if the fixed-point data D I is negative (-1) 10
When D I = (FFFF) 16 , the upper 16 bits of registers 20, 30, 40, and 50 store (4600) 16 , and the lower 16 bits are fixed-point data with sign bit f15 inverted. The resulting data F = (4600 7FFF) 16 is stored. The contents of the register are input to the 32-bit A operand of the floating point subtraction circuit 70.
F is input, and the B operand input is fixed data B I = (0100 0110 0000
0000 1000 0000 0000 0000) 2 = (46008000) 16 is input. Therefore, by setting the read/write control signal 80 to logic 1 in the read state, the 32-bit data F = (4600 7FFF) 16 stored in the registers 20, 30, 40, and 50 and the fixed 32 Floating point subtraction is performed on bit data B I =(46008000) 16 . The operation between the lower 24 bits A x = (007FFF) 16 corresponding to the mantissa of the A operand and the lower 24 bits B x = (008000) 16 corresponding to the mantissa of the B operand is as follows:
A x to B x two's complement value x = (FF7FFF) 16 +
(000001) 16 = (FF8000) This is done by adding 16 , so the result is Q x = (007FFF) 16 + (FF8000) 16 = (FFFFFF) 16 = (-1) 10 . At the same time, the floating point subtraction circuit 70 extracts the upper 8 bits of the A operand corresponding to the exponent part.
= (46) 16 and the upper 8 bits of the B operand B E =
(46) 16 , the upper 8 bits F E corresponding to the exponent part of the result F are set as F E = (C1) 16 = (1100 0001) 2 , and the lower 24 bits corresponding to the mantissa part of the result F F
Set x to F x = (100000) 16 = (0001 0000 0000 0000 0000 0000) 2 , and output floating point data F = (C1100000) 16 normalized as a whole. The exponent part of the result F is F E = (1100
0001) 2 , so the most significant bit is 1. This shows that F is a negative number, n=
(000001) 2 = (+1) Since it is 10 , this exponent part F E
represents −16 +1 . On the other hand, the mantissa part of the normalized floating point data F x =
(100000) 16 represents (+0.1) 10 , so the output F=0.1×16 1 . That is, 16-bit negative fixed-point data (FFFF) 16 is correctly converted to 32-bit normalized floating-point data F=(C1100000) 16 . Ultimately, the result of this calculation can be read by the CPU. As described in detail above, if the data conversion circuit according to the present invention is used, one piece of hardware can convert fixed-point data to floating-point data without using software to determine whether the fixed-point data is positive or negative. Program processing can be performed using only software instructions. Therefore, the present invention contributes to reducing software and increasing the speed of conversion from fixed-point data to floating-point data.

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

図は本発明にかかるデータ変換回路の一実施例
の回路図。 10……入力データバス、20,30,40,
50……レジスタ、60……反転回路、70……
浮動小数点減算回路、80……読み書き制御信
号、90……出力データベース、201,30
1,401,501……書き込みデータ信号、2
02,302,402,502……デコード信
号、203,303,403,503……読み出
しデータ信号。
The figure is a circuit diagram of an embodiment of a data conversion circuit according to the present invention. 10...input data bus, 20, 30, 40,
50...Register, 60...Inverting circuit, 70...
Floating point subtraction circuit, 80... Read/write control signal, 90... Output database, 201, 30
1,401,501...Write data signal, 2
02, 302, 402, 502...Decode signal, 203, 303, 403, 503...Read data signal.

Claims (1)

【特許請求の範囲】 1 入力データバスに接続され浮動小数点データ
の仮数部に対応するデータ幅を持つた第1のレジ
スタ部と前記データバスから第1のレジスタ部に
送られるデータのうち固定小数点データの符号ビ
ツトに対応するビツトのみ反転する反転回路と、
入力データバスに接続され浮動小数点データの指
数部に対応するデータを格納する第2のレジスタ
部と、前記第1および第2のレジスタ部の全出力
をAオペランドとして入力する浮動小数点減算回
路とよりなり、第1のレジスタ部に前記反転回路
によつて符号ビツトのみ反転した固定小数点デー
タを置数し、前記第2のレジスタ部には固定小数
点データの小数点位置を浮動小数点データの仮数
部の小数点位置に移動するための調整データを入
力し、前記浮動小数点減算回路のBオペランドと
しては固定小数点データの符号ビツトに対応する
ビツトのみ論理1で他の浮動小数点データの仮数
部に対応するビツトは全て論理0とし浮動小数点
データの指数部に対応するビツトは前記第2のレ
ジスタ部に加えられる調整データと同様のデータ
がそれぞれ固定的に入力され、AオペランドとB
オペランドの浮動小数点減算により正規化された
浮動小数点データを出力データバスに出力して固
定小数点データから浮動小数点データへの変換を
行なうことを特徴とするデータ変換回路。 2 第1のレジスタ部のうち固定小数点データを
置数する以外のレジスタ部の上位部には論理0を
置数してなる特許請求の範囲第1項記載の固定小
数点データから浮動小数点データへのデータ変換
回路。 3 2バイト長の固定小数点データの最下位ビツ
トの右側にある小数点の位置を1バイト長の指数
部と3バイト長の仮数部からなる浮動小数点デー
タの仮数部の最上位ビツトの左側に移動する場合
で、浮動小数点データの指数部の正負の基準を10
進数で64とした場合は第2のレジスタ部には16進
数の(46)を入力してなる特許請求の範囲第1項
記載の小数点データから浮動小数点データへの変
換回路。
[Scope of Claims] 1. A first register section connected to an input data bus and having a data width corresponding to the mantissa part of floating-point data; and a fixed-point register section of the data sent from the data bus to the first register section. an inversion circuit that inverts only the bit corresponding to the sign bit of the data;
a second register section that is connected to the input data bus and stores data corresponding to the exponent part of the floating point data; and a floating point subtraction circuit that inputs all outputs of the first and second register sections as an A operand. The fixed point data whose sign bit has been inverted by the inversion circuit is placed in the first register section, and the decimal point position of the fixed point data is set as the decimal point of the mantissa part of the floating point data in the second register section. As the B operand of the floating point subtraction circuit, only the bit corresponding to the sign bit of the fixed point data is logic 1, and all the bits corresponding to the mantissa of the other floating point data are input. The bits corresponding to the exponent part of the floating point data set to logic 0 are fixedly input with the same data as the adjustment data added to the second register section, and the A operand and B operand
A data conversion circuit that converts fixed-point data to floating-point data by outputting floating-point data normalized by floating-point subtraction of operands to an output data bus. 2. The conversion from fixed-point data to floating-point data according to claim 1, in which logic 0 is placed in the upper part of the first register part other than the register part in which fixed-point data is stored. Data conversion circuit. 3 Move the decimal point to the right of the least significant bit of 2-byte fixed-point data to the left of the most significant bit of the mantissa of floating-point data consisting of a 1-byte exponent and 3-byte mantissa. In case, the sign of the exponent part of floating point data is 10
2. The conversion circuit from decimal point data to floating point data according to claim 1, wherein when the number is 64 in hexadecimal, a hexadecimal number (46) is input to the second register section.
JP55131278A 1980-09-20 1980-09-20 Data converting circuit Granted JPS5755447A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP55131278A JPS5755447A (en) 1980-09-20 1980-09-20 Data converting circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP55131278A JPS5755447A (en) 1980-09-20 1980-09-20 Data converting circuit

Publications (2)

Publication Number Publication Date
JPS5755447A JPS5755447A (en) 1982-04-02
JPS6252330B2 true JPS6252330B2 (en) 1987-11-05

Family

ID=15054192

Family Applications (1)

Application Number Title Priority Date Filing Date
JP55131278A Granted JPS5755447A (en) 1980-09-20 1980-09-20 Data converting circuit

Country Status (1)

Country Link
JP (1) JPS5755447A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5924342A (en) * 1982-07-30 1984-02-08 Hitachi Ltd Arithmetic device

Also Published As

Publication number Publication date
JPS5755447A (en) 1982-04-02

Similar Documents

Publication Publication Date Title
US5282153A (en) Arithmetic logic unit
EP0127988B1 (en) A normalizing circuit
JP2674754B2 (en) Barrel shifter
JP2662196B2 (en) Calculation result normalization method and apparatus
US5862065A (en) Method and circuit for fast generation of zero flag condition code in a microprocessor-based computer
US5497341A (en) Sign-extension of immediate constants in an ALU using an adder in an integer logic unit
US5469377A (en) Floating point computing device for simplifying procedures accompanying addition or subtraction by detecting whether all of the bits of the digits of the mantissa are 0 or 1
JPS6097435A (en) Arithmetic processor
EP0171805A2 (en) High speed digital arithmetic unit
JP3178746B2 (en) Format converter for floating point numbers
JPH0145649B2 (en)
EP0234495B1 (en) Arithmetic circuit capable of executing floating point operations and fixed point operations
JPH0343645B2 (en)
JPS6252330B2 (en)
GB1006868A (en) Data processing machine
EP0265948B1 (en) Data processor capable of immediately calculating branch address in relative address branch
JPS5968058A (en) Floating point multiplier
US4041296A (en) High-speed digital multiply-by-device
JPS59206942A (en) Leading &#34;1&#34; detecting circuit
JPH0619700B2 (en) Arithmetic unit
JP2842768B2 (en) Floating point arithmetic unit
JP3139011B2 (en) Fixed-point processor
JPH0323937B2 (en)
JPS6149234A (en) Multiplier circuit for floating point
JPS62154134A (en) Data converter