JPH043222A - Data processor - Google Patents
Data processorInfo
- Publication number
- JPH043222A JPH043222A JP2105545A JP10554590A JPH043222A JP H043222 A JPH043222 A JP H043222A JP 2105545 A JP2105545 A JP 2105545A JP 10554590 A JP10554590 A JP 10554590A JP H043222 A JPH043222 A JP H043222A
- Authority
- JP
- Japan
- Prior art keywords
- data
- register
- bit
- arithmetic
- value
- 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
Links
Abstract
Description
【発明の詳細な説明】
[産業上の利用分野]
この発明は、乗算機能を有するデータ処理装置に関する
ものである。DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a data processing device having a multiplication function.
第4図は従来のデータ処理装置のうち、乗算処理に用い
られる部分の構成を説明するブロック図である。FIG. 4 is a block diagram illustrating the configuration of a portion of a conventional data processing device used for multiplication processing.
図において、1は32ビット幅の81バス、2は32ビ
ット幅の82バス、3は32ビット幅のDバスである。In the figure, 1 is a 32-bit wide 81 bus, 2 is a 32-bit wide 82 bus, and 3 is a 32-bit wide D bus.
10はデータ処理装置内で使用する定数を格納している
定数ROMで、S1バス1.S2バス2への出力経路を
備えている。2oは複数個の32ビット幅のレジスタで
構成されるレジスタファイルで、Dバス3からの入力経
路とS1バス1およびS2バス2への出力経路を備えて
いる。10 is a constant ROM that stores constants used within the data processing device, and S1 bus 1. It has an output path to the S2 bus 2. 2o is a register file composed of a plurality of 32-bit wide registers, and has an input path from the D bus 3 and an output path to the S1 bus 1 and the S2 bus 2.
31はAレジスタで、S1バスからの入力経路とALU
35への出力経路をもつ33ビツト幅のレジスタで、S
1バス1からデータを入力する際には33ビツトに符号
拡張またはゼロ拡張を行い、ALU35に出力する際に
は33ビツトをそのまま出力する。また、Aレジスタ3
1の値をゼロにしたり、Aレジスタ31の値を反転させ
てALU35に出力する機能を有している。32はBレ
ジスタで、S2バス2およびALU35からの入力経路
とALU35への出力経路を持つ33ビツト幅のレジス
タである。S2バス2からデータを入力する際には33
ビツトに符号拡張またはゼロ拡張を行い、ALU35と
の入出力は33ビツトで行う。また、Bレジスタ32の
値をゼロにしたり、Bレジスタ32の値を反転させてA
LLI35に出力する機能を有している。Bレジスタ3
2は、Mレジスタ33と結合して左右方向にlビットの
シフトが可能である。33はMレジスタで、S2バス2
からの入力経路とDバス3への出力経路をもつ33ビツ
ト幅のレジスタである。31 is the A register, which connects the input path from the S1 bus and the ALU.
A 33-bit wide register with an output path to S
When data is input from bus 1, it is sign-extended or zero-extended to 33 bits, and when output to ALU 35, 33 bits are output as they are. Also, A register 3
It has a function of setting the value of 1 to zero or inverting the value of the A register 31 and outputting it to the ALU 35. 32 is a B register, which is a 33-bit wide register having an input path from the S2 bus 2 and the ALU 35, and an output path to the ALU 35. 33 when inputting data from S2 bus 2.
Bits are sign-extended or zero-extended, and input/output to and from the ALU 35 is performed using 33 bits. Also, you can set the value of the B register 32 to zero or invert the value of the B register 32 to
It has a function of outputting to LLI35. B register 3
2 is combined with the M register 33 and can shift l bits in the left and right direction. 33 is M register, S2 bus 2
It is a 33-bit wide register with an input path from the D bus 3 and an output path to the D bus 3.
S2バス2からデータを入力する際には、33ビツトに
符号拡張またはゼロ拡張を行い、Dバス3への出力は下
位32ビット分を出力する。なお、Aレジスタ31.B
レジスタ32およびMレジスタ33が33ビツト幅を持
つのは符号付きデータの乗算も符号なしデータの乗算も
同一に行わせることを考慮し、32ビット符号なしデー
タをゼロ拡張して33ビット符号付きデータに変換させ
るためである。Mレジスタ33のLSB側には1ビツト
の付加ビット34が結合されている。Mレジスタ33と
付加ビット34を結合して右方向に1ビツトのシフトを
行うことができる。35は算術論理演算回路(ALU)
で、Aレジスタ31およびBレジスタ32から出力され
る33ビツトのデータ間で演算を行い、その結果をDバ
ス3またはBレジスタ32に出力する。算術論理演算回
路(ALU)35は33ビツトデ一タ間で演算した結果
は33ビツトとなるが、Dバス3には下位32ビツトを
出力し、Bレジスタ32には33ビツトデータをそのま
ま出力する。ALU35では加減算、論理和、論理積、
排他的論理和等の各種演算処理が可能である。When data is input from the S2 bus 2, it is sign-extended or zero-extended to 33 bits, and the lower 32 bits are output to the D bus 3. Note that the A register 31. B
The reason why the register 32 and the M register 33 have a width of 33 bits is because multiplication of signed data and multiplication of unsigned data can be performed in the same way, and 32-bit unsigned data is zero-extended to create 33-bit signed data. This is to convert it into One additional bit 34 is coupled to the LSB side of the M register 33. By combining the M register 33 and the additional bit 34, it is possible to shift one bit to the right. 35 is an arithmetic logic unit (ALU)
Then, an operation is performed between the 33-bit data output from the A register 31 and the B register 32, and the result is output to the D bus 3 or the B register 32. The arithmetic and logic operation circuit (ALU) 35 calculates 33 bits between the 33 bit data, but outputs the lower 32 bits to the D bus 3 and outputs the 33 bit data to the B register 32 as is. In ALU35, addition and subtraction, logical sum, logical product,
Various types of arithmetic processing such as exclusive OR are possible.
36はゼロフラグで、ALU35における演算結果がゼ
ロの場合に、「1」となるフラグであり、演算結果がゼ
ロ以外の場合は「0」となる。36 is a zero flag, which becomes "1" when the calculation result in the ALU 35 is zero, and becomes "0" when the calculation result is other than zero.
37はデコード回路で、Mレジスタ33のLSB値と付
加ビット34の2ビツトをデコードし、ALU35の演
算を指定する信号を送る回路である。デコード回路37
の動作は第5図に示しである。37 is a decoding circuit which decodes the LSB value of the M register 33 and 2 bits of the additional bit 34, and sends a signal specifying an operation to the ALU 35. Decode circuit 37
The operation is shown in FIG.
40はバレルシフタで、32ビツトのデータを一度に複
数ビットシフトさせることができる。シフト幅データと
被シフトデータをそれぞれS1バス1とS2バス2から
入力し、シフト結果をDバス3に出力する。40 is a barrel shifter which can shift multiple bits of 32-bit data at once. Shift width data and shifted data are input from S1 bus 1 and S2 bus 2, respectively, and the shift results are output to D bus 3.
第5図は、第4図に示したデコード回路37のデコード
状態に基づ<ALU35の実行演算種別対応を説明する
対応図である。FIG. 5 is a correspondence diagram illustrating the correspondence between the execution operation types of the ALU 35 based on the decoding state of the decoding circuit 37 shown in FIG.
Mレジスタ33のLSB値と付加ビット34の2ビツト
をデコードした結果、ALU35に対してどのような演
算を指定するかを示したものである。The result of decoding the LSB value of the M register 33 and the 2 bits of the additional bit 34 indicates what kind of operation is specified for the ALU 35.
第6図は、第4図に示したデータ処理装置における乗算
実行処理シーケンスを説明する図である。以下、32ビ
ツトデータどうじの乗算を行う場合について説明する。FIG. 6 is a diagram illustrating a multiplication execution processing sequence in the data processing apparatus shown in FIG. 4. In the following, a case will be described in which 32-bit data is multiplied.
なお、乗算は一次のB。Note that multiplication is first-order B.
othのアルゴリズムを用いて実行する。これは、部分
積の下位2ビツトをデコードし、その結果に基づいて部
分積を加えるか、減じるかあるいは何もしないかを選択
して右にシフトしていく方法である。It is executed using the oth algorithm. In this method, the lower two bits of the partial product are decoded, and based on the result, the partial product is selected to be added, subtracted, or nothing, and then shifted to the right.
先ず、データを各レジスタに入力する。乗数なAレジス
タ31に、被乗数なMレジスタ33に入力する。その際
、それぞれのレジスタには32ビツトのデータを33ビ
ツトに拡張して格納する。First, data is input into each register. The multiplier is input to the A register 31, and the multiplicand is input to the M register 33. At this time, 32-bit data is expanded to 33-bit data and stored in each register.
符号付きデータなら符号拡張、符号なしデータならゼロ
拡張である。このように、32ビット符号付きデータと
32ビット符号なしデータを33ビット符号付きデータ
に変換させることにより、符号付きデータと符号なしデ
ータを同じ方法で乗算実行することができる。一方、B
レジスタ32と付加ビット34はゼロにする。Signed data is sign-extended, unsigned data is zero-extended. In this way, by converting 32-bit signed data and 32-bit unsigned data into 33-bit signed data, signed data and unsigned data can be multiplied in the same way. On the other hand, B
Register 32 and additional bit 34 are set to zero.
次に、デコード回路37がMレジスタ33のLSB値と
付加ビット34の2ビツトをデコードし、第5図に示す
ような演算操作をALU35に指定する。ALtJ35
で実行された演算結果をBレジスタ32に戻す。そして
、Bレジスタ32゜Mレジスタ33および付加ビット3
4を結合して1ビツト右方向に算術シフトを行う。Next, the decoding circuit 37 decodes the LSB value of the M register 33 and the 2 bits of the additional bit 34, and specifies the arithmetic operation as shown in FIG. 5 to the ALU 35. ALtJ35
The result of the operation executed in is returned to the B register 32. Then, B register 32°M register 33 and additional bit 3
4 and performs an arithmetic shift one bit to the right.
このようなALU35の演算と右シフトを33回繰り返
すと、Bレジスタ32とMレジスタ33とに66ビツト
の積を得ることができる。Bレジスタ32には、上位3
3ビット分が、Mレジスタ33には下位33ビット分が
格納されている。Bレジスタ32を左に「1」ビットシ
フトする。この時、Bレジスタ32のLSBにはMレジ
スタ33のMSB値が入る。By repeating the operation and right shift of the ALU 35 33 times, a 66-bit product can be obtained in the B register 32 and the M register 33. The B register 32 contains the upper 3
Three bits are stored in the M register 33, and the lower 33 bits are stored. Shift the B register 32 to the left by "1" bit. At this time, the MSB value of the M register 33 is entered into the LSB of the B register 32.
以上のような方法で、32ビツトデータどうじの乗算を
行い、64ビツトの積をBレジスタ32およびMレジス
タ33に得ることができる。By the method described above, 32-bit data can be multiplied and a 64-bit product can be obtained in the B register 32 and the M register 33.
ここで、オーバーフローの検出処理について説明する。Here, overflow detection processing will be explained.
積を下位桁32ビツトで表わす場合には、積が32ビツ
トに納まらないことを示すオーバーフローの検出が必要
である。上位桁の全ビットが下位桁の符号ビットと一致
していない場合がオーバーフローであるので、乗算実行
後の上記状態でオーバーフローとなる条件は、符号付き
データならばBレジスタ32の各ビットの中でMレジス
タ33のMSBと一致しないビットがあるとき、符号な
しデータならばBレジスタ32に格納されている値がゼ
ロ以外の時である。オーバーフローを検出するためには
、以下のような処理が必要である。When the product is represented by the lower 32 bits, it is necessary to detect an overflow indicating that the product does not fit within the 32 bits. An overflow occurs when all bits of the upper digits do not match the sign bits of the lower digits, so the condition for overflow in the above state after multiplication is that if the data is signed, each bit of the B register 32 When there is a bit that does not match the MSB of the M register 33, the value stored in the B register 32 is non-zero if it is unsigned data. In order to detect overflow, the following processing is required.
先ず、Mレジスタ33の値をDバス3に出力し、その値
をレジスタファイル20中のレジスタであるROレジス
タに格納する。次にROレジスタの値をバレルシフタで
右方向に32ビツトシフトし、その結果をR1レジスタ
に格納する。この時、符号付きデータの場合には算術シ
フトを行い、符号なしデータの場合は論理シフトを行う
。First, the value of the M register 33 is output to the D bus 3, and the value is stored in the RO register, which is a register in the register file 20. Next, the value of the RO register is shifted to the right by 32 bits using a barrel shifter, and the result is stored in the R1 register. At this time, an arithmetic shift is performed in the case of signed data, and a logical shift is performed in the case of unsigned data.
すなわち、符号付きデータでROレジスタの値が負の場
合には、全ビット1 (16進数で(FFFFFFFF
H) )となり、それ以外はゼロとなる。最後に、R1
レジスタの値をAレジスタ31に入力し、ALU35で
Bレジスタ32の値と比較する。比較した結果、一致し
なければオーバーフローであることを示しており、ゼロ
フラグ36がrOJとなる。In other words, if the value of the RO register is negative for signed data, all bits are 1 ((FFFFFFFFF in hexadecimal)
H)), and the other values are zero. Finally, R1
The value of the register is input to the A register 31 and compared with the value of the B register 32 in the ALU 35. As a result of the comparison, if they do not match, it indicates an overflow, and the zero flag 36 becomes rOJ.
一方、オーバーフローしていなければ比較結果が一致す
るのでゼロフラグ36が「1」となる。On the other hand, if there is no overflow, the comparison results match and the zero flag 36 becomes "1".
このように、ゼロフラグ36の値によってオーバーフロ
ーの有無を検出することができる。つまり、ゼロフラグ
36が「○」ならばオーバーフローであり、ゼロフラグ
36が「1」ならばオーバーフローでないことを表わし
ている。In this way, the presence or absence of overflow can be detected based on the value of the zero flag 36. In other words, if the zero flag 36 is "o", it means overflow, and if the zero flag 36 is "1", it means no overflow.
以上のように、乗算におけるオーバーフローを検出する
処理には、■積の読み出し、■シフト、■比較という3
サイクルの処理が必要となる。As mentioned above, there are three processes for detecting overflow in multiplication: ■ reading the product, ■ shifting, and ■ comparing.
Cycle processing is required.
[発明が解決しようとする課題]
従来のデータ処理装置は以上のように構成されているの
で、乗算におけるオーバフローを検出するためには、3
サイクルを必要とし、処理時間が長(なるという問題点
があった。[Problems to be Solved by the Invention] Since the conventional data processing device is configured as described above, in order to detect overflow in multiplication, three steps are required.
There were problems in that it required cycles and the processing time was long.
この発明は、上記の問題点を解決するためになされたも
ので、積の下位桁データの符号が正の場合には積の上位
桁データをそのままALUに出力し、負の場合には積の
上位桁データの反転値をALUに出力するように制御す
ることにより、乗算におけるオーバフローを高速に検出
できるデータ処理装置を得ることを目的とする。This invention was made to solve the above problem, and when the sign of the lower digit data of the product is positive, the upper digit data of the product is output as is to the ALU, and when the sign is negative, the sign of the lower digit data of the product is output to the ALU. It is an object of the present invention to provide a data processing device that can detect overflow in multiplication at high speed by controlling the inverted value of high-order digit data to be output to an ALU.
[課題を解決するための手段]
この発明に係るデータ処理装置は、第2の格納手段の最
上位ビットの値に応じて第1の格納手段に格納されてい
るデータの算術論理演算手段への反転出力または非反転
出力を制御する制御手段を設けたものである。[Means for Solving the Problems] A data processing device according to the present invention processes data stored in a first storage means to an arithmetic and logic operation means according to the value of the most significant bit of the second storage means. A control means for controlling an inverted output or a non-inverted output is provided.
また、制御手段は、第2の格納手段の最上位ビットの値
と符号付きデータであるか符号なしデータであるかの情
報に応じて第1の格納手段に格納されているデータの算
術論理演算手段への反転出力または非反転出力を制御す
るように構成したものである。Further, the control means performs arithmetic and logical operations on the data stored in the first storage means according to the value of the most significant bit of the second storage means and information on whether the data is signed data or unsigned data. The device is configured to control an inverted output or a non-inverted output to the device.
[作用]
この発明においては、算術論理演算手段による乗算処理
がmビットのデータとnビットのデータとの乗算によっ
て得られる(m+n)ビットの積のうち、上位桁のデー
タが第1の格納手段に格納され、下位桁のデータが第2
の格納手段に格納されると、制御手段が第2の格納手段
の最上位ビットの値に応じて第1の格納手段に格納され
ているデータの算術論理演算手段への反転出力または非
反転出力を制御し、算術論理演算手段が反転出力または
非反転出力された第1の格納手段に格納されているデー
タと第2の格納手段されたデータの値に応じてゼロ検出
ビットを設定する。[Operation] In the present invention, the multiplication processing by the arithmetic and logic operation means is performed by multiplying m-bit data by n-bit data, and of the (m+n)-bit product, the data in the upper digits is stored in the first storage means. The lower digit data is stored in the second
When the data is stored in the storage means of the second storage means, the control means inverts or non-inverts the data stored in the first storage means to the arithmetic and logic operation means according to the value of the most significant bit of the second storage means. The arithmetic and logic operation means sets the zero detection bit according to the values of the data stored in the first storage means and the data stored in the second storage means, which are inverted or non-inverted.
また、算術論理演算手段による乗算処理がmビットのデ
ータとnビットのデータとの乗算によって得られる(m
+n)ビットの積のうち上位桁のデータが第1の格納手
段に格納され、下位桁のデータが第2の格納手段に格納
されると、制御手段が第2の格納手段の最上位上ビット
の値と符号付きデータであるか符号なしデータであるか
の情報に応じて第1の格納手段に格納されているデータ
の算術論理演算手段への反転出力または非反転出力を制
御し、算術論理演算手段が反転出力または非反転出力さ
れた第1の格納手段に格納されているデータの値に応じ
てゼロ検出ビットを設定する。Furthermore, the multiplication process by the arithmetic and logic operation means is obtained by multiplying m-bit data by n-bit data (m
+n) When the upper digit data of the product of bits is stored in the first storage means and the lower digit data is stored in the second storage means, the control means controls the most significant bit of the second storage means. The arithmetic logic controller controls inverted output or non-inverted output of the data stored in the first storage means to the arithmetic logic operation means according to the value of The arithmetic means sets the zero detection bit according to the value of the data stored in the first storage means, which is an inverted output or a non-inverted output.
[実施例]
第1図はこの発明の一実施例を示すデータ処理装置のう
ち、乗算処理に用いられる部分の構成を説明するブロッ
ク図であり、第4図と同一のものには同じ符号を付しで
ある。[Embodiment] FIG. 1 is a block diagram illustrating the configuration of a part used for multiplication processing in a data processing device showing an embodiment of the present invention, and the same parts as in FIG. 4 are designated by the same reference numerals. It is attached.
図において、3BはBレジスタ出力制御回路で、Mレジ
スタ33のMSB値と扱うデータが符号付きであるか符
号なしであるかの情報をもとにBレジスタ32の出力を
制御する。39は信号線で、現在処理しているデータが
符号付きであるか符号なしであるかを示す。In the figure, 3B is a B register output control circuit that controls the output of the B register 32 based on the MSB value of the M register 33 and information on whether the data to be handled is signed or unsigned. A signal line 39 indicates whether the data currently being processed is signed or unsigned.
このように構成されたデータ処理装置において、算術論
理演算手段(この実施例ではALU35)による乗算処
理がmビットのデータとnビットのデータとの乗算によ
って得られる(m+n)ビットの積のうち、上位桁のデ
ータが第1の格納手段(この実施例ではBレジスタ32
)に格納され、下位桁のデータが第2の格納手段(この
実施例ではMレジスタ33)に格納されると、制御手段
(この実施例ではBレジスタ出力制御回路38)が第2
の格納手段の最上位ビットの値に応じて第1の格納手段
に格納されているデータの算術論理演算手段への反転出
力または非反転出力を制御し、算術論理演算手段が反転
出力または非反転出力された第1の格納手段に格納され
ているデータの値に応じてゼロ検出ビットを設定する。In the data processing device configured as described above, the multiplication process by the arithmetic and logic operation means (ALU 35 in this embodiment) is performed by multiplying m-bit data by n-bit data, out of the (m+n)-bit product, The upper digit data is stored in the first storage means (B register 32 in this embodiment).
), and when the lower digit data is stored in the second storage means (in this embodiment, the M register 33), the control means (in this embodiment, the B register output control circuit 38)
The arithmetic logic operation means controls inverted output or non-inverted output of the data stored in the first storage means to the arithmetic logic operation means according to the value of the most significant bit of the storage means of the first storage means. A zero detection bit is set according to the value of the data stored in the output first storage means.
また、ALU35による乗算処理がmビットのデータと
nビットのデータとの乗算によって得られる( m +
n )ビットの積のうち、上位桁のデータがBレジス
タ32に格納され、下位桁のデータがMレジスタ33に
格納されると、Bレジスタ出力制御回路38がBレジス
タ32の最上位ビットの値と符号付きデータであるか符
号なしデータであるかの情報に応じてAレジスタ31に
格納されているデータのALU35への反転出力または
非反転出力を制御し、ALU35が反転出力または非反
転出力されたAレジスタ31に格納されているデータと
Bレジスタ32されたデータとからゼロ検出ビットを設
定する。In addition, the multiplication process by the ALU 35 is obtained by multiplying m-bit data by n-bit data ( m +
n) When the upper digit data of the product of bits is stored in the B register 32 and the lower digit data is stored in the M register 33, the B register output control circuit 38 outputs the value of the most significant bit of the B register 32. Controls inverted output or non-inverted output of the data stored in the A register 31 to the ALU 35 according to information on whether the data is signed data or unsigned data, so that the ALU 35 outputs inverted output or non-inverted output. A zero detection bit is set from the data stored in the A register 31 and the data stored in the B register 32.
第2図は、第1図に示したBレジスタ出力制御回路38
の動作を説明する図であり、Mレジスタ33のMSB値
と扱うデータが符号付きであるか符号なしであるかの情
報を示す信号線39の内容からBレジスタ32の出力を
どのように制御するかを示したものである。FIG. 2 shows the B register output control circuit 38 shown in FIG.
This is a diagram explaining the operation of the B register 32, and shows how the output of the B register 32 is controlled based on the MSB value of the M register 33 and the contents of the signal line 39, which indicates whether the data to be handled is signed or unsigned. This shows that.
以下、第1図に示したデータ処理装置の各部の動作につ
いて説明する。The operation of each part of the data processing apparatus shown in FIG. 1 will be explained below.
先ず、データを各レジスタに入力する。乗数をAレジス
タ31に、被乗数なMレジスタ33に入カする。その際
、それぞれのレジスタには32ビツトのデータを33ビ
ツトに拡張して格納する。First, data is input into each register. The multiplier is input into the A register 31 and the multiplicand is input into the M register 33. At this time, 32-bit data is expanded to 33-bit data and stored in each register.
符号付きデータなら符号拡張、符号なしデータならゼロ
拡張である。このように、32ビット符号付きデータと
32ビット符号なしデータを33ビット符号付きデータ
に変換させることにより、符号付きデータと符号なしデ
ータを同じ方法で乗算実行することができる。一方、B
レジスタ32と付加ビット34はゼロにする。Signed data is sign-extended, unsigned data is zero-extended. In this way, by converting 32-bit signed data and 32-bit unsigned data into 33-bit signed data, signed data and unsigned data can be multiplied in the same way. On the other hand, B
Register 32 and additional bit 34 are set to zero.
次に、デコード回路37がMレジスタ33のLSB値と
付加ビット34の2ビツトをデコードし、第5図に示す
ような演算操作をALU35に指定する。ALU35で
実行された演算結果をBレジスタ32に戻す。そして、
Bレジスタ32゜Mレジスタ33および付加ビット34
を結合して1ビツト右方向に算術シフトを行う。Next, the decoding circuit 37 decodes the LSB value of the M register 33 and the 2 bits of the additional bit 34, and specifies the arithmetic operation as shown in FIG. 5 to the ALU 35. The calculation result executed by the ALU 35 is returned to the B register 32. and,
B register 32°M register 33 and additional bit 34
, and performs an arithmetic shift one bit to the right.
このようなALtJ35の演算と右シフトを33回繰り
返すと、Bレジスタ32とMレジスタ33とに66ビツ
トの積を得ることができる。Bレジスタ32には、上位
33ビット分が、Mレジスタ33には下位33ビット分
が格納されている。Bレジスタ32を左に「1」ビット
シフトする。この時、Bレジスタ32のLSBにはMレ
ジスタ33のMSB値が入る。By repeating such ALtJ35 calculation and right shift 33 times, a 66-bit product can be obtained in the B register 32 and M register 33. The B register 32 stores the upper 33 bits, and the M register 33 stores the lower 33 bits. Shift the B register 32 to the left by "1" bit. At this time, the MSB value of the M register 33 is entered into the LSB of the B register 32.
以上のような方法で、32ビツトデータどうじの乗算を
行い、64ビツトの積をBレジスタ32およびMレジス
タ33に得ることができる。By the method described above, 32-bit data can be multiplied and a 64-bit product can be obtained in the B register 32 and the M register 33.
以下、この発明に係る乗算処理時のオーバーフローの検
出処理について説明する。Hereinafter, overflow detection processing during multiplication processing according to the present invention will be described.
積を下位桁32ビツトで表わす場合には、積が32ビツ
トに納まらないことを示すオーバフローの検出が必要で
ある。上位桁の全ビットが下位桁の符号ビットと一致し
ていない場合がオーバフローであるので、乗算実行後の
上記状態でオーバフローとなる条件は、符号付きデータ
ならばBレジスタ32に格納されている値の各ビットの
中でMレジスタ33のMSB値と一致しないビットがあ
る時、符号なしデータならばBレジスタ32に格納され
ている値がゼロ以外の時である。オーバフローを検出す
るためには、以下のような処理が必要である。When the product is represented by the lower 32 bits, it is necessary to detect overflow indicating that the product does not fit within the 32 bits. An overflow occurs when all bits of the upper digits do not match the sign bit of the lower digits, so the condition for an overflow in the above state after multiplication is that if it is signed data, the value stored in the B register 32 When there is a bit among the bits that does not match the MSB value of the M register 33, if the data is unsigned data, the value stored in the B register 32 is non-zero. In order to detect overflow, the following processing is required.
先ず、Aレジスタ31の値をゼロにしてALU35に出
力する。Bレジスタ32の値はBレジスタ出力制御回路
38による指示に従って出力する。すなわち、符号付き
データを扱っている場合には、Mレジスタ33のMSB
値が「1」の時のみ、Bレジスタ32の値を反転して出
力し、それ以外の時には、そのまま出力する。符号なし
データを扱っている場合には、Mレジスタ33のMSB
値にかかわらずBレジスタ32の値をそのまま出力する
。このような制御を行うことによって、積の符号や符号
付きデータであるか符号なしデータであるかの区別なく
、Bレジスタ32からの出力がオーバフローのない場合
には必ずゼロになる。ALU35ではAレジスタ31か
らの出力とBレジスタ32からの出力との論理和をとる
。つまり、Bレジスタ32の値をそのままDバス3に出
力することになる。この時、オーバフローでなければ演
算結果がゼロとなるのでゼロフラグ36が「1」となる
。オーバフローであれば演算結果がゼロにならないので
、ゼロフラグ36がrOJとなる。このように、ゼロフ
ラグ36によって乗算におけるオーバフローの検出を行
うことができる。First, the value of the A register 31 is set to zero and output to the ALU 35. The value of the B register 32 is output according to instructions from the B register output control circuit 38. That is, when handling signed data, the MSB of M register 33
Only when the value is "1", the value of the B register 32 is inverted and output; otherwise, it is output as is. When handling unsigned data, the MSB of M register 33
Regardless of the value, the value of the B register 32 is output as is. By performing such control, the output from the B register 32 will always be zero if there is no overflow, regardless of the sign of the product or whether it is signed data or unsigned data. The ALU 35 calculates the logical sum of the output from the A register 31 and the output from the B register 32. In other words, the value of the B register 32 is output to the D bus 3 as is. At this time, if there is no overflow, the operation result will be zero, so the zero flag 36 will be "1". If there is an overflow, the calculation result will not be zero, so the zero flag 36 will be rOJ. In this manner, overflow in multiplication can be detected using the zero flag 36.
第3図はこの発明に係るデータ処理装置におけるオーバ
フロー検出処理手順の一例を説明するフローチャートで
ある。なお、(1)〜(10)は各ステップを示す。FIG. 3 is a flowchart illustrating an example of an overflow detection processing procedure in the data processing apparatus according to the present invention. Note that (1) to (10) indicate each step.
ALU35による乗算処理が実行されると、Bレジスタ
32には積の上位桁が、Mレジスタ33には積の下位桁
が格納される(1)。次にAレジスタ31にrOJをセ
ットする(2)。信号線39が符号付きデータを示して
いるか符号なしデータを示してるかを判定しく3)、符
号付きデータならば、さらにMレジスタ33のMSBの
値を判定する(4)。この判定でMSB値が「l」なら
ばBレジスタ32の値を反転してALU35に出力しく
5) roJならばBレジスタ32の値をそのまま
ALU35に出力する(6) 一方、ステップ(3)
の判定で符号なしデータと判定された場合は、Mレジス
タ33のMSB値に関係なくBレジスタ32の値をその
ままALU35に出力する(6)。このような操作を行
うことにより、Bレジスタ32からの出力は、オーバフ
ローが発生していなければゼロとなる。次に、ALU3
5でAレジスタ31の値(=O)とBレジスタ32から
の出力との論理和をとり(7)、演算結果がrOJかど
うかを判定しく8)、「「0」ならばゼロフラグ36に
「1」がセットされ、オーバフローでないことを示す(
9) 一方、ステップ(8)の判定で「1」ならばゼ
ロフラグ36にrOJがセットされ、オーバフローであ
ることを示す(lO)。こうしてオーバフロー検出処理
を終了し、他の処理に移行する。When the multiplication process by the ALU 35 is executed, the higher digit of the product is stored in the B register 32 and the lower digit of the product is stored in the M register 33 (1). Next, rOJ is set in the A register 31 (2). It is determined whether the signal line 39 indicates signed data or unsigned data (3), and if it is signed data, the MSB value of the M register 33 is further determined (4). If the MSB value is "l" in this judgment, the value of the B register 32 is inverted and output to the ALU 35. 5) If roJ, the value of the B register 32 is output as is to the ALU 35 (6) On the other hand, step (3)
If it is determined that the data is unsigned data, the value of the B register 32 is output as is to the ALU 35 regardless of the MSB value of the M register 33 (6). By performing such an operation, the output from the B register 32 becomes zero unless an overflow occurs. Next, ALU3
In step 5, the value of the A register 31 (=O) and the output from the B register 32 are logically summed (7), and it is determined whether the operation result is rOJ or not (8). If it is "0", the zero flag 36 is set as " 1” is set, indicating that there is no overflow (
9) On the other hand, if the determination in step (8) is "1", rOJ is set in the zero flag 36, indicating an overflow (lO). In this way, the overflow detection process ends and the process moves on to other processes.
[発明の効果]
以上説明したように、この発明は第2の格納手段の最上
位ビットの値に応じて第1の格納手段に格納されている
データの算術論理演算手段への反転出力または非反転出
力を制御する制御手段を設けたので、符号付きデータに
対してオーバフローのない場合には積の上位桁データが
ゼロとなるように第1の格納手段の出力を算術論理演算
手段に出力できる。[Effects of the Invention] As explained above, the present invention inverts or inverts the data stored in the first storage means to the arithmetic and logic operation means according to the value of the most significant bit of the second storage means. Since the control means for controlling the inverted output is provided, the output of the first storage means can be outputted to the arithmetic logic operation means so that the high-order digit data of the product becomes zero when there is no overflow for signed data. .
また、制御手段は、第2の格納手段の最上位ビットの値
と符号付きデータであるか符号なしデータであるかの情
報に応じて第1の格納手段に格納されているデータの算
術論理演算手段への反転出力または非反転出力を制御す
るように構成したので、積の符号や符号付きデータであ
るか符号なしデータであるかの区別なく、オーバフロー
のない場合には積の上位桁データがゼロとなるように第
1の格納手段の出力を算術論理演算手段に出力できる。Further, the control means performs arithmetic and logical operations on the data stored in the first storage means according to the value of the most significant bit of the second storage means and information on whether the data is signed data or unsigned data. Since the configuration is configured to control the inverted output or non-inverted output to the means, the high-order digit data of the product is The output of the first storage means can be outputted to the arithmetic and logic operation means so as to be zero.
従って、乗算を実行した後、上位桁データを算術論理演
算手段に出力するだけでゼロフラグによるオーバフロー
の検出を行うことが可能となり、従来の読み出し処理、
ビットシフト処理等を実行しないで済み、乗算処理時の
オーバフロー検出処理を大幅に高速化できる等の効果を
奏する。Therefore, after performing multiplication, it is possible to detect overflow using a zero flag by simply outputting the upper digit data to the arithmetic and logic operation means, and the conventional read processing
It is not necessary to perform bit shift processing, etc., and the overflow detection processing during multiplication processing can be greatly speeded up.
第1図はこの発明の一実施例を示すデータ処理装置の構
成を説明するブロック図、第2図は、第1図に示したB
レジスタ出力制御回路の動作を説明する図、第3図はこ
の発明に係るデータ処理装置におけるオーバフロー検出
処理手順の一例を説明するフローチャート、第4図は従
来のデータ処理装置における乗算処理に用いられる部分
の構成説明するブロック図、第5図は、第4図に示した
デコード回路のデコード状態に基づ<ALUの実行演算
種別対応を説明する対応図、第6図は、第4図に示した
データ処理装置における乗算実行処理シーケンスを説明
する図である。
図において、1はS1バス、2はS2バス、3はDバス
、10は定数ROM、20はレジスタファイル、31は
Aレジスタ、32はBレジスタ、33はMレジスタ、3
4は付加ビット、35はALU、36はゼロフラグ、3
7はデコード回路、38はBレジスタ出力制御回路、3
9は信号線、40はバレルシフタである。
なお、各図中の同一符号は同一または相当部分を示す。FIG. 1 is a block diagram illustrating the configuration of a data processing device showing an embodiment of the present invention, and FIG.
A diagram explaining the operation of the register output control circuit, FIG. 3 is a flowchart explaining an example of an overflow detection processing procedure in the data processing device according to the present invention, and FIG. 4 is a part used for multiplication processing in the conventional data processing device. FIG. 5 is a block diagram explaining the configuration of the decoding circuit shown in FIG. 4, and FIG. FIG. 2 is a diagram illustrating a multiplication execution processing sequence in the data processing device. In the figure, 1 is the S1 bus, 2 is the S2 bus, 3 is the D bus, 10 is the constant ROM, 20 is the register file, 31 is the A register, 32 is the B register, 33 is the M register, 3
4 is an additional bit, 35 is an ALU, 36 is a zero flag, 3
7 is a decoding circuit, 38 is a B register output control circuit, 3
9 is a signal line, and 40 is a barrel shifter. Note that the same reference numerals in each figure indicate the same or corresponding parts.
Claims (2)
算を実行する算術論理演算手段と、mビットのデータと
nビットのデータとの乗算によって得られる(m+n)
ビットの積のうち上位桁のデータを格納するための前記
算術論理演算手段への出力経路を有する第1の格納手段
と、mビットのデータとnビットのデータとの乗算によ
って得られる(m+n)ビットの積のうち下位桁のデー
タを格納する第2の格納手段と、前記算術論理演算手段
における演算結果に応じて論理状態が設定されるゼロ検
出ビットを備えたデータ処理装置において、前記第2の
格納手段の最上位ビットの値に応じて前記第1の格納手
段に格納されているデータの前記算術論理演算手段への
反転出力または非反転出力を制御する制御手段とを具備
したことを特徴とするデータ処理装置。(1) An arithmetic logic operation means that performs arithmetic operations on m-bit data and n-bit data, and (m+n) obtained by multiplying m-bit data and n-bit data.
(m+n) obtained by multiplying m-bit data and n-bit data by a first storage means having an output path to the arithmetic and logic operation means for storing the data of the upper digits of the product of bits; A data processing device comprising a second storage means for storing data of a lower digit of a product of bits, and a zero detection bit whose logical state is set according to a calculation result in the arithmetic and logic operation means, and control means for controlling inverted output or non-inverted output of the data stored in the first storage means to the arithmetic and logic operation means according to the value of the most significant bit of the storage means. data processing equipment.
と符号付きデータであるか符号なしデータであるかの情
報に応じて第1の格納手段に格納されているデータの前
記算術論理演算手段への反転出力または非反転出力を制
御することを特徴とする請求項(1)記載のデータ処理
装置。(2) The control means performs the arithmetic operation on the data stored in the first storage means according to the value of the most significant bit of the second storage means and information on whether the data is signed data or unsigned data. 2. The data processing device according to claim 1, wherein the data processing device controls an inverted output or a non-inverted output to the logical operation means.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2105545A JP2591250B2 (en) | 1990-04-19 | 1990-04-19 | Data processing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2105545A JP2591250B2 (en) | 1990-04-19 | 1990-04-19 | Data processing device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH043222A true JPH043222A (en) | 1992-01-08 |
| JP2591250B2 JP2591250B2 (en) | 1997-03-19 |
Family
ID=14410557
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2105545A Expired - Lifetime JP2591250B2 (en) | 1990-04-19 | 1990-04-19 | Data processing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2591250B2 (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0635669A (en) * | 1992-07-21 | 1994-02-10 | Mitsubishi Electric Corp | Central processing unit |
-
1990
- 1990-04-19 JP JP2105545A patent/JP2591250B2/en not_active Expired - Lifetime
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH0635669A (en) * | 1992-07-21 | 1994-02-10 | Mitsubishi Electric Corp | Central processing unit |
Also Published As
| Publication number | Publication date |
|---|---|
| JP2591250B2 (en) | 1997-03-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3589719B2 (en) | Efficient hardware handling of positive and negative overflows resulting from arithmetic operations | |
| US5440702A (en) | Data processing system with condition code architecture for executing single instruction range checking and limiting operations | |
| JP3701401B2 (en) | Microprocessor having saturated operation instructions | |
| KR900010545A (en) | Calculation device and method | |
| JPS5811652B2 (en) | Arithmetic unit | |
| US20020065860A1 (en) | Data processing apparatus and method for saturating data values | |
| JP2591250B2 (en) | Data processing device | |
| JPH0346024A (en) | Floating point computing element | |
| JPH1091395A (en) | Processor | |
| JPH04256016A (en) | Method and apparatus for correcting multiplier for complement of 2 so that multiplication of non-signed number is performed | |
| JPH04350724A (en) | Shift extent detecting circuit | |
| JPH0511980A (en) | Overflow detecting method and circuit | |
| US20020178202A1 (en) | Floating point multiplier for delimited operands | |
| JP2664750B2 (en) | Arithmetic device and arithmetic processing method | |
| JPS60167030A (en) | System and circuit for shift flag generation | |
| KR100385233B1 (en) | Exponent unit for data processing system | |
| KR0176883B1 (en) | Complex multiplier | |
| JP3950920B2 (en) | Multiply-accumulator and data processing device | |
| JP2615746B2 (en) | Bit operation circuit | |
| JPH01282633A (en) | Non-normalized number processing system | |
| US5801978A (en) | Overflow detection for integer-multiply instruction | |
| JPH03241421A (en) | Multiplier | |
| JP3205020B2 (en) | Arithmetic unit | |
| KR100198783B1 (en) | How to drive a serial processing divider | |
| JPH0553759A (en) | Fixed decimal point arithmetic unit |