JP2675087B2 - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JP2675087B2
JP2675087B2 JP63188920A JP18892088A JP2675087B2 JP 2675087 B2 JP2675087 B2 JP 2675087B2 JP 63188920 A JP63188920 A JP 63188920A JP 18892088 A JP18892088 A JP 18892088A JP 2675087 B2 JP2675087 B2 JP 2675087B2
Authority
JP
Japan
Prior art keywords
operation mode
bits
mode
bit
control signal
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.)
Expired - Fee Related
Application number
JP63188920A
Other languages
Japanese (ja)
Other versions
JPH0239234A (en
Inventor
聡 松井
賢次 山田
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 JP63188920A priority Critical patent/JP2675087B2/en
Publication of JPH0239234A publication Critical patent/JPH0239234A/en
Application granted granted Critical
Publication of JP2675087B2 publication Critical patent/JP2675087B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔概要〕 マイクロコンピュータに関し、 乗算速度の高速化を図ることを目的とし、 入力された部分積をそのまま出力する第1の演算モー
ド、部分積に被乗数を加算して出力する第2の演算モー
ド、部分積に2倍の被乗数を加算して出力する第3の演
算モード、部分積から被乗数を減算して出力する第4の
演算モード、を含む複数の演算モードのうち1つのモー
ドを所定のモード制御信号に従って選択して実行し、そ
の実行結果を出力ラッチに格納する乗算部を備えたマイ
クロコンピュータであって、アキュムレータにセットさ
れたnビットの乗数を2ビット右シフトするとともに、
該シフトによって空いたビットに前記出力ラッチのシフ
トアウトデータをセットし、かつ、右シフトした2ビッ
トの値に応じて少なくとも前記第1〜第4の演算モード
を選択実行させる所定のモード制御信号を出力するモー
ド制御信号出力回路を備え、該モード制御信号出力回路
は、前記アキュムレータの下位2ビットの値と所定のフ
ラグとの加算値が0または4であれば前記第1の演算モ
ードを選択し、1であれば前記第2の演算モードを選択
し、2であれば前記第3の演算モードを選択し、3であ
れば前記第4の演算モードを選択するとともに、前記第
1〜第3の演算モードを選択したときに前記フラグに0
をセットし、第4の演算モードを選択したときに前記フ
ラグに1をセットし、かつ、前記第1〜第4の演算モー
ドを実行した結果、キャリーまたはボローが発生する
と、前記出力ラッチの上位2ビットに入れるダミーデー
タの論理を反転する、ことを特徴とする。
DETAILED DESCRIPTION OF THE INVENTION [Outline] Regarding a microcomputer, a first operation mode in which an input partial product is output as it is for the purpose of increasing the multiplication speed, and a multiplicand is added to the partial product and output. Of a plurality of calculation modes including a second calculation mode in which the multiplicand is doubled and output to the partial product, and a fourth calculation mode in which the multiplicand is subtracted from the partial product and output. A microcomputer provided with a multiplication unit for selecting and executing one mode according to a predetermined mode control signal and storing the execution result in an output latch, wherein an n-bit multiplier set in an accumulator is right-shifted by 2 bits. Along with
A predetermined mode control signal for setting the shift-out data of the output latch in the bit vacated by the shift and for selecting and executing at least the first to fourth operation modes according to the value of the right-shifted 2 bits. A mode control signal output circuit for outputting is provided, and the mode control signal output circuit selects the first operation mode if the addition value of the lower 2 bits of the accumulator and a predetermined flag is 0 or 4. If it is 1, the second operation mode is selected, if it is 2, the third operation mode is selected, and if it is 3, the fourth operation mode is selected, and the first to third When the operation mode is selected, the flag is set to 0.
Is set, the flag is set to 1 when the fourth operation mode is selected, and when a carry or borrow occurs as a result of executing the first to fourth operation modes, the high order of the output latch It is characterized in that the logic of the dummy data put in 2 bits is inverted.

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

本発明は、マイクロコンピュータに関し、特に、繰り
返し加算・シフト演算を行うマイクロコンピュータの演
算速度改善に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer, and more particularly to improving the operation speed of a microcomputer that performs repeated addition / shift operations.

近時、マイクロコンピュータは、高速自動制御(例え
ば、自動車のエンジン制御)等の分野で重要な役割を担
っており、一段と演算速度の高速化が求められている。
特に、乗算速度に対してこの要求傾向が強い。
2. Description of the Related Art Recently, microcomputers play an important role in fields such as high-speed automatic control (for example, engine control of automobiles), and there is a demand for even higher calculation speeds.
Especially, this demand tendency is strong for the multiplication speed.

〔従来の技術〕[Conventional technology]

マイクロコンピュータにおける乗算は、被乗数を乗数
の数だけ繰り返して加算することが基本となるが、この
場合、乗数の数だけ加算の回数が必要となるので演算速
度が遅い。そこで実際の演算は次のようにして行われる
ことが多い。
In the multiplication in the microcomputer, it is basically necessary to repeatedly add the multiplicands by the number of multipliers, but in this case, the number of additions is required by the number of multipliers, and therefore the operation speed is slow. Therefore, the actual calculation is often performed as follows.

なお、本明細書中における数値の表し方は、10進表現
の場合添字10を付すものとし、2進表現の場合には特に
添字を付すことはしない。
In the present specification, numerical values are represented by a subscript 10 in the case of a decimal expression, and no particular subscript is added in the case of a binary expression.

10進表現における乗算は、乗数の各桁の値と被乗数と
を乗算して乗数の各桁毎の部分積を求め、次に、乗数の
桁に合わせて各部分積をシフトさせた後、各部分積の加
算値を乗算結果とするものであるが、2進演算の場合に
は、乗数の各ビットの値が“1"のときのみ被乗数をシフ
トさせて答に加算し、“0"のときはシフトのみ行うとい
った簡単な操作になる。すなわち、乗数となる2進表現
の数の各ビット(“0"か“1"しかとりえない)によって
シフト・加算を行うかシフトのみを行うかを決定すれば
よい。この方法によれば、乗数のビット数回のシフト・
加算を行うことになる。
Multiplication in decimal representation is performed by multiplying the value of each digit of the multiplier and the multiplicand to obtain the partial product for each digit of the multiplier, then shifting each partial product according to the digit of the multiplier, and then Although the added value of the partial product is used as the multiplication result, in the case of binary operation, the multiplicand is shifted and added to the answer only when the value of each bit of the multiplier is "1", and the result of "0" Sometimes it's a simple operation like only shifting. That is, it suffices to determine whether to perform shift / addition or only shift according to each bit (only "0" or "1" can be taken) of the binary representation number that is a multiplier. According to this method, the multiplier bit
You will be adding.

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

しかしながら、このような従来の乗算方法にあって
は、乗数のビット数分のシフト・加算を行う必要があ
り、特に多ビットデータを扱う場合、乗算速度の高速化
の課題があった。
However, in such a conventional multiplication method, it is necessary to perform shift / addition corresponding to the number of bits of the multiplier, and particularly when handling multi-bit data, there is a problem of increasing the multiplication speed.

そこで本発明は、乗数の2ビット毎にシフト・加算を
行えるようにすることにより、一度の乗算処理に必要な
シフト・加算の総回数を少なくして乗算速度の高速化を
図ることを目的としている。
Therefore, an object of the present invention is to increase the speed of multiplication by reducing the total number of shifts and additions required for one multiplication process by enabling shifts and additions for every 2 bits of the multiplier. There is.

〔課題を解決するための手段〕[Means for solving the problem]

本発明では、上記目的を達成するために、入力された
部分積をそのまま出力する第1の演算モード、部分積に
被乗数を加算して出力する第2の演算モード、部分積に
2倍の被乗数を加算して出力する第3の演算モード、部
分積から被乗数を減算して出力する第4の演算モード、
を含む複数の演算モードのうち1つのモードを所定のモ
ード制御信号に従って選択して実行し、その実行結果を
出力ラッチに格納する乗算部を備えたマイクロコンピュ
ータであって、アキュムレータにセットされたnビット
の乗数を2ビット右シフトするとともに、該シフトによ
って空いたビットに前記出力ラッチのシフトアウトデー
タをセットし、かつ、右シフトした2ビットの値に応じ
て少なくとも前記第1〜第4の演算モードを選択実行さ
せる所定のモード制御信号を出力するモード制御信号出
力回路を備え、該モード制御信号出力回路は、前記アキ
ュムレータの下位2ビットの値と所定のフラグとの加算
値が0または4であれば前記第1の演算モードを選択
し、1であれば前記第2の演算モードを選択し、2であ
れば前記第3の演算モードを選択し、3であれば前記第
4の演算モードを選択するとともに、前記第1〜第3の
演算モードを選択したときに前記フラグに0をセット
し、第4の演算モードを選択したときに前記フラグに1
をセットし、かつ、前記第1〜第4の演算モードを実行
した結果、キャリーまたはボローが発生すると、前記出
力ラッチの上位2ビットに入れるダミーデータの論理を
4反転する、ことを特徴とする。
In the present invention, in order to achieve the above object, a first operation mode in which an input partial product is output as it is, a second operation mode in which a multiplicand is added to a partial product and the result is output, and a multiplicand that is double the partial product A third operation mode for adding and outputting, and a fourth operation mode for subtracting the multiplicand from the partial product and outputting
Is a microcomputer provided with a multiplication unit that selects and executes one of a plurality of operation modes including a plurality of operation modes in accordance with a predetermined mode control signal, and stores the execution result in an output latch, wherein n is set in an accumulator. The bit multiplier is right-shifted by 2 bits, the shift-out data of the output latch is set in a bit vacated by the shift, and at least the first to fourth operations are performed according to the right-shifted 2-bit value. A mode control signal output circuit for outputting a predetermined mode control signal for selectively executing a mode is provided, and the mode control signal output circuit is configured such that when the value of the lower 2 bits of the accumulator and the predetermined flag are 0 or 4. If there is, the first operation mode is selected, if it is 1, the second operation mode is selected, and if it is 2, the third operation mode is selected. Mode is selected, and if it is 3, the fourth operation mode is selected, and when the first to third operation modes are selected, the flag is set to 0 and the fourth operation mode is selected. When the flag is set to 1
And a carry or borrow is generated as a result of executing the first to fourth operation modes, the logic of the dummy data to be put in the upper 2 bits of the output latch is inverted by 4. .

〔作用〕[Action]

本発明では、乗数が2ビットづつに区切られ、この2
ビットの値(010〜310)に応じて第1の演算モードから
第4の演算モードまでのシフト・加算に必要な操作が行
われる。
In the present invention, the multiplier is divided into 2 bits each.
The operations necessary for the shift / addition from the first operation mode to the fourth operation mode are performed according to the bit values (0 10 to 3 10 ).

したがって、実行されるシフト・加算の回数は、乗数
の区分数に対応して少なくなり、その結果、乗算速度の
高速化が図られる。
Therefore, the number of shifts / additions executed is reduced corresponding to the number of divisions of the multiplier, and as a result, the multiplication speed is increased.

また、アキュムレータのサイズを乗数のビット数(n
ビット)以上にする必要がなく、ハードウェア規模の削
減が図られる。
In addition, the size of the accumulator is set to the number of bits of the multiplier (n
It is not necessary to make more than (bit), and the hardware scale can be reduced.

〔実施例〕〔Example〕

以下、本発明を図面に基づいて説明する。 Hereinafter, the present invention will be described with reference to the drawings.

第1〜3図は本発明に係るマイクロコンピュータの一
実施例を示す図であり、演算精度長nビット(例えばn
=16)のマイクロコンピュータに適用した例である。
1 to 3 are diagrams showing an embodiment of a microcomputer according to the present invention, in which an arithmetic precision length of n bits (for example, n
= 16) applied to a microcomputer.

まず、構成を説明する。第1図において、1はマイク
ロコンピュータであり、マイクロコンピュータ1は、RA
MやROM等の記憶装置2と、多数のレジスタR1〜Rnを有す
るレジスタ群3と、を備えるとともに、アキュムレータ
4、ALU5、第1〜第3のフラグ6〜8、制御信号出力回
路9を含む乗算部10を備えている。なお、11はnビット
のデータバス、12はnビットのアドレスバス、13はリソ
ースバス、14はI/O、15はリソースであり、データバス1
1およびアドレスバス12は、上述の記憶装置2、レジス
タ群3および乗算部10の各部に接続されるとともに、リ
ソースバス13にも接続されている。
First, the configuration will be described. In FIG. 1, reference numeral 1 is a microcomputer, and the microcomputer 1 is an RA.
A storage device 2 such as an M or a ROM and a register group 3 having a large number of registers R 1 to Rn are provided, and an accumulator 4, an ALU 5, first to third flags 6 to 8 and a control signal output circuit 9 are provided. It includes a multiplication unit 10 including the same. In addition, 11 is an n-bit data bus, 12 is an n-bit address bus, 13 is a resource bus, 14 is an I / O, and 15 is a resource.
The 1 and the address bus 12 are connected to the storage device 2, the register group 3 and the multiplication unit 10 described above, and also to the resource bus 13.

第2図は、乗算部10の構成図である。乗算部10は第1
図で示したように、アキュムレータ4、ALU5、第1〜第
3のフラグ6〜8および制御信号出力回路9を含んで構
成されており、また、ALU5にはn+1ビットの第1、第
2の入力ラッチ5a、5bおよびn+1ビットの出力ラッチ
5cが備えられている。ALU5は、後述のモード制御信号SM
に従って少なくとも次の4つの演算モードの1つを実行
する。
FIG. 2 is a configuration diagram of the multiplication unit 10. The multiplication unit 10 is the first
As shown in the figure, it is configured to include an accumulator 4, an ALU5, first to third flags 6 to 8 and a control signal output circuit 9, and the ALU5 has an n + 1 bit first and second bit. Input latch 5a, 5b and n + 1 bit output latch
5c is equipped. ALU5 is a mode control signal S M described later.
According to at least one of the following four operation modes:

すなわち、 ・第1の演算モード(以下M1) 第1の入力ラッチ5aの内容にデータ0を加算して出力
ラッチ5cにラッチさせるモード、 ・第2の演算モード(以下M2) 第1の入力ラッチ5aの内容に第2の入力ラッチ5bの内
容を加算して出力ラッチ5cにラッチさせるモード、 ・第3の演算モード(以下M3) 第1の入力ラッチ5aの内容に第2の入力ラッチ5bの内
容を2倍(1ビット左シフト)したものを加算して出力
ラッチ5cにラッチさせるモード、 ・第4の演算モード(以下M4) 第1の入力ラッチ5aの内容から第2の入力ラッチ5bの
内容を減算して出力ラッチ5cにラッチさせるモード、 である。
That is, the first operation mode (hereinafter M1) is a mode in which data 0 is added to the content of the first input latch 5a and the output latch 5c is latched, and the second operation mode (hereinafter M2) is the first input latch. A mode in which the contents of the second input latch 5b are added to the contents of 5a to be latched in the output latch 5c, the third operation mode (hereinafter M3), the contents of the first input latch 5a are combined with those of the second input latch 5b. A mode in which the contents doubled (shifted to the left by 1 bit) are added and latched in the output latch 5c. ・ Fourth operation mode (M4 below) From the contents of the first input latch 5a to the contents of the second input latch 5b In this mode, the contents are subtracted and latched in the output latch 5c.

なお、第1の入力ラッチ5aには、演算途中の部分積が
ラッチされ、また、第2の入力ラッチ5bには、被乗数が
ラッチされる。部分積はバス20、データバス11、バス21
を介して取り込まれた出力ラッチ5cの内容であり、ま
た、被乗数は、データバス11を介して記憶装置2やレジ
スタ群3から取り込まれたものである。
The first input latch 5a latches the partial product in the middle of the calculation, and the second input latch 5b latches the multiplicand. Partial products are bus 20, data bus 11, bus 21
The contents of the output latch 5c taken in via the data bus 5 and the multiplicand are taken from the storage device 2 and the register group 3 via the data bus 11.

第3のフラグ8は1ビットの2値ゲートであり、第3
のフラグ8の内容(初期値は例えば論理“1")は、ALU5
の出力ラッチ5cのn+1ビット目からのキャリー(ある
いはボロー)入力がある毎に反転される。第3のフラグ
8の内容は必要に応じバス22を介して出力ラッチ5cの上
位2ビットに転送される。例えば、出力ラッチ5cが右2
ビットシフトしたときに、その空いたビットに格納され
るように転送される。
The third flag 8 is a 1-bit binary gate.
The contents of the flag 8 (the initial value is logical "1", for example) is ALU5.
Is inverted every time there is a carry (or borrow) input from the (n + 1) th bit of the output latch 5c. The contents of the third flag 8 are transferred to the upper 2 bits of the output latch 5c via the bus 22 as required. For example, the output latch 5c is on the right 2
When bit-shifted, it is transferred so as to be stored in the empty bit.

一方、アキュムレータ4はnビット分のデータ容量を
持ち、アキュムレータ4には乗数が格納される。この乗
数は、データバス11を介して記憶装置2やレジスタ群3
から取り込まれるもので、その符号ビットSBは第1のフ
ラグ6に格納される。アキュムレータ4内のデータ(乗
数)は、2ビットずつ所定のタイミングで右にシフトさ
れ、空いた2ビット(上位2ビット)には出力ラッチ5c
からのシフトアウト値(出力ラッチ5cの右2ビットシフ
トによってシフトアウトされたデータ)が格納される。
また、アキュムレータ4の下位2ビットは制御信号出力
回路9によってモニタされており、制御信号出力回路9
は、アキュムレータ4の下位2ビットの値と、ALU5のモ
ード(M1〜M4)によってその値を2値的に変化(M1、M2
→“0"、M3、M4→“1")させる第2のフラグ7の内容FA
とを加算し、その加算結果に従ってモード制御信号SM
生成する。例えば、加算結果が“010"か“410"ならばM1
を促すSMを生成し、加算結果が“110"ならばM2を促すSM
を生成し、加算結果が“210"ならばM3を促すSMを生成
し、加算結果が、“310"ならばM4を促すSMを生成する。
On the other hand, the accumulator 4 has a data capacity of n bits, and a multiplier is stored in the accumulator 4. This multiplier is stored in the storage device 2 and the register group 3 via the data bus 11.
And the sign bit SB is stored in the first flag 6. The data (multiplier) in the accumulator 4 is shifted right by 2 bits at a predetermined timing, and the output latch 5c is placed in the empty 2 bits (upper 2 bits).
The shift-out value (data shifted out by right 2 bit shift of the output latch 5c) is stored.
The lower 2 bits of the accumulator 4 are monitored by the control signal output circuit 9, and the control signal output circuit 9
Is a binary value (M1, M2) that varies depending on the value of the lower 2 bits of the accumulator 4 and the mode (M1 to M4) of the ALU5.
→ "0", M3, M4 → "1") Content of second flag 7 F A
And are added, and the mode control signal S M is generated according to the addition result. For example, if the addition result is "0 10 " or "4 10 ", M1
S M that prompts M 2 is generated, and if the addition result is “1 10 ”, S M that prompts M 2
If the addition result is “2 10 ”, S M that prompts M3 is generated, and if the addition result is “3 10 ”, S M that prompts M4 is generated.

次に、作用を説明する。 Next, the operation will be described.

ここでは乗数をBとし、被乗数をAとしてB×Aの乗
算処理を考える。但し、BおよびAともにnビットのデ
ータ長である。今、アキュムレータ4にBがセットさ
れ、また、ALU5の第2の入力ラッチ5bにAがセットされ
ると、ALU5の第1の入力ラッチ5aには部分積C(但し、
この時点では演算開始初期なのでC=010)が同時にセ
ットされる。そして、Bの符号ビットは第1のフラグ6
に格納される。また、AおよびCは第1の入力ラッチ5
a、第2の入力ラッチ5bのビット長(n+1)に従って
符号拡張される。但し、符号なし乗算の場合には“0"拡
張。
Here, the multiplication process of B × A is considered, where the multiplier is B and the multiplicand is A. However, both B and A have a data length of n bits. Now, when B is set in the accumulator 4 and A is set in the second input latch 5b of the ALU5, the partial product C (however,
At this point, the calculation is in the initial stage, so that C = 0 10 ) is simultaneously set. The sign bit of B is the first flag 6
Is stored in A and C are the first input latch 5
a, sign extension is performed according to the bit length (n + 1) of the second input latch 5b. However, in the case of unsigned multiplication, "0" extension.

制御信号出力回路9はBの下位2ビットと第2のフラ
グ7の内容FA(このとき、FAは“0")とを加算して、B
の下位2ビットの値に応じた演算モード(M1〜M4)を決
定する。
The control signal output circuit 9 adds the lower 2 bits of B and the content F A of the second flag 7 (at this time, F A is “0”) to obtain B
The operation mode (M1 to M4) corresponding to the value of the lower 2 bits of is determined.

例えば、Bの下位2ビットの値が010であればM1を決
定し、このM1を促すSMを生成してALU5に出力する。ALU5
はこのSMに従って処理を実行し、その結果、出力ラッチ
5cには、第1の入力ラッチ5aの値(C=010)がセット
される。すなわち、乗数の任意の桁の値が010ならば、
その桁における部分積が第1の入力ラッチ5aにセットさ
れる。また、Bの下位2ビットの値が110であればM2を
決定し、このM2を促すSMを生成してALU5に出力する。AL
U5はこのSMに従って処理を実行し、その結果、出力ラッ
チ5cには第2の入力ラッチ5bの値(A)がセットされ
る。すなわち、乗数の任意の桁の値が110ならば、その
桁における部分積が出力ラッチ5cにセットされる。さら
に、Bの下位2ビットの値が210であれば、その桁にお
ける部分積が出力ラッチ5cにセットされ、また、Bの下
位2ビットの値が310であればその桁における部分積が
出力ラッチ5cにセットされる。
For example, if the value of the lower 2 bits of B is 0 10 , M1 is determined, S M that prompts this M1 is generated, and output to ALU5. ALU5
Performs processing according to this S M , resulting in output latch
The value (C = 0 10 ) of the first input latch 5a is set in 5c. That is, if the value of any digit of the multiplier is 0 10, then
The partial product at that digit is set in the first input latch 5a. The lower 2 bits of the B determines the M2 if 1 10, and outputs the ALU5 to generate S M prompting the M2. AL
U5 executes processing according to this S M, and as a result, the value (A) of the second input latch 5b is set in the output latch 5c. That is, any digit value of the multiplier is 1 if 10, the partial product that digit is set in the output latch 5c. Further, if the value of the lower 2 bits of B is 2 10 , the partial product at that digit is set in the output latch 5c, and if the value of the lower 2 bits of B is 3 10 , the partial product at that digit is Set in output latch 5c.

なお、Bを格納しているアキュムレータ4の下位2ビ
ットと第2のフラグ7の内容FAとの和が310の場合に
は、第2のフラグ7のFAが論理“1"となり、また、110
あるいは210の場合には論理“0"となる。そして、ALU5
における演算の結果、ALU5からキャリー若しくはボロー
が出力されると、第3のフラグ8の論理が反転される。
Note that if the sum of the contents F A lower 2 bits and the second flag 7 of the accumulator 4 that contains the B is 3 10, F A logic "1" of the second flag 7, Also, 1 10
Alternatively, in the case of 2 10 , it becomes a logical “0”. And ALU5
When a carry or borrow is output from the ALU5 as a result of the operation in, the logic of the third flag 8 is inverted.

その後、ALU5の出力ラッチ5cおよびアキュムレータ4
は2ビット右シフトを行い、このシフトによって空いた
出力ラッチ5cの上位2ビットには第3のフラグ8の反転
値が入力され、また、アキュムレータ4の空き上位2ビ
ットには出力ラッチ5cからのシフトアウト値が入力され
る。そして以上の操作が、n/2ビット回繰り返される。
例えば、n=16ビットの場合には8回繰り返されること
となり、この8回をもって以下に述べる補正処理を除い
てB×Aの乗算処理が完結する。
After that, the output latch 5c of ALU5 and accumulator 4
Performs a 2-bit right shift, the inverted value of the third flag 8 is input to the upper 2 bits of the output latch 5c vacated by this shift, and the vacant upper 2 bits of the accumulator 4 are output from the output latch 5c. The shift-out value is input. The above operation is repeated n / 2 bits times.
For example, in the case of n = 16 bits, the process is repeated 8 times, and the multiplication process of B × A is completed in 8 times except for the correction process described below.

補正処理は、乗数の符号ビットSBを格納していた第1
のフラグ6の内容と第2のフラグ7の内容FAの関係によ
って行われる。すなわち、SB→“0"でFA→“0"ならば出
力ラッチ5cにはM1の結果がセットされ、また、SB→“0"
でFA→“1"ならば出力ラッチ5cにはM2の結果がセットさ
れ、また、SB→“1"でFA→“0"ならば出力ラッチ5cには
M4の結果がセットされ、また、SB→“1"でFA→“0"なら
ば出力ラッチ5cにはM1の結果がセットされる。その結
果、ALU5の出力ラッチ5cには積の上位nビットが現れ、
アキュムレータ4には積の下位nビットが現れる。
The correction process is performed by first storing the sign bit SB of the multiplier.
The content of the flag 6 and the content of the second flag 7 F A are related to each other. That is, if SB → “0” and F A → “0”, the result of M1 is set in the output latch 5c, and SB → “0”.
If F A → “1”, the result of M2 is set in the output latch 5c. If SB → “1”, F A → “0”, the output latch 5c is set.
The result of M4 is set, and if SB → “1” and F A → “0”, the result of M1 is set in the output latch 5c. As a result, the upper n bits of the product appear in the output latch 5c of ALU5,
The lower n bits of the product appear in the accumulator 4.

第3図は上述した一連の処理動作を示すフローチャー
トである。なお、第3図において( )を付した符号
は、第2図で用いられている符号と同一であり、同一の
構成部分を示すものである。
FIG. 3 is a flowchart showing the series of processing operations described above. It is to be noted that the reference numerals in parentheses in FIG. 3 are the same as the reference numerals used in FIG. 2 and indicate the same components.

このように本実施例では、B×Aの乗算に際し、乗数
を2ビットづつ区切り、その値に応じて各種演算モード
を決定して区切られた2ビットの桁における部分積を求
め、これを区切った数だけ繰り返して積を求めている。
したがって、B×Aの乗算に要するシフト・加算の回数
がn/2ビット回数となり、たとえ、補正処理を加えたと
しても、n/2ビット回+1回で済み乗算速度の高速化を
図ることができる。
As described above, in the present embodiment, when multiplying B × A, the multiplier is divided into two bits, various operation modes are determined according to the value, the partial product in the divided two-bit digit is obtained, and this is divided. Iterate the number of times to find the product.
Therefore, the number of shifts / additions required for the multiplication of B × A is n / 2 bit times, and even if correction processing is added, n / 2 bit times + 1 time is required and the multiplication speed can be increased. it can.

〔発明の効果〕〔The invention's effect〕

本発明によれば、乗数を2ビットづつ区切り、その2
ビットを1回としてシフト・加算を行うことができる。
したがって、一度の乗算に必要なシフト・加算の総回数
を少なくすることができ、乗算速度の高速化を図ること
ができる。
According to the present invention, the multiplier is divided into 2 bits, and 2
It is possible to perform shift / addition with one bit.
Therefore, the total number of shifts / additions required for one multiplication can be reduced, and the multiplication speed can be increased.

また、アキュムレータのサイズを乗数のビット数(n
ビット)以上にする必要がなく、ハードウェア規模の削
減を図ることができる。
In addition, the size of the accumulator is set to the number of bits of the multiplier (n
It is not necessary to increase the number of bits) or more, and the hardware scale can be reduced.

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

第1〜3図は本発明に係るマイクロコンピュータの一実
施例を示す図であり、 第1図はその全体の構成図、 第2図はその要部の構成図、 第3図はその処理動作を示すフローチャートである。 9……制御信号出力回路、 10……乗算部、 SM……モード制御信号。
1 to 3 are diagrams showing an embodiment of a microcomputer according to the present invention. FIG. 1 is an overall configuration diagram thereof, FIG. 2 is a configuration diagram of its essential parts, and FIG. 3 is its processing operation. It is a flowchart showing. 9: Control signal output circuit, 10: Multiplier, S M: Mode control signal.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】入力された部分積をそのまま出力する第1
の演算モード、 部分積に被乗数を加算して出力する第2の演算モード、 部分積に2倍の被乗数を加算して出力する第3の演算モ
ード、 部分積から被乗数を減算して出力する第4の演算モー
ド、 を含む複数の演算モードのうち1つのモードを所定のモ
ード制御信号に従って選択して実行し、その実行結果を
出力ラッチに格納する乗算部を備えたマイクロコンピュ
ータであって、 アキュムレータにセットされたnビットの乗数を2ビッ
ト右シフトするとともに、 該シフトによって空いたビットに前記出力ラッチのシフ
トアウトデータをセットし、かつ、 右シフトした2ビットの値に応じて少なくとも前記第1
〜第4の演算モードを選択実行させる所定のモード制御
信号を出力するモード制御信号出力回路を備え、 該モード制御信号出力回路は、 前記アキュムレータの下位2ビットの値と所定のフラグ
との加算値が0または4であれば前記第1の演算モード
を選択し、 1であれば前記第2の演算モードを選択し、 2であれば前記第3の演算モードを選択し、 3であれば前記第4の演算モードを選択するとともに、 前記第1〜第3の演算モードを選択したときに前記フラ
グに0をセットし、 第4の演算モードを選択したときに前記フラグに1をセ
ットし、かつ、 前記第1〜第4の演算モードを実行した結果、キャリー
またはボローが発生すると、前記出力ラッチの上位2ビ
ットに入れるダミーデータの論理を反転する、ことを特
徴とするマイクロコンピュータ。
1. A first that directly outputs an input partial product
Operation mode, a second operation mode for adding the multiplicand to the partial product and outputting, a third operation mode for adding the double multiplicand to the partial product and outputting, a second operation mode for subtracting the multiplicand from the partial product and outputting 4 is a calculation mode in which one of a plurality of calculation modes including a calculation mode is selected and executed according to a predetermined mode control signal, and the execution result is stored in an output latch. The n-bit multiplier set in step 1 is right-shifted by 2 bits, the shift-out data of the output latch is set in a bit vacated by the shift, and at least the first bit is shifted according to the value of right-shifted 2-bit
A mode control signal output circuit for outputting a predetermined mode control signal for selectively executing the fourth operation mode, wherein the mode control signal output circuit is a value obtained by adding a value of the lower 2 bits of the accumulator and a predetermined flag. Is 0 or 4, the first operation mode is selected, 1 is the second operation mode, 2 is the third operation mode, and 3 is the above operation mode While selecting the fourth operation mode, the flag is set to 0 when the first to third operation modes are selected, and the flag is set to 1 when the fourth operation mode is selected, In addition, when a carry or borrow occurs as a result of executing the first to fourth operation modes, the logic of dummy data to be put in the upper 2 bits of the output latch is inverted. Computer.
JP63188920A 1988-07-28 1988-07-28 Microcomputer Expired - Fee Related JP2675087B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63188920A JP2675087B2 (en) 1988-07-28 1988-07-28 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63188920A JP2675087B2 (en) 1988-07-28 1988-07-28 Microcomputer

Publications (2)

Publication Number Publication Date
JPH0239234A JPH0239234A (en) 1990-02-08
JP2675087B2 true JP2675087B2 (en) 1997-11-12

Family

ID=16232198

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63188920A Expired - Fee Related JP2675087B2 (en) 1988-07-28 1988-07-28 Microcomputer

Country Status (1)

Country Link
JP (1) JP2675087B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0365723A (en) * 1989-08-03 1991-03-20 Matsushita Electric Ind Co Ltd Parallel multiplication circuit

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5860354A (en) * 1981-10-07 1983-04-09 Toshiba Corp Multiplying device
JPS62127941A (en) * 1985-11-29 1987-06-10 Fujitsu Ltd Shifting system in multiplier

Also Published As

Publication number Publication date
JPH0239234A (en) 1990-02-08

Similar Documents

Publication Publication Date Title
US4893268A (en) Circuit and method for accumulating partial products of a single, double or mixed precision multiplication
US4866652A (en) Floating point unit using combined multiply and ALU functions
JPS6125245A (en) Rounding process circuit
JP3529622B2 (en) Arithmetic circuit
US4878191A (en) Multiplication circuit capable of operating at a high speed with a small amount of hardware
JP2675087B2 (en) Microcomputer
US4823300A (en) Performing binary multiplication using minimal path algorithm
JPH0346024A (en) Floating point computing element
JPH06119148A (en) Arithmetic circuit
US4190894A (en) High speed parallel multiplication apparatus with single-step summand reduction
US6484193B1 (en) Fully pipelined parallel multiplier with a fast clock cycle
JP3435744B2 (en) Multiplication circuit
JPS6259828B2 (en)
JPH04330519A (en) Multiplier
JP3441847B2 (en) Processor with data memory
JP2569330B2 (en) Multiplication circuit
JPH04250527A (en) Arithmetic circuit
JPH0784762A (en) Multiplication circuit
JPH0347534B2 (en)
JPH0260020B2 (en)
JPS5860354A (en) Multiplying device
JPH0253819B2 (en)
JPH0553759A (en) Fixed decimal point arithmetic unit
JPH02146621A (en) Arithmetic processing unit
JPH01128129A (en) Floating point addition/subtraction device

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees