JP3076391B2 - Overflow processing circuit - Google Patents

Overflow processing circuit

Info

Publication number
JP3076391B2
JP3076391B2 JP03061937A JP6193791A JP3076391B2 JP 3076391 B2 JP3076391 B2 JP 3076391B2 JP 03061937 A JP03061937 A JP 03061937A JP 6193791 A JP6193791 A JP 6193791A JP 3076391 B2 JP3076391 B2 JP 3076391B2
Authority
JP
Japan
Prior art keywords
overflow
value
processing circuit
register
result
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 - Fee Related
Application number
JP03061937A
Other languages
Japanese (ja)
Other versions
JPH04296932A (en
Inventor
美次 荒木
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.)
Toshiba Corp
Original Assignee
Toshiba Corp
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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP03061937A priority Critical patent/JP3076391B2/en
Priority to US07/715,622 priority patent/US5450553A/en
Publication of JPH04296932A publication Critical patent/JPH04296932A/en
Application granted granted Critical
Publication of JP3076391B2 publication Critical patent/JP3076391B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[発明の目的][Object of the Invention]

【0002】[0002]

【産業上の利用分野】本発明は、オーバーフロー処理回
路に関し、特に画像処理特有のオーバーフロー処理を行
うオーバーフロー処理回路に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an overflow processing circuit, and more particularly, to an overflow processing circuit for performing overflow processing peculiar to image processing.

【0003】[0003]

【従来の技術】従来のオーバーフロー処理回路は、一回
限りの演算でオーバーフロー処理する加減演算と、累積
加算及びオーバーフローしている数が被減数の場合の累
積減算とに対して処理を行なうことができる。
2. Description of the Related Art A conventional overflow processing circuit is capable of performing an addition / subtraction operation in which overflow processing is performed by a one-time operation, and cumulative addition and accumulation subtraction in a case where the number of overflows is a subtrahend. .

【0004】このオーバーフロー処理回路によるオーバ
ーフロー処理方法には、上位に1ビット拡張する方法
と、ビット数を十分に拡張する方法がある。上位に1ビ
ット拡張する方法は、上位に1ビット拡張してから演算
を行い、その結果の上位2ビットが01ならば正にオー
バーフロー、10であれば負にオーバーフロー、11あ
るいは00であればオーバーフローしていないと検出す
る。オーバーフローが検出された場合には、出力を本来
の演算結果と同極性の最大値符号で置き換える。しかし
ながら、累積演算であれば最終的結果が本来オーバーフ
ローしない場合には、かえって誤った結果を生じること
になる。それは、累積演算のオーバーフローは、正の最
大値を越える回数と負の最大値を越える回数が異なると
きにのみ起こるからである。そこで、これらの回数を数
えることにより、真にオーバーフローが発生した時にの
み訂正を行なうようにしている。
The overflow processing method by the overflow processing circuit includes a method of extending one bit to a higher order and a method of sufficiently expanding the number of bits. In the method of extending the upper one bit, the operation is performed after extending the upper one bit, and the overflow is positive if the upper two bits of the result are 01, overflow if the upper two bits are 10, overflow if the upper two bits are 11 or 00. Detect if not. If an overflow is detected, the output is replaced with the maximum sign of the same polarity as the original operation result. However, if the final result does not inherently overflow in the accumulative operation, an erroneous result will be generated instead. This is because the overflow of the accumulation operation occurs only when the number of times exceeding the positive maximum value differs from the number of times exceeding the negative maximum value. Thus, by counting these times, correction is performed only when a true overflow occurs.

【0005】上位に1ビット拡張してオーバーフロー処
理する回路を図3に示す。同図を用いて、2数のnビッ
ト値の演算のオーバーフロー処理過程を説明する。
FIG. 3 shows a circuit for performing overflow processing by extending one bit to the higher order. The overflow process of calculating two n-bit values will be described with reference to FIG.

【0006】最初、セレクタ300によって選択された
データa32及びデータa33が、ビット拡張回路30
1で上位に1ビット拡張される。拡張されたデータは加
算器302で演算され、その演算結果とオーバーフロー
処理回路304(詳細は後述する)でクランプされた結
果がセレクタ305に入力される。これと同時に、加算
器302の演算結果はビット切りだし回路306で上位
1ビットが削られてレジスタ307に保持される。ここ
で、クランプとは、データの持つビット長で表現可能な
最大値あるいは最小値に置換する処理である。また、デ
ータa32,a33は、オーバーフローしていないデー
タとする。
First, the data a32 and data a33 selected by the selector 300 are transmitted to the bit extension circuit 30.
One bit is extended upward by one. The expanded data is operated on by the adder 302, and the operation result and the result clamped by the overflow processing circuit 304 (to be described in detail later) are input to the selector 305. At the same time, the operation result of the adder 302 is cut off by the bit extracting circuit 306 with the upper one bit, and is stored in the register 307. Here, the clamp is a process of replacing the data with a maximum value or a minimum value that can be represented by the bit length of the data. The data a32 and a33 are data that does not overflow.

【0007】2回目以降の演算は、セレクタ300によ
って選択されたデータa31及びデータa33で、同様
の処理が行われる。クランプするかしないかは、信号3
03によって判定される。クランプする場合はオーバー
フロー処理回路304でクランプされた結果が選択さ
れ、クランプしない場合は加算器302の演算結果が選
択され、選択された値がセレクタ305を通して出力さ
れる。
In the second and subsequent operations, the same processing is performed on the data a31 and data a33 selected by the selector 300. Whether to clamp or not is determined by signal 3
03. When clamping is performed, the result clamped by the overflow processing circuit 304 is selected. When clamping is not performed, the operation result of the adder 302 is selected, and the selected value is output through the selector 305.

【0008】次に、オーバーフロー処理回路304の詳
細について図4を用いて説明する。このオーバーフロー
処理回路304は、演算結果の最上位2ビットからオー
バーフローの判定を行うものである。
Next, details of the overflow processing circuit 304 will be described with reference to FIG. The overflow processing circuit 304 determines an overflow from the two most significant bits of the operation result.

【0009】演算結果がオーバーフロー処理回路304
の入力となる。オーバーフロー判定回路400におい
て、入力された演算結果の上位2ビットが01のときは
正にオーバーフロー、10のときは負にオーバーフロー
しており、00または11のときはオーバーフローして
いないと判定される。正にオーバーフローしている場合
は、予め1が保持されているレジスタ401がセレクタ
404で選択され、負にオーバーフローしている場合
は、−1が保持されているレジスタ402が選択され、
オーバーフローしていない場合には、0が保持されてい
るレジスタ403が選択される。選択された値とレジス
タ405の値とが、加算器406で加算演算される。累
積演算の場合には、この加算演算が繰り返される。
The result of the operation is an overflow processing circuit 304.
Input. In the overflow determination circuit 400, it is determined that the overflow has occurred when the upper 2 bits of the input operation result are 01, the overflow has occurred when the upper 2 bits are 10, and the overflow has occurred when the upper 2 bits have been 00 or 11. If the overflow is positive, the register 401 holding 1 in advance is selected by the selector 404. If the overflow is negative, the register 402 holding -1 is selected.
If no overflow occurs, the register 403 holding 0 is selected. An adder 406 performs an addition operation on the selected value and the value of the register 405. In the case of the accumulation operation, this addition operation is repeated.

【0010】加算演算が繰り返されることにより、正に
オーバーフローしている場合にはレジスタ405の値が
カウントアップされ、負にオーバーフローしている場合
にはカウントダウンされる。すなわち、レジスタ405
には正のオーバーフローの回数と負のオーバーフローの
回数の差が保持されることになる。その結果、レジスタ
405の中身が正か負かで累積演算のオーバーフローが
正か負かを判定することができる。ここで、レジスタ4
05をオーバーフローカウンタと定義する。
As the addition operation is repeated, the value of the register 405 is counted up when the data overflows positively, and is counted down when the data overflows negatively. That is, the register 405
Holds the difference between the number of positive overflows and the number of negative overflows. As a result, it is possible to determine whether the contents of the register 405 are positive or negative and whether the overflow of the accumulation operation is positive or negative. Here, register 4
05 is defined as an overflow counter.

【0011】加算器406の出力はクランプ判定回路4
07に入力され、その値が正であれば正の最大値が保持
されているレジスタ408、負であれば負の最大値が保
持されているレジスタ409、ゼロであればオーバーフ
ロー処理回路304の入力値410がセレクタ411で
選択され出力される。
The output of the adder 406 is the clamp judgment circuit 4
07, the register 408 holds the maximum positive value if the value is positive, the register 409 holds the maximum negative value if the value is negative, and the input of the overflow processing circuit 304 if the value is zero. The value 410 is selected and output by the selector 411.

【0012】しかしながら、このようなオーバーフロー
処理は連続加算を前提としており、オーバーフローを起
こしている値を減数とする減算を行った場合には、オー
バーフロー符号が判定するにもかかわらずレジスタ40
5中のオーバーフロー回数の符号は反転しないので正確
な処理が行えない。
However, such overflow processing is based on continuous addition, and when a subtraction is performed with the value causing the overflow as a decrement, the register 40 is used even if the overflow code is determined.
Since the sign of the overflow count in 5 is not inverted, accurate processing cannot be performed.

【0013】また、レジスタ405に保持されるオーバ
ーフローカウンタ値は、常に正またはゼロとなるように
途中処理において出力値を選ぶことができない。それゆ
え、絶対値演算の際に累積オーバーフロー処理が行え
ず、絶対値演算のオーバーフロー処理が行うことができ
ない。
Further, the output value cannot be selected during the processing so that the overflow counter value held in the register 405 always becomes positive or zero. Therefore, the cumulative overflow process cannot be performed at the time of the absolute value calculation, and the overflow process of the absolute value calculation cannot be performed.

【0014】画像処理におけるフィルタリング、アフィ
ン変換、高速フーリエ変換等の前処理、あるいは画像認
識、ヒストグラム処理、ラベリング等の後処理には、オ
ーバーフローしている値を減数とする演算及び絶対値演
算が必要である。以前より、このような演算が可能なオ
ーバーフロー処理回路が所望されていた。
In preprocessing such as filtering, affine transformation, and fast Fourier transform in image processing, or postprocessing such as image recognition, histogram processing, and labeling, an operation for subtracting an overflowing value and an absolute value operation are required. It is. For some time, an overflow processing circuit capable of performing such an operation has been desired.

【0015】[0015]

【発明が解決しようとする課題】以上のように、従来の
上位に1ビット拡張して処理するオーバーフロー処理回
路では、オーバーフローしている数を減数とする減算、
及びオーバーフローを起こしている数の絶対値演算を正
確に行えないという問題がある。
As described above, in the conventional overflow processing circuit that performs processing by extending one bit to the higher order, subtraction in which the number of overflows is a subtraction is performed.
In addition, there is a problem that the absolute value calculation of the number causing the overflow cannot be performed accurately.

【0016】そこで、本発明は、このような従来の事情
に鑑みてなされたものであり、その目的とするところ
は、上位に1ビット拡張する方法において、オーバーフ
ローしている数を減数とする減算、及びオーバーフロー
を起こしている数の絶対値演算に対しても正確な処理を
行うことができるオーバーフロー処理回路を提供するこ
とにある。
Accordingly, the present invention has been made in view of such a conventional situation, and an object of the present invention is to provide a method of extending one bit to a higher order, in which the number of overflows is subtracted by subtraction. And an overflow processing circuit capable of performing accurate processing even for the calculation of the absolute value of the number causing the overflow.

【0017】[発明の構成][Structure of the Invention]

【0018】[0018]

【課題を解決するための手段】上記目的を達成するた
め、本発明の第1は、演算器の有効桁を上位に1ビット
拡張してオーバーフロー検出をする手段と、正にオーバ
ーフローを起こした回数と負にオーバーフローを起こし
た回数の差をカウントするカウント手段と、オーバーフ
ローを起こしている数が減数となる減算の場合、その演
算結果が正にオーバーフローを起こしているときは前記
カウント手段の値に2の補数をとったものに1を加え、
負にオーバーフローを起こしているときは前記カウント
手段の値に2の補数をとったものに−1を加える手段と
から構成されている。
Means for Solving the Problems In order to achieve the above object, a first aspect of the present invention is to provide a means for extending an effective digit of an arithmetic unit by one bit to a higher order to detect an overflow, Counting means for counting the difference between the number of times overflow has occurred negatively, and in the case of subtraction in which the number causing overflow is a subtraction, the value of the counting means is used if the result of the operation is positively overflowing. Add one to the two's complement,
Means for adding -1 to a value obtained by taking a two's complement to the value of the counting means when an overflow has occurred negatively.

【0019】また、本発明の第2は、演算器の有効桁を
上位に1ビット拡張してオーバーフロー検出をする手段
と、正にオーバーフローを起こした回数と負にオーバー
フローを起こした回数の差をカウントするカウント手段
と、負にオーバーフローを起こしている数が絶対値演算
の対象となる場合、その演算結果が正にオーバーフロー
を起こしているときは前記カウント手段の値に2の補数
をとったものに1を加え、負にオーバーフローを起こし
ているときは前記カウント手段の値に2の補数をとった
ものに−1を加える手段とから構成されている。
A second aspect of the present invention is a means for performing an overflow detection by extending an effective digit of an arithmetic unit by one bit to a higher order, and calculating a difference between the number of times an overflow has occurred positively and the number of times an overflow has occurred negatively. Counting means for counting, and when the number which is negatively overflowing is to be subjected to absolute value calculation, the value of the counting means is 2's complement when the calculation result is positively overflowing. And a means for adding -1 to a value obtained by complementing the value of the counting means with a two's complement when an overflow occurs negatively.

【0020】[0020]

【作用】上記構成により、本発明は、正にオーバーフロ
ーを起こした回数と負にオーバーフローを起こした回数
の差の値を、オーバーフローカウンタと定義されるレジ
スタに保持する。オーバーフローを起こしている数が減
数となる減算の場合で、その演算結果が正にオーバーフ
ローを起こしているときは、レジスタの値に2の補数を
とったもの、すなわち符号を反転したものに1を加え
る。逆に負にオーバーフローを起こしているときはレジ
スタの値の符号を反転したものに−1を加える。
With the above arrangement, the present invention holds the value of the difference between the number of times that the overflow has occurred positively and the number of times that the overflow has occurred negatively in a register defined as an overflow counter. In the case of subtraction in which the number causing overflow is a subtraction, and when the operation result is exactly overflowing, 1 is added to the value obtained by taking the 2's complement of the register value, that is, the value whose sign is inverted. Add. Conversely, if an overflow has occurred negatively, -1 is added to the value obtained by inverting the sign of the register value.

【0021】また、負にオーバーフローを起こしている
数が絶対値演算の対象となる場合で、その演算結果が正
にオーバーフローを起こしているときは、レジスタの値
に2の補数をとったもの、すなわち符号を反転したもの
に1を加える。逆に負にオーバーフローを起こしている
ときはレジスタの値の符号を反転したものに−1を加え
るようにしている。
In the case where the number causing a negative overflow is the target of the absolute value calculation, and the result of the calculation is a positive overflow, the value of the register is two's complement, That is, 1 is added to the sign inverted. Conversely, when an overflow occurs negatively, -1 is added to the value obtained by inverting the sign of the register value.

【0022】[0022]

【実施例】以下、本発明の実施例を図面に従って説明す
る。図1は、本発明のオーバーフロー処理回路の構成
図、図2は、オーバーフロー処理回路を用いた絶対値演
算を行う回路の構成図である。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a configuration diagram of an overflow processing circuit of the present invention, and FIG. 2 is a configuration diagram of a circuit that performs an absolute value calculation using the overflow processing circuit.

【0023】まず、オーバーフローしている数が減数と
なる演算についてのオーバーフロー処理について、図1
を用いて説明する。同図に示すオーバーフロー処理回路
は、図4で示した従来のオーバーフロー処理回路に、セ
レクタ102と正負符号反転器103が追加された構成
となっている。
First, an overflow process for an operation in which the number of overflows is reduced is shown in FIG.
This will be described with reference to FIG. The overflow processing circuit shown in the figure has a configuration in which a selector 102 and a positive / negative sign inverter 103 are added to the conventional overflow processing circuit shown in FIG.

【0024】正負符号反転器103は、レジスタ104
の値の符号を反転するものである。セレクタ102は、
オーバーフローしている数を減数とした場合に正負符号
反転器103の出力を選択し、そうでない場合にはレジ
スタ104の出力を選択する。
The sign inverter 103 has a register 104
The sign of the value of is inverted. The selector 102
If the number of overflows is a subtraction, the output of the sign inverter 103 is selected. Otherwise, the output of the register 104 is selected.

【0025】このような構成により、オーバーフローし
ている数を減数として演算を行ったか否かで、信号10
1によって前回までのオーバーフロー回数が保持されて
いるレジスタ104の値を選択するか、正負符号反転器
103を通して得られた値を選択するかが判定され、選
択された値がセレクタ102を通して加算器105のb
1入力に入力される。すなわち、オーバーフローしてい
る数を減数として演算を行った場合には正負符号反転器
103の値が、そうでない場合はレジスタ104の値が
b1入力に入力される。
With such a configuration, the signal 10
Whether the value of the register 104 holding the number of overflows up to the previous time is selected or the value obtained through the sign inverter 103 is selected based on 1 and the selected value is added through the selector 102 to the adder 105. B
Input to one input. That is, the value of the sign inverter 103 is input to the b1 input when the calculation is performed with the overflowing number as a subtraction number, and otherwise, the value of the register 104 is input.

【0026】一方、オーバーフロー処理回路の入力値
は、オーバーフロー判定回路100において、その上位
2ビットが判定される。上位2ビットが01の場合は、
その回の演算で正にオーバーフローしていると判定され
るためレジスタ107の値1が選択され、10の場合は
その回の演算で負にオーバーフローしていると判定され
るためレジスタ108の値−1が選択される。11、0
0の場合は、その回でオーバーフローしていないと判定
され、レジスタ109の値0が選択される。選択された
値は、加算器105のa1入力に入力される。
On the other hand, the upper two bits of the input value of the overflow processing circuit are judged by the overflow judgment circuit 100. If the upper 2 bits are 01,
The value 1 of the register 107 is selected because it is determined that the overflow has occurred positively in the current operation, and the value of the register 108 is −10 in the case of 10, because it is determined that the overflow has negatively occurred in the current operation. 1 is selected. 11,0
In the case of 0, it is determined that overflow has not occurred at that time, and the value 0 of the register 109 is selected. The selected value is input to the a1 input of the adder 105.

【0027】加算器105で加算された結果は、レジス
タ104に入力されるとともにクランプ判定回路110
に入力される。クランプ判定回路110では、加算器1
05の出力が正か負かゼロかが判定され、正の場合は正
の最大値を保持しているレジスタ111が、負の場合は
負の最小値を保持しているレジスタ112が、0の場合
はオーバーフロー処理回路の入力値113が選択され
る。選択された値は、セレクタ114から出力される。
The result of the addition by the adder 105 is input to the register 104 and the clamp determination circuit 110
Is input to In the clamp determination circuit 110, the adder 1
It is determined whether the output of the register 05 is positive, negative or zero. If the output is positive, the register 111 holding the positive maximum value is set. If the output is negative, the register 112 holding the negative minimum value is set to 0. In this case, the input value 113 of the overflow processing circuit is selected. The selected value is output from the selector 114.

【0028】次に、2数a、bの差の絶対値演算|a−
b|のオーバーフロー処理について、図2を用いて説明
する。同図における回路は、減算器201,202、2
入力のオーバーフロー処理回路204、及びレジスタ2
06から構成されている。減算器201は、入力データ
a、bに対してa−bを行い、減算器202はb−aを
行うものである。
Next, calculation of the absolute value of the difference between the two numbers a and b
The overflow processing of b | will be described with reference to FIG. The circuit in the figure includes subtractors 201, 202, 2
Input overflow processing circuit 204 and register 2
06. The subtracter 201 performs ab on the input data a and b, and the subtractor 202 performs ba.

【0029】オーバーフロー処理回路204は、減算器
201,202から出力される2つの演算結果を取り込
み、クランプ判定を行う。そして、クランプしない場合
に対してa−b、b−aのうち選択すべき方を示す信号
205を出力すると共に、クランプされた値dを出力す
る機能を有している。
The overflow processing circuit 204 takes in the two operation results output from the subtracters 201 and 202 and makes a clamp judgment. In addition, it has a function of outputting a signal 205 indicating which one of ab and ba is to be selected and outputting a clamped value d when no clamping is performed.

【0030】最初は、セレクタ200によって選択され
たデータa21及びデータb2が、2つの減算器20
1,202に入力される。2回目以降は、データa22
とデータb2が減算器201,202に入力される。各
々の減算器201,202では、同時にa−b、b−a
の演算がなされる。なお、演算を並列的に同時に動作さ
せるのは高速化のためである。
At first, the data a21 and the data b2 selected by the selector 200 are
1, 202. From the second time on, data a22
And data b2 are input to the subtracters 201 and 202. In each of the subtracters 201 and 202, ab and ba are simultaneously set.
Is calculated. The simultaneous operation of the operations in parallel is for speeding up.

【0031】2つの演算結果は、セレクタ203に入力
されると同時にオーバーフロー処理回路204に入力さ
れる。オーバーフロー処理回路204からは、クランプ
をしない場合に対してa−b、b−aのうち選択すべき
方を示す信号205と、クランプされた値dが出力され
る。信号205に基づき、a−b、b−aの一方がセレ
クタ203で選択され、値cとして出力される。この値
cは、セレクタ208へ出力されると共にレジスタ20
6に保持される。そして、クランプする場合には値d
が、しない場合には値cがクランプ制御信号207の制
御により、セレクタ208で選択され出力される。
The two calculation results are input to the selector 203 and simultaneously to the overflow processing circuit 204. The overflow processing circuit 204 outputs a signal 205 indicating which one of ab and ba is to be selected and a clamped value d when no clamping is performed. Based on the signal 205, one of ab and ba is selected by the selector 203 and output as a value c. This value c is output to the selector 208 and
6 is held. And when clamping, the value d
However, if not, the value c is selected and output by the selector 208 under the control of the clamp control signal 207.

【0032】次に、絶対値演算におけるオーバーフロー
処理回路204についての説明をする。オーバーフロー
カウンタ(レジスタ104)の値は、常に正またはゼロ
をとらなければならないので、オーバーフロー回数のカ
ウント、及び累積演算の途中の出力値cを求めるために
特別の処理が行われる。これについては、表1を例に説
明する。
Next, the overflow processing circuit 204 in the absolute value calculation will be described. Since the value of the overflow counter (register 104) must always be positive or zero, a special process is performed to count the number of overflows and obtain the output value c during the accumulation operation. This will be described using Table 1 as an example.

【0033】図2における絶対値演算の第一の入力a2
2をb、第二の入力b2をaとし、bを前回までの累積
演算の結果とする。またaは、オーバーフローしていな
いものとして考える。
The first input a2 of the absolute value calculation in FIG.
2 is b, the second input b2 is a, and b is the result of the previous cumulative operation. Also, it is assumed that a does not overflow.

【0034】a−b、b−aの欄はa−b、b−aの演
算結果の状態を示しており、0はオーバーフローしてい
ない状態を、+は正にオーバーフローしている状態を、
−は負にオーバーフローしている状態をそれぞれ示して
いる。bの欄は前回までの累積演算結果のオーバーフロ
ーの状態を表し、flgoutの欄は絶対値演算後のオーバー
フローカウンタ(レジスタ104)の値を表す。flg(n-
1)は前回までのオーバーフローカウンタの値を表し、−
flg(n-1)は、前回までのオーバーフローカウンタの値の
符号を反転させた値、すなわち2の補数をとった値を表
す。最後の欄は、絶対値演算の結果として出力すべき値
を示す。
The columns ab and ba indicate the state of the calculation result of ab and ba, where 0 indicates a state where no overflow has occurred, + indicates a state where a positive overflow has occurred, and
“-” Indicates a state of overflowing negatively. The column b shows the state of the overflow of the accumulated operation results up to the previous time, and the column flgout shows the value of the overflow counter (register 104) after the absolute value operation. flg (n-
1) represents the value of the overflow counter up to the previous time,
flg (n-1) represents a value obtained by inverting the sign of the value of the overflow counter up to the previous time, that is, a value obtained by taking a two's complement. The last column indicates a value to be output as a result of the absolute value calculation.

【0035】入力bがオーバーフローを起こしていない
場合(bが0の場合)で、演算結果がオーバーフローを
起こしていないとき(a−b、b−aが共に0のとき)
は、絶対値演算の結果としてa−bとb−aの内の正の
方を出力する。ここで、正というのは正にオーバーフロ
ーを起こしてみかけ上、負になっている場合も含む。入
力bがオーバーフローを起こしておらず、演算結果が正
にオーバーフローを起こしたとき(a−bあるいはb−
aが+のとき)にはオーバーフローカウンタに1を加
え、オーバーフローを起こしていないときには前の値を
オーバーフローカウンタに保持する。
When the input b does not cause an overflow (when b is 0) and the operation result does not cause an overflow (when both ab and ba are 0)
Outputs the positive one of ab and ba as the result of the absolute value operation. Here, the term “positive” includes a case in which an overflow occurs and an apparently negative value occurs. When the input b does not overflow and the operation result exactly overflows (ab or b-
When a is +), 1 is added to the overflow counter, and when no overflow occurs, the previous value is held in the overflow counter.

【0036】入力bが負にオーバーフローを起こしてい
る場合(bが−の場合)には、絶対値演算の結果として
a−bを出力する。a−bの演算結果が正にオーバーフ
ローを起こしたとき(a−bが+のとき)にはオーバー
フローカウンタの符号を反転したもの(すなわち2の補
数をとったもの)に1を加え、負にオーバーフローを起
こしたとき(a−bが−のとき)にはオーバーフローカ
ウンタの符号を反転したもの(すなわち2の補数をとっ
たもの)に−1を加える。また、オーバーフローを起こ
していないとき(a−bが0のとき)には前の値の符号
を反転したものをオーバーフローカウンタに保持する。
When the input b has a negative overflow (when b is-), ab is output as a result of the absolute value calculation. When the operation result of a-b causes a positive overflow (when a-b is +), 1 is added to a value obtained by inverting the sign of the overflow counter (that is, a value obtained by taking 2's complement), and a negative value is obtained. When an overflow occurs (when a-b is-), -1 is added to a value obtained by inverting the sign of the overflow counter (that is, a value obtained by taking 2's complement). When no overflow has occurred (when ab is 0), a value obtained by inverting the sign of the previous value is held in the overflow counter.

【0037】入力bが正にオーバーフローを起こしてい
る場合(bが+の場合)には、絶対値演算の結果として
b−aを出力する。b−aの演算結果が正にオーバーフ
ローを起こしたとき(b−aが+のとき)にはオーバー
フローカウンタに1を加え、負にオーバーフローを起こ
したとき(b−aが−のとき)にはオーバーフローカウ
ンタに−1を加える。また、オーバーフローを起こして
いないとき(b−aが0のとき)には前の値をオーバー
フローカウンタに保持する。
If the input b is overflowing (b is +), ba is output as the result of the absolute value calculation. When the operation result of ba is positively overflowed (when ba is positive), 1 is added to the overflow counter, and when the overflow is negatively generated (when ba is negative), Add -1 to the overflow counter. When no overflow has occurred (when ba is 0), the previous value is held in the overflow counter.

【0038】クランプ処理として、オーバーフロー回数
flgout(n-1) が0であれば、表1で選択された値をその
まま出力し、0でなければ表現可能な正の最大値を出力
する。
As the clamping process, the number of overflows
If flgout (n-1) is 0, the value selected in Table 1 is output as it is, and if 0, the maximum expressible positive value is output.

【0039】[0039]

【表1】 [Table 1]

【0040】[0040]

【発明の効果】以上説明したように、本発明のオーバー
フロー処理回路によれば、オーバーフローした場合オー
バーフローカウンタの値に2の補数をとるようにした。
これにより、オーバーフローを起こした値が減数となる
演算及び絶対値演算を正確に行うことができる。
As described above, according to the overflow processing circuit of the present invention, when an overflow occurs, the value of the overflow counter is set to 2's complement.
As a result, the calculation in which the value causing the overflow is a subtraction and the absolute value calculation can be accurately performed.

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

【図1】本発明に関わるオーバーフロー処理回路の一実
施例を示す構成図である。
FIG. 1 is a configuration diagram showing an embodiment of an overflow processing circuit according to the present invention.

【図2】本発明のオーバーフロー処理回路を用いた絶対
値演算を行う回路の構成図である。
FIG. 2 is a configuration diagram of a circuit that performs an absolute value calculation using the overflow processing circuit of the present invention.

【図3】従来の上位に1ビットを拡張してオーバーフロ
ー処理を行う回路の構成図である。
FIG. 3 is a configuration diagram of a conventional circuit that performs overflow processing by extending one bit to an upper order.

【図4】従来のオーバーフロ処理回路の構成図であ
る。。
FIG. 4 is a configuration diagram of a conventional overflow processing circuit. .

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

100 オーバーフロー判定回路 102,114,200,203,208 セレクタ 103 正負符号反転器 104,107,108,109,111,112,2
06 レジスタ 105 加算器 110 クランプ判定回路 201,202 減算器 204 オーバーフロー処理回路
100 overflow determination circuit 102, 114, 200, 203, 208 selector 103 positive / negative sign inverter 104, 107, 108, 109, 111, 112, 2
06 Register 105 Adder 110 Clamp determination circuit 201, 202 Subtractor 204 Overflow processing circuit

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 演算器の有効桁を上位に1ビット拡張し
てオーバーフロー検出をする手段と、正にオーバーフロ
ーを起こした回数と負にオーバーフローを起こした回数
の差をカウントするカウント手段と、オーバーフローを
起こしている数が減数となる減算の場合、その演算結果
が正にオーバーフローを起こしているときは前記カウン
ト手段の値に2の補数をとったものに1を加え、負にオ
ーバーフローを起こしているときは前記カウント手段の
値に2の補数をとったものに−1を加える手段を有する
ことを特徴とするオーバーフロー処理回路。
1. Means for detecting an overflow by extending an effective digit of an arithmetic unit to a higher order by one bit, counting means for counting a difference between the number of times an overflow has occurred positively and the number of times an overflow has occurred negatively, In the case of a subtraction in which the number causing the subtraction is a subtraction, if the result of the operation has a positive overflow, 1 is added to the value obtained by taking the two's complement of the value of the counting means, and a negative overflow occurs. An overflow processing circuit comprising means for adding -1 to a value obtained by taking a two's complement to the value of the counting means when the counting is performed.
【請求項2】 演算器の有効桁を上位に1ビット拡張し
てオーバーフロー検出をする手段と、正にオーバーフロ
ーを起こした回数と負にオーバーフローを起こした回数
の差をカウントするカウント手段と、負にオーバーフロ
ーを起こしている数が絶対値演算の対象となる場合、そ
の演算結果が正にオーバーフローを起こしているときは
前記カウント手段の値に2の補数をとったものに1を加
え、負にオーバーフローを起こしているときは前記カウ
ント手段の値に2の補数をとったものに−1を加える手
段を有することを特徴とするオーバーフロー処理回路。
2. A means for detecting an overflow by extending an effective digit of an arithmetic unit to a higher order by one bit, a counting means for counting a difference between the number of times of overflow and the number of times of overflow, and a negative means. If the number causing an overflow is the target of the absolute value calculation, if the result of the calculation is a positive overflow, 1 is added to the value obtained by taking the two's complement of the value of the counting means, and An overflow processing circuit comprising means for adding -1 to a value obtained by complementing the value of the counting means with a two's complement when an overflow has occurred.
JP03061937A 1990-06-15 1991-03-26 Overflow processing circuit Expired - Fee Related JP3076391B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP03061937A JP3076391B2 (en) 1991-03-26 1991-03-26 Overflow processing circuit
US07/715,622 US5450553A (en) 1990-06-15 1991-06-14 Digital signal processor including address generation by execute/stop instruction designated

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP03061937A JP3076391B2 (en) 1991-03-26 1991-03-26 Overflow processing circuit

Publications (2)

Publication Number Publication Date
JPH04296932A JPH04296932A (en) 1992-10-21
JP3076391B2 true JP3076391B2 (en) 2000-08-14

Family

ID=13185595

Family Applications (1)

Application Number Title Priority Date Filing Date
JP03061937A Expired - Fee Related JP3076391B2 (en) 1990-06-15 1991-03-26 Overflow processing circuit

Country Status (1)

Country Link
JP (1) JP3076391B2 (en)

Also Published As

Publication number Publication date
JPH04296932A (en) 1992-10-21

Similar Documents

Publication Publication Date Title
JP3352887B2 (en) Divider with clamp, information processing apparatus provided with this divider with clamp, and clamp method in division processing
JP3076391B2 (en) Overflow processing circuit
JP3012357B2 (en) Shift amount detection circuit
US5260890A (en) Overflow detection system and its circuit for use in addition and subtraction
JP3578793B2 (en) IIR ghost canceling system
JPH056431A (en) Detector for feature point of contour line
CN116488613B (en) Filtering method, device, terminal equipment and readable storage medium
JPH0426495B2 (en)
JP2726479B2 (en) Division device
JPS6384321A (en) Binarization circuit
JP2512230B2 (en) Processor
JPH04167170A (en) Multiplication/addition arithmetic circuit
JPH03217938A (en) Floating deciaml rounding normalizing device
KR100270814B1 (en) Filtering method using shift-adder
JP3245884B2 (en) Shift adder / subtractor
KR100198783B1 (en) Driving method of serial operating divider
JPH1040073A (en) Digital signal processor
JPH06139357A (en) Contour line feature point detector
JPH0644226B2 (en) Processor
JPH05265697A (en) Shift frequency detecting circuit
JPH086762A (en) Multiplying circuit
JPH0553768A (en) Divider
JPH04132537U (en) signal processing device
JPH04165422A (en) Digital signal processor
JPH11232249A (en) Product sum arithmetic processor and product sum arithmetic processing method

Legal Events

Date Code Title Description
FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090609

Year of fee payment: 9

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090609

Year of fee payment: 9

FPAY Renewal fee payment (prs date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100609

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees