Background technology
Calculate for phase place rotation and sine and cosine value, when hardware is realized, generally can select to use cordic algorithm, replace numerous and diverse (plural number) multiplication.CORDIC is called the rotation of coordinate numerical calculation method again, is a kind of alternative manner that is used to calculate the generalized vector rotation.This basic idea through a series of fixing, relevant continuous beats of angle with the computing radix to approach the required anglec of rotation.
Cordic algorithm has only been used addition and shifting function in the realization of hardware circuit, practiced thrift hardware resource greatly, thereby can satisfy deviser's requirement.
Introduce the basic thought of cordic algorithm below briefly.As shown in Figure 1, vector
 is rotated counterclockwise θ degree angle to vector
, and this relational expression can be following with matrix representation:
If angle θ can have N θiAngle superposes and obtains, and it is following to draw the overlap-add operation in each step according to formula (1) so:
Using equation (2) can be expressed through the N-step superimposed by the vector
 Rotate to the vector
  expressed as follows:
Because COMPUTER CALCULATION adopts binary mode, so choose θi=λiArctan (2-i), choose θ like thisiMade things convenient for tan θiCalculating, i.e. tan θi=λi2-i(λi=1,1}), i=0 wherein, 1 ..., N-1.The cos θ of formula (3) frontiCan get the tired limit of taking advantage of:
If in designed system in advance calculating K ', when casting aside K ' and do not include, formula (3) just can become so:
The precision of calculating is by the size decision of N, the λ in formula (5) and the formula (6)iConcrete condition by each step is decided.
Utilize cordic algorithm to ask for the phase angle of plural number and ask the principle of sine and cosine of phase angle as shown in Figure 2, establish initial vector Z0:x0+ jy0, after N angle rotation, obtain vector Z N:xN+ jyN, the angle of the i+1 time rotation is θi, make θi=arctan (2-i), vector is x before the rotationi+ jyi, corresponding phasing degree is Zi, anglec of rotation θiAfter become xI+1+ jyI+1, corresponding phase angle is ZI+1λ whereini∈ 1,1}, λiThe representation vector sense of rotation according to the derivation of J.S.Walter, has the iterative equation group:
Write as matrix form:
zi+1=zi-λi·arctan(2-i) (9)
Because
 utilizes CORDIC to ask the phase angular region should be controlled in
; In like manner, the phase angle that carries out phase alignment also should be controlled in
.
Cordic algorithm is applied to ask the phase angle and the mould of plural number, and the method when asking sine and the cosine of plural number is following:
(1) ask plural phase angle and mould: the difference with start vector Z0 phase angle after the i time angle rotation is Z
i, when
The time, the result of calculation of N iteration is:
Can be by formula (10) in the hope of the mould and the phase angle of plural number.
(2) ask plural sine and cosine: the difference with angle on target after the i time angle rotation is Z
iZ0 is own selected reference vector,
Be known phase.
During as
, the result of calculation of N iteration is:
Get x0=1/K, y0=0, then can try to achieve the sine and cosine value of phase angle.
Yet inventor of the present invention finds, because by N θ
iWhen the angle stack obtains anglec of rotation θ, be to begin stack from i=0 all the time, promptly the initial phase angle of iteration is always
But in actual conditions, anglec of rotation θ maybe be less than π/4.And when carrying out phase place rotation less than the angle of π/4 and asking trigonometric function to calculate, still need use ratio | and θ | big phase angle (like arctan (1)) carries out iteration, is unfavorable for the minimizing on hardware resource and the time overhead.
And when carrying out phase place rotation calculating, existing cordic algorithm is after iterative computation is accomplished; The size of anglec of rotation θ no matter; All need carry out amplitude calibration one time to the real part and the imaginary part of data, promptly multiplication by constants K ' has also caused certain expense to hardware resource with on the time.
Summary of the invention
The object of the present invention is to provide improving one's methods and installing of a kind of rotation of coordinate digital computation, to reduce hardware resource and time overhead.
For solving the problems of the technologies described above, embodiment of the present invention provides improving one's methods of a kind of rotation of coordinate digital computation, comprises following steps:
According to the size of anglec of rotation θ, select the initial phase angle of iteration; Wherein, the initial phase angle of the iteration of selection is less than said θ;
With the initial phase angle of the initial phase angle of the iteration of said selection, carry out the rotation of coordinate digital computation as iteration in the rotation of coordinate digital computation.
Embodiment of the present invention also provides a kind of modifying device of rotation of coordinate digital computation, comprises:
The initial phase angle of iteration is selected module, is used for the size according to anglec of rotation θ, selects the initial phase angle of iteration; Wherein, the initial phase angle of the iteration of selection is less than said θ;
Rotation of coordinate digital computation module is used for the initial phase angle of the initial phase angle of the iteration of said selection as rotation of coordinate digital computation iteration carried out the rotation of coordinate digital computation.
Embodiment of the present invention according to the size of anglec of rotation θ, is selected the absolute value than the anglec of rotation in terms of existing technologies | θ | the initial phase angle of littler iteration, carry out the CORDIC interative computation.Owing to be size according to anglec of rotation θ; The initial phase angle of iteration during decision CORDIC calculates, therefore as far as the small rotation angle, as | θ | the angle of<π/4; Can avoid the use of ratio | θ | big phase angle (like arctan (1)) carries out iteration; Promptly do not do that time iteration of i=0, thereby reduced iterations not influencing under the prerequisite of approaching effect, and then reduced hardware in resource and temporal expense.
In addition, at the initial phase angle of candidate's iteration
I=0,1,2......, N
Iter(N in-1
IterBe maximum iteration time), search less than | θ | and approach most | θ |
With what find
As the initial phase angle of selecting of iteration, guaranteed to calculate the accuracy of effect.
In addition, before carrying out amplitude calibration, judging whether earlier to carry out amplitude calibration, is in the time of need carrying out amplitude calibration, again the data behind the interative computation to be carried out amplitude calibration in result of determination; Otherwise, directly with the data behind the interative computation as final result.Because when phase angle theta is very little, be used to carry out the constant K of amplitude calibration 'nQuite approaching with 1; Do not carry out amplitude calibration this moment, make that the CORDIC calculating after improving need not to use multiplication, and only use addition and shifting function; Can obtain phase place rotation result; Thereby the minimizing operand, the loss of precision is also very little, has further reduced hardware in resource and temporal expense.
Embodiment
First embodiment of the present invention relates to improving one's methods of a kind of rotation of coordinate digital computation.Idiographic flow is as shown in Figure 1.
In
step 110; It is identical with prior art anglec of rotation θ to be transformed into
 this step, repeats no more at this.
Then, instep 120, according to the size of anglec of rotation θ, select the initial phase angle of iteration, wherein, the initial phase angle of the iteration of selection is less than the absolute value of the anglec of rotation | θ |.
Specifically, because COMPUTER CALCULATION adopts binary mode, for making things convenient for tan θ
iCalculating, the initial phase angle of candidate's iteration does
I=0,1,2......, N
Iter-1, wherein, N
IterBe maximum iteration time.When selecting the initial phase angle of iteration,
(i=0,1,2......, N
Iter-1) in, search less than | θ | and approach most | θ |
With what find
As the initial phase angle of selecting of iteration.
Such as; During as
; Find less than | θ | and approach most | θ |
 when being i=1 that is to say; The initial phase angle of iteration selects for use that
 littler than θ to begin to carry out iteration; The phase angle iteration of i.e. use
 beginning, (i.e.
) begins to carry out iteration and do not use
.During as
; Find less than | θ | and approach most | θ |
 when being i=2 that is to say; The initial phase angle of iteration selects for use that
 littler than θ to begin to carry out iteration; The phase angle iteration of i.e. use
 beginning, (i.e.
) and
 begins to carry out iteration and do not use
.The rest may be inferred; As | θ | more hour, always select for use that
 littler than θ to begin to carry out iteration.
Then, in
step 130,, carry out the interative computation in the rotation of coordinate digital computation with the initial phase angle of the initial phase angle of selecting of iteration as iteration in the CORDIC calculating.Such as, if when the initial phase angle of selecting of iteration is i=1
Begin to carry out iteration during promptly from i=1, iteration initial value i=1, iterative manner is i=1,2......N
Iter-1, time iteration of that when not being i=0.When if the initial phase angle of selecting of iteration is i=2
Begin to carry out iteration during promptly from i=2, iteration initial value i=2, iterative manner is i=2,3......N
Iter-1, be not i=0, twice iteration of that of 1 o'clock.Wherein, the account form in the iterative process is identical with existing C ORDIC account form each time, repeats no more at this.
Then, instep 140, the data behind the interative computation are carried out amplitude calibration, this step is identical with prior art, repeats no more at this.
Be not difficult to find, in this embodiment, owing to be size according to anglec of rotation θ; The initial phase angle of iteration during decision CORDIC calculates, for some angle θ ± m* π,
 m=0; 1,2 ... (for example | θ | the angle of<arctan (1)); When carrying out phase place rotation and trigonometric function calculating; Can not use ratio | θ | big phase angle (like arctan (1)) carries out iteration, and only uses less than | θ | phase angle carry out iterative approach, thereby can accelerate speed of convergence; Reduce iterations, and then reduce operand.That is to say; As far as the small rotation angle; As | θ | the angle of<π/4 can avoid the use of ratio | θ | big phase angle (like arctan (1)) carries out iteration, does not promptly do that time iteration of i=0; Thereby reduced iterations not influencing under the prerequisite of approaching effect, and then reduced hardware in resource and temporal expense.And; With find less than | θ | and approach most | θ |
 as the initial phase angle of selecting of iteration, effectively guaranteed to calculate the accuracy of effect.
Second embodiment of the present invention relates to improving one's methods of a kind of rotation of coordinate digital computation.Second embodiment has been done further improvement on the basis of first embodiment, main improvements are:
In the first embodiment, after accomplishing the CORDIC interative computation, directly get into the step that the amplitude after the iteration is calibrated.And in second embodiment of the invention, before carrying out amplitude calibration, need judge whether to carry out amplitude calibration earlier, if judgement need be carried out amplitude calibration, then carry out amplitude calibration again; If judge and need not carry out amplitude calibration, then directly with the data behind the interative computation as final result, as shown in Figure 2.
Specifically, because angle is more little, iterations is few more, be used to carry out the constant K of amplitude calibration 'nAlso more near 1, K 'nComputing method following:
Therefore, can calculate under the different n values corresponding K ' in advancenSuch as, work as NIter=11 o'clock, through the K ' under the different n values that calculatenAs follows:
K′n=[0.60725,0.858785,0.96015,0.9897,0.9974,0.999349,0.9998373,1.0,1.0,1.0,1.0,1.0]
Because according to the initial phase angle of selecting of iteration
Iteration initial value i can be obtained,, K ' corresponding under the different iteration initial values can be obtained the value of iteration initial value as n
nAs working as
The time, iteration initial value i=n=1, K ' at this moment
nBe 0.858785; When
The time, iteration initial value i=n=2, K ' at this moment
nBe 0.96015.Be not difficult to find,
When θ is very little, make n=7,8,9,10 one of them the time, K 'n≈ 1.Therefore, can be with K ' corresponding under the iteration initial valuenDifference with 1 compares with preset thresholding, if the K ' of correspondence under the iteration initial valuenWith 1 difference less than preset thresholding, then the explanation constant that is used to carry out amplitude calibration has been equivalent to 1, judges and need not carry out amplitude calibration; If the K ' of correspondence under the iteration initial valuenBe not less than preset thresholding with 1 difference, then get into the step of amplitude calibration again.
To above-mentioned case, work as n=0,1 ...,, choose K ' corresponding under the iteration initial value at 6 o'clocknAmplitude to after the iteration is calibrated; When n greater than 6 the time, the amplitude after the iteration is not calibrated, directly with the data behind the interative computation as final result.CORDIC computing method after feasible the improvement; Can omit last multiply operation for some angles, owing to need not to use multiplication, and only use addition and shifting function; Can obtain phase place rotation result; Thereby the minimizing operand, the loss of precision is also very little, has further reduced hardware in resource and temporal expense.
In addition, it will be understood by those skilled in the art that each method embodiment of the present invention can be applicable to phase place rotation and calculates, asks trigonometric function to calculate, ask during the modulus of complex number etc. calculates.Promptly calculate the phase place rotation, asking trigonometric function value (just, cosine) and ask under the situation of modulus of complex number value, can reduce iterations to a certain extent; Under some less angle; Can operate by contraction in multiplication, thereby reduce operand, reduce hardware resource and time overhead.Use respectively in existing C ORDIC and the embodiment of the present invention improved cordic algorithm to phase place rotation carry out iterative approach, result such as Fig. 3, shown in Figure 4.Wherein, " Cordic " curve representation of Fig. 3 uses the fixed point error that existing C ORDIC algorithm carries out the phase place rotation; " Cordic-new " curve representation of Fig. 4 uses the fixed point error that improved cordic algorithm carries out the phase place rotation in the embodiment of the present invention.The relative MSE

 that two kinds of methods are carried out the phase place rotation is as follows:
Cordic:5.170246804540731e-003
Cordic-new:5.172967852134145e-003
What deserves to be mentioned is, above the step of the whole bag of tricks divide, just clear in order to describe; Can merge into a step during realization perhaps splits some step; Be decomposed into a plurality of steps, as long as comprise identical logical relation, all in the protection domain of this patent; To adding inessential modification in the algorithm or in the flow process or introduce inessential design, but the core design that does not change its algorithm and flow process is all in the protection domain of this patent.
Third embodiment of the invention relates to a kind of modifying device of rotation of coordinate digital computation, and is as shown in Figure 5, comprises:
The initial phase angle of iteration is selected module, is used for the size according to anglec of rotation θ, selects the initial phase angle of iteration; Wherein, the initial phase angle of the iteration of selection is less than the absolute value of the anglec of rotation | θ |;
Rotation of coordinate digital computation module is used for the initial phase angle of the initial phase angle of selecting of iteration as rotation of coordinate digital computation iteration carried out the rotation of coordinate digital computation.It will be understood by those skilled in the art that in rotation of coordinate digital computation module, include the amplitude calibration submodule, be used for the data behind the interative computation are carried out amplitude calibration.
Wherein, the initial phase angle of iteration selects module to include the submodule that is used for anglec of rotation θ is transformed into
.The initial phase angle of candidate's iteration does
I=0,1,2......, N
Iter-1, wherein, N
IterBe maximum iteration time.The initial phase angle of iteration selects module when selecting the initial phase angle of iteration; In the initial phase angle of candidate's iteration, search less than | θ | and approach most | θ |
 that will find as the initial phase angle of selecting of iteration.
Be not difficult to find that this embodiment is and the corresponding system embodiment of first embodiment, this embodiment can with the enforcement of working in coordination of first embodiment.The correlation technique details of mentioning in first embodiment is still effective in this embodiment, in order to reduce repetition, repeats no more here.Correspondingly, the correlation technique details of mentioning in this embodiment also can be applicable in first embodiment.
Four embodiment of the invention relates to a kind of modifying device of rotation of coordinate digital computation.The 4th embodiment and the 3rd embodiment are roughly the same, and key distinction part is:
In the 3rd embodiment, the amplitude calibration submodule in the rotation of coordinate digital computation module need carry out amplitude calibration to the data behind the interative computation all the time.And in four embodiment of the invention; Also comprise amplitude calibration decision-making submodule in the rotation of coordinate digital computation module, be used for after rotation of coordinate digital computation module is accomplished the interative computation of rotation of coordinate digital computation, judging whether to carry out amplitude calibration; And when judgement need be carried out amplitude calibration; Trigger this amplitude calibration module, judging when need not carry out amplitude calibration, directly with the data behind the interative computation as final result.
Wherein, this amplitude calibration decision-making submodule comprises following subelement:
The calibration constants computation subunit is used for calculating in advance under the different n values, be used to carry out the constant K of amplitude calibration '
n, wherein,
N=0,1,2......, N
IterRelatively subelement is used for according to the initial phase angle of selecting of iteration
Obtain the iteration initial value, and with the value of iteration initial value as n, with K ' corresponding under the iteration initial value
nCompare with 1 difference and preset thresholding, during less than preset thresholding, judge and need not carry out amplitude calibration in difference; During more than or equal to preset thresholding, judgement need be carried out amplitude calibration in difference.
The modifying device that it will be understood by those skilled in the art that above-mentioned rotation of coordinate digital computation can be applicable to phase place rotation calculating, asks trigonometric function to calculate, ask in the modulus of complex number.
Be not difficult to find that this embodiment is and the corresponding system embodiment of second embodiment, this embodiment can with the enforcement of working in coordination of second embodiment.The correlation technique details of mentioning in second embodiment is still effective in this embodiment, in order to reduce repetition, repeats no more here.Correspondingly, the correlation technique details of mentioning in this embodiment also can be applicable in second embodiment.
What deserves to be mentioned is that each involved in this embodiment module is logic module, in practical application, a logical block can be a physical location, also can be the part of a physical location, can also realize with the combination of a plurality of physical locations.In addition, for outstanding innovation part of the present invention, will not introduce in this embodiment, but this does not show the unit that does not have other in this embodiment with solving the not too close unit of technical matters relation proposed by the invention.
Above-mentioned each embodiment is to realize specific embodiment of the present invention, and in practical application, can be in form with on the details it is done various changes, and without departing from the spirit and scope of the present invention.