An approximate floating-point multiplier based on Chebyshev polynomials

By introducing Chebyshev polynomial approximation technology into the floating-point multiplier and optimizing floating-point multiplication operations using logarithmic and exponential conversion modules, the problems of uneven error distribution and high hardware resource consumption are solved, achieving higher computational accuracy and energy efficiency.

CN121680775BActive Publication Date: 2026-04-21EHIWAY MICROELECTRONIC SCI & TECH (SUZHOU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
EHIWAY MICROELECTRONIC SCI & TECH (SUZHOU) CO LTD
Filing Date
2026-02-12
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing approximate floating-point multiplication techniques suffer from uneven error distribution, systematic bias, and large maximum error, which affect their applicability in precision-sensitive scenarios and consume high hardware resources.

Method used

Chebyshev polynomials are used for mantissa approximation. The input single-precision floating-point mantissa is converted into a base-2 logarithmic approximation and an exponential approximation through a logarithmic conversion module and an exponential conversion module. An adder is used for the operation, and the calculation process is optimized by combining leading zero detection and a shifter.

Benefits of technology

It achieves a more uniform error distribution with low hardware overhead, reduces the maximum error, and improves computational accuracy and energy efficiency, making it suitable for high-stability signal processing and artificial intelligence inference scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121680775B_ABST
    Figure CN121680775B_ABST
Patent Text Reader

Abstract

This invention provides an approximate floating-point multiplier based on Chebyshev polynomials, comprising: two logarithmic conversion modules that perform logarithmic function operations based on Chebyshev polynomials to convert the input single-precision floating-point mantissas into logarithmic approximations with base 2; an adder that performs addition operations on the two logarithmic approximations; and an exponentiation conversion module that performs exponentiation function operations based on Chebyshev polynomials to convert the data output by the adder into exponentiation approximations with base 2. The exponentiation approximation with base 2 output by the exponentiation conversion module is the result of multiplying the two single-precision floating-point mantissas.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of digital signal processing and integrated circuit design technology, and particularly relates to an approximate floating-point multiplier based on Chebyshev polynomials. Background Technology

[0002] Floating-point multipliers are key arithmetic units in applications such as digital signal processing, scientific computing, and artificial intelligence inference. In mainstream floating-point formats like IEEE-754, operations typically involve three steps: sign bit manipulation, exponent addition, and mantissa multiplication. Among these, mantissa multiplication is the main factor contributing to high hardware complexity and power consumption. To improve throughput and reduce energy consumption and chip area, approximation methods are gradually becoming an effective design choice in scenarios where a certain degree of accuracy loss is acceptable, such as convolutional neural networks, image processing, and IoT edge computing.

[0003] Among existing approximate floating-point multiplication techniques, algorithms based on logarithmic domain transformations can effectively reduce hardware resource consumption by converting multiplication into addition and combining it with compensation approximation. However, these methods often suffer from uneven error distribution, systematic bias, and large maximum errors under certain input distributions, affecting their applicability in precision-sensitive scenarios.

[0004] Chebyshev polynomials, as a class of orthogonal polynomials with minimum-maximum error characteristics, can achieve optimal and uniform approximation of the objective function within a given interval and possess more uniform error distribution characteristics. Introducing them into the approximate calculation of the mantissa of floating-point multipliers can significantly reduce the maximum error at lower polynomial orders, which is beneficial for implementing low-latency, small-area, and high-energy-efficiency floating-point multiplier architectures on hardware platforms such as FPGAs and ASICs.

[0005] Therefore, it is necessary to design an approximate floating-point multiplier based on Chebyshev polynomials, which introduces Chebyshev approximation with minimum maximum error characteristics during mantissa operations, thereby effectively reducing errors and improving accuracy and energy efficiency while maintaining low hardware overhead. Summary of the Invention

[0006] This invention provides an approximate floating-point multiplier based on Chebyshev polynomials. It introduces Chebyshev approximation with minimum maximum error characteristics during mantissa operations, which effectively reduces errors and improves accuracy and energy efficiency while maintaining low hardware overhead.

[0007] Other objects and advantages of the present invention can be further understood from the technical features disclosed herein.

[0008] To achieve one, some, or all of the above objectives or other objectives, the present invention provides an approximate floating-point multiplier based on Chebyshev polynomials, comprising: two logarithmic conversion modules, which perform logarithmic function operations based on Chebyshev polynomials to convert the input single-precision floating-point mantissas into logarithmic approximations with base 2; an adder, which performs addition operations on the two logarithmic approximations; and an exponentiation conversion module, which performs exponential function operations based on Chebyshev polynomials to convert the addition result output by the adder into an exponential approximation with base 2; wherein the exponential approximation with base 2 output by the exponentiation conversion module is the result of multiplication of the two single-precision floating-point mantissas.

[0009] It also includes a leading zero detector and a shifter; the leading zero detector detects the number of leading zeros in the input single-precision floating-point mantissa and performs shift processing to make the most significant bit of the single-precision floating-point mantissa 1; the single-precision floating-point mantissa processed by the leading zero detector is sent to the logarithmic conversion module for processing; the shifter performs a right shift operation on the addition result output by the adder based on the sum of the leading zeros output by the two leading zero detectors.

[0010] Both the logarithmic conversion module and the exponential conversion module include a constant register for storing constant terms in the Chebyshev polynomial; a product register for storing iteration terms in the Chebyshev polynomial; and an operation unit that retrieves the iteration terms from the product register, performs multiplication with the coefficients in the iterative formula of the Chebyshev polynomial, adds the result of the multiplication to the constant terms retrieved from the constant register, and outputs the logarithmic or exponential result. The output logarithmic or exponential result is stored in the constant register for the next iteration or directly output.

[0011] The Chebyshev polynomial iteration formulas executed by the logarithmic transformation module and the exponential transformation module are as follows:

[0012]

[0013] In Formulas 1-4, C1, C2, C3, and C4 are coefficients, and C0, CP1, CP2, and CP3 are constant terms. The coefficients and constant term C0 of the Chebyshev polynomial used for exponential and logarithmic operations are different.

[0014] The computational units of the logarithmic conversion module and the exponential conversion module perform exponential function operations and logarithmic function operations based on the obtained different Chebyshev polynomial coefficients and constant term C0.

[0015] The computational unit uses a shift-add method to perform the multiplication operation between the iterative term and the coefficients in the Chebyshev polynomial iterative formula.

[0016] The single-precision floating-point mantissa and the iteration terms are represented using a data format of 2 bits for integers, 10 bits for fractions, and 14 bits for redundancy; the fitting coefficients are quantized as 10 bits of fixed-point binary fractions; the arithmetic unit performs the following data processing on the retrieved iteration term data: based on the fractional data of the selected fitting coefficients, the iteration term data is copied into 10 groups, and a shift operation is performed on each group of iteration terms; in the 10 groups of data, every two groups of data perform corresponding operations based on the result of a set of mask values ​​to output the corresponding operation results.

[0017] The operation of each pair of iteration terms based on the mask value is implemented by a mask circuit, which includes a multiplexer. The multiplexer has four data input terminals and four data output terminals. The data input terminals respectively input: the data of each pair of iteration terms for which the operation is performed, the addition result of the two pairs of iteration terms, and the data 0. Each pair of iteration terms is logically ANDed with itself, and the output logically ANDed result is used as a control signal input to the selection control terminal of the multiplexer. The multiplexer outputs the corresponding result based on the control signal.

[0018] When the control signal is 00, data 0 is output; when the control signal is 10 or 01, the set of data that is not 0 in the two sets of iteration terms is selected for output; when the control signal is 11, the two sets of iteration terms are added together and then output.

[0019] After each pair of iterative terms is processed by the mask circuit, the output is added by an adder to output the result of the multiplication of the iterative term with the coefficients in the Chebyshev polynomial iterative formula.

[0020] Another technical solution of the present invention provides an approximate floating-point multiplier based on Chebyshev polynomials, comprising a register, an order configuration controller, an iterative operation module, an adder, and a state machine; the single-precision floating-point mantissa and the set order for Chebyshev polynomial approximation are input to the register; the iterative operation module includes a logarithmic conversion module and an exponential conversion module, which performs logarithmic or exponential function operations based on Chebyshev polynomials, converting the single-precision floating-point mantissa to a logarithmic approximation with base 2 or converting the logarithmic approximation after addition to a base 2. The adder performs addition on the logarithmic approximation output by the iterative operation module and inputs the addition result into the register for the iterative operation module to retrieve and perform exponential function operation; the order configuration controller determines the number of iterations for the iterative operation module to perform logarithmic or exponential function operation based on the order of the input Chebyshev polynomial approximation; the state machine records the number of iterations when the iterative operation module performs logarithmic or exponential function operation, and controls the iterative operation module to stop iterative operation when the set number of iterations is reached.

[0021] The approximate floating-point multiplier also includes a leading zero detector and a shifter; the leading zero detector detects the number of leading zeros in the input single-precision floating-point mantissa and performs shift processing to make the most significant bit of the single-precision floating-point mantissa 1; the single-precision floating-point mantissa processed by the leading zero detector is sent to the logarithmic conversion module for processing; the shifter performs a right shift operation on the addition result output by the adder based on the sum of the leading zeros output by the two leading zero detectors.

[0022] Both the logarithmic conversion module and the exponential conversion module include a constant register for storing constant terms in the Chebyshev polynomial; a product register for storing iteration terms in the Chebyshev polynomial; and an operation unit that retrieves iteration terms from the product register, performs multiplication with the coefficients in the Chebyshev polynomial iteration formula, adds the multiplication result to the constant terms retrieved from the constant register, and outputs the logarithmic or exponential result. The output logarithmic or exponential result is stored in the constant register for the next iteration or directly output. The Chebyshev polynomial iteration formula executed by the logarithmic conversion module and the exponential conversion module is as follows:

[0023]

[0024] In Formulas 1-4, C1, C2, C3, and C4 are coefficients, and C0, CP1, CP2, and CP3 are constant terms. The coefficients and constant term C0 of the Chebyshev polynomial used for exponential and logarithmic operations are different.

[0025] The single-precision floating-point mantissa and the iteration terms are represented using a data format of 2 bits for integers, 10 bits for fractions, and 14 bits for redundancy; the fitting coefficients are quantized as 10 bits of fixed-point binary fractions; the arithmetic unit performs the following data processing on the retrieved iteration term data: based on the fractional data of the selected fitting coefficients, the iteration term data is copied into 10 groups, and a shift operation is performed on each group of iteration terms; in the 10 groups of data, every two groups of data perform corresponding operations based on the result of a set of mask values ​​to output the corresponding operation results.

[0026] The operation on each pair of iteration terms based on the mask value is implemented using a mask circuit, which includes a multiplexer. The multiplexer has four data inputs and four data outputs. The data inputs are: the data of each pair of iteration terms for the corresponding operation, the result of the addition operation of the two sets of iteration terms, and the data 0. Each pair of iteration terms is logically ANDed with itself, and the output result is used as a control signal input to the selection control terminal of the multiplexer. The multiplexer outputs a corresponding result based on the control signal, including: when the control signal is 00, outputting data 0; when the control signal is 10 or 01, selecting and outputting the non-zero set of data from the two sets of iteration terms; and when the control signal is 11, performing the addition operation on the two sets of iteration terms and then outputting the result.

[0027] After each pair of iterative terms is processed by the mask circuit, the output is added by an adder to output the result of the multiplication of the iterative term with the coefficients in the Chebyshev polynomial iterative formula.

[0028] Compared with existing technologies, the main advantages of this invention include: 1. Compared to methods such as Taylor expansion, which suffer from significantly increased and unevenly distributed errors at interval boundaries, this invention uses Chebyshev polynomials based on the minimum-maximum error criterion for approximation. This achieves a more symmetrical and uniform error distribution across the entire mantissa definition interval, with stronger controllability of the maximum error. This helps suppress error accumulation during computation, making it particularly suitable for signal processing and artificial intelligence inference scenarios where computational stability is critical. 2. Compared to the limited adjustment mechanisms of traditional logarithmic-domain approximation multipliers, this invention achieves flexible reconfiguration of computational accuracy through dynamic configuration of the polynomial order. This design supports multi-level adjustable modes from low power consumption to high precision, allowing for fine-grained energy efficiency and accuracy trade-offs based on actual application needs, enhancing the adaptability and practicality of the hardware in different scenarios. 3. Addressing the sparse distribution of Chebyshev polynomial coefficients, this invention employs a masked adder circuit design, automatically resetting the adder when not involved in computation, thereby reducing overall circuit power consumption.

[0029] To make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0030] To more clearly illustrate the technical solutions in the specific embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0031] Figure 1 The structural framework diagram of the approximate multiplier based on Chebyshev polynomials provided in Embodiment 1 of the present invention is shown.

[0032] Figure 2 This is a diagram illustrating an example of calculating the Chebyshev polynomial iterative formula of this invention.

[0033] Figure 3 This is a circuit diagram of the logarithmic conversion module and the exponential conversion module of the present invention.

[0034] Figure 4 This is a schematic diagram of the mask circuit of the present invention.

[0035] Figure 5 This is a framework diagram of an approximate multiplier iterative structure based on Chebyshev polynomials provided in Embodiment 2 of the present invention. Detailed Implementation

[0036] To facilitate understanding of this application, a more complete description will be provided below with reference to the accompanying drawings, which illustrate preferred embodiments of the application. However, this application may be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of this application will be thorough and complete.

[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.

[0038] It should be understood that when an element or layer is referred to as "on," "adjacent to," or "connected to" other elements or layers, it may be directly on, adjacent to, connected to, or coupled to other elements or layers, or there may be intervening elements or layers. It should be understood that although the terms first, second, third, etc., may be used to describe various elements, components, regions, layers, doping types, and / or portions, these elements, components, regions, layers, doping types, and / or portions should not be limited by these terms. These terms are only used to distinguish one element, component, region, layer, doping type, or portion from another element, component, region, layer, doping type, or portion. Therefore, without departing from the teachings of this application, the first element, component, region, layer, doping type, or portion discussed below may be referred to as a second element, component, region, layer, or portion.

[0039] When used herein, the singular forms of “a,” “an,” and “the” may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that when the terms “comprise” and / or “comprising” are used in this specification, the presence of the stated feature, integer, step, operation, element, and / or part is established, but the presence or addition of one or more other features, integers, steps, operations, elements, parts, and / or groups is not excluded. Meanwhile, when used herein, the term “and / or” includes any and all combinations of the associated listed items.

[0040] Embodiments of the invention are described herein with reference to cross-sectional views illustrating preferred embodiments (and intermediate structures) of this application, thus allowing for the anticipation of variations in the illustrated shapes due to, for example, manufacturing techniques and / or tolerances. Embodiments of this application should not be limited to the specific shapes of the regions shown herein, but rather include shape deviations due to, for example, manufacturing techniques. Therefore, the regions shown in the figures are substantially schematic, and their shapes do not represent the actual shapes of regions of the device, nor do they limit the scope of this application.

[0041] Example 1

[0042] Example 1 provides an approximate floating-point multiplier based on Chebyshev polynomials, such as Figure 1 As shown, the approximate floating-point multiplier includes: two logarithmic conversion modules CP-log, which implement logarithmic function operations based on Chebyshev polynomials to convert the input single-precision floating-point mantissa into a logarithmic approximation with base 2; an adder Adder, which performs addition operations on the two logarithmic approximations; and an exponential conversion module CP-exp, which implements exponential function operations based on Chebyshev polynomials to convert the data output by the adder into an exponential approximation with base 2; the exponential approximation with base 2 output by the exponential conversion module is the result of multiplying the two single-precision floating-point mantissas.

[0043] The approximate floating-point multiplier provided in Example 1 is used for operations on single-precision floating-point mantissas. The operation process involves representing the multiplication of the single-precision floating-point mantissas Ma and Mb as an exponential form with base 2, as shown in Formula 1 below:

[0044]

[0045] Therefore, to perform the multiplication operation of this single-precision floating-point mantissa, the key is to convert the floating-point mantissa into a base-2 logarithm, perform the addition operation, and then convert it into a base-2 exponential operation.

[0046] The approximate multiplier in Implementation Example 1, such as Figure 1 As shown, the process of logarithmic and exponential transformations is implemented through logarithmic and exponential transformation modules, and the addition operation of the two logarithmic transformation results is implemented through an adder. Figure 1 In order to realize the calculation process of Formula 1, the most critical step of the circuit is to convert the input single-precision floating-point mantissa into a base-2 logarithm and to convert the logarithmic result after addition into a base-2 exponent.

[0047] Example 1 uses a logarithmic conversion module CP-log to convert the input single-precision floating-point mantissa into a base-2 logarithm and an exponential conversion module CP-exp to convert the addition result of the adder into a base-2 exponential. Both the logarithmic conversion module and the exponential conversion module are based on Chebyshev polynomial approximation and are implemented by hardware circuit design of Chebyshev polynomials.

[0048] Chebyshev polynomials have important applications in approximation theory. The roots of Chebyshev polynomials of the first kind can serve as interpolation nodes, and the constructed interpolation polynomials can minimize the Runge phenomenon and achieve optimal uniform approximation on continuous functions. This invention uses Chebyshev polynomials of the first kind for function approximation, and its recursive relations are shown in Equations 2-1 to 2-3:

[0049]

[0050] The function f(x) is approximated using Chebyshev polynomials, and its expansion formula is shown in Equations 2-4 to 2-6:

[0051]

[0052] For exponential and logarithmic functions with base 2, applying the Chebyshev polynomial recursive formula for expansion and approximation ensures that the maximum error is evenly distributed throughout the entire interval, thus obtaining a more stable approximation accuracy.

[0053] According to formulas 2-1 to 2-3, we can obtain the following... Figure 3The diagram shows the basic circuit diagrams of the logarithmic conversion module CP-log and the exponential conversion module CP-exp.

[0054] Based on equations 2-1 to 2-3, iterative formulas as shown in equations 3-1 to 3-4 can be derived:

[0055]

[0056] Among them, the fitting coefficients (i.e., coefficients C1, C2, C3, C4 and constant term C0 in formulas 3-1 to 3-4) in exponential and logarithmic operations can be obtained by fitting formulas 2-4 to 2-6. The fitting process can be performed using MATLAB. The specific values ​​of the coefficients and constant term C0 are shown in Tables 1 and 2 below.

[0057] Table 1: Quantization coefficients of the Chebyshev polynomial logarithmic function fit

[0058]

[0059] Table 2: Quantization coefficients of the Chebyshev polynomial exponential function fit

[0060]

[0061] When calculating the multiplication of the fitting coefficients and the iteration terms, the fitting coefficients in the table above are all quantized into 10-bit fixed-point binary decimals.

[0062] In this invention, the Chebyshev polynomials can be configured to orders 2-4, and the average relative error (MRE) of the obtained computational results is within 10. -2 Up to 10 -4 Between, the mean squared error (MSE) is 10 -4 Up to 10 -6 Compared to most logarithmic approximation multipliers, the approximation multiplier provided in this invention utilizes a fitting method based on the logarithmic and exponential functions of Chebyshev polynomials. When implementing floating-point mantissa multiplication, iteratively applying the orders of the log and exp functions within a defined interval significantly reduces the approximation error. Unlike traditional schemes based on Taylor expansion or simple polynomial interpolation, Chebyshev polynomials possess the mathematical property of minimizing the maximum error, maintaining a more uniform approximation accuracy across the entire interval and avoiding the problem of excessively high local accuracy leading to a sudden increase in boundary error. Furthermore, Chebyshev polynomials achieve high fitting accuracy at lower orders, reducing the number of multiplication and addition operations required, facilitating hardware implementation; their coefficients are more suitable for quantization and sparsification processing with finite bit widths, and multiplication operations can be replaced by shifting and addition, thereby reducing area and power consumption while maintaining accuracy.

[0063] Example diagram of iterative calculation for the logarithmic transformation module and the exponential transformation module provided in Example 1 is shown below. Figure 2 As shown, the circuit structures of the logarithmic conversion module and the exponential conversion module are as follows: Figure 3 as well as Figure 4 As shown, the circuit structures of the logarithmic conversion module and the exponential conversion module are the same. The difference lies in the coefficients (C1, C2, C3, C4) and the constant term C0 of the Chebyshev polynomial used when performing exponential or logarithmic operations.

[0064] like Figure 3 The circuit structures of the logarithmic conversion module and the exponential conversion module shown include the approximate multiplier iterative structure CPR, which is composed of a CTR part and a PTR part. The CTR part is a constant register used to store the constant terms in the Chebyshev polynomial. It stores the original data part of each iteration (as shown in Equation 3-1, the constant term C0 is the original part; as shown in Equation 3-2, the constant term CP1 is the calculation result of Equation 3-1, which is stored in the CTR as a constant term in Equation 3-2 during iterative calculation; the operations of Equations 3-3 and 3-4 are similar). The PTR part is a product register used to store the iterative terms in the Chebyshev polynomial. It stores the iterative terms of each iteration operation (as shown in Equation 3-1, T is the initial product operation iterative term; in Equation 3-2, (2T×T-1) is the product operation iterative term of the second-order operation; all the above values ​​are stored in the PTR).

[0065] like Figure 3 As shown, the multiplication operation of the product term is implemented using a shift-and-add method. The operation unit copies the iteration term data into 10 sets of data (e.g., ...). Figure 3 That is, PTR[0]-PTR[9]), where the 10 sets are copied based on the number of decimal places of the fitting coefficients (as mentioned above, the fitting coefficients are quantized into 10-bit fixed-point decimals, so the data of each iteration term is copied, so 10 sets of data can be copied, and then the fitting coefficients of each set are shifted based on the fitting decimals). The 10 sets of iteration terms are shifted based on the fitting coefficients. The specific shifting operation steps are: expand the 10-bit fixed-point binary decimals, start indexing from the first digit after the decimal point, find each data "1", and record the position of each data "1", and perform a right shift operation based on the position.

[0066] Taking the binary fitting coefficient 0.1001010010 as an example, the 0th, 3rd, 5th and 8th bits of this binary fitting coefficient are all data "1". Therefore, the iterative terms that are multiplied can be copied into 10 groups, and the following operations can be performed: PTR[0] shifted right by one bit, PTR[3] shifted right by 4 bits, PTR[5] shifted right by 6 bits, PTR[8] shifted right by 9 bits, and the data in other PTR[9:0] are changed to all 0.

[0067] There are 5 groups in total, with each pair of data in the 10 groups forming a group. Each pair of data in each group performs corresponding operations based on the result of a mask value to output the corresponding operation result (e.g., PTR[0] and PTR[1] perform operations based on the result of mask[1:0].

[0068] The operation unit uses four different sets of mask values ​​to represent the calculation process of each group. The result of each group is output to the adder, and the results of every two adjacent groups are added to output the final shift-add result.

[0069] The operation based on the mask value for each pair of data is implemented using a mask circuit, such as... Figure 4 The mask circuit shown includes a multiplexer; the multiplexer includes four data input terminals (11, 10, 01, and 00) and four data output terminals; the data input terminals respectively input: each pair of iteration terms (PTR[m], PTR[n]) for the corresponding operation, the addition result of the two sets of iteration terms, and the data 0, where PTR[m] and PTR[n] are input to terminals 10 and 01 respectively, the addition result of PTR[m] and PTR[n] is input to terminal 11, and the data 0 is input to terminal 00. The selection control terminal of the multiplexer is respectively input to the logical AND operation result of PTR[m] and PTR[n] with itself (… Figure 3 The result of the logical AND operation between &PTR[m], &PTR[n], PTR[m], and PTR[n] and themselves is 0 or 1. The multiplexer outputs based on the control signal. Specifically, when the output control signal is 00, data 0 is output from port 00 on the multiplexer. When the output control signal is 10 or 01, the non-zero data from the two sets of iteration terms is selected for output (output from port 10 or port 01). When the output control signal is 11, the two sets of iteration terms are added and then output (output from port 11).

[0070] For the data processing procedure, please refer to [link / reference]. Figure 2The example shown uses a data format of 2 bits for integers, 10 bits for decimals, and 14 bits for redundancy (23 bits for single-precision floating-point mantissas, and 24 bits for decimals and redundancy to improve truncation precision). The fitting coefficients C0 and C1 use the data shown in Table 1. This fitting example uses first-order data (i.e., the first-order data approximation in Formula 3-1; Formulas 3-2 to 3-4 represent second-order, third-order, and fourth-order approximations, respectively). Data A represents the Chebyshev polynomial coefficients C0, and data B represents the Chebyshev polynomial C1×T, where C1 represents the first-order coefficients of the Chebyshev polynomial, and T represents the value obtained by orthogonal transformation of the Chebyshev polynomial. In CP-log, the orthogonal transformation formula is 2X-3, and in CP-exp, the orthogonal transformation formula is 2X-1. Figure 2 In the example, data A is 0.54296857 (00.100010112), C1 is 0.4951171875 (00.01111110112), and T is 0.40625 (00.011012). The data structure is as follows: Figure 2 As shown, data B represents the product of each term in C1×T, implemented using shift-and-add. Data B' is based on... Figure 4 The circuit in the diagram combines the mask value with the result of the calculation of each set of iterative terms. Data B” is the result of the addition operation based on the result of the calculation of each set of iterative terms. Finally, the addition operation of B” and A is performed to obtain the final calculation result. This structure is reused in each Chebyshev polynomial fitting calculation, which can effectively reduce the resource consumption and high latency path caused by multiplication calculation.

[0071] Among them, in Example 1 Figure 1 The logarithmic conversion module and exponential conversion module of the approximate multiplier shown can perform iterative operations based on a set number of iterations.

[0072] As an optional implementation, the approximate multiplier provided in Embodiment 1 further includes a leading zero detector and a shifter; the leading zero detector (LOD) detects the number of leading zeros in the input single-precision floating-point mantissa and performs left shift processing, so that the most significant bit of the single-precision floating-point mantissa is 1; the single-precision floating-point mantissa processed by the leading zero detector is sent to the logarithmic conversion module for processing; the shifter performs a right shift operation on the operation result output by the adder based on the sum of the leading zeros output by the two leading zero detectors.

[0073] The reason for using a leading zero detector for detection and displacement is that when the mantissa is very close to 1.0 (e.g., 1.000000001), the base-2 logarithm will be very close to 0, but the relative error in calculating it may be amplified. Furthermore, in this region, the curvature of the function is large, making polynomial approximation more difficult. Therefore, leading zero detection and shifting can avoid these problems, resulting in a more uniform and lower relative error when performing polynomial approximation. The use of a shifter to perform a right shift based on the sum of the leading zero detector is to compensate for the shifting operation of the leading zero detection module.

[0074] Example 2

[0075] Example 2 provides an approximate floating-point multiplier capable of automatic iterative computation. The difference between Example 2 and Example 1 is that Example 2 uses an iterative computation module CPR instead of... Figure 1 In the CP-log and CP-exp operations, based on the set operation order, the iterative operation module first performs logarithmic operations and then exponential operations.

[0076] Example 2 provides an approximate floating-point multiplier based on Chebyshev polynomials, see [link to example]. Figure 5 It includes an Input Register, an Order Configuration Controller (Ctrl-CP), an Iterative Operation Module (CPR), an Adder, and a State Machine (FSM).

[0077] The register receives the single-precision floating-point mantissa (Ma and Mb) from external input and the set Chebyshev polynomial approximation order (CP-mode).

[0078] The iterative operation module retrieves the single-precision floating-point mantissa of the external input from the register, performs a logarithmic function operation to output a logarithmic approximation, and feeds the logarithmic approximation back to the register. The adder searches for the logarithmic approximation in the register, performs an addition operation, and feeds the addition result back to the register. At this time, the iterative operation module finds the addition result of the logarithmic approximation in the register, performs an exponential function operation, and converts the addition result into an exponent with base 2.

[0079] In contrast to the scheme in Embodiment 1, Embodiment 2 controls the iterative calculation process through a state machine. Specifically, the order configuration controller determines the number of iterations for the iterative calculation module to perform logarithmic or exponential function operations based on the order of the input Chebyshev polynomial approximation. The state machine records the number of iterations when the iterative calculation module performs logarithmic or exponential function operations, and controls the iterative calculation module to stop iterative calculation when the set number of iterations is reached. The state machine can perform iterative control of data.

[0080] Compared to Example 1, the circuit structure of Example 2 can reduce the hardware circuit area by up to 60% (Example 1 reuses the iterative operation module CPR, eliminating the need to set up a logarithmic conversion module and an exponential conversion module as described in Example 1, thus saving hardware circuit area). It can play an important role in resource-constrained edge computing applications using approximate multipliers.

[0081] The iterative operation module CPR in Example 2 has the same circuit structure as the logarithmic transformation module and the exponential transformation module in Example 1. The logarithmic and exponential transformation modules in Example 1 achieve logarithmic and exponential transformations by selecting different coefficients and constant terms C0. Similarly, the iterative operation module CPR in Example 2 achieves logarithmic and exponential transformations by selecting different coefficients and constant terms C0. Example 1 has already described the logarithmic and exponential transformation modules in detail. The iterative operation module CPR in Example 2 has the same circuit structure and functional implementation as the logarithmic and exponential transformation modules, and will not be described in detail here.

[0082] As an optional implementation, the approximate multiplier provided in Embodiment 2 further includes a leading zero detector (LOD) and a shifter. The leading zero detector (LOD) detects the number of leading zeros in the input single-precision floating-point mantissa and performs a left shift, so that the most significant bit of the single-precision floating-point mantissa is 1. The single-precision floating-point mantissa processed by the leading zero detector is sent to the iterative operation module (CPR) to perform logarithmic function operation and output an approximate logarithmic value. The shifter, based on the sum of the leading zeros output by the two leading zero detectors, performs a right shift operation on the logarithmic approximation value output by the adder.

[0083] The reason for using a leading zero detector for detection and displacement is that when the mantissa is very close to 1.0 (e.g., 1.000000001), the base-2 logarithm will be very close to 0, but the relative error in calculating it may be amplified. Furthermore, in this region, the curvature of the function is large, making polynomial approximation more difficult. Therefore, leading zero detection and shifting can avoid these problems, resulting in a more uniform and lower relative error when performing polynomial approximation. The use of a shifter to perform a right shift based on the sum of the leading zero detector is to compensate for the shifting operation of the leading zero detection module.

[0084] The foregoing has provided a detailed description of an approximate floating-point multiplier based on Chebyshev polynomials provided by this invention. Specific examples have been used to illustrate the structure and working principle of this invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this invention. It should be noted that those skilled in the art can make various improvements and modifications to this invention without departing from its principles, and these improvements and modifications also fall within the scope of protection of the claims of this invention.

Claims

1. An approximate floating-point multiplier based on Chebyshev polynomials, characterized in that, include: Two logarithmic conversion modules, based on Chebyshev polynomials, implement logarithmic function operations to convert the input single-precision floating-point mantissa into a logarithmic approximation with base 2; An adder performs an addition operation on two of the said logarithmic approximations; The exponent conversion module implements exponential function operations based on Chebyshev polynomials, converting the addition result output by the adder into an exponential approximation with base 2. The exponent conversion module outputs a base-2 exponent approximation value, which is the result of multiplying two single-precision floating-point mantissas. Both the logarithmic conversion module and the exponential conversion module include a constant register, which is used to store the constant terms in the Chebyshev polynomial. The product register is used to store the iteration terms in the Chebyshev polynomial; The arithmetic unit retrieves the iteration term from the product register and performs a multiplication operation with the coefficients in the Chebyshev polynomial iteration formula, adds the multiplication result to the constant term retrieved from the constant register, and outputs the logarithmic operation result or the exponential operation result. The output logarithmic or exponential result is stored in the constant register for the next iteration or directly output. The Chebyshev polynomial iteration formulas executed by the logarithmic transformation module and the exponential transformation module are as follows: In Formulas 1-4, C1, C2, C3, and C4 are coefficients, C0, CP1, CP2, and CP3 are constant terms, and T represents the value obtained by orthogonal transformation of the Chebyshev polynomial. The coefficients and constant term C0 of the Chebyshev polynomial used for exponential and logarithmic operations are different.

2. The approximate floating-point multiplier based on Chebyshev polynomials according to claim 1, characterized in that, It also includes a leading zero detector and a shifter; The leading zero detector detects the number of leading zeros in the input single-precision floating-point mantissa and performs shift processing to make the most significant bit of the single-precision floating-point mantissa 1. The single-precision floating-point mantissa, after being processed by the leading zero detector, is sent to the logarithmic conversion module for further processing. The shifter performs a right shift operation on the addition result output by the adder, based on the sum of the leading zeros output by the two leading zero detectors.

3. The approximate floating-point multiplier based on Chebyshev polynomials according to claim 1, characterized in that, The computational units of the logarithmic conversion module and the exponential conversion module perform exponential function operations and logarithmic function operations based on the obtained different Chebyshev polynomial coefficients and constant term C0.

4. The approximate floating-point multiplier based on Chebyshev polynomials according to claim 1, characterized in that, The computational unit uses a shift-add method to perform the multiplication operation between the iterative term and the coefficients in the Chebyshev polynomial iterative formula.

5. An approximate floating-point multiplier based on Chebyshev polynomials according to claim 4, characterized in that, The single-precision floating-point mantissa and the iteration term are represented using a data format of 2 bits for integers, 10 bits for fractions, and 14 bits for redundancy. The fitting coefficients are quantized as 10-bit fixed-point binary decimals; The processing unit performs the following data processing on the retrieved iteration term data: based on the decimal places of the selected fitting coefficients, the iteration term data is copied into 10 groups, and a shift operation is performed on the iteration terms in each group; In each pair of 10 sets of data, corresponding operations are performed based on the result of a mask value to output the corresponding operation result.

6. The approximate floating-point multiplier based on Chebyshev polynomials according to claim 5, characterized in that, The corresponding operation is performed on every two sets of iteration terms based on the result of the mask value, which is implemented by a mask circuit including a multiplexer; The multiplexer includes four data input terminals and four data output terminals; The data input terminal respectively inputs: the data of each pair of iteration terms for performing the corresponding operation, the addition result of the two sets of iteration terms, and the data 0; Each pair of iterative data items is logically ANDed with itself, and the output logical AND result is used as a control signal input to the selection control terminal of the multiplexer; The multiplexer outputs a corresponding result based on the control signal.

7. An approximate floating-point multiplier based on Chebyshev polynomials according to claim 6, characterized in that, When the control signal is 00, data 0 is output; When the control signal is 10 or 01, select the set of data that is not 0 in the two sets of iteration terms to output; When the control signal is 11, the two sets of iterative terms are added together and then output.

8. An approximate floating-point multiplier based on Chebyshev polynomials according to claim 7, characterized in that, After each pair of iterative terms is processed by the mask circuit, the output is added by an adder to output the result of the multiplication of the iterative term with the coefficients in the Chebyshev polynomial iterative formula.

9. An approximate floating-point multiplier based on Chebyshev polynomials, characterized in that, This includes registers, an order configuration controller, an iterative operation module, an adder, and a state machine; The single-precision floating-point mantissa and the set Chebyshev polynomial approximation order are input into the register; The iterative operation module includes a logarithmic conversion module and an exponential conversion module. It performs logarithmic or exponential function operations based on Chebyshev polynomials, converting the single-precision floating-point mantissa into a logarithmic approximation with base 2 or converting the logarithmic approximation after addition into an exponential approximation with base 2. Both the logarithmic conversion module and the exponential conversion module include a constant register, which is used to store the constant terms in the Chebyshev polynomial. The product register is used to store the iteration terms in the Chebyshev polynomial; The arithmetic unit retrieves the iteration term from the product register and performs a multiplication operation with the coefficients in the Chebyshev polynomial iteration formula, adds the multiplication result to the constant term retrieved from the constant register, and outputs the logarithmic operation result or the exponential operation result. The output logarithmic or exponential result is stored in the constant register for the next iteration or directly output. The Chebyshev polynomial iteration formulas executed by the logarithmic transformation module and the exponential transformation module are as follows: In Formulas 1-4, C1, C2, C3, and C4 are coefficients, C0, CP1, CP2, and CP3 are constant terms, and T represents the value obtained by orthogonal transformation of the Chebyshev polynomial. The coefficients and constant term C0 of the Chebyshev polynomial used for exponential and logarithmic operations are different. The adder performs addition on the logarithmic approximation output by the iterative operation module and inputs the addition result into the register for the iterative operation module to retrieve and perform exponential function operations. The order configuration controller determines the number of iterations for the iterative operation module to perform logarithmic or exponential function operations based on the order of the input Chebyshev polynomial approximation. The state machine records the number of iterations performed by the iterative calculation module when it executes logarithmic or exponential function calculations, and controls the iterative calculation module to stop iterative calculations when the set number of iterations is reached.

10. An approximate floating-point multiplier based on Chebyshev polynomials according to claim 9, characterized in that, The approximate floating-point multiplier also includes a leading zero detector and a shifter; The leading zero detector detects the number of leading zeros in the input single-precision floating-point mantissa and performs shift processing to make the most significant bit of the single-precision floating-point mantissa 1. The single-precision floating-point mantissa, after being processed by the leading zero detector, is sent to the logarithmic conversion module for further processing. The shifter performs a right shift operation on the addition result output by the adder, based on the sum of the leading zeros output by the two leading zero detectors.

11. An approximate floating-point multiplier based on Chebyshev polynomials according to claim 9, characterized in that, The single-precision floating-point mantissa and the iteration term are represented using a data format of 2 bits for integers, 10 bits for fractions, and 14 bits for redundancy. The fitting coefficients are quantized as 10-bit fixed-point binary decimals; The processing unit performs the following data processing on the retrieved iteration term data: based on the decimal places of the selected fitting coefficients, the iteration term data is copied into 10 groups, and a shift operation is performed on the iteration terms in each group; In each pair of 10 sets of data, corresponding operations are performed based on the result of a mask value to output the corresponding operation result.

12. The approximate floating-point multiplier based on Chebyshev polynomials according to claim 9, characterized in that, The corresponding operation is performed on every two sets of iteration terms based on the result of the mask value, which is implemented by a mask circuit including a multiplexer; The multiplexer includes four data input terminals and four data output terminals; The data input terminal respectively inputs: the data of each pair of iteration terms for performing the corresponding operation, the addition result of the two sets of iteration terms, and the data 0; Each pair of iterative data items is logically ANDed with itself, and the output logical AND result is used as a control signal input to the selection control terminal of the multiplexer; The multiplexer outputs a corresponding result based on the control signal, including: when the control signal is 00, data 0 is output; When the control signal is 10 or 01, select the set of data that is not 0 in the two sets of iteration terms to output; When the control signal is 11, the two sets of iterative terms are added together and then output.

13. An approximate floating-point multiplier based on Chebyshev polynomials according to claim 12, characterized in that, After each pair of iterative terms is processed by the mask circuit, the output is added by an adder to output the result of the multiplication of the iterative term with the coefficients in the Chebyshev polynomial iterative formula.

Citation Information

Patent Citations

  • Logarithmic approximation floating point multiplication accelerator algorithm and circuit thereof

    CN118377457A

  • Method for realizing multi-scroll neuron circuit based on FPGA (Field Programmable Gate Array) technology of optimal linear approximation

    CN118607603A