JPS6150334B2 - - Google Patents

Info

Publication number
JPS6150334B2
JPS6150334B2 JP20298481A JP20298481A JPS6150334B2 JP S6150334 B2 JPS6150334 B2 JP S6150334B2 JP 20298481 A JP20298481 A JP 20298481A JP 20298481 A JP20298481 A JP 20298481A JP S6150334 B2 JPS6150334 B2 JP S6150334B2
Authority
JP
Japan
Prior art keywords
bit
addition
data
bits
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.)
Expired
Application number
JP20298481A
Other languages
Japanese (ja)
Other versions
JPS58105349A (en
Inventor
Yasuhiro Kuroda
Toshiro Nakazuru
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP20298481A priority Critical patent/JPS58105349A/en
Publication of JPS58105349A publication Critical patent/JPS58105349A/en
Publication of JPS6150334B2 publication Critical patent/JPS6150334B2/ja
Granted 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
    • G06F7/50Adding; Subtracting
    • G06F7/505Adding; Subtracting in bit-parallel fashion, i.e. having a different digit-handling circuit for each denomination

Description

【発明の詳細な説明】[Detailed description of the invention]

本発明は、データ系列の累加を行なうが出力デ
ータ幅に制限があるなどの場合に好適な信号処理
由加減算回路に関する。 時系列データの平均的な傾向を知りたい場合、
逐次入力するデータを単純に加算してゆくという
方法をとることがある。時系列データが正,負に
変るものであると、加算してもその和はある範囲
内に収まり、該和が時系列データの平均的な変動
傾向を示すことになる。ところで加減算回路では
扱えるデータの幅に制限があるので普通であり、
そして前記和が一定範囲内にあるとして該データ
幅を越える場合は、スケーリングなどをして出力
データ幅を所定幅に圧縮する必要がある。これは
符号付きnビツト入力A,Bの和S(これはn+
1ビツトになり得る)を1ビツト右シフトするこ
とにより最下位ビツトを捨るというものである。
この結果は(A+B)/2または(A−B)/2
になるがデータ幅はnビツトに戻る。(A+
B)/2つまり平均化されるので、次のデータ
C,D,……は単純にこれに加えずにやはり(C
+D)/2を求め、それを(A+B)/2に加え
るという方法をとる。 ところでかゝる加減算を普通の符号付きnビツ
トの加減算、その後の1ビツト右シフトという単
純な方法で実行すると、加減算で桁あふれが生じ
た場合に正しい結果が得られない。例えば符号付
き2値データA=1110は10進の−2、B=0111は
10進の7であるが、これらを加算すると結果Sは
S=10101、1ビツト右シフトで1010となり、こ
れは10進の−6であつて正しい結果5にはならな
い。 そこで次のように入力nビツトを(n+1)ビ
ツトに拡張してから加算し、結果を1ビツト右シ
フトするという方法がとることが必要になる。
The present invention relates to an addition/subtraction circuit for signal processing that is suitable for cases in which data series are accumulated but there is a limit to the output data width. If you want to know the average trend of time series data,
Sometimes a method is used in which data that is input sequentially is simply added. If the time series data changes between positive and negative, the sum will fall within a certain range even when added, and the sum will indicate the average fluctuation tendency of the time series data. By the way, it is normal for addition and subtraction circuits to have a limit on the width of data that they can handle.
If the sum is within a certain range and exceeds the data width, it is necessary to compress the output data width to a predetermined width by scaling or the like. This is the sum S of signed n-bit inputs A and B (this is n+
(which can be 1 bit) is shifted to the right by 1 bit, thereby discarding the least significant bit.
This result is (A+B)/2 or (A-B)/2
However, the data width returns to n bits. (A+
B)/2, that is, it is averaged, so the next data C, D, ... are not simply added to this, but are also (C
+D)/2 and add it to (A+B)/2. However, if such addition and subtraction are performed simply by adding and subtracting ordinary signed n bits, followed by a 1-bit shift to the right, correct results will not be obtained if an overflow occurs in the addition or subtraction. For example, signed binary data A = 1110 is -2 in decimal, B = 0111 is
This is 7 in decimal, but when these are added, the result S is S=10101, and with a 1-bit right shift, it becomes 1010, which is -6 in decimal and does not give the correct result 5. Therefore, it is necessary to expand the input n bits to (n+1) bits, add them, and shift the result to the right by 1 bit as shown below.

【表】 こゝでA0,B0は符号ビツトでかつ拡張された
ビツト、A1〜Ao、B1〜BoはA,Bの各デジツ
ト、S0およびS1〜Soは和Sの符号ビツトおよび
デジツトで、最下位のデジツトSoはスケーリン
グにより排棄される。上記の例で言えばA=1110
を11110、B=0111を00111に変形して和S=
00101を求め、1ビツト右シフトで0010とする。
これは10進の2であり、正しい答5のほゞ1/2と
なる。 しかしこの方式では加数、被加数とも1ビツト
増加する必要があり、ハードウエアが増加する。
本発明はこの点を改善しようとするもので、特徴
とする所は符号付きnビツト入力データA,Bの
加減算を行ないかつスケーリングにより同じnビ
ツトの出力データSを生じる信号処理用加減算回
路において、入力データA,Bの符号ビツトを反
転する手段と、符号ビツトが反転されたnビツト
入力データA,Bの加算を行なう回路と、加算結
果からその符号ビツトを反転して上位nビツトを
取出す回路とを備えることにある。 本発明では符号付きnビツト入力データA,B
の符号ビツトを反転して加算する。即ち
[Table] Here, A 0 and B 0 are sign bits and extended bits, A 1 to A o and B 1 to B o are each digit of A and B, and S 0 and S 1 to S o are the sum. Of the sign bits and digits of S, the least significant digit S o is discarded by scaling. In the above example, A=1110
is 11110, B=0111 is transformed to 00111, and the sum S=
Find 00101 and shift it to the right by 1 bit to make it 0010.
This is decimal 2, which is approximately 1/2 of the correct answer of 5. However, in this method, it is necessary to increase both the addend and the summand by 1 bit, which increases the amount of hardware.
The present invention aims to improve this point, and is characterized by a signal processing addition/subtraction circuit that performs addition and subtraction of signed n-bit input data A and B and generates the same n-bit output data S by scaling. A circuit for inverting the sign bits of input data A and B, a circuit for adding the n-bit input data A and B with the sign bits inverted, and a circuit for inverting the sign bits and extracting the upper n bits from the addition result. The goal is to prepare for In the present invention, signed n-bit input data A, B
The sign bit of is inverted and added. That is,

【表】
S S S S………So−1 S
とする。この結果は(1)式と符号ビツトを除いて同
じであるが、符号ビツトが反転している。従
つて更に反転して元に戻す。即ち、数式的には次
の如くする。
[Table] -
S 0 S 1 S 2 S 3 ......S o-1 S o
shall be. This result is the same as equation (1) except for the sign bit, but the sign bit 0 is inverted. Therefore, it is further inverted and returned to its original state. That is, the formula is as follows.

【表】 この(3)式の方式は、入力をオフセツトバイナリ
式に、符号つきのものを符号がないように変換し
た後に加算し、逆変換したものを出力するという
考えから生れたものである。 ハードウエアでこれらを説明すると、第1図は
従来方式、第2図は本発明方式である。いずれも
4ビツト加算器を用いている全加算器の場合も同
様である。これらの図で10は4ビツト加算器、
12,14は加数、被加数を格納される4ビツト
レジスタ、16,18は排他オア回路、20,2
2,24はインバータまたはノツト回路、C′は
4ビツト加算器の下段からのキヤリー入力、Cは
4ビツト加算器の上段へのキヤリー出力である。
第1図では排他オア回路16,18が1ビツト拡
張の機能を果している。具体例で説明すると前記
のA=1110,B=0111なら加算器出力C,S1
S2,S3,S3=10101、EXOR16の出力は1、
EXOR18の出力は0従つて加算出力S0,S1
S2,S3,S4=0010、即ち10進の+5となる。本例
ではA=−2,B=7であるからS=A+B=5
は正しい。取出すのは上位4ビツトS0〜S3であ
る。第2図では符号ビツトA1,B1をインバータ
20,22で反転し、和のキヤリー出力Cを反転
することにより“1”拡張を行ない、(3)式の演算
をしている。第2図のノツト回路20,22はレ
ジスタ12,14がフリツプフロツプ回路群から
なる場合はもその出力を用いることにより省略
できる。第3図にこの例を示す。第1図と比較す
れば明らかなように本発明方式ではハードウエア
の節減が可能である。 減算は2の補数の加算とするので、処理は加算
と同じである。なお符号ビツトが1つまり負の数
の加算は減算であるが、こゝではデータBは正数
としてこれを引く場合を想定している。第4図は
従来例であつて、BのデジツトB1〜B4をインバ
ータ26で反転しかつキヤリー端子C′に“1”
を加えて2の補数としている。つまりこれらのイ
ンバータ26およびキヤリー“1”は−Bを示す
符号付きデータを作成するものである。かゝるデ
ータができたら、あとは第1図と同様である。第
5図は本発明の場合であつて、デジツトA1
B1,Cを反転するが、B1については2の補数化
のための反転と打消し合うのでインバータなしと
とる。これら第4図、第5図の場合も入力レジス
タがフリツプフロツプ群からなる場合その出力
を用いることによりインバータは省略できる。 なお信号処理用加減算回路ではスケーリングの
代りにオーバーフロー処理することもある。これ
は次のようなものである。即ち、nビツトデータ
A,Bの加算結果Sをnビツトとするとオーバフ
ローが起る場合がある。この場合に、正しい加算
結果が正ならば表わせる最大の数、8ビツト出力
なら01111111を出力し、負ならば表わせる最小の
数、本例では10000000を出力する。オーバフロー
の検出は本発明では次のようにすればよい。即ち
(n+1)ビツトの加算結果を得てS0とS1で次の
如く判断する。
[Table] The method of equation (3) was born from the idea of converting the input into an offset binary form, converting signed values to unsigned values, adding them, and outputting the inversely converted result. . To explain these in terms of hardware, FIG. 1 shows the conventional system, and FIG. 2 shows the system of the present invention. The same applies to the full adders, both of which use 4-bit adders. In these figures, 10 is a 4-bit adder,
12 and 14 are addends and 4-bit registers in which the summands are stored; 16 and 18 are exclusive OR circuits; 20 and 2
2 and 24 are inverter or knot circuits, C' is a carry input from the lower stage of the 4-bit adder, and C is a carry output to the upper stage of the 4-bit adder.
In FIG. 1, exclusive OR circuits 16 and 18 perform the function of 1-bit expansion. To explain with a specific example, if the above A=1110 and B=0111, the adder output C, S 1 ,
S 2 , S 3 , S 3 = 10101, EXOR16 output is 1,
The output of EXOR18 is 0, so the addition outputs S 0 , S 1 ,
S 2 , S 3 , S 4 =0010, that is, +5 in decimal. In this example, A=-2 and B=7, so S=A+B=5
is correct. The upper 4 bits S 0 to S 3 are extracted. In FIG. 2, sign bits A 1 and B 1 are inverted by inverters 20 and 22, and the carry output C of the sum is inverted to perform "1" extension, and the calculation of equation (3) is performed. Note circuits 20 and 22 in FIG. 2 can be omitted by using the outputs of the registers 12 and 14 when they are comprised of a group of flip-flop circuits. An example of this is shown in FIG. As is clear from a comparison with FIG. 1, the system of the present invention can save hardware. Since subtraction is 2's complement addition, the process is the same as addition. Note that addition of a sign bit of 1, that is, a negative number, is subtraction, but here it is assumed that data B is a positive number and is subtracted. FIG. 4 shows a conventional example in which the B digits B1 to B4 are inverted by an inverter 26 and "1" is input to the carry terminal C'.
is added to form a two's complement number. In other words, these inverter 26 and carry "1" create signed data indicating -B. Once such data is created, the rest is the same as in Figure 1. FIG. 5 shows the case of the present invention, in which digits A 1 ,
B 1 and C are inverted, but since B 1 cancels out the inversion for two's complement conversion, no inverter is used. In the cases of FIGS. 4 and 5 as well, when the input register is composed of a group of flip-flops, the inverter can be omitted by using the output thereof. Note that the signal processing addition/subtraction circuit may perform overflow processing instead of scaling. This is something like this: That is, if the addition result S of n-bit data A and B is set to n bits, overflow may occur. In this case, if the correct addition result is positive, it outputs the maximum number that can be represented, 01111111 if it is an 8-bit output, and if it is negative, it outputs the minimum number that can be represented, in this example, 10000000. In the present invention, overflow can be detected as follows. That is, the result of addition of (n+1) bits is obtained and the following judgment is made using S0 and S1 .

【表】 S0=S1のときは上記処理を行ない、S0=S1なら
下位nビツトS1〜Soをそのまゝ出力する。 以上説明したように本発明によれば符号付きn
ビツト入力データを加算して同じnビツトデータ
を出力する加減算回路のハードウエアを節減でき
る利点が得られる。
[Table] When S 0 =S 1 , the above processing is performed, and when S 0 =S 1 , the lower n bits S 1 to S o are output as they are. As explained above, according to the present invention, signed n
There is an advantage that the hardware of the adder/subtracter circuit that adds bit input data and outputs the same n-bit data can be saved.

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

第1図および第4図は従来例を示すブロツク
図、第2図、第3図、および第5図は本発明の実
施例を示すブロツク図である。 図面で、12,14は入力データA,Bを格納
するレジスタ、20,22はその符号ビツトを反
転するノツト回路、10は4ビツト加算器、24
は加算結果の符号ビツトを反転するノツト回路で
ある。
1 and 4 are block diagrams showing a conventional example, and FIGS. 2, 3, and 5 are block diagrams showing an embodiment of the present invention. In the drawing, 12 and 14 are registers that store input data A and B, 20 and 22 are not circuits that invert the sign bits, 10 is a 4-bit adder, and 24
is a not circuit that inverts the sign bit of the addition result.

Claims (1)

【特許請求の範囲】 1 符号付きnビツト入力データA,Bの加減算
を行ないかつスケーリングにより同じnビツトの
出力データSを生じる信号処理用加減算回路にお
いて、 入力データA,Bの符号ビツトを反転する手段
と、符号ビツトが反転されたnビツト入力データ
A,Bの加算を行なう回路と、加算結果からその
符号ビツトを反転して上位nビツトを取出す回路
とを備えることを特徴とする信号処理用加減算回
路。
[Claims] 1. In a signal processing addition/subtraction circuit that performs addition and subtraction on signed n-bit input data A and B and generates the same n-bit output data S by scaling, the sign bits of input data A and B are inverted. A signal processing device comprising: a circuit for adding n-bit input data A and B with sign bits inverted; and a circuit for inverting the sign bits and extracting the upper n bits from the addition result. Addition/subtraction circuit.
JP20298481A 1981-12-16 1981-12-16 Signal processing adder and substractor circuit Granted JPS58105349A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP20298481A JPS58105349A (en) 1981-12-16 1981-12-16 Signal processing adder and substractor circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20298481A JPS58105349A (en) 1981-12-16 1981-12-16 Signal processing adder and substractor circuit

Publications (2)

Publication Number Publication Date
JPS58105349A JPS58105349A (en) 1983-06-23
JPS6150334B2 true JPS6150334B2 (en) 1986-11-04

Family

ID=16466400

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20298481A Granted JPS58105349A (en) 1981-12-16 1981-12-16 Signal processing adder and substractor circuit

Country Status (1)

Country Link
JP (1) JPS58105349A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS59151236A (en) * 1983-02-17 1984-08-29 Sanyo Electric Co Ltd Digital adding and subtracting circuit

Also Published As

Publication number Publication date
JPS58105349A (en) 1983-06-23

Similar Documents

Publication Publication Date Title
EP0328063A2 (en) Absolute value calculating circuit having a single adder
JP3735425B2 (en) Absolute value comparison circuit
US4683548A (en) Binary MOS ripple-carry parallel adder/subtracter and adder/subtracter stage suitable therefor
EP0416869B1 (en) Digital adder/accumulator
GB2247330A (en) Absolute value arithmetic circuit
JPS6150334B2 (en)
JPH1091397A (en) Arithmetic circuit
JPH0511980A (en) Overflow detecting method and circuit
JP2002111447A (en) Digital filter
US5781465A (en) Method and apparatus for fast carry generation detection and comparison
Choo et al. A novel conversion scheme from a redundant binary number to two's complement binary number for parallel architectures
US3975624A (en) Two's complement subtracting system
JPH11126157A (en) Method and circuit for multiplication
KR100196520B1 (en) Apparatus for conversion of two's complement numbers
US6148318A (en) Square root extraction circuit and floating-point square root extraction device
JP2569976B2 (en) Digital filter
US5483477A (en) Multiplying circuit and microcomputer including the same
JPS5966790A (en) Operating circuit
JP3261742B2 (en) Redundant binary / binary conversion circuit including rounding processing
KR100239631B1 (en) Digital multiplier
JP3482102B2 (en) Absolute distance calculation circuit
JPH0553768A (en) Divider
JP2870018B2 (en) Product-sum operation circuit
KR0154934B1 (en) Improved circuit for accomplishing the 2's complement
JP2890412B2 (en) Code conversion circuit