JPH06236253A - Bit computing element - Google Patents
Bit computing elementInfo
- Publication number
- JPH06236253A JPH06236253A JP5022256A JP2225693A JPH06236253A JP H06236253 A JPH06236253 A JP H06236253A JP 5022256 A JP5022256 A JP 5022256A JP 2225693 A JP2225693 A JP 2225693A JP H06236253 A JPH06236253 A JP H06236253A
- Authority
- JP
- Japan
- Prior art keywords
- bit
- overflow
- shift
- calculator
- bit shift
- 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
Links
Abstract
(57)【要約】
【目的】 ビットシフトまたはビットローテーション演
算において、シフトあるいはローテート結果の桁あふれ
を検出して、算術演算としての誤差を小さくする。
【構成】 ビットシフト・ローテート演算器2の出力を
桁あふれ検出器3に与え、桁あふれ検出器3の判定出力
に従って、振幅制限器4がビットシフト・ローテート演
算器2の出力補正を行う。
(57) [Abstract] [Purpose] In bit shift or bit rotation operation, the overflow of shift or rotate result is detected to reduce the error as arithmetic operation. [Structure] The output of the bit shift / rotate calculator 2 is given to the overflow detector 3, and the amplitude limiter 4 corrects the output of the bit shift / rotate calculator 2 according to the judgment output of the overflow detector 3.
Description
【0001】[0001]
【産業上の利用分野】本発明は、コンピュータ、計算機
等に使用するビット演算器に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a bit calculator used in computers, computers and the like.
【0002】[0002]
【従来の技術】図2は従来のビット演算器の構成を示し
ている。図2において、1は入力レジスタ、2はビット
シフト・ローテート演算器、3はALU(alithm
etic logic unit,算術論理演算器)、
4は出力レジスタである。2. Description of the Related Art FIG. 2 shows the configuration of a conventional bit arithmetic unit. In FIG. 2, 1 is an input register, 2 is a bit shift / rotate arithmetic unit, and 3 is an ALU (alithm).
(tic logic unit, arithmetic logic unit),
Reference numeral 4 is an output register.
【0003】このビット演算器で演算されるデータは、
上記符号の順序に流れる構造となっている。The data calculated by this bit calculator is
It has a structure that flows in the order of the above symbols.
【0004】上記のように構成された従来のビット演算
器に関し、以下にその動作について説明する。まず、入
力レジスタ1に格納してある被演算数をビットシフト・
ローテート演算器2に加え、シフトあるいはローテート
演算を行う。被演算数が符号付き数値の場合にも、桁あ
ふれのチェックは行わない。ビットシフト・ローテート
演算器2による演算結果を、ALU3でさらに任意の演
算を行って、出力レジスタ4へ書き込む。なお、ALU
3は必ずしも必要ではない。The operation of the conventional bit arithmetic unit configured as described above will be described below. First, the operands stored in the input register 1 are bit-shifted
In addition to the rotate calculator 2, shift or rotate calculation is performed. Even if the operand is a signed number, overflow check is not performed. The arithmetic result of the bit shift / rotate arithmetic unit 2 is further arithmetically operated by the ALU 3 and written into the output register 4. ALU
3 is not always necessary.
【0005】このように上記従来のビット演算器によっ
ても、ビットシフト・ローテート演算器によって、数値
のシフトあるいはローテートを行うことができる。As described above, also with the above-mentioned conventional bit arithmetic unit, it is possible to shift or rotate a numerical value with the bit shift / rotate arithmetic unit.
【0006】[0006]
【発明が解決しようとする課題】しかしながら、現実に
は経済上の問題でビットシフト・ローテート演算器出力
の語長が制限されることが多く、上記従来のビット演算
器では、左シフトあるいはローテートを行おうとしたと
きに桁あふれが発生し、あふれたビットは捨ててしま
う。したがって、絶対値に意味を持つ数値、あるいは符
号と絶対値に意味を持つ数値に対してシフトを算術演算
として使用するとき、桁あふれによって演算結果が全く
意味を持たない場合が出てくるという問題があった。However, in reality, the word length of the output of the bit shift / rotate arithmetic unit is often limited due to economic problems. An overflow occurs when you try to do so, and the overflowing bits are discarded. Therefore, when a shift is used as an arithmetic operation for a numeric value having a significant absolute value or a numeric value having a sign and an absolute value, there is a case where the arithmetic result has no meaning at all due to overflow. was there.
【0007】本発明は、このような従来の問題を解決す
るものであり、絶対値に意味を持つ数値、あるいは符号
と絶対値に意味を持つ数値に対して左シフトあるいはロ
ーテートを行ったときの算術演算としての誤差を減らす
ことのできる、優れたビット演算器を提供することを目
的とする。The present invention is intended to solve such a conventional problem, and to perform a left shift or a rotation on a numerical value having a significant absolute value or a numerical value having a significant sign and an absolute value. It is an object of the present invention to provide an excellent bit arithmetic unit capable of reducing an error as an arithmetic operation.
【0008】[0008]
【課題を解決するための手段】本発明は、上記目的を達
成するために、ビットシフトあるいはビットローテート
演算器に、符号無しの数値あるいは符号付き数値に対応
した、1ビットあるいは複数ビット対応の桁あふれ検出
器および振幅制限器を設け、桁あふれ時に演算結果を補
正して出力するようにしたものである。In order to achieve the above object, the present invention provides a bit shift or bit rotate arithmetic unit with a digit corresponding to one bit or a plurality of bits corresponding to an unsigned numerical value or a signed numerical value. An overflow detector and an amplitude limiter are provided to correct and output the calculation result when a digit overflows.
【0009】[0009]
【作用】したがって、本発明によれば、ビットシフトあ
るいはローテート演算器の出力に対して桁あふれ検出器
で桁あふれを見つけ、桁あふれしている場合には、振幅
制限器が、所定のビット数で表現可能な絶対値最大の値
に置き換える作用により、シフトあるいはローテートを
算術演算として使用したときの演算誤差を小さくするこ
とができるという効果を有する。Therefore, according to the present invention, the overflow detector detects an overflow for the output of the bit shift or rotate arithmetic unit, and when the overflow occurs, the amplitude limiter sets the predetermined number of bits. By the action of substituting the maximum absolute value that can be expressed by, there is an effect that it is possible to reduce the operation error when shift or rotate is used as an arithmetic operation.
【0010】[0010]
【実施例】図1は本発明の第1の実施例の構成を示すも
のである。図1において、1は入力レジスタであり、2
は入力レジスタに接続されたのビットシフト演算器であ
る。3は桁あふれ検出器、4は振幅制限器であり、それ
ぞれビットシフト演算器2に接続されている。桁あふれ
検出器3は振幅制限器4へも接続している。5は振幅制
限器4に接続されたALU(alithmetic l
ogic unit,算術論理演算器)であり、6はA
LU5に接続された出力レジスタである。DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 shows the configuration of the first embodiment of the present invention. In FIG. 1, 1 is an input register, and 2
Is a bit shift calculator connected to the input register. Reference numeral 3 is an overflow detector, and 4 is an amplitude limiter, which are respectively connected to the bit shift calculator 2. The overflow detector 3 is also connected to the amplitude limiter 4. Reference numeral 5 denotes an ALU (alithmetic l) connected to the amplitude limiter 4.
6 is an A unit, and 6 is A.
It is an output register connected to LU5.
【0011】次に上記第1の実施例の動作について説明
する。上記第1の実施例において、まず、入力レジスタ
1に格納してある符号付き数値で表現された被演算数を
ビットシフト演算器2に加え、1ビットシフト演算を行
う。シフト演算結果に対して、桁あふれしているかどう
かを桁あふれ検出器3が以下の方法によって調べる。Next, the operation of the first embodiment will be described. In the first embodiment, first, the operand to be stored in the input register 1 and represented by a signed numerical value is added to the bit shift calculator 2 to perform a 1-bit shift operation. The overflow detector 3 checks whether or not there is an overflow in the shift operation result by the following method.
【0012】なお、扱う符号付き数値を整数としても一
般性を失わないので、以下では符号付き整数を例にあげ
て述べる。Since the generality is not lost even if the signed numerical value to be handled is an integer, a signed integer will be described below as an example.
【0013】 sign(被演算数)=0 かつ sign(シフト演
算結果)=1 ならば正のオーバフロー sign(被演算数)=1 かつ sign(シフト演
算結果)=0 ならば負のオーバフロー ここで、sign(X)は数値×の符号を取り出す操作
である。Positive overflow if sign (operand) = 0 and sign (shift operation result) = 1 Negative overflow if sign (operand) = 1 and sign (shift operation result) = 0 sign (X) is an operation for extracting the sign of the numerical value x.
【0014】 振幅制限器4は、正のオーバフローまたは負のオーバフ
ローの場合には所定のビット数で表現可能な絶対値最大
の数を代わりに出力する。すなわち、ビットシフト演算
器2の出力ビット数をNビットとしたとき、次式の動作
をする。[0014] In the case of positive overflow or negative overflow, the amplitude limiter 4 instead outputs the maximum absolute value that can be represented by a predetermined number of bits. That is, when the number of output bits of the bit shift calculator 2 is N bits, the operation of the following equation is performed.
【0015】[0015]
【数1】 [Equation 1]
【0016】振幅制限器出力を、ALU5でさらに任意
の演算を行って、出力レジスタ6へ書き込む。なお、A
LU5は必ずしも必要ではない。The output of the amplitude limiter is further calculated by the ALU 5 and written in the output register 6. In addition, A
LU5 is not always necessary.
【0017】このように、上記第1の実施例によれば、
符号付き数値に対してビットシフト演算器2がシフトし
た結果が桁あふれすると、桁あふれ検出器3が検出し、
振幅制限器4が振幅制限するため、シフトレジスタを算
術演算に使用したとき、いかなるシフトによっても被演
算算数の符号を見失わず、かつ桁あふれた場合に本来の
値に対する誤差を小さくすることができるという利点を
有する。さらに、上記第1の実施例によれば、時系列デ
ータを順次処理する場合には、累積誤差を小さくできる
という効果をも有する。As described above, according to the first embodiment,
When the result of the bit shift calculator 2 shifting the signed value overflows, the overflow detector 3 detects it,
Since the amplitude limiter 4 limits the amplitude, when the shift register is used for arithmetic operation, the sign of the operand to be calculated is not lost by any shift, and the error with respect to the original value can be reduced in case of overflow. Has the advantage. Further, according to the first embodiment described above, when the time series data is sequentially processed, the cumulative error can be reduced.
【0018】次に第2の実施例について説明する。第2
の実施例における構成は、第1の実施例のそれと同じで
ある。第2の実施例の動作は、ビットシフト演算器2が
多ビットシフト可能であることと、桁あふれ検出器3が
多ビット対応である点が異なる。Next, a second embodiment will be described. Second
The configuration of this embodiment is the same as that of the first embodiment. The operation of the second embodiment is different in that the bit shift calculator 2 is capable of multi-bit shift and that the overflow detector 3 is multi-bit compatible.
【0019】ビットシフト演算器2によるシフト演算結
果に対して、桁あふれしているかどうかを桁あふれ検出
器3が以下の方法によって調べる。The overflow detection unit 3 checks whether or not there is an overflow in the shift operation result of the bit shift operation unit 2 by the following method.
【0020】なお、第1の実施例と同様に、扱う数値を
符号付きの整数として述べる。 sign(被演算数)=0、かつ(桁あふれビット≠0
…0,または,sign(シフト演算結果)=1) ならば、正のオーバフローとする。As in the first embodiment, the numerical values to be handled will be described as signed integers. sign (operand) = 0, and (overflow bit ≠ 0
If 0 or sign (shift operation result) = 1), it is regarded as a positive overflow.
【0021】 sign(被演算数)=1、かつ(桁あふれビット≠1
…1,または,sign(シフト演算結果)=0) ならば、負のオーバフローとする。Sign (operand) = 1, and (overflow bit ≠ 1)
If 1, or sign (shift operation result) = 0), the overflow is negative.
【0022】このように、上記第2の実施例によっても
符号無し数値に対して、第1の実施例と同様の効果が得
られる。As described above, also in the second embodiment, the same effect as in the first embodiment can be obtained with respect to the unsigned numerical value.
【0023】次に第3の実施例について説明する。第3
の実施例における構成は、第1の実施例のそれと同じで
ある。第3の実施例の動作は、演算に扱う数値が符号無
し数値であることと、桁あふれ検出器3と振幅制限器4
が符号無し数値対応である点が第1の実施例と異なる。Next, a third embodiment will be described. Third
The configuration of this embodiment is the same as that of the first embodiment. The operation of the third embodiment is that the numerical value handled in the calculation is an unsigned numerical value, that the overflow detector 3 and the amplitude limiter 4 are used.
Is different from the first embodiment in that it corresponds to an unsigned numerical value.
【0024】ビットシフト演算器2によるシフト演算結
果に対して、桁あふれしているかどうかを桁あふれ検出
器3が以下の方法によって調べる。The overflow detection unit 3 checks whether or not there is an overflow in the shift operation result by the bit shift operation unit 2 by the following method.
【0025】桁あふれビット=1 ならば オーバフロ
ーとする。実施例1と同様に、扱う符号無し数値を整数
としても一般性を失わないので、以下では符号無し整数
を例にあげて述べる。If the overflow bit = 1, it means overflow. Similar to the first embodiment, since the generality is not lost even if the unsigned numerical value to be handled is an integer, an unsigned integer will be described below as an example.
【0026】振幅制限器4は、オーバフローの場合には
所定のビット数で表現可能な最大の数を代わりとして出
力する。すなわち、ビットシフト演算器2の出力ビット
数がNビットとしたとき、次式の動作をする。In the case of overflow, the amplitude limiter 4 outputs the maximum number that can be represented by a predetermined number of bits as a substitute. That is, when the number of output bits of the bit shift calculator 2 is N bits, the operation of the following equation is performed.
【0027】[0027]
【数2】 [Equation 2]
【0028】このように、上記第3の実施例によっても
符号無し数値に対して、第1の実施例と同様の効果が得
られる。As described above, also in the third embodiment, the same effect as that of the first embodiment can be obtained with respect to the unsigned numerical value.
【0029】さらに、実施例2、3の組合せ、あるいは
ビットシフト演算器が、ビットローテート演算器であっ
ても、第1の実施例と同様の効果が得られる。また、振
幅制限器とALUの順序を入れ替えた構成を用いても、
第1の実施例と同様の効果が得られる。Furthermore, even if the combination of the second and third embodiments or the bit shift calculator is a bit rotate calculator, the same effect as that of the first embodiment can be obtained. Moreover, even if the configuration in which the order of the amplitude limiter and the ALU is exchanged is used,
The same effect as the first embodiment can be obtained.
【0030】[0030]
【発明の効果】本発明は、上記実施例より明らかなよう
に、ビットシフト・ローテート演算器出力の桁あふれを
調べ、取り得る値の範囲に制限を加えるものであり、ビ
ットシフト・ローテート演算器に算術演算としての桁あ
ふれが発生しても、桁あふれ検出器が検出して振幅制限
器で値の補正をするため、演算結果の符号を誤ることな
く、かつ有限語長の制限の中で最も演算誤差の小さい演
算結果が得られるという効果を有する。As is apparent from the above embodiment, the present invention examines the overflow of the output of the bit shift / rotate calculator and limits the range of possible values. Even if a digit overflow occurs as an arithmetic operation, the overflow detector detects it and corrects the value with the amplitude limiter. Therefore, the sign of the operation result is correct and the finite word length is limited. This has the effect of obtaining a calculation result with the smallest calculation error.
【図1】本発明の第1、第2、第3の実施例におけるビ
ット演算器の構成図FIG. 1 is a configuration diagram of a bit arithmetic unit according to first, second and third embodiments of the present invention.
【図2】従来のビット演算器の構成図FIG. 2 is a block diagram of a conventional bit arithmetic unit
【符号の説明】 1 入力レジスタ 2 ビットシフト演算器 3 桁あふれ検出器 4 振幅制限器 5 ALU 6 出力レジスタ[Explanation of Codes] 1 Input register 2 Bit shift calculator 3 Overflow detector 4 Amplitude limiter 5 ALU 6 Output register
Claims (3)
対する桁あふれ検出器と、振幅制限器を備えたビット演
算器1. A bit calculator including a bit shift calculator, an overflow detector for a signed numerical value, and an amplitude limiter.
可能であることを特徴とする請求項1に記載のビット演
算器2. The bit calculator according to claim 1, wherein the bit shift calculator is capable of multi-bit shift.
振幅制限器が、符号無し数値に対する桁あふれ検出器、
振幅制限器であることを特徴とする請求項1に記載のビ
ット演算器3. An overflow detector for signed numbers,
Amplitude limiter is an overflow detector for unsigned numbers,
The bit calculator according to claim 1, wherein the bit calculator is an amplitude limiter.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5022256A JPH06236253A (en) | 1993-02-10 | 1993-02-10 | Bit computing element |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP5022256A JPH06236253A (en) | 1993-02-10 | 1993-02-10 | Bit computing element |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH06236253A true JPH06236253A (en) | 1994-08-23 |
Family
ID=12077700
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP5022256A Pending JPH06236253A (en) | 1993-02-10 | 1993-02-10 | Bit computing element |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH06236253A (en) |
-
1993
- 1993-02-10 JP JP5022256A patent/JPH06236253A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP3487903B2 (en) | Arithmetic device and arithmetic method | |
| US20050060359A1 (en) | Arithmetic unit for addition or subtraction with preliminary saturation detection | |
| US5798952A (en) | Leading bit anticipator | |
| JP3012357B2 (en) | Shift amount detection circuit | |
| JPH06236253A (en) | Bit computing element | |
| US7051062B2 (en) | Apparatus and method for adding multiple-bit binary-strings | |
| US20080098057A1 (en) | Multiplication Apparatus | |
| JPH09128213A (en) | Block floating processing system and method | |
| EP0203599B1 (en) | Apparatus to determine conditions in a calculating unit | |
| JPH01282633A (en) | Non-normalized number processing system | |
| JPH0644226B2 (en) | Processor | |
| JPH0713743A (en) | Multiplier | |
| JP2513354B2 (en) | Floating point arithmetic auxiliary circuit | |
| JPS59136849A (en) | Dividing device | |
| JP2801640B2 (en) | Logical value equivalence detection circuit | |
| JPS5960637A (en) | Arithmetic device for floating decimal point | |
| JPS626326A (en) | Arithmetic processor | |
| JPH07117892B2 (en) | Shifter | |
| JPH02170225A (en) | System for detecting arithmetic exception | |
| JPH0635670A (en) | Floating point adder | |
| Choi | Fixed Point Arithmetic | |
| JPH03241421A (en) | Multiplier | |
| JPH0361224B2 (en) | ||
| JPH02165225A (en) | Arithmetic processing unit for floating point numeral with accuracy | |
| JPH07120265B2 (en) | Rounding method in binary floating point multiplication |