JPH03189817A - Multiplying/dividing system in arithmetic unit - Google Patents

Multiplying/dividing system in arithmetic unit

Info

Publication number
JPH03189817A
JPH03189817A JP33069589A JP33069589A JPH03189817A JP H03189817 A JPH03189817 A JP H03189817A JP 33069589 A JP33069589 A JP 33069589A JP 33069589 A JP33069589 A JP 33069589A JP H03189817 A JPH03189817 A JP H03189817A
Authority
JP
Japan
Prior art keywords
division
multiplication
value
quotient
operand
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.)
Granted
Application number
JP33069589A
Other languages
Japanese (ja)
Other versions
JPH0833814B2 (en
Inventor
Seigo Nakatani
聖吾 中谷
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.)
PFU Ltd
Original Assignee
PFU 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 PFU Ltd filed Critical PFU Ltd
Priority to JP1330695A priority Critical patent/JPH0833814B2/en
Publication of JPH03189817A publication Critical patent/JPH03189817A/en
Publication of JPH0833814B2 publication Critical patent/JPH0833814B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PURPOSE:To execute the multiplying/dividing processing of a numerical value by a decimal number expression at a high speed by using a significant digit part of decimal number data of an inputted fixed point as a mantissa in a a state that it remains a decimal number expression, and normalizing and calculating the mantissa. CONSTITUTION:Data of an operand to be operated and an operand of a decimal number of a fixed point format stored on a memory 2 is inputted to a floating format converting means 3, converted to an operand to be operated and an operand of a floating point format, and stored on registers 11, 12. The operand to be operated and the operand on the registers 11, 12 are subjected to normalization processing so that a decimal point comes between the upper one digit and two digits of a mantissa by a normalization processing means 4, respectively. Subsequently, the operated number and the operand which are subjected to normalization processing are inputted to an operated number register 13 and an operand register 14, respectively and subjected to division processing or multiplication processing by an arithmetic processing part 15. In such a way, it does not occur that '0' is generated in the head part of a numerical value. a useless arithmetic processing for exerting no influence on a result of operation is eliminated, and the multiplying/dividing processing by a decimal number expression can be executed at a high speed.

Description

【発明の詳細な説明】 〔概要〕 本発明は、固定小数点形式の10進数を浮動小数点形式
の正規化10進数表現に変換し、乗除算を行う乗除算方
式に関し、 10進数表現による数値の乗除算処理を高速化すること
を目的とし、 固定小数点形式の10進数データを入力手段として乗除
算を行う方式において、入力された固定小数点のlO進
数データを有効桁数部分を10進数表現のまま仮数部と
し、重みを2進数表現の形式のデータに変換する浮動小
数点形式変換手段と、変換された浮動小数点形式のデー
タを正規化する正規化処理手段とを備え、正規化された
浮動小数点形式のデータを指数部と仮数部とに分けて浮
動小数点形式による乗除算を行う構成を持つ。
Detailed Description of the Invention [Summary] The present invention relates to a multiplication/division method that converts a decimal number in fixed point format into a normalized decimal number representation in floating point format and performs multiplication and division. Aiming at speeding up arithmetic processing, in a method that performs multiplication and division using fixed-point decimal data as an input means, the input fixed-point IO base data is converted into a mantissa with the number of significant digits expressed as a decimal number. a floating-point format conversion means for converting weights into data in a binary representation format, and a normalization processing means for normalizing the converted floating-point format data; It has a configuration that divides data into an exponent part and a mantissa part and performs multiplication and division in floating point format.

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

演算装置により固定小数点形式の10進数を浮動小数点
形式の正規化lO進数表現に変換し、乗除算を行う乗除
算方式に関する。
The present invention relates to a multiplication/division method in which a fixed-point decimal number is converted into a floating-point normalized IO-adic representation using an arithmetic unit, and multiplication/division is performed.

〔従来技術〕[Prior art]

従来は、入力データを2進化10進数等の10進数表現
により固定小数点形式の非正規化数により演算処理を行
っていた。
Conventionally, input data has been processed using denormalized numbers in fixed-point format using decimal representation such as binary coded decimal numbers.

第8図(a)に従来の10進数表現による除算方式のブ
ロック図を示す。
FIG. 8(a) shows a block diagram of a conventional division method using decimal representation.

図に付した番号に従って、処理手順を説明する。The processing procedure will be explained according to the numbers attached to the figure.

■ 初期条件を設定する(N=O)。■ Set initial conditions (N=O).

■ 被除数から除数をN倍した値を減算処理する。■ Subtract the value obtained by multiplying the divisor by N from the dividend.

■ 減算結果が0かどうか判断し、0であれば、求めた
Nの値を商とする。
■ Determine whether the subtraction result is 0 or not, and if it is 0, use the obtained value of N as the quotient.

■ 負かどうか判断する。■ Determine whether it is negative or not.

■、■ 負であれば、引きすぎなので、N−1の値を商
の1桁の値として格納する。
(2), (2) If negative, it is subtracted too much, so the value of N-1 is stored as a one-digit value of the quotient.

■ ■の判断の結果がNOのときには、まだ減算できる
状態であるので、NをN+1して■以下の処理を繰り返
す。
(2) If the result of the judgment in (2) is NO, it is still possible to subtract, so N is increased by N+1 and the process from (2) onwards is repeated.

■ 求めた商の桁の位置を14認する。■ Identify the position of the digit of the quotient you found.

■ 求めた商をレジスタに格納する。■ Store the obtained quotient in the register.

■ 有効桁数だけ商が求まっていないかあるいは剰余が
0でなければ再度除算□処理を繰り返す。
■ If the quotient is not calculated for the number of significant digits or the remainder is 0, repeat the division □ process again.

有効桁数の商が求まったかあるいは剰余が0になれば処
理を終了する。
The process ends when the quotient of the number of effective digits is found or the remainder becomes 0.

第8図(b)に従来の乗算方式の例を示す。FIG. 8(b) shows an example of a conventional multiplication method.

演算装置の最大有効桁数が4桁の場合について説明する
A case where the maximum number of significant digits of the arithmetic device is four digits will be explained.

例えば、23X14を計算する場合、演算装置のレジス
タ上には、固定小数点形式の10進数表現データを図に
(1)で示すように、先頭Oを補って4桁にして格納さ
れる。次に、(2)に示すように、被乗数に乗数の各桁
の値を掛けた各桁の中間乗算結果を4ビツトずつシフト
してレジスタ上に格納し、各桁より求まった値を加算し
て乗算結果を求める。
For example, when calculating 23×14, fixed-point decimal representation data is stored in the register of the arithmetic unit as 4 digits with the leading O added, as shown in (1) in the figure. Next, as shown in (2), the multiplicand is multiplied by the value of each digit of the multiplier, and the intermediate multiplication result of each digit is shifted 4 bits at a time and stored in a register, and the values obtained from each digit are added. Find the multiplication result.

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

従来の10進数による演算処理は、上記のように固定小
数点形式で非正規化数により処理していたため有効桁数
を大きく取れない等の問題があった。
Conventional arithmetic processing using decimal numbers has problems such as not being able to obtain a large number of significant digits because processing is performed using denormalized numbers in fixed-point format as described above.

キーボード等の人力手段により入力する場合の入力数値
や、表示手段に表示する数値は10進数であることから
、10進数による演算処理は、そのような装置により入
出力を行う場合には、2進数表現の演算処理に比べて有
利であるが、2進数表現による演算処理の場合より約4
〜6倍多いクロック数を要し、演算処理が遅いという欠
点があった。
Since input numerical values when input using manual means such as a keyboard and numerical values displayed on a display means are decimal numbers, arithmetic processing using decimal numbers is converted into binary numbers when input/output is performed using such devices. Although it is advantageous compared to the arithmetic processing using the representation, it is about 4 times faster than the arithmetic processing using the binary representation.
The drawback was that it required ~6 times as many clocks and slow arithmetic processing.

さらに、従来のIO進数による除算処理では、上記のよ
うに1桁の商を算出するのにポローが検出されるまで、
最大9ないし10回の減算をする必要があったため、た
くさんの演算処理回数を必要とした。
Furthermore, in conventional division processing using IO base numbers, until a pollo is detected to calculate a one-digit quotient as described above,
Since it was necessary to perform subtraction up to 9 or 10 times, a large number of arithmetic operations were required.

また、非正規化数による処理のため、演算装置の有効最
大桁数に満たない数値では数字の先頭に0を補う全体桁
数による演算処理であるため、演算結果に直接影響しな
い無駄な処理が多かった。
In addition, since processing is performed using denormalized numbers, if the number is less than the maximum number of valid digits of the arithmetic unit, 0 is added to the beginning of the number. This process uses the total number of digits, so unnecessary processing that does not directly affect the calculation result is performed. There were many.

そのため、従来の10進数表現による演算処理は、多く
のクロック数を要するために処理が遅いことに加えて、
上記のように、演算処理回数も多く要するため、2進数
表現による場合に比較して演算時間がいちじるしく遅い
という問題点があった。
Therefore, conventional arithmetic processing using decimal representation requires a large number of clocks and is slow.
As mentioned above, since a large number of calculations are required, there is a problem in that the calculation time is significantly slower than in the case of binary representation.

このことは、多倍長精度による演算の場合には特に顕著
であった。
This was particularly noticeable in the case of multiple-precision calculations.

〔課題を解決するための手段) 本発明の演算方式では、固定小数点形式の10進数デー
タを有効桁数部分を2進化10進数等の10進数表現の
まま仮数部とし、重みを2進数表現の形式のデータに変
換し、さらに浮動小数点形式のデータを正規化処理する
。そして、正規化された浮動小数点形式の指数部と仮数
部とにより乗除算を行うようにした。
[Means for Solving the Problems] In the calculation method of the present invention, the significant digit part of fixed-point decimal data is expressed as a decimal number such as a binary coded decimal number as the mantissa part, and the weight is expressed as a binary number. format data, and further normalizes the floating point format data. Then, multiplication and division are performed using the exponent part and the mantissa part in the normalized floating point format.

さらに、除算処理を行う場合には、除数を1ないし9倍
した値を格納するテーブルを設け、被除数と上記テーブ
ル上の数値を比較して、その大小関係を比較するだけで
直接的に商を求めるようにした。そのため、従来の除算
方法のように減算を繰り返すことがなく、演算回数を大
幅に減らすことができる。
Furthermore, when performing division processing, a table is set up to store the values obtained by multiplying the divisor by 1 to 9, and the quotient can be calculated directly by comparing the dividend with the numerical value on the table and comparing the magnitude relationship. I asked for it. Therefore, unlike conventional division methods, subtraction is not repeated, and the number of operations can be significantly reduced.

また、乗算処理を行う場合には、被乗数を1ないし9倍
した値を格納するテーブルを設け、被乗数に乗数の各桁
の値を掛けた値をテーブルを参照して、桁毎に掛は算処
理をすることなく中間の乗算値を求めるようにし、高速
度で結果がもとまるようにした。また、演算処理を正規
化数により行うようにし、先頭数値Oの部分の演算結果
に直接影響しない部分の無駄な処理をなくすようにした
In addition, when performing multiplication processing, create a table that stores the values obtained by multiplying the multiplicand by 1 to 9, and multiply the multiplicand by the value of each digit of the multiplier by referring to the table and calculate the multiplication for each digit. The intermediate multiplication value is calculated without any processing, so that the result can be obtained quickly. In addition, arithmetic processing is performed using normalized numbers, thereby eliminating unnecessary processing of parts that do not directly affect the calculation results of the leading numerical value O.

本発明は、上記のように、10進数表現による数値の乗
除算処理を高速化することを目的とする。
As described above, an object of the present invention is to speed up multiplication/division processing of numerical values expressed in decimal notation.

第1図(a)に示す本発明の基本構成により本発明の基
本構成を説明する。
The basic configuration of the present invention will be explained using the basic configuration of the present invention shown in FIG. 1(a).

2は固定小数点形式の10進数よりなる被演算数および
演算数を格納するメモリ、3は入力された固定小数点形
式の10進数を浮動小数点形式のデータとし、仮数部は
10進数表現により、指数部の重み部分は2進数表現に
変換する浮動小数点形式変換手段、4は浮動小数点形式
に変換されたデータを正規化処理する正規化処理手段、
5は浮動小数点形式の正規化された被演算数および演算
数を除算もしくは乗算処理する演算手段、6は演算処理
鈴果メデータを格納するメモリ、10はメモリ2上に格
納された固定小数点データ、11は浮動小数点形式に変
換された被演算数、12は浮動小数点形式に変換された
演算数、13は浮動小数点形式に変換された被演算数を
格納するレジスタ、14は浮動小数点形式に変換された
演算数を格納するレジスタ、15は被演算数レジスタ1
3および演算数レジスタ14に格納されたデータに基づ
いて、除算もしくは乗算処理をする演算処理部である。
2 is a memory that stores operands and operands made of decimal numbers in fixed-point format; 3 is a memory that stores the input decimal numbers in fixed-point format as data in floating-point format; the mantissa part is expressed as a decimal number; the exponent part is The weight part is a floating point format conversion means for converting into binary representation, 4 is a normalization processing means for normalizing the data converted to floating point format,
5 is an arithmetic means for dividing or multiplying normalized operands and operations in floating point format; 6 is a memory for storing arithmetic processing result data; 10 is fixed-point data stored in the memory 2; 11 is the operand converted to floating point format, 12 is the operand converted to floating point format, 13 is a register that stores the operand converted to floating point format, and 14 is a register that stores the operand converted to floating point format. 15 is the operand register 1.
3 and the data stored in the arithmetic register 14.

 第1図(b)は、本発明において使用する正規化され
た浮動小数点形式の数値のデータフォーマットを示す。
FIG. 1(b) shows the data format of normalized floating-point numbers used in the present invention.

仮数部は、例えば、10進数の1文字を4ピントで表現
した2進化10進数等の10進数表現とし、仮数部の上
位1桁と2桁の間に小数点が位置するように正規化され
たデータを格納する。
The mantissa is expressed as a decimal number, such as a binary coded decimal number in which one character of the decimal number is expressed in 4 pintos, and is normalized so that the decimal point is located between the first and second digits of the mantissa. Store data.

指数部は、重み部分を2進数表現により格納する。また
、仮数部および指数部分の符号は、データフォーマット
の指数部に設けた2ビツトの符号部に2進データにより
格納する。
The exponent part stores the weight part in binary representation. Further, the signs of the mantissa part and the exponent part are stored as binary data in a 2-bit code part provided in the exponent part of the data format.

〔作用〕[Effect]

第1図に示す基本構成の作用を説明する。 The operation of the basic configuration shown in FIG. 1 will be explained.

メモリ2上に格納された固定小数点形式の10進数の被
演算数および演算数のデータは浮動小数点形式変換手段
に入力され、浮動小数点形式の被演算数および演算数に
変換され、レジスタ11、レジスタ12上に格納される
The data of the fixed-point format decimal operands and operands stored in the memory 2 is input to the floating-point format conversion means and converted to the floating-point format operands and operands. It is stored on 12.

レジスタ11.12上の被演算数および演算数はそれぞ
れ正規化処理手段4により仮数部の上位1桁と2桁の間
に小数点がくるように正規化処理される。
The operands and the operands on the registers 11 and 12 are each normalized by the normalization processing means 4 so that the decimal point is between the first and second digits of the mantissa.

例えば、被演算数として固定小数点形式の10進数の1
234の場合について考えると、正規化処理手段は浮動
小数点形式に変換したレジスタ11上の被演算数を1.
234X10’の形に変換する。そして、仮数部は例え
ば2進化10進数の10進数表現により2桁を1バイト
のパンク形式で被演算数レジスタ13上に格納される。
For example, if the operand is a decimal number 1 in fixed-point format,
Considering the case of 234, the normalization processing means converts the operand on register 11 into floating point format into 1.
Convert to 234X10' format. Then, the mantissa part is stored in the operand register 13 in decimal representation of a binary coded decimal number, for example, in a format in which two digits are punctured into one byte.

また指数部はその重みのデータである3を必要により、
例えば、重みデータOを16進数の3fffの2進数表
現によるバイアス値として格納する。
In addition, the exponent part is the weight data 3, if necessary,
For example, the weight data O is stored as a bias value expressed in binary hexadecimal 3fff.

正規化処理された被演算数および演算数はそれぞれ被演
算数レジスタ13および演算数レジスタ14に入力され
演算処理部15において除算処理もしくは乗算処理をさ
れる。
The normalized operand and operand are input to the operand register 13 and the operand register 14, respectively, and are subjected to division processing or multiplication processing in the arithmetic processing section 15.

演算結果は、メモリ6に格納される。The calculation results are stored in the memory 6.

本発明によれば、仮数部を正規化して演算するため、数
値の先頭部に0を生じることがなく、演算結果に影響し
ない無駄な演算処理を無くすことができる。また、仮数
部は10進数表現により処理するので、入力手段により
入力された10進数表現をそのまま使用することができ
、また出力手段に出力する際にも、演算結果の10進数
の表現形式をそのまま利用することができる。
According to the present invention, since the mantissa part is normalized and the calculation is performed, 0 is not generated at the beginning of the numerical value, and unnecessary calculation processing that does not affect the calculation result can be eliminated. In addition, since the mantissa is processed using decimal representation, the decimal representation input by the input means can be used as is, and when outputting to the output means, the decimal representation format of the calculation result can be used as is. can be used.

〔実施例〕〔Example〕

第2図ないし第7図により本発明の詳細な説明する。 The present invention will be explained in detail with reference to FIGS. 2 to 7.

第2図は本発明の演算手段を中心にした実施例構成を示
す。
FIG. 2 shows the configuration of an embodiment centered on the calculation means of the present invention.

図において、20はキーボード等10進数の入力手段、
21は浮動小数点形式の10進数を正規化した10進数
表現の被演算数および演算数に基づいて除算もしくは乗
算を行う演算手段、22は浮動小数点形式から固定小数
点形式に変換された演算結果をメモリから取り出して表
示手段に表示せしめる表示制御部、23は演算処理され
た演算結果を固定小数点形式の24進数により表示する
表示手段、24は人力手段により入力された固定小数点
形式の24進数を格納するメモリ、25は人力手段20
より人力された固定小数点形式のメモリ24上の10進
数の入力データを取り出して仮数部と指数部に分け、浮
動小数点形式のデータに変換する浮動小数点形式変換手
段、26は仮数部の上位2桁目以降が小数点以下の数値
になるように正規化処理する正規化処理部、27.28
は正規化処理部26により正規化処理された浮動小数点
形式の仮数部を2進化10進数等の10進数表現により
1ハイドに2桁の10進数をパンク形式に格納するレジ
スタ、29はレジスタ27.2日上のパンク形式の2進
化10進数および指数部の重みデータにより演算処理を
する演算処理部、30は除算における被除数もしくは乗
算における中間結果を格納する中間結果レジスタ、3I
は除算においてテーブル上の除数の整数倍の数値を検索
し、被除数の値と比較する、もしくは乗算において被乗
数に乗数を掛けた値を引き出して中間結果レジスタに入
力する検索部、32は除算における除数もしくは乗算に
おける被乗数を1ないし9倍した数値を格納するテーブ
ル、33は除算において求めた商の先頭数値が0の場合
、0もしくは1のフラグを格納する検索フラグデータ格
納部、34は除算において、生成された商の桁数を判定
する生成桁数判定部、35は除算における商もしくは乗
算における演算結果を格納する最終結果レジスタ、36
は正規化浮動小数点形式の演算結果を固定小数点形式の
10進数に変換する固定小数点形式変換部、37は固定
小数点形式の10進数に変換された演算結果を格納する
メモリ、38は被演算数もしくは演算数に基づいて、除
算における除数もしくは乗算における被乗数の1ないし
9倍の数値を作成しテーブル32に格納するテーブル作
成部、39は浮動小数点形式のデータの指数部の演算処
理をする指数演算部、40は除算において被除数をテー
ブル上の除数の整数倍の数値と比較して商を求めるため
の比較部である。
In the figure, 20 is a decimal input means such as a keyboard,
21 is an arithmetic unit that performs division or multiplication based on the operands and operands in decimal representation, which are normalized decimal numbers in floating point format, and 22 is a memory for storing the arithmetic results converted from floating point format to fixed point format. 23 is a display means for displaying the result of the arithmetic processing in fixed-point format in 24-decimal notation, and 24 stores the fixed-point format in 24-decimal notation inputted by manual means. Memory, 25, human power means 20
Floating-point format converting means takes out decimal input data in fixed-point format memory 24, divides it into a mantissa part and an exponent part, and converts it into floating-point format data; 26 is the upper two digits of the mantissa part; 27.28 Normalization processing unit that performs normalization processing so that the numbers after the th are decimal points.
29 is a register for storing a mantissa in floating point format normalized by the normalization processing unit 26 in a decimal format such as a binary coded decimal number, and stores a 2-digit decimal number per hide in a punctured format. an arithmetic processing unit that performs arithmetic processing using a binary coded decimal number in a puncture format on the second day and weight data of an exponent part; 30 is an intermediate result register that stores a dividend in division or an intermediate result in multiplication; 3I;
32 is a search unit that searches for a value that is an integral multiple of the divisor on the table in division and compares it with the value of the dividend, or extracts the value obtained by multiplying the multiplicand by the multiplier and inputs it into the intermediate result register in multiplication. 32 is the divisor in division. Or, a table for storing numerical values obtained by multiplying the multiplicand by 1 to 9 in multiplication; 33 is a search flag data storage section for storing a flag of 0 or 1 when the first numerical value of the quotient obtained in division is 0; 34 is a table for storing a flag of 0 or 1 in division; A generated digit number determination unit that determines the number of digits of the generated quotient; 35 is a final result register that stores the quotient in division or the operation result in multiplication; 36;
3 is a fixed-point format conversion unit that converts the operation result in normalized floating-point format into a decimal number in fixed-point format; 37 is a memory that stores the operation result converted to a decimal number in fixed-point format; and 38 is an operand or A table creation unit that creates a value that is 1 to 9 times the divisor in division or the multiplicand in multiplication based on the operation number and stores it in the table 32; 39 is an exponent calculation unit that performs arithmetic processing on the exponent part of data in floating point format; , 40 is a comparison unit for calculating a quotient by comparing the dividend with a value that is an integral multiple of the divisor on the table in division.

第2図の実施例構成の動作を第3図ないし第7図により
説明する。
The operation of the embodiment shown in FIG. 2 will be explained with reference to FIGS. 3 to 7.

本発明の乗除算方式において使用するデータフォーマッ
トの実施例を第3図(a) 、 (b)に示す。
An example of the data format used in the multiplication/division method of the present invention is shown in FIGS. 3(a) and 3(b).

第3図(a)において、50は20桁の2進化10進数
等のlO進数を2桁を1バイトにバンクした仮数部、5
1は16ビツトの2進数で表す指数部領域、52は入力
データの有効桁数を2進数で表す有効桁数領域、53は
1バイトの識別子の領域である。
In Figure 3(a), 50 is the mantissa part of a 20-digit binary coded decimal number, etc., where two digits are banked into one byte.
1 is an exponent area that is expressed as a 16-bit binary number, 52 is an effective digit number area that expresses the number of effective digits of input data as a binary number, and 53 is a 1-byte identifier area.

第3図(b)は、同図(a)における16ビツトの指数
部領域の拡大図である。
FIG. 3(b) is an enlarged view of the 16-bit exponent region in FIG. 3(a).

図において、54は16ビノトの2進数で指数を表現す
る指数域、55は指数部の符号を表す符号ビット領域、
56は仮数部の符号を表す符号ビット領域である。
In the figure, 54 is an exponent area that expresses the exponent in 16 bit binary numbers, 55 is a sign bit area that represents the sign of the exponent part,
56 is a sign bit area representing the sign of the mantissa.

指数域54は、10°を10進数の0を基準とした重み
Oに対して3fffにバイアスした2進数。即ち、重み
0に対して、指数域の各ピッ) pI域全全部2進数で
1が格納される。これにより10の±16384までの
指数の範囲を許容できる(2′4=16384)。
The exponent area 54 is a binary number biased to 3fff with respect to the weight O with 10° as the reference value of decimal number 0. That is, for a weight of 0, 1 is stored in binary for each pI region in the exponential region. This allows a range of exponents up to ±16384 of 10 (2'4=16384).

本発明は、除算における被除数、除数および乗算におけ
る被乗数、乗数を上記のように浮動小数点形式の正規化
数に変換し、第3図(a)に示すようなデータフォーマ
ットに構成して演算処理を行う。
The present invention converts the dividend and divisor in division and the multiplicand and multiplier in multiplication into normalized numbers in floating point format as described above, configures them into a data format as shown in FIG. 3(a), and performs arithmetic processing. conduct.

第4図、第5図により本発明によるデータフォーマット
を用いた除算方式の実施例を説明する。
An embodiment of the division method using the data format according to the present invention will be described with reference to FIGS. 4 and 5.

第4図は、本発明のフローであり、第5図は本発明の除
算方式を説明するための数値例である。
FIG. 4 is a flowchart of the present invention, and FIG. 5 is a numerical example for explaining the division method of the present invention.

必要に応じて第2図、第3図を参照する。Refer to FIGS. 2 and 3 as necessary.

第5図に示すように、被演算数P 1 =394117
1520、演算数P 2 =80256として、P1十
P2を演算処理する場合について考える。
As shown in FIG. 5, operand P 1 =394117
1520 and the number of operations P 2 =80256, consider the case where P10P2 is processed.

除算に先立って、除数P2を1ないし9までの整数値に
より整数倍した値のテーブルを作成する。
Prior to division, a table of values obtained by multiplying the divisor P2 by an integer value from 1 to 9 is created.

そして、被除数とテーブル上の数値の大小を比較するこ
とにより商をもとめるようにする。
Then, the quotient is determined by comparing the size of the dividend with the numerical value on the table.

第4図のフローの手順に従って説明する。This will be explained according to the flowchart shown in FIG.

■ 初期条件を設定する。■ Set initial conditions.

即ち、各演算レジスタをクリアし、被演算レジスタにP
l、演算レジスタにP2を、第3図のデータフォーマッ
トに従って正規化浮動小数点形式により格納する。
In other words, clear each operation register and write P to the operand register.
1, P2 is stored in the arithmetic register in normalized floating point format according to the data format shown in FIG.

■ テーブル32より検索部31は、テーブル上の値を
順次引出し、比較部40に入力する。そして、比較部4
0は、中間結果レジスタ30に格納されている被除数(
第5図参照)と検索部の引き出した値を比較し、被除数
より小さくて、被除数に最も近い値もしくは被除数と同
じ値を選択し、そのテーブル値から、商および次の演算
処理のための被除数を算出する。
(2) The search unit 31 sequentially retrieves values on the table from the table 32 and inputs them to the comparison unit 40. And comparison section 4
0 is the dividend (
(See Figure 5) and the value retrieved by the search unit, select a value smaller than the dividend and closest to the dividend, or the same value as the dividend, and from that table value, calculate the quotient and the dividend for the next calculation process. Calculate.

■ ■で求めた1桁の商を最終結果レジスタ35に位置
を確認して格納する ■ 最初に求めた商の値がO(商の先頭値O)の場合に
は、検索フラグを立てその値を1にする。
■ Confirm the position of the one-digit quotient obtained in ■ and store it in the final result register 35. ■ If the value of the quotient initially obtained is O (the first value of the quotient O), set a search flag and set the value. Set to 1.

■ 商の格納位置を確認する。■ Check the storage location of the quotient.

■ 被除数から■で検索部が引き出し、商をもとめたテ
ーブル上のデータを減算処理し、剰余を求める。
■ The search unit retrieves the dividend using ■ and subtracts the data on the table from which the quotient was obtained to obtain the remainder.

■ 剰余の値が0ならゼロフラグ1を設定する。■ If the remainder value is 0, set the zero flag 1.

ゼロフラグZf=1なら余りがOで割り切れたことを意
味するので、処理を終了する。
If the zero flag Zf=1, it means that the remainder is divisible by O, so the process ends.

■ ゼロフラグzr=oなら、余りが存在していること
を意味しているので、さらに除算処理を継続し、商の生
成桁数のカウンタを1つ進める。
(2) If the zero flag zr=o, it means that there is a remainder, so the division process is continued and the counter for the number of digits generated in the quotient is incremented by one.

■ 検索フラグを確認し、検索フラグデータが0でない
なら商の先頭数値がOでないので求めた商の桁数が有効
桁数の20より大きいか小さいかを判断する。
(2) Check the search flag, and if the search flag data is not 0, the first numerical value of the quotient is not O, so judge whether the number of digits of the obtained quotient is greater or less than the number of effective digits, 20.

[相] 生成桁数が20を越えていれば必要とする桁数
だけ商をもとめられたので処理を終了する。
[Phase] If the number of generated digits exceeds 20, the quotient for the required number of digits has been obtained, and the process ends.

20に満たなければ、さらに演算処理を繰り返す。If the number is less than 20, the calculation process is further repeated.

■ ■における判断で検索フラグの値が0なら商の先頭
数値が0ということを意味するので、商の桁数が21よ
り大きいか小さいかを判断する。
(2) If the value of the search flag is 0 in the determination in (2), it means that the first numerical value of the quotient is 0, so it is determined whether the number of digits of the quotient is greater than or less than 21.

生成桁数が21を越えていれば必要な桁数だけ商がもと
められたので処理を終了する。21に満たなければ、さ
らに演算処理を繰り返す。
If the number of generated digits exceeds 21, the quotient for the required number of digits has been obtained, and the process ends. If the number is less than 21, the calculation process is further repeated.

■ 剰余が0でなく、かつ、商が必要な桁数に満たない
場合には、被除数を、除数と比較対象する位置に移動処
理をし、さらに■以降の除算処理を繰り返す。
(2) If the remainder is not 0 and the quotient is less than the required number of digits, the dividend is moved to a position to be compared with the divisor, and the division processing from (2) onwards is repeated.

■ 商の先頭数値がOの場合には、得られた商を正規化
処理し、先頭数値の0を取り除く。
■ If the leading numerical value of the quotient is O, the obtained quotient is normalized and the leading numerical value 0 is removed.

第6図、第7図により本発明によるデータフォーマット
を用いた乗算方式の実施例を説明する。
An embodiment of the multiplication method using the data format according to the present invention will be explained with reference to FIGS. 6 and 7.

第6図は、本発明の乗算方式のフローであり、第7図は
本発明の乗算方式を説明するための数値例である。
FIG. 6 is a flowchart of the multiplication method of the present invention, and FIG. 7 is a numerical example for explaining the multiplication method of the present invention.

必要に応じて第2図、第3図を参照する。Refer to FIGS. 2 and 3 as necessary.

第7図に示すように、被演算数(被乗数)P1=394
0629、演算数(乗数) P 2 =80256につ
いて、P1×P2を演算処理する場合を考える。
As shown in Figure 7, operand (multiplicand) P1 = 394
0629, the number of operations (multiplier) P 2 =80256, consider the case where P1×P2 is arithmetic processed.

乗算に先立って、被乗数P1の1ないし9までの整数値
による整数倍の値のテーブル32を作成しておき被乗数
P1に乗数P2の各桁を掛けた値を、テーブル上の数値
を検索して引き出すことにより求める。
Prior to multiplication, create a table 32 of integer multiples of the multiplicand P1 using integer values from 1 to 9, and search the numbers on the table for the value obtained by multiplying the multiplicand P1 by each digit of the multiplier P2. Obtain by drawing out.

また図のフローの方式は、中間結果レジスタ30は、乗
数P2の奇数桁を被乗数P1に掛けた値(第7図(b)
におけるAI、A3、A5)をそれぞれテーブルより引
出し、A3は8ビ・ント、A5は16ビツト左シフトし
たデータを加算する奇数桁の中間結果レジスタと、乗数
P2の偶数桁を被乗数P1に掛けた値(第7図(b)に
おけるA2、A4)をそれぞれテーブルより引出し、A
4は8ビツト左シフトしたデータを加算する偶数桁の中
間結果レジスタとした結果よりなり、偶数桁の加算結果
を4ビツト左シフトして奇数桁の加算結果に加算するこ
とにより最終の乗算結果を得る場合のフローである。
Furthermore, in the method of the flow shown in the figure, the intermediate result register 30 stores the value obtained by multiplying the multiplicand P1 by the odd number digits of the multiplier P2 (see FIG. 7(b)).
AI, A3, A5) are respectively drawn from the table, A3 is an 8-bit intermediate result register, A5 is an odd-numbered intermediate result register that adds 16-bit left-shifted data, and the multiplicand P1 is multiplied by an even-numbered digit of the multiplier P2. Pull out the values (A2 and A4 in Figure 7(b)) from the table, and
4 is the result of using an intermediate result register of even number digits to which data shifted left by 8 bits is added, and the final multiplication result is obtained by shifting the addition result of even number digits to the left by 4 bits and adding it to the addition result of odd number digits. This is the flow when obtaining.

第6図のフローの手順に従って、説明する。This will be explained according to the flowchart shown in FIG.

■ 被演算数レジスタ27、演算数レジスタ28をゼロ
クリアして、Pl、P2を正規化処理した浮動小数点形
式のデータとして、仮数部の桁数の大きいPLを被乗数
として被演算数レジスタ2ワに格納し、仮数部の桁数の
小さいP2を乗数として演算数レジスタ28に格納する
■ Clear the operand register 27 and the operand register 28 to zero, and store PL, which has a large number of digits in the mantissa part, in the operand register 2 as the multiplicand, as floating point format data in which Pl and P2 are normalized. Then, P2, which has a small number of digits in the mantissa part, is stored in the operation number register 28 as a multiplier.

■ 被乗数P1の1ないし9倍のテーブルを作成する。■ Create a table of 1 to 9 times the multiplicand P1.

■ 乗数の奇数桁および偶数桁を被乗数に掛けた値を格
納する奇数桁および偶数桁の中間結果レジスタ30をゼ
ロクリアする。
(2) Clear to zero the odd and even digit intermediate result registers 30 that store the value obtained by multiplying the multiplicand by the odd and even digits of the multiplier.

■ 乗数の全ての桁を被乗数に掛けたかどうか判定する
■ Determine whether the multiplicand is multiplied by all digits of the multiplier.

■ 全て掛けていなければ、掛算を終了していないので
、処理を継続し、1バイトに格納された桁のうちの下位
の桁(奇数桁)の値が0であるかどうか判定する。
(2) If all the numbers have not been multiplied, the multiplication has not finished, so processing continues and it is determined whether the value of the lower digit (odd number digit) of the digits stored in one byte is 0.

■ ■の結果がOでなければ、テーブルから乗数の奇数
桁を被乗数に掛けた値に相当する値(A1、A3、A5
)を引出し、それぞれ所定ビ・ノド左シフトして加算す
る。
■ If the result of ■ is not O, then the value (A1, A3, A5
), shift them to the left by a predetermined number of bits, and add them.

■ 乗数のバイト領域の上位ビ・ント(偶数桁)の値が
0であるかどうか判定する。0であれば、次のパイHE
域について、同様の処理をくり返す。
■ Determine whether the value of the upper bits (even number digits) of the multiplier byte area is 0. If it is 0, the next pie HE
Repeat the same process for the area.

■ 0でなければ、テーブルから対象となっている乗数
の桁の値を掛けた値を引出し、前の偶数桁の演算結果に
所定ビット左シフトして加算する。
(2) If it is not 0, extract the value multiplied by the value of the digit of the target multiplier from the table, shift it to the left by a predetermined bit and add it to the previous even-numbered digit calculation result.

さらに、同様の処理をくり返す。Furthermore, the same process is repeated.

■ 偶数桁の中間結果レジスタ30の演算結果を4ビツ
ト左にシフトする。
(2) Shift the operation result of the intermediate result register 30 of even number digits to the left by 4 bits.

[相] 奇数桁の中間結果レジスタ30の演算結果に■
で得た偶数桁の中間結果レジスタのデータを加算する。
[Phase] The operation result of the odd-numbered intermediate result register 30 is
Add the even-digit intermediate result register data obtained in .

■ 指数部の演算結果により桁数を調整し最終結果を得
る。
■ Adjust the number of digits based on the calculation result of the exponent part to obtain the final result.

〔発明の効果〕〔Effect of the invention〕

本発明によれば、仮数部を正規化して演算するため、数
値の先頭部に0を生じることがなく、演算結果に影響し
ない無駄な演算処理を無くすことができる。さらに、乗
除算処理において、除数もしくは被乗数の整数倍の数値
のテーブルを設けることにより、除算において、商をも
とめるための除数の整数倍の数値あるいは乗算において
、被乗数に乗数の各桁を掛けた結果帯られる値を乗算処
理することなく求めることができる、10進数表現によ
る乗除算処理にもかかわらず高速度で演算処理の結果が
得られる。
According to the present invention, since the mantissa part is normalized and the calculation is performed, 0 is not generated at the beginning of the numerical value, and unnecessary calculation processing that does not affect the calculation result can be eliminated. Furthermore, in multiplication and division processing, by providing a table of integral multiples of the divisor or multiplicand, it is possible to obtain the result of multiplying the multiplicand by each digit of the multiplier. The result of the arithmetic processing can be obtained at high speed despite the multiplication/division processing in decimal notation, which can be obtained without performing multiplication of the values contained in the data.

また、仮数部は人力手段により入力された10進数表現
をそのまま利用することができ、また出力手段に出力す
る際にも、演算結果の10進数の表現形式をそのまま利
用することができる。
Further, the mantissa part can use the decimal representation entered by manual means as is, and also when outputting to the output means, the decimal representation format of the calculation result can be used as is.

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

第1図(a)は、本発明の基本構成図である。 第1図(b)は、本発明のデータフォーマットの基本構
成図である。 第2図は、本発明の実施例構成図である。 第3図は、本発明のデータフォーマットの実施例図であ
る。 第4図は本発明の除算方式のフロー図である。 第5図(a)は、本発明のテーブルの実施例(1)の図
である。 第5図(b)は、本発明の除算方式を説明するための図
である。 第6図は、本発明の乗算方式のフロー図である。 第7図(a)は、本発明のテーブルの実施例(2)の図
である。 第7図(b)は、本発明の乗算方式を説明するための図
である。 第8図(a)は、従来の除算方式の説明図である。 第8図(b)は、従来の乗算方式の説明図である。 第1図(a)において、 2 :メモリ、 3 :浮動小数点形式変換手段、 4 :正規化処理手段、 5 :演算手段、 6  : 10 = 11. 13 : ■ 4 : 15 : メモリ、 固定小数点データ、 12:レジスタ、 被演算数レジスタ、 演算数レジスタ、 演算処理部、
FIG. 1(a) is a basic configuration diagram of the present invention. FIG. 1(b) is a basic configuration diagram of the data format of the present invention. FIG. 2 is a configuration diagram of an embodiment of the present invention. FIG. 3 is an example diagram of the data format of the present invention. FIG. 4 is a flow diagram of the division method of the present invention. FIG. 5(a) is a diagram of an embodiment (1) of the table of the present invention. FIG. 5(b) is a diagram for explaining the division method of the present invention. FIG. 6 is a flow diagram of the multiplication scheme of the present invention. FIG. 7(a) is a diagram of Example (2) of the table of the present invention. FIG. 7(b) is a diagram for explaining the multiplication method of the present invention. FIG. 8(a) is an explanatory diagram of a conventional division method. FIG. 8(b) is an explanatory diagram of the conventional multiplication method. In FIG. 1(a), 2: memory, 3: floating point format conversion means, 4: normalization processing means, 5: calculation means, 6: 10 = 11. 13: ■ 4: 15: Memory, fixed-point data, 12: Register, operand register, operation register, arithmetic processing unit,

Claims (1)

【特許請求の範囲】 1)固定小数点形式の10進数データを入力として乗除
算を行う方式において、 上記入力された固定小数点の10進数データを有効桁数
部分を10進数表現のまま仮数部とし、重みを2進数表
現の形式のデータに変換する浮動小数点形式変換手段と
、 上記変換された浮動小数点形式のデータを正規化する正
規化処理手段とを備え、 上記正規化された浮動小数点形式のデータを指数部と仮
数部とに分けて浮動小数点形式による乗除算を行うこと
を特徴とする乗除算方式。 2)請求項1に記載の乗除算方式による除算方式におい
て、 演算手段は、除数を1ないし9倍した値を格納するテー
ブルと、 被演算数と演算数を格納する2つのレジスタと、除算の
演算処理過程における被除数を格納するレジスタと、 商を格納するレジスタと、 商をもとめるため、上記テーブル上の値を引き出して被
除数と比較し、被除数値より小さくて最も近い値もしく
は同じ値を検索する検索部とを備え、除算処理を行うこ
とを特徴とする除算方式。 3)請求項2に記載の除算方式において、除算処理の結
果、商の先頭数値が0を取った場合と0以外の値をとっ
た場合とを識別する検索フラグデータ格納部と、 商の生成桁数を判定する生成桁数判定部を設け、生成桁
数判定部は検索フラグデータを参照し、有効桁数だけの
商を算出しても割り切れない場合には、商の先頭数値が
0でない場合には、有効桁数の商が得られるまで除算処
理を行わせ、先頭数値が0の場合には、有効桁数に1を
加えた数の桁数の商が得られるまで除算処理を行わせる
ことを特徴とする演算方式。 4)請求項1に記載の乗除算方式により乗算を行う方式
において、 被乗数を1ないし9倍した値を格納するテーブルと、 被乗数および乗数を格納する2つのレジスタと、上記テ
ーブルを参照して、被乗数に乗数の各桁の値を掛けた値
を引き出す検索部と、 検索部の引き出した数値を、所定ビットずつシフトして
順次加算して格納し、乗算の中間結果を格納する中間結
果格納レジスタと、 乗算における最終結果を格納する最終結果レジスタとを
備え、乗算を行うことを特徴とする乗除算方式。
[Scope of Claims] 1) In a method of performing multiplication and division using fixed-point decimal data as input, the input fixed-point decimal data is treated as a mantissa part with the number of significant digits expressed as a decimal number, A floating point format conversion means for converting weights into data in a binary representation format, and a normalization processing means for normalizing the converted floating point format data, the normalized floating point format data A multiplication/division method that performs multiplication/division in floating-point format by dividing the value into an exponent part and a mantissa part. 2) In the division method using the multiplication/division method according to claim 1, the calculation means includes a table for storing a value obtained by multiplying the divisor by 1 to 9, two registers for storing the operand and the operation number, and a division method for the division. A register to store the dividend in the arithmetic processing process, a register to store the quotient, and a register to store the quotient.To find the quotient, pull out the value on the table above, compare it with the dividend, and search for the closest value smaller than the dividend value or the same value. A division method characterized by comprising a search unit and performing division processing. 3) In the division method according to claim 2, as a result of the division process, a search flag data storage unit that identifies whether the leading numerical value of the quotient takes 0 or a value other than 0; and quotient generation. A generation digit number determination unit is provided to determine the number of digits, and the generation digit number determination unit refers to the search flag data, and if it is not divisible even after calculating the quotient of only the number of significant digits, the first numerical value of the quotient is not 0. If the first number is 0, the division process is performed until the quotient of the number of significant digits is obtained.If the leading number is 0, the division process is performed until the quotient of the number of digits is obtained by adding 1 to the number of significant digits. An arithmetic method characterized by the ability to 4) A method for performing multiplication using the multiplication/division method according to claim 1, comprising: a table for storing a value obtained by multiplying the multiplicand by 1 to 9; and two registers for storing the multiplicand and the multiplier; A search unit that extracts the value obtained by multiplying the multiplicand by the value of each digit of the multiplier, and an intermediate result storage register that stores the numerical value extracted by the search unit by shifting it by a predetermined bit and sequentially adding it, and storing the intermediate result of the multiplication. and a final result register for storing the final result of multiplication, and is characterized in that it performs multiplication.
JP1330695A 1989-12-20 1989-12-20 Multiplier / divider Expired - Fee Related JPH0833814B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1330695A JPH0833814B2 (en) 1989-12-20 1989-12-20 Multiplier / divider

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1330695A JPH0833814B2 (en) 1989-12-20 1989-12-20 Multiplier / divider

Publications (2)

Publication Number Publication Date
JPH03189817A true JPH03189817A (en) 1991-08-19
JPH0833814B2 JPH0833814B2 (en) 1996-03-29

Family

ID=18235535

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1330695A Expired - Fee Related JPH0833814B2 (en) 1989-12-20 1989-12-20 Multiplier / divider

Country Status (1)

Country Link
JP (1) JPH0833814B2 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS4970551A (en) * 1972-11-08 1974-07-08
JPS501626A (en) * 1972-12-14 1975-01-09
JPS5578340A (en) * 1978-12-09 1980-06-12 Casio Comput Co Ltd Division system
JPS5582353A (en) * 1978-12-18 1980-06-21 Sharp Corp Multiplication and division operation system
JPS56159734A (en) * 1980-05-13 1981-12-09 Casio Comput Co Ltd Arithmetic system
JPH01293437A (en) * 1988-05-20 1989-11-27 Hitachi Ltd Decimal multiplier

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS4970551A (en) * 1972-11-08 1974-07-08
JPS501626A (en) * 1972-12-14 1975-01-09
JPS5578340A (en) * 1978-12-09 1980-06-12 Casio Comput Co Ltd Division system
JPS5582353A (en) * 1978-12-18 1980-06-21 Sharp Corp Multiplication and division operation system
JPS56159734A (en) * 1980-05-13 1981-12-09 Casio Comput Co Ltd Arithmetic system
JPH01293437A (en) * 1988-05-20 1989-11-27 Hitachi Ltd Decimal multiplier

Also Published As

Publication number Publication date
JPH0833814B2 (en) 1996-03-29

Similar Documents

Publication Publication Date Title
US20180052660A1 (en) Apparatus and method for fixed point to floating point conversion and negative power of two detector
JPH05250146A (en) Arithmetic operation circuit executing integer involution processing
JP2722858B2 (en) Square root arithmetic unit
JP2857505B2 (en) Division device
JPH03189817A (en) Multiplying/dividing system in arithmetic unit
US10353671B2 (en) Circuitry and method for performing division
JP3950920B2 (en) Multiply-accumulator and data processing device
KR100974190B1 (en) Complex number multiplying method using floating point
JPH01282633A (en) Non-normalized number processing system
JP2972326B2 (en) Square root calculator
Kumar et al. Single Precision Floating Point Unit (FPU) Based on IEEE 754 Standard Using Verilog
JPH06187132A (en) Square root calculating device
JP4428778B2 (en) Arithmetic device, arithmetic method, and computing device
JPS59136849A (en) Dividing device
JPS62147526A (en) Multiplier
JPH02153412A (en) Inverse trigonometric function arithmetic unit
JP2007073061A (en) Data processing apparatus
JPS6285333A (en) Round-off processing system for floating point multiplier
JP3522387B2 (en) Pipeline arithmetic unit
JPH05313861A (en) Root extracting arithmetic unit
JP2530504B2 (en) Floating point arithmetic unit
JPH0322025A (en) Exponential function arithmetic unit
JPH0769785B2 (en) Divider
Morris et al. Binary systems and computer logic
JPH04358224A (en) Square foot calculating device

Legal Events

Date Code Title Description
S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313532

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees