JPS62200917A - Data conversion method - Google Patents

Data conversion method

Info

Publication number
JPS62200917A
JPS62200917A JP4325886A JP4325886A JPS62200917A JP S62200917 A JPS62200917 A JP S62200917A JP 4325886 A JP4325886 A JP 4325886A JP 4325886 A JP4325886 A JP 4325886A JP S62200917 A JPS62200917 A JP S62200917A
Authority
JP
Japan
Prior art keywords
data
register
word
bit
area
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
JP4325886A
Other languages
Japanese (ja)
Inventor
Shoji Tashiro
田代 章二
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP4325886A priority Critical patent/JPS62200917A/en
Publication of JPS62200917A publication Critical patent/JPS62200917A/en
Pending legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To improve an arithmetic speed by executing arithmetic only to a word area in a register where a data is written possibly to omit useless arithmetic. CONSTITUTION:The arithmetic is executed only to a word area having the possibility of data write in two registers having plural word areas in the method using the registers to convert a data. An operation word location calculation circuit 113, a selector 114 and a register 115 are provided. The operation word location calculation circuit 113 is a circuit generating an operation word location DWN based on a value DPT in the pointer 103, the value DWN is a value changed sequentially vased on the value DPT and showing a maximum word area number having the possibility of data write in the register 107 at the present stage. That is, the word area having the possibility of data write is obtained in advance and the arithmetic is executed to the area only, then the useless arithmetic is omitted and the arithmetic speed is improved.

Description

【発明の詳細な説明】 〔発明の目的〕 (産業上の利用分野) 本発明はデータ変換方法、特にパイ太りデータをBCD
データに変換するためのデータ変換方法に関する。
[Detailed Description of the Invention] [Object of the Invention] (Industrial Application Field) The present invention provides a data conversion method, particularly a method for converting pie fat data into BCD.
This invention relates to a data conversion method for converting data into data.

(従来の技術) デジタルデータは計算機内部では一般にバイナリデータ
、即ち2進数として表現されるが、我々が日常用いてい
る10進数とのPA?!からBCDデータ、即ら2進化
10進数としての表現が用いられることもある。第5図
は従来の一般的なバイナリデータからBCDデータへの
変換方法を示す流れ図、第6図はこの方法に用いる変換
装置のブロック図である。
(Prior Art) Digital data is generally expressed as binary data, that is, binary numbers inside a computer, but is it different from the decimal numbers that we use on a daily basis? ! BCD data, that is, representation as a binary coded decimal number is sometimes used. FIG. 5 is a flowchart showing a conventional general method for converting binary data into BCD data, and FIG. 6 is a block diagram of a conversion device used in this method.

まず第6図の構成を簡単に説明する。いま、mバイトの
バイナリデータをnバイトのBCDデータに変換する例
について考えると、変換されるべきmバイトのバイナリ
データはレジスタ100に、変換によって得られたnバ
イトのBCDデータはレジスタ101に、それぞれ収納
される。この変換を行うために2つのレジスタ106お
よび107、ならびに加i器109が用意されている。
First, the configuration shown in FIG. 6 will be briefly explained. Now, considering an example of converting m-byte binary data to n-byte BCD data, the m-byte binary data to be converted is stored in register 100, the n-byte BCD data obtained by the conversion is stored in register 101, Each is stored. Two registers 106 and 107 and an adder 109 are provided to perform this conversion.

レジスタ106および107は、この例では32ビツト
の容めをもつワード領域(図では1バイトずつに区切ら
れて横に並んだ4つのブロックとして表わされている)
が複数ワード分互いに上下の桁関係をもたせて配された
ものである。即ち、第0ワード目(図の最下段のワード
領域)のMSBからの桁上りは第1ワード目のLSBに
繰入れられて処理される。一方、加算rA109はこの
例では32ビツトのデータどうしの加算を行う機能を有
する。カウンタ105はレジスタ106および107内
の複数のワード領域のうち、現在参照しているワード領
域を示す機能を有する。以後、カウンタ105の値をR
CT、レジスタ106および107内のカウンタ105
で示されたワード領域内のデータをRtJ (RCT)
およびRV(RCT)とあられすことにする。例えばR
u(0)は、レジスタ106の第09−ド目に格納され
ている32ビツトのデータを示す。セレクタ108はR
LJ (RCT) またはRV (RCT) のどちら
か一方のデータを選択して加算器109に与える。加算
器109のもう一方の入力には常にRV (RCT)が
与えられているた”め、加算器109はセレクタ108
の選択によって2とおりの加算を行うことができる。即
ち、RU (RCT)+RV(RCT)’j6演算と、
R゛V(RCT)十RV (RCT)なる演算のどちら
か一方を行うことができる。この加算結果ADDはRV
(RCT)の新しい値としてレジスタ107に書込まれ
る。
In this example, registers 106 and 107 are word areas with a capacity of 32 bits (in the figure, they are represented as four horizontally arranged blocks separated by 1 byte).
are arranged in multiple words with upper and lower digit relationships. That is, the carry from the MSB of the 0th word (the lowest word area in the figure) is transferred to the LSB of the 1st word and processed. On the other hand, the adder rA 109 has a function of adding 32-bit data together in this example. Counter 105 has a function of indicating the currently referenced word area among the plurality of word areas in registers 106 and 107. Thereafter, the value of the counter 105 is set to R.
CT, counter 105 in registers 106 and 107
The data in the word area indicated by RtJ (RCT)
and RV (RCT). For example, R
u(0) indicates 32-bit data stored in the 09th word of the register 106. Selector 108 is R
Data from either LJ (RCT) or RV (RCT) is selected and applied to adder 109 . Since the other input of the adder 109 is always given RV (RCT), the adder 109 is connected to the selector 108.
Two types of addition can be performed by selecting . That is, RU (RCT) + RV (RCT)'j6 operation,
Either one of the calculations R゛V(RCT)+RV(RCT) can be performed. This addition result ADD is RV
(RCT) is written to register 107 as the new value of (RCT).

なお、演算の結果生じたキャリーはフリップフロップ1
10にFCRYとして一時保持される。セレクタ111
は、加算器109が第09−ド目の加算を行うときには
Oを、第1ワード目以後の加算を行うときは1つ下のワ
ードについての加算によって生じたキャリーFCRYの
値を、それぞれ加算!!1109のLSBに与える機能
を果たす。
Note that the carry generated as a result of the operation is transferred to flip-flop 1.
10 is temporarily held as FCRY. Selector 111
When the adder 109 performs the 09th addition, O is added, and when the adder 109 performs the addition after the 1st word, it adds the carry FCRY value generated by the addition of the next lower word! ! 1109 LSB.

レジスタ100内のmバイトのバイナリデータは、上位
桁から所定ビットずつ順に取込まれ、BCDデータに変
換されてゆく。この例では上位4ビツトずつ取込むため
に、レジスタ100内のmバイトのデータは、4ビツト
ずつのセルから成るセレクタ102に移行され、ポイン
タ103によってどのセルまでのデータが取込まれたか
が示されるようになっている。取込んだ4ビツトのバイ
ナリデータZBNYは変換1104によって5ビツトか
らなるBCDデータZBCDに変換され、レジスター0
6の第0ワード目に書込まれる。このとき、レジスター
06の1つのワード領域は32ビツトから成るので、下
位5ビツトをZBCD1上位27ビツトを0とする32
ビツトのデータDBCDが実際には書込まれることにな
る。また、レジスター12にはレジスター01のバイト
数n−〇− に基づいて得られた値   −1が格納されておす、後
述するように種々の演算回数はこの値によりて制御され
ることになる。
The m-byte binary data in the register 100 is sequentially taken in by predetermined bits from the most significant digits and converted into BCD data. In this example, in order to capture the upper 4 bits at a time, the m-byte data in the register 100 is transferred to the selector 102, which consists of cells of 4 bits each, and the pointer 103 indicates up to which cell the data has been fetched. It looks like this. The captured 4-bit binary data ZBNY is converted into 5-bit BCD data ZBCD by conversion 1104, and is stored in register 0.
It is written in the 0th word of 6. At this time, one word area of register 06 consists of 32 bits, so the lower 5 bits are ZBCD1 and the upper 27 bits are 0.
Bit data DBCD will actually be written. Further, the value -1 obtained based on the number of bytes n-〇- of the register 01 is stored in the register 12. As will be described later, the number of various operations will be controlled by this value.

続いて第5図を参照して従来の変換方法の手順を示す。Next, the procedure of the conventional conversion method will be described with reference to FIG.

まずステップS1においてカウンタRCTおよびポイン
タDPTの値を初期化、即ちOにする。次にステップS
2およびS3でレジスタ106および107の各ワード
領域を初期化、即ち0にする。即ち、まずRCT−0と
して両レジスタの第Oワード目の32ビツトすべてを0
とし、順次RCTを1ずつ更新して RCT≧(′−−1)になるまで続け、必要なワード領
域の初期化を行う。ここで−「−1なる値は前述のよう
にレジスター12に格納されている値で、演算に用いら
れるワード領域数から1を減じた値に相当する。この例
ではレジスター06および107の1ワード領域は32
ビツト、即ち4バイトから成るため、nバイトのBCD
デ−タを得るためには]1個のワード領域が必要となる
。従って、第0ワード目〜第(−T−−1)ワード目ま
でのワード領域が必要となり、ステップs2.s3によ
ってこの必要なワード領域が初期化されることになる。
First, in step S1, the values of counter RCT and pointer DPT are initialized, that is, set to O. Next step S
2 and S3, each word area of registers 106 and 107 is initialized, that is, set to 0. That is, first, all 32 bits of the Oth word of both registers are set to 0 as RCT-0.
Then, RCT is sequentially updated one by one until RCT≧('--1), and necessary word areas are initialized. Here, the value -1 is the value stored in register 12 as described above, and corresponds to the value obtained by subtracting 1 from the number of word areas used in the calculation.In this example, 1 word in registers 06 and 107 The area is 32
Consists of bits, that is, 4 bytes, so n-byte BCD
To obtain data, one word area is required. Therefore, a word area from the 0th word to the (-T--1)th word is required, and step s2. This necessary word area will be initialized by s3.

次にステップS4でRCTを再びOに初期化し、ステッ
プS5でDBCDをRlJ(0)、即ちレジスター06
の第0ワード目に書込む。ここで、DBCDは前述した
ように、下位5ビツトがBCDデータZBCD、上位2
7ビツトが0から構成される32ビツトのデータである
。結局、レジスター00内のmバイトのバイナリデータ
のうちのポインタo p −r −oで示される上位4
ピッ−・のデータZBNYが変換器104で5ビツトの
BCDデータZBCDに変換され、レジスタ106の第
Oワード目の下位側5ビツトに書込まれたことになる。
Next, in step S4, RCT is initialized to O again, and in step S5, DBCD is set to RlJ(0), that is, register 06.
Write in the 0th word of Here, in DBCD, as mentioned above, the lower 5 bits are BCD data ZBCD, and the upper 2 bits are BCD data ZBCD.
This is 32-bit data with 7 bits consisting of 0. In the end, among the m bytes of binary data in register 00, the top 4 indicated by the pointer o p -r -o
The data ZBNY of the pin is converted into 5-bit BCD data ZBCD by the converter 104, and written to the lower 5 bits of the O-th word of the register 106.

続いてステップS6およびS7で両レジスタ106およ
び107どうしの加算が行われる。加算器109は32
ビツト幅の加算しかできないため、第Oワード目から第
(土−1)ワード目まで順次桁上りを考慮して加算が行
われ、その結果はレジスター07に1込まれる。はじめ
はRU(0)の下位ビットにZBCOが書込まれている
たけて、RU (0)の他のビットおよびRU(1)l
L− 〜RU(−1)、ならびにRv(0)〜一〇− RV(−1)はすべてOであるため、このステップS6
およびS7の実行は、RV (0)の下位5ビツトにZ
BCDをコピーする結果を生ずるだけである。
Subsequently, in steps S6 and S7, the registers 106 and 107 are added together. Adder 109 is 32
Since only bit width addition is possible, addition is performed sequentially from the O-th word to the (E-1)th word, taking into account carry, and the result is stored in register 07 as 1. Initially, ZBCO is written in the lower bit of RU (0), then other bits of RU (0) and RU (1)
Since L- to RU(-1) and Rv(0) to 10-RV(-1) are all O, this step S6
And the execution of S7 adds Z to the lower 5 bits of RV (0).
It only results in copying the BCD.

さて、次にレジスター00内のmバイトのバイナリデー
タから次の4ビツトが取込まれる。即ち、ステップS8
において、ポインタDPTの値が1だけ更新され、カウ
ンタRCTが0に更新される。
Next, the next 4 bits are fetched from the m-byte binary data in register 00. That is, step S8
At , the value of pointer DPT is updated by 1, and counter RCT is updated to 0.

DPT−1、即ち2回目の取込みが行われると、この取
込まれた4ビツトのバイナリデータZBNYは変換器1
04t”5ビツトのBCDデータZBCDに変換される
When DPT-1, that is, the second capture is performed, the captured 4-bit binary data ZBNY is transferred to converter 1.
04t” is converted into 5-bit BCD data ZBCD.

続いてステップS10〜s21で、レジスタ107内の
データRVを16倍する演算が行われる。
Subsequently, in steps S10 to s21, the data RV in the register 107 is multiplied by 16.

即ち、加算器109を用いてRV+RVを求めこれを新
たなRVとする操作を4回行う。これによりレジスター
07内のデータRVを16倍することができる。なお、
加算器109は32ビツト幅の加算しかできないため、
各加粋操作では第〇−」L− ワード目から第(−1)ワード目まで順次桁上りを考慮
して行われる。
That is, the operation of finding RV+RV using the adder 109 and using this as a new RV is performed four times. This allows data RV in register 07 to be multiplied by 16. In addition,
Since the adder 109 can only add 32 bits wide,
Each addition operation is performed sequentially from the 0th-"L-th word to the (-1)th word, taking into account carry.

この16倍の操作が終了すると再びステップ5へ戻るこ
とになる。即ち、変換器104で変換された新たなりC
DデータZBCDを下位5ビツトとし、残りの27ビツ
トをOとするデータDBCDがレジスタ106の10ワ
ード目に新たなRLJ (0)として書込まれる。
When this 16-fold operation is completed, the process returns to step 5 again. That is, the new C converted by the converter 104
Data DBCD, in which the lower 5 bits are D data ZBCD and the remaining 27 bits are O, is written to the 10th word of the register 106 as a new RLJ (0).

−この書込みによって第09−ド目の旧データは消去さ
れる。さて、この状態で、レジスタ107のデータRV
は、変換されるべきバイナリデータの上位4ビツトに対
応する8CDデータであり、レジスタ106の第09−
ド目のデータRLIは、次の上位4ビツトに対応するB
CDデータである。
-This writing erases the old data of the 09th-th card. Now, in this state, the data RV of register 107
is the 8CD data corresponding to the upper 4 bits of the binary data to be converted, and is the 09th-
The third data RLI corresponds to the next highest 4 bits.
This is CD data.

別言すればRVはRUに比べて4ビツト分の重みをもっ
ていることになる。ところが、RVは前述の各ステップ
で16倍した値となっているから、この4ビツト分の重
みをもった値となっている。
In other words, RV has a weight of 4 bits compared to RU. However, since RV is a value multiplied by 16 in each of the above-mentioned steps, it has a weight equal to these 4 bits.

そこでステップS6およびS7における加算では、この
重みを考慮した加算がなされることになる。
Therefore, in the additions in steps S6 and S7, the additions are performed in consideration of this weight.

このようにしてレジスタ100から4ビツトずつデータ
が取込まれ、BCDデータに変換された後、レジスタ1
07内の累積データRVに加算され、RVを16倍して
重みをもたせ、次の4ビツトのデータを取込んで同様の
処理を行うという手順が繰返されてゆく。
In this way, data is fetched from register 100 in 4-bit increments and converted to BCD data.
07, RV is multiplied by 16 to give it weight, and the next 4-bit data is taken in and the same process is repeated.

データの取込みは4ビツト、[111ち」−バイトずつ
行われるので、mバイトのデータの取込みが完了するに
は2m回の取込みが必要である。2m回の取込みが既に
終了している場合、即ちDPT=(2m−1)となった
場合は、ステップs9で本処理を終了する。この時点で
、レジスター07内にあるデータRVをレジスター01
に転送すれば、これが求めるBC()データである。
Data is fetched in units of 4 bits, [111]-bytes, so 2m times of fetching is required to complete fetching of m bytes of data. If 2m times of acquisition have already been completed, that is, if DPT=(2m-1), the process ends in step s9. At this point, data RV in register 07 is transferred to register 01.
This is the desired BC() data.

(発明が解決しようとする問題点) しかしながら上述のデータ変換方法には、無駄な演算が
含まれているため演算速度が遅いという欠点がある。こ
の無駄な演算は、第5図の流れ図において、ステップS
6およびS7におけるRUとRVとの加算演算、ならび
にステップS10乃至S21の1.6倍演算に含まれて
いる。上記加算演算はRU (RCT)+RV (RC
T)なる演算をROT−0−RCT−(ニー1)まで、
上記16倍演算&tRV (RCT)+RV (RCT
)なる演算をROT−0〜RCT−(上−1)まで、そ
れぞれ繰返し行うことになる。換言すれば、レジスター
06および107の第0ワード目から第(−L−1)ワ
ード目まで、順次桁上りを考慮しながら演算を行ってゆ
くことになる。
(Problems to be Solved by the Invention) However, the above-described data conversion method has the disadvantage that the calculation speed is slow because it includes unnecessary calculations. This wasteful calculation is performed in step S in the flowchart of FIG.
6 and S7, and the 1.6 times operation in steps S10 to S21. The above addition operation is RU (RCT) + RV (RC
T) until ROT-0-RCT-(knee 1),
Above 16 times operation & tRV (RCT) + RV (RCT
) is repeatedly performed from ROT-0 to RCT-(upper-1). In other words, operations are performed sequentially from the 0th word to the (-L-1)th word of registers 06 and 107 while taking carry into consideration.

ところが、第09−ド目についてのrIi算は常に意味
をもつことになるが、第1ワード目以後についての演算
は、演算の初期の段階では無意味なものとなる。即ち、
第1ワード目以後に最初のデータが入るのは、下位のワ
ードからの桁上りによるものであるから、例えば第1ワ
ード目が意味のある演算を行い始めるのは、第0ワード
目がオーバーフローしてキャリーが算入されてからのこ
とになる。それまではOどおしの加算を行うという無意
味な演算を続(プることになる。
However, although the rIi calculation for the 09th word always has meaning, the calculations for the first and subsequent words become meaningless at the initial stage of the calculation. That is,
The first data entered after the first word is due to a carry from the lower word, so for example, the first word starts to perform meaningful operations when the zeroth word overflows. This is after the carry is included in the calculation. Until then, we will continue to perform meaningless operations such as adding O's.

このように従来のデータ変換方法は、無駄な演算が含ま
れているため、演算速度が近いといつ問題点を有してい
たのである。
As described above, the conventional data conversion method includes unnecessary calculations, which causes problems when the calculation speeds are close.

そこで本発明は無駄な演算を省き、演算速度をより向上
させることのできるデータ変換方法を提供することを目
的とする。
Therefore, an object of the present invention is to provide a data conversion method that can eliminate unnecessary calculations and further improve calculation speed.

(発明の構成) (問題点を解決するための手段) 本発明の特徴は、複数のワード領域を、有する2つのレ
ジスタを用いてデータ変換を行う方法において、レジス
タ内のデータ書込みが行われる可能性のあるワード領域
についてのみ演算を行うようにし、演算速度の向上を図
ったものである。
(Structure of the Invention) (Means for Solving the Problems) A feature of the present invention is that in a method of performing data conversion using two registers each having a plurality of word areas, it is possible to write data in the registers. This is an attempt to improve the calculation speed by performing calculations only on word areas with certain characteristics.

(作 用) 発明が解決しようとする問題点として述べたように、従
来のデータ変換方法には、意味のない無駄な演算を行な
うという欠点がある。ここで、どの時点からどのワード
領域までが意味のある*0を行うのかという基準は、ポ
インタDPTの値によって支配される。これを第3図を
用いて説明する。いま、レジスタ100内にmバイトの
バイナリデータが図のように格納されているものとする
(Function) As described as the problem to be solved by the invention, the conventional data conversion method has the drawback of performing meaningless and wasteful calculations. Here, the criterion for determining from which point to which word area a meaningful *0 is performed is controlled by the value of the pointer DPT. This will be explained using FIG. Assume now that m bytes of binary data are stored in the register 100 as shown in the figure.

この第3図では、レジスタ100の各セルは4ビットず
つのデータ領域を示すものとする。従って各セルはDP
Tの0〜2m−1に対応する。ここで、まずDPT=5
、即ち6回目の取込みが行われた時点での演算について
考える。この場合、最大値(2’ )6のバイナリデー
タが取込まれていることになる。(2’ >6= (2
8)3であるから、このバイナリデータは必ず3バイト
のデータ領域内におさまることになる。ところでBCD
データは1バイトで102まで°の数を表現できるから
、(2)  <(102)’なる関係からこのバイナリ
データをBCDデータに変換したとしても、必ず4バイ
トのデータ領域内におさまることになる。即ち、DPT
−5までの加n演算では、第0ワードにのみデー・夕書
込みが行われ、第1ワード以後には何のデータも書込ま
れていないことがわかる。
In FIG. 3, it is assumed that each cell of the register 100 represents a data area of 4 bits each. Therefore each cell has DP
Corresponds to 0 to 2m-1 of T. Here, first, DPT=5
, that is, consider the calculation at the time when the sixth acquisition is performed. In this case, the maximum value (2') of 6 binary data is captured. (2'> 6= (2
8) Since it is 3, this binary data will definitely fit within the 3-byte data area. By the way, BCD
Since data can represent the number of degrees up to 102 in one byte, even if this binary data is converted to BCD data from the relationship (2) <(102)', it will always fit within the 4-byte data area. . That is, DPT
It can be seen that in the addition n operation up to -5, data is written only to the 0th word, and no data is written after the 1st word.

また、DPT−12、即ち13回目の取込みが行われた
時点での演算について考えると、取込まれたバイナリデ
ータの最大値は(24)13である。
Further, considering the calculation at the time of DPT-12, that is, the 13th capture, the maximum value of the captured binary data is (24)13.

(2)  <(102)’なる関係からこのバイナリデ
ータをBCDデータに変換したとしても必ず8バイトの
データ領域内におさまることになる。
(2) From the relationship <(102)', even if this binary data is converted to BCD data, it will always fit within the 8-byte data area.

このようにしてデータ書込みが行われる可能性のあるワ
ード領域をあらかじめ求めておき、これらの領域につい
てのみ演算操作を行うようにすれば、無駄な演算を省き
、演算速度の向上を図ることができる。
In this way, by determining in advance word areas where data may be written and performing calculation operations only on these areas, it is possible to eliminate unnecessary calculations and improve calculation speed. .

(実施例) 以下本発明を図示する実施例に基づいて説明する。第1
図は本発明の一実施例に係るバイナリデータからBCD
データへのデータ変換方法を示す流れ図、第2図はこの
方法に用いる変換装置のブロック図である。
(Example) The present invention will be described below based on an illustrated example. 1st
The figure shows binary data to BCD according to an embodiment of the present invention.
FIG. 2 is a flowchart showing a method of converting data into data, and FIG. 2 is a block diagram of a converting device used in this method.

まず第2図に示す装置の構成を簡単に説明する。First, the configuration of the apparatus shown in FIG. 2 will be briefly described.

なお、ここで第6図に示す従来の方法に用いる変換装置
と同一構成要素については同一符号を付し、説明を省略
する。この装置の特徴は、演算ワード位置算出回路11
3、セレクタ114、レジスタ115を新たに設けた点
である。i!111ilワード位置算出回路113はポ
インタ103内の値DPTに基づいて演算ワード位置D
WNを発生する回路である。この値DWNは値DPTに
基づいて逐次変化する値であって、現段階でレジスタ1
07内にデータ書込みが行われる可能性のある最大ワー
ド領域番号を示す。
Note that the same components as those of the conversion device used in the conventional method shown in FIG. 6 are designated by the same reference numerals, and the explanation thereof will be omitted. The feature of this device is that the calculation word position calculation circuit 11
3. A selector 114 and a register 115 are newly provided. i! The word position calculation circuit 113 calculates the calculated word position D based on the value DPT in the pointer 103.
This is a circuit that generates WN. This value DWN is a value that changes sequentially based on the value DPT, and at this stage, register 1
07 indicates the maximum word area number in which data may be written.

第3図で説明したように、DPT−5までの加算演算で
は、第0ワードについてのみ意味のある演算が行われ、
DPT−12までの加算演算では、第1ワードについて
のみ意味のある*算が行われる。ただ、この後の16倍
演算では更に多くのデータ領域が必要となるため、この
加算演算と16倍演算とを通じて意味のある演算が行わ
れるワード領域について考えると、DPT−4までは第
09−ドについてのみ演算を行えばよく、DPT−11
までは第1ワードについてのみvII:[を行えばよい
ことがわかる。即ち、DPT=4まではDWN−0,D
PT−11まではDWN−1どなる。このような関係を
第4図の図表に示す。演算ワード位置算出回路113は
、例えば第4図に示すような表をテーブルとしてもった
ROMで構成すればよい。あるいは所定の論理回路を組
合せて第4図に示す表と同等の機能を果たすような回路
を組んでもよい。要するにDPTを入力してこれに対応
したDWNを出力する機能を有するものであればどのよ
うな回路を用いてもかまわない。
As explained in FIG. 3, in addition operations up to DPT-5, meaningful operations are performed only on the 0th word,
In addition operations up to DPT-12, meaningful * operations are performed only on the first word. However, since the subsequent 16x operation requires even more data area, considering the word area where meaningful operations are performed through this addition operation and 16x operation, up to DPT-4, the 09- It is only necessary to perform calculations on the DPT-11
It can be seen that vII:[ has to be performed only for the first word. That is, until DPT=4, DWN-0, D
DWN-1 roars up to PT-11. Such a relationship is shown in the diagram of FIG. The operation word position calculation circuit 113 may be constructed of a ROM having a table as shown in FIG. 4, for example. Alternatively, a circuit that performs the same function as the table shown in FIG. 4 may be constructed by combining predetermined logic circuits. In short, any circuit may be used as long as it has the function of inputting DPT and outputting DWN corresponding to it.

セレクタ114は、このDWNとレジスタ」L 101のバイト数nから求めたく   −1)とを入力
し、どちらか小さい方をZWDNとして出力する。この
ZWDNの現時点での値WDNはレジスター15に格納
される。後述するように種々の演算回路はこの値WDN
によって制御されることになる。
The selector 114 inputs this DWN and the number of bytes n of the register L101 (-1), and outputs the smaller one as the ZWDN. The current value WDN of this ZWDN is stored in the register 15. As described later, various arithmetic circuits use this value WDN.
will be controlled by.

続いて第1図を参照して本発明に係る変換方法の手順を
示す。なお、ここで第5図に示す従来の方法に係る流れ
図と同一のステップについては同一符号を付し説明を省
略する。従来のステップと異なる部分は、ダッシュを付
したステップ64′。
Next, the procedure of the conversion method according to the present invention will be described with reference to FIG. Note that steps that are the same as those in the flowchart of the conventional method shown in FIG. 5 are given the same reference numerals and explanations will be omitted. The difference from the conventional step is step 64' with a dash.

s7’ 、s8’ 、s11’ 、s14’ 、s17
’ 。
s7', s8', s11', s14', s17
'.

520′である。まず、ステップS4’では、しラスタ
115内の値WONを初期化するために、値ZWDNを
レジスター15に取込む操作が新たにつけ加えられてい
る。また、こ□のレジスター15内の値WONは、ステ
ップs Q IでDPTが更新されるごとに更新されて
ゆく。ステップs7’は加算演算を行うべきワード領域
を指定するステップで、第0ワードから第WDNワード
まで繰返し演算が行われる。従来の方法では常に第09
−ドから第(上−1)ワードまで演算を行っていたが、
本方法によればその時点でデータ書込みが行われる可能
性がある第WONワードまで演算を行い、それ以後の無
駄な演算を省くことができるのである。
It is 520'. First, in step S4', a new operation for loading the value ZWDN into the register 15 is added in order to initialize the value WON in the raster 115. Further, the value WON in this register 15 is updated every time DPT is updated in step sQI. Step s7' is a step of specifying a word area in which an addition operation is to be performed, and the operation is repeated from the 0th word to the WDN word. In the conventional method, the 09th
The operation was performed from the - word to the (upper -1) word, but
According to this method, calculations are performed up to the WON word for which there is a possibility that data will be written at that point, and unnecessary calculations thereafter can be omitted.

ステップs11’ 、s14’ 、s17’ 。Steps s11', s14', s17'.

S20′は、16倍演算を行うべきワード領域を指定す
るステップで、加nvi算同様に第0ワードから第WD
Nワードまでで演算は打切られ、無駄な演算を省くこと
ができる。
S20' is a step of specifying the word area in which the 16x operation is to be performed, from the 0th word to the WD
The calculation is terminated after reaching N words, and unnecessary calculations can be omitted.

このようにして加算演算および16倍演算がDPT−2
m−1になるまで繰返され、レジスタ107内の最終値
が求めるべきBCDデータとしてレジスタ101に転送
される。
In this way, the addition operation and the 16x operation can be performed using the DPT-2.
This is repeated until m-1 is reached, and the final value in register 107 is transferred to register 101 as the BCD data to be determined.

なお上述の実施例では、バイナリデータをBCDデータ
に変換する例について説明したが、本発明はこれに限定
されるわけではなく、要するに複数のワード領域を有す
る2つのレジスタを用いてデータ変換を行うデータ変換
方法であれば、どのようなデータ変換についても適用可
能である。
Note that in the above embodiment, an example of converting binary data to BCD data was explained, but the present invention is not limited to this, and in short, data conversion is performed using two registers each having a plurality of word areas. Any data conversion method can be applied as long as it is a data conversion method.

また、上述の実施例では、加算演算および16倍演算の
両方で無駄な演算の省略を行っているが、どちらか一方
でのみ省略を行った場合でも従来の方法に比べれば十分
演算速度の向上を図ることができる。
In addition, in the above embodiment, unnecessary operations are omitted in both the addition operation and the 16x operation, but even if only one of them is omitted, the operation speed is sufficiently improved compared to the conventional method. can be achieved.

(発明の効果) 以上のとおり本発明によれば、複数のワード領域を有す
る2つのレジスタを用いてデータ変換を行なう方法にお
いて、レジスタ内のデータ書込みが行われる可能性のあ
るワード領域についてのみ演算を行うようにしたため、
無駄な演算を省略でき、演算速度の向上を図ることがで
きるようになる。
(Effects of the Invention) As described above, according to the present invention, in a method of performing data conversion using two registers having a plurality of word areas, operations are performed only on word areas in which data may be written in the registers. Because I decided to do this,
It is possible to omit unnecessary calculations and improve calculation speed.

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

第1図は本発明の一実施例に係るバイナリデータからB
CDデータへのデータ変換方法を示す流れ図、第2図は
第1図に示す方法を行うための装置の一例を示すブロッ
ク図、第3図は本発明の基本原理を示す説明−1m4図
は第1図に示す方法を行うために用いるテーブルを示す
図表、第5図は従来の一般的なバイナリデータからBC
Dデータへのデータ変換方法を示す流れ図、第6図は第
5図に示す方法を行うための装置の一例を示すブロック
図である。 S1〜s21・・・流れ図の各ステップ、100・・・
変換対象となるバイナリデータを格納するレジスタ、1
01・・・変換によって得られたBCDデータを格納す
るレジスタ、102・・・セレクタ、103・・・ポイ
ンタ、104・・・変換器、105・・・カウンタ、1
06.107・・・複数のワード領域を有するレジスタ
、108・・・セレクタ、109・・・加算器、110
・・・フリップ70ツブ、111・・・セレクタ、11
2・・・レジスタ、113・・・演算ワード位置算出回
路、114・・・セレクタ、115・・・レジスタ。
FIG. 1 shows B from binary data according to an embodiment of the present invention.
FIG. 2 is a block diagram showing an example of a device for performing the method shown in FIG. 1. FIG. 3 is an explanation showing the basic principle of the present invention. Figure 1 shows the table used to perform the method shown in Figure 5.
A flowchart showing a data conversion method to D data, and FIG. 6 is a block diagram showing an example of an apparatus for carrying out the method shown in FIG. S1 to s21... Each step of the flowchart, 100...
Register for storing binary data to be converted, 1
01...Register for storing BCD data obtained by conversion, 102...Selector, 103...Pointer, 104...Converter, 105...Counter, 1
06.107...Register having multiple word areas, 108...Selector, 109...Adder, 110
...Flip 70 knob, 111...Selector, 11
2...Register, 113...Arithmetic word position calculation circuit, 114...Selector, 115...Register.

Claims (1)

【特許請求の範囲】 1、aビットの容量をもつワード領域をbワード分互い
に上下の桁関係をもたせて配した第1のレジスタと、前
記第1のレジスタと同じ構成からなる第2のレジスタと
、aビットのデータどうしの加算を行うことができる加
算器と、cビットのバイナリデータをdビットの所定フ
ォーマットのデータに変換する変換器と、を用い、 取込んだcビットのデータを前記変換器でdビットのデ
ータに変換し、この変換したデータを前記第1のレジス
タの下位側のワード領域に書込む第1の段階と、 前記第1のレジスタと前記第2のレジスタとの対応する
ワード領域内のデータどうしを、前記加算器を用いて桁
上りを上位のワード領域に繰入れるようにして加算し、
その結果を前記第2のレジスタの対応するワード領域に
書込む第2の段階と、前記第2のレジスタの各ワード領
域内のデータを、前記加算器を用いて桁上りを上位のワ
ード領域に繰入れるようにして加算によつて2倍し、そ
の結果を前記第2のレジスタのもとのワード領域に書込
む操作をc回行う第3の段階と、 を有し、変換すべきバイナリデータから所定の順序でc
ビットずつデータを取込み、前記第1乃至第3の段階を
繰返して前記第2のレジスタ内に求めるべき所定フォー
マットのデータを得るデータ変換方法において、 前記第2の段階および/または前記第3の段階における
加算器の加算操作を、前記第2のレジスタ内のデータ書
込みが行われる可能性があるワード領域についてのみ行
うことを特徴とするデータ変換方法。 2、求めるべき所定フォーマットがBCD形式のフォー
マットであることを特徴とする特許請求の範囲第1項記
載のデータ変換方法。 3、変換すべきバイナリデータからcビットのデータを
取込む際のデータ取込み位置と、この取込んだデータに
基づいて行われる第2のレジスタへの書込み操作によつ
て実際に書込みが行われる可能性のあるワード領域数と
、の相関関係をあらかじめテーブルとして準備しておき
、このテーブルに基づいて加算器の加算操作を制御する
ことを特徴とする特許請求の範囲第1項または第2項記
載のデータ変換方法。 4、テーブルをROMとして準備することを特徴とする
特許請求の範囲第3項記載のデータ変換方法。
[Claims] 1. A first register in which b words of a word area having a capacity of a bits are arranged with upper and lower digits, and a second register having the same configuration as the first register. , an adder capable of performing addition of a-bit data, and a converter that converts c-bit binary data to d-bit data in a predetermined format. a first step of converting into d-bit data with a converter and writing the converted data into a lower word area of the first register; and a correspondence between the first register and the second register. adding the data in the word area to each other using the adder so that the carry is transferred to the upper word area,
a second step of writing the result into a corresponding word area of the second register, and a carry of the data in each word area of the second register to an upper word area using the adder; a third step of performing c times an operation of doubling by adding and writing the result into the original word area of the second register; and the binary data to be converted. c in a given order from
In a data conversion method for obtaining data in a predetermined format to be obtained in the second register by taking in data bit by bit and repeating the first to third steps, the second step and/or the third step A data conversion method characterized in that the addition operation of the adder is performed only on word areas in the second register in which there is a possibility that data will be written. 2. The data conversion method according to claim 1, wherein the predetermined format to be obtained is a BCD format. 3. Possibility of actual writing based on the data capture position when fetching c-bit data from the binary data to be converted and the write operation to the second register performed based on this fetched data. Claim 1 or 2, characterized in that the correlation between the number of word areas and the number of word areas with a certain characteristic is prepared in advance as a table, and the addition operation of the adder is controlled based on this table. data conversion method. 4. The data conversion method according to claim 3, characterized in that the table is prepared as a ROM.
JP4325886A 1986-02-28 1986-02-28 Data conversion method Pending JPS62200917A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4325886A JPS62200917A (en) 1986-02-28 1986-02-28 Data conversion method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4325886A JPS62200917A (en) 1986-02-28 1986-02-28 Data conversion method

Publications (1)

Publication Number Publication Date
JPS62200917A true JPS62200917A (en) 1987-09-04

Family

ID=12658828

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4325886A Pending JPS62200917A (en) 1986-02-28 1986-02-28 Data conversion method

Country Status (1)

Country Link
JP (1) JPS62200917A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6477509A (en) * 1987-08-13 1989-03-23 Kojima Press Kogyo Kk Composite molded body with skin and molding method thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6477509A (en) * 1987-08-13 1989-03-23 Kojima Press Kogyo Kk Composite molded body with skin and molding method thereof

Similar Documents

Publication Publication Date Title
JPS6132437Y2 (en)
JPS62200917A (en) Data conversion method
JPH0342715A (en) Approximated inverse number generation device for division
JP3213982B2 (en) Division circuit
JP2621535B2 (en) Code conversion circuit
JPS6218931B2 (en)
JP2558739B2 (en) Absolute value circuit
JPS62187933A (en) Adder/subtractor
JP2508286B2 (en) Square root calculator
JPH0225924A (en) Floating point arithmetic processor
JP2887038B2 (en) Division processing unit
JP2624738B2 (en) Rounding method
JPH052469A (en) Arithmetic circuit for variable-length word-length
JPS60186933A (en) Binary-coded decimal multiplication system
JP3074910B2 (en) Division device
JP2830075B2 (en) Binary to decimal converter
SU750467A1 (en) Digital function generator
JP2000330470A (en) Power arithmetic unit, power residue arithmetic unit, elliptic power multiplication point arithmetic unit and method and recording medium therefor
JPH01157621A (en) Converter from binary number to decimal number bcd code
JPH0318926A (en) Arithmetic circuit
JPH01162926A (en) Data length variable arithmetic unit
JP2600266B2 (en) Address generator
WO2019019196A1 (en) Digital signal processing method and device and programmable logic device
JPH0728220B2 (en) Data conversion processing circuit
JPH05313858A (en) Method and device for digital addition