JPH04116717A - Overflow exception detection system - Google Patents

Overflow exception detection system

Info

Publication number
JPH04116717A
JPH04116717A JP2237354A JP23735490A JPH04116717A JP H04116717 A JPH04116717 A JP H04116717A JP 2237354 A JP2237354 A JP 2237354A JP 23735490 A JP23735490 A JP 23735490A JP H04116717 A JPH04116717 A JP H04116717A
Authority
JP
Japan
Prior art keywords
register
digit
operand
invalid
circuit
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
JP2237354A
Other languages
Japanese (ja)
Inventor
Toshiko Fukazawa
深沢 寿子
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 Computertechno Ltd
Original Assignee
NEC Computertechno 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 NEC Computertechno Ltd filed Critical NEC Computertechno Ltd
Priority to JP2237354A priority Critical patent/JPH04116717A/en
Publication of JPH04116717A publication Critical patent/JPH04116717A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To eliminate the need of a valid digit calculation circuit and a comparison circuit which are hardware exclusively used for the detection of an overflow exception, by exchanging a part equivalent to the invalid digit of variable length decimal data with a specified code. CONSTITUTION:A decimal computing element 7 is controlled so that it executes addition in spite of the value of the code part of an operand and it adds the output of an invalid digit exchange circuit 5 with the absolute value of the operation result of a register 6. In the output of the invalid digit exchange circuit 5, 0000(2) corresponds to the valid digit part of a first operand and 1001(2) to the invalid digit part. Since all the digits corresponding to the invalid part of the first operand are exchanged to 1001(2) in the output of the invalid digit exchange circuit 5, carry is transmitted and a carry is generated. An exception detection circuit 9 detects an exception from the carry outputted from the decimal operating unit 7 and the carry of the operated result stored in the register 8. Thus, the valid digit calculation circuit and the comparison circuit, which are hardware exclusively used for the detection of the overflow exception is made unnecessary.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、オーバーフロー例外検出方式に関し、特に可
変長10進データを扱うオーバーフロー例外検出方式に
関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to an overflow exception detection method, and particularly to an overflow exception detection method that handles variable length decimal data.

〔従来の技術〕[Conventional technology]

可変長10進データのオーバーフロー例外検出のための
従来の技術によるオーバーフロー例外検出方式の一例を
示したブロック図を第5図に、また本従来例の動作を説
明するタイムチャートを第6図に示す。
A block diagram showing an example of a conventional overflow exception detection method for overflow exception detection of variable length decimal data is shown in FIG. 5, and a time chart illustrating the operation of this conventional example is shown in FIG. .

また、ここで供給されるオペランドは第3図に示すよう
に、符号部と絶対値部からなる10進パック形式となっ
ている。すなわち、絶対値部の1桁は4ビツトでOOO
O(2)から1001 (2)までの数で表現し、右の
桁から100の位、101の位、・・・・・・、101
3の位 1014の位に位とりされ、最大15桁の10
進数の絶対値を表現する。
The operand supplied here is in a decimal packed format consisting of a sign part and an absolute value part, as shown in FIG. In other words, 1 digit of the absolute value part is 4 bits and OOO
Expressed as a number from O(2) to 1001 (2), starting from the right digit, the 100th place, the 101st place, etc., 101
3's digit is scaled to the 1014th place, maximum 15 digits 10
Expresses the absolute value of a base number.

可変長10進データのデータ長に合わせてレジスタや演
算器のデータ幅を変化させることはできない。つまり、
可変長10進データは可変長であるが、可変長10進デ
ータを扱うハードウェアは可変長ではない。そこで、ハ
ードウェア上に供給される可変長10進データは常に固
定長とし、実際の可変長10進データ部分を有効桁、ハ
ードウェアの都合上供給された部分を無効桁とそれぞれ
みなしてデータを扱う。そして可変長10進データの有
効桁と無効桁とを判断するためにデータ長く桁数)ηを
用いる。データ長ηは10進1桁を単位として表現され
、従って103の位まで有効桁である場合!;i−4,
1011の位まで有効桁である場合j=12となる。
It is not possible to change the data width of a register or arithmetic unit according to the data length of variable-length decimal data. In other words,
Although variable length decimal data is variable length, hardware that handles variable length decimal data is not variable length. Therefore, the variable length decimal data supplied to the hardware is always fixed length, and the actual variable length decimal data part is regarded as valid digits, and the part supplied for hardware reasons is regarded as invalid digits. handle. In order to determine the valid digits and invalid digits of the variable length decimal data, the data length (number of digits) η is used. The data length η is expressed in units of 1 decimal digit, so if it is a significant digit up to the 103rd place! ;i-4,
If there are significant digits up to the 1011th place, j=12.

第5図において、21は第1オペランドのデータ長11
および第2オペランドのデータ長12より無効桁部分を
算出し、オペランドのマスクをかける部分を指示する無
効桁指示回路、22は無効桁指示回路1の値を格納する
レジスタ、23は供給されたオペランドを格納するレジ
スタ、24はレジスタ2の指示によりレジスタ3に供給
されたオペランドの無効桁をマスクするマスク回路、2
5はマスク回路24の出力または10進演算器26の演
算結果を格納するレジスタである。
In FIG. 5, 21 is the data length 11 of the first operand.
and an invalid digit indicating circuit which calculates the invalid digit part from the data length 12 of the second operand and instructs the part of the operand to be masked, 22 is a register that stores the value of the invalid digit indicating circuit 1, and 23 is the supplied operand. 24 is a mask circuit for masking invalid digits of the operand supplied to register 3 according to instructions from register 2;
A register 5 stores the output of the mask circuit 24 or the operation result of the decimal operator 26.

26は10進演算器で、マスク回路24の出力と、レジ
スタ25の出力を演算する。すなわち、マスク回路24
およびレジスタ25のオペランドが同符号の場合それぞ
れの絶対値の加算を行なう。また絶対値の和がOの場合
は演算結果として絶対値Oと、正符号を出力する。絶対
値の和がO以外の場合は演算結果として、絶対値の和と
マスク回路24から出力されたオペランドの符号とを出
力する。マスク回路24およびレジスタ25のオペラン
ドが異符号の場合は2つのオペランドの絶対値が比較さ
れる。そして、2つのオペランドの絶対値が等しい場合
は、演算結果として絶対値Oと正符号とが出力される。
26 is a decimal arithmetic unit that calculates the output of the mask circuit 24 and the output of the register 25; That is, the mask circuit 24
If the operands of register 25 and 25 have the same sign, their respective absolute values are added. If the sum of absolute values is O, the absolute value O and a positive sign are output as the calculation result. If the sum of absolute values is other than O, the sum of absolute values and the sign of the operand output from the mask circuit 24 are output as the calculation results. If the operands of mask circuit 24 and register 25 have opposite signs, the absolute values of the two operands are compared. If the absolute values of the two operands are equal, the absolute value O and a positive sign are output as the calculation result.

2つのオペランドの絶対値が等しくない場合は絶対値の
大きいオペランドの絶対値から絶対値の小さいオペラン
ドの絶対値を減算し、演算結果として絶対値の差と絶対
値の大きいオペランドの符号を出力する。
If the absolute values of the two operands are not equal, subtract the absolute value of the operand with the smaller absolute value from the absolute value of the operand with the larger absolute value, and output the difference in absolute values and the sign of the operand with the larger absolute value as the result of the operation. .

27はレジスタ25に格納されたオペランドの有効桁算
出回路、28は有効桁算出回路27の出力と第1オペラ
ンドのデータ長p1とを比較しデータ長11のほうが小
さい場合を検出するための比較回路、2つは10進演算
器26で演算された絶対値から発生したキャリーを格納
するレジスタである。30は比較回路28およびレジス
タ29の値を参照しオーバーフロー例外を検出する例外
検出回路、31は例外検出回路30の結果を格納するレ
ジスタ、32はレジスタ25に格納された演算結果を格
納するレジスタである。
27 is a significant digit calculation circuit for the operand stored in the register 25; 28 is a comparison circuit for comparing the output of the significant digit calculation circuit 27 with the data length p1 of the first operand and detecting when the data length 11 is smaller. , 2 are registers that store a carry generated from the absolute value computed by the decimal arithmetic unit 26. 30 is an exception detection circuit that detects an overflow exception by referring to the values of the comparison circuit 28 and register 29; 31 is a register that stores the result of the exception detection circuit 30; and 32 is a register that stores the operation result stored in register 25. be.

33は制御部で、無効桁指示回路21で第1オペランド
のデータ長j1を用いるかあるいは第2オペランドのデ
ータ長ρ2を用いるかの選択指示および各レジスタの制
御を行なう。
A control unit 33 instructs the invalid digit instructing circuit 21 to select whether to use the data length j1 of the first operand or the data length ρ2 of the second operand and controls each register.

第5図に示す装置上で、第2オペランドが第1オペラン
ドに加えられ、和が第1オペランドの場所に入れられる
という10進加算命令が実行される場合を考える。−例
として、第1オペランドが−3524(10)でデータ
長ρ1=4、第2オペランドが+15241 (10)
でデータ長12=5とする。第2オペランドは、第7図
(a)に示す形でレジスタ23に供給される。×印のつ
いた無効桁部分にはどのようなデータがはいっていても
がまわない。
Consider the case where a decimal add instruction is executed on the device shown in FIG. 5 in which the second operand is added to the first operand and the sum is placed in the first operand's place. - For example, the first operand is -3524 (10), the data length ρ1 = 4, and the second operand is +15241 (10).
Let the data length be 12=5. The second operand is supplied to the register 23 in the form shown in FIG. 7(a). It doesn't matter what kind of data you put in the invalid digits marked with an x.

無効桁指示回路21は第2オペランドのデータ長℃2=
5よりレジスタ22に 1111111111000000’ という値を出力する。各ビットはそれぞれレジスタ23
に供給された10進オペランドの1桁に対応し、ゼロマ
スクをかける桁には1が立つ。
The invalid digit indicating circuit 21 determines the data length of the second operand ℃2=
5 outputs the value 1111111111000000' to the register 22. Each bit is in register 23
The digit that corresponds to one digit of the decimal operand supplied to the decimal operand and is zero-masked is set to 1.

第6図のタイムチャートに示す10のタイミングで、レ
ジスタ23に第2オペランドがレジスタ22に第2オペ
ランドの無効桁指示情報がセットされる。レジスタ23
の第2オペランドは、マスク回路4でレジスタ22の指
示に従い無効桁部分にゼロマスクをかけ、第7図(b)
に示す形でレジスタ25にセットされる。また、第1オ
ペランドは第7図(c)に示す形でレジスタ23に供給
される。
At timing 10 shown in the time chart of FIG. 6, the second operand is set in the register 23 and the invalid digit indication information of the second operand is set in the register 22. register 23
The second operand of is zero-masked to the invalid digit part by the mask circuit 4 according to the instructions of the register 22, and the result is shown in FIG. 7(b).
It is set in the register 25 in the form shown in FIG. Further, the first operand is supplied to the register 23 in the form shown in FIG. 7(c).

無効桁指示回路21は第1オペランドのデータ長(1=
4より、レジスタ22に 1111111111100000’ を出力する。
The invalid digit indicating circuit 21 determines the data length of the first operand (1=
4, outputs 1111111111100000' to the register 22.

第6図のタイムチャートに示すtlのタイミングで、無
効桁をゼロマスクした第2オペランドがレジスタ25に
、第1オペランドがレジスタ23に、第1オペランドの
無効桁指示情報がレジスタ22にそれぞれセットされる
At the timing tl shown in the time chart of FIG. 6, the second operand with invalid digits masked to zero is set in the register 25, the first operand is set in the register 23, and the invalid digit instruction information of the first operand is set in the register 22. .

レジスタ23の第1オペランドはマスク回路24てレジ
スタ22の指示に従い、無効桁部分にゼロマスクをかけ
、第7図(d)という形で出力される。10進演算器6
では、マスク回路24の出力とレジスタ25の値とが演
算される。2つのオペランドが異符号であるので絶対値
が比較され+15241(10)l −1−3524(
10)が実行される。演算結果として絶対値11717
 (10)と絶対値の大きいオペランドの符号十が第7
図(e)という形で出力され、レジスタ25にセットさ
れる。キャリーは発生しないのでレジスタ29にOがセ
ットされる。
The first operand of the register 23 is outputted in the form shown in FIG. 7(d) by masking the invalid digits with zero by the mask circuit 24 according to the instructions of the register 22. Decimal operator 6
Then, the output of the mask circuit 24 and the value of the register 25 are calculated. Since the two operands have different signs, their absolute values are compared and get +15241(10)l -1-3524(
10) is executed. Absolute value 11717 as the calculation result
(10) and the sign 10 of the operand with a large absolute value is the 7th
It is output in the form shown in FIG. 2(e) and set in the register 25. Since no carry occurs, O is set in register 29.

第6図のタイムチャートに示すt2のタイミングで、レ
ジスタ25には第1オペランドと第2オペランドの演算
結果が、レジスタ2つには演算によって発生したキャリ
ーがセットされる。有効桁算出回路27では、レジスタ
25の値より有効桁を算出する。最左端の桁からゼロの
桁かなん相続いているかリーディングゼロを行う。絶対
値部は15桁であるから15からリーディングゼロした
結果を減算した差が演算結果の有効桁となる。ここでレ
ジスタ25の値をリーディングゼロとすると、最左端の
桁から10桁が連続してゼロである。すなわち有効桁は
15−10=5である。
At timing t2 shown in the time chart of FIG. 6, the calculation results of the first and second operands are set in the register 25, and the carry generated by the calculation is set in the two registers. The significant digit calculation circuit 27 calculates the significant digits from the value of the register 25. Perform leading zero to see if the zero digit is inherited from the leftmost digit. Since the absolute value part has 15 digits, the difference obtained by subtracting the result of leading zero from 15 becomes the effective digit of the calculation result. Here, if the value of the register 25 is a leading zero, 10 digits from the leftmost digit are consecutive zeros. That is, the effective digits are 15-10=5.

比較回路28では第1オペランドのデータ長p1=4と
演算結果の有効桁5を比較し、第1オペランドのデータ
長ρ1のほうが小さいことを検出する。例外検出回路3
0では、比較回路8の検出結果とレジスタ29のキャリ
ーより例外を検出する。
The comparison circuit 28 compares the data length p1=4 of the first operand with the significant digit 5 of the operation result, and detects that the data length ρ1 of the first operand is smaller. Exception detection circuit 3
0, an exception is detected from the detection result of the comparison circuit 8 and the carry of the register 29.

ここでは第1オペランドのデータ長ff1.のほうが演
算結果の有効桁より小さいことが検出されているので、
オーバーフロー例外が検出される。またレジスタ29の
キャリーを参照する場合は、例えば第1オペランドが第
7図(f)でデータ長ρ1−15、第2オペランドが第
7図(g)でデータ長J22=15という場合、演算結
果は第7図(h)に示すようになり、演算結果の有効桁
は1で第1オペランドのデータ長β1のほうが小さい場
合を検出する比較回路28では、なにも検出されない。
Here, the data length of the first operand is ff1. is detected to be smaller than the significant digits of the operation result, so
An overflow exception is detected. In addition, when referring to the carry in register 29, for example, if the first operand is the data length ρ1-15 in FIG. 7(f), and the second operand is the data length J22=15 in FIG. 7(g), the operation result is is as shown in FIG. 7(h), and the comparison circuit 28, which detects when the valid digit of the operation result is 1 and the data length β1 of the first operand is smaller, does not detect anything.

しかし演算によってキャリーがあがっているので実際に
はオーバーフロー例外が発生している。このような場合
を検出するために、例外検出回路30ではレジスタ29
のキャリーをも参照する。例外検出回路30で検出され
た結果は、レジスタ31にセットされる。レジスタ31
は通常はクリアされており、制御部33が指示したタイ
ミングでのみセットされ、レジスタ32に演算結果がセ
ットされる。
However, since the carry is increased by the operation, an overflow exception actually occurs. In order to detect such a case, the exception detection circuit 30 uses the register 29.
Also see carry. The result detected by the exception detection circuit 30 is set in the register 31. register 31
is normally cleared, and is set only at the timing instructed by the control unit 33, and the calculation result is set in the register 32.

第6図のタイムチャートに示すt3のタイミングでレジ
スタ32に演算結果が、レジスタ31にオーバーフロー
例外の有無がそれぞれセットされる。
At timing t3 shown in the time chart of FIG. 6, the calculation result is set in the register 32, and the presence or absence of an overflow exception is set in the register 31.

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

上述した従来の可変長10進データのオーバーフロー例
外検出方式では、専用の有効桁算出回路27および比較
回路28が必要であるという欠点がある。
The above-described conventional overflow exception detection method for variable length decimal data has a drawback in that a dedicated significant digit calculation circuit 27 and comparison circuit 28 are required.

〔課題を解決するための手段〕[Means to solve the problem]

本発明の可変長10進データの例外検出方式は、可変長
10進データを扱うデータ処理装置において、可変長1
0進データのデータ長より無効桁部分を指示する指示手
段と、可変長10進データの無効桁に相当する部分をあ
る特定のコードに差しかえる差しかえ手段と、10進演
算器と、前記10進演算器の演算結果と前記差しかえ手
段とによって発生させたパターンとを前記10進演算器
で加算し発生するキャリーを参照することによりオーバ
ーフロー例外を検出する検出手段とを備えて構成される
The exception detection method for variable-length decimal data of the present invention is applicable to a data processing device that handles variable-length decimal data.
an instruction means for indicating an invalid digit part based on the data length of the decimal data; a replacement means for replacing the part corresponding to the invalid digit of the variable length decimal data with a specific code; a decimal arithmetic unit; and detecting means for detecting an overflow exception by adding the operation result of the decimal arithmetic unit and the pattern generated by the replacing means in the decimal arithmetic unit and referring to the carry generated.

〔実施例〕〔Example〕

次に、本発明について図面を参照して説明する。 Next, the present invention will be explained with reference to the drawings.

第1図は本発明の一実施例の構成を示すブロック図、第
2図は本実施例の動作を説明するタイムチャート、第4
図(a)〜(j)は本実施例のオペランドの内容を示す
説明図である。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention, FIG. 2 is a time chart explaining the operation of this embodiment, and FIG.
Figures (a) to (j) are explanatory diagrams showing the contents of the operands of this embodiment.

第1図による本実施例の基本構成は従来の技術で述べた
第4図と同様であるが第5図に存在する有効桁算出回路
27と比較回路28を持たず、主として接続の変更など
により解決したものである。
The basic configuration of the present embodiment shown in FIG. 1 is the same as that of FIG. 4 described in the prior art section, but it does not have the significant digit calculation circuit 27 and comparison circuit 28 that are present in FIG. It is resolved.

第1図において1は無効桁指示回路、2は無効桁指示回
路1の値を格納するレジスタ、3は供給されたオペラン
ドを格納するレジスタ、4はマスクする値を格納し00
00 (2)または1001(2)がセットされるレジ
スタ、5はレジスタ2の指示によりレジスタ3の値の無
効桁部分をレジスタ4に格納された値に差しかえる無効
桁差しかえ回路、6は無効桁差しがえ回路5の出力また
は10進演算器7の出力を格納するレジスタ、7はオペ
ランドの符号部の値に関らず加算を実行する機能とを持
つ10進演算器、8は1o進演算器8で発生したキャリ
ーを格納するレジスタ、9は例外検出回路、10は例外
検出回路9の結果を格納するレジスタ、11はレジスタ
6に格納された演算結果を格納し出力するレジスタ、1
2は無効桁指示回路1.10進演算器7および各レジス
タの制御を行なう制御部である。
In FIG. 1, 1 is an invalid digit indicating circuit, 2 is a register that stores the value of the invalid digit indicating circuit 1, 3 is a register that stores the supplied operand, 4 is a register that stores the value to be masked, and 00
00 (2) or 1001 (2) is set in the register, 5 is an invalid digit replacement circuit that replaces the invalid digit part of the value of register 3 with the value stored in register 4 according to the instruction from register 2, 6 is invalid A register that stores the output of the digit swap circuit 5 or the output of the decimal arithmetic unit 7, 7 is a decimal arithmetic unit that has the function of performing addition regardless of the value of the sign part of the operand, and 8 is a 10 decimal arithmetic unit. 9 is an exception detection circuit; 10 is a register that stores the result of the exception detection circuit 9; 11 is a register that stores and outputs the operation result stored in register 6;
Reference numeral 2 designates an invalid digit indicating circuit 1, a control section for controlling the decimal arithmetic unit 7 and each register.

第1図に示す装置上で、従来の技術で述べたと同様の命
令、すなわち第2オペランドが第1オペランドに加えら
れ、和が第1オペランドの場所に入れられるという10
進加算命令が実行される場合を仮定する。比較のため、
従来の技術で述べたと同様のオペランドが供給されるも
のとする。すなわち、第1オペランドが−3524(1
0)でデータ長J1=4、第2オペランドは+1524
1(10)でデータ長j2=5とする。
On the apparatus shown in FIG.
Assume that a base addition instruction is executed. For comparison,
It is assumed that operands similar to those described in the prior art are provided. In other words, the first operand is -3524(1
0), data length J1=4, second operand is +1524
1 (10) and the data length j2=5.

まず、第2オペランドが第4図(a)に示すような形で
レジスタ3に供給される。×印のついた無効桁部分には
、どのようなデータがはいっていてもかまわない。無効
桁指示回路1は第2オペランドのデータ長p2=5より
レジスタ2に’ 1111111111000000 
’を出力する。レジスタ4に制御部12よりクリアが指
示され ’oooo。
First, the second operand is supplied to the register 3 in the form shown in FIG. 4(a). It doesn't matter what kind of data you put in the invalid digits marked with an x. Invalid digit indicating circuit 1 inputs '1111111111000000 to register 2 from the data length p2=5 of the second operand.
' is output. The register 4 is instructed to clear by the control unit 12 and 'oooo' is generated.

がセットされる。is set.

第2図のタイムチャートに示す10のタイミングで、レ
ジスタ3に第2オペランドが、レジスタ2に第2オペラ
ンドの無効桁情報が、レジスタ4に無効桁をマスクする
値がそれぞれセットされる。レジスタ3の第2オペラン
ドは、無効桁差しかえ回路5で、レジスタ2の指示に従
い、無効桁部分をレジスタ4の値と差しがえ第4図(b
)に示すような形でレジスタ6にセットされる。また第
1オペランドは、第4図(c)に示すような形でレジス
タ3に供給される。無効桁指示回路1は第1オペランド
のデータ長g1=4であるからレジスタ2に ’1111111111100000’を出力する。
At timing 10 shown in the time chart of FIG. 2, the second operand is set in register 3, the invalid digit information of the second operand is set in register 2, and a value for masking invalid digits is set in register 4. The second operand of register 3 is processed by invalid digit replacement circuit 5, which replaces the invalid digit with the value of register 4 according to the instructions of register 2.
) is set in register 6 as shown in FIG. Further, the first operand is supplied to the register 3 in the form shown in FIG. 4(c). Since the data length g1 of the first operand is 4, the invalid digit indicating circuit 1 outputs '1111111111100000' to the register 2.

第2図のタイムチャートに示すtlのタイミングで、レ
ジスタ6に無効桁をゼロで差しがえた第2オペランドが
、レジスタ3に第1オペランドが、レジスタ2に第1オ
ペランドの無効桁指示情報がそれぞれセットされる。ま
たレジスタ4はボールドされる。
At the timing tl shown in the time chart of Figure 2, the second operand with invalid digits replaced with zero is stored in register 6, the first operand is stored in register 3, and the invalid digit instruction information of the first operand is stored in register 2. Set. Also, register 4 is bolded.

レジスタ3の第オペランドは、無効桁差しかえ回路5で
レジスタ2の指示に従い、無効桁部分をレジスタ4の値
と差しがえ第4図(d)に示すような形で出力される。
The invalid digit replacement circuit 5 replaces the invalid digits with the value of the register 4 for the third operand of the register 3 according to the instructions from the register 2, and outputs the result as shown in FIG. 4(d).

10進演算器7では無効桁差しかえ回路5の出力と、レ
ジスタ6の値とが演算される。演算結果は第4図(e)
に示ような形で出力され、レジスタ6にセットされる。
The decimal calculator 7 calculates the output of the invalid digit replacement circuit 5 and the value of the register 6. The calculation result is shown in Figure 4(e)
It is output in the form shown in and set in register 6.

また、レジスタ8にはキャリーがセットされ、本演算に
おいてキャリーは発生しないので0がセットされる。
Further, a carry is set in register 8, and since no carry occurs in this operation, 0 is set.

さらに、レジスタ3のクリアが指示され、第4図(f)
に示すような形にすべてゼロがセットされる。レジスタ
4はセットが指示され ’1001’ がセットされる。
Furthermore, clearing of register 3 is instructed, as shown in FIG. 4(f).
All zeros are set as shown in . Register 4 is instructed to be set and '1001' is set.

第2図のタイムチャートに示すt2のタミングで、レジ
スタ6に演算結果が、レジスタ8にキャリーが、レジス
タ4に1001 (2)がセットされ、レジスタ3がゼ
ロクリアされる。レジスタ2はホールドされ、レジスタ
3の値は、無効桁差しかえ回路5でレジスタ2の指示に
従い、第1オペランドの無効桁部分に相当する桁をレジ
スタ4の値に差しかえる。すなわち第4図(g)に示す
ような形が無効桁差しかえ回路5より出力される。
At timing t2 shown in the time chart of FIG. 2, the operation result is set in register 6, carry is set in register 8, 1001 (2) is set in register 4, and register 3 is cleared to zero. Register 2 is held, and the value of register 3 is replaced by the invalid digit replacement circuit 5, which replaces the digit corresponding to the invalid digit portion of the first operand with the value of register 4 according to the instruction of register 2. That is, a form as shown in FIG. 4(g) is output from the invalid digit replacement circuit 5.

10進演算器7はオペランドの符号部の値にかかわらず
加算を実行するよう制御される。無効桁差しかえ回路5
の出力と、レジスタ6の演算結果の絶対値とを、加算す
る。無効桁差しかえ回路5の出力は、第1オペランドの
有効桁部分には0000 (2)が、無効桁部分には1
001 (2)が対応している。第オペランドの無効桁
部分に演算結果の有効桁が存在する場合、1001 (
2)と演算結果の有効桁、すなわちOOOO(2)以外
の数が加算され、上位桁に桁あがりする。無効桁差しか
え回路5の出力は、第1オペランドの無効部分に対応す
る桁をすべて100’l (2)に差しかえであるので
、桁あがりは伝播しキャリーが発生する。本例において
は、演算結果の10’の位の桁0001 (2)が10
01 (2)と加算されて桁あがりする。この桁あがり
が伝播し、キャリーが発生する。
The decimal arithmetic unit 7 is controlled to perform addition regardless of the value of the sign part of the operand. Invalid digit replacement circuit 5
The output of and the absolute value of the operation result of register 6 are added. The output of the invalid digit replacement circuit 5 is 0000 (2) in the valid digit part of the first operand and 1 in the invalid digit part.
001 (2) corresponds. If a valid digit of the operation result exists in the invalid digit part of the second operand, 1001 (
2) and the significant digits of the operation result, that is, the numbers other than OOOO(2), are added and the digits move up to the higher digits. Since the output of the invalid digit replacement circuit 5 replaces all the digits corresponding to the invalid portion of the first operand with 100'l (2), the digit increment propagates and a carry occurs. In this example, the 10' digit 0001 (2) of the calculation result is 10
01 (2) is added to raise the digit. This carry propagates and a carry occurs.

例外検出回路9は10進演算回路7より出力されるキャ
リーと、レジスタ8に格納されている演算結果のキャリ
ーとから例外を検出する。ここでは10進演算回路7よ
りキャリーが発生しているので、オーバーフロー例外が
検出される。また、レジスタ8の演算結果のキャリーを
参照するのは、以下のような場合が存在するからである
。例えば、第1オペランドが第4図(h)に示すような
形でデータ長Ax=15となり、第2オペランドが第4
図(i)に示すような形でデータ長p215という場合
′演算結果は、第4図(j)に示すような形となり、演
算によってキャリーが発生する。
The exception detection circuit 9 detects an exception from the carry output from the decimal arithmetic circuit 7 and the carry of the operation result stored in the register 8. Here, a carry is generated from the decimal arithmetic circuit 7, so an overflow exception is detected. Further, the reason why the carry of the operation result in register 8 is referred to is because the following cases exist. For example, the first operand becomes the data length Ax=15 as shown in FIG. 4(h), and the second operand becomes the fourth operand.
When the data length is p215 as shown in FIG. 4(i), the result of the operation is as shown in FIG. 4(j), and a carry occurs due to the operation.

第1オペランドのデータ長ρ1=15であるから、15
桁すべてが有効桁となる。上述した第1オペランドの有
効桁にはOOOO(2)を、無効桁には1001 (2
)をそれぞれ対応させたパターンを演算結果に加算する
方式では、本令の場合桁あがりはおきないのでキャリー
は発生しない。すなわちオーバーフロー例外は検出され
ない。しかし、演算結果が15桁より大きいのだからオ
ーバーフロー例外は発生している。上述の場合のオーバ
ーフロー例外を検出するために、レジスタ8の演算結果
のキャリーを参照するレジスタ10に例外検出回路9の
出力がセットされる。レジスタ10は通常クリアされて
おり、オーバーフロー例外が検出されるタイミングでの
みセットが指示される。そして、レジスタ11にレジス
タ6の演算結果がセットされる。
Since the data length of the first operand ρ1=15, 15
All digits are significant digits. The valid digits of the first operand mentioned above are OOOO (2), and the invalid digits are 1001 (2).
) in the method of adding corresponding patterns to the operation result, no carry occurs in this case because the digits do not go up. That is, overflow exceptions are not detected. However, since the operation result is larger than 15 digits, an overflow exception occurs. In order to detect the overflow exception in the above case, the output of the exception detection circuit 9 is set in the register 10 which refers to the carry of the operation result of the register 8. Register 10 is normally cleared and is instructed to be set only when an overflow exception is detected. Then, the calculation result of the register 6 is set in the register 11.

また、第2図のタイムチャートに示すt3のタイミング
でレジスタ10にオーバーフロー例外の有無が、レジス
タ11に演算結果がそれぞれセットされるようになって
いる。
Furthermore, at timing t3 shown in the time chart of FIG. 2, the presence or absence of an overflow exception is set in the register 10, and the calculation result is set in the register 11, respectively.

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明は、可変長10進データの無
効桁に相当する部分をある特定のコードに差しかえるこ
とによって、オーバーフロー例外検出専用のハードウェ
アである有効桁算出回路27および比較回路28を必要
とせず、従来と同等のクロック数で10進演算命令のオ
ーバーフロー例外が検出できるという効果がある。
As explained above, the present invention replaces the parts corresponding to invalid digits of variable-length decimal data with a certain specific code, thereby enabling the effective digit calculation circuit 27 and comparison circuit 28, which are hardware dedicated to overflow exception detection, to This method has the advantage that an overflow exception of a decimal arithmetic instruction can be detected with the same number of clocks as the conventional method.

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

第1図は本発明の一実施例の構成を示すブロック図、第
2図は本実施例の動作を説明するタイムチャート、第3
図は可変長lO進データの構成を示す説明図、第4図(
a)〜(j)は本実施例のオペランドの内容を示す説明
図、第5図は従来の技術によるオーバーフロー例外検出
方式の一例を示すブロック図、第6図は本従来例の動作
を説明するタイムチャート、第7図は本従来例のオペラ
ンドの内容を示す説明図。 1・21・・・無効桁指示回路、2〜4・6・8・10
・11・22・23・25・29・31・32・・・レ
ジスタ、5・・・無効桁差しがえ回路、7・・・10進
演算器、9・30・・・例外検出回路、12・3・・・
制御部、 24・・・マスク回路、 6・・・ 10進 演算器、 7・・・有効桁算出回路、 8・・・比較図 路。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention, FIG. 2 is a time chart explaining the operation of this embodiment, and FIG.
The figure is an explanatory diagram showing the structure of variable-length lO-adic data;
a) to (j) are explanatory diagrams showing the contents of the operands of this embodiment, FIG. 5 is a block diagram showing an example of an overflow exception detection method according to the conventional technique, and FIG. 6 explains the operation of this conventional example. FIG. 7 is an explanatory diagram showing the contents of the operands of this conventional example. 1, 21... Invalid digit indicating circuit, 2 to 4, 6, 8, 10
・11・22・23・25・29・31・32...Register, 5...Invalid digit replacement circuit, 7...Decimal arithmetic unit, 9.30...Exception detection circuit, 12・3...
Control unit, 24... Mask circuit, 6... Decimal arithmetic unit, 7... Significant digit calculation circuit, 8... Comparison diagram.

Claims (1)

【特許請求の範囲】[Claims]  可変長10進データを扱うデータ処理装置において、
可変長10進データのデータ長より無効桁部分を指示す
る指示手段と、可変長10進データの無効桁に相当する
部分をある特定のコードに差しかえる差しかえ手段と、
10進演算器と、前記10進演算器の演算結果と前記差
しかえ手段とによつて発生させたパターンとを前記10
進演算器で加算し発生するキャリーを参照することによ
りオーバーフロー例外を検出する検出手段とを備えて成
ることを特徴とするオーバーフロー例外検出方式。
In a data processing device that handles variable length decimal data,
an instruction means for indicating an invalid digit part from the data length of the variable length decimal data; a replacement means for replacing the part corresponding to the invalid digit of the variable length decimal data with a certain specific code;
A decimal arithmetic unit, and a pattern generated by the arithmetic result of the decimal arithmetic unit and the replacing means.
1. An overflow exception detection method, comprising: detection means for detecting an overflow exception by referring to a carry generated by addition in a decimal arithmetic unit.
JP2237354A 1990-09-07 1990-09-07 Overflow exception detection system Pending JPH04116717A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2237354A JPH04116717A (en) 1990-09-07 1990-09-07 Overflow exception detection system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2237354A JPH04116717A (en) 1990-09-07 1990-09-07 Overflow exception detection system

Publications (1)

Publication Number Publication Date
JPH04116717A true JPH04116717A (en) 1992-04-17

Family

ID=17014153

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2237354A Pending JPH04116717A (en) 1990-09-07 1990-09-07 Overflow exception detection system

Country Status (1)

Country Link
JP (1) JPH04116717A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716267B2 (en) 2004-08-30 2010-05-11 Casio Computer Co., Ltd. Decimal computing apparatus, electronic device connectable decimal computing apparatus, arithmetic operation apparatus, arithmetic operation control apparatus, and program-recorded recording medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5743239A (en) * 1980-08-27 1982-03-11 Hitachi Ltd Data processor
JPS61123930A (en) * 1984-11-19 1986-06-11 Fujitsu Ltd Overflow detection system of variable length data arithmetic

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5743239A (en) * 1980-08-27 1982-03-11 Hitachi Ltd Data processor
JPS61123930A (en) * 1984-11-19 1986-06-11 Fujitsu Ltd Overflow detection system of variable length data arithmetic

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716267B2 (en) 2004-08-30 2010-05-11 Casio Computer Co., Ltd. Decimal computing apparatus, electronic device connectable decimal computing apparatus, arithmetic operation apparatus, arithmetic operation control apparatus, and program-recorded recording medium
US8316067B2 (en) 2004-08-30 2012-11-20 Casio Computer Co., Ltd. Decimal computing apparatus, electronic device connectable decimal computing apparatus, arithmetic operation apparatus, arithmetic operation control apparatus, and program-recorded recording medium

Similar Documents

Publication Publication Date Title
US20180157464A1 (en) Apparatus and method for performing arithmetic operations to accumulate floating-point numbers
US11347511B2 (en) Floating-point scaling operation
JP5636110B2 (en) Functional unit for vector leading zero, vector trailing zero, vector operand 1S count and vector parity calculation
KR20080098440A (en) Floating-point processor with reduced power requirements for selectable subprecision
JPH0542011B2 (en)
JPS63278136A (en) Arithmetic circuit
JPH0850545A (en) Digital processor with minimum/maximum retrieval instruction
JPH0228830A (en) Integer number dividing circuit
JPH0756712A (en) Process for execution of numerical computation and arithmetic unit for realization of said process
JPH04116717A (en) Overflow exception detection system
WO2023113445A1 (en) Method and apparatus for floating point arithmetic
JP2504847B2 (en) Decimal data check circuit
JP2018524706A (en) Apparatus and method for processing floating point values
JPH07134645A (en) Device for generating condition code for information processing
JPH0991118A (en) Floating point arithmetic unit
JPH01282633A (en) Non-normalized number processing system
JP3293768B2 (en) Floating point arithmetic circuit and computer provided with the floating point arithmetic circuit
JPH03164930A (en) Detection system for exception to overflow
JP3137636B2 (en) Data processing device
JPH07104777B2 (en) Floating point adder / subtractor
JPH0381173B2 (en)
SU885994A1 (en) Computing device
JPH0644226B2 (en) Processor
JPH04160533A (en) Microprocessor
JPS62271017A (en) Addition and subtraction device for decimal number