JPH0377538B2 - - Google Patents
Info
- Publication number
- JPH0377538B2 JPH0377538B2 JP60173050A JP17305085A JPH0377538B2 JP H0377538 B2 JPH0377538 B2 JP H0377538B2 JP 60173050 A JP60173050 A JP 60173050A JP 17305085 A JP17305085 A JP 17305085A JP H0377538 B2 JPH0377538 B2 JP H0377538B2
- Authority
- JP
- Japan
- Prior art keywords
- decimal
- circuit
- data
- subtraction
- addition
- 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
Links
- 238000001514 detection method Methods 0.000 claims description 25
- 230000000295 complement effect Effects 0.000 claims description 21
- 238000012937 correction Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000000593 degrading effect Effects 0.000 description 1
- 238000000034 method Methods 0.000 description 1
Description
【発明の詳細な説明】
〔概要〕
10進加減算回路における入力データの例外値A
〜Fが、加算時の+6加算器の出力と、減算時の
補数化回路の出力とにおいて、ともに0〜5の範
囲の値になることを利用して、加減算とも、同一
の10進データ例外検出論理を適用し、回路を簡単
化する。[Detailed Description of the Invention] [Summary] Exception value A of input data in decimal addition/subtraction circuit
Using the fact that ~F is a value in the range of 0 to 5 in both the output of the +6 adder during addition and the output of the complement circuit during subtraction, the same decimal data exception is generated for both addition and subtraction. Apply detection logic and simplify the circuit.
本発明はデータ処理装置に関するものであり、
特に10進加減算回路のデータ例外検出方式に関す
る。
The present invention relates to a data processing device,
In particular, it relates to data exception detection methods for decimal addition/subtraction circuits.
一般に2進化10進数を用いた10進化減算では、
演算結果に応じて6の補正を行う必要がある。
Generally, in decimal subtraction using binary coded decimal numbers,
It is necessary to perform 6 corrections according to the calculation results.
第3図は、このような従来の10進加減算回路の
代表的な例を示したものである。 FIG. 3 shows a typical example of such a conventional decimal addition/subtraction circuit.
図において、31は+6加算器、32はセレク
タ、33は主加算器、34は補数化回路、35は
10進補正回路、36は10進データ例外検出回路、
AおよびBは入力データ、CARRYは最下位デジ
ツトへのキヤリー(桁上げ)を表す。 In the figure, 31 is a +6 adder, 32 is a selector, 33 is a main adder, 34 is a complement circuit, and 35 is a
Decimal correction circuit, 36 is a decimal data exception detection circuit,
A and B represent input data, and CARRY represents a carry to the lowest digit.
次に基本的な動作を10進加算と10進減算のそれ
ぞれの場合について説明する。 Next, the basic operations will be explained for decimal addition and decimal subtraction.
10進加算
入力データBの各デジツトに+6加算器31で
6を加算する。その結果をセレクタ32で選択し
て、主加算器33に入力し、入力データAと2進
加算する。このとき、キヤリーを生じなかつたデ
ジツトについてのみ、10進補正回路35で6を減
算する。Decimal addition Add 6 to each digit of input data B using the +6 adder 31. The result is selected by the selector 32, inputted to the main adder 33, and subjected to binary addition with the input data A. At this time, the decimal correction circuit 35 subtracts 6 only for digits that do not cause carry.
たとえばA=5649、B=3291の場合、+6加算
器31の出力は、
3291+6666
98F7
となる。これを主加算器33でAの“5649”と2
進加算することにより、
5649+98F7
和EF40
キヤリー0011
となり、和“EF40”が得られる。そしてこのと
き“E”、“F”のデジツトにはキヤリーが生じな
い。 For example, when A=5649 and B=3291, the output of the +6 adder 31 is 3291 +6666 98F7. The main adder 33 converts this into “5649” of A and 2
By performing base addition, it becomes 5649 + 98F7 sum EF40 carry 0011, and the sum "EF40" is obtained. At this time, no carry occurs in the "E" and "F" digits.
そこで、10進補正回路35において、“E”、
“F”からそれぞれ“6”を減算する補正を行う。 Therefore, in the decimal correction circuit 35, "E",
A correction is made by subtracting "6" from each "F".
EF40−6600
8940
このようにして、10進加算結果として“8940”
が得られる。 EF40 −6600 8940 In this way, “8940” is obtained as the decimal addition result.
is obtained.
10進減算
入力データBをセレクタ32で選択し、主加算
器33の補数化回路34で1の複数化を行い、そ
の結果と、入力データAと、CARRY=1とを2
進加算する。このとき、キヤリーを生じなかつ
た、デジツトについてのみ、10進補正回路35で
6を減算する。Decimal subtraction Input data B is selected by the selector 32, and the complement circuit 34 of the main adder 33 multiplies it by 1, and the result, input data A, and CARRY=1 are converted into 2.
Add base. At this time, the decimal correction circuit 35 subtracts 6 only for digits that do not cause carry.
たとえばA=7392、B=4718の場合、主加算器
33の補数化回路で、Bについての1の複数化、、
すなわち16進数の“F”に対する補数化が行わ
れ、
FFFF−4718
B8E7
となる。これをA=7392およびCARRY=1と加
算し、
7392+B8E7
(1)2C79+0001
(CARRY)
和2C7A
キヤリー1010
を得る。この加算でキヤリーを生じていないデジ
ツトは“C”、“A”である。そこでこれらについ
て10進補正回路35で“6”を減算する補正を行
い、
2C7A−0606
2674
により、10進減算結果として“2674”が得られ
る。 For example, in the case of A=7392 and B=4718, the complement circuit of the main adder 33 multiplies 1 for B,
In other words, the hexadecimal number “F” is complemented, resulting in FFFF −4718 B8E7. Add this to A=7392 and CARRY=1 to obtain 7392 +B8E7 (1)2C79 +0001 (CARRY) Sum 2C7A Carry 1010. The digits that do not cause carry in this addition are "C" and "A". Therefore, the decimal correction circuit 35 corrects these by subtracting "6", and 2C7A -0606 2674 yields "2674" as the decimal subtraction result.
ここで、10進データ例外検出回路36は、主加
算器33の加数あるいは減数入力側データの10進
データ例外を検出している。すなわち入力データ
Bの各デジツトの値が0〜9の範囲を越えて、A
〜Fの範囲の値をもつている場合、これをエラー
とするためのものである。しかし、加算の場合に
は、入力データBに6+加算器31により“6”
が加算されるため、上記A〜Fの値は0〜5の値
に変わる。 Here, the decimal data exception detection circuit 36 detects a decimal data exception in the data on the addend or subtraction input side of the main adder 33. In other words, if the value of each digit of input data B exceeds the range of 0 to 9,
This is to treat this as an error if it has a value in the range of ~F. However, in the case of addition, input data B is set to "6" by 6+adder 31.
is added, so the values of A to F above change to values of 0 to 5.
このため、10進データ例外検出回路36では、
加算の場合にデジツトの値が0〜5のものを10進
例外とし、減算の場合にデジツトの値がA〜Fの
ものを10進例外として検出している。 Therefore, in the decimal data exception detection circuit 36,
In the case of addition, a digit value of 0 to 5 is detected as a decimal exception, and in the case of subtraction, a digit value of A to F is detected as a decimal exception.
従来の10進加減算回路では、10進データ例外の
検出に加算と減算とで別々の方法を用いなければ
ならず、そのため検出回路の構成が複雑になつて
いた。
In conventional decimal addition/subtraction circuits, separate methods must be used for addition and subtraction to detect decimal data exceptions, making the configuration of the detection circuit complex.
本発明は、10進加減算回路における10進データ
例外検出回路の例外検出方法を加算と減算とで共
通化できるように、加減算回路のデータ入力回路
を工夫したものである。
In the present invention, the data input circuit of the decimal addition/subtraction circuit is devised so that the exception detection method of the decimal data exception detection circuit in the decimal addition/subtraction circuit can be shared between addition and subtraction.
そのため本発明では、10進データに6を加えた
とき、A〜Fの値は0〜5となり、また10進デー
タについて1の補数をとつたとき、A〜Fの値は
5〜0となることに着目し、10進加算時には入力
データに6を加えた値について10進データ例外を
0〜5でとり、そして10進減算時には入力データ
を1の補数に変換した値について10進データ例外
を0〜5でとるようにして、10進データ例外検出
回路の簡単化を図つている。 Therefore, in the present invention, when 6 is added to the decimal data, the values of A to F become 0 to 5, and when the 1's complement is taken for the decimal data, the values of A to F become 5 to 0. Focusing on this, during decimal addition, we take a decimal data exception between 0 and 5 for the value obtained by adding 6 to the input data, and when we perform decimal subtraction, we take a decimal data exception for the value obtained by converting the input data to 1's complement. The decimal data exception detection circuit is simplified by taking values from 0 to 5.
第1図は、本発明の原理的構成を示す図であ
り、11は+6加算器、12は補数化回路、13は
セレクタ、14は主加算器、15は10進補正回
路、16は10進データ例外検出回路、A、Bは入
力データ、CARRYは最下位デジツトへのキヤリ
ー(桁上げ)である。 FIG. 1 is a diagram showing the basic configuration of the present invention, in which 11 is a +6 adder, 12 is a complement circuit, 13 is a selector, 14 is a main adder, 15 is a decimal correction circuit, and 16 is a decimal Data exception detection circuit, A and B are input data, and CARRY is a carry to the lowest digit.
+6加算器11は10進加算時に使用され、入力
データの各デジツトに6を加算する。 The +6 adder 11 is used during decimal addition and adds 6 to each digit of input data.
補数化回路12は10進減算時に使用され、入力
データBを1の補数に変換する。 The complement circuit 12 is used during decimal subtraction and converts the input data B into a one's complement number.
セレクタ13は、10進加算時に+6加算器11
の出力を選択し、10進減算時に補数化回路12の
出力を選択する。 Selector 13 selects +6 adder 11 during decimal addition.
The output of the complement circuit 12 is selected during decimal subtraction.
主加算器14は、10進加算時に入力データAと
“6”を加算された入力データBとを2進加算し、
10進減算時に入力データAと1の補数化された入
力データBとCARRY=1とを2進加算する。 The main adder 14 performs binary addition of input data A and input data B to which "6" has been added during decimal addition,
During decimal subtraction, input data A, 1's complemented input data B, and CARRY=1 are added in binary.
10進補正回路15は、10進加算と10進減算の主
加算器14における2進加算で、デジツトキヤリ
ーが生じていないデジツトから“6”を減算する
補正を行う。 The decimal correction circuit 15 performs correction by subtracting "6" from digits in which no digit carry occurs during binary addition in the main adder 14 of decimal addition and decimal subtraction.
10進データ例外検出回路16は、10進加算と10
進減算の両方の場合に、セレクタ13の出力デー
タのデジツトについて0〜5の値を検出し、0〜
5の値を検出したとき、10進データ例外として報
告する。 The decimal data exception detection circuit 16 performs decimal addition and 10
In both cases of base and subtraction, values from 0 to 5 are detected for the digits of the output data of the selector 13;
When a value of 5 is detected, it is reported as a decimal data exception.
本発明によれば、10進減算時における入力デー
タの10進データ例外検出位置を、1の補数化の前
から後へ移す簡単な回路変更で、加減算動作に殆
ど影響することなく10進データ例外検出方法を単
一化することができる。
According to the present invention, by simply changing the circuit to move the decimal data exception detection position of input data during decimal subtraction from before to after conversion to one's complement, decimal data exceptions can be detected without almost affecting addition/subtraction operations. The detection method can be unified.
具体例で説明すると、たとえば入力データが10
進4桁の1B4Fのとき、10進加算の場合には+6
加算器で各デジツトごとの“6”の加算が行われ
て、
1B4F+6666
71A5
となり、これについては10進データ例外検出回路
により“1”と“5”のデジツトが10進データ例
外0〜5に入るものとして検出される。 To explain with a specific example, for example, input data is 10
For decimal 4-digit 1B4F, +6 for decimal addition
The adder adds “6” for each digit, resulting in 1B4F +6666 71A5, and the decimal data exception detection circuit converts the digits “1” and “5” into decimal data exceptions 0 to 5. Detected as entering.
同様に10進減算の場合では、入力データの
1B4Fは、補数化回路において1の補数に変換さ
れ、E4B0となるので、10進データ例外検出回路
により、“4”と“0”のデジツトが10進データ
例外0〜5に入るものとして検出される。 Similarly, in the case of decimal subtraction, the input data
1B4F is converted to 1's complement in the complement circuit and becomes E4B0, so the decimal data exception detection circuit detects the digits "4" and "0" as falling into decimal data exceptions 0 to 5. Ru.
これらのデジツトは、いずれの場合も元の入力
データ1B4F中のデジツト“B”と“F”を指し
ており、10進データ例外が正しく検出されている
ことがわかる。 These digits refer to digits "B" and "F" in the original input data 1B4F in each case, and it can be seen that the decimal data exception is correctly detected.
第2図は、本発明の1実施例の構成図であり、
10進4桁の並列加減算回路の例を示す。
FIG. 2 is a configuration diagram of one embodiment of the present invention,
An example of a 4-digit decimal parallel addition/subtraction circuit is shown.
図において、21は+6加算器、22は補数化
回路、23はセレクタ、24は主加算器、25は
10進補正回路、26は10進データ例外検出回路、
27−1ないし27−4はデコーダ、28−1な
いし28−4はOR回路、29はOR回路を示す。 In the figure, 21 is a +6 adder, 22 is a complement circuit, 23 is a selector, 24 is a main adder, and 25 is a
Decimal correction circuit, 26 is a decimal data exception detection circuit,
27-1 to 27-4 are decoders, 28-1 to 28-4 are OR circuits, and 29 is an OR circuit.
なお、第2図で21ないし26の参照番号で示
される各要素は、第1図で11ないし16の参照
番号で示されている各要素に対応し、同一の機能
を果たしている。そのため、ここでは10進データ
例外検出回路26を中心に説明する。 The elements indicated by reference numbers 21 to 26 in FIG. 2 correspond to the elements indicated by reference numbers 11 to 16 in FIG. 1, and perform the same functions. Therefore, the decimal data exception detection circuit 26 will be mainly explained here.
10進加算時に、10進4桁(4デジツト=16ビツ
ト)の入力データBは、+6加算器21で各桁
(デジツト)ごとに“6”を加算され、結果はセ
レクタ23を経て主加算器24と10進データ例外
検出回路26に入力する。また10進減算時には、
入力データBは補数化回路22で1の補数に変換
され、セレクタ23を経て、主加算器24と10進
データ例外検出回路26に入力される。 During decimal addition, input data B of 4 decimal digits (4 digits = 16 bits) is incremented by 6 for each digit (digit) in the +6 adder 21, and the result is sent to the main adder via the selector 23. 24 and the decimal data exception detection circuit 26. Also, when doing decimal subtraction,
Input data B is converted into a one's complement number by a complement circuit 22, and is inputted to a main adder 24 and a decimal data exception detection circuit 26 via a selector 23.
10進データ例外検出回路26は10進加算/減算
いずれの場合も同一の動作を行う。 The decimal data exception detection circuit 26 performs the same operation in both decimal addition and subtraction.
デコーダ27−1ないし27−4は、それぞれ
各デジツトごとの4ビツトデータを入力として、
0〜5の値、すなわち(0000)、(0001)、(0010)、
(001)(0100)、(0101)を検出したときに出力を
生じる回路である。 The decoders 27-1 to 27-4 each receive 4-bit data for each digit as input, and
Values from 0 to 5, i.e. (0000), (0001), (0010),
This circuit generates an output when detecting (001), (0100), and (0101).
OR回路28−1ないし28−4は、それぞれ
デコーダ27−1ないし27−4の出力を検出
し、OR回路29は各OR回路28−1ないし2
8−4の出力を検出して、10進データ例外検出信
号を出力する。 The OR circuits 28-1 to 28-4 detect the outputs of the decoders 27-1 to 27-4, respectively, and the OR circuit 29 detects the outputs of the decoders 27-1 to 27-4, respectively.
Detects the output of 8-4 and outputs a decimal data exception detection signal.
なお本実施例回路は10進4桁の場合について示
されているが、本発明は、任意の10進n桁の加減
回路に適用することができる。また並列演算方式
の代わりに、直列演算方式をとる回路にも同様に
適用できることは明らかである。 Although the circuit of this embodiment is shown for the case of four decimal digits, the present invention can be applied to any n-digit decimal adding/subtracting circuit. It is also obvious that the present invention can be similarly applied to a circuit that uses a serial calculation method instead of a parallel calculation method.
本発明によれば、10進加減算回路の本体部分の
ハード量を増加させずに、しかも全体の性能を損
なうことなしに10進データ例外検出回路のハード
量を削減することができ、回路の小型化と低価格
化を図ることができる。
According to the present invention, it is possible to reduce the amount of hardware in the decimal data exception detection circuit without increasing the amount of hardware in the main body of the decimal addition/subtraction circuit, and without degrading the overall performance. This makes it possible to reduce costs and reduce costs.
第1図は本発明の原理的構成図、第2図は本発
明の1実施例回路の構成図、第3図は従来例回路
の構成図である。
第1図において、11:+6加算器、12:補
数化回路、13:セレクタ、14:主加算器、1
5:10進補正回路、16:10進データ例外検出回
路。
FIG. 1 is a schematic diagram of the principle of the present invention, FIG. 2 is a diagram of a circuit according to an embodiment of the present invention, and FIG. 3 is a diagram of a conventional circuit. In FIG. 1, 11: +6 adder, 12: complement circuit, 13: selector, 14: main adder, 1
5: Decimal correction circuit, 16: Decimal data exception detection circuit.
Claims (1)
タに対して6を加算する+6加算器11と、前記
入力データの1の補数をとる補数化回路12とを
並列にかつ選択可能に設け、 さらに前記+6加算器11と補数化回路12の
選択されたものの出力データを入力として、0な
いし5の値を10進データ例外と判定する10進デー
タ例外検出回路16を設け、 10進加算時には+6加算器11の出力データに
ついて10進データ例外を検出し、そして10進減算
時には補数化回路12の出力データについて10進
データ例外を検出することを特徴とする10進加減
算回路における10進データ例外検出方式。[Scope of Claims] 1. In the decimal addition/subtraction circuit, one input section of the main adder 14 includes a +6 adder 11 that adds 6 to its input data, and a complement that takes the 1's complement of the input data. A decimal converter circuit 12 is provided in parallel and selectably, and further receives the output data of the selected one of the +6 adder 11 and the complement converter circuit 12 as input, and determines a value between 0 and 5 as a decimal data exception. A data exception detection circuit 16 is provided to detect a decimal data exception in the output data of the +6 adder 11 during decimal addition, and to detect a decimal data exception in the output data of the complement circuit 12 during decimal subtraction. Features a decimal data exception detection method in decimal addition/subtraction circuits.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP60173050A JPS6232533A (en) | 1985-08-06 | 1985-08-06 | Decimal data exception detecting system in decimal adding/subtracting circuit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP60173050A JPS6232533A (en) | 1985-08-06 | 1985-08-06 | Decimal data exception detecting system in decimal adding/subtracting circuit |
Publications (2)
Publication Number | Publication Date |
---|---|
JPS6232533A JPS6232533A (en) | 1987-02-12 |
JPH0377538B2 true JPH0377538B2 (en) | 1991-12-10 |
Family
ID=15953284
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP60173050A Granted JPS6232533A (en) | 1985-08-06 | 1985-08-06 | Decimal data exception detecting system in decimal adding/subtracting circuit |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS6232533A (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2619964B2 (en) * | 1990-03-08 | 1997-06-11 | 富士通株式会社 | Two-input arithmetic operation method for addition or subtraction and decimal addition / subtraction circuit |
-
1985
- 1985-08-06 JP JP60173050A patent/JPS6232533A/en active Granted
Also Published As
Publication number | Publication date |
---|---|
JPS6232533A (en) | 1987-02-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4110831A (en) | Method and means for tracking digit significance in arithmetic operations executed on decimal computers | |
US5504697A (en) | Limiter circuit producing data by use of comparison in effective digit number of data | |
JP2608165B2 (en) | Method and apparatus for multiplying a real-time two's complement code in a digital signal processing system | |
US4623872A (en) | Circuit for CSD-coding of a binary number represented in two's complement | |
US4924421A (en) | Priority encoding system | |
JPH0377538B2 (en) | ||
KR19980082906A (en) | How to Convert Floating-Point Numbers to Integer Types | |
JPH04256016A (en) | Method and apparatus for correcting multiplier for complement of 2 so that multiplication of non-signed number is performed | |
JPH07118654B2 (en) | Arithmetic unit | |
JP3071607B2 (en) | Multiplication circuit | |
JP2991788B2 (en) | Decoder | |
JPH087670B2 (en) | Adder circuit | |
JP2569976B2 (en) | Digital filter | |
JPH0216632A (en) | Fixed point number/floating point number converting circuit | |
JP2890412B2 (en) | Code conversion circuit | |
JP3206863B2 (en) | Code conversion method and code converter | |
JP2599984B2 (en) | Input data peak value detection circuit | |
JPH05257643A (en) | Binary complement unit | |
SU676986A1 (en) | Digital function generator | |
JPS6132436Y2 (en) | ||
SU408307A1 (en) | DEVICE FOR THE COMPOSITION OF BINARY-DECIMAL | |
SU607216A1 (en) | Arrangement for subtracting decimal numbers | |
JPH07152537A (en) | Decimal adder and adder/subtractor | |
JPS59168543A (en) | Binary-decimal converting circuit | |
JPH0511978A (en) | Subtraction circuit |