JPH07146777A - Arithmetic unit - Google Patents

Arithmetic unit

Info

Publication number
JPH07146777A
JPH07146777A JP5293082A JP29308293A JPH07146777A JP H07146777 A JPH07146777 A JP H07146777A JP 5293082 A JP5293082 A JP 5293082A JP 29308293 A JP29308293 A JP 29308293A JP H07146777 A JPH07146777 A JP H07146777A
Authority
JP
Japan
Prior art keywords
circuit
arithmetic
data
output
correction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP5293082A
Other languages
Japanese (ja)
Inventor
Junji Nishikawa
順二 西川
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 JP5293082A priority Critical patent/JPH07146777A/en
Publication of JPH07146777A publication Critical patent/JPH07146777A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To provide an arithmetic unit where power consumption is reduced by varying arithmetic accuracy and decreasing significant digit number. CONSTITUTION:This arithmetic unit is provided with a holding means 10 storing plural data, an arithmetic circuit 20 performing a calculation by the data from the holding means 10, a selection means 30 selecting the output of the arithmetic circuit 20 and a data input and outputting data, an accuracy setting means 40 designating a significant digit number for the data that the selection means 30 outputs and a correction means 50 performing an accuracy correction by the control signal of the accuracy setting means 40 and outputting the correction to the holding means 10.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、コンピュータシステム
における演算装置に関するもので、特に演算精度を可変
にする演算回路に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an arithmetic unit in a computer system, and more particularly to an arithmetic circuit which makes arithmetic precision variable.

【0002】[0002]

【従来の技術】従来より、コンピュータシステムにおい
ては、演算装置によって各種の演算処理を行っている。
従来の演算装置の例を図11に示す。この例の場合は、
マイクロプロセッサ等において一般にデータパスブロッ
クと呼ばれる部分であり、データを格納するレジスタ8
0と、このレジスタ80からのデータに対して演算を行
う浮動小数点演算回路81とからなる。浮動小数点演算
回路81からの演算結果の出力82はレジスタ80に格
納されるが、この回路での演算精度は一定である。倍精
度浮動小数点データの場合には指数部が11ビットで仮数
部が52ビット使用される。通常の演算では、アプリケー
ションソフトウエアで必要とされる演算精度よりも、こ
の演算装置の演算精度が十分に高い。
2. Description of the Related Art Conventionally, in a computer system, various arithmetic processes are performed by an arithmetic unit.
An example of a conventional arithmetic unit is shown in FIG. In this case,
A register 8 for storing data, which is a portion generally called a data path block in a microprocessor or the like.
0 and a floating point arithmetic circuit 81 that operates on the data from the register 80. The output 82 of the calculation result from the floating point calculation circuit 81 is stored in the register 80, but the calculation precision in this circuit is constant. In the case of double precision floating point data, the exponent part is 11 bits and the mantissa part is 52 bits. In normal arithmetic, the arithmetic precision of this arithmetic unit is sufficiently higher than the arithmetic precision required by application software.

【0003】コンピュータシステムにおいて、算術論理
演算装置(ALU)や浮動小数点演算装置では有効桁数が
一定の場合が多いが、アプリケーションによっては有効
桁数が少なくて済む場合がある。このような余分な演算
精度が必要でない場合には、演算精度を切り替える方法
がある。浮動小数点演算装置においては通常は単精度と
倍精度の2つを切り替える機能を持つことが多い。この
他に演算精度を可変にする例として、特開平2-293928号
公報には演算語長可変の算術論理演算回路の入力と出力
に有効桁数を補正する補正回路を用いる方法が開示され
ている。
In a computer system, an arithmetic logic unit (ALU) or a floating point arithmetic unit often has a fixed number of significant digits, but depending on the application, the number of significant digits may be small. When such extra calculation accuracy is not required, there is a method of switching the calculation accuracy. Floating-point arithmetic units usually have a function of switching between single precision and double precision. In addition to this, as an example of changing the operation precision, Japanese Patent Laid-Open No. 2-293928 discloses a method of using a correction circuit for correcting the number of significant digits for the input and output of an arithmetic logic operation circuit with a variable operation word length. There is.

【0004】[0004]

【発明が解決しようとする課題】従来の演算精度が一定
の演算装置においては、有効桁数が小さくてよい場合で
も有効桁数よりも多くの回路が動作し消費電力が大きく
なるという問題点があった。また、演算器に対する入力
と出力部に桁数の補正を行う方法では、補正回路が複数
必要となりハードウエア規模が大きくなるという問題点
があった。さらに、このような補正回路では、演算回路
部分だけにしか作用せず、演算装置の全体からみれば消
費電力を十分に小さくできない。
In a conventional arithmetic unit having a constant arithmetic precision, there is a problem that even if the effective digit number may be small, more circuits operate than the effective digit number and power consumption increases. there were. Further, the method of correcting the number of digits in the input and output units of the arithmetic unit has a problem that a plurality of correction circuits are required and the hardware scale becomes large. Furthermore, such a correction circuit acts only on the arithmetic circuit portion, and the power consumption cannot be sufficiently reduced from the viewpoint of the entire arithmetic device.

【0005】また、浮動小数点加減算装置においては、
入力データの有効桁数が小さくても内部で桁合わせのシ
フト動作を行うために、加減算を行う回路部分への入力
のビット数が有効桁数よりも多くなり、無駄な動作によ
って消費電力が大きくなるという問題点があった。
Further, in the floating point addition / subtraction device,
Even if the number of significant digits of the input data is small, the shift operation for digit alignment is performed internally, so the number of bits input to the circuit part that performs addition and subtraction is greater than the number of significant digits, resulting in unnecessary power consumption and large power consumption. There was a problem that

【0006】本発明は、上記問題点を解決するために、
演算の有効桁数の少なくてよい場合には演算装置の動作
する部分を制限することのできる演算装置を提供するこ
とを目的とする。
In order to solve the above problems, the present invention provides
An object of the present invention is to provide an arithmetic unit capable of limiting the operating portion of the arithmetic unit when the number of effective digits of arithmetic is small.

【0007】[0007]

【課題を解決するための手段】上記目的を達成するため
に、本発明は、演算装置にデータの有効桁数を補正する
補正手段を備えており、補正手段以降のデータにおいて
有効桁数外のビットの値を固定することとしたものであ
る。
In order to achieve the above-mentioned object, the present invention is provided with a correction means for correcting the number of significant digits of data in the arithmetic unit, and the data after the number of the significant digits is corrected outside the number of significant digits. The value of the bit is fixed.

【0008】具体的に説明すると、請求項1の発明に係
る演算装置では、演算回路の出力とデータ入力とを選択
して出力する選択手段と、前記選択手段の出力するデー
タに対して精度補正を行いデータを格納する保持手段に
出力する補正手段とを備えることとした。
Specifically, in the arithmetic unit according to the invention of claim 1, the selecting means for selecting and outputting the output of the arithmetic circuit and the data input, and the accuracy correction for the data output by the selecting means. And a correction means for outputting the data to a holding means for storing the data.

【0009】請求項2の発明に係る演算装置では、前記
補正手段は精度設定手段によって指定される有効桁への
丸め処理を行う回路と、前記指定された有効桁の下位ビ
ットを0にマスクする回路とを有するものである。
In the arithmetic unit according to the second aspect of the invention, the correction means masks a circuit for rounding to a significant digit designated by the precision setting means and a lower bit of the designated significant digit to 0. And a circuit.

【0010】請求項3の発明に係る演算装置では、前記
演算回路は整数データに対する算術論理演算を行う機能
を有し、前記補正手段は、精度設定手段で指定された有
効桁数が上位のビット数となるように左シフトする第1
のシフト回路と、有効桁数が下位のビット数となるよう
に右シフトする第2のシフト回路と、シフトせずにその
まま出力するバイパス回路とを備えており、前記補正手
段は、データ入力が選択されたときは第1のシフト回路
でシフトしたデータを保持手段に出力し、選択手段にお
いて演算回路の出力が選択されかつ保持手段にデータを
格納するときはバイパス回路から出力し、選択手段にお
いて演算回路の出力が選択されかつ演算装置の外部に出
力するときは第2のシフト回路から出力する機能を有す
るものである。
In the arithmetic unit according to the third aspect of the present invention, the arithmetic circuit has a function of performing arithmetic logic operation on integer data, and the correction unit has a significant number of significant digits designated by the precision setting unit. The first shift left to a number
The shift circuit, the second shift circuit that shifts to the right so that the number of significant digits is the lower-order bit number, and the bypass circuit that outputs the data as it is without shifting. When selected, the data shifted by the first shift circuit is output to the holding means, and when the output of the arithmetic circuit is selected in the selecting means and the data is stored in the holding means, the data is output from the bypass circuit, and in the selecting means. When the output of the arithmetic circuit is selected and output to the outside of the arithmetic device, it has a function of outputting from the second shift circuit.

【0011】請求項4の発明に係る演算装置では、2つ
の浮動小数点データの指数部の差をとる第1の演算回路
と、この第1の演算回路の出力にしたがって浮動小数点
データの仮数部の桁合わせを行うシフト回路と、このシ
フト回路から出力に対して精度設定手段からの制御信号
によって精度補正する補正手段と、この補正手段によっ
て補正した仮数部の数値に対して加減算を行う第2の演
算回路と、第2の演算回路の出力と浮動小数点データの
指数部とを正規化する第3の演算回路とを備えることと
した。
In the arithmetic unit according to the fourth aspect of the present invention, the first arithmetic circuit for taking the difference between the exponent parts of two floating point data and the mantissa part of the floating point data according to the output of the first arithmetic circuit. A shift circuit that performs digit alignment, a correction unit that corrects the output from the shift circuit with a control signal from a precision setting unit, and a second value that performs addition and subtraction on the mantissa value corrected by the correction unit. An arithmetic circuit and a third arithmetic circuit for normalizing the output of the second arithmetic circuit and the exponent part of the floating point data are provided.

【0012】請求項5の発明に係る演算装置では、請求
項4記載の浮動小数点加減算演算装置において、補正手
段は精度設定手段によって指定される有効桁への丸め処
理を行う回路と、前記指定された有効桁の下位ビットを
0にマスクする回路とを有するものである。
According to a fifth aspect of the present invention, in the floating point addition / subtraction arithmetic device according to the fourth aspect, the correction means is a circuit for performing rounding processing to a significant digit designated by the precision setting means, and the designation means. And a circuit for masking the lower bits of the significant digit to 0.

【0013】[0013]

【作用】請求項1の発明によれば、補正手段を通して補
正されたデータを保持し、このデータに対して演算を行
うとともに、この演算結果に対しても補正手段によって
演算桁数の補正を行う。
According to the first aspect of the present invention, the data corrected by the correction means is held, the calculation is performed on this data, and the correction means also corrects the number of calculation digits. .

【0014】請求項2の発明によれば、丸め回路によっ
て補正が実行されるとともに、演算装置の内部において
演算桁数の有効桁外のビットは常に0に固定された状態
になる。
According to the second aspect of the present invention, the correction is executed by the rounding circuit, and the bits outside the significant digit of the number of arithmetic digits are always fixed to 0 inside the arithmetic unit.

【0015】請求項3の発明によれば、整数データが入
力されたときは左シフトして格納し、演算結果に対して
はそのままのデータを格納し、データを外部に出力する
ときは演算結果を右シフトして出力する。
According to the third aspect of the present invention, when integer data is input, the data is left-shifted and stored, the operation result is stored as it is, and when the data is output to the outside, the operation result is output. Is shifted right and output.

【0016】請求項4の発明によれば、浮動小数点加減
算を行うときの仮数部の桁合わせ後のデータに対して補
正を行い、補正した仮数部に対して浮動小数点演算を行
う。
According to the invention of claim 4, the data after the digit alignment of the mantissa when performing the floating point addition and subtraction is corrected, and the floating point operation is performed on the corrected mantissa.

【0017】請求項5の発明によれば、丸め回路によっ
て補正が実行されるとともに、仮数部の有効桁外のビッ
トは常に0に固定された状態になる。
According to the fifth aspect of the present invention, the correction is executed by the rounding circuit, and the significant digits of the mantissa are always fixed to 0.

【0018】[0018]

【実施例】【Example】

(実施例1)以下、この発明の実施例を図面を参照しな
がら説明する。
(Embodiment 1) Hereinafter, an embodiment of the present invention will be described with reference to the drawings.

【0019】この発明の第1の実施例を図1から図5に
基づいて説明する。図1は、本実施例の演算装置の構成
を示すブロック図である。この演算装置は複数のデータ
を格納する保持手段10と、この保持手段から出力され
るデータに対して演算を行う演算回路20と、この演算
回路20の出力32と入力データ31の一方を選択して
出力する選択手段30と、演算精度を指定する演算精度
設定手段40と、演算精度設定手段40の出力する有効
桁数41にしたがって選択手段30の出力33に対して
精度補正を行う補正手段50とから構成される。補正手
段50の出力データ51は、保持手段10に戻されると
ともに、出力データ51として外部に出力される。
A first embodiment of the present invention will be described with reference to FIGS. 1 to 5. FIG. 1 is a block diagram showing the configuration of the arithmetic unit of this embodiment. This arithmetic unit selects a holding means 10 for storing a plurality of data, an arithmetic circuit 20 for performing an arithmetic operation on the data output from the holding means, an output 32 of the arithmetic circuit 20 and an input data 31. Selecting means 30 for outputting the calculation accuracy, calculation accuracy setting means 40 for specifying the calculation accuracy, and correction means 50 for performing accuracy correction on the output 33 of the selection means 30 in accordance with the number of significant digits 41 output by the calculation accuracy setting means 40. Composed of and. The output data 51 of the correction means 50 is returned to the holding means 10 and is output to the outside as the output data 51.

【0020】図2は、補正手段50の内部構成を示すブ
ロック図である。補正手段50への入力33は丸め回路
52で丸め処理されて出力データ34として出力され
る。この出力データ34はマスク回路53に入力され、
さらにマスク回路53でマスクされる。丸め回路52と
マスク回路53には、演算精度設定手段40の出力する
有効桁数41が入力され、指定された桁数の処理を行
う。
FIG. 2 is a block diagram showing the internal structure of the correction means 50. The input 33 to the correction means 50 is rounded by the rounding circuit 52 and output as output data 34. This output data 34 is input to the mask circuit 53,
Further, it is masked by the mask circuit 53. The effective digit number 41 output from the arithmetic precision setting means 40 is input to the rounding circuit 52 and the mask circuit 53, and the designated digit number is processed.

【0021】以上のように構成された演算装置の動作を
図3〜図5を用いて説明する。まず、演算装置における
データの流れについて説明する。外部から入力されるデ
ータ31は、選択手段30によって選択されて補正手段
50において精度が補正されて保持手段10に格納され
る。演算回路20における演算は保持手段10に格納さ
れているデータに対して実行される。この演算結果32
は選択手段30によって選択され、補正手段50におい
て精度が補正されて保持手段10に格納されか、また
は、外部に出力データ51として出力される。
The operation of the arithmetic unit configured as above will be described with reference to FIGS. First, the flow of data in the arithmetic unit will be described. The data 31 input from the outside is selected by the selection unit 30, the accuracy is corrected by the correction unit 50, and stored in the holding unit 10. The arithmetic operation in the arithmetic circuit 20 is executed on the data stored in the holding means 10. This calculation result 32
Is selected by the selection means 30, the accuracy is corrected by the correction means 50 and stored in the holding means 10, or output as output data 51 to the outside.

【0022】次に、図3と図4に従って、有効桁数41
が4ビットの場合の補正手段の動作について説明する。
図3に丸め回路52の動作例を示す。8ビットの入力デ
ータ33に対して、下位から4ビット目に1が立ってい
る丸めビットを加算し、上位の4ビットが有効桁数とな
る演算を行う。図4にマスク回路53の動作例を示す。
8ビットの入力データに対して下位4ビットがマスクさ
れ0に固定される。有効桁数41で指定される上位の4
ビットはそのまま出力される。このように、データは有
効桁数41の部分で丸め処理され、有効桁数以下の部分
はマスクされる。
Next, according to FIGS. 3 and 4, the number of significant digits 41 is 41.
The operation of the correction means in the case of 4 bits will be described.
FIG. 3 shows an operation example of the rounding circuit 52. A rounding bit in which 1 is set to the 4th bit from the lower order is added to the 8-bit input data 33, and an operation in which the upper 4bits are the number of significant digits is performed. FIG. 4 shows an operation example of the mask circuit 53.
The lower 4 bits of the 8-bit input data are masked and fixed at 0. Upper 4 specified by the number of significant digits 41
Bits are output as is. In this way, the data is rounded at the portion having the effective digit number 41, and the portion having the effective digit number or less is masked.

【0023】以上の補正動作を適用するデータの例とし
て、図5に浮動小数点数値データの場合のデータフォー
マットの例を示す。最上位ビットSはサインビットであ
り、次が指数部であり、下位のフィールドが仮数部であ
る。この中の仮数部に対して有効桁数41で指定される
範囲のビットが、補正手段50によって図3と図4の例
に示したように丸め処理とマスク処理される。つまり、
補正手段50において図5の斜線で示す下位ビットの部
分を0にマスクして出力され、保持手段10に格納され
る。従って、演算回路20では、有効桁数41から下位
のビットが全て0にマスクされたデータに対する演算が
実行されるとともに、有効桁数41の精度のデータとし
て保持手段10に格納されか、または、外部に出力デー
タ51として出力される。
As an example of data to which the above correction operation is applied, FIG. 5 shows an example of a data format in the case of floating point numerical data. The most significant bit S is a sign bit, the next is an exponent part, and the lower field is a mantissa part. The bits in the range designated by the number of significant digits 41 with respect to the mantissa among these are rounded and masked by the correction means 50 as shown in the examples of FIGS. 3 and 4. That is,
In the correction means 50, the lower bit portion shown by the diagonal lines in FIG. 5 is masked to 0 and output, and stored in the holding means 10. Therefore, in the arithmetic circuit 20, the arithmetic operation is performed on the data in which all the lower bits from the effective digit number 41 are masked to 0, and is stored in the holding means 10 as the data of the precision of the effective digit number 41, or The output data 51 is output to the outside.

【0024】以上に述べたように、本実施例の演算装置
においては、入力データ31が補正されて保持手段10
に格納された後は、演算装置の中のデータは全て指定さ
れた有効桁数41の演算精度にすることができる。この
演算精度を可変にするための精度補正は、1箇所の補正
手段50を入れるだけでよい。また、演算装置の中の保
持手段10と演算回路20は、斜線で示される下位ビッ
トが入力データ31の値によらずに0に固定された状態
になり、この下位ビット部分は一定の状態になる。した
がって、保持手段10と演算回路20の中で、状態が一
定になる部分はトランジスタのオン/オフが発生せず無
駄な電力を消費しない。
As described above, in the arithmetic unit of this embodiment, the holding means 10 corrects the input data 31.
After being stored in, the data in the arithmetic unit can all have the arithmetic precision of the designated effective digit number 41. The accuracy correction for making the calculation accuracy variable only needs to include the correction means 50 at one place. Further, the holding means 10 and the arithmetic circuit 20 in the arithmetic unit are in a state in which the lower-order bits indicated by diagonal lines are fixed to 0 regardless of the value of the input data 31, and the lower-order bits are in a constant state. Become. Therefore, in the holding unit 10 and the arithmetic circuit 20, a portion where the state is constant does not turn on / off the transistor and does not consume useless power.

【0025】(実施例2)この発明の第2の実施例を図
1と図6から図9に基づいて説明する。
(Second Embodiment) A second embodiment of the present invention will be described with reference to FIGS. 1 and 6 to 9.

【0026】図1は、本実施例の演算装置の構成を示す
ブロック図であり、第1の実施例と同じである。本実施
例は補正手段の構成が異なる。
FIG. 1 is a block diagram showing the arrangement of the arithmetic unit of this embodiment, which is the same as that of the first embodiment. The present embodiment is different in the configuration of the correction means.

【0027】図6は、補正手段50の内部構成を示すブ
ロック図である。補正手段50への入力33は右シフト
回路54と左シフト回路55とバイパス回路56に供給
される。右シフト回路54と左シフト回路55とバイパ
ス回路56のうちの1つの出力が補正手段50の出力5
1として出力される。右シフト回路54と左シフト回路
55には、演算精度設定手段40の出力する有効桁数4
1が入力され、指定された桁数のシフト処理を行う。
FIG. 6 is a block diagram showing the internal structure of the correction means 50. The input 33 to the correction means 50 is supplied to the right shift circuit 54, the left shift circuit 55, and the bypass circuit 56. One output of the right shift circuit 54, the left shift circuit 55, and the bypass circuit 56 is the output 5 of the correction means 50.
It is output as 1. In the right shift circuit 54 and the left shift circuit 55, the number of significant digits 4 output from the calculation precision setting means 40 is 4
1 is input, and the shift process of the designated number of digits is performed.

【0028】以上のように構成された演算装置の動作を
図7〜図9を用いて説明する。データの流れは第1の実
施例と同様の流れである。本実施例では補正の方法が異
なる。図7と図8に従って、演算装置の桁数が8ビット
で有効桁数41が4ビットの場合の補正手段の動作につ
いて説明する。図7に左シフト回路54の動作例を示
す。8ビットの入力データ33に対して、4ビット左シ
フトして出力する。図8に右シフト回路55の動作例を
示す。8ビットの入力データ33に対して、4ビット右
シフトして出力する。パイバス回路は入力される8ビッ
トがそのまま出力される。
The operation of the arithmetic unit configured as above will be described with reference to FIGS. The data flow is the same as in the first embodiment. In this embodiment, the correction method is different. The operation of the correction means when the number of digits of the arithmetic unit is 8 bits and the number of significant digits 41 is 4 bits will be described with reference to FIGS. 7 and 8. FIG. 7 shows an operation example of the left shift circuit 54. The 8-bit input data 33 is shifted left by 4 bits and output. FIG. 8 shows an operation example of the right shift circuit 55. The 8-bit input data 33 is right-shifted by 4 bits and output. The 8-bit input is directly output to the pi-bus circuit.

【0029】この右シフト回路54と左シフト回路55
とバイパス回路56は、それぞれ次のような場合に選択
されて動作を行う。入力データ31が保持手段10に格
納されるときには、左シフト回路55によって補正され
て格納される。演算回路20の出力を保持手段10に格
納するときには、バイパス回路56によってそのままの
値が格納される。演算回路20の出力を出力データ51
として外部に出力する場合には右シフト回路54によっ
て補正されて出力される。
The right shift circuit 54 and the left shift circuit 55.
The bypass circuit 56 and the bypass circuit 56 are selected and operate in the following cases. When the input data 31 is stored in the holding means 10, it is corrected by the left shift circuit 55 and stored. When the output of the arithmetic circuit 20 is stored in the holding means 10, the bypass circuit 56 stores the value as it is. The output of the arithmetic circuit 20 is output data 51.
When it is output to the outside as, it is corrected by the right shift circuit 54 and output.

【0030】以上の回路の動作にしたがって精度の補正
と演算処理の動作について説明する。図9は整数データ
の場合のデータフォーマットの例を示す。外部から入力
されるデータ31は、下位ビットから有効桁数41で指
定される桁数が有効な値である。このデータは補正回路
によって左シフトされ、シフトされた後の斜線で示す下
位ビットは0が入る。従って、補正された後のデータに
ついては、保持手段10と演算回路20の間で演算処理
を行う間は、図9の斜線のビットは常に固定された状態
となる。このとき演算回路20は、精度可変の演算回路
にする必要はなく、有効桁数41の値にかかわりなく全
ビット分の精度の処理を行えばよい。例えば加算の場合
であれば、有効桁数の以外の下位ビットの部分は0のデ
ータが入力されているので、加算処理には無関係となり
有効桁数のデータに対する演算に影響しない。また、加
算の結果、演算回路20の最上位ビットに桁溢れを生じ
る場合は有効桁数41を越えたことがわかる。つまり、
演算精度設定手段40において任意の精度を設定した場
合でも、有効桁数に対するオーバーフロー等の制御回路
を変える必要はなく1つの演算精度固定の演算回路20
を用いることができる。さらに、演算結果を出力データ
51として外部に出力する場合は、演算回路20の出力
の上位にある有効桁が、補正手段50によって下位に移
動し、正しい有効桁数の結果として出力することができ
る。
The operation of accuracy correction and arithmetic processing will be described according to the operation of the above circuit. FIG. 9 shows an example of the data format in the case of integer data. The data 31 input from the outside has a valid digit number designated by the significant digit number 41 from the lower bit. This data is left-shifted by the correction circuit, and 0 is entered in the lower bit shown by the diagonal line after the shift. Therefore, for the corrected data, the shaded bits in FIG. 9 are always fixed during the arithmetic processing between the holding means 10 and the arithmetic circuit 20. At this time, the arithmetic circuit 20 does not need to be a variable precision arithmetic circuit, and may perform precision processing for all bits regardless of the value of the number of significant digits 41. For example, in the case of addition, since the data of 0 is input to the lower bit part other than the significant digit number, it is irrelevant to the addition process and does not affect the operation on the valid digit number data. Also, as a result of the addition, when the most significant bit of the arithmetic circuit 20 overflows, it can be seen that the number of significant digits 41 is exceeded. That is,
Even if an arbitrary precision is set in the calculation precision setting means 40, there is no need to change the control circuit for overflow or the like with respect to the number of significant digits, and one calculation circuit 20 with a fixed calculation precision.
Can be used. Further, when the calculation result is output to the outside as the output data 51, the significant digit in the upper portion of the output of the arithmetic circuit 20 is moved to the lower portion by the correction means 50 and can be output as the result of the correct number of significant digits. .

【0031】以上のように、入力するデータの下位ビッ
ト部分が有効であるデータの場合に、1箇所の補正手段
で演算精度を可変にすることが可能であり、本実施例の
演算装置における演算の間は指定された有効桁数41の
精度の演算を行うことができる。このとき、演算回路2
0は固定精度の演算回路でよい。また、保持手段10と
演算回路20の回路の全桁数から有効桁数を除いた下位
ビットは常に値が固定された状態になり、この下位ビッ
ト部分は一定の状態になる。したがって、保持手段10
と演算回路20の中で、状態が一定になる部分はトラン
ジスタのオン/オフが発生せず無駄な電力を消費せず、
低消費電力にすることが可能である。
As described above, in the case where the lower bit part of the input data is valid data, it is possible to make the calculation accuracy variable by one correction means, and the calculation in the calculation device of this embodiment is performed. During this period, the calculation can be performed with the precision of the designated significant digit number 41. At this time, the arithmetic circuit 2
0 may be a fixed precision arithmetic circuit. The lower bits obtained by removing the significant digits from the total number of digits of the holding means 10 and the arithmetic circuit 20 are always fixed, and the lower bits are in a constant state. Therefore, the holding means 10
In the arithmetic circuit 20, the portion where the state is constant does not turn on / off the transistor and does not consume useless power,
It is possible to reduce power consumption.

【0032】(実施例3)この発明の第3の実施例を図
10と図2に基づいて説明する。
(Embodiment 3) A third embodiment of the present invention will be described with reference to FIGS.

【0033】図10は、本実施例の演算装置の構成を示
すブロック図である。演算装置は、指数部の差をとる減
算回路60と、仮数部の桁合わせを行うシフト回路61
と、シフト回路61の出力に対して演算精度設定手段6
5から指定される精度補正を行う補正手段62と、補正
後のデータに対して加減算を行う加減算回路63と、加
減算回路63の演算結果に対して桁合わせと指数部に対
する補正を行う正規化回路64から構成される。補正手
段は図2に示す丸め回路とマスク回路から構成され、第
1の実施例で説明したとおりの動作を行う。
FIG. 10 is a block diagram showing the configuration of the arithmetic unit of this embodiment. The arithmetic unit includes a subtraction circuit 60 that calculates the difference of the exponent part and a shift circuit 61 that performs digit matching of the mantissa part.
And the calculation accuracy setting means 6 for the output of the shift circuit 61.
5, a correction unit 62 for performing accuracy correction, an addition / subtraction circuit 63 for performing addition / subtraction on the corrected data, and a normalization circuit for performing digit alignment and correction for the exponent part on the operation result of the addition / subtraction circuit 63. It is composed of 64. The correction means is composed of the rounding circuit and the mask circuit shown in FIG. 2 and operates as described in the first embodiment.

【0034】次に、本実施例の動作について説明する。
2つの浮動小数点データは入力70と入力71にそれぞ
れ供給される。それぞれの浮動小数点データは指数部と
仮数部に分離されそれぞれが減算回路60と、シフト回
路61に供給される。減算回路60において指数部の値
が比較され、その差の分だけ小さいほうの浮動小数点デ
ータ70または71の仮数部をシフト回路61において
右にシフトして桁合わせを行う。この桁合わせにおい
て、桁合わせされる仮数部データは演算精度設定手段6
5によって指定される仮数部の有効桁数を越えて右シフ
トされるので、この部分を補正手段62において補正す
る。補正回路動作は第1の実施例で述べたとおりであ
る。補正後の仮数部の2つのデータはともに、有効桁数
72で示される精度の数値であり、この2つのデータに
対する演算を加減算回路63で実行することにより仮数
部の演算が行われる。この加減算の結果は、加算の場合
は桁上がりが発生し、減算の場合は桁落ちが発生する場
合があるので、仮数部の最上位ビットの1の位置を検出
して正規化する。この仮数部の正規化は仮数部データの
シフト処理である。さらに、この正規化回路73は仮数
部をシフトした分だけ指数部の値を補正する。
Next, the operation of this embodiment will be described.
The two floating point data are supplied to the input 70 and the input 71, respectively. Each floating point data is separated into an exponent part and a mantissa part and supplied to the subtraction circuit 60 and the shift circuit 61, respectively. The subtraction circuit 60 compares the values of the exponents and shifts the mantissa of the floating-point data 70 or 71, which is smaller by the difference, to the right in the shift circuit 61 to perform digit alignment. In this digit matching, the mantissa data to be digit matched is the calculation precision setting means 6
Since the number of significant digits of the mantissa part designated by 5 is shifted to the right, this part is corrected by the correction means 62. The correction circuit operation is as described in the first embodiment. Both of the two data of the corrected mantissa part are numerical values with the precision indicated by the number of significant digits 72, and the mantissa part is calculated by executing the calculation on these two data by the adder / subtractor circuit 63. Since a carry may occur in the case of addition and a carry may occur in the case of subtraction in the result of this addition and subtraction, the position of the most significant bit 1 of the mantissa part is detected and normalized. The normalization of the mantissa part is a shift process of the mantissa part data. Further, the normalization circuit 73 corrects the value of the exponent part by the amount of shifting the mantissa part.

【0035】以上に述べたように、浮動小数点加減算演
算装置において、補正手段62によって精度を可変にす
ることができる。さらに、とこの補正手段以降の加減算
回路63と正規化回路73の有効桁数外の下位ビットの
状態を固定することが可能となり、有効桁数に合わせて
無駄な回路の動作が発生しないようにして低消費電力に
することができる。
As described above, in the floating point addition / subtraction arithmetic unit, the accuracy can be made variable by the correction means 62. Furthermore, it becomes possible to fix the state of the lower bits outside the effective digit number of the adder / subtractor circuit 63 and the normalization circuit 73 after this correction means, and prevent unnecessary circuit operation according to the effective digit number. Power consumption can be reduced.

【0036】[0036]

【発明の効果】以上説明してきたとおり、請求項1の発
明によれば、1箇所の補正手段によって演算精度を可変
にすることができる。このとき、演算回路の演算精度は
精度一定の回路でよい。請求項2の発明によれば、演算
装置の中の有効桁数外の下位ビットを一定の値に固定す
ることができ、状態の変化する部分を制限することがで
き、消費電力を低減することができる。請求項3の発明
によれば、入力データの下位ビットが有効桁である場合
にも演算装置の中の処理において演算精度を可変にし、
さらに、下位ビットを一定の状態にすることができ、消
費電力を低減することができる。請求項4の発明によれ
ば、浮動小数点データに対する加減算を行うときに、桁
合わせした後に補正を行い加算器の演算を行い精度可変
にすることができる。請求項5の発明によれば、演算装
置の中の有効桁数外の下位ビットを一定の値に固定する
ことができ、状態の変化する部分を制限することがで
き、消費電力を低減することができる。
As described above, according to the first aspect of the present invention, the calculation accuracy can be made variable by the correction means at one place. At this time, the arithmetic accuracy of the arithmetic circuit may be constant. According to the invention of claim 2, the lower bits outside the effective digit number in the arithmetic unit can be fixed to a constant value, the part where the state changes can be limited, and the power consumption can be reduced. You can According to the invention of claim 3, even when the lower bit of the input data is a significant digit, the arithmetic precision is made variable in the processing in the arithmetic unit,
Furthermore, the lower bits can be kept in a constant state, and power consumption can be reduced. According to the invention of claim 4, when the addition and subtraction are performed on the floating point data, it is possible to perform the correction after the digit alignment and the arithmetic operation of the adder to make the precision variable. According to the invention of claim 5, the lower bits outside the significant digit number in the arithmetic unit can be fixed to a constant value, the part where the state changes can be limited, and the power consumption can be reduced. You can

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

【図1】本発明の第1の実施例における演算装置の構成
FIG. 1 is a configuration diagram of an arithmetic unit according to a first embodiment of the present invention.

【図2】同実施例における補正手段の構成図FIG. 2 is a configuration diagram of a correction unit in the same embodiment.

【図3】同実施例における丸め回路の動作図FIG. 3 is an operation diagram of a rounding circuit in the embodiment.

【図4】同実施例におけるマスク回路の動作図FIG. 4 is an operation diagram of a mask circuit according to the same embodiment.

【図5】同実施例における浮動小数点データのフォーマ
ット図
FIG. 5 is a format diagram of floating-point data in the same embodiment.

【図6】本発明の第2の実施例における補正手段の構成
FIG. 6 is a configuration diagram of a correction unit according to a second embodiment of the present invention.

【図7】同実施例における左シフト回路の動作図FIG. 7 is an operation diagram of a left shift circuit in the same embodiment.

【図8】同実施例における右シフト回路の動作図FIG. 8 is an operation diagram of a right shift circuit according to the same embodiment.

【図9】同実施例における整数データのフォーマット図FIG. 9 is a format diagram of integer data in the same embodiment.

【図10】本発明の第3の実施例における演算装置の構
成図
FIG. 10 is a block diagram of an arithmetic unit according to a third embodiment of the present invention.

【図11】従来の演算装置の構成図FIG. 11 is a block diagram of a conventional arithmetic unit.

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

10 保持手段 20 演算回路 30 選択手段 40 演算精度設定手段 50、62 補正手段 52 丸め回路 53 マスク回路 54 右シフト回路 55 左シフト回路 56 バイパス回路 60 減算回路 61 シフト回路 63 加減算回路 64 正規化回路 10 holding means 20 arithmetic circuit 30 selecting means 40 arithmetic precision setting means 50, 62 correction means 52 rounding circuit 53 mask circuit 54 right shift circuit 55 left shift circuit 56 bypass circuit 60 subtraction circuit 61 shift circuit 63 adder / subtractor circuit 64 normalization circuit

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】演算精度を設定する精度設定手段と、 複数のデータを格納する保持手段と、 前記保持手段からのデータにより演算を行う演算回路
と、 前記演算回路の出力とデータ入力とを選択して出力する
選択手段と、 前記選択手段の出力するデータに対して前記精度設定手
段の制御信号によって精度補正を行い前記保持手段に出
力する補正手段とを備えた演算装置。
1. An accuracy setting means for setting an operation accuracy, a holding means for storing a plurality of data, an arithmetic circuit for performing an arithmetic operation on the data from the holding means, and an output and a data input of the arithmetic circuit are selected. And a correction unit that corrects the data output from the selection unit by a control signal of the accuracy setting unit and outputs the corrected data to the holding unit.
【請求項2】前記補正手段は前記精度設定手段によって
指定される有効桁への丸め処理を行う回路と、 前記指定された有効桁の下位ビットを0にマスクする回
路とを有したことを特徴とする請求項1記載の演算装
置。
2. The correction means includes a circuit for rounding to a significant digit designated by the precision setting means, and a circuit for masking a lower bit of the designated significant digit to 0. The arithmetic unit according to claim 1.
【請求項3】前記演算回路は整数データに対する算術論
理演算を行う機能を有し、 前記補正手段は、 精度設定手段で指定された有効桁数が上位のビット数と
なるように左シフトする第1のシフト回路と、 前記有効桁数が下位のビット数となるように右シフトす
る第2のシフト回路と、シフトせずにそのまま出力する
バイパス回路とを備えており、 前記補正手段は、前記選択手段においてデータ入力が選
択されたときは前記第1のシフト回路でシフトしたデー
タを前記保持手段に出力し、前記選択手段において前記
演算回路の出力が選択されかつ前記保持手段にデータを
格納するときは前記バイパス回路から出力し、前記選択
手段において前記演算回路の出力が選択されかつ演算装
置の外部に出力するときは前記第2のシフト回路から出
力することを特徴とする請求項1記載の演算装置。
3. The arithmetic circuit has a function of performing arithmetic logic operation on integer data, and the correcting means shifts to the left so that the number of significant digits designated by the precision setting means becomes a higher number of bits. 1 shift circuit, a second shift circuit that shifts to the right so that the number of significant digits is a lower-order bit number, and a bypass circuit that outputs the shift digit as it is without any shift. When the data input is selected by the selecting means, the data shifted by the first shift circuit is output to the holding means, and the output of the arithmetic circuit is selected by the selecting means and the data is stored in the holding means. When the output of the arithmetic circuit is selected by the selecting means and is output to the outside of the arithmetic device, the output signal is output from the second shift circuit. The arithmetic unit according to claim 1, wherein:
【請求項4】2つの浮動小数点データの指数部の差をと
る第1の演算回路と、 前記第1の演算回路の出力にしたがって前記浮動小数点
データの仮数部の桁合わせを行うシフト回路と、 演算精度を設定する精度設定手段と、 前記シフト回路から出力に対して前記精度設定手段から
の制御信号によって精度補正する補正手段と、 前記補正手段によって補正した仮数部の数値に対して加
減算を行う第2の演算回路と、 前記第2の演算回路の出力と前記浮動小数点データの指
数部とを正規化する第3の演算回路とを備えた浮動小数
点加減算演算装置。
4. A first arithmetic circuit for calculating a difference between exponent parts of two floating point data, and a shift circuit for performing digit alignment of a mantissa part of the floating point data according to an output of the first arithmetic circuit. Precision setting means for setting the calculation precision, correction means for correcting the output from the shift circuit with the control signal from the precision setting means, and addition and subtraction for the numerical value of the mantissa corrected by the correction means. A floating-point addition / subtraction arithmetic device comprising: a second arithmetic circuit; and a third arithmetic circuit that normalizes the output of the second arithmetic circuit and the exponent part of the floating-point data.
【請求項5】前記補正手段は前記精度設定手段によって
指定される有効桁への丸め処理を行う回路と、 前記指定された有効桁の下位ビットを0にマスクする回
路とを有したことを特徴とする請求項4記載の浮動小数
点加減算演算装置。
5. The correction means includes a circuit for rounding to a significant digit designated by the precision setting means, and a circuit for masking a lower bit of the designated significant digit to 0. The floating point addition / subtraction arithmetic unit according to claim 4.
JP5293082A 1993-11-24 1993-11-24 Arithmetic unit Pending JPH07146777A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5293082A JPH07146777A (en) 1993-11-24 1993-11-24 Arithmetic unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5293082A JPH07146777A (en) 1993-11-24 1993-11-24 Arithmetic unit

Publications (1)

Publication Number Publication Date
JPH07146777A true JPH07146777A (en) 1995-06-06

Family

ID=17790218

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5293082A Pending JPH07146777A (en) 1993-11-24 1993-11-24 Arithmetic unit

Country Status (1)

Country Link
JP (1) JPH07146777A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009104405A (en) * 2007-10-23 2009-05-14 Yamaha Corp Digital signal processing apparatus
JP2009528638A (en) * 2006-02-27 2009-08-06 クゥアルコム・インコーポレイテッド Floating point processor with reduced power requirements for selectable subaccuracy
JP2010271946A (en) * 2009-05-21 2010-12-02 Fujitsu Ltd Arithmetic circuit and power saving method
US7917566B2 (en) 2006-10-18 2011-03-29 Kabushiki Kaisha Toshiba Arithmetic device capable of obtaining high-accuracy calculation results
WO2020084751A1 (en) * 2018-10-26 2020-04-30 日本電気株式会社 Secret calculation server, system, secret calculation method, and program

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009528638A (en) * 2006-02-27 2009-08-06 クゥアルコム・インコーポレイテッド Floating point processor with reduced power requirements for selectable subaccuracy
US8595279B2 (en) 2006-02-27 2013-11-26 Qualcomm Incorporated Floating-point processor with reduced power requirements for selectable subprecision
US7917566B2 (en) 2006-10-18 2011-03-29 Kabushiki Kaisha Toshiba Arithmetic device capable of obtaining high-accuracy calculation results
JP2009104405A (en) * 2007-10-23 2009-05-14 Yamaha Corp Digital signal processing apparatus
JP2010271946A (en) * 2009-05-21 2010-12-02 Fujitsu Ltd Arithmetic circuit and power saving method
WO2020084751A1 (en) * 2018-10-26 2020-04-30 日本電気株式会社 Secret calculation server, system, secret calculation method, and program
JPWO2020084751A1 (en) * 2018-10-26 2021-09-24 日本電気株式会社 Secret calculation server, system, secret calculation method and program
US11985232B2 (en) 2018-10-26 2024-05-14 Nec Corporation Secure computing server, system, secure computing method, and program

Similar Documents

Publication Publication Date Title
JP3487903B2 (en) Arithmetic device and arithmetic method
US6178435B1 (en) Method and system for performing a power of two estimation within a data processing system
JPS61237133A (en) Arithmetic circuit
EP0234495B1 (en) Arithmetic circuit capable of executing floating point operations and fixed point operations
JPH07146777A (en) Arithmetic unit
JPH1091395A (en) Processor
KR100309520B1 (en) Multiplication methods and multiplication circuits with round-off capability
JP4428778B2 (en) Arithmetic device, arithmetic method, and computing device
JPH0644226B2 (en) Processor
US6792442B1 (en) Signal processor and product-sum operating device for use therein with rounding function
JPH0330170B2 (en)
JP3137131B2 (en) Floating point multiplier and multiplication method
KR200156144Y1 (en) A circuit of absolute value
JP3522387B2 (en) Pipeline arithmetic unit
JP3124286B2 (en) Floating point arithmetic unit
JP3068640B2 (en) Computing device
JPH0414173A (en) Fixed point product sum computing element
GB2296803A (en) Apparatus for arithmetically operating floating-points
JPH0413734B2 (en)
JPS59160235A (en) Dividing device
JPS60245046A (en) Logical shift arithmetic circuit
JPS63123123A (en) Unnormalized floating point arithmetic unit
JPH0285922A (en) Arithmetic circuit
JPH04160533A (en) Microprocessor
JPH01125625A (en) Division device