JPH0619700B2 - Arithmetic unit - Google Patents

Arithmetic unit

Info

Publication number
JPH0619700B2
JPH0619700B2 JP58179941A JP17994183A JPH0619700B2 JP H0619700 B2 JPH0619700 B2 JP H0619700B2 JP 58179941 A JP58179941 A JP 58179941A JP 17994183 A JP17994183 A JP 17994183A JP H0619700 B2 JPH0619700 B2 JP H0619700B2
Authority
JP
Japan
Prior art keywords
data
control signal
bit
output
register
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP58179941A
Other languages
Japanese (ja)
Other versions
JPS6072022A (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
Tokyo Shibaura Electric 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 Tokyo Shibaura Electric Co Ltd filed Critical Tokyo Shibaura Electric Co Ltd
Priority to JP58179941A priority Critical patent/JPH0619700B2/en
Publication of JPS6072022A publication Critical patent/JPS6072022A/en
Publication of JPH0619700B2 publication Critical patent/JPH0619700B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime 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
    • 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/499Denomination or exception handling, e.g. rounding or overflow
    • G06F7/49905Exception handling
    • G06F7/4991Overflow or underflow
    • G06F7/49921Saturation, i.e. clipping the result to a minimum or maximum value

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)

Description

【発明の詳細な説明】 〔発明の技術分野〕 この発明は、演算結果にオーバーフローが生じたとき
に、演算結果を最大値または最小値にクランプする機能
を持つ演算装置に関するものである。
Description: TECHNICAL FIELD The present invention relates to an arithmetic device having a function of clamping an arithmetic result to a maximum value or a minimum value when an arithmetic result overflows.

〔発明の技術的背景〕[Technical background of the invention]

従来のディジタル信号処理等に用いられる演算装置で
は、演算結果にオーバーフローが生じると、演算装置の
演算結果を保持させておくレジスタへ最大値のデータま
たは最小値のデータをソフトウェアの処理として書き込
み、クランプ処理を実現させていた。
In an arithmetic unit used for conventional digital signal processing, when an arithmetic result overflows, the maximum value data or the minimum value data is written as a software process into a register that holds the arithmetic result of the arithmetic unit and clamped. The processing was realized.

〔背景技術の問題点〕[Problems of background technology]

このため、ソフトウェアにおいてクランプ処理を考慮し
たものを開発せねばならないという問題点があり、ま
た、ソフトウェアに処理の負荷がかかるとともに、処理
速度が低下するという欠点があった。特に、連続演算命
令を実行する場合には、演算結果を格納するレジスタが
複数となり、上記欠点は増大することになった。
For this reason, there is a problem in that software must be developed in consideration of the clamp processing, and there is a drawback that the processing load is imposed on the software and the processing speed is reduced. In particular, when a continuous operation instruction is executed, the number of registers for storing the operation result becomes plural, and the above drawbacks are increased.

〔発明の目的〕[Object of the Invention]

本発明は上記のような従来の演算装置の欠点に鑑みなさ
れたもので、その目的は、オーバーフローが生じる連続
演算命令を的確に実行することができ、この場合にも、
ソフトウェアの負荷が少なく、処理速度を高速化できる
演算装置を提供することである。
The present invention has been made in view of the drawbacks of the conventional arithmetic device as described above, and an object thereof is to accurately execute a continuous arithmetic instruction that causes an overflow.
It is an object of the present invention to provide an arithmetic unit that has a small software load and can increase the processing speed.

〔発明の概要〕[Outline of Invention]

そこで本発明では、それぞれn(nは整数)ビットのデ
ータが格納される第1、第2のレジスタと、nビットの
データの演算を行い、その結果のnビットのデータを出
力するとともに、演算結果にオーバーフローが生じたと
きにクランプ制御信号を出力する一方、連結演算命令の
実行に際して前記第1、第2のレジスタの一方へクロッ
クを与えて演算結果を格納するレジスタの選択制御を行
い、且つ、上位側のデータの演算にオーバーフローが生
じたときにはフラグのセットによりオーバーフローを示
す主演算部と、前記クランプ制御信号を用いて、前記主
演算部の出力データそのままのデータと、nビットの最
大または最小のnビットのデータとの一方を作成して前
記第1、第2のレジスタへ出力する論理回路と、前記主
制御部の連結演算命令の実行に際しての動作に呼応し
て、前記フラグがセットされた場合には、前記第1、第
2のレジスタの内、下位側のデータが格納されるレジス
タのデータをクランプする手段とを具備させて演算装置
を構成した。更に本発明では、それぞれn(nは整数)
ビットのデータが格納される第1、第2のレジスタと、
nビットのデータの演算を行い、その結果のnビットの
データを出力するとともに、演算結果にオーバーフロー
が生じたときにクランプ制御信号を出力する一方、連結
演算命令の実行に際しては当該命令の実行を示す制御信
号を出力するとともに前記第1、第2のレジスタの一方
へクロックを与えて演算結果を格納するレジスタの選択
制御を行う示す主演算部と、前記クランプ制御信号を用
いて、前記主演算部の出力データそのままのデータと、
nビットの最大または最小のnビットのデータとの一方
を作成して前記第1、第2のレジスタへ出力する論理回
路と、連結演算命令の実行を示す制御信号及び前記クラ
ンプ制御信号を受けて、これら制御信号を用いて前記主
制御部の出力の最上位ビットを制御して得た1ビットの
データを、前記第1、第2のレジスタの内、下位側のデ
ータが格納されるレジスタへ出力するとともに、上位側
のレジスタへ与えられるクロックを下位側のデータが格
納されるレジスタへ出力する上記第3の論理回路とを具
備させて演算装置を構成した。
Therefore, in the present invention, the first and second registers each storing n-bit (n is an integer) data are operated with the n-bit data, and the resulting n-bit data is output and the operation is performed. A clamp control signal is output when a result overflows, while a clock is applied to one of the first and second registers during execution of a concatenated operation instruction to control selection of a register for storing an operation result, and When an overflow occurs in the operation of the higher-order data, a flag is set to indicate the overflow, and the clamp control signal is used to output the output data of the main operation unit as it is, the maximum of n bits or A concatenation operation of the main control unit and a logic circuit that creates one of the minimum n-bit data and outputs it to the first and second registers. In response to the operation at the time of executing the command, when the flag is set, there is provided means for clamping the data of the register in which the lower data of the first and second registers is stored. Then, the arithmetic unit was constructed. Further, in the present invention, each is n (n is an integer)
First and second registers in which bit data is stored,
An n-bit data operation is performed, the resulting n-bit data is output, and a clamp control signal is output when an overflow occurs in the operation result, while the concatenation operation instruction is executed when the instruction is executed. A main arithmetic operation section for outputting a control signal as shown and for controlling selection of a register for storing a calculation result by applying a clock to one of the first and second registers; and the main arithmetic operation using the clamp control signal. The output data of the part as it is,
A logic circuit that creates one of n-bit maximum or minimum n-bit data and outputs the data to the first and second registers, a control signal indicating execution of a concatenation operation instruction, and the clamp control signal , 1-bit data obtained by controlling the most significant bit of the output of the main control unit using these control signals is sent to the register in which the lower data of the first and second registers is stored. The arithmetic unit is configured to include the third logic circuit that outputs the clock to the register on the higher side and outputs the clock to the register on the lower side.

〔発明の実施例〕Example of Invention

以下、図面を参照して本発明の実施例を説明する。 Embodiments of the present invention will be described below with reference to the drawings.

第1図は本発明の一実施例のブロック図である。同図に
おいて、1は主演算部を示す。この主演算部1は、16ビ
ットの演算が可能であり、演算結果のデータの最上位ビ
ットのデータを符号ビットとした固定小数点演算を行な
い16ビットの演算結果のデータを出力データライン41
42、43、……、416へ出力する。演算結果にオーバーフ
ローが生じると、主演算部1は、オーバーフローが正の
データで生じたときには最大クランプ制御信号を信号ラ
イン8から出力し、オーバーフローが負のデータで生じ
たときには最小クランプ制御信号を信号ライン9から出
力する。主演算部1から出力データライン41、42、43
……、416へ出力されたデータは、アンドゲート211、21
2、213、……、2116へ与えられる。この実施例では、最
大クランプ制御信号、最小クランプ制御信号はともに、
ハイアクティブであり、オーバーフローとならぬときに
は、ロウレベルになっている。従って、アンドゲート21
1には、インバータ221を介してハイレベルの信号が与え
られ、アンドゲート212、213、……、2116にはインバー
タ222を介してハイレベルの信号が与えられ、出力デー
タライン41、42、43、……、416へ出力されたデータは
アンドゲート211、212、213、……、2116を介して、オ
アゲート231、232、233、……、2316へ与えられる。オ
アゲート231には、インバータ222、223を介して、最小
クランプ制御信号が与えられ、オアゲート232、233、…
…、2316には最大クランプ制御信号が与えられている。
オアゲート231、232、233、……、2316から出力された
演算データは、演算データライン51、52、53、……、5
16を介して、16ビットのレジスタ2、または、16ビット
のレジスタ3へ与えられる。ここで、主演算部1は、ク
ロックライン6またはクロックライン7の一方に、クロ
ックを出力することによって、演算データを格納するレ
ジスタをレジスタ2とするかレジスタ3とするか制御し
ている。
FIG. 1 is a block diagram of an embodiment of the present invention. In the figure, reference numeral 1 indicates a main calculation unit. The main operation section 1 is capable of calculating the 16-bit operation result of the data of the most significant bit output data of the code bits and the fixed-point arithmetic is performed with 16-bit result data the data lines 4 1,
Output to 4 2 , 4 3 , ..., 4 16 . When an overflow occurs in the operation result, the main operation unit 1 outputs the maximum clamp control signal from the signal line 8 when the overflow occurs with positive data, and outputs the minimum clamp control signal when the overflow occurs with negative data. Output from line 9. Output data lines 4 1 , 4 2 , 4 3 from the main operation unit 1,
The data output to 4 16 is the AND gates 21 1 and 21
It is given to 2 , 21, 3 , ..., 21 16 . In this embodiment, both the maximum clamp control signal and the minimum clamp control signal are
It is high active and is at low level when it does not overflow. Therefore, AND gate 21
A high level signal is given to 1 via the inverter 22 1, and a high level signal is given to the AND gates 21 2 , 21 3 , ..., 21 16 via the inverter 22 2 , and the output data line The data output to 4 1 , 4 2 , 4 3 , ..., 4 16 is passed through the AND gates 21 1 , 21 2 , 21 3 , ..., 21 16 to the OR gates 23 1 , 23 2 , 23 3 , ……, given to 23 16 The minimum gate control signal is given to the OR gate 23 1 via the inverters 22 2 and 22 3 , and the OR gates 23 2 and 23 3 , ...
..., 23 16 is provided with the maximum clamp control signal.
The operation data output from the OR gates 23 1 , 23 2 , 23 3 , ..., 23 16 are calculated data lines 5 1 , 5 2 , 5 3 , ..., 5
It is given to 16-bit register 2 or 16-bit register 3 via 16. Here, the main arithmetic unit 1 outputs a clock to one of the clock line 6 and the clock line 7 to control whether the register for storing the arithmetic data is the register 2 or the register 3.

このような演算装置によるクランプ処理を説明する。16
ビットのデータの演算において、正のデータでオーバー
フローが生じると、主演算部1は最大クランプ制御信号
をアクティブとするから、信号ライン8を介してオアゲ
ート232、233、……、2316にはハイレベルの信号が与え
られ、アンドゲート211にはインバータ221を介してロウ
レベルの信号が与えられる。このため、アンドゲート21
1の出力が禁止され、オアゲート231には、アンドゲート
211及びインバータ221を介してロウレベルの信号が与え
られる。従って、オアゲート231から演算データライン5
1へは“0”のデータが出力され、オアゲート232、2
33、……、2316からは演算データライン52、53、……、
516へは“1”のデータが出力される。つまり、全デー
タとしては正の最大値である“7FFFH”へクランプされ
たデータが演算データライン51、52、53、……、516
ら、レジスタ2またはレジスタ3へ格納される。
The clamp processing by such an arithmetic device will be described. 16
In operation of the bit data, an overflow in the positive data occurs, since the main operating unit 1 is active up to clamp control signal, the OR gate 23 2, 23 3 via a signal line 8, ..., 23 16 Is supplied with a high level signal, and the AND gate 21 1 is supplied with a low level signal via the inverter 22 1 . For this reason, AND Gate 21
Output of 1 is prohibited, AND gate 23 1 has AND gate
A low-level signal is applied via the 21 1 and the inverter 22 1 . Therefore, from the OR gate 23 1 to the operation data line 5
1 to the data is output in "0", the OR gate 23 2, 2
From 3 3 , ..., 23 16 the calculation data lines 5 2 , 5 3 , ...,
Data of “1” is output to 5 16 . That is, the data clamped to "7FFF H " which is the maximum positive value as all data is stored in the register 2 or the register 3 from the operation data lines 5 1 , 5 2 , 5 3 , ..., 5 16. .

また、16ビットのデータの演算において、負のデータで
オーバーフローが生じると、主演算部1は最小クランプ
制御信号をアクティブとするから、信号ライン9及びイ
ンバータ222を介して、アンドゲート212、213、……、2
116へロウレベルの信号が与えられ、アンドゲート211
はインバータ221を介してハイレベルの信号が与えられ
る。このため、アンドゲート212、213、……、2116の出
力が禁止され、オアゲート232、233、……、2316は最大
クランプ制御信号によるロウレベルの信号を与えられ
て、演算データライン52、53、……、516へ“0”のデ
ータを出力する。また、オアゲート231はインバータ233
を介して必ずハイレベルの信号を受け取るから、演算デ
ータライン51へ“1”のデータを出力する。つまり、全
データとしては負の最小値である“8000H”へクランプ
されたデータが演算データライン51、52、53、……、5
16から、レジスタ2またはレジスタ3へ格納される。
Further, in the operation of 16-bit data, an overflow occurs in the negative data, the main calculating portion 1 since the minimum clamp control signal active, via the signal line 9 and the inverter 22 2, AND gate 21 2, 21 3 , ……, 2
A low level signal is applied to 1 16 and a high level signal is applied to the AND gate 21 1 via the inverter 22 1 . Therefore, the outputs of the AND gates 21 2 , 21 3 , ..., 21 16 are prohibited, and the OR gates 23 2 , 23 3 , ..., 23 16 are given a low level signal by the maximum clamp control signal, and the operation data line 5 2, 5 3, ..., and outputs the data of "0" to 5 16. Further, the OR gate 23 1 is an inverter 23 3
Since always receives a high level signal via the outputs data of "1" to the arithmetic data lines 5 1. In other words, the data clamped to "8000 H ", which is the minimum negative value for all data, is the calculation data lines 5 1 , 5 2 , 5 3 , ..., 5
From 16 is stored in register 2 or register 3.

従って、16ビットの演算の範囲でオーバーフローが生じ
た場合には、完全にハードウェアによるクランプ処理が
なされ、処理速度の高速化がはかられ、ソフトウェアの
負荷を軽減することができる。
Therefore, when overflow occurs in the 16-bit arithmetic range, the clamp processing is completely performed by hardware, the processing speed is increased, and the load of software can be reduced.

この演算装置において、主演算部1で演算可能なビット
である16ビットの倍の32ビットのデータとなる演算(連
結演算)を行ない、演算結果にオーバーフローが生じた
場合を説明する。例えば、レジスタ3を下位のデータ用
のレジスタとして用いると、このレジスタ3には、レジ
スタ2に格納すべきデータの演算を行なっているとき
に、既にデータが格納されている。このため、レジスタ
2のデータについて、クランプ処理をハードウェアで実
現できるが、レジスタ3のデータについてはソフトウェ
アで処理する。例えば、主演算部1に、オーバーフロー
フラグを用意して、32ビットのデータの演算でオーバー
フローが生じたときには、上記フラグをセットし、ソフ
トウェアにより、レジスタ3内のデータをクランプ処理
する。これにより、従来行なわれなかったハードウェア
によるクランプ処理を一部取入れているので、それだ
け、処理速度の高速化、ソフトウェアの負荷の軽減をは
かることができる。
A case will be described in which, in this arithmetic unit, an arithmetic operation (concatenation arithmetic operation) is performed which becomes data of 32 bits which is double the 16 bits which can be operated by the main arithmetic unit 1 and an overflow occurs in the operation result. For example, when the register 3 is used as a lower data register, the data is already stored in the register 3 when the data to be stored in the register 2 is being calculated. Therefore, the clamp processing can be realized by hardware for the data of the register 2, but the data of the register 3 is processed by software. For example, an overflow flag is prepared in the main operation unit 1, and when an overflow occurs in the operation of 32-bit data, the flag is set and the data in the register 3 is clamped by software. As a result, a part of the clamp processing by hardware, which has not been conventionally performed, is incorporated, so that the processing speed can be increased and the software load can be reduced accordingly.

尚、実施例においては、アンドゲート、インバータ、オ
アゲートによって、最大クランプ制御信号に基づき、主
演算部1から出力される演算結果のデータが正の最大値
のデータとなるように各ビットのデータを制御して出力
する第1の論理回路と、最小クランプ制御信号に基づ
き、主演算部1から出力される演算結果のデータが負の
最小値のデータとなるように各ビットのデータを制御し
て出力する第2の論理回路とからなる論理回路を構成し
ているが、必ずしもこれによらなくとも良い。例えば各
ゲートによる構成を変えて、同様の効果を得るようにし
ても良い。また、最大または最小の一方のデータへのみ
クランプするようにしても良い。つまり、正または負の
データの一方のみを扱う演算装置とすることもできる。
In the embodiment, the data of each bit is converted by the AND gate, the inverter and the OR gate so that the data of the operation result output from the main operation unit 1 becomes the data of the positive maximum value based on the maximum clamp control signal. Based on the first logic circuit that controls and outputs and the minimum clamp control signal, the data of each bit is controlled so that the data of the operation result output from the main operation unit 1 becomes the data of the negative minimum value. Although a logic circuit including the output second logic circuit is configured, it does not necessarily have to be based on this. For example, the same effect may be obtained by changing the configuration of each gate. Also, the data may be clamped to only one of the maximum and minimum data. That is, it is possible to use an arithmetic unit that handles only one of positive and negative data.

次に、第2図を参照して、本発明の他の一実施例を説明
する。同図において、第1図と同一の符号を付した構成
要素は、第1図と同一のものである。主演算部1′は、
最大クランプ制御信号と最小クランプ制御信号のほか
に、ADD WITH CARRY(キャリー付加算)命令を受けたと
きに、信号線10を介してADD WITH CARRY制御信号を出力
し、SUB WITH BORROW(キャリー付減算)命令を受けた
ときに、信号線11を介してSUB WITH BORROW制御信号を
出力する。ADD WITH CARRY制御信号はオアゲート241
一方の入力端子へ与えられ、SUB WITH BORROW制御信号
はオアゲート241の他方の入力端子へ与えられる。オア
ゲート242には、最大クランプ制御信号及び最小クラン
プ制御信号が与えられ、このオアゲート242の出力と上
記オアゲート241の出力とはアンドゲート251へ与えられ
る。このアンドゲート251が信号ライン12へ出力する信
号は、新入力クロック制御信号であり、キャリー付加減
算の結果の連結命令(連結演算命令)の実行中に、オー
バーフローが生じたときに、アクティブ(ハイレベル)
となる。この新入力クロック制御信号はアンドゲート25
2、排他的論理和ゲート(以下EX-ORゲートという)26へ
与えられている。アンドゲート252の他方の入力端子へ
は、クロックライン6′から、レジスタ2へ与えられる
クロックが与えられる。アンドゲート252の出力は、オ
アゲート243の一方の入力端子へ与えられ、オアゲート2
43の他方の入力端子へはクロックライン7からクロック
が与えられる。オアゲート243の出力はクロックライン1
3を介してレジスタ3へクロックとして与えられる。即
ち、レジスタ3は、第1図のように主演算部1からの演
算結果のデータを受け取るモードだけでなく、キャリー
付加減算の結果の連結命令実行時に、オーバーフローが
生じたときに、クロックライン13を介してクロックが与
えられる。また、EX-ORゲート26には、上述の新入力ク
ロック制御信号と、オアゲート231の出力とが与えられ
る。EX-ORゲート26の出力は演算データライン14を介し
て、新入力最上位ビットデータとして、レジスタ3の最
上位ビットに与えられる。新入力最上位ビットデータ
は、新入力クロック制御信号がインアクティブであれ
ば、オアゲート231の出力そのままであるが、新入力ク
ロック制御信号がアクティブであれば、正のデータによ
るオーバーフローか負のデータによるオーバーフローか
に左右される。即ち、正のデータによるオーバーフロー
のときには、オアゲート231の出力が“0”であるか
ら、EX-ORゲート26からは“1”のデータが出力され、
負のデータによるオーバーフローのときには、オアゲー
ト231の出力が“1”であるから、EX-ORゲート26からは
“0”のデータが出力される。
Next, another embodiment of the present invention will be described with reference to FIG. In the figure, the components designated by the same reference numerals as those in FIG. 1 are the same as those in FIG. The main arithmetic unit 1'is
In addition to the maximum clamp control signal and the minimum clamp control signal, when an ADD WITH CARRY (addition with carry) command is received, the ADD WITH CARRY control signal is output via signal line 10, and SUB WITH BORROW (subtraction with carry) ) When receiving the command, the SUB WITH BORROW control signal is output via the signal line 11. The ADD WITH CARRY control signal is applied to one input terminal of the OR gate 24 1 , and the SUB WITH BORROW control signal is applied to the other input terminal of the OR gate 24 1 . The OR gate 24 2, maximum clamp control signal and the minimum clamp control signal is given, is applied to the AND gate 25 1 and the output of the OR gate 24 and second output and the OR gate 24 1. Signal the AND gate 25 1 is output to the signal line 12 is a new input clock control signal, during the execution results linking instructions carry with addition and subtraction (concatenation operation instruction), when an overflow occurs, the active ( high level)
Becomes This new input clock control signal is AND gate 25
2 , given to the exclusive OR gate (hereinafter referred to as EX-OR gate) 26. To the AND gate 25 2 of the other input terminal, a clock line 6 'is given clock supplied to the register 2. The output of the AND gate 25 2 is given to one input terminal of the OR gate 24 3 and
4 clock is applied from the clock line 7 3 to the other input terminal. The output of OR gate 24 3 is clock line 1
It is given as a clock to register 3 via 3. That is, the register 3 is not only in the mode for receiving the data of the operation result from the main operation unit 1 as shown in FIG. 1, but also when the overflow occurs at the time of executing the concatenation instruction of the result of the carry addition / subtraction, the clock line 13 The clock is given via. In addition, the EX-OR gate 26, and a new input clock control signal described above, the output is given OR gate 23 1. The output of the EX-OR gate 26 is given to the most significant bit of the register 3 as new input most significant bit data via the operation data line 14. New input the most significant bit data, if a new input clock control signal is inactive, but as it is the output of the OR gate 23 1, if the new input clock control signal is active, positive overflow or negative data by the data It depends on the overflow. That is, at the overflow due to positive data, the output of the OR gate 23 1 is “0”, and therefore the data of “1” is output from the EX-OR gate 26.
At the overflow due to the negative data, the output of the OR gate 23 1 is "1", so that the EX-OR gate 26 outputs the data of "0".

この演算装置による16ビットのデータの演算は第1図と
同様である。この演算装置において、連結演算命令(こ
の実施例では、32ビットのデータとなる演算命令)が行
なわれ、オーバーフローが生じた場合を説明する。既
に、レジスタ3へはデータが格納されている。
The arithmetic operation of 16-bit data by this arithmetic unit is the same as in FIG. A case will be described in which a concatenation operation instruction (in this embodiment, an operation instruction that becomes 32-bit data) is executed in this arithmetic unit and an overflow occurs. Data has already been stored in the register 3.

今、ADD WITH CARRY命令が出されていたとすると、主演
算部1′は信号ライン10からADD WITH CARRY制御信号を
アクティブとして出力する。また、正のデータでオーバ
ーフローが生じたとすると、主演算部1′は信号ライン
8へ最大クランプ制御信号をアクティブとして出力す
る。すると、信号ライン8を介してオアゲート232、2
33、……、2316にはハイレベルの信号が与えられ、アン
ドゲート211にはインバータ221を介してロウレベルの信
号が与えられる。このため、アンドゲート211の出力が
禁止され、オアゲート231には、アンドゲート211及びイ
ンバータ223を介してロウレベルの信号が与えられる。
従って、オアゲート231から演算データライン51へは
“0”のデータが出力され、オアゲート232、233、…
…、2316から演算データライン52、53、……、516へは
“1”のデータが出力される。つまり、全データとして
は正の最大値である“7FFFH”へクランプされたデータ
が演算データライン51、52、53、……、516からレジス
タ2へ、クロックライン6のクロックによって格納され
る。一方、ADD WITH CARRY制御信号と最大クランプ制御
信号がともにアクティブであるから、アンドゲート251
の出力である新入力クロック制御信号がアクティブとな
る。また、EX-ORゲート26にはオアゲート231から“0”
が与えられるから、その出力は“1”のデータとなり、
レジスタ3へはオール“1”の16ビットのデータが、ク
ロックライン6′、アンドゲート252、オアゲート243
クロックライン13を介して与えられるクロックに同期し
て格納される。従って、レジスタ2、3には、“7FF
FH”、“FFFFH”が格納され、32ビットのデータがクラ
ンプされて格納されることになる。
Now, assuming that the ADD WITH CARRY instruction has been issued, the main operation unit 1 ′ outputs the ADD WITH CARRY control signal as active from the signal line 10. If an overflow occurs in the positive data, the main arithmetic unit 1'outputs the maximum clamp control signal to the signal line 8 as active. Then, via the signal line 8, the OR gate 23 2 , 2
A high level signal is applied to 3 3 , ..., 23 16 and a low level signal is applied to the AND gate 21 1 through the inverter 22 1 . Therefore, the output of the AND gate 21 1 is prohibited, and a low level signal is given to the OR gate 23 1 via the AND gate 21 1 and the inverter 22 3 .
Therefore, the data of “0” is output from the OR gate 23 1 to the operation data line 5 1 , and the OR gates 23 2 , 23 3 , ...
, 23 16 outputs data of "1" to the operation data lines 5 2 , 5 3 , ..., 5 16 . In other words, the data clamped to "7FFF H ", which is the maximum positive value for all data, is transferred from the operation data lines 5 1 , 5 2 , 5 3 , ..., 5 16 to the register 2 by the clock on the clock line 6. Is stored. On the other hand, since both the ADD WITH CARRY control signal and the maximum clamp control signal are active, the AND gate 25 1
The new input clock control signal, which is the output of, becomes active. In addition, the EX-OR gate 26 has “0” from the OR gate 23 1.
Is given, the output becomes the data of "1",
16-bit data of all "1" is input to the register 3 by the clock line 6 ', AND gate 25 2 , OR gate 24 3 ,
It is stored in synchronism with the clock applied via the clock line 13. Therefore, the registers 2 and 3 contain "7FF
F H "," FFFF H "is stored, so that the 32-bit data is stored is clamped.

次に、SUB WITH BORROW命令が出されていたとすると、
主演算部1′は信号ライン11からSUB WITH BORROW制御
信号をアクティブとして出力する。また、負のデータで
オーバーフローが生じると、主演算部1′は最小クラン
プ制御信号をアクティブとするから、信号ライン9及び
インバータ222を介して、アンドゲート212、213、…
…、2116へロウレベルの信号が与えられ、アンドゲート
211にはインバータ221を介してハイレベルの信号が与え
られる。このため、アンドゲート212、213、……、2116
の出力が禁止され、オアゲート232、233、……、2316
最大クランプ制御信号によるロウレベルの信号を与えら
れて、演算データライン52、53、……、516へ“0”の
データを出力する。また、オアゲート231はインバータ2
33を介して必ずハイレベルの信号を受け取るから、演算
データライン51へ“1”のデータを出力する。つまり、
全データとしては負の最小値である“8000H”へクラン
プされたデータが演算データライン51、52、53、……、
516から、レジスタ2へクロックライン6のクロックに
よって格納される。一方、SUB WITH BORROW制御信号と
最小クランプ制御信号がともにアクティブであるから、
アンドゲート251の出力である新入力クロック制御信号
がアクティブとなる。また、EX-ORゲート26には、オア
ゲート231から“1”が与えられるから、その出力は
“0”のデータとなり、レジスタ3へはオール“0”の
16ビットのデータが、クロックライン6′、アンドゲー
ト252、オアゲート243、クロックライン13を介して与え
られるクロックに同期して格納される。従って、レジス
タ2、3には、“8000H”、“0000H”が格納され、32ビ
ットのデータがクランプされて格納されたことになる。
Next, if the SUB WITH BORROW command was issued,
The main operation unit 1'outputs the SUB WITH BORROW control signal as active from the signal line 11. When the negative data overflows, the main arithmetic unit 1'activates the minimum clamp control signal. Therefore, the AND gates 21 2 , 21 3 , ... via the signal line 9 and the inverter 22 2 .
The low-level signal is given to 21 16 and AND gate
A high-level signal is given to 21 1 via an inverter 22 1 . Therefore, AND gate 21 2 , 21 3 , ……, 21 16
Is prohibited, and the OR gates 23 2 , 23 3 , ..., 23 16 are given a low level signal by the maximum clamp control signal, and "0" is input to the operation data lines 5 2 , 5 3 , ..., 5 16 . The data of is output. Further, the OR gate 23 1 is the inverter 2
Since always receives a high level signal through the 3 3, and outputs the data of "1" to the arithmetic data lines 5 1. That is,
The data clamped to "8000 H ", which is the negative minimum value for all data, is the calculation data line 5 1 , 5 2 , 5 3 , ...,
From 5 16 it is stored in register 2 by the clock on clock line 6. On the other hand, since both the SUB WITH BORROW control signal and the minimum clamp control signal are active,
New input clock control signal which is the output of the AND gate 25 1 is active. Further, since the EX-OR gate 26 is supplied with "1" from the OR gate 23 1 , its output becomes data of "0" and all "0" is stored in the register 3.
16-bit data is stored in synchronism with the clock given through the clock line 6 ', the AND gate 25 2 , the OR gate 24 3 , and the clock line 13. Therefore, the register 2,3, "8000 H", " 0000 H" is stored, so that the 32-bit data is stored is clamped.

このように、本実施例によれば、16ビットの範囲でのオ
ーバーフローはもちろん、32ビットの範囲でオーバーフ
ローが生じた場合にも、完全にハードウェアによるクラ
ンプ処理がなされ、処理速度の高速化がはかられ、ソフ
トウェアの負荷を軽減することができる。また、全くソ
フトウェアによらずにクランプ処理を実行できるので演
算装置のソフトウェアの開発が極めて容易になるという
利点もある。
As described above, according to the present embodiment, not only the overflow in the 16-bit range but also the overflow in the 32-bit range is completely clamped by hardware, and the processing speed can be increased. It is possible to reduce the load on the software. Also, there is an advantage that the software of the arithmetic unit can be extremely easily developed because the clamp processing can be executed without using any software.

尚、実施例においては、オアゲート241、242、243、ア
ンドゲート251、252、EX-ORゲート26によって、第3の
論理回路を構成し、この第3の論理回路によって、既に
行なわれた演算結果のデータが格納されているレジスタ
へ、連結演算命令実行時において表わし得る最大または
最小のデータの一部のデータとなるように、各ビットの
データを制御して出力するようにしたが、第3の論理回
路は、上記作用をなすものであれば他の構成であっても
良い。
In the embodiment, the OR gates 24 1 , 24 2 , 24 3 , AND gates 25 1 , 25 2 , and EX-OR gate 26 form a third logic circuit, and the third logic circuit Data of each bit is controlled and output so that it becomes a part of the maximum or minimum data that can be represented when a concatenated operation instruction is executed, to the register that stores the data of the operation result. However, the third logic circuit may have any other structure as long as it has the above-described function.

また、第1図、第2図において、レジスタを2個とし、
別個のものを用いたが、レジスタの数に制限はなく、ま
た一連のレジスタへ所定ビットのデータを区分して保持
させる方式を採ることも可能である。
Further, in FIGS. 1 and 2, the number of registers is two,
Although separate ones are used, the number of registers is not limited, and it is also possible to adopt a system in which a predetermined bit of data is divided and held in a series of registers.

〔発明の効果〕〔The invention's effect〕

連結演算命令の場合に、下位側のnビットのデータを上
位側のnビットのデータの演算時のオーバーフロー時に
変更するので、的確な処理が可能であり、しかも、少な
くともオーバーフロー時の上位側の処理を論理回路とう
いうハードウェアで行うため処理速度が高速化され、且
つソフトウェアの負荷を軽減できる効果がある。
In the case of a concatenation operation instruction, the lower-order n-bit data is changed at the time of overflow of the upper-side n-bit data, so that accurate processing is possible, and at least the upper-side processing at the time of overflow Since it is performed by hardware called a logic circuit, the processing speed is increased and the load of software can be reduced.

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

第1図は本発明の一実施例のブロック図、第2図は本発
明の他の実施例のブロック図である。 1、1′……主演算部 2、3……レジスタ 211、212、213、……、2116,251、252……アンドゲー
ト 221、222、223……インバータ 231、232、233、……、2316,241、242、243……オアゲ
ート 26……EX−ORゲート (221、222、223、211、212、213、……、2116、231、2
32、233、……、2316)……論理回路 (241、242、243、251、252、26)……第3の論理回路
FIG. 1 is a block diagram of an embodiment of the present invention, and FIG. 2 is a block diagram of another embodiment of the present invention. 1, 1 '... Main operation unit 2, 3 ... Registers 21 1 , 21 2 , 21 3 , ..., 21 16 , 25 1 , 25 2 ... AND gate 22 1 , 22 2 , 22 3 ... Inverter 23 1 , 23 2 , 23 3 , ..., 23 16 , 24 1 , 24 2 , 24 3 ... OR gate 26 ... EX-OR gate (22 1 , 22 2 , 22 3 , 21 1 , 21 2 , 21 3 , ......, 21 16 , 23 1 , 2
3 2 , 23 3 , ……, 23 16 ) …… Logic circuit (24 1 , 24 2 , 24 3 , 25 1 , 25 2 , 26) …… Third logic circuit

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】それぞれn(nは整数)ビットのデータが
格納される第1、第2のレジスタと、 nビットのデータの演算を行い、その結果のnビットの
データを出力するとともに、演算結果にオーバーフロー
が生じたときにクランプ制御信号を出力する一方、連結
演算命令の実行に際して前記第1、第2のレジスタの一
方へクロックを与えて演算結果を格納するレジスタの選
択制御を行い、且つ、上位側のデータの演算にオーバー
フローが生じたときにはフラグのセットによりオーバー
フローを示す主演算部と、 前記クランプ制御信号を用いて、前記主演算部の出力デ
ータそのままのデータと、nビットの最大または最小の
nビットのデータとの一方を作成して前記第1、第2の
レジスタへ出力する論理回路と、 前記主制御部の連結演算命令の実行に際しての動作に呼
応して、前記フラグがセットされた場合には、前記第
1、第2のレジスタの内、下位側のデータが格納される
レジスタのデータをクランプする手段とを具備すること
を特徴とする演算装置。
1. A first register and a second register, each of which stores n (n is an integer) bit of data, and an operation of the n-bit data, and outputs the resulting n-bit data, and an operation. A clamp control signal is output when a result overflows, while a clock is applied to one of the first and second registers during execution of a concatenated operation instruction to control selection of a register for storing an operation result, and When an overflow occurs in the operation of the higher-order data, a flag is set to indicate the overflow, the clamp control signal is used, the output data of the main operation unit is unchanged, and the maximum of n bits or A logic circuit that creates one of the minimum n-bit data and outputs it to the first and second registers, and a concatenation operation instruction of the main control unit. In response to the operation at the time of execution, when the flag is set, there is provided means for clamping the data of the register in which the lower data of the first and second registers is stored. An arithmetic unit characterized by.
【請求項2】主演算部は、演算結果のデータが、正のデ
ータでオーバーフローが生じたときに出力する最大クラ
ンプ制御信号と、負のデータでオーバーフローが生じた
ときに出力する最小クランプ制御信号とを有し、 論理回路は、前記最大クランプ制御信号に基づき前記主
演算部から出力される演算結果のデータが正の最大値の
データとなるように各ビットのデータを制御して出力す
る第1の論理回路と、前記最小クランプ制御信号に基づ
き前記主演算部から出力される演算結果のデータが負の
最小値のデータとなるように各ビットのデータを制御し
て出力する第2の論理回路とからなることを特徴とする
特許請求の範囲第(1)項記載の演算装置。
2. The main arithmetic unit outputs a maximum clamp control signal when the arithmetic result data overflows with positive data and a minimum clamp control signal which outputs when the overflow occurs with negative data. The logic circuit controls and outputs each bit data so that the data of the operation result output from the main operation unit based on the maximum clamp control signal becomes the data of the positive maximum value. 1 logic circuit, and a second logic for controlling and outputting data of each bit so that the data of the operation result output from the main operation unit based on the minimum clamp control signal becomes the data of the negative minimum value. An arithmetic unit according to claim (1), characterized in that it comprises a circuit.
【請求項3】それぞれn(nは整数)ビットのデータが
格納される第1、第2のレジスタと、 nビットのデータの演算を行い、その結果のnビットの
データを出力するとともに、演算結果にオーバーフロー
が生じたときにクランプ制御信号を出力する一方、連結
演算命令の実行に際しては当該命令の実行を示す制御信
号を出力するとともに前記第1、第2のレジスタの一方
へクロックを与えて演算結果を格納するレジスタの選択
制御を行う示す主演算部と、 前記クランプ制御信号を用いて、前記主演算部の出力デ
ータそのままのデータと、nビットの最大または最小の
nビットのデータとの一方を作成して前記第1、第2の
レジスタへ出力する論理回路と、 連結演算命令の実行を示す制御信号及び前記クランプ制
御信号を受けて、これら制御信号を用いて前記主制御部
の出力を最上位ビットを制御して得た1ビットのデータ
を、前記第1、第2のレジスタの内、下位側のデータが
格納されるレジスタへ出力するとともに、上位側のレジ
スタへ与えられるクロックを下位側のデータが格納され
るレジスタへ出力する上記第3の論理回路とを具備する
ことを特徴とする演算装置。
3. A first register and a second register, each of which stores n (n is an integer) bit of data, and an operation of the n-bit data, and outputs the resulting n-bit data and the operation. When the result overflows, a clamp control signal is output, while a concatenated operation instruction is executed, a control signal indicating the execution of the instruction is output and a clock is given to one of the first and second registers. A main arithmetic unit that performs selection control of a register that stores the arithmetic result, and data that is the same as the output data of the main arithmetic unit and n-bit maximum or minimum n-bit data, using the clamp control signal. A logic circuit that creates one and outputs it to the first and second registers, a control signal indicating execution of a concatenated operation instruction, and the clamp control signal are received, and these controls are performed. 1-bit data obtained by controlling the most significant bit of the output of the main control unit using a signal is output to the register in which the lower data of the first and second registers is stored. And a third logic circuit for outputting a clock given to a register on the upper side to a register for storing data on the lower side.
【請求項4】主演算部は、演算結果のデータが、正のデ
ータでオーバーフローが生じたときに出力する最大クラ
ンプ制御信号と、負のデータでオーバーフローが生じた
ときに出力する最小クランプ制御信号とを有し、 論理回路は、前記最大クランプ制御信号に基づき前記主
演算部から出力される演算結果のデータが正の最大値の
データとなるように各ビットのデータを制御して出力す
る第1の論理回路と、前記最小クランプ制御信号に基づ
き前記主演算部から出力される演算結果のデータが負の
最小値のデータとなるように各ビットのデータを制御し
て出力する第2の論理回路とからなることを特徴とする
特許請求の範囲第(3)項記載の演算装置。
4. The main operation unit outputs a maximum clamp control signal when the operation result data overflows with positive data and a minimum clamp control signal output when the overflow occurs with negative data. The logic circuit controls and outputs each bit data so that the data of the operation result output from the main operation unit based on the maximum clamp control signal becomes the data of the positive maximum value. 1 logic circuit, and a second logic for controlling and outputting data of each bit so that the data of the operation result output from the main operation unit based on the minimum clamp control signal becomes the data of the negative minimum value. An arithmetic unit according to claim (3), characterized in that it comprises a circuit.
JP58179941A 1983-09-28 1983-09-28 Arithmetic unit Expired - Lifetime JPH0619700B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP58179941A JPH0619700B2 (en) 1983-09-28 1983-09-28 Arithmetic unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP58179941A JPH0619700B2 (en) 1983-09-28 1983-09-28 Arithmetic unit

Publications (2)

Publication Number Publication Date
JPS6072022A JPS6072022A (en) 1985-04-24
JPH0619700B2 true JPH0619700B2 (en) 1994-03-16

Family

ID=16074615

Family Applications (1)

Application Number Title Priority Date Filing Date
JP58179941A Expired - Lifetime JPH0619700B2 (en) 1983-09-28 1983-09-28 Arithmetic unit

Country Status (1)

Country Link
JP (1) JPH0619700B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003008812A (en) * 2001-06-22 2003-01-10 Ricoh Co Ltd Electronic device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS61276174A (en) * 1985-05-30 1986-12-06 Sony Corp Data detecting device
JPH0769783B2 (en) * 1987-11-16 1995-07-31 日本電気株式会社 Exception handling method
JPH0573267A (en) * 1991-09-12 1993-03-26 Sharp Corp Arithmetic processor

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57132268A (en) * 1981-02-09 1982-08-16 Victor Co Of Japan Ltd Digital signal processing circuit
JPS58115544A (en) * 1981-12-29 1983-07-09 Mitsubishi Electric Corp Arithmetic device
JPS59194244A (en) * 1983-04-18 1984-11-05 Nippon Telegr & Teleph Corp <Ntt> Multiplication processor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003008812A (en) * 2001-06-22 2003-01-10 Ricoh Co Ltd Electronic device

Also Published As

Publication number Publication date
JPS6072022A (en) 1985-04-24

Similar Documents

Publication Publication Date Title
JPS61122747A (en) Data processor
US4225934A (en) Multifunctional arithmetic and logic unit in semiconductor integrated circuit
US5757685A (en) Data processing system capable of processing long word data
US4503511A (en) Computing system with multifunctional arithmetic logic unit in single integrated circuit
US4677582A (en) Operation processing apparatus
JPH0619700B2 (en) Arithmetic unit
US4398247A (en) Control device for directing execution of forced operations in a data processing system
JPH034936B2 (en)
JPH0831033B2 (en) Data processing device
KR940009377B1 (en) Information processing apparatus
JP2557629B2 (en) Interrupt method
JP2743685B2 (en) Fixed-point processor
JP3139011B2 (en) Fixed-point processor
JPS59184944A (en) Rounding arithmetic system
JPH0233173B2 (en)
JP2693598B2 (en) Program execution controller for digital signal processor
JPS59123957A (en) Digital signal arithmetic device
JPS6111493B2 (en)
JPH02293928A (en) Microcomputer
JPS61211741A (en) Microcomputer
JPH045727A (en) Converter
JPH0498319A (en) Digital circuit
JPH0225539B2 (en)
JPH02171812A (en) Operating speed increasing circuit for processor having no wait state function
JPH03255524A (en) Adding circuit