WO2007096982A1 - 演算処理装置および演算処理方法 - Google Patents

演算処理装置および演算処理方法 Download PDF

Info

Publication number
WO2007096982A1
WO2007096982A1 PCT/JP2006/303441 JP2006303441W WO2007096982A1 WO 2007096982 A1 WO2007096982 A1 WO 2007096982A1 JP 2006303441 W JP2006303441 W JP 2006303441W WO 2007096982 A1 WO2007096982 A1 WO 2007096982A1
Authority
WO
WIPO (PCT)
Prior art keywords
bit
carry
result
upper bit
bit string
Prior art date
Application number
PCT/JP2006/303441
Other languages
English (en)
French (fr)
Inventor
Ryuji Kan
Original Assignee
Fujitsu Limited
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 Limited filed Critical Fujitsu Limited
Priority to JP2008501539A priority Critical patent/JP4500358B2/ja
Priority to PCT/JP2006/303441 priority patent/WO2007096982A1/ja
Publication of WO2007096982A1 publication Critical patent/WO2007096982A1/ja
Priority to US12/230,029 priority patent/US8549054B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation

Definitions

  • the present invention relates to an arithmetic processing device and an arithmetic processing method for performing absolute value addition of two bit strings having different bit widths.
  • the present invention can further reduce the processing time and reduce the circuit scale.
  • the present invention relates to an arithmetic processing device and an arithmetic processing method.
  • floating point numbers are used in operations in processors such as computers because the numerical range that can be expressed by a limited number of bits is large.
  • a floating-point number consists of a sign part, an exponent part, and a mantissa part. When calculating a floating-point number, absolute values of the exponent part and mantissa part are frequently added.
  • a general arithmetic processing unit that performs addition of absolute values includes two adders for adding and subtracting two binary numbers A and B.
  • One adder has a carry-in force SO, which is the third input.
  • SO carry-in force
  • the output of this adder is the calculation result.
  • the binary numbers A and B are different in sign and the addition result is negative, the output of this adder is inverted to obtain the absolute value, and the result is the operation result.
  • the other adder has a carry-in as the third input of 1, and performs subtraction using a 2's complement expression. Therefore, when the binary numbers A and B are different in sign and the addition result is positive, the output of this adder is the operation result.
  • the circuit scale and power consumption tend to increase.
  • the circuit scale can be reduced by adding an inverter or adjusting a shift.
  • Various configurations have been studied (see, for example, Patent Document 1).
  • Patent Document 1 Japanese Patent Application Laid-Open No. 2000-155671
  • the present invention has been made in view of the strong point, and when performing two numbers of operations having different bit widths, the processing time can be further shortened and the circuit scale can be reduced.
  • An object is to provide an apparatus and an arithmetic processing method.
  • the present invention provides an arithmetic processing device for performing absolute value addition of a first bit string having a predetermined bit width and a second bit string having a bit width larger than the first bit string, Dividing means for dividing the second bit string into a lower bit part having a bit width equal to that of the first bit string and an upper bit part higher than the lower bit part, and a carry for the upper bit part obtained by dividing by the dividing means And a first calculation means for performing a carry-down calculation, a second calculation means for adding the absolute value of the first bit string and the lower bit part obtained by the division by the dividing means, and information on the upper bit part, Depending on the sign information of the first bit string and the second bit string, and the intermediate result of the absolute value addition by the second arithmetic means, the output of the first arithmetic means is the result of the carry arithmetic, the carry Calculation result, or characterized by having a selection means for selecting from the upper bit portion minute
  • the present invention is characterized in that, in the above-mentioned invention, the selecting means selects the output of the first calculating means in accordance with whether or not the upper bit part is 0.
  • the selection unit selects the carry operation result or the upper bit portion itself when the codes of the first bit string and the second bit string are the same sign. It is characterized by doing.
  • the selection unit selects the carry calculation result when a carry occurs in the absolute value addition by the second calculation unit.
  • the upper bit portion itself is selected when no carry occurs in the absolute value addition by the second calculation means.
  • the selection unit selects the carry-down calculation result or the upper bit portion itself when the codes of the first bit string and the second bit string are different signs. It is characterized by doing.
  • the present invention is characterized in that, in the above-mentioned invention, the selecting means selects the upper bit part itself when the upper bit part is 0.
  • the selecting means may calculate the carry-down calculation result when the upper bit part is not 0 and the lower bit part is less than the first bit string. It is characterized by selecting.
  • the present invention is characterized in that, in the above invention, the selecting means selects the upper bit portion itself when the lower bit portion is equal to or more than the first bit string.
  • the first arithmetic unit corresponds to a first arithmetic unit that adds 1 corresponding to a carry to the upper bit part and the upper bit partial force carry-down. Any one of the first arithmetic unit, the second arithmetic unit, and the third arithmetic unit according to the selection of the selection unit, the second arithmetic unit that subtracts 1, the third arithmetic unit that adds 0 to the upper bit part, Output means for outputting the calculation result.
  • the present invention also provides an arithmetic processing method for performing absolute value addition between a first bit string having a predetermined bit width and a second bit string having a bit width larger than that of the first bit string.
  • a dividing step of dividing a lower bit portion having a bit width equal to the bit string and an upper bit portion higher than the lower bit portion, and carrying and lowering of the upper bit portion obtained by the dividing step A first calculation step for performing calculation, a second calculation step for adding the absolute value of the lower bit portion obtained by dividing in the dividing step and the first bit string, and information on the upper bit portion, first Depending on the sign information of the bit string and the second bit string, and the intermediate result of the absolute value addition in the second calculation step, the result of the first calculation step is changed to the carry calculation result, the carry calculation result, or the upper bit. And having a selection step of selecting from root section itself.
  • the second bit string is divided into the lower bit part of the bit width and the upper bit part higher than the lower bit part, such as the first bit string, and the carry and digit for the upper bit part are divided.
  • the lower bit is added and the absolute value of the lower bit part is added to the first bit string.
  • the upper bit is added according to the information about the upper bit part, the sign information of the first bit string and the second bit string, and the intermediate result of the absolute value addition. Select the operation result for the part from the carry operation result, the carry operation result, or the upper bit part itself. For this reason, when two numbers of operations with different bit widths are performed, it is sufficient to select an appropriate operation result for the upper bit portion if the calculation for the lower bit portion is completed. All the calculations are completed only by the time required for the calculation, and the processing time can be further reduced, and the circuit for performing the addition related to the upper bit part becomes unnecessary, and the circuit scale can be reduced.
  • the bit width of the second bit sequence is substantially equal to that of the first bit sequence. Accurate calculation can be performed even when the width is less than the bit width.
  • the carry operation result or the upper bit part itself is selected, so that the digit in the addition of the positive values is determined. Whether or not the bit is raised can be reflected in the calculation result for the upper bit part.
  • the result of the carry-down operation or the upper bit part itself is selected.
  • the presence / absence of carry-down in addition can be reflected in the calculation result for the upper bit part.
  • the upper bit portion when the upper bit portion is 0, the upper bit portion itself Therefore, if the bit width of the second bit string is substantially less than or equal to the bit width of the first bit string, the calculation result for the upper bit part is left as 0, and the first bit string force is also set to the lower bit part.
  • the absolute value addition result can be obtained by subtraction.
  • the lower bit partial force is also set to the first bit in order to select the carry operation result.
  • the carry-down that occurs in the process of subtracting a column can be accurately reflected in the calculation result for the upper bit part.
  • the upper bit portion when the lower bit portion is equal to or higher than the first bit sequence, the upper bit portion itself is selected, so that the lower bit partial force is not reduced in the process of subtracting the first bit sequence. This can be accurately reflected in the calculation result for the upper bit part.
  • the first arithmetic unit for adding 1 corresponding to carry to the upper bit part, the second arithmetic unit for subtracting 1 corresponding to carry lower, and the upper bit part Outputs the operation result of one of the third arithmetic units to which 0 is added according to the selection. For this reason, the circuit configuration for obtaining the calculation result relating to the upper bit part becomes simple, and the circuit size can be surely reduced.
  • FIG. 1 is a block diagram showing a schematic configuration of a floating point number arithmetic apparatus according to an embodiment of the present invention.
  • FIG. 2 is a diagram illustrating an example of a floating-point number according to an embodiment.
  • FIG. 3 is a block diagram showing an internal configuration of an absolute value addition unit according to one embodiment.
  • FIG. 4 is a diagram showing selection of calculation results of an absolute value addition unit according to one embodiment.
  • FIG. 1 is a block diagram showing a schematic configuration of a floating point number arithmetic apparatus according to an embodiment of the present invention.
  • the floating-point arithmetic unit shown in FIG. 1 includes a division unit 100, a division unit 200, an exponent difference calculation unit 300, a sign determination unit 400, an upper / lower division unit 500, an absolute value addition unit 600, a normalization shift unit 700, and It has a rounding calculator 800!
  • the dividing unit 100 converts the floating point number A into a sign bit indicating the sign of the floating point number A, an exponent bit corresponding to the number of digits of the floating point number A, and a mantissa bit corresponding to the numerical value of the floating point number A. Divide (see FIG. 2), output the sign bit to the sign determination unit 400, output the exponent bit to the exponent difference calculation unit 300, and output the mantissa bit to the upper and lower division unit 500.
  • the dividing unit 200 converts the floating-point number B into a sign bit indicating the sign of the floating-point number B, floating Divide into an exponent bit corresponding to the number of digits of the decimal point B and a mantissa bit corresponding to the value of the floating-point number B, and output the sign bit to the sign determination unit 400 and output the exponent bit to the exponent difference calculation unit 300
  • the mantissa bits are output to the absolute value addition unit 600.
  • the exponent difference calculation unit 300 compares the exponent bits of the floating point numbers A and B, notifies the exponent difference between the floating point number A and the floating point number B to the upper and lower division unit 500, and the floating point number A
  • the upper bit information AH—0 indicating whether the upper bit AH corresponding to the difference in the number of digits between the floating point number A and the floating point number B is 0 is output to the absolute value addition unit 600. To do.
  • the upper bit information AH-0 is a signal that takes a value of 1 when the upper bit AH is 0 and takes a value of 0 when the upper bit AH is not 0.
  • the sign determination unit 400 compares the sign bits of the floating-point numbers A and B, determines whether the floating-point numbers A and B are the same sign or different signs, and the determination result and the floating-point number A , B code information including each code is output to absolute value adding section 600.
  • the upper and lower division unit 500 shifts the digit alignment of the mantissa bits of the floating-point number A and the mantissa bits of the floating-point number B, and the difference in the number of digits Is divided into the upper bit AH corresponding to, the number of mantissa bits of the floating-point number B, and the lower bit AL common. That is, the floating point number A and the floating point number B may have different bit widths of the mantissa bits when the digits are aligned. Therefore, the upper and lower division unit 500, as shown in FIG. Divide A's mantissa bit into upper bit AH and lower bit AL, and align the bit width of lower bit AL to the bit width of mantissa bit BL of floating point number B.
  • the absolute value addition unit 600 adds the lower bit AL of the floating-point number A and the mantissa bit BL of the floating-point number B, and carries the carry for the upper bit AH of the floating-point number A. And the carry-down (borrow) is calculated separately, and finally, the upper bit portion operation result SH and the lower bit portion operation result SL are selected according to the upper bit information AH-0 and the sign information, etc. .
  • a specific calculation by the absolute value adding unit 600 will be described in detail later.
  • Normalization shift section 700 appropriately determines exponent bits by performing normal shift so that the bit string that also includes the operation result SH and operation result SL power of absolute value addition section 600 is a mantissa bit of a floating-point number. .
  • the rounding calculation unit 800 rounds the bit string composed of the calculation result SH and the calculation result SL by the absolute value addition unit 600 to obtain the mantissa bit of the floating-point number, thereby obtaining the floating-point number A and the floating-point number.
  • the floating point number S that is the result of addition with B is output.
  • FIG. 3 is a block diagram showing an internal configuration of absolute value adding section 600 according to the present embodiment.
  • the absolute value addition unit 600 shown in FIG. 3 has a high-order operation unit 610, a low-order operation unit 620, and an output selection unit 630.
  • the high-order arithmetic unit 610 includes a +1 arithmetic unit 611, a ⁇ 1 arithmetic unit 612, a +0 arithmetic unit 613, and an output unit 614
  • the low-order arithmetic unit 620 includes a logical negation calculation unit 621 and a logical negation.
  • a calculation unit 622, an adder 623, an adder 624, an inverter 625, and an output unit 626 are included.
  • Upper operation section 610 performs a carry and a carry on upper bit AH, and according to intermediate results of upper bit information AH-0, sign information, and operation of lower bits in lower operation section 620 As a result, the result of the higher bit AH being carried, the result of the lower bit AH being lowered, and the higher bit AH itself are output as the upper bit operation result SH.
  • the +1 arithmetic unit 611 adds +1 corresponding to the carry (carry) of the operation result of the lower bit to the upper bit AH, and uses it as the input X to the output unit 614.
  • the arithmetic unit 6 12 adds 1 corresponding to the carry (borrow) from the lower bit operation result to the upper bit AH, and uses it as the input Y to the output unit 614.
  • the +0 computing unit 613 uses the upper bit AH as input Z to the output unit 614 as it is when neither a carry nor a carry occurs from the lower bit calculation result.
  • the output unit 614 outputs one of the inputs X, Y, and ⁇ ⁇ ⁇ as the higher-bit operation result SH in accordance with the instruction from the output selection unit 630.
  • Lower operation unit 620 performs addition / subtraction of lower bit AL and mantissa bit BL, and outputs lower bit operation result SL according to upper bit information AH-0, sign information, and an intermediate result of addition / subtraction.
  • the logical negation calculation unit 621 determines that the low-order bit AL is less when the floating point number A and the floating point number B are determined to have different signs and the floating point number A is a negative value from the sign information. The logical negation is calculated and output to the adder 623 and the adder 624. In addition, the logic failure calculation unit 621 uses the sign information so that the floating point number A and the floating point number B have the same sign. Or, when the floating point number A is determined to be a positive value, the lower bit AL is output to the adder 623 and the adder 624 as they are.
  • the logical negation calculation unit 622 calculates the logical negation of the mantissa bit BL when the sign information force floating point number A and floating point number B are determined to have different signs and the floating point number B is negative. , Output to adder 623 and adder 624. In addition, when the floating point number A and the floating point number B are determined to have the same sign or the floating point number B is a positive value from the sign information, the logical negation calculation unit 622 adds the mantissa bit BL as it is to the adder 623. And output to adder 624.
  • the logical rejection calculation unit 621 or the logical negation calculation unit 622 calculates a logical negation of the lower bit AL or the mantissa bit BL. Keep it.
  • Adder 623 receives 0 as the carry-in to the least significant bit, adds the output from logical negation calculation unit 621 and the output from logical negation calculation unit 622 with carry as 0, The addition result is input z to the output unit 626.
  • the input z is AL (or! AL) + BL (or! BL).
  • the adder 623 outputs the carry-out CO_0 in the addition process to the output selection unit 630.
  • Adder 624 receives 1 as a carry-in to the least significant bit, adds the output from logical negation calculation unit 621 and the output from logical negation calculation unit 622, with carry as 1
  • the addition result is input X to output unit 626. Therefore, the input X becomes AL (or! AL) + BL (or! BL) + 1.
  • the carry-in 1 in the adder 624 corresponds to +1 on the right side of the above equation (1).
  • the adder 624 is AL +! When calculating BL + 1, it is nothing but AL—BL (but only when the result is positive).
  • the adder 624 outputs the carry-out CO-1 in the addition process to the output selection unit 630.
  • the inverter 625 inverts the addition result of the adder 623 and outputs a logical negation to the output unit 626. Input y. Therefore, input y is! (AL (or! AL) + BL (or! BL)).
  • AL-BL is calculated, if the result is negative, 1 (AL-BL) is required as the absolute value addition result.
  • one (AL-BL) is transformed using the above equation (1), the following equation (2) is obtained.
  • the inverter 625 is one (AL-BL)! (AL +! BL) Or! (! AL
  • the output unit 626 outputs any one of the inputs x, y, and z as the lower bit operation result SL according to the instruction from the output selection unit 630.
  • the output selection unit 630 Based on the upper bit information AH-0, sign information, carry-out CO-0, and carry-out CO-1, the output selection unit 630 outputs the operation result SH in the upper operation unit 610 to the output unit 614. In addition to selecting from the inputs X, Y, and ⁇ , the calculation result SL in the low-order calculation unit 620 is selected from the inputs x, y, and z to the output unit 626. Specifically, output selection section 630 selects calculation result SH and calculation result SL according to the table shown in FIG. In the table shown in FIG. 4, the shaded area indicates that either 0 or 1 is acceptable.
  • Carry-out CO-1 in FIG. 4 indicates the sign of the addition result by adder 624. That is, if the addition result by the adder 624 is 0 or more, a carry occurs in the adder 624. In other words, the carry-out CO-1 becomes 1, and if the addition result by the adder 624 is negative, the addition is performed. No carry occurs in vessel 624, in other words carry-out CO-1 is zero.
  • the upper bit information AH-0 in FIG. 4 indicates whether or not the upper bit AH is 0! That is, if the number of digits in floating-point number A equal to the value of the exponent bit in floating-point number A is equal to the value of the exponent bit in floating-point number B, the upper bit AH Becomes 0 and upper bit information AH-0 becomes 1. On the other hand, if the number of digits of the floating point number A exceeds the number of digits of the floating point number B, the upper bit information AH-0 is 0, not the upper bit AH. [0055]
  • Carry-out CO-0 in FIG. 4 indicates whether or not a carry is generated in the addition result by the adder 623. That is, if a carry occurs in the adder 623, the carry-out CO-0 becomes 1, and if no carry occurs in the adder 623, the carry-out CO-0 becomes 0.
  • FIG. 4 three types of operations A + B (including —A—B), —A + B, and A—B are covered.
  • the upper bit AH is left as it is depending on whether the lower bit AL and the mantissa bit BL are operated and the carry is generated. It is determined whether 1 is added. In other words, if there is no carry in the addition of the lower bit AL and the mantissa bit BL, the upper bit AH remains unchanged, and if a carry occurs in the addition of the lower bit AL and the mantissa bit BL, the upper bit AH 1 is added to.
  • the upper bit AH is left as it is or is reduced depending on the magnitude relationship between the lower bit AL and the mantissa bit BL and whether the upper bit AH is 0 or not. Decide if you want to add 1 to the minute. That is, if the lower bit AL is smaller than the mantissa bit BL (AL and BL) and the upper bit AH is not 0, a borrow from the upper bit AH occurs when the mantissa bit BL is subtracted from the lower bit AL. 1 is added to the upper bits.
  • the borrow from the upper bit AH is subtracted when the mantissa bit BL is subtracted from the lower bit AL.
  • the upper bit AH which does not occur, remains unchanged.
  • the absolute value adding unit 600 may perform normal addition. Therefore, the addition result from the adder 623 having a carry-in of 0 is selected for the lower bits. That is, the operation result SL of the lower bits becomes the input z of the output unit 626. If no carry occurs in the addition process by the adder 623, the carry-out CO-0 becomes 0, and the output from the +0 calculator 613 is selected for the upper bits. That is, the upper bit operation result SH becomes the input Z of the output unit 614. On the other hand, if a carry occurs in the addition process by the adder 623, the carry-out CO 0 becomes 1. Output is selected. That is, the upper bit operation result SH becomes the input X of the output unit 614.
  • the operation result SL of the lower bits becomes the input y of the output unit 626.
  • the operation result SH of the upper bit becomes the input Y of the output unit 614.
  • the upper bit AH is 0, that is, if the upper bit information AH—0 is 1, it means that the number of digits of the floating point number A is less than or equal to the number of digits of the floating point number B. No polo occurs. If borrowing does not occur, AL + BL is positive, so BL AL can be simply subtracted. Therefore, the operation result SL of the lower bits becomes the input X of the output unit 626. At this time, since the borrow from the upper bit AH has not occurred, the operation result SH of the upper bit becomes the input Z of the output unit 614.
  • the upper bit AH is 0, that is, the upper bit information AH—0 is 1, it means that the number of digits of the floating point number A is less than or equal to the number of digits of the floating point number B. No polo occurs. If a borrow does not occur, AL—BL is negative, so the absolute value addition result is — (AL—BL).
  • AL—BL is negative, so the absolute value addition result is — (AL—BL).
  • the output selection unit 630 selects the operation result SH from the output unit 614 and the operation result SL from the output unit 626 according to the table shown in FIG.
  • the absolute value addition result of decimal point number B is obtained.
  • the adder 623 and the adder 624 in the lower operation unit 620 have the bit width of the lower bit AL and the mantissa bit BL. A corresponding one is sufficient, and the circuit provided for adding 0 to the upper bit AH can be reduced.
  • the circuit added for the calculation of the upper bit AH in this embodiment has a very simple configuration, so that the circuit scale of the absolute value adding unit 600 can be reduced.
  • a number with a large bit width is divided into upper bits and lower bits. Precisely carry out operations assuming the carry and carry of the lower bits, and select an appropriate upper bit operation result in the lower bit operation process. As a result, the computation can be completed only in the time required for the computation of the lower bits, and the processing time can be further shortened. Further, a circuit for performing addition for the upper bits is not necessary, and the circuit scale can be reduced. it can.
  • the present invention can be applied to the case of further reducing the processing time and reducing the circuit scale when performing two numbers of operations with different bit widths.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Executing Machine-Instructions (AREA)
  • Complex Calculations (AREA)

Abstract

 ビット幅が異なる2つの数の演算を行う場合に、さらなる処理時間の短縮を図り、回路規模を削減すること。上位演算部(610)は、上位ビットAHに対する桁上げおよび桁下げをあらかじめ演算しておき、上位ビット情報AH_0、符号情報、および下位演算部(620)における下位ビットの演算の中間結果に応じて、上位ビットの演算結果SHを出力する。下位演算部(620)は、下位ビットALおよび仮数ビットBLの加減算を行い、上位ビット情報AH_0、符号情報、および加減算の中間結果に応じて、下位ビットの演算結果SLを出力する。出力選択部(630)は、上位演算部(610)における演算結果SHを出力部614への入力X、Y、Zから選択するとともに、下位演算部(620)における演算結果SLを出力部626への入力x、y、zから選択する。

Description

明 細 書
演算処理装置および演算処理方法
技術分野
[0001] 本発明は、ビット幅が異なる 2つのビット列の絶対値加算を行う演算処理装置およ び演算処理方法であって、特に、さらなる処理時間の短縮を図り、回路規模を削減 することができる演算処理装置および演算処理方法に関する。
背景技術
[0002] 通常、コンピュータなどのプロセッサにおける演算においては、限られたビット数で 表現可能な数値範囲が大きくなることから浮動小数点数が用いられている。浮動小 数点数は、符号部、指数部、および仮数部からなっており、浮動小数点数の演算に ぉ 、ては、指数部や仮数部の絶対値加算が頻繁に行われる。
[0003] 一般的な絶対値加算を行う演算処理装置には、 2つの 2進数 A、 Bを加減算するた めに 2つの加算器が備えられている。一方の加算器は、第 3入力であるキャリーイン 力 SOとされており、 2進数 A、 Bの正負が同じである場合は、この加算器の出力が演算 結果となる。また、 2進数 A、 Bの正負が異なり、かつ、加算結果が負となる場合には、 この加算器の出力が絶対値を求めるために反転されて演算結果となる。
[0004] また、他方の加算器は、第 3入力であるキャリーインが 1とされており、 2の補数表現 を用いた減算を実行する。したがって、 2進数 A、 Bの正負が異なり、かつ、加算結果 が正となる場合には、この加算器の出力が演算結果となる。
[0005] このような演算処理装置を備えた浮動小数点数演算装置においては、回路規模や 消費電力が大きくなる傾向にあるため、例えばインバータの追加やシフトの調整など によって回路規模を縮小するための種々の構成が検討されている (例えば特許文献 1参照)。
[0006] 特許文献 1 :特開 2000— 155671号公報
発明の開示
発明が解決しょうとする課題
[0007] し力しながら、加算器でビット幅 (すなわち桁数)が異なる 2つの 2進数 A、 Bの加減 算を行う場合、ビット幅が小さい方の上位に 0を補完して加減算が行われるため、処 理時間の短縮に限界があるという問題がある。すなわち、例えば 2進数 Aの方が 2進 数 Bよりもビット幅が大きい場合、両者が同じビット幅になるように、 2進数 Bの上位に 0 が補完されてから加減算が行われる。
[0008] このような場合、加算器としては、 2進数 Aのビット幅に対応するものが必要となるた め、回路規模が増大するとともに、 2進数 Bの上位ビットがすべて 0であるにも関わら ずすベてのビットについて演算が実行されて、処理時間が必要以上に長くなる。
[0009] 本発明は力かる点に鑑みてなされたものであり、ビット幅が異なる 2つの数の演算を 行う場合に、さらなる処理時間の短縮を図り、回路規模を削減することができる演算 処理装置および演算処理方法を提供することを目的とする。
課題を解決するための手段
[0010] 上記課題を解決するために、本発明は、所定のビット幅の第 1ビット列と第 1ビット列 よりもビット幅が大きい第 2ビット列との絶対値加算を行う演算処理装置であって、第 2 ビット列を第 1ビット列と等しいビット幅の下位ビット部分と下位ビット部分よりも上位の 上位ビット部分とに分割する分割手段と、前記分割手段によって分割されて得られた 上位ビット部分に対する桁上げおよび桁下げの演算を行う第 1演算手段と、前記分 割手段によって分割されて得られた下位ビット部分と第 1ビット列の絶対値加算を行う 第 2演算手段と、前記上位ビット部分に関する情報、第 1ビット列および第 2ビット列の 符号情報、ならびに前記第 2演算手段による絶対値加算の中間結果に応じて、前記 第 1演算手段の出力を桁上げ演算結果、桁下げ演算結果、または前記上位ビット部 分そのものから選択する選択手段とを有することを特徴とする。
[0011] また、本発明は、上記発明において、前記選択手段は、前記上位ビット部分が 0で ある力否かに応じて前記第 1演算手段の出力を選択することを特徴とする。
[0012] また、本発明は、上記発明において、前記選択手段は、第 1ビット列および第 2ビッ ト列の符号が同符号である場合に、前記桁上げ演算結果または前記上位ビット部分 そのものを選択することを特徴とする。
[0013] また、本発明は、上記発明において、前記選択手段は、前記第 2演算手段による絶 対値加算において桁上げが発生した場合に前記桁上げ演算結果を選択する一方、 前記第 2演算手段による絶対値加算において桁上げが発生しない場合に前記上位 ビット部分そのものを選択することを特徴とする。
[0014] また、本発明は、上記発明において、前記選択手段は、第 1ビット列および第 2ビッ ト列の符号が異符号である場合に、前記桁下げ演算結果または前記上位ビット部分 そのものを選択することを特徴とする。
[0015] また、本発明は、上記発明において、前記選択手段は、前記上位ビット部分が 0で ある場合に、前記上位ビット部分そのものを選択することを特徴とする。
[0016] また、本発明は、上記発明において、前記選択手段は、前記上位ビット部分が 0で はなくかつ前記下位ビット部分が前記第 1ビット列未満である場合に、前記桁下げ演 算結果を選択することを特徴とする。
[0017] また、本発明は、上記発明において、前記選択手段は、前記下位ビット部分が前記 第 1ビット列以上である場合に、前記上位ビット部分そのものを選択することを特徴と する。
[0018] また、本発明は、上記発明において、前記第 1演算手段は、前記上位ビット部分に 桁上げに相当する 1を加える第 1演算器と、前記上位ビット部分力 桁下げに相当す る 1を減じる第 2演算器と、前記上位ビット部分に 0を加える第 3演算器と、前記選択 手段の選択に従って、前記第 1演算器、前記第 2演算器、および前記第 3演算器の いずれかの演算結果を出力する出力手段とを含むことを特徴とする。
[0019] また、本発明は、所定のビット幅の第 1ビット列と第 1ビット列よりもビット幅が大きい 第 2ビット列との絶対値加算を行う演算処理方法であって、第 2ビット列を第 1ビット列 と等しいビット幅の下位ビット部分と下位ビット部分よりも上位の上位ビット部分とに分 割する分割工程と、前記分割工程にて分割されて得られた上位ビット部分に対する 桁上げおよび桁下げの演算を行う第 1演算工程と、前記分割工程にて分割されて得 られた下位ビット部分と第 1ビット列の絶対値加算を行う第 2演算工程と、前記上位ビ ット部分に関する情報、第 1ビット列および第 2ビット列の符号情報、ならびに前記第 2 演算工程における絶対値加算の中間結果に応じて、前記第 1演算工程の結果を桁 上げ演算結果、桁下げ演算結果、または前記上位ビット部分そのものから選択する 選択工程とを有することを特徴とする。 発明の効果
[0020] 本発明によれば、第 2ビット列を第 1ビット列と等 、ビット幅の下位ビット部分と下位 ビット部分よりも上位の上位ビット部分とに分割し、上位ビット部分に対する桁上げお よび桁下げの演算を行い、下位ビット部分と第 1ビット列の絶対値加算を行い、上位 ビット部分に関する情報、第 1ビット列および第 2ビット列の符号情報、ならびに絶対 値加算の中間結果に応じて、上位ビット部分に関する演算結果を桁上げ演算結果、 桁下げ演算結果、または上位ビット部分そのものから選択する。このため、ビット幅が 異なる 2つの数の演算を行う場合に、下位ビット部分に関する演算が完了すれば上 位ビット部分については適切な演算結果を選択するのみで良ぐ実質的に下位ビット 部分の演算に要する時間のみですベての演算が完了し、さらなる処理時間の短縮を 図ることができるとともに、上位ビット部分に関する加算を行うための回路が不要となり 、回路規模を削減することができる。
[0021] また、本発明によれば、上位ビット部分が 0である力否かに応じて上位ビット部分に 関する演算結果を選択するため、第 2ビット列のビット幅が実質的に第 1ビット列のビ ット幅以下である場合でも正確な演算を行うことができる。
[0022] また、本発明によれば、第 1ビット列および第 2ビット列の符号が同符号である場合 に、桁上げ演算結果または上位ビット部分そのものを選択するため、正の値同士の 加算における桁上げの有無を上位ビット部分に関する演算結果に反映することがで きる。
[0023] また、本発明によれば、絶対値加算にぉ ヽて桁上げが発生した場合に桁上げ演算 結果を選択する一方、絶対値加算において桁上げが発生しない場合に上位ビット部 分そのものを選択する。このため、下位ビット部分と第 1ビット列の加算における桁上 げの有無を上位ビット部分に関する演算結果に正確に反映することができる。
[0024] また、本発明によれば、第 1ビット列および第 2ビット列の符号が異符号である場合 に、桁下げ演算結果または上位ビット部分そのものを選択するため、正の値と負の値 の加算における桁下げの有無を上位ビット部分に関する演算結果に反映することが できる。
[0025] また、本発明によれば、上位ビット部分が 0である場合に、上位ビット部分そのもの を選択するため、第 2ビット列のビット幅が実質的に第 1ビット列のビット幅以下である 場合は、上位ビット部分に関する演算結果を 0のままにしておき、第 1ビット列力も下 位ビット部分を減算して絶対値加算結果を得ることができる。
[0026] また、本発明によれば、上位ビット部分が 0ではなくかつ下位ビット部分が第 1ビット 列未満である場合に、桁下げ演算結果を選択するため、下位ビット部分力も第 1ビッ ト列を減算する過程で発生する桁下げを上位ビット部分に関する演算結果に正確に 反映することができる。
[0027] また、本発明によれば、下位ビット部分が第 1ビット列以上である場合に、上位ビット 部分そのものを選択するため、下位ビット部分力も第 1ビット列を減算する過程で桁 下げが発生しないことを上位ビット部分に関する演算結果に正確に反映することがで きる。
[0028] また、本発明によれば、上位ビット部分に桁上げに相当する 1を加える第 1演算器、 上位ビット部分力 桁下げに相当する 1を減じる第 2演算器、および上位ビット部分に 0を加える第 3演算器のいずれかの演算結果を選択に従って出力する。このため、上 位ビット部分に関する演算結果を得る回路構成が簡易なものになり、確実に回路規 模を削減することができる。
図面の簡単な説明
[0029] [図 1]図 1は、本発明の一実施の形態に係る浮動小数点数演算装置の概略構成を示 すブロック図である。
[図 2]図 2は、一実施の形態に係る浮動小数点数の一例を示す図である。
[図 3]図 3は、一実施の形態に係る絶対値加算部の内部構成を示すブロック図である
[図 4]図 4は、一実施の形態に係る絶対値加算部の演算結果の選択を示す図である
符号の説明
[0030] 100、 200 分割部
300 指数差計算部
400 符号判定部 500 上下位分割部
600 絶対値加算部
610 上位演算部
611 + 1演算器
612 1演算器
613 + 0演算器
614 出力部
620 下位演算部
621、 622 論理否定算出部
623、 624 加算器
625 インノ ータ
626 出力部
630 出力選択部
700 正規ィ匕シフト部
800 演算部
発明を実施するための最良の形態
[0031] 以下、本発明の一実施の形態について、図面を参照して詳細に説明する。なお、 以下においては、浮動小数点数の仮数部の加減算を例に挙げて説明するが、本発 明は、浮動小数点数に限らず種々の絶対値加算に適用することができる。
[0032] 図 1は、本発明の一実施の形態に係る浮動小数点数演算装置の概略構成を示す ブロック図である。図 1に示す浮動小数点数演算装置は、分割部 100、分割部 200、 指数差計算部 300、符号判定部 400、上下位分割部 500、絶対値加算部 600、正 規化シフト部 700、および丸め演算部 800を有して!/、る。
[0033] 分割部 100は、浮動小数点数 Aを浮動小数点数 Aの正負を示す符号ビット、浮動 小数点数 Aの桁数に対応する指数ビット、および浮動小数点数 Aの数値に対応する 仮数ビットに分割し (図 2参照)、符号ビットを符号判定部 400へ出力し、指数ビットを 指数差計算部 300へ出力し、仮数ビットを上下位分割部 500へ出力する。
[0034] 分割部 200は、浮動小数点数 Bを浮動小数点数 Bの正負を示す符号ビット、浮動 小数点数 Bの桁数に対応する指数ビット、および浮動小数点数 Bの数値に対応する 仮数ビットに分割し、符号ビットを符号判定部 400へ出力し、指数ビットを指数差計算 部 300へ出力し、仮数ビットを絶対値加算部 600へ出力する。
[0035] 指数差計算部 300は、浮動小数点数 A、 Bの指数ビットを比較し、浮動小数点数 A と浮動小数点数 Bとの指数差を上下位分割部 500へ通知し、浮動小数点数 Aの仮 数ビットにおいて、浮動小数点数 Aと浮動小数点数 Bの桁数の差分に相当する上位 ビット AHが 0であるカゝ否かを示す上位ビット情報 AH—0を絶対値加算部 600へ出力 する。上位ビット情報 AH— 0は、上位ビット AHが 0である場合に 1の値をとり、上位ビ ット AHが 0ではない場合に 0の値をとる信号である。
[0036] 符号判定部 400は、浮動小数点数 A、 Bの符号ビットを比較し、浮動小数点数 A、 B が同符号であるか異符号であるかを判定し、判定結果と浮動小数点数 A、 Bそれぞ れの符号とを含む符号情報を絶対値加算部 600へ出力する。
[0037] 上下位分割部 500は、指数差計算部 300からの通知に従 、、浮動小数点数 Aの 仮数ビットと浮動小数点数 Bの仮数ビットとの桁合わせシフトを行 、、桁数の差分に 相当する上位ビット AHと浮動小数点数 Bの仮数ビットの桁数と共通する下位ビット A Lとに分割する。すなわち、浮動小数点数 Aと浮動小数点数 Bとは、桁合わせを行うと 仮数ビットのビット幅が異なることがあるため、上下位分割部 500は、例えば図 2に示 すように、浮動小数点数 Aの仮数ビットを上位ビット AHと下位ビット ALとに分割し、 下位ビット ALのビット幅は浮動小数点数 Bの仮数ビット BLのビット幅に揃える。
[0038] 絶対値加算部 600は、浮動小数点数 Aの下位ビット ALと浮動小数点数 Bの仮数ビ ット BLとを加算するとともに、浮動小数点数 Aの上位ビット AHに対する桁上げ (キヤリ 一)および桁下げ (ボロー)については別途演算しておき、最終的に、上位ビット情報 AH—0および符号情報などに応じて上位ビット部分の演算結果 SHおよび下位ビッ ト部分の演算結果 SLを選択する。絶対値加算部 600による具体的な演算について は、後に詳述する。
[0039] 正規化シフト部 700は、絶対値加算部 600による演算結果 SHおよび演算結果 SL 力もなるビット列を浮動小数点数の仮数ビットとするように正規ィ匕シフトして指数ビット を適切に決定する。 [0040] 丸め演算部 800は、絶対値加算部 600による演算結果 SHおよび演算結果 SLから なるビット列を丸め演算して、浮動小数点数の仮数ビットとすることにより、浮動小数 点数 Aと浮動小数点数 Bとの加算結果である浮動小数点数 Sを出力する。
[0041] 図 3は、本実施の形態に係る絶対値加算部 600の内部構成を示すブロック図であ る。図 3に示す絶対値加算部 600は、大きく分けて上位演算部 610、下位演算部 62 0、および出力選択部 630を有している。また、上位演算部 610は、 + 1演算器 611、 —1演算器 612、 +0演算器 613、および出力部 614を有しており、下位演算部 620 は、論理否定算出部 621、論理否定算出部 622、加算器 623、加算器 624、インバ ータ 625、および出力部 626を有している。
[0042] 上位演算部 610は、上位ビット AHに対する桁上げおよび桁下げを演算し、上位ビ ット情報 AH— 0、符号情報、および下位演算部 620における下位ビットの演算の中 間結果に応じて、上位ビット AHが桁上げされた結果、上位ビット AHが桁下げされた 結果、および上位ビット AHそのものの 、ずれかを上位ビットの演算結果 SHとして出 力する。
[0043] 具体的には、 + 1演算器 611は、下位ビットの演算結果力もの桁上げ (キャリー)に 相当する + 1を上位ビット AHに加算し、出力部 614への入力 Xとする。 1演算器 6 12は、下位ビットの演算結果からの桁下げ (ボロー)に相当する 1を上位ビット AH に加算し、出力部 614への入力 Yとする。 +0演算器 613は、下位ビットの演算結果 から桁上げも桁下げも発生しな ヽ場合のために、上位ビット AHをそのまま出力部 61 4への入力 Zとする。出力部 614は、出力選択部 630からの指示に従って、入力 X、Y 、Ζのうちいずれか 1つを上位ビットの演算結果 SHとして出力する。
[0044] 下位演算部 620は、下位ビット ALおよび仮数ビット BLの加減算を行い、上位ビット 情報 AH— 0、符号情報、および加減算の中間結果に応じて、下位ビットの演算結果 SLを出力する。
[0045] 具体的には、論理否定算出部 621は、符号情報から浮動小数点数 Aおよび浮動 小数点数 Bが異符号かつ浮動小数点数 Aが負の値と判断された場合に、下位ビット ALの論理否定を算出し、加算器 623および加算器 624へ出力する。また、論理否 定算出部 621は、符号情報から浮動小数点数 Aおよび浮動小数点数 Bが同符号あ るいは浮動小数点数 Aが正の値と判断された場合は、下位ビット ALをそのまま加算 器 623および加算器 624へ出力する。同様に、論理否定算出部 622は、符号情報 力 浮動小数点数 Aおよび浮動小数点数 Bが異符号かつ浮動小数点数 Bが負の値 と判断された場合に、仮数ビット BLの論理否定を算出し、加算器 623および加算器 624へ出力する。また、論理否定算出部 622は、符号情報から浮動小数点数 Aおよ び浮動小数点数 Bが同符号あるいは浮動小数点数 Bが正の値と判断された場合は、 仮数ビット BLをそのまま加算器 623および加算器 624へ出力する。
[0046] ここで、 2進数における負の値の加算(すなわち減算)は、 2の補数表現における次 式(1)を用いることにより、正の値の加算に変換することができる。ただし、式(1)にお いて、 Pは所望の 2進数を示し、 ! Pは Pの論理否定を示す。
P=! P+ 1
[0047] したがって、浮動小数点数 Aまたは浮動小数点数 Bが負の値の場合には、論理否 定算出部 621または論理否定算出部 622が下位ビット ALまたは仮数ビット BLの論 理否定を算出しておく。
[0048] 加算器 623は、最下位ビットへのキャリーインとして 0が入力されており、キャリーィ ンを 0として論理否定算出部 621からの出力と論理否定算出部 622からの出力とを 加算し、加算結果を出力部 626への入力 zとする。したがって、入力 zは、 AL (または ! AL) +BL (または! BL)となる。また、加算器 623は、加算過程におけるキャリー アウト CO_0を出力選択部 630へ出力する。
[0049] 加算器 624は、最下位ビットへのキャリーインとして 1が入力されており、キャリーィ ンを 1として論理否定算出部 621からの出力と論理否定算出部 622からの出力とを 加算し、加算結果を出力部 626への入力 Xとする。したがって、入力 Xは、 AL (または ! AL) +BL (または! BL) + 1となる。加算器 624におけるキャリーインの 1は、上式 (1)の右辺の + 1に対応している。したがって、加算器 624が例えば AL+! BL+ 1 を演算する場合には、 AL— BLが演算されたことに他ならない(ただし結果が正にな るときに限る)。また、加算器 624は、加算過程におけるキャリーアウト CO— 1を出力 選択部 630へ出力する。
[0050] インバータ 625は、加算器 623の加算結果を反転し、論理否定を出力部 626への 入力 yとする。したがって、入力 yは、 ! (AL (または! AL) +BL (または! BL) )とな る。ここで、例えば AL— BLが演算される場合、結果が負になるときは、絶対値加算 結果として一(AL— BL)が必要となる。このとき、上式(1)を用いて一(AL— BL)を 変形すると、次式(2)のようになる。
- (AL-BL) = - (AL+! BL+ 1)
=— (AL+! BL) - 1
=! (AL+! BD + 1 - 1
=! (AL+! BL) - -- (2)
[0051] つまり、インバータ 625は、一(AL— BL)として、 ! (AL+! BL)もしくは! (! AL
+ BL)を得るために設けられている。出力部 626は、出力選択部 630からの指示に 従って、入力 x、 y、 zのうちいずれか 1つを下位ビットの演算結果 SLとして出力する。
[0052] 出力選択部 630は、上位ビット情報 AH— 0、符号情報、キャリーアウト CO— 0、お よびキャリーアウト CO— 1に基づいて、上位演算部 610における演算結果 SHを出力 部 614への入力 X、 Y、 Ζから選択するとともに、下位演算部 620における演算結果 S Lを出力部 626への入力 x、 y、 zから選択する。具体的には、出力選択部 630は、図 4に示す表に従って、演算結果 SHおよび演算結果 SLを選択する。図 4に示す表に おいて、斜線部分については、 0および 1のいずれでも良いことを示している。
[0053] 図 4におけるキャリーアウト CO— 1は、加算器 624による加算結果の正負を示して いる。すなわち、加算器 624による加算結果が 0以上であれば、加算器 624において 桁上げが発生する、換言すればキャリーアウト CO— 1が 1となり、加算器 624による 加算結果が負であれば、加算器 624において桁上げが発生しない、換言すればキ ャリーアウト CO— 1が 0となる。
[0054] 図 4における上位ビット情報 AH—0は、上位ビット AHが 0であるか否かを示して!/ヽ る。すなわち、浮動小数点数 Aの指数ビットの値と浮動小数点数 Bの指数ビットの値と が等しぐ浮動小数点数 Aの桁数が浮動小数点数 Bの桁数以下であれば、上位ビッ ト AHは 0となり、上位ビット情報 AH— 0は 1となる。一方、浮動小数点数 Aの桁数が 浮動小数点数 Bの桁数を超えていれば、上位ビット AHは 0となることはなぐ上位ビ ット情報 AH— 0は 0となる。 [0055] 図 4におけるキャリーアウト CO— 0は、加算器 623による加算結果に桁上げが発生 する力否かを示している。すなわち、加算器 623において桁上げが発生すれば、キ ャリーアウト CO— 0が 1となり、加算器 623において桁上げが発生しなければ、キヤリ 一アウト CO— 0が 0となる。
[0056] このような図 4においては、 A+B (— A— Bを含む)、— A+B、および A— Bの 3種 類の演算が網羅されている。これらのうち、 A+Bの演算においては、下位ビット ALと 仮数ビット BLの演算にぉ 、て桁上げが発生する力否かによって、上位ビット AHをそ のままにするカゝ桁上げ分の 1を加算するかが決定される。すなわち、下位ビット ALと 仮数ビット BLの加算に桁上げが発生しな 、場合は、上位ビット AHはそのままとなり、 下位ビット ALと仮数ビット BLの加算に桁上げが発生する場合は、上位ビット AHに 1 が加算される。
[0057] また、—A + Bおよび A—Bの演算においては、下位ビット ALと仮数ビット BLの大 小関係および上位ビット AHが 0か否かによって、上位ビット AHをそのままにするか 桁下げ分の— 1を加算するかが決定される。すなわち、下位ビット ALが仮数ビット BL より小さく(ALく BL)、かつ、上位ビット AHが 0ではない場合は、下位ビット ALから 仮数ビット BLが減算される際に上位ビット AHからのボローが発生し、上位ビットに一 1が加算される。また、下位ビット ALが仮数ビット BL以上 (AL≥BL)カゝまたは上位ビ ット AHが 0の場合は、下位ビット ALカゝら仮数ビット BLが減算される際に上位ビット A Hからのボローが発生することはなぐ上位ビット AHはそのままとなる。
[0058] 次いで、図 4に示す表について、より具体的に説明する。
[0059] 図 4に示す表において、浮動小数点数 Aと浮動小数点数 Bが同符号の場合 (すな わち A+Bの場合)、絶対値加算部 600は、通常の加算を行えば良いため、下位ビッ トについては、キャリーインが 0の加算器 623からの加算結果が選択される。すなわち 、下位ビットの演算結果 SLは、出力部 626の入力 zとなる。また、加算器 623による加 算過程で桁上げが発生しなければキャリーアウト CO— 0は 0となり、上位ビットについ ては、 +0演算器 613からの出力が選択される。すなわち、上位ビットの演算結果 SH は、出力部 614の入力 Zとなる。一方、加算器 623による加算過程で桁上げが発生 すればキャリーアウト CO 0は 1となり、上位ビットについては、 + 1演算器 611から の出力が選択される。すなわち、上位ビットの演算結果 SHは、出力部 614の入力 X となる。
[0060] 次に、浮動小数点数 Aが負の値かつ浮動小数点数 Bが正の値である場合 (すなわ ち一 A+Bの場合)、下位ビットについては、 AL + BLが演算されることになる。この とき、浮動小数点数 Aが負であるため、論理否定算出部 621からは下位ビット ALの 論理否定! ALが出力され、加算器 623および加算器 624における演算とインバー タ 625とにより、出力部 626の入力 x、 y、 zは、それぞれ以下の式(3)のようになる。 x=! AL+BL+ 1
y=! (! AL + BL) - (3)
z=! AL + BL
[0061] ここで、加算器 624のキャリーアウト CO— 1が 0の場合、 AL + BLが負であること になり、絶対値加算結果は—(-AL + BL)となる。このため、上式(2)と同様に、 - ( -AL + BL)を次式 (4)のように変形する。
(一 AL + BL) =! (! AL + BL) - -- (4)
[0062] これは、上式(3)における入力 yに等しぐ下位ビットの演算結果 SLは、出力部 626 の入力 yとなる。また、このとき、 AL + BLが負であることから、 AL>BLなる関係が 成立し、上位ビット AH力ものポロ一が発生することはなぐ上位ビットの演算結果 SH は、出力部 614の入力 Zとなる。
[0063] 一方、加算器 624のキャリーアウト CO— 1が 1の場合、 AL + BLが 0以上であるこ とになるが、特に加算器 623のキャリーアウト CO— 0が 0となるケースに着目すると、 加算器 623の加算(上式(3)における z)においては桁上げが発生せず、加算器 624 の加算(上式(3)における X)においては桁上げが発生している。これは、加算器 624 におけるキャリーインの 1が伝播して桁上げが発生していることを意味しているため、 加算器 623における加算結果! AL+BL ( = z)は、すべて 1からなるビット列である ことがわかる。すなわち、下位ビット ALの論理否定! ALと仮数ビット BLとが互いに 論理否定の関係にあることになり、これは下位ビット ALと仮数ビット BLが等しいことを 意味している。このため、下位ビットの演算結果 SL (=— AL + BL)は 0であり、すべ て 1からなる加算器 623の加算結果力インバータ 625によって反転された入力 yが選 択される。このとき、 AL + BLが 0であることから、上位ビット AHからのボローが発 生することはなぐ上位ビットの演算結果 SHは、出力部 614の入力 Zとなる。
[0064] また、加算器 624のキャリーアウト CO— 1が 1かつ加算器 623のキャリーアウト CO —0が 1となるケースでは、 AL + BLが正であることから、 ALく BLなる関係が成立 し、上位ビット AH力 のボローが発生する可能性がある。具体的には、上位ビット A Hが 0でない、すなわち上位ビット情報 AH—0が 0ならば、ボローが発生することにな る。ボローが発生する場合は、 AL+BLが正であっても、実質的には上位ビット A Hからの桁下げによって下位ビット ALの方が仮数ビット BLよりも大きくなり、 -AL + BLが負となる場合の演算と同様になる。したがって、下位ビットの演算結果 SLは、出 力部 626の入力 yとなる。このとき、上位ビット AHからのボローが発生しているため、 上位ビットの演算結果 SHは、出力部 614の入力 Yとなる。
[0065] さらに、上位ビット AHが 0である、すなわち上位ビット情報 AH—0が 1ならば、浮動 小数点数 Aの桁数が浮動小数点数 Bの桁数以下であることを意味しており、ポロ一は 発生しない。ボローが発生しない場合は、 AL + BLが正であることから、単純に BL ALの減算を行えば良い。したがって、下位ビットの演算結果 SLは、出力部 626の 入力 Xとなる。このとき、上位ビット AHからのボローが発生していないため、上位ビット の演算結果 SHは、出力部 614の入力 Zとなる。
[0066] 次に、浮動小数点数 Aが正の値かつ浮動小数点数 Bが負の値である場合 (すなわ ち A—Bの場合)、下位ビットについては、 AL— BLが演算されることになる。このとき 、浮動小数点数 Bが負であるため、論理否定算出部 622からは仮数ビット BLの論理 否定! BLが出力され、加算器 623および加算器 624における演算とインバータ 625 とにより、出力部 626の入力 x、 y、 zは、それぞれ以下の式(5)のようになる。
x=AL+ ! BL+ 1
y= ! (AL+ ! BL) - (5)
z=AL+ ! BL
[0067] ここで、加算器 624のキャリーアウト CO— 1が 1の場合、 AL— BL力 0以上であるこ とになり、単純に AL— BLの減算を行えば良い。したがって、下位ビットの演算結果 S Lは、出力部 626の入力 Xとなる。このとき、 AL— BLが正であることから、 AL>BLな る関係が成立し、上位ビット AH力 のボローが発生することはなぐ上位ビットの演算 結果 SHは、出力部 614の入力 Zとなる。
[0068] 一方、加算器 624のキャリーアウト CO— 1が 0の場合、 AL— BLが負であることから 、 ALく BLなる関係が成立し、上位ビット AHからのボローが発生する可能性がある。 具体的には、上位ビット AHが 0でな ヽ、すなわち上位ビット情報 AH—0が 0ならば、 ボローが発生することになる。ボローが発生する場合は、 AL— BLが負であっても、 実質的には上位ビット AHからの桁下げによって下位ビット ALの方が仮数ビット BLよ りも大きくなり、 AL— BLが 0以上の場合の演算と同様になる。したがって、下位ビット の演算結果 SLは、出力部 626の入力 Xとなる。このとき、上位ビット AHからのボロー が発生しているため、上位ビットの演算結果 SHは、出力部 614の入力 Yとなる。
[0069] さらに、上位ビット AHが 0である、すなわち上位ビット情報 AH—0が 1ならば、浮動 小数点数 Aの桁数が浮動小数点数 Bの桁数以下であることを意味しており、ポロ一は 発生しない。ボローが発生しない場合は、 AL— BLが負であることから、絶対値加算 結果は—(AL— BL)となる。これは、上式(2)によって、上式(5)における入力 yに等 しいことがわかり、下位ビットの演算結果 SLは、出力部 626の入力 yとなる。また、こ のとき、上位ビット AH力ものポロ一が発生していないため、上位ビットの演算結果 SH は、出力部 614の入力 Zとなる。
[0070] このように、出力選択部 630が図 4に示す表に従って、出力部 614からの演算結果 SHおよび出力部 626からの演算結果 SLを選択することにより、浮動小数点数 Aおよ び浮動小数点数 Bの絶対値加算結果が得られることになる。このとき、上位ビット AH に関する演算を下位ビット ALおよび仮数ビット BLに関する演算と分けたことにより、 下位演算部 620における加算器 623および加算器 624は、下位ビット ALおよび仮 数ビット BLのビット幅に対応したもので十分であるとともに、上位ビット AHに関して 0 と加算するために設けられていた回路を削減することができる。カロえて、本実施の形 態において上位ビット AHの演算に関して付加される回路は、非常に簡易な構成で あるため、絶対値加算部 600の回路規模を削減することができる。
[0071] また、上位ビット AHについては、あら力じめ桁上げが発生する場合、桁下げが発 生する場合、および桁上げおよび桁下げのいずれも発生しない場合に関する演算を 行っておき、下位演算部 620による演算の過程で適切な上位ビットの演算結果 SHを 選択する。このため、下位演算部 620による下位ビット ALおよび仮数ビット BLの演 算が終了すれば、改めて上位ビット AHに関する演算を行う必要がなぐ実質的には 浮動小数点数 Aの仮数ビットよりも小さいビット幅の演算に要する時間だけで浮動小 数点数 Aの仮数ビットおよび浮動小数点数 Bの仮数ビットの絶対値加算が完了する。
[0072] 以上のように、本実施の形態によれば、ビット幅が異なる 2つの数の演算を行う場合 に、ビット幅が大きい数を上位ビットと下位ビットに分割し、上位ビットについては、下 位ビットの演算力もの桁上げおよび桁下げを想定した演算をあら力じめ行っておき、 下位ビットに関する演算の過程で適切な上位ビットの演算結果を選択する。このため 、下位ビットの演算に要する時間のみで演算が完了し、さらなる処理時間の短縮を図 ることができるとともに、上位ビットに関する加算を行うための回路が不要となり、回路 規模を削減することができる。
産業上の利用可能性
[0073] 本発明は、ビット幅が異なる 2つの数の演算を行う場合に、さらなる処理時間の短縮 を図り、回路規模を削減する場合に適用することができる。

Claims

請求の範囲
[1] 所定のビット幅の第 1ビット列と第 1ビット列よりもビット幅が大きい第 2ビット列との絶 対値加算を行う演算処理装置であって、
第 2ビット列を第 1ビット列と等しいビット幅の下位ビット部分と下位ビット部分よりも上 位の上位ビット部分とに分割する分割手段と、
前記分割手段によって分割されて得られた上位ビット部分に対する桁上げおよび 桁下げの演算を行う第 1演算手段と、
前記分割手段によって分割されて得られた下位ビット部分と第 1ビット列の絶対値 加算を行う第 2演算手段と、
前記上位ビット部分に関する情報、第 1ビット列および第 2ビット列の符号情報、なら びに前記第 2演算手段による絶対値加算の中間結果に応じて、前記第 1演算手段の 出力を桁上げ演算結果、桁下げ演算結果、または前記上位ビット部分そのものから 選択する選択手段と
を有することを特徴とする演算処理装置。
[2] 前記選択手段は、
前記上位ビット部分が 0である力否かに応じて前記第 1演算手段の出力を選択する ことを特徴とする請求項 1記載の演算処理装置。
[3] 前記選択手段は、
第 1ビット列および第 2ビット列の符号が同符号である場合に、前記桁上げ演算結 果または前記上位ビット部分そのものを選択することを特徴とする請求項 1記載の演 算処理装置。
[4] 前記選択手段は、
前記第 2演算手段による絶対値加算において桁上げが発生した場合に前記桁上 げ演算結果を選択する一方、前記第 2演算手段による絶対値加算において桁上げ が発生しない場合に前記上位ビット部分そのものを選択することを特徴とする請求項 3記載の演算処理装置。
[5] 前記選択手段は、
第 1ビット列および第 2ビット列の符号が異符号である場合に、前記桁下げ演算結 果または前記上位ビット部分そのものを選択することを特徴とする請求項 1記載の演 算処理装置。
[6] 前記選択手段は、
前記上位ビット部分が 0である場合に、前記上位ビット部分そのものを選択すること を特徴とする請求項 5記載の演算処理装置。
[7] 前記選択手段は、
前記上位ビット部分が 0ではなくかつ前記下位ビット部分が前記第 1ビット列未満で ある場合に、前記桁下げ演算結果を選択することを特徴とする請求項 5記載の演算 処理装置。
[8] 前記選択手段は、
前記下位ビット部分が前記第 1ビット列以上である場合に、前記上位ビット部分その ものを選択することを特徴とする請求項 5記載の演算処理装置。
[9] 前記第 1演算手段は、
前記上位ビット部分に桁上げに相当する 1を加える第 1演算器と、
前記上位ビット部分から桁下げに相当する 1を減じる第 2演算器と、
前記上位ビット部分に 0を加える第 3演算器と、
前記選択手段の選択に従って、前記第 1演算器、前記第 2演算器、および前記第 3 演算器のいずれかの演算結果を出力する出力手段と
を含むことを特徴とする請求項 1記載の演算処理装置。
[10] 所定のビット幅の第 1ビット列と第 1ビット列よりもビット幅が大きい第 2ビット列との絶 対値加算を行う演算処理方法であって、
第 2ビット列を第 1ビット列と等しいビット幅の下位ビット部分と下位ビット部分よりも上 位の上位ビット部分とに分割する分割工程と、
前記分割工程にて分割されて得られた上位ビット部分に対する桁上げおよび桁下 げの演算を行う第 1演算工程と、
前記分割工程にて分割されて得られた下位ビット部分と第 1ビット列の絶対値加算 を行う第 2演算工程と、
前記上位ビット部分に関する情報、第 1ビット列および第 2ビット列の符号情報、なら びに前記第 2演算工程における絶対値加算の中間結果に応じて、前記第 1演算ェ 程の結果を桁上げ演算結果、桁下げ演算結果、または前記上位ビット部分そのもの から選択する選択工程と
を有することを特徴とする演算処理方法。
PCT/JP2006/303441 2006-02-24 2006-02-24 演算処理装置および演算処理方法 WO2007096982A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2008501539A JP4500358B2 (ja) 2006-02-24 2006-02-24 演算処理装置および演算処理方法
PCT/JP2006/303441 WO2007096982A1 (ja) 2006-02-24 2006-02-24 演算処理装置および演算処理方法
US12/230,029 US8549054B2 (en) 2006-02-24 2008-08-21 Arithmetic processing apparatus and arithmetic processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2006/303441 WO2007096982A1 (ja) 2006-02-24 2006-02-24 演算処理装置および演算処理方法

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US12/230,029 Continuation US8549054B2 (en) 2006-02-24 2008-08-21 Arithmetic processing apparatus and arithmetic processing method

Publications (1)

Publication Number Publication Date
WO2007096982A1 true WO2007096982A1 (ja) 2007-08-30

Family

ID=38437044

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2006/303441 WO2007096982A1 (ja) 2006-02-24 2006-02-24 演算処理装置および演算処理方法

Country Status (3)

Country Link
US (1) US8549054B2 (ja)
JP (1) JP4500358B2 (ja)
WO (1) WO2007096982A1 (ja)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013190690A1 (ja) * 2012-06-21 2013-12-27 三菱電機株式会社 符号化装置、復号装置、符号化方法、符号化プログラム、復号方法および復号プログラム
CN105045558A (zh) * 2015-09-07 2015-11-11 浪潮(北京)电子信息产业有限公司 一种反码加法器

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010271091A (ja) 2009-05-20 2010-12-02 Seiko Epson Corp 周波数測定装置
JP5517033B2 (ja) 2009-05-22 2014-06-11 セイコーエプソン株式会社 周波数測定装置
JP5440999B2 (ja) * 2009-05-22 2014-03-12 セイコーエプソン株式会社 周波数測定装置
JP5582447B2 (ja) 2009-08-27 2014-09-03 セイコーエプソン株式会社 電気回路、同電気回路を備えたセンサーシステム、及び同電気回路を備えたセンサーデバイス
JP5815918B2 (ja) 2009-10-06 2015-11-17 セイコーエプソン株式会社 周波数測定方法、周波数測定装置及び周波数測定装置を備えた装置
JP5876975B2 (ja) 2009-10-08 2016-03-02 セイコーエプソン株式会社 周波数測定装置及び周波数測定装置における変速分周信号の生成方法
JP5883558B2 (ja) 2010-08-31 2016-03-15 セイコーエプソン株式会社 周波数測定装置及び電子機器
JP2012221188A (ja) * 2011-04-08 2012-11-12 Fujitsu Ltd 演算回路、演算処理装置、及び演算回路の制御方法
US10489152B2 (en) * 2016-01-28 2019-11-26 International Business Machines Corporation Stochastic rounding floating-point add instruction using entropy from a register
US10671347B2 (en) 2016-01-28 2020-06-02 International Business Machines Corporation Stochastic rounding floating-point multiply instruction using entropy from a register
JP7177000B2 (ja) * 2019-05-16 2022-11-22 日立Astemo株式会社 演算装置および演算方法

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07508603A (ja) * 1992-05-22 1995-09-21 セイコーエプソン株式会社 絶対値算術演算ユニット及び差動マルチプレクサ

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02310620A (ja) * 1989-05-25 1990-12-26 Fujitsu Ltd 単精度絶対値加減算方式
JPH038018A (ja) * 1989-06-06 1991-01-16 Toshiba Corp 符号付き絶対値加減算器
US5867413A (en) * 1995-10-17 1999-02-02 Hitachi Micro Systems, Inc. Fast method of floating-point multiplication and accumulation
US6061707A (en) * 1998-01-16 2000-05-09 International Business Machines Corporation Method and apparatus for generating an end-around carry in a floating-point pipeline within a computer system
JP2000155671A (ja) * 1998-11-24 2000-06-06 Mitsubishi Electric Corp 浮動小数点演算装置
JP3845009B2 (ja) * 2001-12-28 2006-11-15 富士通株式会社 積和演算装置、及び積和演算方法
US7490119B2 (en) * 2003-12-11 2009-02-10 International Business Machines Corporation High speed adder design for a multiply-add based floating point unit

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07508603A (ja) * 1992-05-22 1995-09-21 セイコーエプソン株式会社 絶対値算術演算ユニット及び差動マルチプレクサ

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013190690A1 (ja) * 2012-06-21 2013-12-27 三菱電機株式会社 符号化装置、復号装置、符号化方法、符号化プログラム、復号方法および復号プログラム
JP5619326B2 (ja) * 2012-06-21 2014-11-05 三菱電機株式会社 符号化装置、復号装置、符号化方法、符号化プログラム、復号方法および復号プログラム
US8947274B2 (en) 2012-06-21 2015-02-03 Mitsubishi Electric Corporation Encoding apparatus, decoding apparatus, encoding method, encoding program, decoding method, and decoding program
CN105045558A (zh) * 2015-09-07 2015-11-11 浪潮(北京)电子信息产业有限公司 一种反码加法器

Also Published As

Publication number Publication date
US20080320065A1 (en) 2008-12-25
JPWO2007096982A1 (ja) 2009-07-09
JP4500358B2 (ja) 2010-07-14
US8549054B2 (en) 2013-10-01

Similar Documents

Publication Publication Date Title
WO2007096982A1 (ja) 演算処理装置および演算処理方法
JP4388543B2 (ja) 3項入力の浮動小数点加減算器
JP3076046B2 (ja) 例外検出回路
US8645449B1 (en) Combined floating point adder and subtractor
JPH09269891A (ja) 部分積加算方法および装置、浮動小数点乗算方法および装置、浮動小数点積和演算方法および装置
US5148386A (en) Adder-subtracter for signed absolute values
JP3845009B2 (ja) 積和演算装置、及び積和演算方法
KR100203468B1 (ko) 부동소수점수를 위한 산술연산장치
JPH04283831A (ja) 除算器
US7437400B2 (en) Data processing apparatus and method for performing floating point addition
JP4858794B2 (ja) 浮動小数点除算器、及びそれを用いた情報処理装置
JP2010238011A (ja) ベクトル乗算処理装置および方法ならびにプログラム
JP4439060B2 (ja) 浮動小数点加算器
JP2020071642A (ja) 演算処理装置及びその制御方法
US7599974B2 (en) Data processing apparatus and method for comparing floating point operands
EP1429239A2 (en) Floating-point multiplication
JP2752564B2 (ja) 先行1予測装置及び浮動小数点加減算装置
JP3174974B2 (ja) 浮動小数点演算装置および方法
JP4109181B2 (ja) 論理回路、および、それを使用した浮動小数点演算回路とマイクロプロセッサ
JP5010648B2 (ja) 演算装置及び演算方法
JP5376659B2 (ja) 積和演算装置及び積和演算装置の制御方法
JPH0612224A (ja) 浮動小数点2進数のための演算処理方法およびその装置
JPH07121353A (ja) 浮動小数点加減算装置
JPH0855015A (ja) 浮動小数点数のための算術演算装置
JPH0498524A (ja) 浮動小数点演算装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application
ENP Entry into the national phase

Ref document number: 2008501539

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 06714580

Country of ref document: EP

Kind code of ref document: A1