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
JPH0644226B2 - Processor - Google Patents
[go: Go Back, main page]

JPH0644226B2 - Processor - Google Patents

Processor

Info

Publication number
JPH0644226B2
JPH0644226B2 JP62064619A JP6461987A JPH0644226B2 JP H0644226 B2 JPH0644226 B2 JP H0644226B2 JP 62064619 A JP62064619 A JP 62064619A JP 6461987 A JP6461987 A JP 6461987A JP H0644226 B2 JPH0644226 B2 JP H0644226B2
Authority
JP
Japan
Prior art keywords
register
overflow
data
arithmetic
signal
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 - Lifetime
Application number
JP62064619A
Other languages
Japanese (ja)
Other versions
JPS63228330A (en
Inventor
秀夫 田中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
Nippon Electric 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 Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP62064619A priority Critical patent/JPH0644226B2/en
Publication of JPS63228330A publication Critical patent/JPS63228330A/en
Publication of JPH0644226B2 publication Critical patent/JPH0644226B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は数値計算を行う演算処理装置に関し、特に固定
小数点データを取り扱う演算処理装置に関する。
Description: TECHNICAL FIELD The present invention relates to an arithmetic processing device that performs numerical calculation, and more particularly to an arithmetic processing device that handles fixed-point data.

〔従来の技術〕[Conventional technology]

数値計算でよく用いられるデータ形式として、固定小数
点データ方式がある。この固定小数点データ方式では、
2の補数表示が一般的である。従来、この2の補数の固
定小数点データ方式での演算では、表現できる数値範囲
が限定されるため演算結果がこの範囲を越えると表現で
きない。従来、上記のように表現できる範囲を越えた場
合、オーバーフローとしての補正処理を行っていた。こ
こで、2の補数表示でデータ長8ビットの場合を例にと
り説明を行う。データ長8ビットの場合(但し、最上位
ビットは正,負のサインビットとする)、数値データx
は、80(H)≦x≦7F(H)(Hは16進表現であ
ることを示す。)の範囲で表現される。なお、2値表現
すれば1000000≦x≦01111111である。
二つの任意の値を加算し、その加算結果が上記の範囲8
0(H)もしくは7F(H)を越えた場合、オーバーフ
ローとして扱われる。このとき、従来の演算装置では、
演算結果はオーバーフローが発生したときの結果をその
まま採り、オーバーフローが発生したことを示すオーバ
ーフローフラグを立てる。プログラムで前記のオーバー
フローフラグを検出し、プログラムにより、演算結果を
正の最大値(7F(H))に補正する。ここで数値を用
いて具体的に示す。演算されるべき二つの値を70
(H)と2E(H)とするとその加算結果は9E(H)
となる。しかしデータ長は8ビットでかつ2の補数表現
であるため、最上位ビットは正,負のサイン符号を示す
ため正の値であるにもかかわらず、結果は負の値を示し
ていることになる。したがって、オーバーフローフラグ
が立ち、オーバーフローの補正処理が必要となる。この
補正処理ではプログラムにより、オーバーフローフラグ
を検出し、演算結果が正であるべきときには正の最大値
に、負であるときには負の最小値に置き換える。上記の
例の演算では、正しい値は正の値であるため、正の最大
値である7F(H)に演算結果を置き換える。
A fixed-point data method is a data format often used in numerical calculations. With this fixed-point data method,
Two's complement representation is common. Conventionally, in the operation by the two's complement fixed-point data method, the range of numerical values that can be expressed is limited, so that the calculation result cannot be expressed if it exceeds this range. Conventionally, when the value exceeds the range that can be expressed as described above, correction processing as overflow has been performed. Here, a case of a data length of 8 bits in 2's complement display will be described as an example. When the data length is 8 bits (however, the most significant bit is a positive or negative sign bit), numerical data x
Is expressed in the range of 80 (H) ≦ x ≦ 7F (H) (H indicates hexadecimal notation). If expressed in binary, 1000000 ≦ x ≦ 01111111.
Two arbitrary values are added, and the addition result is the above range 8
When it exceeds 0 (H) or 7F (H), it is treated as an overflow. At this time, in the conventional arithmetic device,
As the calculation result, the result when the overflow occurs is taken as it is, and an overflow flag indicating that the overflow has occurred is set. The program detects the overflow flag, and the program corrects the calculation result to the maximum positive value (7F (H)). Here, it will be specifically shown by using numerical values. Two values to be calculated are 70
(H) and 2E (H), the addition result is 9E (H)
Becomes However, since the data length is 8 bits and is a two's complement representation, the result shows a negative value even though the most significant bit is a positive value because it shows a positive or negative sign sign. Become. Therefore, the overflow flag is set and an overflow correction process is required. In this correction processing, the overflow flag is detected by the program, and when the calculation result should be positive, it is replaced with the maximum positive value, and when it is negative, it is replaced with the minimum negative value. In the calculation of the above example, since the correct value is a positive value, the calculation result is replaced with the maximum positive value of 7F (H).

第3図は従来の固定小数点対応の演算処理装置の例を示
すブロック図である。第3図においてレジスタ14,1
5に格納されたデータが演算器16で演算され、その結
果検出回路18でオーバーフロー検出が行われた場合、
保持回路19にオーバーフローの情報が格納される。こ
の保持回路19に格納された情報をプログラムで検出
し、レジスタ17に格納されている演算結果に上述した
補正処理を施すことになる。
FIG. 3 is a block diagram showing an example of a conventional fixed-point-compatible arithmetic processing unit. In FIG. 3, registers 14 and 1
When the data stored in 5 is calculated by the calculator 16 and the result detection circuit 18 detects overflow,
Information on overflow is stored in the holding circuit 19. The information stored in the holding circuit 19 is detected by a program, and the above-described correction processing is applied to the calculation result stored in the register 17.

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

上述した従来の演算装置では、オーバーフローが発生し
たときの演算結果に差があっても同一値に補正されてし
まう。つまり、上記の例で示すと、オーバーフロー時の
演算結果が80(H)とFE(H)のときの二通りの場
合、その差は7E(H)であるにもかかわらず両方共に
7F(H)に補正され、両者の差がなくなってしまう。
このように従来の演算装置では、演算精度が極端に落ち
ることになり、大きな欠点となる。この従来技術を解決
する方法として演算結果をその符号ビットを考慮し、1
ビット右シフトすることにより、結果は1桁下がること
になるが、データの精度は保てることになる。上述した
演算のオーバーフローを生じるデータげ同一データ処理
を必要とするデータ群のうちの1データであったとする
と、上記のオーバーフロー処理による桁下りに対して他
のデータに対しても1桁下げてデータ群全体の桁をそろ
える必要がある。
In the conventional arithmetic device described above, even if there is a difference in the arithmetic result when the overflow occurs, it is corrected to the same value. In other words, in the above example, when there are two types of calculation results at the time of overflow, 80 (H) and FE (H), both are 7F (H) even though the difference is 7E (H). ), The difference between the two disappears.
As described above, in the conventional arithmetic device, the arithmetic precision is extremely lowered, which is a big drawback. As a method for solving this conventional technique, the calculation result is considered in consideration of its sign bit, and 1
By shifting to the right by one bit, the result is reduced by one digit, but the precision of the data can be maintained. If one data in the data group that requires the same data processing as the data that causes the overflow of the above-mentioned operation, one digit lower than the carry due to the overflow processing is also added to the other data. It is necessary to align the digits of the entire group.

したがって、本発明の目的は、上記の問題に鑑みこれを
解決する、2の補数表示された固定少数点データの演算
でオーバーフローが発生した場合の補正処理をオーバー
フローが発生したと同時に行うとともに、補正処理にお
けるデータ精度の劣化を防ぐことのできる演算処理装置
を提供することにある。
Therefore, an object of the present invention is to solve the above problem and to perform a correction process when an overflow occurs in the calculation of fixed-point data represented by 2's complement at the same time as the overflow occurs, and An object of the present invention is to provide an arithmetic processing device capable of preventing deterioration of data accuracy in processing.

〔問題点を解決するための手段〕[Means for solving problems]

本発明の演算処理装置は、固定小数点データとしての演
算データを格納する第1および第2のレジスタと、イン
ストラクションデータを格納するインストラクションレ
ジスタと、このインストラクションレジスタを解読する
デコーダと、このデコーダからの出力信号により前記第
1および第2のレジスタのそれぞれの出力値を入力して
演算を行う演算器と、この演算器の出力値を格納する第
3のレジスタと、前記演算器で発生する最上位桁への第
1の桁上げ信号および最上位桁からの第2の桁上げ信号
を入力としオーバーフローを検出する検出回路と、この
検出回路の検出信号を保持する第1の保持回路とを備え
る演算処理装置において、前記第1のレジスタと前記演
算器との間に前記第1のレジスタの出力値をシフトする
第1のシフト手段と、前記第2のレジスタと前記演算器
との間に前記第2のレジスタの出力値をシフトする第2
のシフト手段と、前記第3のレジスタと前記演算器との
間に前記演算器の出力値をシフトする第3のシフト手段
と、前記デコーダからの補正要求信号を保持する第2の
保持回路と、前記第1および第2の保持回路の出力信号
のそれぞれを入力し前記第1、第2および第3のシフト
手段のそれぞれに対して補正処理を指定する制御信号を
出力する制御回路とから構成される。
The arithmetic processing unit of the present invention includes first and second registers for storing arithmetic data as fixed-point data, an instruction register for storing instruction data, a decoder for decoding the instruction register, and an output from the decoder. An arithmetic unit for inputting the output values of the first and second registers by a signal to perform arithmetic operation, a third register for storing the output value of the arithmetic unit, and a most significant digit generated in the arithmetic unit Processing including a detection circuit that receives the first carry signal to the first carry signal and the second carry signal from the most significant digit as input and detects an overflow, and a first holding circuit that holds the detection signal of this detection circuit In the device, first shift means for shifting an output value of the first register between the first register and the arithmetic unit. , Second to shift the output value of the second register between the computing unit and the second register
Shift means, third shift means for shifting the output value of the arithmetic unit between the third register and the arithmetic unit, and a second holding circuit for holding the correction request signal from the decoder. , A control circuit which receives each of the output signals of the first and second holding circuits and outputs a control signal for designating a correction process to each of the first, second and third shift means. To be done.

〔実施例〕〔Example〕

次に、本発明の演算処理装置について図面を参照して説
明する。
Next, the arithmetic processing device of the present invention will be described with reference to the drawings.

第1図は、本発明の一実施例の演算処理装置のブロック
図である。
FIG. 1 is a block diagram of an arithmetic processing unit according to an embodiment of the present invention.

第1図を参照すると、この実施例の演算処理装置は、そ
れぞれ演算すべきデータを格納するレジスタ1および2
と、レジスタ1および2の値をシフトするシフタ3およ
び4と、インストラクションレジスタ12およびデコー
ダ13による指定にしたがってシフタ3および4の出力
データを演算し演算結果を出力する演算器5と、演算結
果を補正するためのシフタ6と、演算結果を格納するレ
ジスタ7とを有している。
Referring to FIG. 1, the arithmetic processing unit of this embodiment has registers 1 and 2 for respectively storing data to be arithmetically operated.
, Shifters 3 and 4 for shifting the values of registers 1 and 2, an arithmetic unit 5 for arithmetically operating the output data of the shifters 3 and 4 and outputting the arithmetic result in accordance with the instruction register 12 and the decoder 13, and the arithmetic result It has a shifter 6 for correction and a register 7 for storing the calculation result.

さらに、この演算処理装置は、演算でオーバーフローが
発生したかどうかを検出する検出回路8と、オーバーフ
ローが発生した情報を保持する保持回路9と、オーバー
フローによるデータ補正を行うかどうかの情報を保持す
る保持回路10と、データ補正のための信号を発生する
制御回路11とを有している。
Further, this arithmetic processing unit holds a detection circuit 8 for detecting whether or not an overflow has occurred in the operation, a holding circuit 9 for holding the information for which the overflow has occurred, and information for whether or not to perform data correction due to the overflow. It has a holding circuit 10 and a control circuit 11 that generates a signal for data correction.

次に、本発明の演算処理装置の動作について説明する。
演算すべきデータはレジスタ1とレジスタ2に格納さ
れ、演算器5でオーバーフローが発生しない場合はシフ
タ3およびシフタ4では前記レジスタ1とレジスタ2の
データはシフトされずにそのまま演算器5の入力データ
となる。前記入力データは演算器5で演算され、この演
算でオーバーフローが発生しない場合、シフタ6では演
算結果はシフトされずそのままレジスタ7へ出力する。
次に演算器5での演算でオーバーフローが発生した場合
について述べる。検出回路8は演算器5での演算で生じ
る最上位ビットからのキャリーと、その次の下位ビット
からのキャリーとの排他的論理和によりオーバーフロー
の検出を行う。ここで検出されたオーバーフロー信号
は、第1の保持回路9によってオーバーフロー情報とし
て保持される。また、オーバーフロー処理を行うかどう
かの情報を保持している第2の保持回路10からの信号
と前記第1の保持回路9からの信号とが制御回路11で
論理積がとられ、オーバーフロー処理信号となる。前記
オーバーフロー処理信号によりシフト回路6では演算結
果に対してその演算結果のキャリービットを含め、1ビ
ット右シフトが行われる。またシフト回路3およびシフ
ト回路4では右にシフトすべきデータに対してサインビ
ット拡張による1ビット右シフトが行われる。上記動作
により、演算結果の補正と同時にその演算以後の演算デ
ータを1ビット右シフト(1/2にすることに相当す
る)することにより、その後のオーバーフローの発生を
防ぐことができるとともに、演算結果の精度もオーバー
フローを発生し、シフタ6でシフトが行われた演算結果
の精度と同一になる。
Next, the operation of the arithmetic processing unit of the present invention will be described.
The data to be calculated is stored in the register 1 and the register 2, and when the calculator 5 does not overflow, the data in the register 1 and the register 2 is not shifted in the shifter 3 and the shifter 4 and the input data of the calculator 5 is not changed. Becomes The input data is calculated by the arithmetic unit 5, and when an overflow does not occur in this arithmetic operation, the shifter 6 outputs the arithmetic result as it is to the register 7 without being shifted.
Next, a case where an overflow occurs in the arithmetic operation in the arithmetic unit 5 will be described. The detection circuit 8 detects an overflow by an exclusive OR of the carry from the most significant bit generated by the calculation in the arithmetic unit 5 and the carry from the next lower bit. The overflow signal detected here is held by the first holding circuit 9 as overflow information. Further, the signal from the second holding circuit 10 holding the information as to whether or not to perform the overflow processing and the signal from the first holding circuit 9 are logically ANDed by the control circuit 11 to obtain the overflow processing signal. Becomes By the overflow processing signal, the shift circuit 6 shifts the operation result right by 1 bit including the carry bit of the operation result. Further, in the shift circuit 3 and the shift circuit 4, 1-bit right shift by sign bit extension is performed on the data to be shifted to the right. By the above operation, the operation result can be corrected and the operation data after the operation can be right-shifted by 1 bit (corresponding to halving) at the same time, so that the overflow can be prevented from occurring and the operation result can be prevented. Also, the accuracy of (1) overflows and becomes the same as the accuracy of the operation result shifted by the shifter 6.

〔実施例2〕 前記実施例では、入力データと演算結果にオーバーフロ
ー処理を施こすとき、シフト回路を用いたが、第2図に
示すように単なるマルチプレクサ回路を用いてもよく、
この場合、オーバーフロー発生によるシフト制御信号a
は、データセレクト信号となる。簡単に本マルチプレク
サ回路での動作を第2図を用いて説明する。オーバーフ
ロー処理を必要としない場合、出力Oの値は入力データ
Iの値がそのまま選ばれ出力される。もし、オーバーフ
ロー処理が必要であれば、入力データIの左隣のビット
Hが選択され出力される。この操作によりシフト回路と
同一の機能を果たすことができる。
[Embodiment 2] In the embodiment, the shift circuit is used when the overflow processing is applied to the input data and the operation result, but a simple multiplexer circuit may be used as shown in FIG.
In this case, the shift control signal a due to the occurrence of overflow
Becomes a data select signal. The operation of the multiplexer circuit will be briefly described with reference to FIG. When the overflow process is not required, the value of the output O is the value of the input data I as it is and is output. If overflow processing is required, the bit H on the left of the input data I is selected and output. By this operation, the same function as the shift circuit can be achieved.

〔発明の効果〕〔The invention's effect〕

以上説明したように本発明は、演算でオーバーフローが
発生した場合、その演算結果に対し符号ビットを含めて
1ビット右シフトすることにより、データの精度を落と
すことなく、補正することができ、またオーバーフロー
が発生した後の演算に対して、演算の入力となるデータ
を符号ビットを含めて1ビット右シフトすることによ
り、精度の面で前記演算の出力結果と同一のデータ精度
にすることができ、さらに演算でのオーバーフロー発生
にともなう一連の補正処理をプログラムによる処理より
も高速に行うことができる効果がある。
As described above, according to the present invention, when an overflow occurs in the operation, the result of the operation is right-shifted by 1 bit including the sign bit, so that the accuracy of the data can be corrected without lowering the accuracy. With respect to the operation after the overflow has occurred, the input data of the operation can be shifted to the right by 1 bit including the sign bit, so that the same data accuracy as the output result of the operation can be obtained in terms of accuracy. Further, there is an effect that a series of correction processes accompanying the occurrence of overflow in the calculation can be performed faster than the process by the program.

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

第1図は本発明の一実施例を示すブロック図、第2図は
第1図に示したシフトレジスタをマルチプレクサとした
実施例を示す図であり、第3図は従来の演算処理装置の
一例を示すブロック図である。 1,2,7,12,14,15,17……レジスタ、
3,4,6……シフタ、5,16……演算器、8,18
……検出回路、9,10,19……保持回路、11……
制御回路、13……デコーダ、O……出力信号、a……
シフト制御信号、I,H……入力信号。
FIG. 1 is a block diagram showing an embodiment of the present invention, FIG. 2 is a view showing an embodiment in which the shift register shown in FIG. 1 is used as a multiplexer, and FIG. 3 is an example of a conventional arithmetic processing unit. It is a block diagram showing. 1, 2, 7, 12, 14, 15, 17 ... Register,
3, 4, 6 ... Shifter, 5, 16 ... Operation unit, 8, 18
...... Detection circuit, 9, 10, 19 …… Holding circuit, 11 ……
Control circuit, 13 ... Decoder, O ... Output signal, a ...
Shift control signals, I, H ... Input signals.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】固定小数点データとしての演算データを格
納する第1および第2のレジスタと、インストラクショ
ンデータを格納するインストラクションレジスタと、こ
のインストラクションレジスタを解読するデコーダと、
このデコーダからの出力信号により前記第1および第2
のレジスタのそれぞれの出力値を入力して演算を行う演
算器と、この演算器の出力値を格納する第3のレジスタ
と、前記演算器で発生する最上位桁への第1の桁上げ信
号および最上位桁からの第2の桁上げ信号を入力としオ
ーバーフローを検出する検出回路と、この検出回路の検
出信号を保持する第1の保持回路とを備える演算処理装
置において、前記第1のレジスタと前記演算器との間に
前記第1のレジスタの出力値をシフトする第1のシフト
手段と、前記第2のレジスタと前記演算器との間に前記
第2のレジスタの出力値をシフトする第2のシフト手段
と、前記第3のレジスタと前記演算器との間に前記演算
器の出力値をシフトする第3のシフト手段と、前記デコ
ーダからの補正要求信号を保持する第2の保持回路と、
前記第1および第2の保持回路の出力信号のそれぞれを
入力し前記第1、第2および第3のシフト手段のそれぞ
れに対して補正処理を指定する制御信号を出力する制御
回路とを有することを特徴とする演算処理装置。
1. A first and a second register for storing operation data as fixed point data, an instruction register for storing instruction data, and a decoder for decoding the instruction register.
According to the output signal from this decoder, the first and second
, A third register for storing the output value of this arithmetic unit, and a first carry signal to the most significant digit generated by the arithmetic unit. And a detection circuit for detecting an overflow by inputting a second carry signal from the most significant digit and a first holding circuit for holding the detection signal of the detection circuit, wherein the first register And a calculator, the first shift means for shifting the output value of the first register, and the output value of the second register between the second register and the calculator. Second shift means, third shift means for shifting the output value of the arithmetic unit between the third register and the arithmetic unit, and a second holding unit for holding a correction request signal from the decoder. Circuit,
And a control circuit which inputs each of the output signals of the first and second holding circuits and outputs a control signal for designating a correction process to each of the first, second and third shift means. An arithmetic processing unit characterized by.
JP62064619A 1987-03-18 1987-03-18 Processor Expired - Lifetime JPH0644226B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP62064619A JPH0644226B2 (en) 1987-03-18 1987-03-18 Processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP62064619A JPH0644226B2 (en) 1987-03-18 1987-03-18 Processor

Publications (2)

Publication Number Publication Date
JPS63228330A JPS63228330A (en) 1988-09-22
JPH0644226B2 true JPH0644226B2 (en) 1994-06-08

Family

ID=13263454

Family Applications (1)

Application Number Title Priority Date Filing Date
JP62064619A Expired - Lifetime JPH0644226B2 (en) 1987-03-18 1987-03-18 Processor

Country Status (1)

Country Link
JP (1) JPH0644226B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02216582A (en) * 1989-02-16 1990-08-29 Nec Corp Pipeline arithmetic circuit
JPH0599618A (en) * 1991-09-25 1993-04-23 Matsushita Electric Works Ltd Laser distance measuring sensor

Also Published As

Publication number Publication date
JPS63228330A (en) 1988-09-22

Similar Documents

Publication Publication Date Title
JP2674754B2 (en) Barrel shifter
US5508951A (en) Arithmetic apparatus with overflow correction means
JPH04290122A (en) Numerical expression conversion device
EP0234495B1 (en) Arithmetic circuit capable of executing floating point operations and fixed point operations
JPS61237133A (en) Arithmetic circuit
JPH0644226B2 (en) Processor
US5528525A (en) Processor for determining shift counts based on input data
JPH1091395A (en) Processor
JPH07146777A (en) Arithmetic unit
US20020178202A1 (en) Floating point multiplier for delimited operands
JP2615746B2 (en) Bit operation circuit
JP2664750B2 (en) Arithmetic device and arithmetic processing method
KR0176883B1 (en) Complex multiplier
JP4428778B2 (en) Arithmetic device, arithmetic method, and computing device
JPH0426495B2 (en)
JP2591250B2 (en) Data processing device
JPH0330170B2 (en)
JP2503017B2 (en) Barrel shifter circuit
JPH03217938A (en) floating point rounding normalizer
JPS6224322A (en) Floating point arithmetic unit
KR200156144Y1 (en) A circuit of absolute value
JPS63123123A (en) Unnormalized floating point arithmetic unit
JPS626326A (en) Arithmetic processor
JPH0553759A (en) Fixed decimal point arithmetic unit
JPH06236253A (en) Bit computing element