A device and method for solving the Nth root of a complex number

Through the combination of the pipeline architecture and the CORDIC module, the similarity sharing resources of complex Nth roots are used to dynamically perform parallel calculations, which solves the problem of complex Nth root calculation complexity and low efficiency, and achieves efficient and flexible complex number 2 to The 10th root calculation reduces hardware complexity and resource consumption, and expands the calculation range and accuracy.

CN113778378BActive Publication Date: 2024-09-10NANJING NINGQI INTELLIGENT COMPUTING CHIP RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111135773.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-27
Publication Date
2024-09-10
Estimated Expiration
2041-09-27

AI Technical Summary

Technical Problem

The calculation process of complex Nth root is complex and inefficient. Existing hardware implementations mainly focus on real numbers or quadratic root calculations, which cannot meet the application requirements of high-order roots. Moreover, the calculation complexity increases with the value of N, resulting in circuit complexity and resource consumption. Increase.

Method used

It uses a pipeline architecture and CORDIC module to share computing resources through the similarity of complex Nth roots, combines parallel result processing units and lookup tables, dynamically activates sub-computing units, and uses trigonometric function diagonal sum-difference formulas for parallel calculations, reducing hardware costs. Implementation complexity and resource consumption.

Benefits of technology

It achieves efficient calculation of the 2 to 10th root of complex numbers, improves calculation efficiency and flexibility, reduces hardware complexity and resource consumption, expands the calculation convergence range, supports a wide input range and has high calculation accuracy, with a relative error of up to 10-6.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113778378B
    Figure CN113778378B
Patent Text Reader

Abstract

The present invention discloses a device and method for solving the Nth root of a complex number, and relates to the technical field of complex Nth root operation. In view of the problems of complex Nth root calculation process and low efficiency in the prior art, the present invention constructs a CORDIC module for calculation. The CORDIC module adopts a pipeline architecture, and can perform multiple iterations at the same time. The similarity of the Nth root solution process of the complex number is used to share computing resources to reduce the computational complexity, and the calculation of the result processing unit is executed in parallel, so as to reduce the computational cost, improve the computational efficiency and computational accuracy, and the hardware device has low complexity and can support 10 ‑8 to 10 4 The relative error can reach 10 ‑6 .
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of complex number Nth root calculation, and more specifically, to a device and method for solving complex number Nth root. Background Art

[0002] Complex number operations are the core part of circuit calculations and are widely used in communication systems and signal processing fields for real-time data representation and system modeling. Nth root operations are an important part of complex function theory. In polynomial calculations, matrix calculations, trigonometric functions, etc., timely introduction of Nth root operations can simplify the calculation process. However, complex Nth root operations are very complex due to the uncertainty of the number of roots and the complexity of complex operations. Most Nth root operation research focuses on real numbers, or usually implements complex Nth root operations by software. However, software implementation often uses mixed operations of various algorithms rather than dedicated algorithms to ensure accurate and reliable calculations. There is often redundancy in the process and it performs poorly in real-time work.

[0003] Another method is to accelerate the Nth root operation through application-specific integrated circuit (ASIC) hardware to achieve high computing performance. However, there are only a few works related to the hardware implementation of complex square roots. As high-order roots are widely used in atmospheric models, radiation and other fields, square root operations alone can no longer meet application requirements. In specific hardware implementations, the resources consumed by the constant associated with N are proportional to the range of N. In practical applications, the most commonly used N value is an integer from 2 to 10.

[0004] A coordinate rotation digital computer (CORDIC) can effectively calculate transcendental functions such as trigonometric functions, exponential functions, and logarithmic functions through simple shift and addition operations, can achieve a high calculation speed, and has a good trade-off between accuracy and area, and achieves low cost. To this end, the present invention proposes a low-complexity hardware solution based on CORDIC for calculating the 2nd to 10th roots of complex numbers, achieving high calculation efficiency while reducing hardware implementation complexity.

[0005] Because the number of results is uncertain, Nth root calculation has always been a challenging topic, so most hardware implementations focus on real number Nth roots or just quadratic root calculations. Chinese patent application number CN202011357034.8, published on March 12, 2021, discloses a method for calculating the Nth square root of a complex number based on the CORDIC method. This method is the result of the preliminary work of the applicant of the present invention. Although it can realize the calculation of Nth roots of arbitrary orders, it can only calculate the Nth root of each input complex number serially according to the value of N, and only calculate one of the N results each time. However, the calculation of the complex number Nth root has N results. When the value of N is large, the complexity of the circuit will increase rapidly with the increase of the value of N. Therefore, the calculation efficiency and flexibility of this method are insufficient. Summary of the invention

[0006] 1. Technical problems to be solved

[0007] In view of the problems of complex Nth root calculation process and low efficiency in the prior art, the present invention provides a device and method for solving the Nth root of a complex number, adopts a pipeline architecture, and uses the similarity of the Nth root solution process of the complex number to share computing resources and reduce computing costs.

[0008] 2. Technical solution

[0009] The purpose of the present invention is achieved through the following technical solutions.

[0010] A device for solving the Nth root of a complex number, the complex number is expressed as z=a+b*i, the device comprises a CORDIC calculation module and a result processing unit, input data a, b are calculated by the CORDIC module and then input into the result processing unit for calculation to obtain the calculation result.

[0011] Furthermore, the CORDIC module includes a first coordinate conversion unit, a modulus calculation unit, a phase angle calculation unit and a second coordinate conversion unit, the first coordinate conversion unit includes a circular vector calculation unit; the modulus calculation unit includes a first linear vector calculation unit, a hyperbolic vector calculation unit and a hyperbolic rotation calculation unit; the phase angle calculation unit includes a second linear vector calculation unit; the second coordinate conversion unit includes a circular rotation calculation unit;

[0012] The input data is input into the first coordinate conversion unit, and converted from the plane coordinate form to the polar coordinate form. After the coordinate conversion, the data is calculated by the modulus calculation unit and the phase angle calculation unit respectively, and input into the second coordinate conversion unit to convert the polar coordinate form into the plane coordinate form. The system uses a pipeline architecture.

[0013] Furthermore, the convergence times of the CORDIC module is X, where x is an integer greater than zero; the CORDIC module is iterated X times through an x-stage pipeline architecture to complete result convergence.

[0014] Furthermore, the number of iterations includes a positive number of iterations for determining the calculation accuracy, and a negative number of iterations for expanding the calculation convergence range.

[0015] Furthermore, the device further comprises a lookup table for storing constant values ​​related to N. Constants in calculations are pre-calculated and stored in the lookup table, thereby avoiding complex hardware calculations.

[0016] Furthermore, the result processing unit includes a plurality of parallel sub-computing units. Different sub-computing units in the result processing unit are dynamically activated according to different integers N input to the processing unit to complete the calculation of N roots in parallel.

[0017] Furthermore, the sub-calculation unit uses the trigonometric function two-angle sum and difference formula to calculate The real and imaginary parts of . The real part of and the imaginary part The expression is:

[0018]

[0019]

[0020] Furthermore, the sub-computing unit includes a multiplier, an adder and a subtractor, the output ends of the first multiplier and the third multiplier are connected to the input end of the adder, and the calculation output The output of the second multiplier and the fourth multiplier is connected to the input of the subtractor to calculate the output The real part of .

[0021] A method for solving the Nth root of a complex number, using the device for solving the Nth root of a complex number, the complex number is represented by z=a+b*i, input data a and b are iterated X times in a CORDIC module through a pipeline architecture to complete result convergence, X is an integer greater than zero; the calculation result of the CORDIC module is transmitted to a result processing unit for parallel calculation to obtain the calculation result.

[0022] Furthermore, N is an integer greater than or equal to two and less than or equal to ten.

[0023] The present invention innovatively uses an efficient parallel result processing unit, utilizes the similarity of the solution process of the Nth root of a complex number to reduce the computational complexity, and adopts a pipeline architecture, which can dynamically support the calculation of the 2nd to 10th roots of complex numbers, saves storage resources, and overcomes the problems of high computational complexity and long computational time of the Nth root.

[0024] 3. Beneficial effects

[0025] Compared with the prior art, the present invention adopts a pipeline architecture, which can calculate multiple iterative processes at the same time and improve throughput; during the calculation process, the constant values ​​related to N are calculated in advance and stored in a lookup table, and the corresponding constants are flexibly taken out according to different integers N, thereby further reducing hardware overhead and saving storage resources.

[0026] The present invention utilizes the similarity of the N-th root solution process of a complex number to share computing resources and reduce the hardware implementation complexity of high-order N-th root; utilizes CORDIC characteristics to solve through simple shift and addition operations. According to different input integers N, different result processing units are dynamically activated to calculate N results in parallel, effectively improving the input range, throughput and flexibility while ensuring flexibility, and reducing hardware implementation complexity and resource consumption.

[0027] The present invention expands the calculation convergence range, and the software simulation can support 10 -8 to 10 4 The relative error can reach 10 -6 , with a wide support range and high calculation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a schematic diagram of the hardware architecture of the present invention;

[0029] Figure 2 It is a schematic diagram of the parallel result processing unit architecture of the present invention;

[0030] Figure 3 23-stage pipeline architecture diagram of the CV-CORDIC module of the present invention;

[0031] Figure 4 It is a simulation relationship diagram of the average relative error, integer N value and positive iteration number P in the present invention. DETAILED DESCRIPTION

[0032] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. However, it is obvious to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features known in the art are not described.

[0033] Example

[0034] The hardware device of this embodiment is as follows Figure 1 As shown, the system inputs the real part a and the imaginary part b of the complex number z, and passes through the CORDIC module. As shown in the figure, the CORDIC module includes a first coordinate conversion unit, a modulus calculation unit, a phase angle calculation unit, and a second coordinate conversion unit. The first coordinate conversion unit includes a circular vector calculation unit; the modulus calculation unit includes a first linear vector calculation unit, a hyperbolic vector calculation unit, and a hyperbolic rotation calculation unit; the phase angle calculation unit includes a second linear vector calculation unit; and the second coordinate conversion unit includes a circular rotation calculation unit.

[0035] The input data is input into the first coordinate conversion unit, converted from plane coordinate form to polar coordinate form, and after the coordinate conversion, the data is calculated by the modulus calculation unit and the phase angle calculation unit respectively, and input into the second coordinate conversion unit to convert the polar coordinate form into plane coordinate form and send it to the result processing unit; the system uses a pipeline architecture to achieve high-speed full-pipeline calculation.

[0036] The result processing unit uses the trigonometric function two-angle sum and difference formula to perform shift and addition operations to calculate The result processing unit includes several parallel sub-computation units. According to the different input integers N of the processing unit, different sub-computation units in the result processing unit are dynamically activated to complete the calculation of N roots in parallel.

[0037] There are N roots for high-order Nth roots. As N increases, the complexity of the circuit increases rapidly. Taking N=10 as an example, if 10 computing resources are used to calculate 10 results in parallel, the hardware overhead is 10 times the original; if 10 roots are calculated serially, a lot of computing time will be consumed. In order to reduce the complexity of the high-order Nth root, this embodiment uses the similarity in the process of solving the N roots to share computing resources, and finally connects the parallel result processing units for parallel processing, thereby reducing the hardware implementation complexity of the high-order Nth root.

[0038] This embodiment uses three coordinate systems and five CORDIC algorithms to calculate the Nth root of a complex number. Each coordinate system includes two modes: rotation and vector. The generalized CORDIC formula is as follows:

[0039] x k+1 =x k -μd k (2 -k y k )

[0040] y k+1 =y k +d k (2 -k x k )

[0041] z k+1 =z k -d k e k

[0042] Where k represents the current iteration number, d k represents the decision operator, d k The value of d is determined by the CORDIC operating mode. In rotation mode, d k =sign( zk ); in vector mode, d k =sign(x k y k ). In addition, when different coordinate systems are used to describe the CORDIC equations, μ and e k The value of is shown in the following formula:

[0043]

[0044] In the above formula, circlar represents circular coordinate system, linear represents linear coordinate system, and hyperbolic represents hyperbolic coordinate system. In general, k starts from 0, and the value of k increases by 1 in each iteration. It can also be expanded in the negative direction, that is, k starts from a negative value, to expand the calculation range; an exception to the hyperbolic coordinate system is that when k = 4, 13, 40, these fixed special values, the iteration needs to be repeated once to ensure convergence.

[0045] This embodiment performs 23 iterations for each CORDIC operator to complete the result convergence. Theoretically, without considering the accuracy, the number of iterations of this system can be any value. This embodiment takes 23 times as an example, based on the software simulation, it is found that 23 iterations can achieve higher accuracy. The maximum number of positive iterations is selected as 20, at which time the relative error can reach 10 -6 , which is sufficient to meet the requirements of good accuracy; at the same time, the maximum index of negative iteration is -2, which can extend the input range to 10 -8 to 10 4 , which satisfies the Nth root operation of general data. After 23 iterations, the CORDIC equation converges to the value shown in Table 1.

[0046] Table 1 Output convergence values ​​of CORDIC in three coordinate systems and two modes

[0047]

[0048] In Table 1, χ and λ are scaling factors used to correct the results. For a circular coordinate system, For a hyperbolic coordinate system, Since the number of iterations is known, these scaling factors are constants and can be pre-computed by software and stored in a lookup table to avoid complex hardware calculations.

[0049] According to Table 1, the Nth root of the complex number z=m+j*n is calculated using the circular vector calculation unit, the hyperbolic vector calculation unit, the first linear vector calculation unit, the hyperbolic rotation calculation unit, the second linear vector calculation unit and the circular rotation calculation unit. The calculation result of the circular vector calculation unit needs to pass through a multi-level buffer unit before sending the data to the second linear vector calculation unit to ensure synchronization with the hyperbolic rotation calculation unit. The connection mode of each CORIDC calculation unit and the input and output values ​​are as follows: Figure 1 As shown, the result processing unit performs shift and addition operations to finally output The real and imaginary parts of .

[0050] The exponential form of z is ρe j(2dπ+θ ), solve the Nth root of the complex number z by exponential form; then:

[0051] in d=0,1,...,N-1;when m≥0, When m<0, n≥0, When m<0, n<0,

[0052] According to N different d values, There are N roots; when the value of d is determined, and is a constant, which is stored in the lookup table in advance, and the corresponding constant is flexibly taken out according to different integers N between 2 and 10 to save hardware calculation time.

[0053] like Figure 2 As shown, the result processing unit includes a multiplier, an adder and a subtractor, the output ends of the first multiplier and the third multiplier are connected to the input end of the adder, and the calculation output The output of the second multiplier and the fourth multiplier is connected to the input of the subtractor to calculate the output The result processing unit adopts a parallel structure, and the trigonometric function two-angle sum and difference formula is used in the parallel result processing unit to calculate The real part of and the imaginary part

[0054]

[0055]

[0056] The integer N value input in each clock cycle can change dynamically between 2 and 10. The parallel result processing unit dynamically activates different result units in the result processing unit according to the different input integers N to complete the calculation of N roots in parallel, such as Figure 2 As shown, at this time N=3, result1 to result3 units are activated in the result processing unit, and 3 roots are calculated at the same time.

[0057] Figure 3 This is the 23-stage pipeline architecture diagram of the CV-CORDIC module in the present invention. The architecture of other CORDIC module operators is similar. In the first three reverse iterations, k = 0, 0, 0, and the iteration formula at this time is:

[0058] x k+1 =x k -sign(y k )*y k

[0059] y k+1 =y k +sign(y k )*x k

[0060] z k+1 =z k -sign(y k )*tan -1 (1)

[0061] In the next twenty forward iterations, k = 1, 2, ..., 20, and the iteration formula is:

[0062] x k+1 =x k -sign(y k )*y k *2 -k

[0063] y k+1 =y k +sign(y k )*x k *2 -k

[0064] z k+1 =z k -sign(y k )*tan -1 (2 -k )

[0065] where tan -1 (1) and tan -1 (2 -k) is stored in the lookup table. In this embodiment, each CORDIC module operator is iterated 23 times to complete the result convergence. The number of iterations matches the pipeline level, and finally a high-throughput fixed-point implementation of 2 to 10 square root calculations can be completed. Software simulation confirms that the maximum number of positive iterations selected is 20, which is sufficient to meet the requirements of good accuracy. At the same time, the maximum index of negative iterations is -2. For the three coordinate systems, the negative expansion method is slightly different, specifically:

[0066] (a) For the circular coordinate system CORDIC algorithm, the sequence given by k = 0, 0, 0, 1, ..., 20 has been verified to be a better sequence than k = -2, -1, 0, 1, ..., 20;

[0067] (b) For the linear coordinate system CORDIC algorithm, the iteration index set is expanded to k = -2, -1, 0, 1, ..., 20, as Figure 3 Show;

[0068] (c) For the hyperbolic coordinate system CORDIC algorithm, like the linear coordinate system CORDIC algorithm, the iteration index set is expanded to k = -2, -1, 0, 1, ..., 20. The difference from the linear coordinate system CORDIC algorithm is that in the hyperbolic coordinate system CORDIC algorithm, the negative iteration has an iteration formula independent of the positive iteration operation.

[0069] This embodiment expands the complex input range through negative iteration, and performs simulation calculations of 10,000 data through MATLAB. In this embodiment, the number of positive iterations determines the accuracy, and the negative iteration is used to expand the convergence range, which has great flexibility.

[0070] Assuming that the maximum number of negative iterations is -2 and the maximum number of positive iterations is P, on this basis, the relationship between the average relative error and the integer N value and the positive iteration number P is explored in the experiment.

[0071] The integer N supports values ​​from 2 to 10. When P varies from 15 to 20, we get Figure 4 The simulation relationship diagram of the average relative error, integer N value and positive iteration number P is shown. When P = 20, the average relative error can reach 1.38*10-6, which can support 10 -8 to 10 4 The input range is

[0072] This embodiment uses Verilog HDL language for modeling and performs hardware simulation based on 10,000 test data. The average relative error is 2.9578*10 -6Taking N=10 as an example, an example circuit using TSMC 28nm CMOS technology is synthesized through hardware implementation. Table 2 is a comprehensive result and performance comparison table of this embodiment and the prior art.

[0073] Table 2

[0074] Technology Architecture frequency <![CDATA[Area (μm 2 )]]> Calculating Delay Accuracy Preliminary work 1 28nm Non-pipelined architecture 1.5GHz 6561 170.9ns <![CDATA[9.6117*10 -5 ]]> Preliminary work 2 28nm Pipeline architecture 2.218GHz 67964.17 4.50ns <![CDATA[2.9660*10 -6 ]]> The present invention works 28nm Pipeline architecture 2.218GHz 68070.87 0.451ns <![CDATA[2.9578*10 -6 ]]>

[0075] Preliminary work 1 is a patent cited in the background technology and is the result of the applicant's preliminary work. This method operates at a frequency of 1.5 GHz and does not adopt a pipeline architecture. It can only serially calculate the Nth root of each input complex number based on the value of N, and only calculates one of the N results each time. Taking N=10 as an example, calculating the 10th root of a complex number requires 255 clock cycles, or 170.9ns.

[0076] Preliminary work 2 is to add a pipeline architecture based on preliminary work 1, with an operating frequency of 2.218 GHz. Taking N=10 as an example, only 1 of the 10 roots is calculated each time, and it takes 10 clock cycles to calculate the 10th root of a complex number, which takes 4.5ns.

[0077] Based on the previous work 2, this embodiment designs a parallel result processing unit and uses the similarity of the N-root solution process of a complex number to reduce the computational complexity. Taking N=i0 as an example, after earlier calculations, it only takes one clock cycle, or 0.45ns, to calculate the 10th root of a complex number.

[0078] According to the comprehensive results in Table 2, the circuit complexity of this embodiment is only 0.157% higher than that of the previous work 2, but the calculation speed is increased by 10 times. Compared with the previous work 1, the calculation efficiency of the system in this embodiment can be increased by 379 times at most, and the hardware implementation accuracy is also improved by 1 order of magnitude.

[0079] In summary, the present invention provides a low hardware complexity architecture that dynamically supports complex number 2 to 10th root operations. The architecture uses three CORDIC systems: circular, linear, and hyperbolic to build a hardware efficient algorithm. The convergence range is expanded, and software simulation can support 10 -8 to 10 4 The input range reaches 10 -6 The relative error of the algorithm is large, and it supports a wide range and high precision. It adopts a pipeline architecture to achieve high-speed full-pipeline calculation. It uses the similarity of the N-th root solution process of complex numbers to reduce the calculation complexity. It can dynamically support the calculation of the 2nd to 10th roots of complex numbers, and has the characteristics of high efficiency, high precision and low hardware complexity.

[0080] The invention and its implementation methods are described schematically above, and the description is non-restrictive. Although the invention has been represented and described with reference to specific preferred embodiments, it shall not be construed as a limitation on the invention itself. Various changes may be made to it in form and detail without departing from the spirit or basic characteristics of the invention. Without departing from the purpose of the invention, structural methods and embodiments similar to the technical solution are designed without creativity, and all of them shall belong to the protection scope of the present application. The multiple elements stated in the present application may also be implemented by one element through software or hardware. Words such as first and second are used to represent names, and do not represent any specific order.

Claims

1. A device for solving the Nth root of a complex number, the complex number is represented by z=a+b*i, characterized in that: The device includes a CORDIC calculation module and a result processing unit. After the input data a and b are calculated by the CORDIC module, they are input into the result processing unit for calculation to obtain the calculation result. The CORDIC module includes a first coordinate conversion unit, a modulus calculation unit, a phase angle calculation unit, and a second coordinate conversion unit. The first coordinate conversion unit includes a circular vector calculation unit; the modulus calculation unit includes a first linear vector calculation unit, a hyperbolic vector calculation unit, and a hyperbolic rotation calculation unit; the phase angle calculation unit includes a second linear vector calculation unit; and the second coordinate conversion unit includes a circular rotation calculation unit. The input data is input into the first coordinate conversion unit, and converted from the plane coordinate form to the polar coordinate form. After the coordinate conversion, the data is calculated by the modulus length calculation unit and the phase angle calculation unit respectively, and then input into the second coordinate conversion unit to convert the polar coordinate form into the plane coordinate form. The CORDIC module uses a pipeline architecture. The result processing unit includes a plurality of parallel sub-computing units. Different sub-computing units in the result processing unit are dynamically activated according to different integers N input to the processing unit to complete the calculation of N roots in parallel.

2. The device for solving the Nth root of a complex number according to claim 1, characterized in that: The number of convergence times of the CORDIC module is X, where X is an integer greater than zero; the CORDIC module is iterated X times through an X-stage pipeline architecture to complete result convergence.

3. The device for solving the Nth root of a complex number according to claim 2, characterized in that: The number of iterations includes the positive number of iterations used to determine the calculation accuracy and the negative number of iterations used to expand the calculation convergence range.

4. The device for solving the Nth root of a complex number according to claim 3, characterized in that: The device also includes a lookup table for storing constant values ​​related to N.

5. The device for solving the Nth root of a complex number according to claim 4, characterized in that: The sub-calculation unit uses the trigonometric function two-angle sum and difference formula to calculate The real and imaginary parts of .

6. The device for solving the Nth root of a complex number according to claim 5, characterized in that: The sub-calculation unit includes a multiplier, an adder and a subtractor. The output ends of the first multiplier and the third multiplier are connected to the input end of the adder. The output of the second multiplier and the fourth multiplier is connected to the input of the subtractor to calculate the output The real part of .

7. A method for solving the Nth root of a complex number, characterized in that: Using the device for solving the Nth root of a complex number as claimed in any one of claims 1 to 6, the complex number is represented as , input data , the CORDIC module is iterated X times through the pipeline architecture to complete the result convergence, where X is an integer greater than zero; the calculation result of the CORDIC module is transmitted to the result processing unit for parallel calculation to obtain the calculation result.

8. A method for solving the Nth root of a complex number according to claim 7, characterized in that: N is an integer greater than or equal to two and less than or equal to ten.