High-performance function generator based on BKM algorithm
Through the improved BKM algorithm and IBKM iterative unit, the problems of low calculation accuracy and high resource overhead in the exponential/logarithmic function calculation circuit are solved, and high performance exponential/logarithmic function calculation is realized, with fast convergence, high precision and low Characteristics of complexity.
Patent Information
- Application Number
- CN202411106366.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-08-13
AI Technical Summary
In the prior art, the exponential/logarithmic function calculation circuit has problems such as low calculation accuracy, large resource overhead, long execution time and long iteration cycle, making it difficult to realize high-performance hardware implementation.
Using the improved BKM algorithm, the E/L mode range reduction unit and the IBKM iterative unit are used to use iterative factor comparison and simple addition and shift operations to achieve fast convergence and high-precision exponential/logarithmic function calculations.
It realizes high computing speed, high computing accuracy, low resource overhead and simple hardware design, can quickly approach ideal values, and supports wide computing range and high scalability.
Smart Images

Figure CN119126915A_ABST
Abstract
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 functions and logarithmic functions have extremely important applications in a wide range of fields such as natural science, engineering technology, economics and finance, and data analysis. They provide powerful mathematical tools for describing and analyzing various dynamic processes. The calculation circuits of exponential functions and logarithmic functions are important components of some special applications, such as neural network systems, wireless communication systems, and information encryption systems, and their calculation speed and accuracy have a significant impact on the performance of the entire system.
[0003] Although the traditional exponential / logarithmic function calculation circuit based on a single lookup table method is simple in hardware implementation, it often has low calculation accuracy or large storage resource overhead, and its execution time is long as the calculation scale increases. Although the exponential / logarithmic function calculation circuit based on piecewise linear interpolation method is relatively simple in hardware implementation and fast in calculation speed, its calculation accuracy is limited, the segmentation parameters are not fixed, and the storage requirement is large. Although the exponential / logarithmic function calculation circuit based on Taylor expansion reduces the complexity of exponential / logarithmic calculation, the calculation range and calculation accuracy are limited, and the complexity of the circuit and the consumption of hardware resources continue to increase with the increase of the expansion order. The exponential / logarithmic function calculation circuit based on the CORDIC algorithm (coordinate rotation digital algorithm) adopts a simple shift-addition operation, and the hardware structure is relatively simple, but for high-speed and high-precision applications, its iteration cycle is long and the convergence speed is often slow. In 1994, Jean-Claude Bajard, Sylvanus Kla and Jean-Michel Muller first published the BKM algorithm, which is a shift-addition algorithm for calculating elementary functions. The BKM algorithm uses addition, shift and comparison operations to calculate elementary functions by using a pre-calculated logarithmic table. However, the exponential / logarithmic function calculation circuit based on the BKM algorithm still has the disadvantages of slow convergence speed and low calculation accuracy.
[0004] In summary, there is still no good design solution for an exponential / logarithmic function calculation circuit with simple hardware implementation and high calculation speed, high calculation accuracy and low resource overhead. Summary of the invention
[0005] The purpose of the present invention is 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, IBKM) algorithm is improved based on the BKM algorithm in the prior art, and mainly includes two calculation modes: exponential / logarithmic function.
[0006] The high-performance function generator based on the BKM algorithm described in the present invention comprises 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 to perform range mapping on the input variable x according to the calculation mode signal M; 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, or the current iteration value L k and the corresponding dynamic demarcation point A Lk , B Lk The size of the iteration factor d at 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 includes a 1-bit sign, an I-bit integer, and an F-bit fraction;
[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 fractional bit of the input variable x and -19·2 -4 The initial value E1 is calculated by adding, and the mapping index C is calculated 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 cut-off 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 more IBKM iterators followed by an output selector; iterative calculation is achieved by time-division multiplexing an IBKM iterator or by serially connecting multiple IBKM iterators; the output selector is controlled by a calculation mode signal to select the corresponding final iteration result for output.
[0015] The IBKM iterator iterates according to the set of equations The kth iteration is realized, and the dynamic demarcation point A of the E mode is realized 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 then compared with 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 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) It has 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 so that the iteration result converges to the ideal value at a faster speed. It can also control the accuracy of function calculation by adjusting the number of iterations. The iterative process is simple and the more iterations there are, 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 only requires simple comparison, shift, and addition operations, and the circuit structure is simple. The range reduction unit uses simple table lookup, addition, priority coding, shift, and other operations to achieve complex range mapping, reducing hardware costs. In addition, the IBKM iterator can perform time-division multiplexing operations in calculations, and the hardware resource utilization is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a structural schematic diagram of the high-performance function generator described in the present invention.
[0021] Figure 2 It is a structural schematic 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 It 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 It 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 It is a schematic diagram of the circuit principle of the IBKM iterator described 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 realize 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 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 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 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 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 satisfy 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 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 Dynamic cut-off point
[0030] The E / L mode range reduction unit selects the E mode or the L mode to work by calculating the mode signal M. When the E mode is selected, the E / L mode range reduction unit realizes the input variable x to the initial value 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 through 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, an 1-bit integer, and an F-bit decimal. First, check the sign bit of the input variable x. If the input variable x is a negative number 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 each 2 bits of the input variable x and input the logic calculation result into a high-order priority encoder to achieve the calculation of 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 a 2C·ln(2) lookup table.
[0032] The IBKM iterator iterates according to the set of equations The kth iteration is realized, and the dynamic demarcation point A of the E mode is realized 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 then compared with 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 the iteration factor or The IBKM iterator is calculated according to the iteration factor d k Select L as the value k 2 -k or 0 or -L k 2 -k Through an adder and L k Add to achieve the iteration 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] For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope 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 to perform range mapping on the input variable x according to the calculation mode signal M; 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, or the current iteration value L k and the corresponding dynamic demarcation point A Lk , B Lk The size of the iteration factor d at 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 includes a 1-bit sign, an I-bit integer, and an F-bit fraction; 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 fractional bit of the input variable x and -19·2 -4 The initial value E1 is calculated by adding, and the mapping index C is calculated 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 cut-off 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 more IBKM iterators followed by an output selector; iterative calculation is achieved by time-division multiplexing an IBKM iterator or by serially connecting multiple IBKM iterators; the output selector is controlled by a 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 The kth iteration is realized, and the dynamic demarcation point A of the E mode is realized 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 then compared with 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 the iteration factor or Calculation.
Citation Information
Patent Citations
FPGA-based real-time radar signal generating device and modulation method
CN108627809A
A calculation system based on a type-2 hyperbolic CORDIC arbitrary exponential function
CN109739470A
Exponential function signal generating circuit
CN110109508A
Method for cooling on smartfarm and smartfamr cooling system
KR102488141B1
