JPH0773015A - Fixed-point data adder - Google Patents

Fixed-point data adder

Info

Publication number
JPH0773015A
JPH0773015A JP5217173A JP21717393A JPH0773015A JP H0773015 A JPH0773015 A JP H0773015A JP 5217173 A JP5217173 A JP 5217173A JP 21717393 A JP21717393 A JP 21717393A JP H0773015 A JPH0773015 A JP H0773015A
Authority
JP
Japan
Prior art keywords
circuit
fixed
overflow
point data
operand
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
JP5217173A
Other languages
Japanese (ja)
Inventor
Yaeko Endou
弥恵子 遠藤
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 JP5217173A priority Critical patent/JPH0773015A/en
Publication of JPH0773015A publication Critical patent/JPH0773015A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce the amount of hardware by detecting the case, where a overflow is brought about, from the combination of the number of negatives of operands, the final carries, and the value of the sign part. CONSTITUTION:An addition circuit 1 which adds three fixed-point data A to C expressed by complements of two, an operand negative detecting circuit 2 which detects the number of negatives of operands of data A to C, a final carry generating circuit 3 which generates final carries C0 and C1 from the addition result of data A to C, and an overflow detecting circuit 4 which is connected to circuits 1 to 3 and detects fixed-point overflow from the combination of the number of negatives of operands detected by the circuit 2, carries C0 and C1 generated by the circuit 3, and a sign S of the addition result from the circuit 1 are provided. The case where a overflow is brought about is detected from the combination of the number of negatives of operands, final carries, and the value of the sign part. Thus, overflow is detected with a smaller amount of hardware than conventional at the time of addition of fixed-point data.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、2の補数で表現された
3個以上の固定小数点データを加算するための加算回路
に関し、特に固定小数点のオーバーフローを検出できる
固定小数点データ加算装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an adder circuit for adding three or more fixed point data represented by 2's complement, and more particularly to a fixed point data adder capable of detecting fixed point overflow.

【0002】[0002]

【従来の技術】2の補数で表現された3個以上の固定小
数点データを加算するための加算回路のうち、特に固定
小数点のオーバーフローを検出できる従来の固定小数点
データ加算装置は、加算器内でオペランドの符号を上位
の方に拡張して演算を行い、その結果の符号ビットと拡
張したビットとが不一致の場合にオーバーフローを検出
している。
2. Description of the Related Art Among the adder circuits for adding three or more fixed-point data represented by two's complement, a conventional fixed-point data adder capable of detecting a fixed-point overflow is provided in an adder. An operation is performed by expanding the sign of the operand to the higher order, and overflow is detected when the sign bit of the result and the expanded bit do not match.

【0003】[0003]

【発明が解決しようとする課題】上述したように、従来
の固定小数点データ加算装置は、符号付き固定小数点演
算オーバーフローを検出するため、加算器内でオペラン
ドの符号を上位の方に拡張しなければならないため、ハ
ードウエアの量が多くなるという欠点を有している。
As described above, the conventional fixed-point data adder detects the signed fixed-point arithmetic overflow, so that the sign of the operand must be extended to the higher order in the adder. However, it has a drawback that the amount of hardware increases.

【0004】[0004]

【課題を解決するための手段】本発明の固定小数点デー
タ加算装置は、2の補数で表現された3個以上の固定小
数点データを加算する加算回路と、前記3個以上の固定
小数点データのオペランドの負の数を検出するオペラン
ド負数検出回路と、前記加算回路からの情報によって2
個の最終キャリーを生成する最終キャリー生成回路と、
前記オペランド負数検出回路からのオペランドの負の数
と前記最終キャリー生成回路からの2個の最終キャリー
および前記加算回路からの符号部の組合わせとによって
固定小数点のオーバーフローを検出するオーバーフロー
検出回路とを備えている。
A fixed-point data adder according to the present invention includes an adder circuit for adding three or more fixed-point data represented by a two's complement, and an operand of the three or more fixed-point data. Operand negative number detection circuit for detecting the negative number of
A final carry generation circuit for generating the final carry of
An overflow detection circuit for detecting a fixed-point overflow by a combination of the negative number of the operand from the operand negative number detection circuit, the two final carries from the final carry generation circuit, and the sign part from the addition circuit. I have it.

【0005】[0005]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。
Embodiments of the present invention will now be described with reference to the drawings.

【0006】図1は本発明の一実施例を示すブロック図
である。
FIG. 1 is a block diagram showing an embodiment of the present invention.

【0007】図1の実施例は、2の補数で表現された3
個の固定小数点データAおよびBおよびCを加算する加
算回路1と、固定小数点データAおよびBおよびCのオ
ペランドの負の数を検出するオペランド負数検出回路2
と、加算回路1に接続され、固定小数点データAおよび
BおよびCの加算結果から最終キャリィC0 およびC1
を生成する最終キャリィ生成回路3と、加算回路1およ
び最終キャリィ生成回路3およびオペランド負数検出回
路2に接続され、オペランド負数検出回路2で検出され
たオペランドの負の数と、最終キャリィ生成回路3で生
成された最終キャリィC0 およびC1 と、加算回路1の
加算結果の符号Sとの組合わせから、固定小数点のオー
バーフローを検出するオーバーフロー検出回路4とを備
えている。
The embodiment of FIG. 1 has a 3's representation in 2's complement.
Adder circuit 1 for adding fixed-point data A, B, and C, and operand negative-number detection circuit 2 for detecting a negative number of operands of fixed-point data A, B, and C
Is connected to the adder circuit 1 and the final carry C 0 and C 1 is obtained from the addition result of the fixed point data A, B and C.
And a final carry generating circuit 3 connected to the adder circuit 1 and the final carry generating circuit 3 and the operand negative number detecting circuit 2 for detecting the negative number of the operand detected by the operand negative number detecting circuit 2. An overflow detection circuit 4 is provided for detecting a fixed-point overflow from the combination of the final carry C 0 and C 1 generated in 1. and the sign S of the addition result of the addition circuit 1.

【0008】次に、上述のように構成した固定小数点デ
ータ加算装置の動作について説明する。
Next, the operation of the fixed-point data addition device configured as described above will be described.

【0009】2の補数で表現された3個の固定小数点デ
ータを加算したときにオーバーフローを発生する場合に
ついて、具体例によって考察する。具体例は、4ビット
形式の固定小数点データを取扱うものとし、ビット0は
符号部とする。
A case where overflow occurs when three pieces of fixed-point data represented by 2's complements are added will be considered with a specific example. In the specific example, it is assumed that fixed-point data in 4-bit format is handled, and bit 0 is a code part.

【0010】取扱うデータをXとすると、データXの表
現範囲は、 −8≦X≦7 ………式(1) である。
When the data to be handled is X, the expression range of the data X is -8≤X≤7 (Equation 1).

【0011】オペランドの負の数が0個の場合は、入力
オペランドをAおよびBおよびCとし、AおよびBおよ
びCを正の数とすると、AおよびBおよびCのとる範囲
は、0≦A≦7,0≦B≦7,0≦C≦7である。これ
らを加算回路1において加算した結果は、0≦A+B+
C≦21の範囲内となる。
When the number of negative operands is 0, and the input operands are A and B and C, and A, B and C are positive numbers, the range of A, B and C is 0≤A. ≦ 7,0 ≦ B ≦ 7, 0 ≦ C ≦ 7. The result of adding these in the adder circuit 1 is 0 ≦ A + B +
It is within the range of C ≦ 21.

【0012】しかし、式(1)によってデータの表現範
囲が制限されているため、 8≦A+B+C≦21 ………式(2) の範囲は表現することができず、オーバーフローとな
る。
However, since the expression range of the data is limited by the expression (1), the range of 8 ≦ A + B + C ≦ 21 ... Expression (2) cannot be expressed, resulting in overflow.

【0013】例えば、A=7,B=7,C=7のときの
加算結果Fは、次のようになる。
For example, the addition result F when A = 7, B = 7 and C = 7 is as follows.

【0014】 [0014]

【0015】式(2)を2の補数で表わすと、次のよう
になる。
The expression (2) can be represented by the two's complement as follows.

【0016】 [0016]

【0017】これから、上位の3ビットが“010”お
よび“001”のとき、オーバーフローであると判断で
きる。すなわち、上位の3ビットを上から順に C0
1,S (C0 およびC1 を最終キャリーと呼び、S
を符号部と呼ぶ)とすると、オペランドの負の数が0個
の場合は、 (C0 ,C1 ,S)=(0,1,0)および(0,0,
1) のとき、オーバーフローとなる。
From this, when the upper 3 bits are "010" and "001", it can be determined that the overflow has occurred. That is, the upper 3 bits are C 0 ,
C 1 , S (C 0 and C 1 are called final carry, and S 1
Is called the sign part), and when the number of negative operands is 0, (C 0 , C 1 , S) = ( 0 , 1 , 0) and (0, 0,
In case of 1), overflow occurs.

【0018】オペランドの負の数が1個の場合は、入力
オペランドをAおよびBおよびCとし、Aを負の数と
し、BおよびCを正の数とすると、AおよびBおよびC
のとる範囲は、 −8≦A≦−1,0≦B≦7,0≦C
≦7である。これらを加算回路1において加算した結果
は、 −8≦A+B+C≦13 の範囲内となる。
If the operand has one negative number, then A and B and C are the input operands, A is a negative number and B and C are positive numbers.
The range of is −8 ≦ A ≦ −1, 0 ≦ B ≦ 7, 0 ≦ C
≦ 7. The result of adding these in the adder circuit 1 is within the range of −8 ≦ A + B + C ≦ 13.

【0019】しかし、式(1)によってデータの表現範
囲が制限されているため、 8≦A+B+C≦13 ………式(3) の範囲は表現することができず、オーバーフローとな
る。
However, since the expression range of data is limited by the expression (1), the range of 8 ≦ A + B + C ≦ 13 ... Expression (3) cannot be expressed and overflows.

【0020】例えば、A=−1,B=7,C=7のとき
の加算結果Fは、次のようになる。
For example, the addition result F when A = -1, B = 7, C = 7 is as follows.

【0021】 [0021]

【0022】また、A=−6,B=7,C=7のときの
加算結果Fは、次のようになる。
The addition result F when A = −6, B = 7, C = 7 is as follows.

【0023】 [0023]

【0024】式(3)を2の補数で表わすと、次のよう
になる。
The expression (3) can be represented by the two's complement as follows.

【0025】 [0025]

【0026】これらから、オペランドの負の数が1個の
場合にオーバーフローとなるのは、(011000)2
〜(011101)2 の範囲であることがわかる。
From these, when the number of negative operands is 1, the overflow is (011000) 2
It can be seen that the range is from (011101) 2 .

【0027】すなわち、オペランドの負の数が1個の場
合は、 (C0 ,C1 ,S)=(0,1,1) のとき、オーバーフローとなる。
That is, when the number of negative operands is 1, an overflow occurs when (C 0 , C 1 , S) = ( 0 , 1 , 1 ).

【0028】同様に、オペランドの負の数が2個の場
合、およびオペランドの負の数が3個の場合の(C0
1 ,S)の組合わせを求めることができる。
Similarly, when the number of negative operands is 2, and when the number of negative operands is 3, (C 0 ,
The combination of C 1 , S) can be determined.

【0029】表1は、このようにして求めたオーバーフ
ローとなる場合のオペランドの負の数と(C0 ,C1
S)の組合わせを示したものである。
Table 1 shows the negative numbers of the operands (C 0 , C 1 ,
The combination of S) is shown.

【0030】[0030]

【表1】 [Table 1]

【0031】以上の結果から、オペランドの負の数と最
終キャリーおよび符号部の値との組合わせから、オーバ
ーフローとなる場合の検出が可能である。
From the above results, it is possible to detect the case of overflow from the combination of the negative number of the operand and the final carry and the value of the sign part.

【0032】次に、本実施例の動作について説明する。Next, the operation of this embodiment will be described.

【0033】2の補数で表現された3個の固定小数点デ
ータAおよびBおよびCを加算回路1に入力して加算を
行い、その結果を最終キャリィ生成回路3に出力する。
最終キャリィ生成回路3は、加算回路1からの情報から
最終キャリーC0 およびC1を生成してオーバーフロー
検出回路4に出力する。一方、オペランド負数検出回路
2は、3個の固定小数点データAおよびBおよびCの符
号ビットを入力し、それらからオペランドの負の数を検
出してオーバーフロー検出回路4に出力する。オーバー
フロー検出回路4は、最終キャリィ生成回路3からの最
終キャリーC0およびC1 と、オペランド負数検出回路
2からのオペランドの負の数と、加算回路1の演算結果
の符号部Sとを入力し、表1の組合わせを参照してオー
バーフローを検出する。
The three fixed-point data A, B, and C expressed in 2's complement are input to the adder circuit 1 to perform addition, and the result is output to the final carry generation circuit 3.
The final carry generation circuit 3 generates final carries C 0 and C 1 from the information from the adder circuit 1 and outputs them to the overflow detection circuit 4. On the other hand, the operand negative number detection circuit 2 inputs the sign bits of the three pieces of fixed point data A, B and C, detects the negative number of the operand from them, and outputs them to the overflow detection circuit 4. The overflow detection circuit 4 inputs the final carry C 0 and C 1 from the final carry generation circuit 3, the negative number of the operand from the operand negative number detection circuit 2, and the sign part S of the operation result of the adder circuit 1. , The overflow is detected by referring to the combinations in Table 1.

【0034】上述の動作を具体例で説明する。The above operation will be described with a specific example.

【0035】2の補数で表現された3個の4ビット固定
小数点データAおよびBおよびCをそれぞれ A=7,
B=7,C=7 とすると、これらの加算回路1におけ
る加算結果は、(0101)2 となる。 A+B+C
=21>7 であるため、オーバーフローとなる。この
とき加算回路1は、符号部S=0 をオーバーフロー検
出回路4に出力する。加算回路1はまた、最終キャリィ
を生成するために必要な情報を最終キャリィ生成回路3
に出力し、最終キャリィ生成回路3は、最終キャリーC
0 =0およびC1 =1を生成する。オペランド負数検出
回路2は、オペランドAおよびBおよびCの符号ビット
0 =0およびb0 =0およびc0 =0を入力し、それ
らから オペランドの負の数=0 を検出する。オーバ
ーフロー検出回路4は、オペランド負数検出回路2で検
出された オペランドの負の数=0 と、最終キャリィ
生成回路3で生成された 最終キャリーC0 =0および
1 =1 と、加算回路1から出力された 符号部S=
0 とから、表1の組合わせを参照してオーバーフロー
を検出する。
Three 4-bit fixed point data A, B and C represented by 2's complement are respectively A = 7,
When B = 7 and C = 7, the addition result of these addition circuits 1 is (0101) 2 . A + B + C
Since = 21> 7, overflow occurs. At this time, the adder circuit 1 outputs the code part S = 0 to the overflow detection circuit 4. The adder circuit 1 also provides the information necessary to generate the final carry with the final carry generation circuit 3.
To the final carry C.
Generate 0 = 0 and C 1 = 1. The operand negative number detection circuit 2 inputs the sign bits a 0 = 0 and b 0 = 0 and c 0 = 0 of the operands A, B and C, and detects the negative number = 0 of the operand from them. The overflow detection circuit 4 receives the negative number of the operand = 0 detected by the operand negative number detection circuit 2, the final carry C 0 = 0 and C 1 = 1 generated by the final carry generation circuit 3, and the addition circuit 1. Output code part S =
From 0, the overflow is detected by referring to the combination of Table 1.

【0036】上述の実施例は、入力する固定小数点デー
タのデータ幅が4ビットの場合であるが、本発明は、デ
ータ幅がが更に大きく、8ビットまたは16ビットまた
は64ビットの場合にも適用できる。
In the above embodiment, the data width of the input fixed-point data is 4 bits, but the present invention is also applied to the case where the data width is larger, that is, 8 bits, 16 bits or 64 bits. it can.

【0037】[0037]

【発明の効果】以上説明したように、本発明の固定小数
点データ加算装置は、オペランドの負の数と最終キャリ
ーおよび符号部の値との組合わせからオーバーフローと
なる場合を検出することにより、従来よりも少ないの量
のハードウエアで固定小数点データを加算した場合のオ
ーバーフローを検出することが可能になるという効果が
あり、従ってハードウエア量を削減することができると
いう効果がある。
As described above, the fixed-point data adding device of the present invention detects the overflow from the combination of the negative number of the operand and the final carry and the value of the sign part, and thus the conventional method is used. There is an effect that it is possible to detect an overflow when the fixed-point data is added with a smaller amount of hardware, and therefore it is possible to reduce the amount of hardware.

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

【図1】本発明の一実施例を示すブロック図である。FIG. 1 is a block diagram showing an embodiment of the present invention.

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

1 加算回路 2 オペランド負数検出回路 3 最終キャリィ生成回路 4 オーバーフロー検出回路 1 adder circuit 2 operand negative number detection circuit 3 final carry generation circuit 4 overflow detection circuit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 2の補数で表現された3個以上の固定小
数点データを加算する加算回路と、前記3個以上の固定
小数点データのオペランドの負の数を検出するオペラン
ド負数検出回路と、前記加算回路に接続されて最終キャ
リーを生成する最終キャリー生成回路と、前記加算回路
および前記最終キャリィ生成回路および前記オペランド
負数検出回路に接続されて固定小数点のオーバーフロー
を検出するオーバーフロー検出回路とを備えることを特
徴とする固定小数点データ加算装置。
1. An adder circuit for adding three or more fixed-point data represented by a two's complement, an operand negative number detection circuit for detecting a negative number of operands of the three or more fixed-point data, and A final carry generation circuit connected to the addition circuit to generate a final carry; and an overflow detection circuit connected to the addition circuit, the final carry generation circuit and the operand negative number detection circuit to detect a fixed point overflow. Fixed-point data addition device.
【請求項2】 2の補数で表現された3個以上の固定小
数点データを加算する加算回路と、前記3個以上の固定
小数点データのオペランドの負の数を検出するオペラン
ド負数検出回路と、前記加算回路からの情報によって2
個の最終キャリーを生成する最終キャリー生成回路と、
前記オペランド負数検出回路からのオペランドの負の数
と前記最終キャリー生成回路からの2個の最終キャリー
および前記加算回路からの符号部の組合わせとによって
固定小数点のオーバーフローを検出するオーバーフロー
検出回路とを備えることを特徴とする固定小数点データ
加算装置。
2. An adder circuit for adding three or more fixed-point data represented by a two's complement, an operand negative number detection circuit for detecting a negative number of operands of the three or more fixed-point data, and 2 according to the information from the adder circuit
A final carry generation circuit for generating the final carry of
An overflow detection circuit for detecting a fixed-point overflow by a combination of the negative number of the operand from the operand negative number detection circuit, the two final carries from the final carry generation circuit, and the sign part from the addition circuit. A fixed-point data addition device, comprising:
JP5217173A 1993-09-01 1993-09-01 Fixed-point data adder Pending JPH0773015A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5217173A JPH0773015A (en) 1993-09-01 1993-09-01 Fixed-point data adder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5217173A JPH0773015A (en) 1993-09-01 1993-09-01 Fixed-point data adder

Publications (1)

Publication Number Publication Date
JPH0773015A true JPH0773015A (en) 1995-03-17

Family

ID=16700008

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5217173A Pending JPH0773015A (en) 1993-09-01 1993-09-01 Fixed-point data adder

Country Status (1)

Country Link
JP (1) JPH0773015A (en)

Similar Documents

Publication Publication Date Title
US5367477A (en) Method and apparatus for performing parallel zero detection in a data processing system
US7428567B2 (en) Arithmetic unit for addition or subtraction with preliminary saturation detection
US6480873B1 (en) Power operation device
JP3345894B2 (en) Floating point multiplier
JP2001222410A (en) Divider
JPH02294731A (en) Floating point arithmetic processor
US7080112B2 (en) Method and apparatus for computing an approximation to the reciprocal of a floating point number in IEEE format
US5920493A (en) Apparatus and method to determine a most significant bit
JPH0773015A (en) Fixed-point data adder
JP3137131B2 (en) Floating point multiplier and multiplication method
JP2901463B2 (en) Addition device
JPH113210A (en) Three-input comparator, saturation operation device using the same, and operation method thereof
JPH09330210A5 (en)
US20060277246A1 (en) Multiplication circuitry
JPH05119969A (en) Product sum computing element
JP3122622B2 (en) Division device
JPH04328630A (en) Floating point multiplication/division device
JPH0414173A (en) Fixed point product sum computing element
JPH05100826A (en) Reciprocal arithmetic unit
JP2001092639A (en) Division and square root arithmetic unit
JPH0285922A (en) Arithmetic circuit
JPS60230266A (en) arithmetic device
JPS6359170B2 (en)
JPH04246722A (en) Adder/subtracter
JPH11312076A (en) Decimal arithmetic unit

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20000718