JPH04191925A - Arithmetic processor - Google Patents

Arithmetic processor

Info

Publication number
JPH04191925A
JPH04191925A JP2324827A JP32482790A JPH04191925A JP H04191925 A JPH04191925 A JP H04191925A JP 2324827 A JP2324827 A JP 2324827A JP 32482790 A JP32482790 A JP 32482790A JP H04191925 A JPH04191925 A JP H04191925A
Authority
JP
Japan
Prior art keywords
result
zero
subtraction
arithmetic
decimal
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
JP2324827A
Other languages
Japanese (ja)
Inventor
Masahiro Ikeda
昌弘 池田
Nobuyoshi Sato
信義 佐藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2324827A priority Critical patent/JPH04191925A/en
Publication of JPH04191925A publication Critical patent/JPH04191925A/en
Pending legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To prevent the lowering of operation speed when an arithmetic result is zero by providing a holding means which is set when the arithmetic result of an arithmetic means is not zero, and hold a set state until the operation of all digits is completed and executing the zero discrimination of the arithmetic result by referring to the holding means. CONSTITUTION:When subtraction is executed materially by decimal addition/ subtraction arithmetic processing and moreover the result of it is zero, it is necessary to modify the code of the result into a positive code and when the arithmetic result by an arithmetic means 1 is any number except zero every time when an operation is executed by an arithmetic means 1, the effect of it is accumulate-held by a holding means 2. Then, the holding means 2 is referred to at the end of the operation of all digits and the holding means 2 is not set, that is, all the digits are zero, the code is modified into the positive code. Thus, the subtraction is executed materially by the decimal addition/ subtraction arithmetic processing and moreover even when the result of it is zero, the lowering of operation speed is prevented.

Description

【発明の詳細な説明】 〔概要〕 バンク形式の2進化10進数の加減演算を高速に実行す
る演算処理装置に関し、 10進加減演算処理で実質的に減算を行い、しかも結果
がゼロになるような場合であっても、演算速度が低下す
るのを防止できる演算処理装置を提供することを目的と
し、 所定桁の10進数の加減演算を行なう演算手段と、該演
算手段の演算結果がゼロでない時にセットされ、該セッ
ト状態を全桁の演算が終了するまで保持する保持手段と
、を具備し、演算結果のゼロ判定を前記保持手段を参照
することにより行なうことを特徴とする。
[Detailed Description of the Invention] [Summary] The present invention relates to an arithmetic processing device that performs addition and subtraction operations on bank-format binary coded decimal numbers at high speed, and that performs subtraction in decimal addition and subtraction processing, and furthermore, performs subtraction in such a way that the result becomes zero. The purpose of the present invention is to provide an arithmetic processing device that can prevent the arithmetic speed from decreasing even in such cases, and includes an arithmetic means for performing addition and subtraction operations on decimal numbers of predetermined digits, and an arithmetic processing device in which the arithmetic result of the arithmetic means is not zero. The present invention is characterized in that it is provided with a holding means that is set at a time and holds the set state until the calculation of all digits is completed, and a zero determination of the calculation result is performed by referring to the holding means.

〔産業上の利用分野〕[Industrial application field]

本発明は、バンク形式の2進化10進数(以下、単に「
10進数」という)の加減演算を高速に実行する演算処
理装置に関する。
The present invention is a bank-format binary coded decimal number (hereinafter simply "
The present invention relates to an arithmetic processing device that performs addition/subtraction operations on decimal numbers at high speed.

一般に、電子計算機では、事務処理を行なうプログラム
は、例えばC0BOL等の事務処理用に開発された言語
で記述されるようになっている。
Generally, in electronic computers, programs for performing office processing are written in a language developed for office processing, such as COBOL.

このような事務処理用言語を使って情報処理装置に計算
や処理をさせるためには、該情報処理装置の内部で10
進数を扱う必要がある。
In order for an information processing device to perform calculations and processing using such a language for business processing, the information processing device must have 10
It is necessary to handle decimal numbers.

このような電子計算機で取り扱う10進数の表現形式と
しで、バック形式がある。このパンク形式の10進数の
仕様について、第5図を参照しながら、以下に説明する
One of the representation formats for decimal numbers handled by such electronic computers is the back format. The specifications of this puncture format decimal number will be explained below with reference to FIG.

■各バイトは、最下位1バイトを除き上位及び下位の4
ビツトともに数字部と呼ばれ、「OM」〜’9HJ(添
字の−」は16進数であることを示ず)の何れかの値で
構成される。この数字部に’ONJ〜「9H」以外のデ
ータがきたときはデータ例外のエラーとなる。
■Each byte consists of the upper and lower 4 bytes except for the lowest 1 byte.
Both bits are called a numeric part, and are composed of any value from ``OM'' to ``9HJ'' (the subscript "-" does not indicate a hexadecimal number). If data other than 'ONJ-9H' is received in this numerical part, a data exception error will occur.

■データの最右端のバイト(最下位バイト)の下位4ビ
ア)は符号部と呼ばれ、例えば、正の数を「C8j、負
の数を「D、l」で表現する。したがって、この符号部
に’CMJ又は’DMJ以外のデータがきたときにデー
タ例外のエラーとなる。
(4) The lower 4 vias of the rightmost byte (lowest byte) of the data are called the sign part, and for example, a positive number is expressed as "C8j" and a negative number is expressed as "D, l". Therefore, when data other than 'CMJ or 'DMJ comes into this code part, a data exception error occurs.

なお、最下位ハイドの上位4ピントは数字部である。Note that the top four pinto points of the lowest hide are numeric parts.

このような10進数は可変長の取り扱いが可能であるの
が一般的であり、その長さ(桁数)は命令の一部で指定
するようになっている。
Generally, such decimal numbers can be handled with variable length, and the length (number of digits) is specified as part of the instruction.

したがって、10進数を用いて加減演算を行なう場合、
演算処理装置が一度に演算することのできるデータ幅以
上の桁数を有するデータを取り扱う場合は繰り返し実行
で指定桁の演算を行なうことになる。
Therefore, when performing addition and subtraction operations using decimal numbers,
When handling data having a number of digits greater than the data width that the arithmetic processing device can operate on at one time, the operation for the designated digits is performed repeatedly.

ところで、上記10進数の仕様では、ゼロを表す場合、
数字部は全て「09」であり、符号部は”C)IJつま
り正数として表すのが一般的であり、負のゼロは存在し
ない。
By the way, according to the above decimal specification, when representing zero,
The number part is all "09", and the sign part is generally expressed as "C)IJ", that is, a positive number, and negative zero does not exist.

したがって、演算結果が全桁ゼロとなった場合、符号部
を正にする必要がある。
Therefore, if the operation result is all digits zero, it is necessary to make the sign part positive.

〔従来の技術〕[Conventional technology]

従来、10進数の加減算は、第6図のフローチャートに
示す処理により実現されている。
Conventionally, addition and subtraction of decimal numbers has been realized by the process shown in the flowchart of FIG.

基本的には、被加数と加数の符号を調べ、同符号であれ
ば加算を、異符号であれば減算を行なうようになってい
る。
Basically, the signs of the summand and addend are checked, and if the signs are the same, addition is performed, and if they are different signs, subtraction is performed.

即ち、先ず被加数と加数の符号が共に正であるか否かを
調べ(ステップ531)、もし共に正であれば結果符号
を正、つまり’CMJとする(ステップ532)。
That is, first, it is checked whether the signs of the summand and the addend are both positive (step 531), and if both are positive, the resulting sign is set to be positive, that is, 'CMJ' (step 532).

一方、被加数と加数の符号が共に正でなければ、これら
が共に負であるか否かを調べ(ステップ533)、もし
共に負であれば結果符号を負、つまり「DH」とする(
ステップ534)。
On the other hand, if the signs of the summand and addend are both not positive, it is checked whether they are both negative (step 533), and if both are negative, the result sign is set to negative, that is, "DH". (
Step 534).

上記2ケースの場合は、以下加算を行なうことになる。In the above two cases, the following additions are performed.

なお、こ−の場合、演算前の被加数及び加数は何れも負
のゼロ(不正なデータ)ではないものとする。
In this case, it is assumed that neither the summand nor the addend before the operation is negative zero (invalid data).

上記のようにして結果の符号が決定したら符号部をマス
クして(ゼロにして)加算を行なう(ステップ535)
。そして、全桁の演算が終了したか否かを調べ(ステッ
プ536)、終了していなければ次の桁を取り出して1
0進加算を行い、結果を格納する(ステップ537)、
以下、全桁の演算の終了が判断されるまで、上記ステッ
プS36、S37を繰り返し実行し、全桁の演算の終了
が判断された時点で、一連の10進数の加減算処理を終
了する。
Once the sign of the result is determined as described above, the sign part is masked (set to zero) and addition is performed (step 535).
. Then, it is checked whether the calculation of all digits has been completed (step 536), and if it has not been completed, the next digit is taken out and 1
Perform 0-base addition and store the result (step 537);
Thereafter, steps S36 and S37 are repeatedly executed until it is determined that the calculations for all digits have been completed, and at the time it is determined that the calculations for all digits have been completed, the series of addition and subtraction processing of decimal numbers is completed.

一方、上記ステップS33で、被加数と加数の符号が共
に負でもないことが判断されると、被加数が正で加数が
負であるか否かを調べる(ステップ338)。そして、
被加数が正で加数が負であることが判断されると、結果
符号を正とする(ステップ539)、一方、ステップ5
3Bで被加数が正で加数が負でないことが判断されると
、被加数が負で加数が正であることを認識し、結果符号
を負とする(ステップ540)。
On the other hand, if it is determined in step S33 that the signs of both the summand and the addend are not negative, it is checked whether the summand is positive and the addend is negative (step 338). and,
If it is determined that the summand is positive and the addend is negative, the sign of the result is set to positive (step 539), while step 5
When it is determined in 3B that the summand is positive and the addend is not negative, it is recognized that the summand is negative and the addend is positive, and the result sign is set to negative (step 540).

以下、10進数の減算処理が行なわれることになる。Thereafter, decimal subtraction processing will be performed.

即ち、先ず、所定のレジスタaをゼロにクリアする(ス
テップ”54I)にのレジスタaは、ゼロ判定をするた
めのレジスタである。
That is, first, register a in which a predetermined register a is cleared to zero (step "54I") is a register for making a zero determination.

次いで、符号部をマスクして10進減算を行い、その結
果を格納する(ステップ542)。そして、上記減算結
果とレジスタの内容との論理和(記号ry、で示す)を
とり、その結果をレジスタaに格納する(ステップ54
3)。
Next, the code part is masked, decimal subtraction is performed, and the result is stored (step 542). Then, the logical sum (indicated by the symbol ry) of the above subtraction result and the contents of the register is taken, and the result is stored in register a (step 54
3).

そして、全ての桁の演算が終了したか否かを調べ(ステ
ップ544)、終了していなければ次の桁を取り出して
10進減算を行い、結果を格納する(ステップ545)
。次いで、上記減算結果とレジスタの内容との論理和を
とり、その結果をレジスタaに格納する(ステップ54
6)。
Then, it is checked whether the calculation of all digits has been completed (step 544), and if it has not been completed, the next digit is taken out, decimal subtraction is performed, and the result is stored (step 545).
. Next, the result of the subtraction is logically summed with the contents of the register, and the result is stored in register a (step 54).
6).

以下、全桁の演算の終了が判断されるまで、上記ステッ
プ544〜S46を繰り返し実行し、全桁の演算の終了
が判断された時点で、最終桁の減算で減算結果がゼロ以
上であったか否かを調べる(ステップ547)。そして
、ゼロ以上であったことが判断されると、ボロー無しで
減算が終了したことを意味するので、レジスタaの内容
がゼロであるか否かを調べ(ステップ550)、ゼロで
ないことが判断されるとそのまま一連の10進数の加減
算処理を終了する。
Thereafter, the above steps 544 to S46 are repeatedly executed until it is determined that the operation for all digits is completed, and at the time it is determined that the operation for all digits is completed, it is determined whether or not the subtraction result in the subtraction of the last digit is greater than or equal to zero. (Step 547). If it is determined that the value is greater than or equal to zero, it means that the subtraction has been completed without borrowing, so it is checked whether the contents of register a are zero (step 550), and it is determined that it is not zero. When this happens, the series of addition and subtraction processing of decimal numbers is completed.

一方、レジスタaの内容がゼロであることが判断される
と、結果符号を正にする(ステップ551)。これは、
上記ステップS40で予め結果符号を負りこしている場
合があるので、演算結果がゼロの場合は正符号に修正す
るために行なうものである。
On the other hand, if it is determined that the contents of register a are zero, the result sign is made positive (step 551). this is,
Since the sign of the result may have been assigned in advance in step S40, if the result of the operation is zero, this is done to correct it to a positive sign.

また、上記ステ、ブS47で、最終桁の減算の結果がゼ
ロより小さいことが判断されると、被減数の絶対値が減
数の絶対値より小さいことを意味するので、補数演算を
行なう(ステップ348)。
Further, if it is determined in step S47 that the result of subtraction of the last digit is smaller than zero, this means that the absolute value of the minuend is smaller than the absolute value of the subtrahend, so a complement calculation is performed (step 348). ).

この補数演算は、先に演算した結果の10の補数をとる
処理であり、実際には、10進数のゼロから演算結果を
減算する処理を行なうものである。
This complement calculation is a process of taking the 10's complement of the result of the previous calculation, and is actually a process of subtracting the calculation result from decimal zero.

そして、結果符号を反転しくステップ549)、一連の
10進数の加減算処理を終了する。
Then, the sign of the result is inverted (step 549), and the series of addition and subtraction processing of decimal numbers is completed.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

このように、10進数の加減算処理では、実質的に減算
を行なうことがあるので、結果が全てゼロになる場合も
発生し、この場合符号部を正にする修正が必要である。
In this way, in addition and subtraction processing of decimal numbers, since subtraction may actually be performed, the result may be all zero, and in this case, it is necessary to correct the sign part to make it positive.

したがって、結果がゼロであるか否かを調べるため、1
0進演算処理中の10進減算の途中結果の論理和の蓄積
を必要としていた。したがって、演算ループ中に論理和
をとるステップが必要となり、演算速度が低下するとい
う欠点があった。
Therefore, to check whether the result is zero, 1
It was necessary to accumulate the logical sum of intermediate results of decimal subtraction during decimal arithmetic processing. Therefore, a step of calculating a logical sum is required during the calculation loop, which has the disadvantage of reducing the calculation speed.

本発明は、上記事情に鑑みて成されたもので、10進加
減演算処理で実質的に減算を行い、しかも結果がゼロに
なるような場合であっても、演算速度が低下するのを防
止できる演算処理装置を提供することを目的とする。
The present invention has been made in view of the above circumstances, and prevents the calculation speed from decreasing even when subtraction is actually performed in decimal addition/subtraction processing and the result is zero. The purpose is to provide an arithmetic processing device that can perform the following tasks.

〔課題を解決するための手段〕[Means to solve the problem]

本発明の演算処理装置は、第1図に原理的に示すように
、所定桁の10進数の加減演算を行なう演算手段1と、
該演算手段1の演算結果がゼロでない時にセットされ、
該セット状態を全桁の演算が終了するまで保持する保持
手段2と、を具備し、演算結果のゼロ判定を前記保持手
段2を参照することにより行なうことを特徴とする。
The arithmetic processing device of the present invention, as shown in principle in FIG.
Set when the calculation result of the calculation means 1 is not zero,
It is characterized by comprising a holding means 2 that holds the set state until the calculation of all digits is completed, and by referring to the holding means 2, the judgment of zero of the calculation result is performed.

〔作用〕[Effect]

10進加減演算処理で実質的に減算を行い、しかも結果
がゼロになるような場合は結果の符号を正符号に修正す
る必要があるが、演算手段1で演算を行なう都度、該演
算手段1での演算結果がゼロ以外であれば、その旨を保
持手段2に累積保持し、全桁の演算の紡了時に該保持手
段2を参照し、該保持手段2がセットされていなければ
、っまり全桁がゼロであれば符号を正符号に修正するよ
うにしたものである。
If subtraction is actually performed in decimal addition/subtraction processing and the result is zero, it is necessary to correct the sign of the result to a positive sign. If the calculation result in is other than zero, that fact is cumulatively stored in the holding means 2, and when the calculation of all digits is completed, the holding means 2 is referred to, and if the holding means 2 is not set, the Therefore, if all digits are zero, the sign is modified to a plus sign.

〔実施例〕〔Example〕

以下、図面を参照しながら本発明の一実施例について説
明する。
An embodiment of the present invention will be described below with reference to the drawings.

第2図は、本発明の実施例の構成を示すブロック図であ
る。なお、以下の説明においては、1回で1バイト(1
0進数2桁)の演算を行なう場合について説明する。
FIG. 2 is a block diagram showing the configuration of an embodiment of the present invention. In the following explanation, 1 byte (1
A case will be described in which an operation is performed using a 2-digit 0-decimal number.

図において、10は1バイトのXバスであり、被加数又
は被減数が供給されるものである。11は1バイトのY
バスであり、加数又は減数が供給されるものである。
In the figure, 10 is a 1-byte X bus to which an addend or a minuend is supplied. 11 is 1 byte Y
bus, which supplies the addend or subtrahend.

上記Xバス10はセレクタ12に接続されると共に、こ
のXバス10には10進数検査回路(DCK)13、及
び+6回路(+6)14が接続されるようになっている
。同様に、上記Yバス11はセレクタ15に接続される
と共に、このYハス11には10進数検査回路(DCK
’)16、及び補数回路(CMP)17が接続されるよ
うになっている。
The X bus 10 is connected to a selector 12, and a decimal check circuit (DCK) 13 and a +6 circuit (+6) 14 are also connected to the X bus 10. Similarly, the Y bus 11 is connected to the selector 15, and this Y bus 11 has a decimal number check circuit (DCK
) 16 and a complement circuit (CMP) 17 are connected.

上記10進数検査回路13.16は、10進数データの
正当性を検査するものであり、10進数データの数字部
に「OH」〜「9H」以外の不正データがあるか否か、
また符号部に「CsJ、’D)IJ基以外不正データが
あるか否かを検査し、もし不正データがあれば、その旨
を制御部(図示しない)に通知するものである。これは
、通常、10進数データ例外の割り込みとして通知され
る。
The decimal number checking circuits 13 and 16 test the validity of the decimal number data, and check whether there is any invalid data other than "OH" to "9H" in the numeric part of the decimal number data.
It also checks whether there is invalid data other than the "CsJ, 'D) IJ base" in the code section, and if there is invalid data, it notifies the control section (not shown) to that effect. Normally, this is notified as a decimal data exception interrupt.

+6回路14は、Xハス10の内容、つまり被加数に「
68」を加えて出力するものである。この+6回路14
は、被加数に予め「6H」を加えて加数と加算すること
により、lO進数としての次桁への桁上がりがあったか
否かを調べるために使用される。
The +6 circuit 14 adds "
68'' is added and output. This +6 circuit 14
is used to check whether there has been a carry to the next digit as a lO base number by adding "6H" to the summand in advance and adding it to the addend.

補数回路17は、Yバス11の内容、つまり加数の2の
補数をとって出力するものである。被加数とこの補数回
路17で補数をとられた加数とを加算することにより減
算を可能にしている。
The complement circuit 17 takes the two's complement of the contents of the Y bus 11, that is, the addend, and outputs it. Subtraction is made possible by adding the summand and the addend complemented by the complement circuit 17.

セレクタ12は、Xバス10の内容又は+6回路】4の
出力の何れかを選択して算術論理演算ユニット(以下、
rALUJという)1のX入力に供給するものである。
The selector 12 selects either the contents of the X bus 10 or the output of the
rALUJ) 1 is supplied to the X input.

同様に、セレクタ15は、Yハス11の内容又は補数回
路17の出力の何れかを選択してALUIの7人力に供
給するものである。
Similarly, the selector 15 selects either the contents of the Y lotus 11 or the output of the complement circuit 17 and supplies it to the seven ALUIs.

ALIJIは、算術演算又は論理演算を実行するもので
あり、演算結果は0端子から出力されるようになってい
る。また、演算時に発生したキャリー信号は、キャリー
ビット保持回路19に供給されるようになっている。
ALIJI executes arithmetic operations or logical operations, and the operation results are output from the 0 terminal. Further, a carry signal generated during calculation is supplied to a carry bit holding circuit 19.

キャリーピント保持回路19は、上記したように、演算
ムこより発生したキャリー信号を保持するものであり、
マイクロプログラムはこのキャリーピント保持回路19
の内容を調べることにより、桁上がりの有無を知ること
ができるようになっている。
As mentioned above, the carry focus holding circuit 19 holds the carry signal generated by the calculation unit.
The microprogram is this carry focus holding circuit 19
By checking the contents of , it is possible to know whether there is a carry or not.

上記ALUIの出力は、セレクタ20に供給されるとと
もに、−6回路(−6)21に供給されるようになって
いる。
The output of the ALUI is supplied to the selector 20 and also to the -6 circuit (-6) 21.

一6回路21は、ALUIの出力を「−6」するもので
あり、上記+6回路14とともに10進数演算時の補正
を行なうために使用されるものである。即ち、上記+6
回路14で「+6」された被加数に加数を加算した結果
、キャリーが発生すれば得られた結果は正しい10進数
であるが、キャリーが発生しなければ、先に「+6jさ
れているので加算結果をr−6JLなければ正しい10
進数が得られない。この−6回路21は、かかる場合に
動作して正しい結果を得るために使用されるものである
The -6 circuit 21 is for adding "-6" to the output of the ALUI, and is used together with the +6 circuit 14 to perform correction during decimal calculation. That is, the above +6
As a result of adding the addend to the summand that has been increased by 6 in circuit 14, if a carry occurs, the result obtained is a correct decimal number, but if no carry occurs, the result is a decimal number that has been previously increased by 6j. Therefore, if the addition result is not r-6JL, it is correct 10.
I can't get a base number. This -6 circuit 21 is used to operate in such a case and obtain correct results.

セレクタ20は、演算結果としてALUIの出力をその
まま用いるか、−6回路21の出力を用いるかを選択す
るものである。このセレクタ20の出力が最終的な演算
結果となる。
The selector 20 selects whether to use the output of the ALUI as it is or to use the output of the -6 circuit 21 as the calculation result. The output of this selector 20 becomes the final calculation result.

22はゼロフラグ回路(ZR)であり、セレクタ20の
出力、つまり演算結果がゼロの場合にセットされるフラ
グであり、1サイクル毎に変化するものである。マイク
ロプログラムはこのゼロフラグ回路22の内容を調べる
ことにより、直前に行なった演算がゼロであるか否かを
知ることができるようζこなっている。
A zero flag circuit (ZR) 22 is a flag that is set when the output of the selector 20, that is, the calculation result is zero, and changes every cycle. By checking the contents of this zero flag circuit 22, the microprogram is designed to be able to know whether or not the most recently executed operation is zero.

2は、この発明の特徴に直接関係する累積ゼロフラグ回
路(ADDINZフラグ回路)である。
2 is an cumulative zero flag circuit (ADDINZ flag circuit) which is directly related to the features of the present invention.

このADDINZフラグ回路2の詳細な構成を第3図に
示す。
The detailed configuration of this ADDINZ flag circuit 2 is shown in FIG.

即ち、ADDINZフラグ回路2は、ORゲート31.
34、ANDゲート32.33及びDタイプのフリップ
フロップ35が図示するように接続されて構成される。
That is, the ADDINZ flag circuit 2 operates as the OR gate 31 .
34, AND gates 32, 33, and a D type flip-flop 35 are connected as shown in the figure.

ORゲート31にはセレクタ20の出力(8ビツト)が
供給されるようになっている。したがって、セレクタ2
0の出力が1ビツトでもオンになっていれば、該ORゲ
ート31の出力がオンになる。このORゲート31の出
力は、ANDゲート32に供給される加算信号がオンで
あれば、3B ANDゲート32を通過し、ORゲート
34を介してフリップフロップ35に供給される。上記
加算信号はゼロ判定のタイミングを与えるもので、演算
結果がセレクタ20から出力されるタイミングでオンに
なる信号である。これにより、ORゲート31の出力が
オン、つまりALU 1の演算結果がゼロでなければフ
リップフロップ35がセットされることになる。
The output (8 bits) of the selector 20 is supplied to the OR gate 31. Therefore, selector 2
If even one bit of the 0 output is turned on, the output of the OR gate 31 is turned on. The output of this OR gate 31 passes through the 3B AND gate 32 and is supplied to the flip-flop 35 via the OR gate 34 if the addition signal supplied to the AND gate 32 is on. The addition signal provides the timing for zero determination, and is a signal that turns on at the timing when the calculation result is output from the selector 20. As a result, the flip-flop 35 is set unless the output of the OR gate 31 is on, that is, the calculation result of the ALU 1 is zero.

このフリップフロップ35は一旦セットされると、リセ
ット信号がアクティブ(Hレベル)にならない限り、A
NDゲート33及びORゲート34を介してフィードバ
ックされ、自己保持動作を行なう。
Once this flip-flop 35 is set, unless the reset signal becomes active (H level), the A
It is fed back through the ND gate 33 and the OR gate 34 to perform a self-holding operation.

次に、上記構成において、第4図のフローチャートを参
照しながら動作について説明する。
Next, the operation of the above configuration will be described with reference to the flowchart of FIG. 4.

基本的には、従来と同様に、被加数と加数の符号を調べ
、同符号であれば加算を、異符号であれば減算を行なう
ようになっており、処理内容は第6図に示したものと類
似の処理となっている。
Basically, as in the past, the signs of the summand and addend are checked, and if the signs are the same, addition is performed, and if they are different signs, subtraction is performed.The processing details are shown in Figure 6. The processing is similar to that shown.

即ち、先ず被加数と加数の符号が共に正であるか否かを
調べ(ステップ5ll)、もし共に正であれば結果符号
を正、つまり「CイJとする(ステップ512)。
That is, first, it is checked whether the signs of the summand and the addend are both positive (step 5ll), and if both are positive, the resulting sign is set to be positive, that is, "C i J" (step 512).

一方、被加数と加数の符号が共に正でなければ、これら
が共に負であるか否かを調べ(ステップ513)、もし
共に負であれば結果符号を負、つまり’DMJとする(
ステップ514)。
On the other hand, if the signs of the summand and addend are both not positive, it is checked whether they are both negative (step 513), and if both are negative, the result sign is negative, that is, 'DMJ' (
Step 514).

上記2ケースの場合は、以下加算を行なうことになる。In the above two cases, the following additions are performed.

なお、この場合、演算前の被加数及び加数は何れも負の
ゼロ(不正なデータ)ではないものとする。
In this case, it is assumed that neither the summand nor the addend before the operation is negative zero (invalid data).

上記結果の符号が決まったら、符号部をマスクして(ゼ
ロにして)加算を行なう(ステップ515)。この加算
にあたっては、先ず、被加数がXバス10に、加数がY
バス11にそれぞれ供給される。そして、10進数検査
回路13.16で被加数及び加数が正しい10進数であ
るか否かがチエツクされる。このとき、正しい10進数
でないことが判断されると、以下の処理は中止され、例
えば割り込みにより制御部に通知される。
Once the sign of the above result is determined, the sign part is masked (set to zero) and addition is performed (step 515). For this addition, first, the summand is placed on the X bus 10, and the addend is placed on the Y bus 10.
The signals are supplied to the bus 11 respectively. Then, the decimal number checking circuits 13 and 16 check whether the summand and the addend are correct decimal numbers. At this time, if it is determined that the decimal number is not correct, the following processing is stopped and the control unit is notified, for example, by an interrupt.

被加数及び加数が共に正しい10進数であれば、セレク
タ12は+6回路14の出力をALLIIのX入力に供
給する。即ち、被加数に「6」を加えた値が被加数とな
る。一方、セレクタ15はYパスの内容をそのままAL
UIのY入力に供給する。
If both the summand and the addend are correct decimal numbers, the selector 12 supplies the output of the +6 circuit 14 to the X input of ALLII. That is, the value obtained by adding "6" to the summand becomes the summand. On the other hand, the selector 15 AL
Feed to Y input of UI.

そして、ALUlで加算が行なわれ、結果が0端子から
出力される。この際、キャリーがあれば、その旨がキャ
リービット回路19にセットされる。
Then, addition is performed in ALU1, and the result is output from the 0 terminal. At this time, if there is a carry, that fact is set in the carry bit circuit 19.

このキャリービット回路19に保持されたデータはセレ
クタ20の選択信号として用いられる。
The data held in the carry bit circuit 19 is used as a selection signal for the selector 20.

即ち、キャリーピント回路19の値がrl」であればセ
レクタ20はALUIの出力を選択し、r□、であれば
−6回路21の出力を選択して出力する。このセレクタ
20の出力が演算結果となる。
That is, if the value of the carry focus circuit 19 is rl, the selector 20 selects the output of ALUI, and if it is r□, the output of the -6 circuit 21 is selected and output. The output of this selector 20 becomes the calculation result.

ADDINZフラグ回路2の内部のフリップフロップ3
5は、演算結果がゼロでなければセットされ、ゼロであ
れば元の状態を維持する。なお、このフリップフロップ
35は、演算を開始する前にリセット信号によりクリア
されているものとする。
Flip-flop 3 inside ADDINZ flag circuit 2
5 is set if the operation result is not zero, and if it is zero, the original state is maintained. It is assumed that this flip-flop 35 has been cleared by a reset signal before starting the calculation.

次いで、命令で与えられた全桁の演算が終了したか否か
を調べ(ステップ316)、終了していなければ次の1
バイトを取り出して10進加算を行い、結果を格納する
(ステップ517)。この加算も上記ステップ515と
同し動作にて行なわれる。以下、全桁の演算の終了が判
断されるまで、上記ステップS16、S17を繰り返し
実行し、全桁の演算の終了が判断された時点で、一連の
10進数の加減算処理を終了する。
Next, it is checked whether the operation of all digits given by the instruction has been completed (step 316), and if it has not been completed, the next one is
The bytes are extracted, decimal addition is performed, and the result is stored (step 517). This addition is also performed in the same manner as step 515 above. Thereafter, steps S16 and S17 are repeatedly executed until it is determined that the calculations for all digits have been completed, and at the time it is determined that the calculations for all digits have been completed, the series of addition and subtraction processing of decimal numbers is completed.

一方、上記ステップS13で、被加数と加数の符号が共
に負でもないことが判断されると、被加数が正で加数が
負であるか否かを調べる(ステップ518)、そして、
被加数が正で加数が負であることが判断されると、結果
符号を正とする(ステップ519)。一方、ステップ3
1Bで被加数が正で加数が負でないことが判断されると
、被加数が負で加数が正であることを認識し、結果符号
を負とする(ステップ520)。
On the other hand, if it is determined in step S13 that the signs of both the summand and the addend are not negative, it is checked whether the summand is positive and the addend is negative (step 518); ,
If it is determined that the summand is positive and the addend is negative, the sign of the result is set to positive (step 519). On the other hand, step 3
When it is determined in 1B that the summand is positive and the addend is not negative, it is recognized that the summand is negative and the addend is positive, and the result sign is set to negative (step 520).

以下、10進数の減算処理が行なわれることになる。Thereafter, decimal subtraction processing will be performed.

即ち、先ず、ADDINZフラグをクリアする(ステッ
プ521)。このADDINZフラグは、ADDINZ
フラグ回路2中のフリップフロップ35であり、リセッ
ト信号がLレベルになることによりクリアされる。
That is, first, the ADDINZ flag is cleared (step 521). This ADDINZ flag is
This is the flip-flop 35 in the flag circuit 2, and is cleared when the reset signal goes to L level.

次いで、符号部をマスクして10進減算を行い、結果を
格納する(ステップ522)。この減算にあたっては、
先ず、被減数がXバス10に、減数がYバス11にそれ
ぞれ供給される。そして、10進数検査回路13.16
で被減数及び減数が正しい10進数であるか否かがチエ
ツクされる。このとき、正しい10進数でないことが判
断されると、上記と同様に、以下の処理は中止され、例
えば割り込みにより制御部に通知される。
Next, the sign part is masked, decimal subtraction is performed, and the result is stored (step 522). For this subtraction,
First, the minuend is supplied to the X bus 10 and the subtrahend to the Y bus 11. And decimal check circuit 13.16
It is checked whether the minuend and the subtrahend are correct decimal numbers. At this time, if it is determined that the decimal number is not a correct decimal number, the following processing will be stopped and the control unit will be notified, for example, by an interrupt, in the same way as above.

被減数及び減数が共に正しい10進数であれば、セレク
タ12はXバス10の出力をALLIIのX入力に供給
する。一方、セレクタ15は補数回路17の出力をAL
UIのY入力に供給する。そして、ALUIで加算が行
なわれ、結果が0端子から出力される。この際、キャリ
ーがあれば、その旨がキャリービット回路19にセット
される。このキャリービット回路19に保持されたデー
タはセレクタ20の選択信号として用いられる。即ち、
キャリービット回819の値が「1」であればセレクタ
20はAL[Jlの出力を:J!択し、「OΔであれば
一6回路2]の出力を選択して出力する。
If both the minuend and the subtrahend are valid decimal numbers, selector 12 supplies the output of X bus 10 to the X input of ALLII. On the other hand, the selector 15 selects the output of the complement circuit 17 as AL
Feed to Y input of UI. Then, addition is performed in ALUI, and the result is output from the 0 terminal. At this time, if there is a carry, that fact is set in the carry bit circuit 19. The data held in the carry bit circuit 19 is used as a selection signal for the selector 20. That is,
If the value of the carry bit 819 is "1", the selector 20 outputs the output of AL[Jl:J! Select the output of "16 circuit 2 if OΔ" and output it.

このセレクタ20の出力が演算結果となる。The output of this selector 20 becomes the calculation result.

ADDINZフラグ回路2の内部のフリップフロップ3
5は、演算結果がゼロでなければセットされ、ゼロであ
れば元の状態を維持する。なお、このフリップフロ、ブ
35は、演算を開始する前にリセット信号によりクリア
されているものとする。
Flip-flop 3 inside ADDINZ flag circuit 2
5 is set if the operation result is not zero, and if it is zero, the original state is maintained. It is assumed that this flip-flop block 35 has been cleared by a reset signal before starting the calculation.

そして、全ての桁の演算が終了したか否かを調べ(ステ
ップ523)、終了していなければ次のlハイドを取り
出して10進減算を行い、結果を格納する(ステップ5
24)。以下、全桁の演算の終了が判断されるまで、上
記ステップS23、S24を繰り返し実行し、全桁の演
算の終了を判断すると、最終桁の減算で減算結果がゼロ
以上であったか否かを調べる(ステップ525)。そし
て、ゼロ以上であったことが判断されると、ボロー無し
で減算が終了したことを意味するので、へ〇〇INZフ
ラグを調べ(ステップ328)、オンであることが判断
されるとそのまま一連の10進数の加減算処理を終了す
る。
Then, it is checked whether the calculations for all digits have been completed (step 523), and if not, the next l hide is taken out, decimal subtraction is performed, and the result is stored (step 523).
24). Thereafter, the above steps S23 and S24 are repeatedly executed until it is determined that the calculation of all digits is completed, and when it is determined that the calculation of all digits is completed, it is checked whether the subtraction result is greater than or equal to zero in the subtraction of the last digit. (Step 525). If it is determined that the value is greater than or equal to zero, it means that the subtraction has been completed without borrowing, so the 〇〇INZ flag is checked (step 328), and if it is determined that it is on, the sequence continues. The addition and subtraction processing of decimal numbers is completed.

一方、ADDINZフラグがゼロであることが判断され
ると、結果符号を正にする(ステップ529)、これは
、上記ステップS20で予め結果符号を負にしている場
合があるので、演算結果がゼロの場合は正符号に修正す
るために行なうものである。
On the other hand, if it is determined that the ADDINZ flag is zero, the result sign is made positive (step 529). This is because the result sign may have been made negative in advance in step S20, so the operation result is zero. In the case of , this is done to correct it to a plus sign.

また、上記ステップS25で、最終桁の減算の結果がゼ
ロより小さいことが判断されると、被減数の絶対値が減
数の絶対値より小さいことを意味するので、補数演算を
行なう(ステップ326)。
Furthermore, if it is determined in step S25 that the result of subtraction of the last digit is smaller than zero, this means that the absolute value of the minuend is smaller than the absolute value of the subtrahend, so a complement calculation is performed (step 326).

この補数演算は、先に演算した結果の10の補数をとる
処理であり、実際には、10進数のゼロから演算結果を
減算する処理を行なうものである。
This complement calculation is a process of taking the 10's complement of the result of the previous calculation, and is actually a process of subtracting the calculation result from decimal zero.

そして、結果符号を反転しくステップ527)、一連の
10進数の加減算処理を終了する。
Then, the sign of the result is inverted (step 527), and the series of addition and subtraction processing of decimal numbers is completed.

このように、演算結果のゼロ判定を、ADD fNZフ
ラグ回路2を用いて行なうようにしたので、第4図(ス
テップS23.524)と第6図(ステップ344〜5
46)とを対比して参照すれば明らかなように、演算ル
ープでゼロ判定用の演算結果の論理和をとるステップが
省略でき、高速に加減演算を実行できるものとなってい
る。
In this way, since the zero determination of the calculation result is performed using the ADD fNZ flag circuit 2, the difference between FIG. 4 (step S23.524) and FIG. 6 (steps 344 to 5)
46), it is possible to omit the step of calculating the logical OR of the operation results for zero determination in the operation loop, and the addition and subtraction operations can be executed at high speed.

なお、上記実施例では、1回に1バイトの演算を行なう
ハードウェア構成について説明したが、これに限定され
るものでなく、2バイト、4バイト、或いはこれ以外の
任意のバイトを演算するハードウェア構成でも同様に適
用できるものであり、上記と同様の作用・効果を奏する
Note that in the above embodiment, a hardware configuration that performs an operation on one byte at a time has been described, but the hardware configuration is not limited to this, and may also be applied to hardware that performs an operation on 2 bytes, 4 bytes, or any other byte. The present invention can be similarly applied to a hardware configuration, and produces the same actions and effects as described above.

[発明の効果] 以上、詳述したように、本発明によれば10進加減演算
処理で実質的に減算を行い、しかも結果がゼロになるよ
うな場合であっても、演算速度が低下するのを防止でき
る演算処理装置を従供することができる。
[Effects of the Invention] As detailed above, according to the present invention, even when subtraction is substantially performed in decimal addition/subtraction processing and the result is zero, the calculation speed decreases. It is possible to provide an arithmetic processing device that can prevent this.

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

第1図は本発明の原理説明図、 第2図は本発明の実施例の構成を示すブロック図、 第3図は本発明の実施例のADDINZフラグ回路の構
成を示す回路図、 第4図は本発明の実施例の動作を示すフローチャート図
、 第5図はバック形式の10進数を説明するたの図、 第6図は従来の10進加減算の動作を示すフローチャー
ト図である。 1・・・演算手段(ALU)。 2・・・保持手段(ADDINZフラグ回路)。 図中、同一符号は同−又は相当部を示す。 !45rJ’flrr)tPLll、IR図第1図 ADDINZ 7う7− Wil 5Jt−n 4A 
q第3図 出願人  冨士通株式会社  、、、、、、−1−ヘ、
代理人  弁理士 井桁貞−′−−−い゛4ニー′ オート明の失Vりの′#F八qへ 第2図 オーを唱のヂ地伊jの動r’pブU− 第4図(qの1) i−タシ明り史1亡カ1の動イγフσ−第4図(〒/)
2) バッフ脣シさJ1oシηメト( 第 5 図 Ktz)1o道噛り!へ清の動イYフσ−第6図(Tつ
1)
FIG. 1 is a diagram explaining the principle of the present invention. FIG. 2 is a block diagram showing the configuration of an embodiment of the present invention. FIG. 3 is a circuit diagram showing the configuration of an ADDINZ flag circuit according to the embodiment of the present invention. 5 is a flowchart showing the operation of the embodiment of the present invention, FIG. 5 is a diagram for explaining back format decimal numbers, and FIG. 6 is a flowchart showing the operation of conventional decimal addition and subtraction. 1...Arithmetic unit (ALU). 2... Holding means (ADDINZ flag circuit). In the figures, the same reference numerals indicate the same or corresponding parts. ! 45rJ'flrr)tPLll, IR Figure 1ADDINZ 7U7- Will 5Jt-n 4A
q Figure 3 Applicant: Fujitsu Co., Ltd., -1-f.
Agent Patent Attorney Sada Igeta -'---I゛4 Knee' Auto-light loss V Rino'#F8q to recite Figure 2 O, where Ij's movement r'p B-U- No. 4 Figure (1 of q)
2) Buff Length J1o Shimet (Fig. 5 Ktz) 1o Road Biting! Hesei's movement i Yfu σ - Figure 6 (T 1)

Claims (1)

【特許請求の範囲】 所定桁の10進数の加減演算を行なう演算手段(1)と
、 該演算手段(1)の演算結果がゼロでない時にセットさ
れ、該セット状態を全桁の演算が終了するまで保持する
保持手段(2)と、を具備し、 演算結果のゼロ判定を前記保持手段(2)を参照するこ
とにより行なうことを特徴とする演算処理装置。
[Scope of Claims] Arithmetic means (1) for performing addition and subtraction operations on decimal numbers of predetermined digits, and is set when the arithmetic result of the arithmetic means (1) is not zero, and the set state is reached when the arithmetic operations for all digits are completed. An arithmetic processing device, comprising: a holding means (2) for holding up to a maximum of 100, and determining whether a calculation result is zero by referring to the holding means (2).
JP2324827A 1990-11-26 1990-11-26 Arithmetic processor Pending JPH04191925A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2324827A JPH04191925A (en) 1990-11-26 1990-11-26 Arithmetic processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2324827A JPH04191925A (en) 1990-11-26 1990-11-26 Arithmetic processor

Publications (1)

Publication Number Publication Date
JPH04191925A true JPH04191925A (en) 1992-07-10

Family

ID=18170125

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2324827A Pending JPH04191925A (en) 1990-11-26 1990-11-26 Arithmetic processor

Country Status (1)

Country Link
JP (1) JPH04191925A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0675767A (en) * 1992-07-28 1994-03-18 Matsushita Electric Ind Co Ltd Processor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0675767A (en) * 1992-07-28 1994-03-18 Matsushita Electric Ind Co Ltd Processor

Similar Documents

Publication Publication Date Title
US7395297B2 (en) Floating point system that represents status flag information within a floating point operand
JPH09212337A (en) Floating point processor
US4246644A (en) Vector branch indicators to control firmware
JPH0479015B2 (en)
JPH034936B2 (en)
JPH04191925A (en) Arithmetic processor
JPH1091395A (en) Processor
US4224682A (en) Pointer for defining the data by controlling merge switches
JPS62128331A (en) Information processor
US4288850A (en) Apparatus for identification and removal of a sign signal character superimposed
JP2517064B2 (en) Denormalized number processing method
CA1257706A (en) Multiprocessors on a single semiconductor chip
JPS63158626A (en) Arithmetic processing unit
JP3522387B2 (en) Pipeline arithmetic unit
JP2903529B2 (en) Vector operation method
JP3110072B2 (en) Pre-normalization circuit
JPH03217938A (en) floating point rounding normalizer
JPS6149234A (en) Multiplier circuit for floating point
JPH04245534A (en) Adder/subtractor
JPH01128129A (en) Floating point addition/subtraction device
JPH0325526A (en) Floating-point rounding system
JPS6194144A (en) Floating point adder circuit
JPH07120265B2 (en) Rounding method in binary floating point multiplication
JPS626326A (en) Arithmetic processor
JPH03241421A (en) Multiplier