A high-performance function generator based on BKM algorithm

Through the improved BKM algorithm, combined with the E/L mode range reduction unit and the IBKM iteration unit, the accuracy and efficiency problems of the existing exponential/logarithmic function calculation circuit are solved, and a high-performance function generator is realized, which is suitable for neural networks, wireless communications and information encryption systems.

CN119126915BActive Publication Date: 2025-09-19SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411106366.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2025-09-19
Estimated Expiration
2044-08-13

AI Technical Summary

Technical Problem

Existing exponential/logarithmic function calculation circuits have problems such as low calculation accuracy, high resource overhead, and long execution time. In particular, they lack high-performance design in high-speed and high-precision applications.

Method used

The improved BKM algorithm is adopted to realize efficient calculation of exponential/logarithmic functions by using simple comparison, shift and addition operations through the E/L mode range reduction unit and the IBKM iterative unit, which quickly converges to the function value using the iteration factor.

Benefits of technology

It achieves high computing speed, high computing accuracy, low resource overhead, wide computing range and high scalability, low hardware design complexity and high hardware resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119126915B_ABST
    Figure CN119126915B_ABST
Patent Text Reader

Abstract

The present invention discloses a high-performance function generator based on the BKM algorithm, which relates to the technical field of function calculation circuits. This solution is proposed to address the problem of insufficient performance of calculation circuits in the prior art. It includes an E / L-mode range reduction unit and an IBKM iteration unit driven by signals in sequence; the E / L-mode range reduction unit selects E mode or L mode according to the calculation mode signal M to perform range mapping on the input variable x, and the IBKM iteration unit performs an iterative process. In the kth iteration, by comparing the current iteration value E k and the corresponding dynamic demarcation point A Ek 、B Ek The size of the current iteration value L k and the corresponding dynamic demarcation point A Lk 、B Lk The size of the iteration factor d under the current iteration step is obtained in {‑1,0,1} k , so that the current iteration result L k+1 、E k+1 The iterative equations converge to the corresponding function value. The advantages are: high calculation speed and accuracy, low complexity; wide calculation range, high scalability; low hardware complexity, low cost, and high utilization rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of function calculation circuits, and in particular to a high-performance function generator based on a BKM algorithm. Background Art

[0002] Exponential and logarithmic functions have crucial applications in a wide range of fields, including natural sciences, engineering, economics, finance, and data analysis. They provide powerful mathematical tools for describing and analyzing various dynamic processes. Circuits that calculate exponential and logarithmic functions are crucial components of specialized applications, such as neural network systems, wireless communication systems, and information encryption systems. Their computational speed and accuracy significantly impact the performance of the entire system.

[0003] While traditional exponential / logarithmic function calculation circuits based on a single lookup table offer simple hardware implementation, they often suffer from low computational accuracy or high storage resource overhead, and their execution time increases as the computational scale increases. Exponential / logarithmic function calculation circuits based on piecewise linear interpolation offer relatively simple hardware implementation and fast computational speed, but they suffer from limited computational accuracy, unstable segmentation parameters, and high storage requirements. Exponential / logarithmic function calculation circuits based on Taylor expansions reduce the complexity of exponential / logarithmic calculations, but their computational range and accuracy are limited, and their circuit complexity and hardware resource consumption increase with the order of the expansion. Exponential / logarithmic function calculation circuits based on the CORDIC algorithm (coordinate rotation digital algorithm) employ simple shift-and-add operations, resulting in a relatively simple hardware structure. However, for high-speed, high-precision applications, their iteration cycles are long and convergence is often slow. In 1994, Jean-Claude Bajard, Sylvanus Kla, and Jean-Michel Muller first published the BKM algorithm, a shift-and-add algorithm for calculating elementary functions. The BKM algorithm uses a pre-calculated logarithmic table to calculate elementary functions using addition, shift, and comparison operations. However, circuits for calculating exponential / logarithmic functions based on the BKM algorithm still have shortcomings such as slow convergence speed and low calculation accuracy.

[0004] In summary, there is currently no good design solution for an exponential / logarithmic function calculation circuit that is simple to implement in hardware and has high calculation speed, high calculation accuracy, and low resource overhead. Summary of the Invention

[0005] The present invention aims to provide a high-performance function generator based on the BKM algorithm to solve the problems existing in the above-mentioned prior art. The IBKM (Improved BKM) algorithm is an improvement on the BKM algorithm in the prior art and mainly includes two calculation modes: exponential and logarithmic functions.

[0006] The high-performance function generator based on the BKM algorithm described in the present invention includes an E / L mode range reduction unit and an IBKM iteration unit driven by signals in sequence;

[0007] The E / L mode range reduction unit selects the E mode or the L mode according to the calculation mode signal M to perform range mapping on the input variable x; the E mode is used to calculate the exponential function, and the L mode is used to calculate the logarithmic function;

[0008] In the kth iteration, by comparing the current iteration value E k and the corresponding dynamic demarcation point A Ek 、B Ek The size of the current iteration value L k and the corresponding dynamic demarcation point A Lk 、B Lk The size of the iteration factor d under the current iteration step is obtained in {-1,0,1} k , so that the iteration result L of the current iteration step k+1 、E k+1 According to the iterative equations Converge to the corresponding function value;

[0009] Where k is a positive integer, 1≤k≤n, and n is the total number of iterations;

[0010] In E mode, the iteration initial value E1 satisfies In L mode, the iteration initial value L1 satisfies Iteration factor d in the kth iteration k ∈{-1,0,1}.

[0011] The input variable x consists of a 1-bit sign, a 1-bit integer, and an F-bit fractional number.

[0012] In E mode, according to Choose the iteration factor d k The value of; Among them, the dynamic demarcation point A Ek =ln(1-2 -() ), dynamic demarcation point B Ek =ln(1+2 -() ); the initial value is Mapping Index By selecting the sign bit, the lower integer bit and the F-bit fraction bit of the input variable x and -19·2 -4 The calculation of the initial value E1 is realized by adding, and the calculation of the mapping index C is realized by selecting the sign bit and the high (I-1) bit integer bit of the input variable x. 2C The lookup table realizes the calculation of the initial value L1;

[0013] In L mode, according to Choose the iteration factor d k The value of ; Among them, the dynamic demarcation point Dynamic cutoff point The initial value is Mapping Index First, check the sign bit of the input variable x. If the input variable x is negative or 0, the input value does not meet the calculation requirements of the logarithmic function and the calculation is terminated. Otherwise, perform an OR logic operation on every 2 bits of the input variable x and input the logic calculation result into a high-order priority encoder to realize the calculation of 2C. Shift the input variable x right by 2C bits to realize the calculation of the initial value L1. Multiply 2C by ln(2) or use a 2C·ln(2) lookup table to realize the calculation of the initial value E1.

[0014] The IBKM iteration unit includes one or several IBKM iterators followed by an output selector; iterative calculation is achieved by time-division multiplexing one IBKM iterator or connecting multiple IBKM iterators in series; the output selector is controlled by the calculation mode signal to select the corresponding final iteration result for output.

[0015] The IBKM iterator follows the iterative equations Realize the kth iteration and realize the dynamic demarcation point A of the E mode through the selector according to the calculation mode signal M Ek 、B Ek Or L mode dynamic demarcation point A Lk 、B Lk The input is used to compare the current iteration value E through a mixed comparator. k Dynamic demarcation point A Ek 、B Ek or the current iteration value L k Dynamic demarcation point A Lk 、B Lk The size relationship of , to achieve the iteration factor or Calculation.

[0016] The high-performance function generator based on the BKM algorithm described in the present invention has the following advantages:

[0017] (1) High computational speed, high computational accuracy, and low computational complexity. The proposed improved BKM algorithm compares the current iteration value with the dynamic demarcation point to obtain a suitable iteration factor, which allows the iteration result to converge to the ideal value at a faster rate. The accuracy of the function calculation can be controlled by adjusting the number of iterations. The iterative process is simple, and the more iterations, the higher the computational accuracy.

[0018] (2) It has a wide calculation range and high scalability. By adjusting the bit width of the input variable, the exponential function or logarithmic function of any variable can be calculated; by selecting an appropriate lookup table, the exponential function or logarithmic function of any base can be calculated.

[0019] (3) Low hardware design complexity, low hardware resource cost, and high hardware resource utilization. The iterative process involved requires only simple comparison, shift, and addition operations, resulting in a simple circuit structure. The range reduction unit uses simple operations such as table lookup, addition, priority encoding, and shifting to implement complex range mapping, reducing hardware costs. In addition, the IBKM iterator can perform time-division multiplexing operations during calculations, resulting in high hardware resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a structural diagram of the high-performance function generator described in the present invention.

[0021] Figure 2 It is a structural diagram of the first embodiment of the high-performance function generator described in the present invention.

[0022] Figure 3 It is a structural diagram of the second embodiment of the high-performance function generator described in the present invention.

[0023] Figure 4 This is a schematic diagram of the circuit principle of the E / L mode range reduction unit in the present invention when the E mode is selected.

[0024] Figure 5 This is a schematic diagram of the circuit principle of the E / L mode range reduction unit in the present invention when the L mode is selected.

[0025] Figure 6 Schematic diagram of the circuit principle of the IBKM iterator in the present invention. DETAILED DESCRIPTION

[0026] like Figure 1 As shown, the high-performance function generator based on the BKM algorithm described in the present invention includes an E / L mode range reduction unit and an IBKM iteration unit driven by signals in sequence. In one embodiment, the IBKM iteration unit includes an IBKM iterator and two selectors arranged at the input end; the output signal of the IBKM iterator is input to the IBKM iterator for time division multiplexing to achieve iterative calculation, such as Figure 2 In another embodiment, the IBKM iteration unit includes a plurality of IBKM iterators connected in series, such as Figure 3 In the two embodiments of the present invention, the working principle is the same, and the circuits of the E / L mode range reduction unit and the IBKM iterator all have the same structure, wherein the E / L mode range reduction unit is as shown in FIG. Figure 4 and Figure 5 As shown, the IBKM iterator is as follows Figure 6 shown.

[0027] In the kth iteration, by comparing the current corresponding iteration value E k or L k Respectively with the corresponding dynamic demarcation point A Ek 、B Ek or A Lk 、B Lk The size of , in {-1,0,1} get the appropriate iteration factor d for the current iteration step. k , so that the iteration result L of the current iteration step k+1 、E k+1 According to the iterative equations Converge to the corresponding ideal exponential or logarithmic function value at a faster speed. Where k is a positive integer, 1≤k≤n, n is the total number of iterations; E k and L k are the two current iteration values ​​in the kth iteration. And in E mode, the initial value E1 needs to satisfy In L mode, the initial value L1 needs to meet d k is the iteration factor in the kth iteration, d k ∈{-1,0,1}.

[0028] Specifically, in the exponential function calculation mode E, according to Choose the iteration factor d k The value of the dynamic demarcation point A Ek =ln(1-2 -() ), dynamic demarcation point B Ek =ln(1+2 -() ).

[0029] In the logarithmic function calculation mode L mode, according to Choose the iteration factor d k The value of , where the dynamic cutoff point Dynamic cutoff point

[0030] The E / L mode range reduction unit selects E mode or L mode to work by calculating the mode signal M. The E / L mode range reduction unit realizes the input variable x to the initial value when the E mode is selected. The range scaling mapping makes -19·2 -4 ≤E1<13·2 -4 Among them, the mapping index The input variable x includes a 1-bit sign, a 1-bit integer, and an F-bit decimal. By selecting the sign bit, the lower 1-bit integer bit, and the F-bit decimal bit of the input variable x and -19·2 -4 The initial value E1 is calculated by adding; the mapping index C is calculated by selecting the sign bit and the high (I-1) bit integer bit of the input variable x, and then an e 2C The lookup table realizes the calculation of the initial value L1.

[0031] The E / L mode range reduction unit realizes the input variable x to the initial value when the L mode is selected The range scaling mapping makes 2 -1 ≤L1<2 1 Among them, the mapping index The input variable x also includes a 1-bit sign, a 1-bit integer, and an F-bit decimal. First, the sign bit of the input variable x is checked. If the input variable x is negative or 0, the input value does not meet the calculation requirements of the logarithmic function and the calculation is terminated. Otherwise, the input variable x is logically ORed by performing an OR operation on each 2 bits and the result of the logical calculation is input to a high-order priority encoder to calculate 2C. The initial value L1 is calculated by controlling the shifter to right-shift the input variable x by 2C bits. The initial value E1 is calculated by multiplying 2C by ln(2) through a multiplier or by using a 2C·ln(2) lookup table.

[0032] The IBKM iterator follows the iterative equations Realize the kth iteration and realize the dynamic demarcation point A of the E mode through the selector according to the calculation mode signal M Ek 、B Ek Or L mode dynamic demarcation point A Lk 、B Lk The input is used to compare the current iteration value E through a mixed comparator. k Dynamic demarcation point A Ek 、B Ek or the current iteration value L k Dynamic demarcation point A Lk 、B Lk The size relationship of , to achieve the iteration factor or The IBKM iterator is calculated according to the iteration factor d k Select the value of L k 2 -k or 0 or -L k 2 -k Through an adder and L k Add to achieve the iterative result L of the current iteration step k+1 Calculation of L k 2-k By L k Right shift k bits to achieve, -L k 2 -k Through L k 2 -k The IBKM iterator is implemented by bitwise inversion and then adding 1. k The value of –ln(1+2 -k ) or 0 or –ln(1-2 -k ) is added to E k Add together to achieve the iteration result E of the current iteration step k+1 Calculation of –ln(1+2 -k ),–ln(1-2 -k ) can be obtained by a –ln(1±2 -k )Lookup table implementation.

[0033] Those skilled in the art can make various other corresponding changes and deformations based on the technical solutions and concepts described above, and all of these changes and deformations should fall within the scope of protection of the claims of the present invention.

Claims

1. A high-performance function generator based on the BKM algorithm, characterized in that: It includes an E / L mode range reduction unit and an IBKM iteration unit driven by sequential signals; The E / L mode range reduction unit selects the E mode or the L mode according to the calculation mode signal M to perform range mapping on the input variable x; the E mode is used to calculate the exponential function, and the L mode is used to calculate the logarithmic function; In the kth iteration, by comparing the current iteration value E k and the corresponding dynamic demarcation point A Ek 、B Ek The size of the current iteration value L k and the corresponding dynamic demarcation point A Lk 、B Lk The size of the iteration factor d under the current iteration step is obtained in {-1,0,1} k , so that the iteration result L of the current iteration step k+1 、E k+1 According to the iterative equations Converge to the corresponding function value; Where k is a positive integer, 1≤k≤n, and n is the total number of iterations; In E mode, the iteration initial value E1 satisfies In L mode, the iteration initial value L1 satisfies Iteration factor d in the kth iteration k ∈{-1,0,1}.

2. A high-performance function generator based on the BKM algorithm according to claim 1, characterized in that: The input variable x consists of a 1-bit sign, a 1-bit integer, and an F-bit fractional number. In E mode, according to Choose the iteration factor d k The value of; Among them, the dynamic demarcation point A Ek =ln(1-2 -(k+1) ), dynamic demarcation point B Ek =ln(1+2 -(k+1) ); the initial value is Mapping Index By selecting the sign bit, the lower integer bit and the F-bit fraction bit of the input variable x and -19·2 -4 The calculation of the initial value E1 is realized by adding, and the calculation of the mapping index C is realized by selecting the sign bit and the high (I-1) bit integer bit of the input variable x. 2C The lookup table realizes the calculation of the initial value L1; In L mode, according to Choose the iteration factor d k The value of ; among them, the dynamic demarcation point Dynamic cutoff point The initial value is Mapping Index First, check the sign bit of the input variable x. If the input variable x is negative or 0, the input value does not meet the calculation requirements of the logarithmic function and the calculation is terminated. Otherwise, perform an OR logic operation on every 2 bits of the input variable x and input the logic calculation result into a high-order priority encoder to realize the calculation of 2C. Shift the input variable x right by 2C bits to realize the calculation of the initial value L1. Multiply 2C by ln(2) or use a 2C·ln(2) lookup table to realize the calculation of the initial value E1.

3. A high-performance function generator based on the BKM algorithm according to claim 1, characterized in that: The IBKM iteration unit includes one or several IBKM iterators followed by an output selector; iterative calculation is achieved by time-division multiplexing one IBKM iterator or connecting multiple IBKM iterators in series; the output selector is controlled by the calculation mode signal to select the corresponding final iteration result for output.

4. A high-performance function generator based on the BKM algorithm according to claim 3, characterized in that: The IBKM iterator follows the iterative equations Realize the kth iteration and realize the dynamic demarcation point A of the E mode through the selector according to the calculation mode signal M Ek 、B Ek Or L mode dynamic demarcation point A Lk 、B Lk The input is used to compare the current iteration value E through a mixed comparator. k Dynamic demarcation point A Ek 、B Ek or the current iteration value L k Dynamic demarcation point A Lk 、B Lk The size relationship of , to achieve the iteration factor or Calculation.

Citation Information

Patent Citations

  • Exponential function signal generating circuit

    CN110109508A

  • KR20220093792A