JPH0764768A - Absolute value accumulator - Google Patents

Absolute value accumulator

Info

Publication number
JPH0764768A
JPH0764768A JP5235346A JP23534693A JPH0764768A JP H0764768 A JPH0764768 A JP H0764768A JP 5235346 A JP5235346 A JP 5235346A JP 23534693 A JP23534693 A JP 23534693A JP H0764768 A JPH0764768 A JP H0764768A
Authority
JP
Japan
Prior art keywords
adder
value
data
input
cumulative
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
JP5235346A
Other languages
Japanese (ja)
Inventor
Takashi Katsuyama
隆史 勝山
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP5235346A priority Critical patent/JPH0764768A/en
Publication of JPH0764768A publication Critical patent/JPH0764768A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To sufficiently shorten the time required for accumulation as the whole regardless of a large. number of negative values at the time of executing the accumulation of absolute values. CONSTITUTION:When inputted data 1 is a positive value, the accumulation processing is performed once in an adder 14 in the same manner as usual. When inputted data us a negative value, the value obtained by inverting all of bits, the accumulated value, and the carry are subjected to the addition processing once by the adder 14 having the normal constitution. The absolue value of the negative value is obtained by inversion of all of bits and addition of carry '1'. Consequently, the accumulation processing speed is fixed independently of the sign of the inputted value, and the operation is performed at a high speed.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、情報処理装置において
入力データの絶対値を累積加算し、その結果を得るため
の演算に用いられる絶対値累積加算装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an absolute value cumulative addition device used in an arithmetic operation for cumulatively adding absolute values of input data and obtaining a result thereof.

【0002】[0002]

【従来の技術】例えば、画像処理の分野において、画像
中のある1点とその周辺にあるいくつかの点との間の距
離を累積加算するような場合、各点のX、Y座標につい
て、それぞれその差の絶対値を求め、加算器等を用いて
累積加算することが行なわれる。この目的のために、絶
対値累積加算装置が使用される。図2に、従来の絶対値
累積加算装置ブロック図を示す。この装置は、データ1
を直接受け入れるセレクタ2と、データ1の補数を得る
インバータ3及び加算器4と、データ1の符号を判定す
る符号判定部5と、累積加算を行なう加算器6及び累積
値記憶部7から構成される。
2. Description of the Related Art For example, in the field of image processing, when cumulatively adding the distances between a certain point in an image and several points in the vicinity thereof, the X and Y coordinates of each point are The absolute value of each difference is obtained, and cumulative addition is performed using an adder or the like. For this purpose an absolute value cumulative addition device is used. FIG. 2 shows a block diagram of a conventional absolute value cumulative addition device. This device is data 1
, A inverter 2 and an adder 4 for obtaining the complement of data 1, a code determination unit 5 for determining the sign of data 1, an adder 6 for performing cumulative addition, and a cumulative value storage unit 7. It

【0003】一般のコンピュータでは、符号付きの数字
を取り扱うために、数値を2の補数で表現することが行
なわれる。このような数値については、正の数であれば
そのまま、負の数であればこの値を論理反転し、“1”
を加算することによって絶対値が得られる。図2に示し
たセレクタ2は、一方の入力端子に値が正のデータ1を
そのまま受け入れると共に、データ1が負である場合の
ために、インバータ3によってこれを論理反転し、加算
器4で“1”を加算したものを、他方の端子に受け入れ
る構成とされている。
In a general computer, a numerical value is represented by a two's complement in order to handle a number with a sign. For such a numerical value, if it is a positive number, it is unchanged, and if it is a negative number, this value is logically inverted and “1” is set.
The absolute value is obtained by adding. The selector 2 shown in FIG. 2 accepts the data 1 having a positive value at one input terminal as it is, and in the case where the data 1 is negative, the inverter 3 logically inverts it and the adder 4 The addition of 1 "is received in the other terminal.

【0004】セレクタ2の入力のいずれを選択するか
は、符号判定部5の出力による。2の補数で表現された
数値については、例えばその最上位ビットが“0”であ
る場合には正の数、“1”の場合には負の数と判定する
ことができる。符号判定部5は、そのような判定結果を
セレクタ2に入力し、正の数の場合にはデータ1を直接
受け入れて出力し、負の数の場合は加算器4の出力を受
け入れて出力する制御を行なう。
Which of the inputs of the selector 2 is selected depends on the output of the code determination section 5. Regarding the numerical value represented by 2's complement, for example, when the most significant bit is "0", it can be determined as a positive number, and when it is "1", it can be determined as a negative number. The sign determination unit 5 inputs such a determination result to the selector 2, directly accepts and outputs the data 1 in the case of a positive number, and accepts and outputs the output of the adder 4 in the case of a negative number. Take control.

【0005】加算器6はA端子にセレクタ2の出力を受
け入れ、B端子に累積値記憶部7の出力を受け入れる構
成となっている。累積値記憶部7は加算器6の出力を受
け入れて保持するレジスタから構成される。従って、例
えば初期状態では累積値記憶部7の内容は“0”であっ
て、加算器6のA端子に入力する値と、B端子に入力す
る値“0”とが加算されて累積値記憶部7に記憶され
る。その後は、前回に得られた累積値がB端子に入力
し、今回入力する値の絶対値がA端子に入力し、これが
加算器6によって加算されて出力される。こうして、デ
ータ1の絶対値の累積値8がこの回路から出力されるこ
とになる。
The adder 6 receives the output of the selector 2 at the A terminal and receives the output of the cumulative value storage unit 7 at the B terminal. The cumulative value storage unit 7 is composed of a register that receives and holds the output of the adder 6. Therefore, for example, in the initial state, the content of the cumulative value storage unit 7 is “0”, and the value input to the A terminal of the adder 6 and the value “0” input to the B terminal are added to store the cumulative value. It is stored in the unit 7. After that, the accumulated value obtained last time is input to the B terminal, the absolute value of the value input this time is input to the A terminal, and this is added by the adder 6 and output. In this way, the cumulative value 8 of the absolute value of the data 1 is output from this circuit.

【0006】[0006]

【発明が解決しようとする課題】ところで、上記のよう
な従来の絶対値累積加算装置には次のような解決すべき
課題があった。図2に示す装置では、入力するデータ1
が正の数の場合にはデータ1がセレクタ2を通過し、直
ちに加算器6に入力して累積加算処理が実行される。し
かしながら、入力したデータ1が負の数の場合には、一
旦加算器4において絶対値を求めるための演算処理が実
行される。その後、その結果がセレクタ2を通じて加算
器6に入力し、累積値記憶部7の出力と共に累積加算処
理が実行される。
The conventional absolute value cumulative addition device as described above has the following problems to be solved. In the device shown in FIG. 2, the input data 1
When is a positive number, the data 1 passes through the selector 2 and is immediately input to the adder 6 to execute the cumulative addition process. However, when the input data 1 is a negative number, the adder 4 once executes an arithmetic process for obtaining an absolute value. After that, the result is input to the adder 6 through the selector 2, and the cumulative addition processing is executed together with the output of the cumulative value storage unit 7.

【0007】このように、正の数については1台の加算
器6が処理を行ない、負の数については2台の加算器4
と6が順に1回ずつ加算処理を行なうことから、負の数
の加算処理には正の数の加算処理の2倍近い時間がかか
る。従って、入力するデータ1に負の数が多く含まれて
いるような場合、累積加算結果を得るための時間が非常
に長くなるという問題があった。特に、画像処理のよう
な場合、画像中の1点とその周辺にある多数の点との間
の距離を累積加算しようとすると、入力する負の数は正
の数と同等程度になり、しかもデータ量は膨大なため、
演算処理時間はとても無視できない長時間となる。
In this way, one adder 6 processes positive numbers and two adders 4 process negative numbers.
Since 6 and 6 sequentially perform the addition process once, the addition process of a negative number takes nearly twice as long as the addition process of a positive number. Therefore, when the input data 1 includes many negative numbers, there is a problem that the time for obtaining the cumulative addition result becomes very long. Particularly in the case of image processing, when trying to cumulatively add the distances between one point in the image and a large number of points around it, the negative number to be input becomes approximately the same as the positive number, and Since the amount of data is huge,
The calculation processing time is very long and cannot be ignored.

【0008】本発明は以上の点に着目してなされたもの
で、絶対値の累積加算を実行する場合に、負の数が多い
場合でも全体として累積加算にかかる時間を十分に短く
することができる絶対値累積加算装置を提供することを
目的とするものである。
The present invention has been made by paying attention to the above points, and when executing cumulative addition of absolute values, it is possible to sufficiently reduce the time required for cumulative addition as a whole even when there are many negative numbers. It is an object of the present invention to provide an absolute value cumulative addition device that can be used.

【0009】[0009]

【課題を解決するための手段】本発明の絶対値累積加算
装置は、2の補数で表現される任意の整数値から成るデ
ータを順に受け入れて、これらのデータの絶対値を加算
器によって累積加算するものにおいて、入力したデータ
の正負を判定し、入力したデータが負の数の場合に、前
記加算器に値が1のキャリーを供給する符号判定部と、
入力したデータが正の数の場合はそのままそのデータを
前記加算器に送り、負の数の場合はそのデータを構成す
る全てのビットを反転して前記加算器に送る論理反転部
と、前記加算器の出力する加算結果を記憶する累積値記
憶部とを備え、前記加算器は、前記論理反転部と累積記
憶部の出力とキャリーを受け入れて加算して新たな累積
値を得ることを特徴とするものである。
SUMMARY OF THE INVENTION An absolute value cumulative addition device of the present invention sequentially receives data consisting of arbitrary integer values represented by two's complement, and cumulatively adds the absolute values of these data by an adder. A sign determining unit that determines whether the input data is positive or negative, and supplies a carry having a value of 1 to the adder when the input data is a negative number,
When the input data is a positive number, the data is sent to the adder as it is, and when the input data is a negative number, all bits constituting the data are inverted and sent to the adder, and the addition A cumulative value storage unit for storing the addition result output from the adder, wherein the adder receives the outputs of the logical inversion unit and the cumulative storage unit and a carry and adds them to obtain a new cumulative value. To do.

【0010】[0010]

【作用】この装置では、入力するデータが正の数である
場合には従来と同様の動作で累積加算処理を行なう。ま
た、入力するデータ位置が負の数である場合には、通常
の構成の加算器によってその全てのビットを反転した値
と累積値とキャリーとを1回で加算処理してしまう。全
てのビットを反転し、キャリーの“1”を加算すると負
の数の絶対値が得られる。従って、入力する値の正負に
関わらず、その累積加算処理速度は同様になり、高速演
算が可能となる。
In this device, when the input data is a positive number, the cumulative addition process is performed by the same operation as the conventional one. Further, when the input data position is a negative number, the adder having a normal configuration adds the value obtained by inverting all the bits, the accumulated value, and the carry at once. When all bits are inverted and carry "1" is added, a negative absolute value is obtained. Therefore, regardless of whether the input value is positive or negative, the cumulative addition processing speed becomes similar, and high-speed calculation becomes possible.

【0011】[0011]

【実施例】以下、本発明を図の実施例を用いて詳細に説
明する。図1は、本発明の絶対値累積加算装置実施例を
示すブロック図である。この装置は、データ1を受け入
れる論理反転部11と、データ1の符号を判定する符号
判定部12と、この符号判定部12の出力からキャリー
を生成するキャリー生成部13と、累積加算処理を実行
する加算器14及び累積値記憶部15から構成されてい
る。
The present invention will be described in detail below with reference to the embodiments shown in the drawings. FIG. 1 is a block diagram showing an embodiment of an absolute value cumulative addition device of the present invention. This apparatus executes a logical addition unit 11 that receives data 1, a code determination unit 12 that determines the code of the data 1, a carry generation unit 13 that generates a carry from the output of the code determination unit 12, and a cumulative addition process. It includes an adder 14 and a cumulative value storage unit 15.

【0012】本発明の装置においても、この累積加算に
使用されるデータは2の補数で表現される任意の整数値
とする。論理反転部11は、入力するデータ1が正の数
の場合にはこれをそのまま出力し、負の数の場合には全
てのビットを反転して出力する動作を行なう回路であ
る。この論理反転部11は、符号判定部12の出力を受
け入れて、正の数が入力した場合と負の数が入力した場
合との処理を切り換える構成となっている。なお、その
詳細は後で図4を用いて説明する。
Also in the apparatus of the present invention, the data used for this cumulative addition is an arbitrary integer value represented by 2's complement. The logic inverting section 11 is a circuit for performing an operation of outputting the input data 1 as it is when it is a positive number and inverting and outputting all the bits when it is a negative number. The logic inversion unit 11 is configured to receive the output of the sign determination unit 12 and switch the processing when a positive number is input and when a negative number is input. The details will be described later with reference to FIG.

【0013】符号判定部12は、入力したデータの正負
を判定し、例えば入力したデータが正の場合には
“0”、負の場合には“1”というデータを出力する回
路から構成される。この回路構成の具体例等は、後で図
3を用いて説明する。キャリー生成部13は、符号判定
部12の出力を受け入れて、加算器14に対しキャリー
を出力する回路から構成される。これは、例えば符号判
定部12の出力を受け入れて加算器14の動作中、その
値を保持する1ビットのレジスタ等から構成される。
The sign judging section 12 is composed of a circuit for judging whether the input data is positive or negative, and for example outputting "0" when the input data is positive and outputting "1" when the input data is negative. . A specific example of this circuit configuration will be described later with reference to FIG. The carry generation unit 13 is configured by a circuit that receives the output of the code determination unit 12 and outputs a carry to the adder 14. This is composed of, for example, a 1-bit register that receives the output of the sign determination unit 12 and holds the value during the operation of the adder 14.

【0014】加算器14は、従来装置に使用されている
ものと同様の構成で、A端子及びB端子に入力する数値
を加算してY端子に出力する構成のものである。なお、
この加算器14は、キャリーが入力すると、その最下位
ビットに“1”を加える動作を行なう。即ち、キャリー
を下位の加算器の桁上げ信号として受け入れ、実質的に
最下位ビットに“1”を加算する処理を加算処理と同時
に実行する構成となっている。この機能は従来の加算器
に備わったものをそのまま利用する。
The adder 14 has the same structure as that used in the conventional apparatus, and has a structure in which the numerical values input to the A terminal and the B terminal are added and output to the Y terminal. In addition,
When the carry is input, the adder 14 performs an operation of adding "1" to the least significant bit. That is, the carry is accepted as a carry signal of the lower adder, and the process of adding "1" to the least significant bit is executed at the same time as the adding process. This function is the same as that provided in the conventional adder.

【0015】累積値記憶部15は、加算器14の出力を
受け入れて保持するレジスタ等から構成される。上記の
ような構成によって、新たなデータ1が次々とこの回路
に入力すると、累積値8が得られる構成となっている。
なお、加算器14のこのような動作によって、加算器1
4は見かけ上A端子に入力するデータとB端子に入力す
るデータとを加算すると共に、これに“1”を加算する
動作を一挙に行なうという効果が得られる。
The cumulative value storage unit 15 is composed of a register or the like that receives and holds the output of the adder 14. With the above configuration, when new data 1 is successively input to this circuit, the cumulative value 8 is obtained.
It should be noted that by the operation of the adder 14, the adder 1
4 has the effect of apparently adding the data input to the A terminal and the data input to the B terminal and simultaneously adding "1" to the data.

【0016】図3に、本発明の装置の具体例結線図を示
す。本発明の装置の動作を具体的な結線図を用いて更に
詳細に説明する。この実施例では、入力するデータが2
の補数で表現される整数であって、8ビットのデータ幅
を持つものとする。この8ビットで表されるデータは、
「10000000」の「−128」から「11111
111」の「−1」までの負の数と、「0000000
0」から「01111111」の「127」までの整数
を表すことができる。
FIG. 3 shows a wiring diagram of a concrete example of the apparatus of the present invention. The operation of the device of the present invention will be described in more detail with reference to specific wiring diagrams. In this embodiment, the input data is 2
It is an integer represented by the complement of and has a data width of 8 bits. The data represented by these 8 bits is
From "-128" of "10000000" to "11111"
Negative numbers up to "-1" of "111" and "0000000"
An integer from "0" to "127" of "01111111" can be represented.

【0017】このように2の補数で表現されるデータの
場合、その最上位ビットはデータの正負を表す符号とな
る。即ち、最上位ビットが“0”の場合は正、“1”の
場合は負の数を表している。なお、この図ではIN
[7:0]は8ビット全てのデータを示し、IN[7]
というのはデータの最上位ビットを示している。
In the case of data represented by 2's complement as described above, the most significant bit thereof is a code representing the sign of the data. That is, when the most significant bit is "0", it is positive, and when it is "1", it is negative. In this figure, IN
[7: 0] indicates all 8-bit data, and IN [7]
It indicates the most significant bit of the data.

【0018】この実施例では、入力データの全てのビッ
トを受け入れる論理反転回路21と、その出力側の8ビ
ットのデータを受け入れ累積加算処理を行なう加算器1
4と、加算器14の出力する8ビットのデータを受け入
れて保持する累積値保持レジスタ25とが設けられてい
る。論理反転回路21の出力は加算器14のA端子に入
力し、累積値保持レジスタ25の出力は加算器14のB
端子に入力する構成となっている。また、入力するデー
タの最上位ビットIN[7]は、加算器14のキャリー
としてそのまま入力する構成となっている。
In this embodiment, a logical inversion circuit 21 that receives all bits of input data and an adder 1 that receives 8-bit data on the output side and performs cumulative addition processing.
4 and a cumulative value holding register 25 that receives and holds the 8-bit data output from the adder 14. The output of the logic inverting circuit 21 is input to the A terminal of the adder 14, and the output of the cumulative value holding register 25 is B of the adder 14.
It is configured to input to the terminal. Further, the most significant bit IN [7] of the input data is directly input as the carry of the adder 14.

【0019】即ち、この実施例では、入力するデータの
最上位ビットがそのまま論理反転回路21の制御に使用
され、かつ加算器14のキャリーとして使用されるた
め、符号判定やキャリー生成のための回路素子は設けて
いない。即ち、入力データの一部を加算器14に入力す
るためのラインがそのまま符号判定部及びキャリー生成
部として機能することになる。また、論理反転回路21
に符号判定部から入力すべき信号は、論理反転回路21
の内部で分岐される構成となっている。
That is, in this embodiment, since the most significant bit of the input data is used as it is to control the logic inverting circuit 21 and is used as the carry of the adder 14, the circuit for code judgment and carry generation. No element is provided. That is, the line for inputting a part of the input data to the adder 14 directly functions as the code determination unit and the carry generation unit. In addition, the logic inversion circuit 21
The signal to be input from the sign determination unit to the logical inversion circuit 21
It is configured to branch inside.

【0020】図4に、このような論理反転回路の具体的
なブロック図を示す。図に示すように、この回路には8
個のイクスクルーシブオア(排他的論理和)ゲート20
−0〜20−7が設けられている。ここで、入力するデ
ータの各ビットは、それぞればらばらに分離され、下位
7ビットはイクスクルーシブオアゲート20−0〜20
−6にそれぞれ入力し、上位ビットIN[7]は全ての
イクスクルーシブオアゲート20−0〜20−7のもう
一方の入力端子に入力する構成となっている。最上位ビ
ットを受け入れるイクスクルーシブオアゲート20−7
には、最上位ビットIN[7]が両方の入力端子に入力
する構成となっている。
FIG. 4 shows a concrete block diagram of such a logic inverting circuit. As shown, this circuit has 8
20 exclusive or gates 20
-0 to 20-7 are provided. Here, each bit of the input data is separated into pieces, and the lower 7 bits are exclusive OR gates 20-0 to 20-20.
Each of them is input to -6 and the upper bit IN [7] is input to the other input terminals of all the exclusive OR gates 20-0 to 20-7. Exclusive OR gate 20-7 that accepts the most significant bit
Has a configuration in which the most significant bit IN [7] is input to both input terminals.

【0021】以上のようなイクスクルーシブオアゲート
の動作は従来よりよく知られたもので、制御信号として
入力する最上位ビットIN[7]が“0”の場合には、
もう一方の端子に入力する8ビットの信号がそのまま出
力として取り出され、制御信号が“1”の場合には入力
する信号が全て論理反転して出力される。
The operation of the exclusive OR gate as described above is well known in the prior art. When the most significant bit IN [7] input as a control signal is "0",
The 8-bit signal input to the other terminal is taken out as it is, and when the control signal is "1", all the input signals are logically inverted and output.

【0022】一方、加算器14にキャリーが入力する
と、その加算結果の最下位ビットに“1”が加算される
ことは先に説明したとおりである。従って、本発明の装
置では、加算器14の入力データが正の場合にはA端子
に入力した信号とB端子に入力した信号とがそのまま加
算されて累積値となる。一方、入力データが負の数の場
合にはその数値の全てのビットを論理反転し、キャリー
によって最下位ビットに“1”を加算することによって
その絶対値を得ると共に、B端子に入力する累積値との
加算処理が同時に実行される。
On the other hand, when carry is input to the adder 14, "1" is added to the least significant bit of the addition result, as described above. Therefore, in the device of the present invention, when the input data of the adder 14 is positive, the signal input to the A terminal and the signal input to the B terminal are added as they are to obtain a cumulative value. On the other hand, when the input data is a negative number, all bits of that number are logically inverted and the carry value is added to the least significant bit to obtain its absolute value and the accumulated value input to the B terminal. The addition processing with the value is executed at the same time.

【0023】従って、実質的に、図2に示した従来装置
と同様、負の数の場合についてもその絶対値を求めて累
積加算処理が行なわれる。しかも、本発明の装置ではこ
のような処理を1台の加算器14によって同時に実行す
ることから、負の数が入力した場合でも正の数が入力し
た場合と同様の時間で累積加算処理が行なわれる。
Therefore, substantially similarly to the conventional apparatus shown in FIG. 2, even in the case of a negative number, the absolute value thereof is obtained and the cumulative addition process is performed. Moreover, in the apparatus of the present invention, such processing is simultaneously executed by one adder 14, so that even if a negative number is input, cumulative addition processing is performed in the same time as when a positive number is input. Be done.

【0024】図5に、本発明の装置の具体的な動作説明
図を示す。図は、上記の図3に示す回路に時刻T1から
T7の間に次々に入力するデータの累積値加算処理を行
なった結果の出力を示している。この図の横方向には、
入力されたデータと、論理反転回路の出力と、累積値保
持レジスタ25に格納された前回までの累積値と、キャ
リーの内容と、加算器14の出力を示している。なお、
この表には8ビットの2進数字の他に()でくくって1
0進数表現を併せて表示している。
FIG. 5 shows a concrete operation explanatory view of the apparatus of the present invention. The figure shows the output of the result obtained by performing the cumulative value addition processing of the data successively input to the circuit shown in FIG. 3 between times T1 and T7. In the horizontal direction of this figure,
It shows the input data, the output of the logical inversion circuit, the accumulated value up to the previous time stored in the accumulated value holding register 25, the contents of the carry, and the output of the adder 14. In addition,
In this table, in addition to 8-bit binary numbers, enclose in () and
It also displays the expression in decimal notation.

【0025】まず、時刻T1に10進数で値が“1”の
データが入力すると、この値は正の値のため、論理反転
回路21をそのまま通過して加算器14に入力する。こ
の累積処理は初回のため、累積値保持レジスタ25の内
容は“0”である。また、入力データが正なのでキャリ
ーは“0”である。従って、加算器14は入力した値
“1”と累積値“0”とを加算し、“1”という出力を
得る。
First, at time T1, when decimal data with a value of "1" is input, since this value is a positive value, it passes through the logic inverting circuit 21 as it is and is input to the adder 14. Since this cumulative processing is the first time, the content of the cumulative value holding register 25 is "0". Further, since the input data is positive, the carry is "0". Therefore, the adder 14 adds the input value "1" and the accumulated value "0" to obtain an output "1".

【0026】次の時刻T2には、10進数にして−5の
数値のデータが入力する。入力データが負の値のため、
入力されたデータが全て反転され、論理反転回路21か
ら出力される。従って、その値を10進数に直すと
“4”となる。累積値保持レジスタ25に格納された前
回の累積結果は“1”である。また、入力したデータが
負の数であるため、キャリーは“1”となる。加算器1
4にはA端子に“4”、B端子に“1”の値が入力す
る。その結果、加算器14の加算結果は“5”となる
が、キャリーが“1”であって、これが最下位ビットに
加算されるため、結果的に“4”と“1”と“1”を加
算した値“6”が出力として得られる。
At the next time T2, data of a decimal number of -5 is input. Since the input data is a negative value,
All input data is inverted and output from the logic inversion circuit 21. Therefore, if the value is converted into a decimal number, it becomes "4". The previous cumulative result stored in the cumulative value holding register 25 is “1”. Further, since the input data is a negative number, the carry is "1". Adder 1
As for 4, the value of "4" is input to the A terminal and the value of "1" is input to the B terminal. As a result, the addition result of the adder 14 is "5", but since the carry is "1" and this is added to the least significant bit, the result is "4", "1" and "1". The value "6" obtained by adding is obtained as an output.

【0027】これは、丁度入力したデータ“−5”の絶
対値と累積値“1”との加算値に等しくなる。時刻T3
では、10進数にして“−18”という値がデータとし
て入力する。これが負の数であることから、論理反転回
路21で全てのビットが反転され、値が“17”となっ
て加算器14に入力する。前回までの累積値は“6”で
あって、キャリーが“1”として入力するから、加算器
14の出力は“24”となる。以下、時刻T4から時刻
T6まで同様の処理が実行される。そして時刻T7に、
累積値保持レジスタ25から最終的な累積値が得られ、
外部回路に出力される。
This is equal to the sum of the absolute value of the data "-5" just input and the cumulative value "1". Time T3
Then, the value "-18" in decimal is input as data. Since this is a negative number, all the bits are inverted by the logic inverting circuit 21 and the value becomes "17" and is input to the adder 14. The accumulated value up to the previous time is "6", and since carry is input as "1", the output of the adder 14 becomes "24". Thereafter, similar processing is executed from time T4 to time T6. And at time T7,
The final accumulated value is obtained from the accumulated value holding register 25,
Output to external circuit.

【0028】本発明は以上の実施例に限定されない。上
記実施例では、入力されるデータが8ビットの例を示し
たが、そのビット数は任意で構わない。この場合には、
論理反転回路や、加算器、累積値保持レジスタ等の構成
を変更すればよい。また、上記実施例では入力されたデ
ータの符号判定のためにそのデータの最上位ビットを直
接利用するようにしたが、例えばこの回路に入力する前
にデータを処理した他の演算器の出力する符号フラグ等
を利用してもよい。また、よく知られたその他の処理で
データの符号を判定し、論理反転部の動作を制御した
り、加算器にキャリーを入力させるようにすればよい。
The present invention is not limited to the above embodiments. In the above embodiment, the example in which the input data is 8 bits has been shown, but the number of bits may be arbitrary. In this case,
The configurations of the logic inverting circuit, the adder, the cumulative value holding register, and the like may be changed. Further, in the above embodiment, the most significant bit of the input data is directly used to determine the sign of the input data. However, for example, it is output by another arithmetic unit that processes the data before inputting to this circuit. A code flag or the like may be used. Further, the sign of the data may be determined by other well-known processing, the operation of the logic inverting unit may be controlled, or the carry may be input to the adder.

【0029】[0029]

【発明の効果】以上説明した本発明の絶対値累積加算装
置は、2の補数で表現される任意の整数値についてその
絶対値を加算器によって累積加算する場合に、入力した
データの正負を判定して、入力したデータが負の数の場
合に値が“1”のキャリーを供給する符号判定部と、値
が負の場合に全てのビットを反転して加算器に送る論理
判定部と、加算器の出力結果を記憶する累積値記憶部と
を設けるようにし、加算器において論理反転部の出力と
累積値記憶部の出力とを正負判定部から入力されたキャ
リーとを受け入れて加算処理するので、1台の加算器に
より正の数も負の数も一挙に絶対値の累積加算を実行す
ることができる。これにより、この種の演算処理の高速
化を図り、画像処理等の情報処理装置についてその全体
的な演算速度を早めることができる。
As described above, the absolute value cumulative addition device of the present invention determines whether the input data is positive or negative when the absolute value of an arbitrary integer value represented by 2's complement is cumulatively added by the adder. Then, when the input data is a negative number, a sign determination unit that supplies a carry with a value of "1", and a logic determination unit that inverts all bits and sends the result to the adder when the value is negative, A cumulative value storage unit that stores the output result of the adder is provided, and in the adder, the output of the logical inversion unit and the output of the cumulative value storage unit receive the carry input from the positive / negative determination unit and perform addition processing. Therefore, a single adder can perform cumulative addition of absolute values for both positive and negative numbers at once. As a result, it is possible to increase the speed of this kind of arithmetic processing, and to speed up the overall arithmetic speed of the information processing apparatus such as image processing.

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

【図1】本発明の絶対値累積加算装置ブロック図であ
る。
FIG. 1 is a block diagram of an absolute value cumulative addition device of the present invention.

【図2】従来の絶対値累積加算装置ブロック図である。FIG. 2 is a block diagram of a conventional absolute value cumulative addition device.

【図3】本発明の装置の具体例結線図である。FIG. 3 is a connection diagram of a specific example of the device of the present invention.

【図4】論理反転回路結線図である。FIG. 4 is a wiring diagram of a logic inversion circuit.

【図5】本発明の装置の具体的な動作説明図である。FIG. 5 is a specific operation explanatory diagram of the apparatus of the present invention.

【符号の説明】 1 データ 8 累積値 11 論理反転部 12 符号判定部 13 キャリー生成部 14 加算器 15 累積値記憶部[Explanation of Codes] 1 Data 8 Cumulative Value 11 Logical Inversion Unit 12 Sign Judgment Unit 13 Carry Generation Unit 14 Adder 15 Cumulative Value Storage Unit

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 2の補数で表現される任意の整数値から
成るデータを順に受け入れて、これらのデータの絶対値
を加算器によって累積加算するものにおいて、 入力したデータの正負を判定し、入力したデータが負の
数の場合に、前記加算器に値が1のキャリーを供給する
符号判定部と、 入力したデータが正の数の場合はそのままそのデータを
前記加算器に送り、負の数の場合はそのデータを構成す
る全てのビットを反転して前記加算器に送る論理反転部
と、 前記加算器の出力する加算結果を記憶する累積値記憶部
とを備え、 前記加算器は、前記論理反転部と累積記憶部の出力とキ
ャリーを受け入れて加算して新たな累積値を得ることを
特徴とする絶対値累積加算装置。
1. A method of sequentially accepting data consisting of arbitrary integer values represented by two's complement and accumulating the absolute values of these data by an adder, determining whether the input data is positive or negative, and inputting If the input data is a negative number, a sign determination unit that supplies a carry with a value of 1 to the adder, and if the input data is a positive number, the data is sent to the adder as it is, and a negative number In the case of, a logical inversion unit that inverts all the bits that make up the data and sends it to the adder, and a cumulative value storage unit that stores the addition result output by the adder, the adder, An absolute value cumulative addition device, characterized in that the outputs of the logical inversion unit and the cumulative storage unit and the carry are received and added to obtain a new cumulative value.
JP5235346A 1993-08-27 1993-08-27 Absolute value accumulator Pending JPH0764768A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5235346A JPH0764768A (en) 1993-08-27 1993-08-27 Absolute value accumulator

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5235346A JPH0764768A (en) 1993-08-27 1993-08-27 Absolute value accumulator

Publications (1)

Publication Number Publication Date
JPH0764768A true JPH0764768A (en) 1995-03-10

Family

ID=16984735

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5235346A Pending JPH0764768A (en) 1993-08-27 1993-08-27 Absolute value accumulator

Country Status (1)

Country Link
JP (1) JPH0764768A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5983250A (en) * 1997-05-26 1999-11-09 Oki Electric Industry Co., Ltd. Arithmetic circuit for obtaining absolute-valued distance

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5983250A (en) * 1997-05-26 1999-11-09 Oki Electric Industry Co., Ltd. Arithmetic circuit for obtaining absolute-valued distance

Similar Documents

Publication Publication Date Title
US6009451A (en) Method for generating barrel shifter result flags directly from input data
JPH05216624A (en) Arithmetic unit
JPH0568725B2 (en)
JPH0764768A (en) Absolute value accumulator
EP0442220B1 (en) Decoder
JP2664750B2 (en) Arithmetic device and arithmetic processing method
JP2575856B2 (en) Arithmetic circuit
JPH0435777B2 (en)
JPH0736149B2 (en) Shift flag generation circuit
JP3166781B2 (en) Adder circuit
JP3205020B2 (en) Arithmetic unit
JP3331682B2 (en) Arithmetic unit
JP2953405B2 (en) Method for speeding up logic simulation and logic simulation apparatus
JPH03118632A (en) Arithmetic and logic circuit
JP3110072B2 (en) Pre-normalization circuit
JPH0553759A (en) Fixed decimal point arithmetic unit
JPH04148231A (en) Arithmetic circuit
JPH02239325A (en) Division circuit
JPS62211729A (en) Data operation unit
JPH01114937A (en) Absolute value generator
JPH06301516A (en) Semiconductor integrated circuit
JPH03255524A (en) Adding circuit
JPH04246722A (en) Adder/subtracter
JPH06259231A (en) Integral divider
JPH09269892A (en) Divider