JPS58115544A - Arithmetic device - Google Patents

Arithmetic device

Info

Publication number
JPS58115544A
JPS58115544A JP56212416A JP21241681A JPS58115544A JP S58115544 A JPS58115544 A JP S58115544A JP 56212416 A JP56212416 A JP 56212416A JP 21241681 A JP21241681 A JP 21241681A JP S58115544 A JPS58115544 A JP S58115544A
Authority
JP
Japan
Prior art keywords
register
positive
maximum value
overflow
data
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
JP56212416A
Other languages
Japanese (ja)
Inventor
Masaichi Itagaki
板垣 政一
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP56212416A priority Critical patent/JPS58115544A/en
Publication of JPS58115544A publication Critical patent/JPS58115544A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/499Denomination or exception handling, e.g. rounding or overflow
    • G06F7/49905Exception handling
    • G06F7/4991Overflow or underflow
    • G06F7/49921Saturation, i.e. clipping the result to a minimum or maximum value

Abstract

PURPOSE:To prevent the inversion of the sign of a maximum value and to resolve the hunting or the like, by storing the maximum value having a proper sign in an independent register on a basis of signs and types of data in two registers when the overflow is generated in an operation. CONSTITUTION:When the overflow due to the operation is generated, signals indicating signs of data in a register A1 3 and a register B1 4 and a signal indicating the type of the operation from an instruction decoder 2 are inputted to a discriminator 6. A signal indicating that the signal of the operation result is a positive or negative number is outputted to an excess value controlling circuit 51, and a positive or negative maximum value setting signal is outputted to an operator 1, and an internal overflow flag register is set. The operator 1 stores a positive or negative maximum value in a register A0 on a basis of the positive or negative maximum value setting signal from the excess value controlling circuit 51. Consequently, when data in registers 3 and 4 are positive together and the operation command from the instruction decoder 2 indicates addition and the overflow is generated, the positive maximum value is stored in the register A0 of the operator 1.

Description

【発明の詳細な説明】 この発明は、演算器のオーバーフロー発生で、演算結果
を適正な値に自動修正する演算装置に関するものである
DETAILED DESCRIPTION OF THE INVENTION The present invention relates to an arithmetic device that automatically corrects an arithmetic result to an appropriate value when an overflow occurs in an arithmetic unit.

従来この種の装置として第1図に示すものがあった。図
において、(1)は演算器、(2)は演算器(1)に演
算指令(加算、乗算、除算等)を与える命令デコーダ、
(3)は演算器(1)の演算結果(以下。レジスタ〜の
データと^う)を取込むレジスタ’! % (4)は外
部からの入力(以下、ソースSのデータという)を取込
むレジスタBl 、(51は演算器(1)の演算による
オーバーフローの発生を配憶するオーバーフローフラグ
レジスタである。
A conventional device of this type is shown in FIG. In the figure, (1) is an arithmetic unit, (2) is an instruction decoder that gives arithmetic instructions (addition, multiplication, division, etc.) to the arithmetic unit (1),
(3) is a register that takes in the operation result (hereinafter referred to as register ~ data) of arithmetic unit (1)! % (4) is a register Bl that takes in an input from the outside (hereinafter referred to as source S data), and (51 is an overflow flag register that stores the occurrence of overflow due to an operation of the arithmetic unit (1)).

次に動作について説明する6演算器(1)が演算を開始
する前に、レジスタA、 +3)は演を器(1)内部の
レジスタ〜のデータを格納し、同様にレジスタB1(4
1はソースSのデータを格納する。
Next, before the 6 arithmetic unit (1) starts calculation, the register A, +3) stores the data of the register ~ inside the arithmetic unit (1), and similarly register B1 (4)
1 stores data of source S.

演算器(1)は、命令デコーダ(2Iの演算指令により
、レジスタAL(3)のデータとレジスタB、 +41
のデータを入力データとして加算、減算、乗算、除算等
の演算を行ない演算結果を演算器(1)内部のレジスタ
幅に格納する。この演算実行時、オーバーフローが発生
した場合、演算器(1)はオーバーフローフラグレジス
タ(5)をセットする。
Arithmetic unit (1) receives data from register AL(3) and register B, +41 according to the arithmetic command from instruction decoder (2I).
Arithmetic operations such as addition, subtraction, multiplication, and division are performed using the data as input data, and the arithmetic results are stored in the register width inside the arithmetic unit (1). If an overflow occurs during execution of this operation, the arithmetic unit (1) sets an overflow flag register (5).

例えば、最上位符号付4ビツトの演算の場合を第8図1
イ)について説明する。最上位の符号ビットが0なら正
、lなら負の数である。今、レジスタAユ(3)に01
01(+5の2進数)、レジスタBl(4)に0111
(+7の2進数)のデータが格納され、命令デコーダ(
2)が加算の演算指令を発生していると仮定する。演算
器(1)は入力データの加算を行ない演算結果110 
Q (−4の2進数)を算出して内部レジスタムに格納
する。また、この場合オーバーフロー発生時生いるので
オーバーフローフラグレジスタ(5)のフラグが立つ。
For example, in the case of the most significant signed 4-bit operation, Figure 8.
b) will be explained. If the most significant sign bit is 0, it is a positive number, and if it is l, it is a negative number. Now, register Ayu (3) is 01
01 (+5 binary number), 0111 in register Bl (4)
(+7 binary number) data is stored and the instruction decoder (
Assume that 2) generates an addition operation command. Arithmetic unit (1) performs addition of input data and produces an arithmetic result 110.
Q (binary number -4) is calculated and stored in the internal register. Further, in this case, since an overflow occurs, the flag of the overflow flag register (5) is set.

、従来の演算装置は以上のように構成されているので、
オーバーフロー発生時、オーバーフローの演算結果がレ
ジスターへに格納される。このため、たとえばレジスタ
Am(3)、レジスタ穐(4)のそれぞれのデータが正
の数で加算時にオーバーフローが発生した場合、レジス
ターへには負の数が格納されるという欠点がちった。
, since the conventional arithmetic unit is configured as above,
When an overflow occurs, the overflow operation result is stored in a register. For this reason, for example, if the data in register Am (3) and register Aki (4) are positive numbers and an overflow occurs during addition, a negative number tends to be stored in the registers.

この発明は上記のような従来のものの欠点を除去するた
めになされたもので、演算によりオーバー7O−d1発
生した時、レジスタAt(3) 、レジスタ穐(4)の
各データの符号と演算の種類から、演算結果として適正
な符号の最大の値をレジスタへに格納する装置を提供す
ることを目的としている。
This invention was made in order to eliminate the drawbacks of the conventional ones as described above, and when over 7O-d1 occurs due to an operation, the sign of each data in register At (3) and register Aki (4) and the operation result are changed. It is an object of the present invention to provide a device that stores the maximum value of a proper sign as an operation result in a register based on the type of operation.

以下、この発明の一実施例を図について説明する。第2
図において、(6)はレジスレALC3)、レジスタB
l(4)のレジスタ内のデータの正、負の符号ト、(2
)の演算形式により演算結果の正、負の符号を判別する
判別器、bυは演算器(1)からのオーバーフロー発生
信号を入力した時、判別器(6)からの符号信号により
演算器(1)に符号信号の符号を持つ最大の値を設定す
る信号を出力し、且つ、オーバーフローフラグレジスタ
(5)を内蔵する過剰値制御回路である。
An embodiment of the present invention will be described below with reference to the drawings. Second
In the figure, (6) is register ALC3), register B
The positive and negative signs of the data in the register l(4), (2
bυ is a discriminator that determines the positive or negative sign of the operation result according to the operation format of arithmetic unit (1). ) is an excessive value control circuit which outputs a signal for setting the maximum value having the sign of a code signal and includes an overflow flag register (5).

次に動作について説明する。演算器(1)がレジスタA
lC3)、レジスタBl(41のデータを入力データと
して、命令デコーダ(2)の演算指令によシ演算を行な
いその結果をレジスタ〜に格納する一連の動作は従来の
装置と同じである。
Next, the operation will be explained. Arithmetic unit (1) is register A
The series of operations of using the data in register Bl (41) as input data, performing arithmetic operations in accordance with the arithmetic instructions of the instruction decoder (2), and storing the results in registers are the same as in the conventional device.

本発明では、演算によりオーバーフローが発生した時、
判別器(6)は、レジスタA1(3) 、レジスター(
4)のデータが正の数であるか、負の数であるかの信号
と、命令デコーダ(2)から演算の種類(加算、減算、
乗算、除算)の信号を入力し、演算結果が正の数になる
か、または負の数になるかの信号を過剰値制御回路II
に出力する。過剰値制御回路1li11は判別器(6)
の信号と、演算器(1)のオーバーフロー発生信号によ
り、演算器(1)に正の最大の値または、負の最大の値
設定信号を出力するとともに、内部にあるオーバーフロ
ーフラグレジスタをセットする。
In the present invention, when an overflow occurs due to an operation,
The discriminator (6) uses register A1 (3), register (
4) A signal indicating whether the data is a positive number or a negative number and the type of operation (addition, subtraction,
Excess value control circuit II
Output to. The excess value control circuit 1li11 is a discriminator (6)
In response to the signal and the overflow generation signal of the arithmetic unit (1), a maximum positive value or a maximum negative value setting signal is output to the arithmetic unit (1), and an internal overflow flag register is set.

次に演算n (t)は過剰値制御回路1からの正の静大
の値、または負の最大の値設定信号によりレジスタ〜に
正または負の最大の値を格納する。
Next, the operation n(t) stores a positive or negative maximum value in the register 1 in accordance with the positive static value or negative maximum value setting signal from the excess value control circuit 1.

たとえば、第8図10)に示すようにレジスタA1(3
)、レジスタB1(4)のデータが、ともに正の数で命
令デコーダ(2)からの演算指令が加算の時にオーバー
フローが発生した場合、演算器(1)のレジスタんには
正の最大の値0111(+7の2進数)が格納される。
For example, as shown in Figure 8 10), register A1 (3
), the data in register B1 (4) are both positive numbers, and if an overflow occurs when the calculation command from the instruction decoder (2) is addition, the maximum positive value is stored in the register of the calculation unit (1). 0111 (binary number +7) is stored.

なお、上記実施例では命令デコーダ(2)は加算、減算
、乗算、除算の時、その信号を判別器(6)に出力した
が、演算装置の命令体系により他の演算時にも出力信号
を出しても良い。また、判別器(6)から演算器(1)
の信号にスイッチを設け、必要に応じて選択式にしても
良い。
In the above embodiment, the instruction decoder (2) outputs the signal to the discriminator (6) during addition, subtraction, multiplication, and division, but depending on the instruction system of the arithmetic unit, it may also output signals during other operations. It's okay. Also, from the discriminator (6) to the arithmetic unit (1)
A switch may be provided for the signal to make it selectable as necessary.

以上のように、この発明にすれば、オーバーフロー発生
時に演算結果として正しい符号の最大値符号の逆転によ
る不都合を防止し真の値に最も近い値が得られる。例え
ばレジスタ〜の出力がモータのスピードレファレンスと
する場合、正転データ(正の数)での演算でオーバーフ
ローが発生した時に演算結果が負の数となってモータが
逆転することなく、最大スピードで正転するために、モ
ータ及び機械の異常な動き(ハンチング等)をなくすこ
とができる効果がある。
As described above, according to the present invention, it is possible to prevent the inconvenience caused by the inversion of the maximum value sign of the correct sign as a calculation result when an overflow occurs, and to obtain the value closest to the true value. For example, if the output of the register ~ is used as the speed reference of the motor, when an overflow occurs during calculation with forward rotation data (positive number), the calculation result will be a negative number and the motor will not rotate in reverse, and the maximum speed will be maintained. Since the motor rotates in the normal direction, abnormal movement (hunting, etc.) of the motor and machine can be eliminated.

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

第111は従来の演算装置の回路図、第2図はこの発明
の一実施例によるオーバーフローを自動的に修正する演
算装置の回路図である。また、第8図は演算例の説明図
である。 図において、(1)は演算器、(2)は命令デコーダ、
(3)はレジスタへ、(4)はレジスタA%FDは過剰
値制御回路、(6)は判別器である。 なお、図中、同一符号は同一、又は相当部分を示す。 代理人 葛野信−(ほか1名) 第1図 第2図 第13図 (イ)                (0)可下コ
(7)    ロ]H口(7)
Reference numeral 111 is a circuit diagram of a conventional arithmetic device, and FIG. 2 is a circuit diagram of an arithmetic device that automatically corrects overflow according to an embodiment of the present invention. Moreover, FIG. 8 is an explanatory diagram of an example of calculation. In the figure, (1) is an arithmetic unit, (2) is an instruction decoder,
(3) is a register, (4) is a register A%FD is an excess value control circuit, and (6) is a discriminator. In addition, in the figures, the same reference numerals indicate the same or equivalent parts. Agent Makoto Kuzuno (1 other person) Figure 1 Figure 2 Figure 13 (a) (0) Kashitako (7) B] H mouth (7)

Claims (1)

【特許請求の範囲】[Claims] 被演算値と加演算値を演算する演算器と、前記被演算値
と前記加演算値の符号と演算の種類により演算結果の符
号を判別する判別器と、前記演算器がオーバーフローし
た時は、前記判別器の判別した符号を持つ最大の値を上
記演算器の演算結果として設定する過剰値制御回路とを
備えた演算装置。
an arithmetic unit that calculates an operand value and an addition value; a discriminator that determines the sign of the operation result based on the sign of the operand value and the addition value and the type of operation; and when the arithmetic unit overflows, and an excessive value control circuit that sets the maximum value having the sign determined by the discriminator as the calculation result of the calculation unit.
JP56212416A 1981-12-29 1981-12-29 Arithmetic device Pending JPS58115544A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP56212416A JPS58115544A (en) 1981-12-29 1981-12-29 Arithmetic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP56212416A JPS58115544A (en) 1981-12-29 1981-12-29 Arithmetic device

Publications (1)

Publication Number Publication Date
JPS58115544A true JPS58115544A (en) 1983-07-09

Family

ID=16622219

Family Applications (1)

Application Number Title Priority Date Filing Date
JP56212416A Pending JPS58115544A (en) 1981-12-29 1981-12-29 Arithmetic device

Country Status (1)

Country Link
JP (1) JPS58115544A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6072022A (en) * 1983-09-28 1985-04-24 Toshiba Corp Arithmetic unit
JPH03286268A (en) * 1990-04-03 1991-12-17 Samsung Electron Co Ltd Multivalued picture conversion circuit for binary dither picture
EP0686910A1 (en) 1994-06-10 1995-12-13 Nec Corporation Data processing system having a saturation arithmetic operation function

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6072022A (en) * 1983-09-28 1985-04-24 Toshiba Corp Arithmetic unit
JPH03286268A (en) * 1990-04-03 1991-12-17 Samsung Electron Co Ltd Multivalued picture conversion circuit for binary dither picture
EP0686910A1 (en) 1994-06-10 1995-12-13 Nec Corporation Data processing system having a saturation arithmetic operation function
US5684728A (en) * 1994-06-10 1997-11-04 Nec Corporation Data processing system having a saturation arithmetic operation function

Similar Documents

Publication Publication Date Title
US4872128A (en) High speed data processing unit using a shift operation
KR100210891B1 (en) Information processor
KR960043562A (en) A circuit that performs arithmetic operations in the demodulator
JPS58115544A (en) Arithmetic device
US4677582A (en) Operation processing apparatus
KR940009819A (en) Offset Value Calculation Circuit and Method of Data Processing System
JPH0619700B2 (en) Arithmetic unit
JP2557629B2 (en) Interrupt method
JPH0831033B2 (en) Data processing device
JPH0797312B2 (en) Arithmetic unit
SU363980A1 (en) FIRMWARE PROCESSOR
JPH0330170B2 (en)
SU636810A1 (en) Arrangement for error protection of telegraphy messages
SU962973A1 (en) Device for computing polynomial values
JPS6244657B2 (en)
SU1522197A1 (en) Device for calculation of cosine of a number
JPS5940665Y2 (en) Power calculation control device
JPH0418344B2 (en)
Woods Miscellaneous Instructions
JPS5960551A (en) Memory access controlling system
JPS60142423A (en) Forming method of conditional code
JPS6238748B2 (en)
JPH04124725A (en) Floating point arithmetic unit
JPH05119969A (en) Product sum computing element
JPH0519745B2 (en)