CORDIC anti-trigonometric function solving system based on prefix binary tree mapping

By replacing the initial iteration process of the CORDIC algorithm with a prefix binary tree mapping and combining it with the CORDIC iteration module, high-precision arcsine and arccosine calculations are achieved while consuming low hardware resources, thus solving the resource and accuracy problems of the CORDIC algorithm in high-precision scenarios.

CN121597162APending Publication Date: 2026-03-03ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511759960.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing CORDIC algorithms suffer from high hardware overhead and insufficient computational accuracy in arcsine and arccosine calculations, making them particularly difficult to meet requirements in high-precision or high-iteration-number scenarios.

Method used

A CORDIC inverse trigonometric function solution system based on prefix binary tree mapping is adopted. The prefix binary tree mapping module replaces the first k iterations of the CORDIC algorithm, and the CORDIC iteration module is combined to perform the remaining iterations. This establishes an efficient mapping relationship between the independent variable and the unit vector, reducing computational resource consumption while maintaining accuracy.

Benefits of technology

While maintaining computational accuracy, it significantly reduces computational resource consumption and computational latency, avoids errors introduced by approximate gain compensation, and meets the high-precision requirements of real-time high-performance computing systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597162A_ABST
    Figure CN121597162A_ABST
Patent Text Reader

Abstract

The invention discloses a CORDIC inverse trigonometric function solving system based on prefix binary tree mapping, and the system comprises a prefix binary tree mapping module which is used for carrying out the multi-stage prefix comparison of an input independent variable x, and directly outputting a unit vector corresponding to the (k + 1) th iteration, so as to replace the first k stages of micro-rotation iterations of a CORDIC algorithm; and the CORDIC iteration module is used for taking the unit vector output by the prefix binary tree mapping module as an initial value, taking an input independent variable x as an initial comparison value, continuing to finish the rest (M-k-1)-level iteration from the (k + 1)-th level, and outputting a final iteration result. According to the CORDIC anti-trigonometric function solving system based on prefix binary tree mapping provided by the invention, on the premise of keeping the calculation precision, the early-stage iteration process of a CORDIC algorithm is effectively replaced, the calculation resource consumption and the operation time delay are remarkably reduced, meanwhile, the precision loss caused by approximate gain compensation is thoroughly avoided, and the calculation efficiency is improved. Therefore, the requirement of a real-time high-performance computing system for high-precision transcendental function operation is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention specifically relates to a CORDIC inverse trigonometric function solving system based on prefix binary tree mapping. Background Technology

[0002] Inverse trigonometric functions, as fundamental mathematical functions, play a crucial role in real-time computing scenarios such as digital signal processing, communication systems, and physical simulations. In terms of hardware implementation, the Coordinate Rotating Digital Computer (CORDIC) algorithm is widely adopted because it relies solely on shift and addition operations and does not require large-scale multipliers. Compared to traditional methods based on lookup tables or polynomial interpolation, the CORDIC algorithm offers significant advantages in resource consumption and power consumption control, making it particularly suitable for embedded platforms such as FPGAs and ASICs.

[0003] In the calculation of arcsine and arccosine, the CORDIC algorithm decomposes the target rotation into a series of successive approximating micro-rotations to perform function calculations, with each step involving a rotation angle of tan θ. -1 2 -i The direction of rotation is determined by comparing the current vector coordinates with the input value. However, as the iteration progresses, each micro-rotation introduces a gain in the magnitude, causing a change in the vector amplitude. Therefore, gain compensation is necessary to maintain computational accuracy.

[0004] To overcome the high multiplier resource consumption problem in traditional gain compensation, existing technologies have proposed several improvement schemes. Among them, the double-iteration method achieves gain compensation without explicit multiplication by doubling the angle of each micro-rotation. Although this method has been implemented in FPGA and can alleviate the numerical overflow problem when the input value is close to 1, the complexity of its vector coordinate update process increases significantly with the number of iterations, leading to a substantial increase in hardware overhead.

[0005] Another direction for improvement is the approximate gain compensation technique. This technique uses an approximate gain factor instead of the precise gain value, and compensation can be completed through only shift and addition operations, thereby further reducing resource consumption. However, due to the approximation of the gain factor, this method introduces systematic errors during the calculation process, making it difficult to meet the requirements of high-precision application scenarios.

[0006] In summary, existing CORDIC improvement schemes have significant limitations in both arcsine and arccosine calculations: the double-iteration method has high hardware complexity, making it unsuitable for high-precision or high-iteration-count scenarios; the approximate gain compensation method cannot meet the requirements of error-sensitive applications due to accuracy loss. Therefore, a new computing architecture that can control hardware overhead while ensuring computational accuracy is urgently needed. Summary of the Invention

[0007] This invention provides a CORDIC inverse trigonometric function solving system based on prefix binary tree mapping to solve the technical problem of insufficient accuracy of traditional early warning methods mentioned above. The specific technical solution is as follows:

[0008] A CORDIC inverse trigonometric function solving system based on prefix binary tree mapping includes:

[0009] The prefix binary tree mapping module is used to directly output the unit vector (X) corresponding to the (k+1)th iteration by performing multi-level prefix comparisons on the input independent variable x. k+1 Y k+1 Z k+1 This replaces the first k stages of micro-rotation iterations of the CORDIC algorithm.

[0010] The CORDIC iterative module takes the unit vector output by the prefix binary tree mapping module as the initial value and the input independent variable x as the initial comparison value, and continues to complete the remaining Mk-1 levels of iteration starting from the (k+1)th level, and outputs the final iteration result.

[0011] Furthermore, the prefix binary tree mapping module establishes a mapping relationship between the independent variable and the set of unit vectors by summarizing the boundary characteristics between unit vectors. The mapping relationship is constructed based on the binary tree structure, mapping the input range [0,1] to a binary tree hierarchy. Each node is assigned a unique binary prefix, representing the common prefix of all fixed-point values ​​within its coverage range.

[0012] Furthermore, the prefix binary tree mapping module includes:

[0013] The leaf node mapping unit is used to determine the leaf node to which the independent variable x belongs layer by layer based on the binary prefix of x and output the leaf node index I. B ;

[0014] The boundary leaf node table stores the solution space index I corresponding to each boundary leaf node. S and rounding boundary value b mid ;

[0015] Solution vector table, storing and indexing the solution space I S The unit vectors that correspond one-to-one.

[0016] Furthermore, the leaf node mapping unit identifies the leaf node level of the independent variable x through a level determiner. The level determiner identifies the binary prefix of the independent variable x based on the prefix code characteristics of that level. After locating the level of the variable, it quickly locates the index I of the leaf node by selecting binary bits and subtraction. B :

[0017] I B =x[n-1:n-σ] l]-τ l

[0018] Where n represents the bit width of the independent variable x, σ l For a fixed width, square brackets represent selected binary bits in the independent variable x, τ l This is a hierarchical offset used to eliminate discontinuities in leaf node indices across levels.

[0019] Furthermore, the boundary leaf node table receives leaf node index I B Then, output the left solution space index I associated with that leaf node. S and rounding boundary value b mid The rounding boundary value b mid Used to correspond to the binary bits of the independent variable x. mid Compare, in x mid >b mid When the solution space index I is used S Increment by 1.

[0020] Furthermore, the solution vector table receives the solution space index I after boundary comparison adjustment. S Then, output the unit vector phase Z at iteration number k+1. k+1 and its coordinates (X) k+1 ,Y k+1 ).

[0021] Furthermore, the CORDIC iteration module updates the comparison value using the following formula:

[0022] T i+1 =T i (1+2 -2i-1 ).

[0023] Furthermore, the mapping depth k of the prefix binary tree mapping module is a fixed positive integer, and the size of the solution vector set is 2^k. k This is to cover all possible unit vectors after k micro-rotations.

[0024] Furthermore, the coordinate variables X and Y, and the number of decimal places for the comparison values, are ω. frac The range of values ​​for k must satisfy the following conditions:

[0025] The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping provided by this invention effectively replaces the early iteration process of the CORDIC algorithm while maintaining computational accuracy, significantly reducing computational resource consumption and computational latency, and completely avoiding the accuracy loss caused by approximate gain compensation, thereby meeting the needs of real-time high-performance computing systems for high-precision transcendental function operations. Attached Figure Description

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

[0027] Figure 1 This is a schematic diagram of a CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to this application;

[0028] Figure 2 This is a schematic diagram of the solution vectors and solution space with a mapping depth of 3;

[0029] Figure 3 This is a schematic diagram of a prefix binary tree with a mapping depth of 3 and its solution space;

[0030] Figure 4 This is a schematic diagram of the leaf node mapping unit;

[0031] Figure 5 This is a schematic diagram of the CORDIC iterative module. Detailed Implementation

[0032] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0033] This invention relates to a method for calculating arcsine and arccosine based on a hybrid architecture of prefix binary tree mapping and the CORDIC algorithm. For example... Figure 1 As shown, the CORDIC inverse trigonometric function solution system based on prefix binary tree mapping includes a prefix binary tree mapping module and a CORDIC iteration module. The input independent variable x is first processed by the prefix binary tree mapping module to obtain the unit vector (X) corresponding to the iteration stage. k+1 ,Y k+1 Z k+1 The vector is then input into the CORDIC iteration module for further iteration, ultimately outputting the calculated arcsine or arccosine. Specifically, the prefix binary tree mapping module directly outputs the unit vector (X) corresponding to the (k+1)th iteration after multi-level prefix comparisons of the input independent variable x. k+1 Y k+1 Z k+1This replaces the first k levels of micro-rotation iterations of the CORDIC algorithm. The CORDIC iteration module uses the unit vector output by the prefix binary tree mapping module as the initial value and the input independent variable x as the initial comparison value. It continues to complete the remaining Mk-1 levels of iterations from the (k+1)th level and outputs the final arcsine or arccosine calculation result.

[0034] The prefix binary tree mapping module is built upon a binary tree structure. By summarizing the boundary characteristics between unit vectors, it establishes a mapping relationship between the independent variable and the set of unit vectors. This hybrid strategy effectively reduces the computational overhead of the CORDIC algorithm in the initial iteration phase, while avoiding errors introduced by approximate gain compensation. Specifically, the prefix binary tree mapping module includes a leaf node mapping unit and two lookup tables—a boundary leaf node table and a solution vector table. The leaf node mapping unit is used to determine the leaf node to which the independent variable x belongs layer by layer based on its binary prefix and outputs the leaf node index I. B The boundary leaf node table stores the solution space index I corresponding to each boundary leaf node. S and rounding boundary value b mid Solution vector table storage and solution space index I S The unit vectors that correspond one-to-one.

[0035] To clarify the design principle of the prefix binary tree mapping module, we first explain the conventional method for calculating the arcsine and arccosine using the CORDIC algorithm alone. This method is based on the vector pattern of the CORDIC circular system, rotating the initial vector from a fixed position to the target phase. The rotation process consists of a series of progressively refined micro-rotations. To cover the interval [0, π / 2], the initial vector is usually set to an angle of π / 2. The unit vector, that is:

[0036]

[0037] The angle of the micro-rotation is tan -1 2 -i , where i is the iteration number. Rotation direction δ i The rotation is determined by comparing the current vector coordinates with the input value, thus making the vector's ordinate (arcsine) or abscissa (arccosine) approximate the input value x. The cumulative angle of rotation of the vector at this point is the desired result. The specific iterative formula is as follows:

[0038] X i+1 =X i -δ i Y i 2 -i #(2)

[0039] Y i+1 =Y i +δ i Xi 2 -i #(3)

[0040] Z i+1 =Z i +δ i tan -1 2 -i #(4)

[0041]

[0042] Z i Let T be the angle of the vector at the i-th iteration. i The comparison value is the gain-compensated value; the input variable is used as the initial comparison value T1. Rotation direction δ i Depending on the computation function, the calculation of the arcsine is as follows:

[0043]

[0044] Correspondingly, in the calculation of arccosine:

[0045]

[0046] The function of the prefix binary tree mapping module is to replace the first k iterations of the CORDIC algorithm, where k is the mapping depth. Since the initial vector position is fixed, the vector set {X} obtained after k iterations... k+1 ,Y k+1 Z k+1 The size of} is 2 k This is called the solution vector set. Figure 2 This shows that when k=3, the initial vector is... The corresponding 8 solution vectors. The vector space that subsequent iterations can cover for each solution vector is called the solution space. For the inverse cosine function, by projecting the solution space onto the horizontal axis, the solution space of the independent variable can be formed, such as... Figure 2 As shown in the middle colored horizontal bar.

[0047] Since the solution space of the independent variable is non-uniformly distributed, the boundary of the solution space needs to be optimized to establish an efficient mapping. In the overlapping region of the solution space, the upper and lower bounds of the overlapping region are defined as b. u and b l Assume b u and b l The n-bit binary representations are u n-1 u n-2 …u0 and l n-1 l n-2 …l0, define a rounding boundary b c It is a binary number located between the upper and lower bounds and has at most zeros in its tail. Its binary representation is:

[0048] b c =u n-1 u n-2 …u m+1 100…0#(8)

[0049] in

[0050] To efficiently locate the solution space to which the independent variable belongs, this invention employs a prefix binary tree structure. This tree structure is built upon the solution space of the independent variable, mapping the input range [0,1] to a binary tree hierarchy: the root node represents the entire input range, and the left and right child nodes sequentially bisect the range. Each node is assigned a unique binary prefix, representing the common prefix of all fixed-point values ​​within its coverage area. Figure 3 The structure of the prefix binary tree when k=3 and its mapping relationship with the solution space of the independent variable are shown.

[0051] A prefix binary tree expanded to cover no more than two solution spaces at each leaf node. Leaf nodes with rounded boundaries are called boundary leaf nodes. For example... Figure 3 As shown, except for the leaf node prefixed with "1110x", all other leaf nodes are boundary leaf nodes. The depth of the binary tree is defined as the distance from a node to the root node, and the leaf node level is a statistical count consisting only of leaf nodes, starting from the shallowest leaf node and proceeding to the deepest leaf node. Each level uses a fixed-width selection of the prefix binary bits of the variable x, with a width of σ. l It is equal to the depth of the deepest leaf node in that layer.

[0052] The workflow of the leaf node mapping unit is as follows: Figure 4 As shown. First, the leaf node level of the independent variable x is identified by a level determiner. The level determiner identifies the binary prefix of variable x based on the prefix code characteristics of different levels. After locating the level of the variable, the index I of the leaf node can be quickly located by selecting binary bits and subtraction. B :

[0053] I B =x[n-1:n-σ] l ]-τ l #(9)

[0054] Where n represents the bit width of the independent variable x, σ l For a fixed width, square brackets represent selected binary bits in the independent variable x, τ l This is a hierarchical offset used to eliminate discontinuities in leaf node indices across levels. The fixed width σ... lThe value is equal to the depth of the binary tree corresponding to that level. The offset τ1 of level 1 is 0. Starting from level 2, the offset τ1 of that level is the difference between the index of the smallest leaf node in that level where no offset is applied and the index of the largest leaf node in the previous level where an offset is applied, minus 1. l σ l With τ l All are recorded in the hierarchy determiner of the leaf node mapping unit, and stored using a small lookup table.

[0055] like Figure 1 As shown, leaf node index I B Used to access the boundary leaf node table, which stores the solution space index I of each boundary leaf node, corresponding to its associated left solution space. S and the rounding boundary value b mid This is obtained by ignoring common prefixes and trailing zeros based on rounding boundaries. Then, the corresponding binary bits of the independent variable x are... mid With b mid Compare them. If x mid >b mid Then the solution space index I will be... S Increment by 1, which means accessing the right solution space of the boundary leaf node. Then, use this index to access the solution vector table, which stores the phase Z of the unit vector at iteration number k+1. k+1 and coordinates (X) k+1 ,Y k+1 ), defined as follows:

[0056]

[0057] This vector state serves as the output of the prefix binary tree mapping module and the input of the CORDIC iteration module.

[0058] CORDIC iteration module, such as Figure 5 As shown, it consists of Mk-1 CORDIC units connected end-to-end in a pipelined computational structure. The input includes unit vector coordinates (X... k+1 ,Y k+1 ) and phase Z k+1 and comparison value T k+1 It is equal to the input independent variable x.

[0059] Each CORDIC unit performs the following calculations.

[0060]

[0061] Where the rotation direction δ i Make a judgment using the logic of formula (6) or formula (7). Figure 5 The text shows the specific details of the CORDIC cell, where the variable X... iY i and T i Calculate variable X by binary right shift (>>). i 2 -i Y i 2 -i and T i 2 -2i-1 , variable tan -1 2 -i The value of X is pre-calculated and stored in a lookup table, and is accessed during computation. The comparator compares X... i and T i The magnitude gives the direction of rotation δ i The direction of rotation determines the variable X. i With Y i 2 -i Y i With X i 2 -i and Z i With tan -1 2 -i The addition / subtraction operations are performed. The variables obtained after the addition / subtraction are output through registers. The phase output result Z of the last CORDIC unit is... M This is the result of solving for the inverse cosine, i.e., cos -1 x. For arcsine, the comparator object needs to be changed to "Y". i ≥T i Z M That is, the result of the arcsine, sin -1 x. This pipeline structure consists only of adders / subtractors, shifters, registers, and a small lookup table.

[0062] The CORDIC iterative module uses the iterative method of formula (11), therefore the comparison values ​​used in this module can be expressed in series form:

[0063]

[0064] Where T k+1 It equals the input value x. Correspondingly, if the true gain is used for amplification, i.e., if formula (5) is used for iteration, the true comparison value should be:

[0065]

[0066] The gain deviation Ω between the used comparison value and the true comparison value is:

[0067]

[0068] For a fixed value of k, the gain deviation Ω decreases as i increases. Therefore, the gain deviation is maximized when i = k + 2. The upper limit of the gain deviation Ω at this point is analyzed as follows:

[0069]

[0070] Assume the number of decimal places for the variable is ω. frac Then the rounding error of this variable is 2. -ωfrac-1 If the upper limit of the gain deviation Ω does not exceed the rounding error of the variable, then the difference between the used comparison value and the true comparison value can be ignored. In this case, the following must be satisfied:

[0071] ω frac ≤4k+6#(16)

[0072] In the embodiments of this application, the number of decimal places for coordinate variables X and Y, and comparison value T is ω. frac The range of values ​​for k must satisfy the following conditions: When the decimal places of variables X, Y, and T are ω frac When formula (16) is satisfied, the difference between the comparison value iteration method using formula (11) and the method using formula (5) will be less than the quantization error of the variable 2. -ωf In rac-1, the gain deviation caused by vector rotation is negligible, thus not affecting the rotation trajectory in the iteration process, and saving multiplication operations.

[0073] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any way, and all technical solutions obtained by equivalent substitution or equivalent transformation fall within the protection scope of the present invention.

Claims

1. A CORDIC inverse trigonometric function solving system based on prefix binary tree mapping, characterized in that, include: The prefix binary tree mapping module is used to directly output the unit vector (X) corresponding to the (k+1)th iteration by performing multi-level prefix comparisons on the input independent variable x. k+1 Y k+1 Z k+1 This replaces the first k stages of micro-rotation iterations of the CORDIC algorithm. The CORDIC iterative module takes the unit vector output by the prefix binary tree mapping module as the initial value and the input independent variable x as the initial comparison value, and continues to complete the remaining Mk-1 levels of iteration starting from the (k+1)th level, and outputs the final iteration result.

2. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 1, characterized in that, The prefix binary tree mapping module establishes a mapping relationship between independent variables and the set of unit vectors by summarizing the boundary characteristics between unit vectors. The mapping relationship is constructed based on a binary tree structure, mapping the input range [0,1] to a binary tree hierarchy. Each node is assigned a unique binary prefix, which represents the common prefix of all fixed-point values ​​within its coverage range.

3. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 2, characterized in that, The prefix binary tree mapping module includes: The leaf node mapping unit is used to determine the leaf node to which the independent variable x belongs layer by layer based on the binary prefix of x and output the leaf node index I. B ; The boundary leaf node table stores the solution space index I corresponding to each boundary leaf node. S and rounding boundary value b mid ; Solution vector table, storing and indexing the solution space I S The unit vectors that correspond one-to-one.

4. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 3, characterized in that, The leaf node mapping unit identifies the leaf node level of the independent variable x through a level determiner. The level determiner identifies the binary prefix of the independent variable x based on the prefix code characteristics of that level. After locating the level of the variable, it quickly locates the index I of the leaf node by selecting binary bits and subtraction. B : I B =x[n-1:n-σ l ]-t l Where n represents the bit width of the independent variable x, σ l For a fixed width, square brackets represent selected binary bits in the independent variable x, τ l This is a hierarchical offset used to eliminate discontinuities in leaf node indices across levels.

5. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 1, characterized in that, The boundary leaf node table receives leaf node index I B Then, output the left solution space index I associated with that leaf node. S and rounding boundary value b mid The rounding boundary value b mid Used to correspond to the binary bits of the independent variable x. mid Compare, in x mid >b mid When the solution space index I is used S Increment by 1.

6. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 1, characterized in that, The solution vector table receives the solution space index I after boundary comparison adjustment. S Then, output the unit vector phase Z at iteration number k+1. k+1 and its coordinates (X) k+1 ,Y k+1 ).

7. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 1, characterized in that, The CORDIC iteration module updates the comparison value using the following formula: T i+1 =T i (1+2 -2i-1 )。 8. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 1, characterized in that, The mapping depth k of the prefix binary tree mapping module is a fixed positive integer, and the size of the solution vector set is 2. k This is to cover all possible unit vectors after k micro-rotations.

9. The CORDIC inverse trigonometric function solving system based on prefix binary tree mapping according to claim 1, characterized in that, The coordinate variables X and Y, and the number of decimal places for the comparison values ​​are ω. frac The range of values ​​for k must satisfy the following conditions: