Methods and systems for performing floating-point operations

The method optimizes floating-point operations by selecting addends based on absolute values and normalizing results within the floating-point adder, addressing the inefficiencies of conventional designs and achieving reduced circuit area and improved performance.

WO2024228703A1PCT designated stage expired Publication Date: 2024-11-07GREATER SHINE LTD

Patent Information

Application Number
PCT/US2023/020802
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-05-03
Publication Date
2024-11-07

AI Technical Summary

Technical Problem

Conventional floating-point adder designs are inadequate in reducing the critical path while minimizing the area of integrated circuits, especially when supporting normal and denormal formats without special values like NaN and Inf, leading to signal-to-noise degradation and increased circuit area.

Method used

A method and system for performing floating-point operations by selecting two floating-point numbers as left and right addends based on their absolute values, performing addition or subtraction, and normalizing the result, which includes shifting, rounding, and handling overflow/underflow detection in parallel data paths to optimize circuit design and reduce critical path length.

Benefits of technology

The solution enables a high-performance floating-point adder that reduces circuit area and critical path length, supports normal and denormal formats without special values, and improves overall system performance by minimizing power consumption and resource usage, especially beneficial for real-time processing and low-bit-width applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US2023020802_07112024_PF_FP_ABST
    Figure US2023020802_07112024_PF_FP_ABST
Patent Text Reader

Abstract

The present invention is directed to performing floating-point operations using integrated circuits. In specific embodiments, two floating-point numbers are selected as a left addend and a right addend based on their absolute values. An addition operation or a subtraction operation is performed between the left addend and the right addend, and the result is normalized to provide an output. There are other embodiments as well.
Need to check novelty before this filing date? Find Prior Art

Description

METHODS AND SYSTEMS FOR PERFORMING FLOATING-POINT OPERATIONSBACKGROUND OF THE INVENTION

[0001] The present invention is directed to performing floating-point operations using integrated circuits.

[0002] Floating-point calculations are useful in many applications and are frequently performed. A floating-point adder is a digital circuit that performs addition on numbers represented in floating point format. Floating point representation is a way of encoding real numbers in a computer, allowing for a large range of values to be represented with a fixed number of bits. It is commonly used in scientific and engineering applications, where the ability to represent a wide range of values is important. Many different approaches have been proposed, each with its own trade-offs in terms of accuracy, speed, and power consumption. As computer technology has continued to evolve, so have the design and implementation of floating-point adders, with the goal of improving performance and efficiency. Over the past, various conventional techniques have been developed for floating point operations. Unfortunately, they are inadequate for the reasons explained below.

[0003] Therefore, new and improved floating-point adder designs are desired for providing benefits in reducing the critical path while minimizing the area increase of integrated circuits.BRIEF SUMMARY OF THE INVENTION

[0004] The present invention is directed to performing floating-point operations using integrated circuits. In specific embodiments, two floating-point numbers are selected as a left addend and a right addend based on their absolute values. An addition operation or a subtraction operation is performed between the left magnitude and the right magnitude, and the result is normalized to provide an output. There are other embodiments as well.

[0005] A system of one or more computers can be configured to perform particular operations or actions by virtue of having software, firmware, hardware, or a combination of them installed on the system that in operation causes or cause the system to perform the actions. One or more computer programs can be configured to perform particular operations or actions by virtue of including instructions that, when executed by data processingapparatus, cause the apparatus to perform the actions. One general aspect of the present disclosure includes a method for performing floating-point operations on an integrated circuit. The method also includes receiving a first floating-point number that may include a first sign and a first exponent and a first mantissa, the first floating-point number conforming to a first mantissa width of F bits. The method also includes storing the first floating-point number. The method also includes receiving a second floating-point number that may include a second sign and a second exponent and a second mantissa. The method also includes storing the second floating-point number. The method also includes calculating a first absolute value of the first floating-point number. The method also includes calculating a second absolute value of the second floating-point number. The method also includes designating a left addend and a right addend by selecting between the first absolute value and the second absolute value such that an absolute value of the left addend is larger than or equal to an absolute value of the right addend, the left addend including a left sign, a left exponent, and a left mantissa, the right addend including a right sign, a right exponent, and a right mantissa. The method also includes shifting the right mantissa to match the right exponent to the left exponent and to obtain a shift right value. The method also includes selecting between an addition operation and a subtraction operation based the first sign and the second sign, the addition operation being based on the first sign and the second sign being same signs, the subtraction operation being based on the first sign and the second sign being opposite signs. The method also includes obtaining an intermediate data by performing the addition operation or the subtraction operation between the left mantissa and the right mantissa, the intermediate data may include a result value and the shift out value, the result value may include at least F+2 bits. The method also includes obtaining an output data by normalizing using the intermediate data. Other embodiments of this aspect include corresponding computer systems, apparatus, and computer programs recorded on one or more computer storage devices, each configured to perform the actions of the methods.

[0006] Implementations may include one or more of the following features. The method may include performing mantissa right shift of the intermediate data by one for a carry after performing the addition operation or a no shift otherwise. The subtraction operation is performed by adding a two’s compliment of the right mantissa. The normalizing the intermediate data corresponding to the addition operation may include rounding off a least significant bit in the result value. The normalizing the intermediate data, corresponding to the addition operation, further includes right shifting the mantissa by one for a carry due to the rounding off the least significant bit. The normalizing the intermediate data corresponding tothe subtraction operation may include mantissa left shift based on a least one of a left exponent value or a number of leading zeroes in a first (F + 1) bits after carry bit. The normalizing may include rounding the intermediate data and computing an output exponent and an output mantissa. The method may include outputting the output formatted data having a sign the same as the left sign, the output exponent, and the output mantissa. The method may include computing a first exponent value and a first mantissa value using the first floating-point number and computing a second exponent value and the second mantissa value using the second floating-point number before designating the left addend and the right addend. The method may include performing underflow detection or overflow detection using at least the intermediate data in the parallel data paths. Normalization operations for addition operation and subtraction operation are configured on parallel data paths using the intermediate data. The normalizing may include formatting the output exponent and the output mantissa, the output exponent being equal to the left exponent or the left exponent plus 1. Implementations of the described techniques may include hardware, a method or process, or computer software on a computer-accessible medium.

[0007] One general aspect of the disclosure includes an integrated circuit device for performing floating-point operations. The integrated circuit device also includes a first input for receiving a first floating-point number may include a first sign and a first exponent and a first mantissa, the first floating-point number conforming to a first mantissa width of F bits. The device also includes a second input for receiving a second floating-point number may include a second sign and a second exponent and a second mantissa. The device also includes a swap stage for computing a first exponent and a first mantissa of the first floating-point number, computing a second exponent and a second mantissa of the second floating-point number, designating a left addend and a right addend based on the absolute value of the first addend and the absolute value of the second addend, the left addend being characterized by a left sign, a left exponent and a left mantissa, the right addend being characterized by a right sign, a right exponent and a right mantissa, the left addend having a magnitude being larger than or equal to that of the right addend. The device also includes an alignment / add stage for computing two’s complement of the right mantissa, performing a right shift to the right mantissa or to the two’s complement of the right mantissa to match the right exponent to the left exponent, and performing a first addition operation to add the left mantissa and the right mantissa after the right shift of the right mantissa to obtain a first intermediate data or performing a second addition operation to add the left mantissa and the two’s complement of the right mantissa after the right shift of the two’s complement of the right mantissa to obtaina second intermediate data, depending on the first sign and the second sign being the same or the opposite. The device also includes a data path that may include a result value register and a shift value register for storing the first intermediate data or the second intermediate data, the result value register may include at most F+2 bits, the shift value register may include fewer than 3 bits. The device also includes a normalization stage that may include a first normalization circuit and a second normalization circuit configured in parallel for processing the first intermediate data or the second intermediate data, the first normalization circuit being associated using the right mantissa for addition, the second normalization circuit being associated with the two’s complement of the right mantissa being used for addition. Other embodiments of this aspect include corresponding computer systems, apparatus, and computer programs recorded on one or more computer storage devices, each configured to perform the actions of the methods.

[0008] Implementations may include one or more of the following features. The device where the first input may include a first input register for storing the first floating-point number, the first input being characterized by a predetermined mantissa width. The normalization stage may include a first data path associated with the two input addends with same signs for processing the first intermediate data including rounding, overflow detection / handling, and formatting, and a second data path associated with the two input addends with opposite signs for processing the second intermediate data including rounding, underflow detection / handling, and formatting, the first data path being configured in parallel to the second data path. Implementations of the described techniques may include hardware, a method or process, or computer software on a computer-accessible medium.

[0009] One general aspect of the disclosure includes a method for performing floatingpoint operations on an integrated circuit. The method also includes receiving a first floatingpoint number that may include a first sign and a first exponent and a first mantissa, the first floating-point number conforming to a first mantissa width of F bits. The method also includes receiving a second floating-point number that may include a second sign and a second exponent and a second mantissa. The method also includes computing a first exponent and a first mantissa of the first floating-point number and computing a second exponent and a second mantissa of the second floating-point number. The method also includes designating a left addend and a right addend by selecting between the first addend and the second addend, the left addend being characterized by a left sign and a left exponent and a left mantissa with a bit width of F while the right addend being characterized by a right sign, a right exponent and a right mantissa, the left addend being larger than or equal to the right addend in absolutevalue. The method also includes computing a two’s complement of the right mantissa. The method also includes providing a shifted right value by selecting between the right mantissa and the two’s complement of the right mantissa for performing a right shift operation, the right mantissa being selected for the first sign and the second sign having same signs, the two’s complement of the right mantissa being selected for the first sign and the second sign being opposite signs. The method also includes obtaining an intermediate data by adding the left mantissa and the shifted right value, the intermediate data may include a result value and a shift out value, the result value may include at least F+2 bits and the shift out value may include only 2 bits. The method also includes obtaining an output data by normalizing using the intermediate data. Other embodiments of this aspect include corresponding computer systems, apparatus, and computer programs recorded on one or more computer storage devices, each configured to perform the actions of the methods.

[0010] Implementations may include one or more of the following features. The method where the shift right value may include F+2 bits. The normalizing may include rounding off a least significant bit. The normalizing, for the right mantissa being selected for the first sign and the second sign having same signs, may include right shifting mantissa by one bit if there is carry due to the carry of the first addition operation and another right shifting after the rounding-off due to the carry of rounding off a least significant bit or no shifting otherwise, and performing overflowing detection and handling. The normalizing, for the two’s complement of the right mantissa being selected for the first sign and the second sign being opposite signs, may include performing left shifting mantissa by an amount equal to a minimum value of the left exponent and a number of leading 0’s in the first (F + 1) bits after carry bit, and performing overflowing detection and handling. Implementations of the described techniques may include hardware, a method or process, or computer software on a computer-accessible medium.

[0011] It is to be appreciated that embodiments of the present invention provide many advantages over conventional techniques. Among other things, the methods and systems provided according to the present invention provide a fully synthesizable floating-point adder design and support the normal and denormal format in IEEE standard without any special values such as NaN and Inf. This allows applications that do not need special values to avoid allocating a given bit width (for the special values) to incur signal-to-noise (SNR) degradation. The method according to the present invention is especially beneficial for applications with low bit width. Additionally, the methods and systems are also advantageous over a configurable design that has the option to support or not support thosespecial values on the reduction of both the circuit area and the critical path for the floatingpoint operations. A high-performance floating-point adder circuit according to embodiments of the present invention can enable computer or other device to perform calculations more quickly, leading to improved overall performance, which is especially important in applications where real-time processing or large amounts of data are involved. A high- performance floating-point adder circuit according to embodiments of the present invention can also improve the efficiency of a system by reducing the amount of time and resources required to perform calculations, which would afford lower power consumption and heat generation (especially important in battery-powered or portable devices).

[0012] Embodiments of the present invention can be implemented in numerous ways, such as a process, an apparatus, a system, a device, and instructions on a computer-readable medium. For example, the floating-point adder according to the present invention is a basic computation unit and can be used anywhere floating-point is used and addition is needed. Additionally, various techniques according to the present invention can be adopted into existing systems via optimization for minimal circuit area under the condition that the clock constraint (usually a single clock delay) and the constraint of low percentage (<15%) of LVT cells are satisfied. There are other benefits as well.

[0013] The present invention achieves these benefits and others in the context of known technology. However, a further understanding of the nature and advantages of the present invention may be realized by reference to the latter portions of the specification and attached drawings.BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 is a simplified block diagram illustrating an integrated circuit device for performing floating-point operations according to embodiments of the present invention.

[0015] Figure 2 is a simplified block diagram illustrating a floating-point number.

[0016] Figure 3 is a simplified block diagram illustrating a design structure for performing floating-point operations according to embodiments of the present invention.

[0017] Figure 4 is a simplified flow diagram illustrating a method for performing floatingpoint operations according to embodiments of the present invention.

[0018] Figure 5 is a block diagram illustrating an exemplary circuit design for a floatingpoint adder according to embodiments of the present invention.DETAILED DESCRIPTION OF THE INVENTION

[0019] The present invention is directed to performing floating-point operations using integrated circuits. In specific embodiments, two floating-point numbers are selected as a left addend and a right addend based on their absolute values. An addition operation or a subtraction operation is performed between the left addend and the right addend, and the result is normalized to provide an output. There are other embodiments as well.

[0020] Floating-point operations are usually implemented in accordance with the IEEE754 standard, which defines a floating-point number in a standard format having a sign, a mantissa, and an exponent. Performing floating-point operations using integrated circuits traditionally is implemented by using design ware or some other standard design tools that support IEEE754 standard floating format, but it has many limitations. For example, certain designs that support normal and subnormal (also called denormal) formats in IEEE standards without any special values such as NaN (Not-a-Number) and Inf (Infinity). This prevents users from using any fully IEEE standard-compliant design to accomplish their applications. If an IEEE standard-compliant design is configured to meet the application needs, it would require allocation of a given bit for the special values that are not needed in the application which incurs degradation of the signal-to-noise ratio especially when the bit width is low. It also will increase circuit area and prolong critical path.

[0021] The following description is presented to enable one of ordinary skill in the art to make and use the invention and to incorporate it in the context of particular applications. Various modifications, as well as a variety of uses in different applications will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to a wide range of embodiments. Thus, the present invention is not intended to be limited to the embodiments presented, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0022] In the following detailed description, numerous specific details are set forth in order to provide a more thorough understanding of the present invention. However, it will be apparent to one skilled in the art that the present invention may be practiced without necessarily being limited to these specific details. In other instances, well-known structures and devices are shown in block diagram form, rather than in detail, in order to avoid obscuring the present invention.

[0023] The reader’ s attention is directed to all papers and documents which are filed concurrently with this specification and which are open to public inspection with this specification, and the contents of all such papers and documents are incorporated herein by reference. All the features disclosed in this specification, (including any accompanying claims, abstract, and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise. Thus, unless expressly stated otherwise, each feature disclosed is one example only of a generic series of equivalent or similar features.

[0024] Furthermore, any element in a claim that does not explicitly state “means for” performing a specified function, or “step for” performing a specific function, is not to be interpreted as a “means” or “step” clause as specified in 35 U.S.C. Section 112, Paragraph 6. In particular, the use of “step of’ or “act of’ in the Claims herein is not intended to invoke the provisions of 35 U.S.C. 112, Paragraph 6.

[0025] Please note, if used, the labels left, right, front, back, top, bottom, forward, reverse, clockwise and counterclockwise have been used for convenience purposes only and are not intended to imply any particular fixed direction. Instead, they are used to reflect relative locations and / or directions between various portions of an object.

[0026] Figure 1 is a simplified block diagram illustrating an integrated circuit device for performing floating-point operations according to embodiments of the present invention. This diagram is merely an example, which should not unduly limit the scope of the claims. One of the ordinary skills in art would recognize many variations, alternatives, and modifications. The integrated circuit device 100 of FIG. 1 is a simplified illustration based on the design of an exemplary floating-point adder according to some embodiments of the present invention. Practically, circuit 100 may be implemented in part of any computation system including storage and processing circuitry and input-output circuitry. Storage and processing circuitry (which is not shown explicitly in this simplified illustration) may include embedded microprocessors, digital signal processors (DSP), microcontrollers, or other processing circuitry configured to perform various computation operations and execute data process functions in multiple data paths. The storage and processing circuitry may further have digital registers, random-access memory (RAM), first-in first-out (FIFO) circuitry, stack or last-in first-out (LIFO) circuitry, read-only memory (ROM), or other memory elements. Input / output circuitry may include parallel input / output circuitry, differential input / output circuitry, serial data transceiver circuitry, or other input / output circuitry suitable to transmit and receive data.

[0027] In FIG.l, circuit 100 has first input 101 and second input 102. Each input is configured to receive a floating-point number. For example, first input 101 and second 102 may be implemented using registers (e.g., implemented using flip-flops) with a fixed number of bits. Circuit 100 is designed with certain data paths to perform floating-point number addition or subtraction between a first floating-point number received from the first input 101 (designated at the left side) and a second floating-point number received from the second input 102 (designated on the right side) to output another floating-point number in a normalized format. The first floating-point number has a first sign bit and a first exponent el and a first mantissa ml, the first floating-point number conforming to a first mantissa bit width of F. The second floating-point number has a second exponent e2 and a second mantissa m2.

[0028] Circuit 100, implementing the floating-point adder, includes three stages. Below the input circuitry, circuit 100 includes firstly a swap stage circuit 110 configured with a preparameter computation function. The swap stage circuit 110 is designed to perform swap operation to the first floating-point number and a second floating-point number to designate a left addend 111 and a right addend 112. For example, an objective of the swap operation is to ensure that the left addend is not less than the right addend in absolute value. Left addend 111 is selected between the first and second floating-point numbers, and it always has its absolute value larger than or equal to right addend 112. For example, first input 101 is referred to the left side and the second input 102 is referred to the right side, the swap operation is performed based on a result of a pre-parameter computation which computes the first exponent value evl and the first mantissa value mvl based on the first floating-point number and the second exponent value ev2 and the second mantissa value mv2 based on the second floating-point number. If evl > ev2, no swap is needed. If evl < ev2, swap is performed. If evl = ev2, mvl and mv2 are compared to see whether mvl < mv2 and determine that a swap operation is needed. The pre -parameter computation determines the magnitude for the first floating-point number and the magnitude of the second floating-point number. Conditional swap is performed to ensure the left addend to be the larger one of the first floating-point number and the second floating-point number in absolute value. In an embodiment, the pre-parameter computation can be performed after the swap operation, or be initiated before the swap operation to improve the timing at the expense of slightly increasing the area. The timing of the floating-point addition / subtraction is improved because initiating computation of the parameter values before swapping will not impact the critical path (e.g., the critical path before swapping remains to be the comparison operation in computing the‘swap’ signal) while computing them after swapping will prolong the critical path. The output of the swap stage circuit 110 is thus the left addend 111 and the right addend 112.

[0029] Next, circuit 100 includes an “Align & Add” stage circuit 120 that is configured with a right shifter module and addition / subtraction computation function. The right shifter module, not shown explicitly, is configured to right shift the right mantissa (112) to align the right exponent with that of the left addend 111, i.e., change the right exponent value (smaller one) to match the left exponent (larger one). Then the mantissa of left addend 111 and right addend 112 are added together or the mantissa of right addend 112 is subtracted from that of left addend 1 1 1 depending on whether the two addends have the same sign or not (i.e., does si = s2 ?). Circuit 120 produces intermediate data that have tentatively an exponent equal to the left exponent, a mantissa expected from the addition / subtraction result above, and a sign the same as left addend 111.

[0030] Final stage of circuit 100 is a normalization stage circuit 130 configured with parallelized computation function for addition / subtraction cases and with all floating-point number normalization functions. The parallelized computation function is conducted in two parallelized data paths, one being designed for computations involving addition operation of the left mantissa and the right mantissa after a right shift of the right mantissa to match the right exponent to the left exponent and another one being designed for computations involving another addition operation, replacing the subtraction operation in which a two’s complement of the right mantissa is computed to replace the right mantissa before right shift, depending on whether the two addends have the same sign or not. The normalization stage circuit 130 performs various formatting operations to the intermediate data so that its floating-point (FP) number output has the correct value and bit width in each field. Tn particular, the normalization stage circuit 130 performs rounding, underflow and overflow detection and handling, identifying whether the FP output is normal or subnormal, and formatting the output accordingly. In an embodiment, the normalization stage is optimized using the parallelized computation function in two parallelized data paths to minimize the critical path in each case. It is to be appreciated that by separating the addition section from the subtraction (or addition using a two’s complement) section, logical complexity of selecting circuit components is reduced.

[0031] FIG. 2 is a simplified block diagram illustrating a floating-point number. Floatingpoint numbers are commonplace for representing real numbers in scientific notation in computing systems and are designed to cover a large numeric range and diverse precision requirements. The IEEE754 standard is widely used for floating-point numbers. A floating-point number, such as the floating-point number illustrated in FIG. 2 includes three different fields: the sign of the floating-point number 210, the mantissa 211, and the exponent 212. Each of these fields may be represented by a binary number and, in the IEEE754 format, have different bit widths, S, E, and F, depending on the precision. For example, a single-precision floating-point number such as the floating-point number in FIG. 2 requires 32 bits, which are distributed as follows: one sign bit (S = 1, where a “0” denotes a positive number and a “1” denotes a negative number), eight exponent bits (bit width E = 8), and 23 mantissa bits (bit width F = 23). For an exemplary small bit width floating-point number, which has many special applications such as systems with constraints of single clock delay and low percentage of LVT cells, the bit widths in all three fields are S = 1, E = 3, and F = 3.

[0032] The exponent 212 of a floating-point number preferably is an unsigned binary number which, for the single precision format, ranges from 0 to 255. In order to represent a very small number, it is necessary to use negative exponents. Thus, the exponent 212 preferably has a negative bias. For single-precision floating-point numbers, the bias preferably is -127. For example, a value of 140 for the exponent actually represents (140- 127)=13, and a value of 100 represents (100-127)=-27.

[0033] According to the IEEE754 standard, mantissa 211 is a normalized number, i.e., it has no leading zeroes and represents the precision component of a floating-point number. Therefore, in a system where numbers are always normalized, the leading bit need not be stored and can be implied, effectively giving mantissa 211 one hidden bit of precision. As shown in FIG. 2, under IEEE754 standard, a floating-point number can be presented in a normalized format, including a sign s, an exponent e, and a mantissa m. Based on respective bit widths, a value of the exponent e is denoted as ev and a value of the mantissa m is denoted as mv, which concatenate the hidden bit to the mantissa m. These expressions apply through the specification.

[0034] Figure 3 is a simplified block diagram illustrating a design structure for performing floating-point operations according to embodiments of the present invention. This diagram is merely an example, which should not unduly limit the scope of the claims. One of the ordinary skills in art would recognize many variations, alternatives, and modifications. In some embodiments, the design structure for performing floating-point operations is based on the integrated circuit 100 of an improved floating-point adder with various optimizations in the reduction of the critical path. As shown in FIG. 3, the proposed floating-point adder 300 takes two addends as input and outputs the sum through three stages of operations. The first addend 301 is a first floating-point number, denoted with all fields as sign si, exponent el,and mantissa ml. The second addend 302 is a second floating-point number denoted with all fields as sign s2, exponent e2, and mantissa m2. In a specific embodiment, first addend 301 is stored in a seven-bit register: one bit for the sign, three bits for the exponent, and three bits for mantissa.

[0035] In various embodiments, adder 300 is configured to quickly and efficiently process floating-point operations. For example, after a first pair of addends are processed and percolated from registers 301 and 302 to registers 321 and 322, a second pair of addends are buffered at registers 301 and 302, and so on. In other embodiment, these registers can be ‘virtual’ (i.e. not present) so that the whole adder operation can be completed in one clock cycle.

[0036] The floating-point adder 300 includes a swap stage 310 to conditionally swap the two addends 301 and 302 so that after this stage left addend 321 always has a larger absolute value than or equal absolute value to the right addend 322. For example, before a “SWAP” signal is triggered in this stage, computation operation 312 is performed first to obtain the first exponent value evl and the first mantissa value mvl (which concatenates the hidden bit of ml when the first addend is normal) from the first floating-point number as the first addend 301 and obtain the second exponent value ev2 and the second mantissa value mv2 from the second floating-point number as the second addend 302. Since “signs” of two floating-point addends are ignored at this stage, only the “absolute value” of the two addends are evaluated and used as the criteria for the swap. More specifically, swap operation 315 is performed by selecting between the si and the s2, the evl and ev2, and mvl and mv2, and designates one floating-point number with a larger magnitude or absolute value as the left addend 321 and the other floating-point number with a smaller (or equal) magnitude or absolute value as the right addend 322. The left addend 321 is denoted with all fields as left sign sL, left exponent eL, and left mantissa mL. The left mantissa mL is conforming a bit width of F. The right addend 322 is denoted with all fields as right sign sR, right exponent eR, and right mantissa mR. Here, the value of left exponent evL is larger than or equal to the value of right exponent evR.

[0037] The floating-point adder 300 then includes an Align&Add stage 330 to process input of the left addend 321 and the right addend 322. Firstly, a computation operation 331 is performed to obtain a two’s complement of the right mantissa value mvR, which is introduced to avoid subtraction and keep the addition to (F+l) bits, where F is the bit-width of the left mantissa mL of left addend 321. The output of the two’s complement computation 331 should have F+2 bit as it includes a sign bit. The sign bit is needed for sign extension in thesubsequent right- shifting. Here the mantissa value mvR is always non-negative, and thus the sign bit is always 1 except when mvR is 0. The right mantissa value mvR and the two’s complement of right mantissa value mvR are inputs for mux operator 333 to select. The output of mux operator 333 is configured to select just one of the two inputs depending on a checker 332 to determine if the first sign si of the first floating-point number and the second sign s2 of the second floating-point number are the same or not. If si - s2, mux operator 333 outputs (selects) the right mantissa value mvR. If si s2 mux operator 333 outputs (selects) the two’s complement of right mantissa value mvR.

[0038] The Align&Add stage 330 further includes a shifter 334 to perform a mantissa right shift operation with an input being either the right mantissa value mvR or its two’s complement depending on whether two addends have the same sign. The shift amount done by shifter 334 is evL - evR. Here, evL is the value of left exponent eL and evR is the value of right exponent eR. This makes right exponent value of the shifted right addend matching with the left exponent value evL of the left addend. Shifter 334 outputs a shift right value that is either a right shifted version of right mantissa value mvR or a right shifted version of the two’ s complement of right mantissa value mvR, depending on whether two addends have the same sign or not. The shift right value has (F+l) bits.

[0039] It is understood that mux operator 333 determines whether addition or subtraction is performed based on whether the two addends have the same sign. By selecting two’s complement of the right addend (i.e., if two addends have different signs), the right addend is subtracted from the left addend, and the operation of adding two’s complement may be referred to as a subtraction operation.

[0040] The Align&Add stage 330 then performs a (F+l) bit addition operation 335. When two signs of the two floating-point numbers are the same, the addition between the left mantissa value mvL and the right mantissa value mvR after the right shift (i.e., a right shifted version of right mantissa value mvR} is performed to obtain a first intermediate data 336. Because of the implementation of computation of two’s complement for the right mantissa value mvR, when two signs of the two floating-point numbers are not the same, a subtraction is not needed, instead, the addition between the left mantissa value mvL and the two’s complement of right mantissa value mvR after the right shift (i.e., a right-shifted version of the two’s complement of right mantissa value m ) is performed to obtain a second intermediate data 337. Two additional fractional bits need not participate in the addition because their counterparts in the left mantissa value mvL is 0. Thus, the adder bit width can be limited to the bit width of left mantissa plus a sign bit, i.e., (F + 1). It is understood that,the first intermediate data 336 is corresponding to an addition (+) case and the second intermediate data 337 is corresponding to a (traditional) subtraction (-) case although the subtraction has been replaced by addition after the computation of two’s complement of right mantissa value performed earlier. The (first or second) intermediate data includes a result value and a shift out value. The result value is a direct result of the (F+l) bit addition operation 335 and the shift out value is two extra bits directly passed from the shifter 334 after performing the mantissa right shift by the amount of evL - evR) with sign extension.

[0041] The Align&Add stage 330 may include a result value register and a shift value register for respectively storing a result value and a shift out value in first intermediate data 336 or the second intermediate data 337. The result value register comprising at least F+2 bits, the shift out value register comprising fewer than F bits. It is understood that the first intermediate data 336 and the second intermediate data 337 — albeit being shown as two blocks — may be configured as the same register on the same data path with a fixed width. The implementation of the data path before normalization (selected between block 340 and block 350) is described in further details (e.g., in FIG. 5 and the description thereof), below. It is to be appreciated that the “shift out value” portion of the intermediate data in a conventional implementation may include F bits, while the data path here allocates fewer bits (as few as one or two bits) for the “shift out value” portion of either one of the first or second intermediate data.

[0042] The floating-point adder 300 also includes a normalization stage which is configured to two parallelized data paths 340 and 350 independently taking either the first intermediate data 336 or the second intermediate data 337 as their respective input. In other words, one normalization data path 340 takes the first intermediate data 336 as its input for (+) case, and another normalization data path 350 takes the second intermediate data 337 as its input for (-) case. Note, for adding any two floating-point numbers, only one of the two parallel data paths stands in real operation of the normalization stage. The parallel data paths reduce the critical path at the expense of slightly increasing the area (e.g. two copies of the rounding circuit are needed instead of just one). The rationale of separating the addition case from the subtraction case is many differences in their handling. For example, for (+) case, carry bit due to addition in the adder output can be 1 or 0; but for (-) case, it always 0 and can be ignored. In terms of mantissa shift, there is no left shift before rounding for (+) case; while there is no right shift before rounding for (-) case. In (+) case, it is not possible to have underflow (i.e., the mantissa is 0 but the exponent is non-zero); but underflow is possible for (-) case and it needs special handling. In (+) case, it is possible to have overflow or saturationand need special handling; but it is not possible for (-) case. Additionally, in (+) case, the exponent of floating-point output can be eL or eL + 1 (cannot decrease from eLy, but it cannot increase from eL in (-) case. So, by separating the (+) case from (-) case, the critical path in each case can be minimized. For example, a brute-force approach would adjust the exponent every time when the mantissa is shifted or a rounding produces a carry. However, the parallelized data paths make it possible to adjust the exponent once at the end together with the underflow or overflow handling.

[0043] The normalization operation in the data path 340 includes three operations, shifting operation 343, rounding operation 345, and formatting operation 347. More specifically, shift operation 343 performs right shift of the first intermediate data 336 by 1 if there is a carry due to the addition operation 335. Alternatively, shift operation 343 takes no shifting action when there is no carry. Next, rounding operation 345 performs rounding off the least significant bit in the output from shifter 336. Rounding operation 345 also does mantissa right shift by 1 if there is a carry due to the rounding or no shift if no carry. The third operation is formatting operation 347, which computes an output exponent and mantissa resulting from all the above shifting and rounding operations on the first intermediate data 336 and formats the output exponent and mantissa in a format similar to that of IEEE standard. The output of the data path 340 or directly out of the formatting operation 347 leads to a final floating-point number (FP output 361) in a format similar to that of IEEE standard format, particularly with a sign sO, an exponent eO, and a mantissa mO. Here, the sign sO will take the same sign sL of left addend 321 designated after the swap stage 310. The formatting operation 347 also includes overflow detection and handling in special situations. It picks the hidden bit position depending on if there’s a carry or not during rounding. The exponent computation in this operation covers the effect of both the shifting and rounding, leading to eO = eL or eL + 1.

[0044] Alternately, the normalization operation in another parallel data path 350 also includes three operations, shifting operation 353, rounding operation 355, and formatting operation 357. In more details, the shifting operation 353 performs mantissa left shift by an amount equal to min(m, evL), that is minimum of m being a number of leading 0’s in the first (F + 1) bits after carry bit in mantissa of the second intermediate data 337 and evL the left mantissa value of left addend 321. The rounding operation 355 performs rounding off the least significant bit of output from the left shifter 337. Rounding operation 355 also does mantissa right shift by 1 if there is a carry due to the rounding or no shift if no carry. The third operation is formatting operation 357, which computes an output exponent and mantissaresulting from all above shifting and rounding operations on the second intermediate data 336 and formats the output exponent and mantissa in a format similar to IEEE standard format. The output of the data path 350 or directly out of the formatting operation 357 leads to a final floating-point number (FP output 361 ) in a format similar to IEEE standard format, particularly with a sign sO, an exponent eO, and a mantissa mO. Here, the sign sO will take the same sign of the left addend 321 designated after swap stage 310. The mantissa formatting is straight forward while the exponent computation covers the effect of both the shifting and rounding.

[0045] Figure 4 is a simplified flow diagram illustrating a method for performing floatingpoint operations according to embodiments of the present invention. This diagram is merely an example, which should not unduly limit the scope of the claims. One of ordinary skill in the art would recognize many variations, alternatives, and modifications. As shown, method 400 executing multiple data operations to complete the addition operation of two floatingpoint numbers. Step 410 of method 400 includes receiving a first floating-point (FP) number and a second FP number. Optionally, the FP numbers are sent via input / output circuitry of an integrated circuit (such as the one shown in Figure 1), or are retrieved from a memory location where the numbers are previously saved, or delivered from one register location in the data path. At step 421, method 400 includes a computation operation to use the first FP number and the second FP number as inputs to calculate some parameters associated with the first FP number and the second FP number. The computation operation leads to values of a first exponent, a first mantissa of the first FP number and also values of a second exponent, a second mantissa of the second FP number.

[0046] At step 423, method 400 includes a swap operation for designating a left addend (an FP number) and a right addend (an FP number) by selecting between the first addend and the second addend (inluding signs, exponents and mantissas) so that the left addend always has a absolute value larger than or equal to that of the right addend. In other words, the left addend will be one FP number of the first FP number and the second FP number that has a larger absolute value than (or equal to) that of another FP number. A comparison operation is done after the computation step 421, which computes a “swap” signal to complete step 423, including actual swap or no swap actions. The output of the swap operation leads to a left addend having a left sign, a left exponent and a left mantissa and a right addend having a right exponent and a right mantissa. The left addend always has a larger magnitude or absolute value than (or equal to) that of the right addend.

[0047] At step 431, method 400 further includes a computation operation to calculate two’s complement of the right mantissa of the right addend. After obtaining the two’s complement of the right mantissa, both the right mantissa value and its two’s complement are inputs of a multiplexer (mux) and only one of them is outputted and used as an input for subsequent operations, depending on a condition set in step 432 in which the first sign of the first FP number is compared with the second sign of the second FP number. If the first sign and the second sign are the same, the right mantissa value is outputted from the mux and used as an input for subsequent operations in the first one of two parallel data paths. If the first sign and the second are not the same, the two’s complement of the right mantissa value is outputted from the mux and used as an input for subsequent operations in a second one of the two parallel data paths.

[0048] The first one of the two parallel data paths includes at least operations 434, 436, 438, and 442. Alternatively, the second one of the two parallel data paths includes at least operations 435, 437, 439, and 443. At step 434 or step 435, method 400 includes a mantissa right shift operation to align the right exponent to the left exponent. The input to the right shift is either the right mantissa or the two’s complement of right mantissa depending on whether the two addends have the same sign or not as suggested in step 432. At step 434, right shifting to the right mantissa is performed, corresponding to the case that two signs of the two addends are the same. At step 435, right shifting to the two’s complement of right mantissa is performed, corresponding to the case that two signs of the two addends are not the same.

[0049] Continuing along the flow of the first one of the two parallel data paths following step 434, method 400 includes an addition operation 436 to perform a first addition between the left mantissa value and the right mantissa value after right shifting step 434. This addition operation 436 leads to, in the next step 438, obtaining a first intermediate data which has its exponent result and mantissa result. Furthermore, step 442 of method 400 takes the first intermediate data as input to perform a normalization operation to obtain, at step 450, an output FP floating-point number in the standard format. In some embodiments, the normalization operation in step 442 will conduct mantissa right shifting by 1 if there is a carry after the addition operation 436 of the left mantissa and the right mantissa. The normalization operation in step 442 may also perform rounding off the least significant bit in the mantissa result of the first intermediate data, and perform right shifting by 1 if there is a carry due to the rounding operation. The normalization operation in step 442 may alsoperform overflow detection and handling to the first intermediate data to obtain the final FP output 450 (a floating-point number) in a format similar to the IEEE standard format.

[0050] Continuing along the second one of the two parallel data paths following step 435 which is independent of step 434, method 400 includes an addition operation 437 to perform a second addition between the left mantissa value and the two’s complement of the right mantissa value after right shifting step 435. This addition operation 437 leads to, in the next step 439, obtaining a second intermediate data which has its exponent result and mantissa result. Furthermore, step 443 of method 400 takes the second intermediate data as input to perform a normalization operation to obtain independently, at step 450, an output FP floatingpoint number in the standard format. In some embodiments, the normalization operation in step 443 is configured in parallel (and independently) to step 442. The normalization operation in step 443 will conduct mantissa left shifting by a minimum value of a number of leading 0’s in the first (F + 1) bits after carry bit in mantissa result of the second intermediate data and the left exponent value of the left addend. Here F is the fractional bit width of the mantissa of the two addends. The normalization operation in step 443 may also perform rounding off the least significant bit in the mantissa result of the second intermediate data. Because the second addition operation in step 437 in fact is designed to use two’s complement computation to replace an actual subtraction operation with an addition operation involving two’s complement, the normalization in two parallel and independent data paths has a significant advantage in reducing each critical path due to various distinct formatting differences involving the above two cases. The normalization operation in step 443 may also perform underflow detection and handling to the second intermediate data to obtain the final FP output 450 (a floating-point number) in IEEE standard format.

[0051] The method for performing floating-point operations disclosed in FIG. 4 is optimized in reducing the critical path and minimizing circuit area, especially for systems including constraints with single clock delay or low percentage of low V threshold (LVT) cells. The design is parameterized for any exponent bit width E (> 1) and fractional bit width F (> 1). In some embodiments, pre-computing some parameters to remove them from the critical path and parallelization in normalization calculation shortens the critical path. The method is particularly beneficial to avoid incurring significant SNR degradation especially when bit width is low. In a case with exponent bit width = fractional bit width = 3, the circuit area implementing the floating-point adder according to some embodiments of the present invention is reduced from 20 to 16 while cutting the LVT percentage from 30% to 16% (relative to the areas of 20 and 16 respectively). Any floating-point design according toembodiments of the present invention can in principle be replaced by a fixed-point design with large bit width. This is sometimes possible and even beneficial because the fixed-point adder is typically much cheaper. However, when the data path requires a large dynamic range, the cost of using a fixed point can be prohibitive.

[0052] Figure 5 is a block diagram illustrating an exemplary circuit design for a floatingpoint adder according to embodiments of the present invention. This diagram is merely an example, which should not unduly limit the scope of the claims. One of the ordinary skills in art would recognize many variations, alternatives, and modifications. As shown in FIG. 5, the floating-point adder 500 takes two addends as input and outputs the sum through three stages of operations. The first addend 501 is a first floating-point number, denoted with all fields as sign si, exponent el, and mantissa ml. The second addend 502 is a second floatingpoint number denoted with all fields as sign s2, exponent e2, and mantissa m2. In a specific implementation, the first addend 501 is stored in a seven-bit register: one bit for the sign, three bits for the exponent, and three bits for mantissa.

[0053] The floating-point adder 500 is configured to process floating-point operations quickly and efficiently.

[0054] The floating-point adder 500 includes a swap circuit 510 to use the two addends 501 and 502 as inputs and conditionally swap the two addends 501 and 502 to output a left addend in 521 and a right addend in register 522 so that the left addend 521 always has a larger absolute value than or equal absolute value to the right addend 522. For example, before a “SWAP” signal 513 is triggered, computation operation 512 is performed first to obtain the first exponent value evl and the first mantissa value fl (which concatenates the hidden bit el_not0 of ml) from the first floating-point number in the first addend 501 and obtain the second exponent value ev2 and the second mantissa value f2 from the second floating-point number in the second addend 502. Since “signs” of two floating-point addends are ignored at this stage, only the “absolute value” of the two addends are evaluated and used as the condition for the swap. More specifically, swap operation 515 is performed by selecting between the first and the second addends and designates one floating-point number with a larger magnitude or absolute value as the left addend 521 and the other floating-point number with a smaller (or equal) magnitude or absolute value as the right addend 522. The left addend 521 is denoted with all bit fields as left sign sL, left exponent eL with a value of evL, and left mantissa value fL. The left mantissa value fL is conforming a bit width of F. The left addend 521 has a larger absolute value. The right addend 522 has a smaller absolute value. The right addend 522 is denoted with the right exponent value evS, and right mantissavalue fS. Here, the value of left exponent evL is larger than or equal to the value of right exponent evS.

[0055] The floating-point adder 500 also includes a circuit 530 to use input of the left addend 521 and the right addend 522 for a two’s complement computation operation as well as alignment / add operations. Firstly, the circuit 530 performs a two’s complement computation operation to obtain a two’s complement of the right mantissa value fS, which is introduced to realize subtraction using an adder with (F+1) input bits and F+2 output bits, where F+1 is the bit-width of the left mantissa value fL of left addend 521. The output of the two’s complement computation should have F+2 bit as it includes a sign bit which is needed for sign extension in the subsequent mantissa right-shifting. The mantissa value is always non- negative and thus its sign bit is always 0. After two’s complement, the sign bit is always 1 except when the right mantissa is 0. The sign bit is used during the right shifting for sign extension and it is not needed after the right shifting. Thus, only F+1 bits are retained at the right shifter output. The right mantissa value fS and the two’s complement of right mantissa value fS are inputs for a mux operator 533 to select. The output of mux operator 533 is configured to select just one of the two inputs depending on a checker operation 532 to determine if the first sign si of the first floating-point number and the second sign s2 of the second floating-point number are the same or not. If si = s2, mux operator 533 outputs (selects) the right mantissa value fS. If si s2, mux operator 533 outputs (selects) the two’s complement of right mantissa value fS.

[0056] The circuit 530 is also configured to perform alignment and addition operations by using a shifter 534 to perform a mantissa right shift on the right addend 522. The input to the mantissa right shift is the right mantissa value fS or its two’s complement depending on whether the left addend 521 and right addend 522 have the same sign or not. The right shift amount is (evL - evS) bits to make the right exponent evS of the shifted right addend matching with the left exponent value evL of the left addend. Thus, the shift amount can be up to (2E— 2) bits, where E is bit width of the exponent. For example, if E = 3, the mantissa right shift amount can be up to 6 bits. However, at most two more fractional bits in mantissa, x2,xl, need to be kept as extra bits regardless how large is F or the right shift amount. Shifter 534 outputs a shift right value that is either a right shifted version of right mantissa value fS or a right shifted version of the two’s complement of right mantissa value fS, depending on the checker operation 532 to determine whether the two (left and right) addends have the same sign or not. The right shifter output has F+1 bits..

[0057] It is understood that mux operator 533 determines whether an addition or a subtraction is performed based on the checker operation 532 whether the two (left and right) addends have the same sign. By selecting two’s complement of the right addend (i.e., if two addends have different signs), the right addend is subtracted from the left addend, and the operation of adding two’s complement may be referred to as a subtraction operation.

[0058] Circuit 530 further includes an adder 535 to perform a (F+l) bit addition operation. In a (+) case with si = s2, adder 535 performs the addition operation to obtain a sum of the left mantissa value IL and the shifted version of right mantissa value fS after the mantissa right shift, wherein each addend has F+l bits. The output of the adder 535 is a first intermediate data 536 with a result value being at most F+2 bits (i.e., denoted in c b3 b2 bl bO in FIG. 5). In a (-) case with si s2, adder 535 performs the addition operation to obtain a sum of the left mantissa value fL and the shifted version of two’s complement of right mantissa value fS after the right shift of a value of the two’s complement of the right mantissa fS. Because of the implementation of computation of two’s complement for the right mantissa value fS, a subtraction is not needed, instead, the addition operation is still performed by the adder 535 to obtain a second intermediate data 537 having at most F+l bits (also denoted in b3 b2 bl bO in FIG. 5 with the carry bit ignored). Two additional fractional bits x2,xl, need not participate in the addition because their counterparts in the left mantissa value fL is 0. Thus, the register bit widths for the inputs for adder 535 can be limited to the bit width of left mantissa, i.e., (F + 1) bits. It is understood that either the first intermediate data 536 or the second intermediate data 537 contains one result value obtained from the (F+l) bit addition operation performed in adder 535 respectively for the (+) case or (-) case. The result value is saved as one result value for the (+) case or (-) case, holding at least F+2 bits denoted as c b3, b2, bl, bO in FIG. 5. Additionally, the first intermediate data 536 and the second intermediate data 537 include a shift out value directly passed from the shifter 534. The shift out value corresponds to the two extra bits denoted as x2 xl in FIG. 5. The result value register contains at least F+2 bits, the shift value register contains fewer than 3 bits.

[0059] In the implementation, there is only one intermediate data here. The subsequent operations applied to this intermediate data will differ depending on if si and s2 are the same or not, i.e. (+) or (-) case. The first intermediate data 536 and the second intermediate data 537 — albeit being shown as two blocks — may be configured as the same block on the same data path with a fixed width. It is to be appreciated that the “shift out value” portion of the intermediate data in a conventional implementation could include F bits, while the data pathhere allocates fewer bits (as few as one or two bits) for the “shift out value” portion of the intermediate data.

[0060] The floating-point adder 500 also includes two normalization stage circuits 540 and 550 configured on two parallelized data paths independently taking either the first intermediate data 536 or the second intermediate data 537 as their respective input. In other words, one circuit 540 takes the first intermediate data 536 as its input in a first data path for the (+) case corresponding to “same sign” case of the first two input floating-point numbers. Another circuit 550 takes the second intermediate data 537 as its input in a second data path for the (-) case corresponding to “opposite sign” case of the first two input floating-point numbers. Note, for adding any two floating-point numbers, only one of the two parallel data paths stands in real operations of the normalization stage. The circuit design with two parallel data paths reduces the critical path at the expense of slightly increasing the area (as two copies of the rounding circuit are needed instead of just one). The rationale of the design with two parallel data paths is to separate the (+) case from the (-) case because there are many differences in the handling of floating-point addition and subtraction. For example, for (+) case, carry bit due to addition in the adder output can be 1 or 0; but for (-) case, it is always 0 and can be ignored. In terms of mantissa shift, there is no left shift before rounding for (+) case; while there is no right shift before rounding for (-) case. In (+) case, it is not possible to have underflow (i.e., the mantissa is 0 but the exponent is non-zero); but underflow is possible for (-) case and it needs special handling. In (+) case, it is possible to have overflow or saturation and need special handling; but overflow is not possible for (-) case. Additionally, in (+) case, the exponent of floating-point output can be eL or eL + 1 (cannot decrease from eL); but it cannot increase from eL in (-) case. So, by separating the (+) case from (-) case, the critical path can be minimized. For example, a brute- force approach would adjust the exponent every time when the mantissa is shifted or a rounding produces a carry. However, the parallelized data paths here adjust the exponent once at the end together with the underflow or overflow handling.

[0061] The normalization operation in one normalization stage circuit 540 conducts its operation in a first data path corresponding to ‘same sign’ (+) case. The input data of this data path uses the (first) intermediate data 536 with only (F + 3) bits: (F+2) bits (denoted as c, b3, . . ., bl in FIG. 5) result value that is obtained from the output of the adder 535 plus one extra bit (x2) that is passed directly from the shifter 534. Circuit 540 conducts a right shifting operation 541 to perform a mantissa right shift by one for a carry bit c =1 produced by the addition operation done in the adder 535 or perform no shift for no carry bit. Circuit 540 alsoconducts a rounding operation 542 to rounding off a least significant bit of the result value, cutting it from (F+2) bits to (F+l) bits. It outputs a value 543 expressed in denotation (c’ y3 y2 yl yO) in FIG. 5. Optionally, circuit 540 also conducts a formatting operation 544 to computer an output mantissa ma (for (+) case) with a bit width of F. Optionally, it performs a mantissa right shift by one to pick the hidden bit position for a carry bit c’ = 1 produced by the rounding operation 542 or no shift otherwise. Circuit 540 also conducts a formatting operation 545 to computes an output exponent ea with bit width of E. The output exponent computation during the formatting operation 545 covers effects of both the shifting operation 541 and rounding operation 542. Additionally, circuit 540 in the first data path further conducts an overflow detection / handling operation 546 from all the above right shifting operation 541 and rounding operation 542 on the first intermediate data 536 and formats the output exponent and output mantissa. Note, the output exponent can be adjusted every time when mantissa is shifted or a rounding produces a carry. While, the output exponent can also be adjusted once at the end together with the overflow handling operation 546 to provide process optimization for reducing the critical path and enhancing efficiency of the floatingpoint adder. The output of the circuit 540 in the first data path using the (first) intermediate data 536 leads to a final floating-point number ema with an exponent ea and a mantissa ma. Exponent ea is the output exponent formatted above, ea = eL or eL + 1. Mantissa is the output mantissa ma formatted above.

[0062] Alternately, the normalization operation in another normalization stage circuit 550 in a parallelly configured second data path corresponding to ‘opposite sign’ (-) case using the (second) intermediate data 537. In this data path, the two extra bits, i.e. x2, xl, resulted from the shifter 534 are kept regardless of the bit width F value. Circuit 550 performs a counting operation 551 to obtain a number m of leading 0’s in the first (F+l) bits (ignoring c the carry bit). The number m is compared with the left exponent value evL of the left addend 521 to determine a minimum value of the two, which will be set to be an amount for left shifting Ishf. Here, counting number of leading 0 is limited up to only F+l bits, thus limiting the amount of left shifting to mostly F+l. Circuit 550 then performs a left shifting operation 552 to shift the mantissa of the intermediate data 537 by Isht bits (with carry bit being ignored) to produce a value 553 in (F+2) bits denoted as z4 z3 z3 z2 zl zO in FIG. 5. Circuit 550 then performs a rounding operation 554 to round off a least significant bit of z4 z3 z3 z2 zl zO to obtain a value 555 in (F+l) bits denoted as c” z3 z2 zl zO in FIG. 5. Optionally, circuit 550 performs a formatting operation 556 to compute an output mantissa ms (for (-) case) with a bit width of F. Additionally, circuit 540 also conducts a formatting operation 557 to computesan output exponent es with bit width of E. Here, the computation of the output exponent es covers effects of both the left shifting operation 552 and rounding operation 554. The formatting operation 557 also includes underflow detection / handling to produces the output exponent with the bit width of E. Here, the underflow detection mechanism covers those cases that require more than F+l shift. Furthermore, the underflow detection is realized by checking the condition ‘number of leading 0 == F+l’ AND ‘x2 == O’. Further, an unsigned floating-point number ems (558 in FIG. 5) is obtained by circuit 550 with an exponent es and a mantissa ms. Here, sign s is the same as the sign sL of the left addend 521. Exponent es is the output exponent formatted above. Mantissa ms is the output mantissa formatted above. Finally, an output data 600 of the floating-point adder 500 is outputted as ema or ems, a normalized floating-point number in IEEE standard format with a sign s, a formatted output exponent, and a formatted mantissa corresponding to either (+) case or (-) case. The sign s will be always the same as that of the left addend 521. The formatted output exponent and mantissa are captured in the output exponent ema for “same sign” (+) case. The formatted output exponent and mantissa are captured in the output exponent ems for “opposite sign” (-) case.

[0063] The present floating-point adder design according to some embodiments of the present invention is optimized for a low percentage of LVT cells (~<15%) with minimal areas. However, we can lower the area by eliminating some pre-computation at the expense of increasing the percentage of LVT or lower the latter by adding more pre-computation at the expense of the area.

[0064] While the above is a full description of the specific embodiments, various modifications, alternative constructions and equivalents may be used. Therefore, the above description and illustrations should not be taken as limiting the scope of the present invention which is defined by the appended claims.

Claims

WHAT IS CLAIMED IS:

1. A method for performing floating-point operations on an integrated circuit, the method comprising: receiving a first floating-point number comprising a first sign and a first exponent and a first mantissa, the first floating-point number conforming to a first mantissa width of F bits; receiving a second floating-point number comprising a second sign and a second exponent and a second mantissa; calculating a first absolute value of the first floating-point number; calculating a second absolute value of the second floating-point number; designating a left addend and a right addend by selecting between the first addend and the second addend so that an absolute value of the left addend is larger than or equal to an absolute value of the right addend, the left addend including a left sign, a left exponent, and a left mantissa, the right addend including a right exponent, and a right mantissa; shifting the right mantissa to match the right exponent to the left exponent and to obtain a shift right value, the shift right value having F+l bits; selecting between an addition operation and a subtraction operation based on the first sign and the second sign, the addition operation being based on the first sign and the second sign being same signs, the subtraction operation being based on the first sign and the second sign being opposite signs; obtaining an intermediate data by performing the addition operation or the subtraction operation between the left mantissa and the right mantissa, the intermediate data comprising a result value and a shift out value, the result value comprising at least F+2 bits and the shift out value comprising of at most 2 bits; obtaining an output data by normalizing the intermediate data.

2. The method of claim 1 further comprising performing mantissa right shift of the intermediate data by one for a carry after performing the addition operation or a no shift otherwise.

3. The method of claim 1 wherein the subtraction operation is performed by adding a two’s compliment of the right mantissa.

4. The method of claim 1 wherein the normalizing the intermediate data comprises rounding off a least significant bit of mantissa in the result value.

5. The method of claim 4 wherein the normalizing the intermediate data, corresponding to the addition operation, further comprises right shifting the rounding result by one if there is a carry due to the rounding off the least significant bit.

6. The method of claim 1 wherein the normalizing the intermediate data corresponding to the subtraction operation comprises left shift of the intermediate data based on a least one of a left exponent value or a number of leading zeroes in a first (F + 1) bits after a carry bit.

7. The method of claim 1 wherein the obtaining the output data by normalizing the intermediate data comprises normalization operations for addition operation and subtraction operation configured on parallel data paths using the intermediate data.

8. The method of claim 7 wherein the normalization operations comprise rounding the intermediate data and computing an output exponent and an output mantissa.

9. The method of claim 8 wherein the normalization operations comprise formatting the output exponent and the output mantissa, the output exponent being equal to the left exponent or the left exponent plus 1.

10. The method of claim 7 further comprising performing underflow detection or overflow detection using at least the intermediate data in the parallel data paths.

11. The method of claim 9 further comprising outputting the output data having a sign the same as the left sign, a formatted output exponent, and a formatted output mantissa.

12. The method of claim 1 further comprising: computing a first exponent value and a first mantissa value using the first floating-point number and computing a second exponent value and the second mantissa value using the second floating-point number before designating the left addend and the right addend.

13. An integrated circuit device for performing floating-point operations, the device comprising:a first input for receiving a first floating-point number comprising a first sign and a first exponent and a first mantissa, the first floating-point number conforming to a first mantissa width of F bits; a second input for receiving a second floating-point number comprising a second sign and a second exponent and a second mantissa; a swap stage for computing a first exponent value and a first mantissa value of the first floating-point number, computing a second exponent value and a second mantissa value of the second floating-point number, designating a left addend and a right addend based on the absolute value of the first addend and the absolute value of the second addend, the left addend being characterized by a left sign, a left exponent and a left mantissa, the right addend being characterized by a right exponent and a right mantissa, the left addend having a magnitude being larger than or equal to that of the right addend; an alignment / add stage for computing two’s complement of the right mantissa, performing a right shift to the right mantissa or to the two’s complement of the right mantissa to match the right exponent to the left exponent, and performing a first addition operation to add the left mantissa and the right mantissa after the right shift of the right mantissa to obtain a first intermediate data or performing a second addition operation to add the left mantissa and the two’s complement of the right mantissa after the right shift of the two’s complement of the right mantissa to obtain a second intermediate data, depending on the first sign and the second sign being the same or the opposite; a data path comprising a result value and a shift value for the first intermediate data or the second intermediate data, the result value register comprising at most F+2 bits, the shift value register comprising fewer than 3 bits; and a normalization stage comprising a first normalization circuit and a second normalization circuit configured in parallel for processing the first intermediate data or the second intermediate data, the first normalization circuit being associated with using the right mantissa for addition, the second normalization circuit being associated with the two’s complement of the right mantissa being used for addition.

14. The device of claim 13 wherein the first input comprises a first input for the first floating-point number, the first input being characterized by a predetermined mantissa width.

15. The device of claim 13 wherein the normalization stage comprises a first data path associated with the first addition operation for processing the first intermediate data including rounding, overflow detection / handling, and formatting, and a second data pathassociated with the second addition operation for processing the second intermediate data including rounding, underflow detection / handling, and formatting, the first data path being configured in parallel to the second data path.

16. A method for performing floating-point operations on an integrated circuit, the method comprising: receiving a first floating-point number comprising a first sign and a first exponent and a first mantissa, the first floating-point number conforming to a first mantissa width of F bits; receiving a second floating-point number comprising a second sign and a second exponent and a second mantissa; computing a first exponent value and a first mantissa value of the first floating-point number and computing a second exponent value and a second mantissa value of the second floating-point number; designating a left addend and a right addend by selecting between the first addend and the second addend, the left addend being characterized by a left sign, a left exponent and a left mantissa value with a bit width of F+1 while the right addend being characterized by a right exponent and a right mantissa, the left addend being larger than or equal to the right addend in absolute value; computing a two’s complement of the right mantissa with a bit width of F+2 (an extra sign bit used by the right shift with sign extension); providing a shifted right value by selecting between the right mantissa and the two’s complement of the right mantissa for performing a right shift operation, the right mantissa being selected for the first sign and the second sign having same signs, the two’s complement of the right mantissa being selected for the first sign and the second sign being opposite signs; obtaining an intermediate data by adding the left mantissa and the shifted right value, the intermediate data comprising a result value and a shift out value, the result value comprising at most F+2 bits and the shift out value comprising of at most 2 bits; and obtaining an output data by normalizing using the intermediate data.

17. The method of claim 16 wherein the shift right value comprises F+1 bits.

18. The method of claim 16 wherein the normalizing comprises rounding off a least significant bit and performing a right shift if there is a carry due to the rounding.

19. The method of claim 18 wherein the normalizing, for the right mantissa being selected for the first sign and the second sign having same signs, comprises right shifting mantissa by one bit if there is carry due to the first addition operation and another right shifting if there is a carry due to the rounding off a least significant bit or no shifting otherwise, and performing overflowing detection and handling.

20. The method of claim 19 wherein the normalizing, for the two’s complement of the right mantissa being selected for the first sign and the second sign being opposite signs, comprises performing left shifting mantissa by an amount equal to a minimum value of the left exponent value and a number of leading 0’s in the first (F + 1) bits after carry bit, and performing overflowing detection and handling.

Citation Information

Patent Citations

  • Multipurpose functional unit with multiply-add and format conversion pipeline

    US20060149803A1

  • Apparatus and method for performing fused multiply add floating point operation

    US20110040815A1

  • Floating-point adder

    US20130007084A1

Cited By

  • Floating-point number multiplication method and floating-point number multiplication circuit

    CN120780267A