JPH0315942A - Divider - Google Patents

Divider

Info

Publication number
JPH0315942A
JPH0315942A JP1149316A JP14931689A JPH0315942A JP H0315942 A JPH0315942 A JP H0315942A JP 1149316 A JP1149316 A JP 1149316A JP 14931689 A JP14931689 A JP 14931689A JP H0315942 A JPH0315942 A JP H0315942A
Authority
JP
Japan
Prior art keywords
circuit
divisor
power
output
division
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP1149316A
Other languages
Japanese (ja)
Inventor
Takaya Sawai
澤井 孝哉
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.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP1149316A priority Critical patent/JPH0315942A/en
Publication of JPH0315942A publication Critical patent/JPH0315942A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To shorten operation time when a divisor is a power of 2 by selecting either the output of a division circuit or the output of a shift circuit in accordance with the output of a power of 2-detection circuit detecting that the divisor is a power of 2. CONSTITUTION:The division circuit 3 calculating the quotient and a remainder from the given divisor and a dividend, the power of 2-detection circuit 6 detecting that the divisor is a power of 2, and the shift circuit 4 shifting the dividend right by the number of bits corresponding to the divisor are provided. The selection circuit 7 selects either the output of the division circuit 3 or the output of the shift circuit 4 in accordance with the output of the power of 2-detection circuit 6. When the divisor is a power of 2, the selector 7 inputs the shifted divisor which is received from the shift circuit 4 to a register 8 as the quotient. When the divisor is not a power of 2, the output of the division circuit 3 is set as the quotient and is inputted to the register 8. Thus, division can be speeded up when the divisor is a power of 2.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明は,情報処理装置の除算器に関し,特に除数が2
の巾乗である場合の除算を実行する除算器に関する。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a divider for an information processing device, and in particular, the present invention relates to a divider for an information processing device.
This invention relates to a divider that performs division when it is a power of .

[従来の技術] 従来.固定小数点の除算を行なう方法として第4図のフ
ローに示すような方法が用いられている。
[Conventional technology] Conventional. A method shown in the flowchart of FIG. 4 is used to perform fixed-point division.

この方法は,被除数から除数を引いて,その差が除数よ
り大ならば,その差より除数を引くという減算を繰り返
し.その結果が除数よりも小さくなった時点で処理を終
了し,結果として被除数から除数を引いた回数を商とし
て出力するという方法である。
This method subtracts the divisor from the dividend, and if the difference is greater than the divisor, then subtracts the divisor from the difference, repeating the subtraction. This method ends the process when the result becomes smaller than the divisor, and outputs the number of times the divisor has been subtracted from the dividend as a quotient.

一方.演算器が浮動小数点除算器を備えている場合は,
一度被除数,除数を正規化して浮動小数点除算器を利用
して商をもとめる等の手法が用いられている。
on the other hand. If the arithmetic unit is equipped with a floating-point divider,
Techniques used include normalizing the dividend and divisor and then using a floating-point divider to find the quotient.

[発明が解決しようとする課題コ しかしながら.上述した従来の方法によると.前者の場
合は,減算を複数回繰り返すから,その実行サイクルは
.被除数や除数の大小によって幅はあるものの数サイク
ルから数10サイクルといった実行サイクルが必要であ
る。
[However, the problem that the invention seeks to solve] According to the conventional method described above. In the former case, the subtraction is repeated multiple times, so the execution cycle is . The number of execution cycles required varies depending on the size of the dividend and divisor, but ranges from several cycles to several tens of cycles.

一方.後者の手段においても.前処理(正規化)中処理
(引き戻し法や引き放し法等による).後処理というよ
うに数サイクルを必要とする。
on the other hand. Even in the latter method. Pre-processing (normalization) and mid-processing (by pull-back method, pull-out method, etc.). Several cycles of post-processing are required.

いずれにしても,従来の除算器の場合,一般的に多くの
実行サイクルを要する。このため除算を含む演算処理は
時間がかかるという問題点がある。
In any case, conventional dividers typically require many execution cycles. Therefore, there is a problem that arithmetic processing including division takes time.

本発明は,除数が2の巾乗の場合の除算の高速化を目的
とする。
The present invention aims to speed up division when the divisor is a power of two.

[課題を解決するための手段] 本発明の除算器は.与えられた被除数と除数とから商及
び剰余を算出する除算回路と前記除数が2の巾乗である
ことを検出する2の巾乗検出回路と,前記被除数を前記
除数に対応するビット数右シフトするシフト回路と,前
記2の巾乗検出回路の出力に応じて前記除算回路の出力
と前記シフト回路の出力のどちらか一方を選択する選択
回路を有していることを特徴とする。
[Means for solving the problem] The divider of the present invention is as follows. A division circuit that calculates a quotient and a remainder from a given dividend and a divisor, a power of 2 detection circuit that detects that the divisor is a power of 2, and a right shift of the dividend by the number of bits corresponding to the divisor. and a selection circuit that selects either the output of the division circuit or the output of the shift circuit according to the output of the power of 2 detection circuit.

〔実施例] 第1図は,本発明の一実施例を示したブロック図である
。レジスタ1は外部から入力された被除数を保持するレ
ジスタである。レジスタ2は外部から入力される除数を
保持するレジスタである。
[Embodiment] FIG. 1 is a block diagram showing an embodiment of the present invention. Register 1 is a register that holds the dividend input from the outside. Register 2 is a register that holds a divisor input from the outside.

除算回路3はレジスタ1とレジスタ2とからそれぞれ出
力される被除数と除数とを受け,除算を行なう除算回路
である。この除算回路3は固定小数点,浮動小数点を問
わず処理が行なわれ,通常その処理に数マシンサイクル
を要する。
The division circuit 3 is a division circuit that receives the dividend and divisor output from the register 1 and the register 2, respectively, and performs division. This division circuit 3 performs processing regardless of fixed point or floating point, and normally requires several machine cycles for the processing.

シフト回路4は,レジスタ1に保持されている被除数を
もう一方の人力であるシフトカウント数だけ右シフトし
た値を出力する回路である。これは除数が2の巾乗であ
れば2進数で表わされた数値の除算は,右シフトするこ
とで行なえるということに基づいている。
The shift circuit 4 is a circuit that outputs a value obtained by right-shifting the dividend held in the register 1 by the other manual shift count number. This is based on the fact that if the divisor is a power of 2, division of a numerical value expressed in binary can be performed by right shifting.

シフトカウント生戊回路5はレジスタ2に保持されてい
る除数のビット数からシフトカウントを生成し出力する
回路である。
The shift count generation circuit 5 is a circuit that generates a shift count from the number of bits of the divisor held in the register 2 and outputs it.

2の巾乗検出回路6はレジスタ2に保持されている除数
が2の巾乗であるかどうかを判定しその結果を出力する
回路である。
The power of 2 detection circuit 6 is a circuit that determines whether the divisor held in the register 2 is a power of 2 and outputs the result.

セレクタ7は除算回路3からの人力とシフタ5からの人
力のどちらか一方を2の巾乗検出回路6の出力に基づき
出力する機能を持つ。
The selector 7 has a function of outputting either the human power from the division circuit 3 or the human power from the shifter 5 based on the output of the power of 2 detection circuit 6.

レジスタ8はセレクタ7の出力を保持する。Register 8 holds the output of selector 7.

ここで.動作の説明の前に,まずシフトカウント生成回
路5と2の巾乗検出回路6の説明を行なつ〇 第2図(a)はシフトカウント生成回路5の人力値と出
力値の関係を示している。ここでは,人力(除数)が,
2の巾乗かどうかにかかわらず,出力として入力のL 
S B (least slgnlflcant bi
t)からの連続した“O″の個数を出力としている。
here. Before explaining the operation, we will first explain the shift count generation circuit 5 and the power of 2 detection circuit 6. Figure 2 (a) shows the relationship between the manual input value and the output value of the shift count generation circuit 5. There is. Here, the human power (divisor) is
L of the input as output, regardless of whether it is a power of 2 or not.
S B (least slgnlflcant bi
The number of consecutive "O"s from t) is output.

第2図(b)は2の巾乗検出回路6の入力値と出力値の
関係を示している。ここでは,入力(除数)が2の巾乗
か否かを判定しその結果を2の巾乗であれば“1“,2
の巾乗でなければ“O”として出力している。
FIG. 2(b) shows the relationship between the input value and the output value of the power of 2 detection circuit 6. Here, it is determined whether the input (divisor) is a power of 2 or not, and the result is “1” if it is a power of 2, 2
If it is not a power of , it is output as "O".

次に,第1図を再び参照してこの除算器の動作を説明す
る。
Next, the operation of this divider will be explained with reference to FIG. 1 again.

外部から被除数及び除数が入力されると,レジスタ1及
び2はそれぞれ彼数算及び除数を保持する。レジスタ1
に保持された被除数は除算回路3及びシフト回路4に入
力される。また,レジスタ2に保持された除数は除算回
路3,シフトカウンタ生成回路5,及び2の巾乗検出回
路に人力される。
When a dividend and a divisor are input from the outside, registers 1 and 2 hold the arithmetic value and the divisor, respectively. register 1
The dividend held in is input to the division circuit 3 and shift circuit 4. Further, the divisor held in the register 2 is input manually to the division circuit 3, the shift counter generation circuit 5, and the power of 2 detection circuit.

除算回路3は被除数と除数が人力されると従来と同じ方
法で除算を開始し,商及び余りを算出する。この除算は
数サイクルから数サイクルを必要とする。除算の結果は
セレクタ7に入力される。
When the dividend and divisor are entered manually, the division circuit 3 starts division in the same manner as in the past, and calculates the quotient and remainder. This division requires several to several cycles. The result of the division is input to the selector 7.

除算回路3の除算開始と同時にシフトカウント生成回路
5は除数からシフト数を生成しシフト回路4に出力する
。また,2の巾乗検出回路6は除数が2の巾乗か否かを
検出し,濱算回路3の出力と,シフト回路4の出力のど
ちらかを商とするかセレクタ7に指示を出す。
Simultaneously with the start of division by the division circuit 3, the shift count generation circuit 5 generates a shift number from the divisor and outputs it to the shift circuit 4. Further, the power of 2 detection circuit 6 detects whether the divisor is a power of 2 or not, and instructs the selector 7 whether the output of the summation circuit 3 or the output of the shift circuit 4 should be used as the quotient. .

シフト回路4はシフトカウント生成回路5から入力され
たシフト数だけ被除数の右シフトを行い,シフトされた
被除数をセレクタ7に出力する。この場合.演算サイク
ルは1サイクルですむ。
The shift circuit 4 shifts the dividend to the right by the shift number input from the shift count generation circuit 5 and outputs the shifted dividend to the selector 7. in this case. One calculation cycle is enough.

除数が2の巾染の場合は,2の巾乗検出回路からの信号
により,セレクタ7はシフト回路4から受けたシフトさ
れた被除数を商としてレジスタ8へ入力する。
If the divisor is a power of 2, the selector 7 inputs the shifted dividend received from the shift circuit 4 to the register 8 as a quotient in response to a signal from the power of 2 detection circuit.

除数が2の巾乗でない場合は,除算回路3の出力を商と
してレジスタ8へ入力する。
If the divisor is not a power of 2, the output of the division circuit 3 is input to the register 8 as a quotient.

一例として被除数が21,除数が4及び5の場合の入力
出力パターンを第3図に示す。
As an example, an input/output pattern when the dividend is 21 and the divisors are 4 and 5 is shown in FIG.

[発明の効果] 本発明によれば,除算器を除算回路と,除数が2の巾乗
であることを検出する2の巾乗検出回路と,被除数を右
シフト回路と,除算回路の出力と,シフト回路の出力と
のどちらか一方を選択回路で構成することにより除数が
2の巾乗の場合に,?7jL算サイクルを1サイクルに
短縮できる,即ち演算時間を短縮できる。
[Effects of the Invention] According to the present invention, the divider is a division circuit, a power of 2 detection circuit that detects that the divisor is a power of 2, a circuit that shifts the dividend to the right, and an output of the division circuit. , and the output of the shift circuit by configuring either one of them with a selection circuit, so that when the divisor is a power of 2, ? The 7jL computation cycle can be shortened to one cycle, that is, the computation time can be shortened.

2の巾乗検出回路の入出力関係を説明するための図,第
3図は第1図の構成の除算器を用いた場合の結果を説明
するための図,第4図は従来の除算方法の一例を示すフ
ローチャートである。
Figure 3 is a diagram to explain the input/output relationship of the power detection circuit of 2, Figure 3 is a diagram to explain the result when using the divider configured in Figure 1, Figure 4 is the conventional division method. It is a flowchart which shows an example.

1,2.8・・・レジスタ.3・・・除算回路,4・・
・シフト回路,5・・・シフトカウント生成回路,6・
・・2の巾乗検出回路,7・・・セレクタである。
1, 2.8...Register. 3...Division circuit, 4...
・Shift circuit, 5...Shift count generation circuit, 6・
. . . 2 power detection circuit, 7 . . . selector.

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

第1図は本発明の一実施例の構成図を示すブロック図,
蒲2図はシフトカウント生成回路および第1図 第2図 (a)  シフトカウント生成回路 (b) 2の巾乗検出回路 第3図 0内はIOJ表記 第4図
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention.
Figure 2 shows the shift count generation circuit, Figure 1, Figure 2 (a), Shift count generation circuit (b), power of 2 detection circuit, Figure 3, IOJ notation in Figure 4.

Claims (1)

【特許請求の範囲】[Claims] (1)2進除算命令を処理する除算器において、与えら
れた被除数と除数とから商及び剰余を算出する除算回路
と、前記除数が2の巾乗であることを検出する2の巾乗
検出回路と、前記被除数を前記除数に対応するビット数
右シフトするシフト回路と、前記除算回路の出力と前記
シフト回路の出力を受け、前記2の巾乗検出回路によっ
て前記除数が2の巾乗であることが検出されると前記シ
フト回路の出力を選択する選択回路とを有することを特
徴とする除算器。
(1) In a divider that processes a binary division instruction, a division circuit that calculates a quotient and a remainder from a given dividend and a divisor, and a power of 2 detection that detects that the divisor is a power of 2 a shift circuit for shifting the dividend to the right by a number of bits corresponding to the divisor; and receiving the output of the division circuit and the output of the shift circuit, and determining that the divisor is a power of 2 by the power of 2 detection circuit. and a selection circuit that selects the output of the shift circuit when a certain condition is detected.
JP1149316A 1989-06-14 1989-06-14 Divider Pending JPH0315942A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1149316A JPH0315942A (en) 1989-06-14 1989-06-14 Divider

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1149316A JPH0315942A (en) 1989-06-14 1989-06-14 Divider

Publications (1)

Publication Number Publication Date
JPH0315942A true JPH0315942A (en) 1991-01-24

Family

ID=15472456

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1149316A Pending JPH0315942A (en) 1989-06-14 1989-06-14 Divider

Country Status (1)

Country Link
JP (1) JPH0315942A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150378681A1 (en) * 2014-06-26 2015-12-31 Arm Limited Apparatus and method for efficient division performance

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150378681A1 (en) * 2014-06-26 2015-12-31 Arm Limited Apparatus and method for efficient division performance
JP2016009492A (en) * 2014-06-26 2016-01-18 エイアールエム リミテッド Apparatus and method for efficient division performance
GB2528367A (en) * 2014-06-26 2016-01-20 Advanced Risc Mach Ltd An apparatus and method for efficient division performance
CN105320491A (en) * 2014-06-26 2016-02-10 Arm有限公司 Apparatus and method for efficient division performance
US9524143B2 (en) 2014-06-26 2016-12-20 Arm Limited Apparatus and method for efficient division performance
GB2528367B (en) * 2014-06-26 2019-02-13 Advanced Risc Mach Ltd An apparatus and method for efficient division performance

Similar Documents

Publication Publication Date Title
US8370415B2 (en) Overflow detection and clamping with parallel operand processing for fixed-point multipliers
JPH0667851A (en) Multiplier provided with overflow detecting function
EP0869432A1 (en) Multiplication method and multiplication circuit
JPS62191926A (en) Arithmetic unit
US4692891A (en) Coded decimal non-restoring divider
JPS608933A (en) Arithmetic processing unit
JPH0315942A (en) Divider
JPH07239774A (en) Method and device for division
US4546447A (en) Division apparatus
JPH0383127A (en) Decimal divider
CA1173164A (en) Fraction calculator
JP2664750B2 (en) Arithmetic device and arithmetic processing method
JP2591250B2 (en) Data processing device
US20050210089A1 (en) Saturating shift mechanisms within data processing systems
JPH0797312B2 (en) Arithmetic unit
US4141077A (en) Method for dividing two numbers and device for effecting same
JP3068640B2 (en) Computing device
JP2726479B2 (en) Division device
JPH04160533A (en) Microprocessor
JPH01180627A (en) Arithmetic controller for floating decimal point
KR100198783B1 (en) Driving method of serial operating divider
JPS60254241A (en) Error detection control circuit
JPS60247735A (en) Decimal multiplying circuit
JPH03245226A (en) Floating decimal-point multiplier
JPH01237831A (en) Divider