Floating point adder

Information

  • Patent Application
  • 20020184285
  • Publication Number
    20020184285
  • Date Filed
    June 04, 2001
    23 years ago
  • Date Published
    December 05, 2002
    21 years ago
Abstract
A floating point adder circuit includes an exponent path and a mantissa path. The exponent path includes a comparator to compare two three-bit exponents. The two exponents are each incremented, and a resultant exponent is chosen from one of the two original exponents or one of the incremented exponents. The mantissa path includes an adder to add mantissas, and an adder bypass path to select one of the mantissas in lieu of performing an addition. The mantissa path also includes constant shifters that conditionally shift the mantissas right by thirty-two bit positions.
Description


FIELD

[0001] The present invention relates generally to floating point operations, and more specifically to floating point adders.



BACKGROUND

[0002] Fast floating point mathematical operations have become an important feature in modem electronics. Floating point units are useful in applications such as three-dimensional graphics computations and digital signal processing (DSP). Examples of three-dimensional graphics computation include geometry transformations and perspective transformations. These transformations are performed when the motion of objects is determined by calculating physical equations in response to interactive events instead of replaying prerecorded data.


[0003] Many DSP operations, such as finite impulse response (FIR) filters, frequently compute Σ(ai bi), where i=0 to n−1, and ai and bi are both single precision floating point numbers. This type of computation benefits from floating point adders that operate at high frequencies and at low power. Design of fast, low power, floating point adders can be difficult, in part because they typically include circuits for alignment, mantissa addition, normalization, rounding, and other complex operations.


[0004] The Institute of Electrical and Electronic Engineers (IEEE) has published an industry standard for floating point operations in the ANSI/IEEE Std 754-1985, IEEE Standardfor Binary Floating-Point Arithmetic, IEEE, New York, 1985, hereinafter referred to as the “IEEE standard.” Floating-point numbers are represented as a concatenation of a sign bit, an exponent field, and a significant field (also referred to as the mantissa). In the IEEE single precision floating-point format, the most significant bit (integer bit) of the mantissa is not represented. The most significant bit of the mantissa has an assumed value of 1, except for denormal numbers, whose most significant bit of the mantissa is 0. A single precision floating point number as specified by the IEEE standard has a 23 bit mantissa field, an eight bit exponent field, and a one bit sign field.


[0005] For all examples in this description, floating point adders compute the sum C, of two floating point operands, A and B. The floating point numbers A, B, and C have mantissas Ma, Mb, and Mc, exponents Ea, Eb, and Ec, and signs Sa, Sb, and Sc, respectively.


[0006] A typical implementation for a floating point adder compliant with the IEEE standard is shown in FIG. 1. Small arithmetic logic unit (ALU) 110 of adder 100 compares the exponents Ea and Eb of floating point numbers A and B to determine which is smaller and by how much, and provides the exponent difference 112 to control unit 114. In response to the exponent difference, control unit 114 selects the larger exponent using multiplexor 122, selects the mantissa of the smaller number using multiplexor 116, and selects the mantissa of the larger number using multiplexor 118. Control unit 114 also controls shifter 120 to cause the mantissa of the smaller number to be shifted right so that it aligns with the mantissa of the larger number. The aligned mantissas are then summed using ALU 124. Normalization is performed using blocks 126 and 128, and rounding is performed by rounding hardware 130.


[0007]
FIG. 2 shows a flowchart of a method carried out by the hardware in FIG. 1. First, in block 210, the exponents of the two numbers are compared and the mantissa of the smaller number is shifted to the right until its exponent would match the exponent of the larger number. This corresponds to the operation of ALU 110, control unit 114, and shifter 120. In block 220, the mantissas are summed. This corresponds to the operation of ALU 124. Blocks 230 and 250 perform normalizing and rounding, and block 260 forms a loop to allow renormalization if rounding has caused the number to become denormalized. The floating point adder and method of FIGS. 1 and 2 are discussed further in David A. Patterson & John L. Hennessy, “Computer Organization and Design: The Hardware/Software Interface,” 275-300 (Morgan Kaufinann Publishers, 2d ed. 1998).


[0008] The comparison performed by small ALU 110 (FIG. 1) can be expensive in terms of execution time, in part because at least one subtraction is performed to determine the difference between the exponent values. In addition, the shift performed by right shifter 120 can be expensive in terms of time because a variable shift of zero to twenty-three bits is performed after the exponent difference is calculated. Although these problems have been illustrated in a single precision floating point operation compliant with the IEEE standard, one skilled in the art will appreciate that similar problems exist with extended precision floating point operations and with operations not compliant with the IEEE standard.


[0009] For the reasons stated above, and for other reasons stated below which will become apparent to those skilled in the art upon reading and understanding the present specification, there is a need in the art for efficient floating point addition operations.







BRIEF DESCRIPTION OF THE DRAWINGS

[0010]
FIG. 1 shows a prior art floating point adder circuit;


[0011]
FIG. 2 shows a prior art method for a floating point adder circuit;


[0012]
FIG. 3 shows a base 32 floating point number representation;


[0013]
FIG. 4 shows an integrated circuit with a floating point adder;


[0014]
FIG. 5 shows an exponent path of a floating point adder; and


[0015]
FIG. 6 shows a mantissa path of a floating point adder.







[0016] DESCRIPTION OF EMBODIMENTS


[0017] In the following detailed description of the embodiments, reference is made to the accompanying drawings which show, by way of illustration, specific embodiments in which the invention may be practiced. In the drawings, like numerals describe substantially similar components throughout the several views. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention. Other embodiments may be utilized and structural, logical, and electrical changes may be made without departing from the scope of the present invention. Moreover, it is to be understood that the various embodiments of the invention, although different, are not necessarily mutually exclusive. For example, a particular feature, structure, or characteristic described in one embodiment may be included within other embodiments. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims, along with the full scope of equivalents to which such claims are entitled.


[0018] The method and apparatus of the present invention perform a floating point addition by converting an IEEE standard single precision floating point number to a base 32 number. The use of converted numbers obviates the need for an eight bit subtractor in the exponent path and also obviates the need for a variable shifter in the mantissa path. The exponent path includes a comparator to compare three bit exponent values, and the mantissa path includes a constant shifter.


[0019]
FIG. 3 shows base 2 and base 32 floating point number representations. Base 2 floating point number representation 310 includes sign bit 312, eight bit exponent field 314, and twenty-three bit mantissa field 316. Base 2 floating point number representation is in the IEEE standard single precision format. Base 32 floating point number 320 includes a sign bit 322, a three bit exponent field 324, and a fifty-four bit mantissa field 326. Some embodiments of the present invention convert floating point numbers in representation 310 to and from floating point numbers in representation 320. This is performed by evaluating the least significant five bits of exponent 314 to obtain a mantissa shift value, and shifting mantissa 316 to the right by the number of bit positions equal to the mantissa shift value. Because five bits of exponent are evaluated, the mantissa shift value can be a number between zero and thirty-one. Mantissa field 326 holds the shifted mantissa without loss of precision, because the maximum size of the twenty three bit mantissa shifted by thirty-one yields a fifty-four bit mantissa.


[0020] The least significant five bits of the exponent 314 are then truncated, and exponent 324 is equal to the most significant three bits of exponent 314. The least significant bit of exponent 324 has a “weight” of thirty-two. In other words, a least significant change in exponent 324 corresponds to a mantissa shift of thirty-two bits. For this reason, floating point representation 320 is dubbed a “base 32” floating point representation.


[0021] The remainder of this description provides details of embodiments that add floating point numbers in base 32 format. Other embodiments of the present invention add floating point numbers in formats other than base 32. For example, in some embodiments, floating point numbers in a “base 16” format that have an exponent field with a least significant bit weight of sixteen are summed. In other embodiments, floating point numbers with exponent fields having least significant bit weights of other than thirty two or sixteen are summed. In general, embodiments of the present invention exist for floating point representions having least significant bit weights of other than one.


[0022] Extended precision embodiments also exist. For example, in the embodiment of FIG. 3, an IEEE standard single precision floating point number with an eight bit exponent field is converted to a base 32 format floating point number with a three bit exponent field. In other embodiments, extended precision floating point numbers can be converted into base 32 format. In some of these embodiments, the exponent field of the base 32 format number is larger than three, and the mantissa field is larger than fifty-four.


[0023]
FIG. 4 shows an integrated circuit with a floating point adder. Integrated circuit 400 includes floating point conversion blocks 402, 406, and 462, exponent path 440, and mantissa path 450. Exponent path 440 and mantissa path 450 are floating point adder paths, and together form a floating point adder circuit. Exponent path 440 and mantissa path 450 are shown in more detail in FIGS. 5 and 6. Also shown in FIG. 4 are floating point numbers 410, 420, and 460. For clarity, floating point numbers 410, 420, and 460 are shown separately from the floating point conversion blocks and adder paths. In some embodiments, registers exist where floating point numbers 410, 420, and 460 are shown, and in other embodiments, the floating point numbers are not held in registers, but instead are received by the adder paths directly from other circuits.


[0024] In some embodiments, floating point conversion blocks 402 and 406 convert floating point numbers from IEEE standard single precision floating point format to a base 32 format. For example, in some embodiments, floating point conversion block 402 converts floating point number “A” from IEEE standard single precision format on node 404 to a base 32 floating point representation at 410. Also for example, in some embodiments, floating point conversion block 406 converts floating point number “B” from IEEE standard single precision floating point format on node 408 to a base 32 floating point representation at 420. Referring now back to FIG. 3, in some embodiments, numbers on nodes 404 and 408 are represented using floating point representation 310, and numbers at 410 and 420 are represented using floating point representation 320.


[0025] In some embodiments, floating point conversion blocks 402 and 406 convert numbers from other floating point representations to base 32 format. For example, in some embodiments, floating point converters 402 and 406 convert integers into floating point numbers. In other embodiments, floating point conversion blocks 402 and 406 convert floating point numbers in formats other than IEEE standard formats into base 32 format. In still other embodiments, floating point conversion blocks 402 and 406 are omitted. In some of these embodiments, floating point numbers throughout integrated circuit 400 are represented in base 32 format.


[0026] Floating point conversion block 462 converts floating point number “C” from base 32 representation at 460 into a format other than base 32 format on node 470. In some embodiments, floating point conversion block 462 converts the floating point number at 460 to an IEEE standard single precision number on node 470. In other embodiments, floating point conversion block 460 converts the number to a format other than an IEEE standard format. In general, floating point conversion block 462 operates in reverse of floating point conversion blocks 402 and 406. As previously described, in some embodiments, floating point conversion block 462 is omitted.


[0027] Floating point number 410 includes a single sign bit (S), a three bit exponent field (Ea), and a 54 bit mantissa field (Ma). Likewise, floating point number 420 includes a single sign bit (Sb), a three bit exponent field (Eb), and a fifty-four bit mantissa field (Mb). Exponent path 440 receives exponents Ea and Eb on nodes 412 and 422, respectively, and produces resultant exponent Ec on node 442. Exponent path 440 also produces five digital signals 441. Digital signals 441 carry information from exponent path 440 to mantissa path 450 to signify whether the two exponents are equal (Ea=Eb), whether one exponent is greater than the other (Ea>Eb, Ea<Eb), and whether one exponent is one greater than the other (Ea=Eb+1, Eb=Ea+1). Because floating point numbers 410 and 420 are in base 32 format, an exponent that differs by a least significant bit differs by a “weight” of thirty-two. Therefore, while exponent path 440 detects a physical difference of one, a logical difference of thirty-two is detected. Exponent path 440 also receives an overflow signal (OVF) from mantissa path 450 on node 443.


[0028] Mantissa path 450 receives mantissa fields Ma and Mb on nodes 414 and 424, respectively, and produces resultant mantissa field Mc on node 454. Mantissa path 450 also receives digital signals 441 from exponent path 440, and produces the overflow signal (OVF) and sends it to exponent path 440. The OVF signal is asserted when a mantissa overflow condition has occurred. The floating point adder paths and the signals therebetween are described in more detail below.


[0029]
FIG. 5 shows an exponent path of a floating point adder. Exponent path 440 includes multiplexors 502, 504, and 506, comparator 520, incrementers 512 and 514, and logic 510. Incrementers 512 and 514 pre-increment Ea and Eb to produce an incremented Ea and an incremented Eb, respectively. When either exponent Ea or Eb is incremented, the weight of the exponent is changed by thirty-two with respect to the mantissa. Accordingly, incrementers 512 and 514 are shown in FIG. 5 with the label “+32.”


[0030] In operation, comparator 520 compares exponents Ea and Eb, and generates logic outputs as shown in FIG. 5. When Ea is greater than Eb, the (Ea>Eb) signal controls multiplexors 502 and 504 to select Ea and the incremented Ea, respectively. Otherwise, multiplexors 502 and 504 select Eb and the incremented Eb, respectively. Multiplexor 506 selects either the exponent on node 505 or the incremented exponent on node 507 based on the overflow trigger (OFT) signal on node 511. OFT is asserted only if the OVF signal is asserted and the two three-bit input exponents are either equal or differ by one. Logic 510 receives OVF from the mantissa path and logic outputs from comparator 520, and produces the OFT signal according to the following equation:




OFT=OVF
AND ((Ea=Eb) OR (Ea=Eb+1) OR (Eb=Ea+1)).



[0031] When OFT is true, the resultant exponent Ec is chosen as the incremented exponent on node 507, and when OFT is false, the resultant exponent is chosen as the greater exponent on node 505.


[0032] Comparator 520 compares three bit exponents and produces a plurality of outputs that are logic functions of the inputs. Each logic output is a function six input bits: three bits from Ea, and three bits from Eb. This provides a very quick logic path as compared to the prior art discussed with reference to FIG. 1, above. In addition to the quick comparison made in the exponent path, the mantissa path includes constant shifters that conditionally shift mantissas by a fixed amount. The combination of a quick exponent comparison in the exponent path and a quick shift in the mantissa path provide for a fast floating point adder circuit. The constant shifter is described in more detail below with reference to FIG. 6.


[0033]
FIG. 6 shows a mantissa path of a floating point adder. Mantissa path 450 includes constant shifters 602, 604, and 606, adder circuit 610, multiplexors 612 and 614, and logic 616. The expensive variable shifters used in prior art adder circuits such as that of FIG. 1 are replaced in the present invention with constant shifters 602, 604, and 606. This simplification saves on the amount of hardware necessary to implement the adder, and also decreases execution time. In some embodiments, constant shifters 602, 604, and 606 are implemented as a series of two-input multiplexors.


[0034] Constant shifters 602 and 604 conditionally shift mantissas by an amount equal to the weight of the least significant bit of the exponent fields in the exponent path. For example, in base 32 embodiments as shown in the figures, the least significant bits of the exponents have a weight of thirty-two, and constant shifters 602 and 604 each conditionally shift a mantissa thirty-two bit positions to the right. Likewise, in base 16 embodiments, the least significant bits of the exponents have a weight of sixteen, and constant shifters 602 and 604 each conditionally shift a mantissa sixteen bit positions to the right. In general, constant shifters 602 and 604 can have any constant shift amount.


[0035] Mantissa path 450 receives mantissa Ma on node 414 and mantissa Mb on node 424. In embodiments represented by FIG. 6, constant shifter 604 shifts Mb thirty-two bit positions to the right when Ea is greater than Eb, and constant shifter 602 shifts Ma thirty-two bit positions to the right when Eb is greater than Ea. When Ea is equal to Eb, then neither mantissa is shifted in mantissa path 450. After constant shifters 602 and 604, mantissa path 450 separates into two sub-paths: the integer adder path and the bypass path. The integer adder path includes adder 610 and constant shifter 606, while the bypass path includes multiplexor 612.


[0036] Adder circuit 610 adds the two mantissas on nodes 620 and 622, and produces the result on node 624. If an overflow occurs in adder circuit 610, the OVF signal is asserted and constant shifter 606 shifts the mantissa produced by adder circuit 610 thirty-two bit positions to the right. The OVF signal is sent to exponent path 440 to conditionally select an incremented exponent, as described above with reference to FIG. 5. In some embodiments, adder circuit 610 is a conventional binary adder suitable to add two binary words. In other embodiments, adder circuit 610 is implemented using full adders arranged as three-to-two (3:2) compressors and four-to-two (4:2) compressors. For a discussion of compressors, see Neil H. E. Weste & Kamran Eshragihan, “Principles of CMOS VLSI Design: A Systems Perspective,” 2nd Ed., pp. 554-558 (Addison Wesley Publishing 1993).


[0037] In some embodiments, adder circuit 610 can be powered down when not in use. For example, when the resultant exponent on node 454 is chosen from the bypass path rather than the integer adder path, adder circuit 610 can be shut down to save power. In the embodiment of FIG. 6, adder circuit 610 can be powered down by asserting the PWRDN signal on node 650.


[0038] Multiplexor 612, like adder circuit 610, receives exponents on nodes 620 and 622. Unlike adder circuit 610, however, multiplexor 612 selects one of the inputs rather than adding them. Multiplexor 612 selects the mantissa that corresponds to the larger floating point number. For example, when Ea is greater than Eb, multiplexor 612 selects Ea. Also for example, when Eb is greater than Ea, multiplexor 612 selects Eb. Multiplexor 612 drives node 613 with the selected exponent.


[0039] Multiplexor 614 selects the resultant mantissa Mc from the integer adder path when the input exponents are equal or differ by one, and selects the resultant mantissa Mc from the bypass path when the input exponents differ by more than one. When the input exponents differ by more than one, a shift of sixty-four or more would be needed to align the mantissas for addition, and the mantissas in the embodiment of FIG. 6 are only fifty-four bits long.


[0040] The outputs from mantissa path 450 (FIG. 6) and exponent path 440 (FIG. 5) are normalized and converted to a standard floating point representation. For example, in embodiments that utilize IEEE standard single precision floating point number representations, the outputs from mantissa path 450 and exponent path 440 are normalized and converted to a IEEE standard single precision floating point number.


[0041] The method an apparatus of the present invention provide for a fast and efficient floating point addition operation. Floating point numbers are represented in formats with relatively small exponent fields to allow for quick comparisons in the exponent path. Mantissa fields are expanded so precision can be maintained with smaller exponents. Furthermore, the method and apparatus of the present invention can provide precision comparable to the precision available using prior art double precision arithmetic units, in part because the mantissa fields are expanded. In some embodiments the floating point representation used is a base 32 format with a three bit exponent and a fifty-four bit mantissa. In these embodiments, the three bit exponent fields can be quickly compared, and a shift of thirty-two bits in the mantissa path can be carried out by a constant shifter.


[0042] It is to be understood that the above description is intended to be illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reading and understanding the above description. The scope of the invention should, therefore, be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.

Claims
  • 1. A floating point adder circuit comprising: an exponent path to compare exponents having least significant bits with a weight of other than one; and a mantissa path having a shifter to shift a mantissa responsive to the exponent path.
  • 2. The floating point adder circuit of claim 1 wherein the exponent path includes a comparator comprising: a first input node to accept a first exponent; a second input node to accept a second exponent; and a plurality of output nodes to signify if the first exponent is larger, smaller, or equal to the second exponent.
  • 3. The floating point adder of claim 2 wherein the first and second input nodes are configured to accept three bit exponents.
  • 4. The floating point adder of claim 3 wherein the three bit exponents have least significant bits with a weight of thirty-two.
  • 5. The floating point adder circuit of claim 4 wherein the mantissa path comprises a constant shifter to conditionally shift a mantissa by thirty-two bits.
  • 6. The floating point adder circuit of claim 5 wherein the constant shifter comprises a multiplexor.
  • 7. The floating point adder circuit of claim 1 wherein the mantissa path comprises a constant shifter to conditionally shift a mantissa by an amount equal to the weight of the least significant bits of the exponents.
  • 8. The floating point adder circuit of claim 7 wherein the mantissa path comprises an adder circuit for adding a non-shifted mantissa and the mantissa shifted by an amount equal to the weight of the least significant bits of the exponents.
  • 9. The floating point adder circuit of claim 8 wherein the least significant bits of the exponents have a weight of thirty-two.
  • 10. The floating point adder circuit of claim 9 wherein the constant shifter comprises a multiplexor.
  • 11. The floating point adder circuit of claim 1 wherein the exponent path includes a comparator to compare three bit exponents of two floating point numbers, and the mantissa path includes a constant shifter to conditionally shift a mantissa of one of the two floating point numbers by thirty-two bits.
  • 12. The floating point adder circuit of claim 11 wherein the mantissa path further includes: an adder to add mantissas of the two floating point numbers; and a multiplexor in parallel with the adder to conditionally select one of the mantissas to be a resultant mantissa.
  • 13. The floating point adder of claim 12 wherein the adder is configured to be powered down when not in use.
  • 14. The floating point adder circuit of claim 11 wherein the two floating point numbers include fifty-four bit mantissas.
  • 15. An integrated circuit comprising: a comparator to compare two floating point exponents of less than eight bits; and a constant shifter to shift a mantissa corresponding to one of the two floating point exponents by a number of bit positions equal to a weight of a least significant bit of the two floating point exponents.
  • 16. The integrated circuit of claim 15 wherein the comparator is configured to compare two three-bit exponents.
  • 17. The integrated circuit of claim 15 wherein the weight of the least significant bit of the two floating point exponents is equal to thirty-two.
  • 18. The integrated circuit of claim 17 wherein the mantissa is fifty-four bits long.
  • 19. The integrated circuit of claim 15 further comprising an adder circuit to sum the mantissa corresponding to one of the two floating point exponents with a mantissa corresponding to a second one of the two floating point exponents.
  • 20. A method of converting a floating point number in a first floating point format to a second floating point format comprising: right shifting a mantissa of the floating point number by a value of the least significant five bits of an exponent of the floating point number; and zeroing the least significant five bits of the exponent of the floating point number.
  • 21. The method of claim 20 wherein the exponent of the first floating point format comprises eight bits, and zeroing comprises truncating the eight bits to produce a three bit exponent for the second floating point format.
  • 22. The method of claim 21 wherein the mantissa of the first floating point format comprises twenty-three bits, and right shifting comprises adding thirty-one least significant bit positions to the mantissa and shifting right between zero and thirty-one bit positions.
  • 23. A method of floating point addition comprising: comparing an exponent of a first floating point number to an exponent of a second floating point number; conditionally shifting right by a fixed amount the mantissa of the floating point number having a smaller exponent; selecting the larger exponent as a resultant exponent; and producing a resultant mantissa from a mantissa of the first floating point number and a mantissa of the second floating point number.
  • 24. The method of claim 23 wherein conditionally shifting right comprises selecting one of two inputs of a multiplexor.
  • 25. The method of claim 23 wherein producing a resultant mantissa comprises selecting the mantissa of the first floating point number if the exponent of the first floating point number is more than one greater than the exponent of the second floating point number.
  • 26. The method of claim 23 wherein producing a resultant mantissa comprises adding mantissas of the first and second floating point numbers to produce a resultant mantissa.
  • 27. The method of claim 23 wherein conditionally shifting right comprises: when the exponent of the first floating point number is one greater than the exponent of the second floating point number, shifting a mantissa of the second floating point number thirty-two bit positions to the right.