JPS62293342A - Decimal addition/subtraction system - Google Patents
Decimal addition/subtraction systemInfo
- Publication number
- JPS62293342A JPS62293342A JP13493886A JP13493886A JPS62293342A JP S62293342 A JPS62293342 A JP S62293342A JP 13493886 A JP13493886 A JP 13493886A JP 13493886 A JP13493886 A JP 13493886A JP S62293342 A JPS62293342 A JP S62293342A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- register
- flag
- subtraction
- addition
- 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
Links
- 238000004364 calculation method Methods 0.000 claims description 7
- 238000011410 subtraction method Methods 0.000 claims description 2
- 238000007792 addition Methods 0.000 abstract description 28
- PCTMTFRHKVHKIS-BMFZQQSSSA-N (1s,3r,4e,6e,8e,10e,12e,14e,16e,18s,19r,20r,21s,25r,27r,30r,31r,33s,35r,37s,38r)-3-[(2r,3s,4s,5s,6r)-4-amino-3,5-dihydroxy-6-methyloxan-2-yl]oxy-19,25,27,30,31,33,35,37-octahydroxy-18,20,21-trimethyl-23-oxo-22,39-dioxabicyclo[33.3.1]nonatriaconta-4,6,8,10 Chemical compound C1C=C2C[C@@H](OS(O)(=O)=O)CC[C@]2(C)[C@@H]2[C@@H]1[C@@H]1CC[C@H]([C@H](C)CCCC(C)C)[C@@]1(C)CC2.O[C@H]1[C@@H](N)[C@H](O)[C@@H](C)O[C@H]1O[C@H]1/C=C/C=C/C=C/C=C/C=C/C=C/C=C/[C@H](C)[C@@H](O)[C@@H](C)[C@H](C)OC(=O)C[C@H](O)C[C@H](O)CC[C@@H](O)[C@H](O)C[C@H](O)C[C@](O)(C[C@H](O)[C@H]2C(O)=O)O[C@H]2C1 PCTMTFRHKVHKIS-BMFZQQSSSA-N 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 2
- 238000000034 method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
Abstract
Description
【発明の詳細な説明】
3、発明の詳細な説明
〔概 要〕
演算レジスタの有効桁数を超える十進数の加減算をこの
レジスタの有効桁数ごとに分割して処理するために、指
定された演算子を示すフラグをストアするレジスタを設
け、このフラグと加減算に共通の演算命令とによってこ
の分割された演算を逐次実行するようにした。[Detailed Description of the Invention] 3. Detailed Description of the Invention [Summary] In order to process additions and subtractions of decimal numbers exceeding the number of significant digits of an arithmetic register by dividing them into each number of significant digits of this register, a specified A register is provided to store a flag indicating an operator, and the divided operations are sequentially executed using this flag and an operation instruction common to addition and subtraction.
倍精度演算などの演算レジスタの有効桁数を超える桁数
の十進数の加減算を行う十進数加減算方式に関する。This invention relates to a decimal addition/subtraction method that performs addition/subtraction of decimal numbers with a number of digits exceeding the number of effective digits of an arithmetic register, such as in double-precision arithmetic.
倍精度演算などのように、演算レジスタの有効桁数を超
える桁数の十進数の演算(以下便宜」−1倍長演算、と
いう)を行う場合にはこのレジスタの有効桁数ごとに十
進数を下位桁から分割し、先ず演算される2数の」二記
レジスタの有効桁数に相当する最下位からの桁数を有す
る下位桁について指定された演算子による演算を行い、
その結果得られた桁上がりあるいは桁下がりと演算され
る2数の上位桁、ずなわち演算1/ジスタの有効桁数を
超える上位の桁の値とにより演算を行うものであるが、
このような加減算を行う場合には桁上げあるいは桁借り
用の専用加算命令、専用減算命令が必要であり、このた
め桁上がり付加算および桁下がり付減算に対して別々の
命令コードを割当てていた。When performing an operation on a decimal number with a number of digits exceeding the number of significant digits in the operation register (hereinafter referred to as "1-double precision operation" for convenience), such as double-precision operation, the decimal number is calculated for each number of significant digits in this register. is divided from the lower digits, and first performs an operation using a specified operator on the lower digits having the number of digits from the lowest order corresponding to the number of significant digits of the two registers of the two numbers to be operated,
The calculation is performed using the resulting carry or digit and the upper digits of the two numbers to be calculated, that is, the value of the upper digit that exceeds the number of effective digits of operation 1/register.
When performing such additions and subtractions, dedicated addition and subtraction instructions for carry or borrowing are required, and for this reason separate instruction codes were assigned for addition and subtraction with carry. .
本発明はこのような倍長演算を行う場合、実行される演
算の演算子とは無関係に同一の命令によって十進数の倍
長演算を行い得るようにしたものである。In the present invention, when such a double-length operation is performed, the same instruction can be used to perform the double-length operation on a decimal number, regardless of the operator of the operation to be executed.
第1図の模式的な原理図に示すように、演算命令により
指定された加減算を指示するフラグをストアするレジス
タ1を設け、演算レジスタ21.22の有効桁数ごとに
分割された演算を逐次処理する際にはこのフラグにより
指示された加算あるいは減算を実行させることにより、
同一の演算命令により加算あるいは減算を行い得るよう
にしたものである。As shown in the schematic principle diagram in Figure 1, a register 1 is provided to store flags instructing addition and subtraction specified by operation instructions, and operations divided by the number of significant digits of operation registers 21 and 22 are sequentially executed. When processing, by executing the addition or subtraction specified by this flag,
This allows addition or subtraction to be performed using the same arithmetic instruction.
なお、同図において、Mは便宜上命令レジスタの形で示
した命令コード部M1およびオペランド指定部M2をふ
くむ演算命令、AおよびBは便宜上数値レジスタの形で
示した演算すべき倍長の十進数であって、それぞれ上位
桁At、Blと下位桁A2 、B2 とからなるものと
して示してあり、演算処理の進行に応じて演算レジスタ
21.22にAl、BlおよびA、2、B2がストアさ
れ、上記演算命令の命令コード部M1をデコーダ3でデ
コードして得られた演算子を示すフラグにしたがって、
十進数演算回路4において下位桁A2.82間の演算お
よび上位桁AI、B、と桁上がりあるいは桁下がりとを
含めた演算処理が逐次行われるものである。In the figure, M is an operation instruction including an instruction code part M1 and an operand specification part M2, which are shown in the form of an instruction register for convenience, and A and B are double-length decimal numbers to be operated, shown in the form of numerical registers for convenience. are shown as consisting of upper digits At, Bl and lower digits A2, B2, respectively, and as the arithmetic processing progresses, Al, Bl and A, 2, B2 are stored in the arithmetic registers 21 and 22. , according to the flag indicating the operator obtained by decoding the instruction code part M1 of the above operation instruction with the decoder 3,
In the decimal number arithmetic circuit 4, arithmetic processing including arithmetic operations between lower digits A2 and 82, upper digits AI and B, and carry-up or down-carrying is performed sequentially.
演算命令により指定された演算子を示すフラグをフラグ
レジスタlにストアしておくことによって、演算レジス
タ21.22の有効桁数ごとに分割して逐次実行される
演算は加算あるいは減算を指定する情報を必要としない
ので、上位桁についての演算を指示する命令には加算あ
るいは減算を指定しないでも所要の処理が行われるので
、加算・減算のいずれの場合であっても同一の演算命令
を使用することができる。By storing a flag indicating the operator specified by the arithmetic instruction in the flag register l, the arithmetic operations that are divided and executed sequentially according to the number of significant digits in the arithmetic registers 21 and 22 contain information specifying addition or subtraction. is not required, so the required processing is performed even if addition or subtraction is not specified in the instruction that instructs the operation on the upper digits, so the same operation instruction is used regardless of whether it is addition or subtraction. be able to.
第2図は本発明の実施例を示すもので、第1図に示した
原理図におけるフラグレジスタ1とデコーダ3および演
算命令とから演算処理命令を生成する部分に相当するも
のである。FIG. 2 shows an embodiment of the present invention, which corresponds to the part in the principle diagram shown in FIG. 1 that generates an arithmetic processing instruction from the flag register 1, decoder 3, and arithmetic instruction.
演算命令Mの命令コード部は第1図のデコーダ3に相当
するデコーダ11によりデコードされ、正負の符号を含
まない十進数の加算を指示する処理命令ABCD (A
は加算、BCDは十進数の意味)が“1″として出力さ
れるとインバータ13、オア回路14を介して、第1図
のフラグレジスタ1に相当するフラグレジスタ12のフ
ラグを消去して“O″とし、また正負の符号を含まない
十進数の減算を指示する処理命令5BCD (Sは減算
、BCDは十進数の意味)が“1”として出力されると
オア回路14を介してフラグレジスタ12にフラグ″1
”をセントする。The instruction code part of the operation instruction M is decoded by a decoder 11 corresponding to the decoder 3 in FIG. 1, and a processing instruction ABCD (A
(BCD means addition, BCD means decimal number) is output as “1”, the flag in flag register 12 corresponding to flag register 1 in FIG. 1 is erased via inverter 13 and OR circuit 14, and “O '', and when the processing instruction 5BCD (S means subtraction, BCD means decimal number) that instructs subtraction of a decimal number that does not include positive or negative signs is output as "1", it is output to the flag register 12 via the OR circuit 14. flag ″1
” to cents.
これにより、演算命令DCEが与えられるとこのフラグ
レジスタ12のフラグの状態に応じて加算あるいは減算
が実行される。As a result, when the arithmetic instruction DCE is given, addition or subtraction is executed depending on the state of the flag in the flag register 12.
この実施例では、これらのフラグを制御する信号がOR
回路14を介してフラグレジスタ12に供給されるもの
として示してあり、さらに正負の符号材の数値を演算す
るために演算命令により指定された演算子が変換された
とき(例えば、A−(−B)→A+B)にこの変換され
た演算子により上記のフラグをセントするための演算子
選択回路15の符号出力もこのOR回路I4に供給され
るものとして示しである。In this example, the signals controlling these flags are OR
It is shown as being supplied to the flag register 12 via the circuit 14, and further when the operator specified by the operation instruction is converted to calculate the numerical value of the positive or negative sign material (for example, A-(- The sign output of the operator selection circuit 15 for setting the above-mentioned flag by the operator converted from B) to A+B) is also shown as being supplied to this OR circuit I4.
上記デコーダ11からはさらに命令コードから演算レジ
スタ(第1図の21.22)の有効桁数以内の数値を演
算する命令であることを示す出力Sと倍長演算命令であ
ることを示す出力Wが選択的に出力され、AND回路1
6.17.18.19によって」−記フラグレジスタ1
2からのフラグとこの出力SあるいはWとの論理積がと
られ、第1図の十進数演算回路4の演算処理を指示する
演算処理命令がこれらAND回路16.17.18.1
9から出力される。The decoder 11 further outputs an output S indicating that the instruction is to calculate a numerical value within the number of effective digits in the operation register (21.22 in FIG. 1) from the instruction code, and an output W indicating that it is a double-length operation instruction. is selectively output, AND circuit 1
By 6.17.18.19” - flag register 1
The AND circuit 16.17.18.1 of the flag from 2 and this output S or W is taken, and the arithmetic processing command that instructs the arithmetic processing of the decimal number arithmetic circuit 4 in FIG.
Output from 9.
有効桁数以内の演算であることを示すデコーダ11の出
力Sとフラグレジスタ12の出力との論理積をとるAN
D回路I6の出力(減算指示)DClおよび上記デコー
ダ11の出力Sとフラグレジスタ12の出力をインバー
タ20を介して論理積をとるAND回路18の出力(加
算指示)DCであるDC信号は通常の演算であることを
十進数演算回路(第1図4)に示すものであり、本発明
におけると同様に演算子を指定しない演算命令によって
このフラグレジスタI2のフラグの状態に応じた演算が
実行されるものである。AN that takes the AND of the output S of the decoder 11 and the output of the flag register 12, which indicates that the operation is within the number of effective digits.
The output (subtraction instruction) of the D circuit I6 (subtraction instruction) DCl, the output of the AND circuit 18 (addition instruction) which ANDs the output S of the decoder 11, and the output of the flag register 12 via the inverter 20. The decimal number calculation circuit (FIG. 1, 4) indicates that the operation is an operation, and as in the present invention, an operation according to the state of the flag in the flag register I2 is executed by an operation instruction that does not specify an operator. It is something that
また、倍長演算であることを示すデコーダ11の出力W
とフラグレジスタI2の出力との論理積をとるAND回
路17の出力(減算指示)DCE、および上記デコーダ
11の出力Wとフラグレジスタ12の出力をインパーク
20を介して論理積をとるAND回路19の出力(加算
指示)DCEであるDCE信号は、本発明により倍長演
算を行うことを十進数演算回路(第1図4)に指示する
ものである。Also, the output W of the decoder 11 indicating that it is a double-length operation
and the output of the flag register I2 (subtraction instruction) DCE, and the AND circuit 19 which takes the AND of the output W of the decoder 11 and the output of the flag register 12 via the impark 20. The DCE signal, which is the output (addition instruction) DCE, instructs the decimal number arithmetic circuit (FIG. 1, 4) to perform double length arithmetic according to the present invention.
上記したAおよびBの2つの数の倍長演算を行う場合の
従来のプログラムは例えば次のようになる。For example, a conventional program for performing a double-length operation on the two numbers A and B mentioned above is as follows.
BRSUB −−−−−−−−−=−−−−−
−111A D D : −−−−−−−
−−−−−+21A、 B CD −−−−
−−−−−f3)A B CD E −−−−
−−−−−−−−−(41BRNEXT −−−−−
=−一−−−−〜〜 (5)S U B :
−−−−−−−−−一一一−[61SBCD
−〜−−−−−−−−−−−−−−(71S B
CD E −−−−−−−−−−−−−−−
−(8)N E X T : −一−−−−
−−−−−−−−==−(9)これに対して本発明によ
るプログラムは、例えば、
BRSUB −−−−−−−−−−−−111
A、 D D : −−−−−−−−−−
−−+21A B CD −一−−−−−=
−−−−〜〜−−(3)B RN E W (F S
= 0 ) −−001S U B :
−−−−一=−−−−−−−(6)S B CD
−−〜−−−−−〜−=−−−−(7+NEW
: −・−−−−−−−−−−一−−aυD
CE −−−−−−−−−一=−−−−−
叩N E X T : −−−−−−−−−
−−−一〜(9)のようになる。BRSUB −−−−−−−−−=−−−−−
-111A DD: --------
−−−−−+21A, B CD −−−−
------f3) A B CD E -----
------------(41BRNEXT ------
=−1−−−−〜〜 (5) SU B:
-------------111-[61SBCD
−〜−−−−−−−−−−−−−(71S B
CD E ----------------
-(8)NEXT: -1----
−−−−−−−−==−(9) On the other hand, the program according to the present invention is, for example, BRSUB −−−−−−−−−−−111
A, DD: ------------
−−+21A B CD −1−−−−−=
−−−−〜〜−−(3) B RN E W (F S
= 0) --001SUB:
−−−−1=−−−−−−−(6) S B CD
−−〜−−−−−〜−=−−−−(7+NEW
: −・−−−−−−−−−−1−−aυD
CE −−−−−−−−−1=−−−−−
Hit NEXT: -----------
---It will be as follows from 1 to (9).
ここで、BRは分岐命令で+ilは指定された演算が減
算であれば“SUB”への分岐命令、(2)は加算処理
、(3)は十進数加算命令、(4)は倍長演算による十
進数加算命令、(5)は加算処理の終了により“NEX
T”へ分岐する命令、(6)は分岐先名、(7)は減算
命令、(8)は倍長演算による十進数減算命令、(9)
は分岐先名、0〔は”NEW″へ分岐する命令で、この
とき前記フラグレジスターのフラグは加算を示す0″で
ある。また、αυは分岐先名、α2)は本発明により加
減算に共通に使用される演算命令であり、先に説明した
ように加算か減算かはフラグレジスタのフラグにより定
められる。Here, BR is a branch instruction, +il is a branch instruction to "SUB" if the specified operation is subtraction, (2) is an addition operation, (3) is a decimal addition instruction, and (4) is a double-length operation. decimal number addition instruction, (5) is “NEX” upon completion of the addition process.
Instruction to branch to "T", (6) is the branch destination name, (7) is the subtraction instruction, (8) is the decimal subtraction instruction using double-length operation, (9)
is the branch destination name, 0[ is the instruction to branch to "NEW", and at this time, the flag in the flag register is 0'' indicating addition.Also, αυ is the branch destination name, and α2) is the instruction that is common to addition and subtraction according to the present invention. This is an arithmetic instruction used for addition and subtraction, and as explained earlier, whether it is addition or subtraction is determined by the flag in the flag register.
このように、本発明によれば命令の数が1つ減少するの
で一定数の命令上ソトであれば他の命令を追加すること
ができ、また加減算についての命令が共通に使用できる
ことから分割して演算を行う回数が多いほどプログラム
の量とステップが減少する効果が大きい。As described above, according to the present invention, since the number of instructions is reduced by one, other instructions can be added as long as the number of instructions is equal to a certain number, and since the instructions for addition and subtraction can be used in common, it is possible to divide the instructions. The greater the number of times the calculations are performed, the greater the effect of reducing the program size and steps.
第1図は本発明の原理図、第2図は本発明の実施例を示
す図である。
1はフラグレジスタ、2は演算レジスタ、3は演算命令
の命令コードをデコードするデコーダ、4は十進数演算
回路である。
OFIG. 1 is a diagram showing the principle of the present invention, and FIG. 2 is a diagram showing an embodiment of the present invention. 1 is a flag register, 2 is an arithmetic register, 3 is a decoder for decoding the instruction code of an arithmetic instruction, and 4 is a decimal number arithmetic circuit. O
Claims (1)
減算を演算レジスタ(2)の有効桁数ごとに分割して演
算を行うために、演算命令からデコーダ(3)によりデ
コードされて加算あるいは減算を指定する演算子を示す
フラグをストアするフラグレジスタ(1)を設け、加算
および減算に共通の命令と上記フラグとによって上記分
割した演算を十進数演算回路(4)が逐次実行するよう
にしたことを特徴とする十進数加減算方式。In order to perform the addition or subtraction of decimal numbers that exceed the number of valid digits in the calculation register by dividing them according to the number of valid digits in the calculation register (2), the decoder (3) decodes the calculation instruction and performs the addition or subtraction. A flag register (1) is provided to store a flag indicating a specified operator, and the decimal number calculation circuit (4) sequentially executes the divided operations using the instruction common to addition and subtraction and the flag. A decimal number addition/subtraction method featuring:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP13493886A JPS62293342A (en) | 1986-06-12 | 1986-06-12 | Decimal addition/subtraction system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP13493886A JPS62293342A (en) | 1986-06-12 | 1986-06-12 | Decimal addition/subtraction system |
Publications (1)
Publication Number | Publication Date |
---|---|
JPS62293342A true JPS62293342A (en) | 1987-12-19 |
Family
ID=15140063
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP13493886A Pending JPS62293342A (en) | 1986-06-12 | 1986-06-12 | Decimal addition/subtraction system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS62293342A (en) |
-
1986
- 1986-06-12 JP JP13493886A patent/JPS62293342A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPH0228830A (en) | Integer number dividing circuit | |
JPH034936B2 (en) | ||
JPS62293342A (en) | Decimal addition/subtraction system | |
JPH0560629B2 (en) | ||
JPS5969845A (en) | Controlling system of data driving | |
JP3252493B2 (en) | Electronic calculator and its calculation processing method | |
JPS6349259B2 (en) | ||
JPS6041102A (en) | Sequence control device | |
JP2529694B2 (en) | Standby instruction execution device for microprocessor | |
JPS6230455B2 (en) | ||
JPS62293432A (en) | Information processor | |
JPS5995646A (en) | Arithmetic control system | |
US4651295A (en) | Electronic desk-top calculator | |
JPH02297627A (en) | System for transfer of immediate data and execution of arithmetic instruction | |
JPH0991118A (en) | Floating point arithmetic unit | |
JPH01195532A (en) | Microprocessor | |
JPH04250555A (en) | Electronic computer | |
JPS62271017A (en) | Addition and subtraction device for decimal number | |
JPS58107906A (en) | Process step type programmable controller | |
JPS59105110A (en) | Programmable controller | |
JPH02284225A (en) | Arithmetic processor | |
JPH04124724A (en) | Decimal arithmetic circuit | |
JPS6383866A (en) | Vector arithmetic processing system | |
JPS6019238A (en) | Decimal arithmetic device | |
JPH0620071A (en) | Data driven information processor |