JPH07261984A - Arithmetic method and unit - Google Patents

Arithmetic method and unit

Info

Publication number
JPH07261984A
JPH07261984A JP6048417A JP4841794A JPH07261984A JP H07261984 A JPH07261984 A JP H07261984A JP 6048417 A JP6048417 A JP 6048417A JP 4841794 A JP4841794 A JP 4841794A JP H07261984 A JPH07261984 A JP H07261984A
Authority
JP
Japan
Prior art keywords
multiplier
multiplicand
multiplication
unsigned
sign
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.)
Withdrawn
Application number
JP6048417A
Other languages
Japanese (ja)
Inventor
Masahiro Abe
正洋 阿部
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP6048417A priority Critical patent/JPH07261984A/en
Publication of JPH07261984A publication Critical patent/JPH07261984A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To provide an arithmetic method and an arithmetic unit for performing multiplication with signs by the irreducible minimum size and processing procedure of the arithmetic unit of a register or the like without using a unit of operation with sign. CONSTITUTION:In this arithmetic unit 10 provided with a register means 2 for storing a multiplier and a multiplicand and an arithmetic means 3 for performing multiplication based on the multiplier and the multiplicand, the arithmetic means 3 performs the multiplication of integers by providing a without-the-sign operation part for performing the multiplication without the sign for not performing a sign operation to the multiplier of (n) bits {(n) is a natural number} and the multiplicand of (n) bits and generating the multiplier without the sign and the multiplicand without the sign, a multiplication part for calculating the multiplied result of 2n bits based on the multiplier without the sign and the multiplicand without the sign and a subtraction part for subtracting the multiplicand from the register where the value of the upper (n) bits of the multiplied result is stored when the multiplier is provided with a negative sign and subtracting the multiplier from the register where the value of the upper (n) bits of the multiplied result is stored when the multiplicand is provided with the negative sign.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、マイクロコンピュータ
等の演算装置に係り、特に乗算を行う演算装置の改良に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an arithmetic unit such as a microcomputer, and more particularly to improvement of an arithmetic unit for multiplication.

【0002】近年の半導体技術の発達により、あらゆる
分野でマイクロチップ化された演算装置が使用されてい
る。特に、リアルタイム処理のため、演算処理に関して
高速化に貢献し得る技術が重要である。その反面、マイ
クロチップのチップ面積、プログラムサイズの小型化等
のコンパクトな設計を満たすことも要求される。特に、
デジタル信号処理技術においては、同じような乗算等の
演算を繰り返し執り行う必要があり、その演算手順の僅
かな短縮が、システム全体として大幅な演算時間の短縮
につながる。
With the recent development of semiconductor technology, microchip arithmetic units are used in various fields. In particular, since it is real-time processing, a technology that can contribute to speeding up of arithmetic processing is important. On the other hand, it is also required to satisfy compact design such as microchip area and program size reduction. In particular,
In the digital signal processing technique, it is necessary to repeatedly perform similar calculations such as multiplication, and a slight reduction in the calculation procedure leads to a significant reduction in the calculation time of the entire system.

【0003】このため、共通性のある処理を極力共有化
して最小の処理手順で大きく演算効率をアップさせる技
術が必要である。
Therefore, there is a need for a technique for sharing common processes as much as possible so as to greatly improve the calculation efficiency with a minimum processing procedure.

【0004】[0004]

【従来の技術】通常、乗算等のデジタル演算は、中央処
理装置等の演算装置がレジスタに格納した乗数、被乗数
を元に、演算器(アキュムレータ等)を動作させて行
う。
2. Description of the Related Art Generally, digital operations such as multiplication are performed by operating an arithmetic unit (accumulator or the like) based on a multiplier or a multiplicand stored in a register by an arithmetic unit such as a central processing unit.

【0005】ここで、整数を扱う場合、数値の正負が問
題となる。これら乗数に符号ビットという乗数の正負を
特定するビットを用意して、この符号を含めて符号のビ
ット状態、すなわち数値の正負を判定しながら整数演算
を行うものを符号付き演算という。また、符号ビットを
も数値の一部として、すなわち、MSBが‘1’である
正の数値として取扱い、単純な2進数の演算を行うもの
を、符号なし演算という。
Here, when dealing with integers, whether the numerical value is positive or negative becomes a problem. A sign operation is performed by preparing a bit, which is a sign bit, for these multipliers, which specifies whether the multiplier is positive or negative, and performing an integer operation while determining the sign bit state, that is, whether the numerical value is positive or negative, including this sign. In addition, a code bit is treated as a part of a numerical value, that is, a positive numerical value whose MSB is "1", and a simple binary arithmetic operation is performed is called an unsigned arithmetic operation.

【0006】さて、従来の符号付き演算においては、こ
の符号ビットを含めて数値の正負を判定しながら乗算を
行うため、符号なし演算とは別個の符号付きの演算を行
う演算装置を設けていた。また、符号付き演算装置も設
けない場合には、演算前に符号情報を他のレジスタ等に
保管し、符号なしの値に変換してから符号なし乗算を行
い、演算後に演算結果の符号を反転していた。
In the conventional signed arithmetic, since the multiplication is performed while determining whether the numerical value including the sign bit is positive or negative, an arithmetic unit for performing signed arithmetic different from the unsigned arithmetic is provided. . If a signed arithmetic unit is not provided, the sign information is stored in another register before the operation, converted to an unsigned value, then the unsigned multiplication is performed, and the sign of the operation result is inverted after the operation. Was.

【0007】[0007]

【発明が解決しようとする課題】しかしながら、上記の
ように、乗算や除算において符号を取り扱う演算装置で
は、専用の符号付き演算装置を符号なし演算装置とは別
に設ける必要があるため、機能として演算処理という類
似の働きを行う演算装置が重複して設けられており、演
算装置のオーバーヘッドが大きかった。また、符号付き
演算装置を使用しない場合においても、符号の操作のた
めに、符号フラグの判定処理、符号を記憶するための作
業領域が増えるといった無駄を生じていた。
However, as described above, in an arithmetic unit that handles a code in multiplication or division, a dedicated signed arithmetic unit must be provided separately from the unsigned arithmetic unit, and therefore the arithmetic operation is performed as a function. Since the arithmetic units that perform similar functions of processing are provided in duplicate, the overhead of the arithmetic units is large. Further, even when the signed arithmetic unit is not used, there is a waste of increasing the work area for determining the code flag and storing the code due to the operation of the code.

【0008】これら問題点は、データフィールドの倍増
や、浮動小数データの多用を招く、近年の高度の演算処
理においては、さらに、全体のパフォーマンスに悪影響
を与えることとなるものであった。
[0008] These problems further adversely affect the overall performance in the recent high-level arithmetic processing which doubles the data field and makes heavy use of floating point data.

【0009】そこで、本発明の目的は、符号なし乗算と
符号付き乗算を同一の演算装置で行い、符号付き演算装
置を使用することなく、最小限のレジスタ等の演算装置
のサイズ、最低限の処理手順で、符号付き乗算を行う演
算方法及び演算装置を提供することにある。
Therefore, an object of the present invention is to perform unsigned multiplication and signed multiplication with the same arithmetic unit, and to use the signed arithmetic unit without using the minimum size of arithmetic units such as registers and the minimum. An object of the present invention is to provide an arithmetic method and an arithmetic device for performing signed multiplication in a processing procedure.

【0010】[0010]

【課題を解決するための手段】上記目的を達成するため
に、請求項1記載の発明は、レジスタ手段(2)及び演
算手段(3)を使用してnビット(nは自然数)の乗数
及びnビットの被乗数により2nビットの整数演算を行
う演算方法において、乗数及び被乗数に対し符号操作を
行わない符号なし乗算を行い、符号なし乗数及び符号な
し被乗数を生成する符号なし演算工程(ステップS1)
と、符号なし乗数及び符号なし被乗数に基づいて2nビ
ットの乗算結果を算出する乗算工程(ステップS2)
と、乗数が負の符号を有する場合に、乗算結果の上位n
ビットの値から被乗数を減算し、被乗数が負の符号を有
する場合に、乗算結果の上位nビットの値から乗数を減
算する減算工程(ステップS4,6)とにより、2nビ
ットの整数の乗算を行うことを特徴とする。
In order to achieve the above object, the invention according to claim 1 uses a register means (2) and an arithmetic means (3) to multiply an n-bit multiplier (n is a natural number) and In an arithmetic method for performing 2n-bit integer arithmetic with an n-bit multiplicand, an unsigned arithmetic step of generating an unsigned multiplier and an unsigned multiplicand by performing unsigned multiplication without performing a sign operation on the multiplier and the multiplicand (step S1)
And a multiplication step of calculating a 2n-bit multiplication result based on the unsigned multiplier and the unsigned multiplicand (step S2)
And the multiplier has a negative sign, the upper n of the multiplication result
The multiplicand is subtracted from the value of the bit, and when the multiplicand has a negative sign, the multiplication step is performed by subtracting the multiplier from the value of the upper n bits of the multiplication result (steps S4, 6). It is characterized by performing.

【0011】また、請求項2記載の発明は、乗数及び被
乗数を格納するレジスタ手段(2)と、当該乗数及び被
乗数に基づいて乗算を行う演算手段(3)と、を有する
演算装置において、演算手段(3)は、nビット(nは
自然数)の乗数及びnビットの被乗数に対し符号操作を
行わない符号なし乗算を行い、符号なし乗数及び符号な
し被乗数を生成する符号なし演算部と、符号なし乗数及
び符号なし被乗数に基づいて2nビットの乗算結果を算
出する乗算部と、乗数が負の符号を有する場合に、乗算
結果の上位nビットの値が格納されたレジスタから被乗
数を減算し、被乗数が負の符号を有する場合に、乗算結
果の上位nビットの値が格納されたレジスタから乗数を
減算する減算部と、を備えることで整数の乗算を行うこ
と、を特徴とする。
The invention according to claim 2 is an arithmetic unit comprising: a register means (2) for storing a multiplier and a multiplicand; and an arithmetic means (3) for multiplying based on the multiplier and the multiplicand. A means (3) performs an unsigned multiplication that does not perform a sign operation on an n-bit multiplier (n is a natural number) and an n-bit multiplicand, and generates an unsigned multiplier and an unsigned multiplicand; A multiplication unit which calculates a 2n-bit multiplication result based on the unmultiplied multiplier and the unsigned multiplicand; and when the multiplier has a negative sign, subtracts the multiplicand from the register in which the value of the upper n bits of the multiplication result is stored, When the multiplicand has a negative sign, a subtraction unit that subtracts the multiplier from the register that stores the value of the upper n bits of the multiplication result is used to perform integer multiplication.

【0012】[0012]

【作用】符号付きの数値である符号付き被乗数をX、符
号付き乗数をYとし、その絶対値をそれぞれ符号なし被
乗数x、符号なし被乗数yとする。
The signed multiplicand, which is a signed numerical value, is X, the signed multiplier is Y, and the absolute values thereof are the unsigned multiplicand x and the unsigned multiplicand y, respectively.

【0013】入力値(X,Y)をそのまま使用して符号
なし乗算を行うために、X、Yは、符号なし数値として
取り扱われる。取り扱う数値のフィールドとnビットと
した場合、X、Yを符号なし数値として表現すると、式
(1)となる。
Since the input values (X, Y) are used as they are for performing unsigned multiplication, X and Y are treated as unsigned numerical values. In the case of a numerical field to be handled and n bits, when X and Y are expressed as unsigned numerical values, the formula (1) is obtained.

【0014】 正の場合:X=x、 Y=y 負の場合:X=2n −x、 Y=2n −y …(1) 例えば、nのビット長が16ビットであった場合、x、
yは、16ビット長のデータとなる。
Positive: X = x, Y = y Negative: X = 2 n −x, Y = 2 n −y (1) For example, if the bit length of n is 16 bits, x ,
y is 16-bit length data.

【0015】X,Yの符号により判定される数値の正負
により、以下の場合に分けられる。 X,Yともに正の場合 X×Y=x×y …(2) 式(2)の結果は、符号付き乗算結果と同じであり、通
常の演算である。X,Yの一方が負の場合 乗算の交換法則により、X,Yいずれか一方が負の場合
を説明すれば十分なので、ここでは、Yが負の場合を考
える。
Positive / negative of the numerical value judged by the signs of X and Y
Is divided into the following cases. When both X and Y are positive X × Y = x × y (2) The result of equation (2) is the same as the signed multiplication result, and
This is an ordinary operation.When one of X and Y is negative When either X or Y is negative due to the exchange law of multiplication
Is sufficient, so let's consider the case where Y is negative.
Get

【0016】 X×Y=x×(2n −y)=2n ×x−x×y …(3) nビット同士の乗算で乗算結果は全部で2nビット長を
有する。以下、MSB側のnビットを上位部といい、L
SB側のnビットを下位部という。
X × Y = x × (2 n −y) = 2 n × x−x × y (3) In the multiplication of n bits, the multiplication result has a total length of 2n bits. Hereinafter, the n bits on the MSB side are referred to as the upper part, and L
The n bits on the SB side are called the lower part.

【0017】下位部の算出においては、式(3)の右辺
第1項の下位部はゼロとなるため、下位部のみを取り出
すと、式(3)右辺第2項、つまり−x×yとなる。上
位部は下位部に何等の影響を与えないため、上位部を無
視すると、この符号なし演算結果の下位部は、符号付き
演算の結果と同じ値となる。
In the calculation of the lower part, the lower part of the first term on the right side of the equation (3) is zero. Therefore, if only the lower part is taken out, the second term on the right side of the equation (3), that is, −x × y. Become. Since the upper part does not affect the lower part in any way, if the upper part is ignored, the lower part of the unsigned operation result has the same value as the result of the signed operation.

【0018】上位部の算出においては、符号なし演算の
結果は、式(3)右辺の値、すなわち2n ×x−x×y
であるが、本来の演算結果は−x×yであるため、上位
部からxを減算しなければならない。
In the calculation of the upper part, the result of the unsigned operation is the value on the right side of the equation (3), that is, 2 n × x−x × y.
However, since the original calculation result is −x × y, x must be subtracted from the upper part.

【0019】このとき、被乗数Xは正の数値であり、X
=xであることから、上位部からXを減算(符号なし数
値同士の減算)する。その演算結果は、符号付き演算結
果と同一の演算結果をもたらす。
At this time, the multiplicand X is a positive numerical value, and X
= X, X is subtracted from the upper part (unsigned numbers are subtracted from each other). The operation result gives the same operation result as the signed operation result.

【0020】Xが負の場合は、式(3)による乗算結果
の上位部より、Yを減算することとなる。X,Yの双方とも負の場合 X×Y=(2n −x)×(2n −y) =22n−2n ×(x+y)+x×y …(4) 下位部の算出においては、式(4)右辺第1項、第2項
の下位部はゼロであるため、下位部のみの数値として
は、第3項のx×yとなる。上位部の数値である式
(4)右辺第1項、第2項は、この下位部の数値に何等
の影響を与えない。よって、下位部の数値は、式(4)
右辺第3項、すなわちx×yとなり、これは符号付き演
算結果と同一の演算結果である。
When X is negative, Y is subtracted from the upper part of the multiplication result by the equation (3). When both X and Y are negative X × Y = (2 n −x) × (2 n −y) = 2 2n −2 n × (x + y) + x × y (4) In the calculation of the lower part, Since the lower part of the first term and the second term on the right side of the equation (4) is zero, the numerical value of only the lower part is x × y of the third term. The first term and the second term on the right side of Expression (4), which are the numerical values of the upper part, have no influence on the numerical values of the lower part. Therefore, the numerical value of the lower part is the formula (4)
It becomes the third term on the right side, that is, x × y, which is the same operation result as the signed operation result.

【0021】上位部の算出においては、符号なし演算結
果は、式(4)第1項、第2項であり、本来の演算結果
は、第3項のみであるため、上位部にx,yを加えなけ
ればならない。
In the calculation of the upper part, the unsigned operation results are the first and second terms of the equation (4), and the original operation result is only the third term. Must be added.

【0022】このとき、X=−x、Y=−yであるた
め、上位部からX及びYを減算する。この演算処理によ
り得られる演算結果は、式(4)の第1項及び第3項の
2n+x×yとなるが、第1項は2nビット長の演算結
果の格納範囲外であるので無視し得る。
At this time, since X = -x and Y = -y, X and Y are subtracted from the higher order part. The calculation result obtained by this calculation process is 2 2n + x × y of the first term and the third term of the formula (4). However, the first term is out of the storage range of the calculation result of 2n bit length and is ignored. You can

【0023】従って、この演算結果は符号付き乗算結果
と同一の演算結果をもたらす。この手順に従えば、如何
なるレジスタ構成であっても、符号なし演算のみで整数
演算を行える演算方法となる。
Therefore, this operation result gives the same operation result as the signed multiplication result. According to this procedure, even if any register configuration is adopted, an arithmetic method capable of performing an integer arithmetic operation only by an unsigned arithmetic operation.

【0024】また、符号なし演算装置のみを有する演算
装置に、この方法を適用すれば、符号の操作を行わず、
整数演算が達成できる。
Further, if this method is applied to an arithmetic unit having only an unsigned arithmetic unit, the operation of the code is not performed,
Integer arithmetic can be achieved.

【0025】[0025]

【実施例】本発明の演算装置に係る好適な実施例を図面
を参照して説明する。図1に本発明の実施例の構成を示
す。図1に示すように、本実施例の演算装置10は、外
部から供給されるプログラムの命令コードに従って制御
する制御部1と、外部のメモリ4から読出された乗数、
被乗数及び演算結果等を一時的に格納するレジスタを有
するレジスタ部2と、レジスタ部2より供給される乗
数、被乗数等に基づいて、制御部1により指定される演
算を行う演算器3と、を備えて構成される。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT A preferred embodiment of an arithmetic unit according to the present invention will be described with reference to the drawings. FIG. 1 shows the configuration of an embodiment of the present invention. As shown in FIG. 1, the arithmetic unit 10 of the present embodiment controls a control unit 1 according to an instruction code of a program supplied from the outside, a multiplier read from an external memory 4,
A register unit 2 having a register that temporarily stores a multiplicand, a calculation result, and the like, and a calculator 3 that performs a calculation specified by the control unit 1 based on the multiplier, the multiplicand, and the like supplied from the register unit 2. It is equipped with.

【0026】レジスタ部2は、RAM、ROMの記憶装
置等のメモリ4とデータの入出力が行えるように接続さ
れており、レジスタR1 〜Rm (mは自然数)の複数本
のレジスタを備える。各レジスタは、2nビットのフィ
ールドを有し、nビットの乗数及び被乗数の乗算結果を
格納できる。同様に、演算器3は、nビットの乗数及び
被乗数、ならびに、2nビットの加減算についてオーバ
ーフローを起こすことなく演算することが可能である。
The register unit 2 is connected to a memory 4 such as a storage device such as a RAM or a ROM so that data can be input / output, and includes a plurality of registers R 1 to R m (m is a natural number). . Each register has a 2n-bit field and can store a multiplication result of an n-bit multiplier and a multiplicand. Similarly, the computing unit 3 is capable of computing n-bit multipliers and multiplicands and 2n-bit additions and subtractions without causing overflow.

【0027】次に、動作を図2のフローチャート及び図
3の具体例に基づいて説明する。図3では、Bは2進数
を表し、数字の末端に記号がない数値は10進数を示
す。演算装置10のメモリ4に格納されているプログラ
ムに従い、演算装置10は演算処理を進める。
Next, the operation will be described based on the flowchart of FIG. 2 and the specific example of FIG. In FIG. 3, B represents a binary number, and a numerical value without a symbol at the end of the numeral indicates a decimal number. According to the program stored in the memory 4 of the arithmetic unit 10, the arithmetic unit 10 advances the arithmetic processing.

【0028】まず、演算装置10の制御部1は、メモリ
4から被乗数X、乗数Yを読み込み、符号ビットを含め
て符号なし被乗数x及び乗数yとして、そのままレジス
タ部2のレジスタR1 及びレジスタR2 に格納する(ス
テップS1)。
First, the control unit 1 of the arithmetic unit 10 reads the multiplicand X and the multiplier Y from the memory 4, and outputs the unsigned multiplicand x and the multiplier y including the sign bit as they are in the register R 1 and the register R of the register unit 2. Store in 2 (step S1).

【0029】例えば、図3に示すように、演算の元とな
る乗数X(例えば、‘3’とする。)及び被乗数Y(例
えば、‘−2’とする。)は、メモリ4等から供給さ
れ、演算装置10の内部レジスタR1 及びR2 に格納さ
れることになる。
For example, as shown in FIG. 3, the multiplier X (for example, "3") and the multiplicand Y (for example, "-2") which are the basis of the calculation are supplied from the memory 4 or the like. Are stored in the internal registers R 1 and R 2 of the arithmetic unit 10.

【0030】このとき、被乗数X及び乗数Yは、数値の
正負に関わらず、すなわち、符号ビットの有効‘1’、
無効‘0’に関わらず、符号ビットをも数値に含めレジ
スタに格納される。図中では、nビット(nは自然数:
ここでは、4ビットとする。)の被乗数Xは、そのまま
符号なし被乗数x(すなわち、‘3’)としてレジスタ
1 に格納され、nビットの乗数Yは符号なし乗数y
(すなわち、‘14’)としてレジスタR2 に格納され
る。
At this time, the multiplicand X and the multiplier Y are irrespective of whether the numerical values are positive or negative, that is, the sign bit is effective "1",
Regardless of invalid '0', the sign bit is also included in the numerical value and stored in the register. In the figure, n bits (n is a natural number:
Here, it is 4 bits. ) Is stored as it is in the register R 1 as the unsigned multiplicand x (that is, '3'), and the n-bit multiplier Y is the unsigned multiplier y.
(That is, '14') is stored in the register R 2 .

【0031】次に、制御部1は、乗算器3に指示して、
レジスタR1 及びレジスタR2 に格納された値に基づく
符号なし演算を行う。図3では、レジスタR1 及びR2
の値は、演算器3において符号なし乗算により乗算さ
れ、符号なし乗算結果zとして、レジスタR3 に格納さ
れている(‘3×14=42’)。
Next, the control unit 1 instructs the multiplier 3 to
An unsigned operation based on the values stored in the registers R 1 and R 2 is performed. In FIG. 3, registers R 1 and R 2
The value of is multiplied by unsigned multiplication in the arithmetic unit 3, and is stored in the register R 3 as the unsigned multiplication result z ('3 × 14 = 42').

【0032】更に、前記被乗数Xが負の符号を有する場
合(ステップS3:YES)、前記符号なし乗算結果z
の上位nビットの上位部の値から前記乗数Yを減算し、
これを再度レジスタR3 に格納する(ステップS4)。
Further, when the multiplicand X has a negative sign (step S3: YES), the unsigned multiplication result z
Subtract the multiplier Y from the value of the upper part of the upper n bits of
This is stored again in the register R 3 (step S4).

【0033】また、前記乗数Yが負の符号を有する場合
(ステップS5:YES)、前記符号なし乗算結果zの
上位nビットの上位部の値から前記被乗数Xを減算し、
ここでは、乗数Yが負の数(‘−2’)であるため、乗
算結果zの上位4ビットから被乗数X‘3’を減算し、
演算結果をレジスタR3 に格納する(ステップS6)。
When the multiplier Y has a negative sign (step S5: YES), the multiplicand X is subtracted from the value of the upper part of the upper n bits of the unsigned multiplication result z,
Here, since the multiplier Y is a negative number ('-2'), the multiplicand X'3 'is subtracted from the upper 4 bits of the multiplication result z,
The calculation result is stored in the register R 3 (step S6).

【0034】以上により、レジスタR4 に格納される演
算結果は、符号付きデータとして判定すると‘−6’と
なり、符号付き演算装置で演算を行った場合(‘3×−
2=−6’)と同一の値となる。
As a result, the operation result stored in the register R 4 becomes "-6" when judged as signed data, and when the operation is performed by the signed arithmetic unit ('3 ×-
2 = −6 ′).

【0035】上記の如く、本実施例によれば、符号なし
乗算装置のみを使用した演算手順により、符号付き演算
を行うことができ、演算器3を有効に利用することがで
きる。また、各レジスタの使用状態を見ても判るよう
に、符号ビットに関する保存動作、ビット反転動作等が
一切必要なく、演算処理上の手順の省力ができる。その他の変形例 本発明の上記実施例に限らず種々の変形が可能である。
As described above, according to the present embodiment, the signed operation can be performed by the operation procedure using only the unsigned multiplier, and the operator 3 can be effectively used. Further, as can be seen from the usage status of each register, no saving operation or bit inverting operation regarding the sign bit is required, and the labor in the procedure of arithmetic processing can be saved. Other Modifications Various modifications are possible without being limited to the above embodiment of the present invention.

【0036】例えば、上記実施例では、マイクロプロセ
ッサの演算処理を想定したが、デジタル・シグナル・プ
ロセッサ等、整数の乗算を多用する演算装置であれば、
本発明を適用できる。
For example, in the above embodiment, the arithmetic processing of the microprocessor is assumed, but if it is an arithmetic device such as a digital signal processor that frequently uses integer multiplication,
The present invention can be applied.

【0037】[0037]

【発明の効果】以上の通り、請求項1記載の発明によれ
ば、符号なしの演算手順により、符号付き演算を行うこ
とができ、また、手順数を減らすこともできるので、処
理速度の向上に貢献できる。
As described above, according to the first aspect of the present invention, the signed operation can be performed by the unsigned operation procedure, and the number of procedures can be reduced, so that the processing speed is improved. Can contribute to.

【0038】また、請求項2記載の発明によれば、符号
付き演算装置を用いることなく、正負の整数の演算が少
ない手順で行えるので、乗算装置一個分のサイズの縮小
が可能となる。特に、マイクロチップが小型化・高密度
化している昨今にあったは、比較的大きな面積を占有す
る乗算器の面積が約半分になることは、回路経済上意義
が大きい。
According to the second aspect of the present invention, since the arithmetic operation of the positive and negative integers can be performed in a small procedure without using the signed arithmetic unit, the size of one multiplication unit can be reduced. In particular, in recent years when microchips have become smaller and more dense, the fact that the area of the multiplier, which occupies a relatively large area, is reduced to about half has great significance in terms of circuit economy.

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

【図1】本発明の実施例による演算装置を示すブロック
図である。
FIG. 1 is a block diagram showing an arithmetic unit according to an embodiment of the present invention.

【図2】実施例の演算装置の演算動作を示すフローチャ
ートである。
FIG. 2 is a flowchart showing a calculation operation of the calculation device according to the embodiment.

【図3】レジスタ内における実際の数値の演算の一例を
示す説明図である。
FIG. 3 is an explanatory diagram showing an example of actual calculation of numerical values in a register.

【符号の説明】[Explanation of symbols]

1…制御部 2…レジスタ部 3…演算器 4…メモリ 10…本発明の演算装置 DESCRIPTION OF SYMBOLS 1 ... Control part 2 ... Register part 3 ... Arithmetic unit 4 ... Memory 10 ... Arithmetic device of this invention

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 レジスタ手段(2)及び演算手段(3)
を使用してnビット(nは自然数)の前記乗数及びnビ
ットの被乗数により2nビットの整数演算を行う演算方
法において、 前記乗数及び前記被乗数に対し符号操作を行わない符号
なし乗算を行い、符号なし乗数及び符号なし被乗数を生
成する符号なし演算工程(ステップS1)と、 前記符号なし乗数及び前記符号なし被乗数に基づいて2
nビットの乗算結果を算出する乗算工程(ステップS
2)と、 前記乗数が負の符号を有する場合に、前記乗算結果の上
位nビットの値から前記被乗数を減算し、前記被乗数が
負の符号を有する場合に、前記乗算結果の上位nビット
の値から前記乗数を減算する減算工程(ステップS4,
6)とにより、整数の乗算を行うこと、を特徴とする演
算方法。
1. Register means (2) and arithmetic means (3)
Using an n-bit (n is a natural number) multiplier and an n-bit multiplicand to perform an integer operation of 2n bits, the unsigned multiplication is performed on the multiplier and the multiplicand without performing a sign operation, An unsigned operation step (step S1) of generating an unsigned multiplier and an unsigned multiplicand; and 2 based on the unsigned multiplier and the unsigned multiplicand.
A multiplication step of calculating an n-bit multiplication result (step S
2) and, when the multiplier has a negative sign, the multiplicand is subtracted from the value of the upper n bits of the multiplication result, and when the multiplicand has a negative sign, the higher n bits of the multiplication result A subtraction step of subtracting the multiplier from the value (step S4,
6) An arithmetic method characterized by performing an integer multiplication by and.
【請求項2】 乗数及び被乗数を格納するレジスタ手段
(2)と、当該乗数及び被乗数に基づいて乗算を行う演
算手段(3)と、を有する演算装置において、 前記演算手段(3)は、nビット(nは自然数)の前記
乗数及びnビットの被乗数に対し符号操作を行わない符
号なし乗算を行い、符号なし乗数及び符号なし被乗数を
生成する符号なし演算部と、 前記符号なし乗数及び前記符号なし被乗数に基づいて2
nビットの乗算結果を算出する乗算部と、 前記乗数が負の符号を有する場合に、前記乗算結果の上
位nビットの値が格納されたレジスタから前記被乗数を
減算し、前記被乗数が負の符号を有する場合に、前記乗
算結果の上位nビットの値が格納されたレジスタから前
記乗数を減算する減算部と、を備えることで整数の乗算
を行うこと、 を特徴とする演算装置。
2. An arithmetic unit comprising: a register means (2) for storing a multiplier and a multiplicand; and an arithmetic means (3) for performing multiplication based on the multiplier and the multiplicand, wherein the arithmetic means (3) is n. An unsigned arithmetic unit that generates an unsigned multiplier and an unsigned multiplicand by performing unsigned multiplication without performing a sign operation on the multiplier of bits (n is a natural number) and the n-bit multiplicand, and the unsigned multiplier and the sign None based on multiplicand 2
a multiplication unit that calculates an n-bit multiplication result; and, if the multiplier has a negative sign, subtracts the multiplicand from a register that stores the value of the upper n bits of the multiplication result, and the multiplicand has a negative sign. And a subtraction unit that subtracts the multiplier from a register that stores the value of the upper n bits of the multiplication result, the integer multiplication is performed.
JP6048417A 1994-03-18 1994-03-18 Arithmetic method and unit Withdrawn JPH07261984A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6048417A JPH07261984A (en) 1994-03-18 1994-03-18 Arithmetic method and unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6048417A JPH07261984A (en) 1994-03-18 1994-03-18 Arithmetic method and unit

Publications (1)

Publication Number Publication Date
JPH07261984A true JPH07261984A (en) 1995-10-13

Family

ID=12802743

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6048417A Withdrawn JPH07261984A (en) 1994-03-18 1994-03-18 Arithmetic method and unit

Country Status (1)

Country Link
JP (1) JPH07261984A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656751A (en) * 2021-08-10 2021-11-16 上海新氦类脑智能科技有限公司 Method, device, equipment and medium for realizing signed operation of unsigned DAC (digital-to-analog converter)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656751A (en) * 2021-08-10 2021-11-16 上海新氦类脑智能科技有限公司 Method, device, equipment and medium for realizing signed operation of unsigned DAC (digital-to-analog converter)
CN113656751B (en) * 2021-08-10 2024-02-27 上海新氦类脑智能科技有限公司 Method, apparatus, device and medium for realizing signed operation by unsigned DAC

Similar Documents

Publication Publication Date Title
US7236995B2 (en) Data processing apparatus and method for converting a number between fixed-point and floating-point representations
JPH03105614A (en) Matrix computation circuit
US20040117421A1 (en) Methods and systems for computing floating-point intervals
JPH07261984A (en) Arithmetic method and unit
JPH10187416A (en) Floating point arithmetic unit
Raghunath et al. A compact carry-save multiplier architecture and its applications
JP4428778B2 (en) Arithmetic device, arithmetic method, and computing device
JP3336986B2 (en) Signal processor and multiply-accumulate unit with rounding function used therefor
JPH06301710A (en) Method and device for double precision product-sum operation
JPH0225924A (en) Floating point arithmetic processor
JPS59136849A (en) Dividing device
JPH01282633A (en) Non-normalized number processing system
JP3277220B2 (en) Operation method of remainder multiplication device
JPH06180640A (en) Device and method for division
Brown Binary arithmetic
JP3659408B2 (en) Data arithmetic processing apparatus and data arithmetic processing program
JP3068640B2 (en) Computing device
JP3522167B2 (en) Arithmetic processing circuit and arithmetic processing method
JPS61138334A (en) Decimal arithmetic processor
JPS60245046A (en) Logical shift arithmetic circuit
JPH01128129A (en) Floating point addition/subtraction device
JPH0361224B2 (en)
JPS5939772B2 (en) Exponential function calculation method
JPH0566924A (en) Product sum computing element
JPH05313859A (en) Microprocessor

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20010605