METHOD AND DEVICE FOR NUMERICALLY GENERATING A FREQUENCY

Information

  • Patent Application
  • 20090006514
  • Publication Number
    20090006514
  • Date Filed
    June 25, 2008
    16 years ago
  • Date Published
    January 01, 2009
    15 years ago
Abstract
To generate a digital signal at a given frequency, a step of calculating at least one trigonometric function for consecutive phases separated by a phase gap φS which is dependent on the frequency to be generated is repeated, and, during the step of calculating said trigonometric function for a phase of index k, k representing a phase incrementation index according to the phase gap φS, a result of the trigonometric function for the phase of index k is calculated on the basis of rounded results of the trigonometric function for the previous phase of index k−1 and for said phase gap respectively. A number N of rounded results of the trigonometric function for said phase gap φS and respective probabilities pi of selecting said N rounded results being provided, one of the N rounded results for the phase gap φS is selected, taking account of the determined selection probabilities pi, to calculate the result of the trigonometric function for the phase of index k.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based upon and claims the benefit of priority from France Patent Application No. 07 56038, filed Jun. 26, 2007, the entire contents of which are incorporated herein by reference.


SUMMARY

The invention relates to a method and a device for numerically generating a digital signal of a given frequency.


To numerically generate a frequency, one solution consists in generating the discrete values of one or more trigonometric functions, for example cosine and sine, corresponding to the frequency to be generated, these discrete values corresponding to points situated on the curves of the trigonometric functions used.


Among the various existing digital frequency generation procedures, there is one, dubbed “recursive” or “iterative”, which is based on calculating sines and cosines of consecutive angles. This procedure relies on the following trigonometric identity:






e


k

=e
j(kφ

s



0

)
=e
j[(k−1)φ

s



0

]
·e


s

=e


k−1

·e


s
  (1)


where

    • φ0 represents an initial phase, generally such that φ0=0,
    • φs represents a constant phase gap, defined by the relation φs=2π·fc/fs, where fc, fs correspond respectively to the frequency to be generated and to a sampling frequency for the digital signal generated,
    • k represents a phase incrementation index for the calculation of sines and cosines of consecutive angles, or phases, such that k=1, 2, . . . .


Putting xk=cos φk and yk=sin φk.


It follows from identity (1) that:





xk=xk−1·cos φs−yk−1·sin φs  (2)





yk=yk−1·cos φs+xk−1·sin φs  (3)


Thus, the initial phase φ0 and the phase gap φs being known, the sine and cosines values of the following phases φk for k=1, 2, 3, 4, . . . are deduced recursively, from the cosine and sine values of the initial phase φ0. Stated otherwise, it is possible to calculate the values of the pairs (xk, yk) recursively, from the initial pair (x0, y0).


By way of illustrative example, we shall describe the calculation of the sines and cosines for k=1, k=2 and k=3, with an initial phase φ0=0° and a phase gap φs=1°. For the requirements of the calculations, the cosine and the sine of the angle φs=1° are calculated and stored: cos(1°)=0.999848 and sin(1°)=0.017452.


Initially, for k=0, we have cos φ0=1 and sin φ0=0.


Thereafter, for k=1, cos φ1 and sin φ1 are calculated from cos φ0 and sin φ0 with the aid of equations (2) and (3):






x
1
=x
0·cos(1°)−y0·sin(1°)=1·cos(1°)−0·sin(1°)=0.999848






y
1
=y
0·cos(1°)+x0·sin(1°)=0·cos(1°)+1·sin(1°)=0.017452


Thereafter, for k=2, cos φ2 and sin φ2 are calculated from cos φ1 and sin φ1 with the aid of equations (2) and (3):










x
2

=





x
1

·

cos


(

1

°

)



-


y
1

·

sin


(

1

°

)










=





(
0.999848
)

·

(
0.999848
)


-


(
0.017452
)

·

(
0.017452
)









=


0.999391













y
2

=





y
1

·

cos


(

1

°

)



+


x
1

·

sin


(

1

°

)










=





(
0.017452
)

·

(
0.999848
)


+


(
0.999848
)

·

(
0.017452
)









=


0.034899







Thereafter, for k=3, cos φ3 and sin φ3 are calculated from cos φ2 and sin φ2 with the aid of equations (2) and (3):










x
3

=





x
2

·

cos


(

1

°

)



-


y
2

·

sin


(

1

°

)










=





(
0.999391
)

·

(
0.999848
)


-


(
0.034899
)

·

(
0.017452
)









=


0.998629













y
3

=





y
2

·

cos


(

1

°

)



+


x
2

·

sin


(

1

°

)










=





(
0.034899
)

·

(
0.999848
)


+


(
0.999391
)

·

(
0.017452
)









=


0.052336







The procedure thus makes it possible to recursively calculate the sines and cosines of consecutive angles.


Trigonometric calculations using standard trigonometric functions consume a great deal of calculation time. With the recursive procedure which has just been described for the trigonometric calculation of consecutive angles, the results of the sines and cosines of consecutive angles are calculated without calling upon trigonometric functions. Specifically, the calculations use the results of the sines and cosines of the phase gap φs and require that only multiplication and addition operations be carried out. This procedure thus exhibits the advantage of being able to be implemented with simple hardware and/or software means and of offering a constant calculation speed, independently of the precision required for the frequency generated. Its use is therefore particularly beneficial.


However, such a procedure for the trigonometric calculation of consecutive angles exhibits a major drawback: it is numerically unstable. This drawback is related to the fact that it is recursive, that is to say it calculates the values (xk, yk) from the previously calculated result (xk−1, yk−1), and that the numerical calculation means impose a finite precision for the calculations. In particular, the calculations of the values (xk, yk) are carried out on the basis of rounded values with the finite precision used of the values (xk−1, yk−1) and of the cosines and sines of the phase gap φs. Furthermore, the result provided by the calculation means for the pair of values (xk, yk) is itself a rounded value, an approximation of the real result of the calculations. Such approximations produce, at each phase increment k, an error in the calculations. This error feeds into the following calculations, corresponding to the phase increment (k+1), which amplify it further. As a function of the initial values of the pairs (x0, y0) and (xs, ys), the pair of calculated values (xk, yk) may either degenerate towards zero, or increase towards the infinity. This entails an evolving vicious circle producing a “snowball effect” which considerably and rapidly degrades the precision of the calculations. This is the reason why this procedure for numerically generating the frequency of consecutive angles is unusable in practice.


The present invention proposes a method of numerically generating a given frequency, in which

    • a step of calculating at least one trigonometric function for consecutive phases separated by a phase gap φS which is dependent on the frequency to be generated is repeated, and
    • during the step of calculating said trigonometric function for a phase of index k, k representing a phase incrementation index according to the phase gap φS, a result of the trigonometric function for the phase of index k is calculated on the basis of rounded results of the trigonometric function for the previous phase of index k−1 and for said phase gap respectively


which makes it possible to solve the numerical instability problem explained in the preceding paragraph.


For this purpose, a number N of rounded results of the trigonometric function for said phase gap φS and respective probabilities pi of selecting said N rounded results being provided, the invention resides in the fact of selecting one of the N rounded results for the phase gap φS, and of calculating the result of the trigonometric function for the phase of index k taking account of the determined selection probabilities pi.


The invention therefore consists in selecting each of the N rounded results of the trigonometric function for the phase gap with a predefined selection probability. The probabilities of drawing, or of selecting, the various rounded results can thus be chosen so as to ensure numerical stability of the iterative calculation method. Instead of accumulating and therefore amplifying, the successive rounding errors compensate one another and mutually cancel one another.


In a particular embodiment, to select one of the N rounded results for the phase gap φS taking account of the determined selection probabilities pi,

    • a random number (l) uniformly distributed over a reference interval is generated;
    • the reference interval being divided into N disjoint intervals In of respective lengths proportional to the probabilities pi with 1≦i≦N, the interval Ij, from among said N intervals In, to which the generated random number (l) belongs, is determined;
    • and, from among the N rounded results of the trigonometric function for the phase gap φS, that having the selection probability pj corresponding to the length of the determined interval Ij is selected.


By virtue of this, the respective probabilities of selecting the various rounded results are taken into account in a simple and effective manner to select these rounded results during the iterative calculation process.


Advantageously, the rounded results being calculated with a finite precision of w bits on the fractional part, it being assumed that the results are represented using a fixed decimal point with w bits after the decimal point, the result of the trigonometric function for the phase of index k, obtained by multiplication of the rounded results of the trigonometric function for the previous phase of index k−1 and for the phase gap respectively, is rounded by truncating the fractional part of said result for the phase of index k by a portion of w bits and the value represented by the portion of the w truncated bits in the reference interval is determined so as to generate the random number.


The invention also relates to a device for numerically generating a given frequency comprising iterative calculation means designed to repeat the calculation of at least one trigonometric function for consecutive phases separated by a phase gap φS which is dependent on the frequency to be generated, the calculation of said trigonometric function for a phase of index k, k representing a phase incrementation index according to the phase gap φS, being carried out on the basis of a rounded result of the trigonometric function for the previous phase of index k−1 and of a rounded result of the trigonometric function for said phase gap respectively, characterized in that it comprises

    • means for storing a number N of rounded results of the trigonometric function for said phase gap φS
    • means for storing respective probabilities pi of selecting said N rounded results
    • means for selecting one of the N rounded results for the phase gap φS, taking account of the determined selection probabilities pi, to calculate the result of the trigonometric function for the phase of index k.





BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be better understood with the aid of the following description of the method and of the device for numerically generating a given frequency according to the invention, with reference to the appended drawings in which:



FIG. 1 represents a functional block diagram of a particular embodiment of the device of the invention;



FIG. 2 represents a flowchart of a particular embodiment of the method according to the invention, corresponding to the operation of the device of FIG. 1;



FIGS. 3A and 3B represent, on a trigonometric circle, a phase gap φs used in the method of FIG. 2.





DETAILED DESCRIPTION

The method of the invention makes it possible to generate a digital signal with a given digital frequency, denoted fc, by calculating at least one trigonometric function for consecutive angles. In the particular example of the description, the trigonometric function used is the complex exponential function defined in the following manner:






e
jz=cos(z)+j sin(z)


Let us first recall the following trigonometric identity:






e


k

=e
j(kφ

s



0

)
=e
j[(k−1)φ

s



0

]
·e


s

=e


k−1

·e


s
  (1)


where

    • φ0 represents an initial phase, here φ0=0,
    • φs represents a phase gap here constant, defined by the relation φs=2π·fc/fs, where fc, fs correspond respectively to the frequency to be generated and to a sampling frequency, and
    • k represents a phase incrementation index for calculating sines and cosines of consecutive angles, or phases.


The signal generated by the frequency generator is a digital signal, sampled at the sampling frequency fs. In order to comply with the Nyquist-Shannon criterion, the frequencies fs and fc are such that








f
s


f
c





1
2

.





It follows from this that the phase gap is such that φs≦π.


The initial phase φ0 being zero, the following trigonometric identity is obtained:






e


k

=e


k−1

·e


s
  (2)


From relation (2), the complex exponential function es for the phase of index k is calculated from the result of the complex exponential function ek−1 for the phase of index k−1 and the result of the complex exponential function es for the phase gap φs.


Putting:





xk=cos φk





yk=sin φk


Then, it is possible to express the complex exponential function in the following manner:






e


k

=x
k
+j·y
k


Additionally, for the sake of conciseness, we put:






x
k
+j·y
k=(xk,yk)


The mathematical identity relation (2) yields the following relations:










k
=
0












(


x
0

,

y
0


)

=


(


cos






ϕ
0


,

sin






ϕ
0



)

=


cos






ϕ
0


+


j
·
sin







ϕ
0















k
=
1

,











(


x
k

,

y
k


)

=




cos






ϕ
k


+


j
·
sin







ϕ
k










=




(


x

k
-
1


,

y

k
-
1



)

·

(


cos






ϕ
s


+


j
·
sin







ϕ
s



)








=




(


x

k
-
1


+

j
·

y

k
-
1




)

·

(


cos






ϕ
s


+


j
·
sin







ϕ
s



)








=




(




x

k
-
1


·
cos







ϕ
s


-



y

k
-
1


·
sin







ϕ
s



)

+










j


(




y

k
-
1


·
cos







ϕ
s


+



x

k
-
1


·
sin







ϕ
s



)










(
3
)







In practice, the calculations are carried out with finite precision. In the nonlimiting particular example described here, this involves a precision of w bits on the fractional part (that is to say on the part of the number situated after the decimal point). Thus, the result of the calculation of the complex exponential function ek for the phase of index k is obtained from the approximate results of the complex exponential function respectively for the phase of index k−1, ek−1, and for the phase gap φs, es, and itself undergoes a rounding of its fractional part on w bits.


Let Qw


be a rounding operator with w bits on the fractional part. The function of this rounding operator, represented by the notation Qw[.], is to round a number, having an integer part and a fractional part coded on a certain number of bits, by truncating the fractional part of the lowest order bits so as to preserve only the w bits of the fractional part of highest orders. The result obtained is an approximate result, that will also subsequently be called a “rounded result” or “approximation”, of the number considered, with a finite precision of w bits on the fractional part.


The result of the calculation of the complex exponential function, with finite precision of w bits on the fractional part, for the phase of index k is therefore:






Q
w[(xk,yk)]=Qw[Qw[(xk−1,yk−1)]·Qw[(cos φs, sin φs)]]  (4)


A particular embodiment of the method of the invention will now be described with reference to FIG. 2.


The method comprises a preliminary phase Φ comprising

    • a step Φ1 of determining a given number N of possible rounded results, with the precision of w bits on the fractional part, of es (that is to say of the complex exponential function for said phase gap φs;
    • a step Φ2 of determining respective probabilities pi of selecting the N possible rounded results, with 1≦i≦N determined in the step Φ1.


Represented in FIG. 3A is the trigonometric circle C in a complex plane associated with a right-handed orthonormal reference frame (O,{right arrow over (u)},{right arrow over (w)}), where (O,{right arrow over (u)}) and (O,{right arrow over (w)}) respectively represent the real axis, abscissa, and the imaginary axis, ordinate. The trigonometric circle C is centered on the origin O of the complex plane and its radius is equal to 1.


Also represented in the complex plane of FIG. 3A is a vector {right arrow over (rv)}, that will subsequently be called the “phase rotation vector”, defined by the relation: {right arrow over (rv)}={right arrow over (OP)}, where

    • O represents the origin of the complex plane and
    • P represents the point of the complex plane defined the exponential expression es and appearing in FIG. 3B; it is situated on the trigonometric circle C and corresponds to the angle φs on the circle C (φs=angle between the axis (O,{right arrow over (u)}) and {right arrow over (rv)}={right arrow over (OP)}).


Ultimately, the phase rotation vector {right arrow over (rv)} models the complex exponential function for the phase gap φs, that is to say es. In the particular example described here, the rounded results, determined in the step Φ1, of the complex exponential function for the phase gap es, stated otherwise of the phase rotation vector {right arrow over (rv)}, are N=4 in number. They are modeled in FIG. 3A by four vectors {right arrow over (rvi)} with i=1, 2, 3, 4 such that {right arrow over (rvi)}={right arrow over (OPi′)}, Pi′ representing the point of the complex plane defined by the exponential expression rsies and appearing in FIG. 3B. The four points P1′, P2′, P3′, P4′ correspond to the four approximations of the point P and form a square, having two sides parallel to the axis (O,{right arrow over (u)}) and the other two to the axis (O,{right arrow over (w)}), inside which is situated the point P.


Represented in a more detailed manner in FIG. 3B are the square formed by the four points P1′, P2′, P3′, P4′, the point P situated in the interior, as well as four vectors representing the corresponding approximation errors. These approximation or rounding error vectors, denoted {right arrow over (ev1)}, {right arrow over (ev2)}, {right arrow over (ev3)}, {right arrow over (ev4)}, are defined by the point P, constituting the origin of each of them, and by the four approximation points P1′, P2′, P3′, P4′ respectively, in the following manner:





{right arrow over (evs)}={right arrow over (PPi′)} for 1≦i≦4


The sub-step Φ2 of determining the respective probabilities of selecting the four possible approximation vectors {right arrow over (rvi)} with i=1, 2, 3, 4, stated otherwise the four corresponding rounded results of the complex exponential function for the phase gap, comprises the solving of the following system of equations:













-




i
=
1

4



p
i



=
1




(
a
)










-




i
=
1

4




p
i

·


e

v
i







=

0


{








i
=
1

4




p
i

·

e

x
i




=
0




(
b
)










i
=
1

4




p
i

·

e

y
i




=
0




(
c
)
















-
min



{




i
=
1

4







p
i

·


e

v
i







2


}





(
d
)










This system of equations conveys several conditions that the selection probabilities p1, p2, p3, p4 must comply with.


Equation (a) conveys the condition according to which the sum of the selection probabilities p1, p2, p3, p4 must be equal to 1.


Equations (b) and (c) convey the condition according to which, on average, the approximation error must be zero.


Equation (d) conveys the condition according to which the variance of the error, which corresponds to the energy of the error, must be a minimum.


To solve this system of equations, we proceed in the following manner:

    • we put p4=x;
    • equations (a), (b) and (c) are solved so as to express the probabilities p1, p2, p3 as a function of x;
    • the probabilities p1, p2, p3, p4 are substituted by their respective expressions as a function of x in the expression









i
=
1

4







p
i

·


e

v
i







2







    •  of equation (d) so as to determine











f


(
x
)


=




i
=
1

4







p
i

·


e

v
i







2



;






    • the first derivative with respect to x of the function











f


(
x
)


=




i
=
1

4







p
i

·


e

v
i







2



,






    •  i.e.













(




i
=
1

4







p
i

·


e

v
i







2


)




x


,






    •  is calculated and the equation













(




i
=
1

4







p
i

·


e

v
i







2


)




x


=
0






    •  is solved to minimize the expression












i
=
1

4








p
i

·


e

v
i







2

.





Finally, since we are dealing with probabilities, a check is made to verify that pi≧0 for i=1, 2, 3, 4. If this is not the case, the value 0 is assigned to each probability pi which is negative and equations (a), (b) and (c) are solved to calculate the remaining unknown probabilities.


Solving this system of equations thus makes it possible to obtain the respective values of the selection probabilities p1, p2, p3, p4 for the vectors {right arrow over (rvi)} with i=1, 2, 3, 4 approximating the phase rotation vector {right arrow over (rv)}.


Following this initial phase Φ of calculating the respective probabilities of selecting the four approximations of the result of the function es, the method comprises the execution of a calculation loop, fed with the four rounded results of the complex exponential function for the phase gap and with their respective selection probabilities. This loop is executed for as long as the frequency fc has to be generated.


This loop comprises the repetition of a step of calculating the complex exponential function for consecutive phases φk, for k=0, 1, 2 . . . . Two consecutive phases are separated from one another by the phase gap φs; stated otherwise we have the relation: φkk−1s


The loop comprises a first step β0, termed the initialization step, for the index k=0.


During this step β0, the value of Qw[es], stated otherwise the rounding of e0 with a precision of w bits on the fractional part, is stored in the storage memory 1, if appropriate instead of the previous content of the memory 1.


Step β0 is followed by a step β1 corresponding to the incrementation index k=1 of calculating the complex exponential function for the phase φ10S. During this step β1, the following sub-steps are carried out so as to calculate a rounding of es with a precision of w bits on the fractional part, denoted Qw[es]:

    • β1,1) One of the rounded results of es, denoted Qw[es], is selected from among the four rounded results determined during the initial phase Φ. Stated otherwise, by vector modeling, one of the four approximation vectors {right arrow over (rvi)} with i=1, 2, 3, 4 is selected as approximation of the phase rotation vector {right arrow over (rv)}. For the first selection (that is to say for k=1), the most probable approximation vector {right arrow over (rvi)} is selected, that is to say that having the highest selection probability pi. In this instance, this is








r

v
3




=


r
3








s
3



.








    • β1,2) The rounded result of the complex exponential function for the previous phase φ0, i.e. Qw[e0], and the selected rounded result of the complex exponential function for the phase gap φs, i.e.












Q
w



[




s


]


=


r
3







s
3





,






    •  , are multiplied. Stated otherwise, the following multiplication operation is carried out:








Qw[e0]·Qw[es]

      • It will be noted that the multiplication of two roundings, each having a precision of w bits on their fractional part, provides a result having a precision of 2w bits on its fractional part.
    • β1,3) The rounding of the result obtained in the previous sub-step β1,2) is then calculated with the aid of the operator Qw[.]. The following operation is thus carried out:






Q
w
[Q
w
[e


0

]·Q
w
[e


s

]]=Q
w
[e


1
]

      • The rounding operator truncates the fractional part of the result obtained in sub-step β1,2) by a portion of w bits. A rounded result of e1, denoted Qw[e2], is thus obtained with a precision of w bits on the fractional part.
    • β1,4) The rounded result of the exponential function obtained for the phase φ1, denoted Qw[e1], is stored in the storage register 1 intended to feed the calculation step for the following phase φ2.


Step β1 is followed by a succession of steps βk for k=2, 3, . . . .


A calculation step βk for k=2, 3, . . . , calculates a rounding, or approximate result, with a precision of w bits on the fractional part of the complex exponential function for the phase φk. This approximate result is denoted Qw[ek]. The step βk comprises the following sub-steps:

    • βκ,1) during a first sub-step βk,1, the value of a selection index is determined from among a set of N indices, namely the set {1,2,3,4}, it being recalled that N=4.
      • To determine this selection index, a random number lk is generated, uniformly distributed over a reference interval Iref, here Iref=[0,1]. The fact that the random number lk is uniformly distributed over the interval [0,1] signifies that it may take, with the same probability, numerical values in sub-intervals of the interval [0,1] of the same respective lengths.
      • The reference interval Iref=[0,1] is divided into N sub-intervals In, with 1≦n≦4, it being recalled that N=4. The various intervals In are disjoint and here of respective lengths equal to the selection probabilities pn with 1≦n≦4 determined during the preliminary phase Φ. The sub-intervals In are defined in the following manner:





I1=[0,p1[






I
2
=[p
1
,p
1
+p
2[






I
3
=[p
1
+p
2
,p
1
+p
2
+p
3[






I
4
=[p
1
+p
2
+p
3
,p
1
+p
2
+p
3
p
4]

      • The sub-interval In to which the random number lk generated belongs is determined. It is assumed that the number lk belongs to the sub-interval Ij of length pj. The index j of the selection probability pj corresponding to the length of the determined interval Ij is then allocated to the selection index to be determined. Consequently, the selection index j is such that:
        • if lkεI1, then j=1
        • if lkεI2, then j=2
        • if lkεI3, then j=3
        • if lkεI4, then j=4
    • βκ,2) With the aid of the selection index j determined in step βk,1, the rounded result having the probability of selecting index j, i.e. pj., is selected from among the four rounded results of the complex exponential function for the phase gap determined during the initial phase Φ. Thus, we chose








Q
w



[




s


]


=


r
3








s
j



.








    •  Stated otherwise, in vector modeling, the approximation vector {right arrow over (rv1)} is selected as approximation of the vector {right arrow over (rv)}.

    • βκ,3) The rounded result of the complex exponential function for the previous phase φk−1, i.e. Qw[ek−1], and the rounded result of the complex exponential function for the phase gap φS, Qw[ek], selected in the step βk,2, are multiplied. Stated otherwise, the expression Qw[ek−1]·Qw[es] is calculated, with Qw[es]={right arrow over (rv1)}.
      • The calculation consisting in multiplying two roundings each having a precision of w bits on their fractional part, the result obtained has a fractional part coded on 2w bits.

    • βκ,4) The rounding of Qw[ek−1]·Ww[es] is then calculated with the aid of the rounding operator Qw[+], that is to say the rounding with a precision of w bits on the fractional part of the result of sub-step βk,3. For this purpose, the fractional part of the result obtained in sub-step βk,3 of the w lowest order bits is truncated. A rounded result of es is thus obtained with a precision of w bits on its fractional part (corresponding to the remaining w bits, of highest orders), denoted Qw[ek].

    • βκ,5) The rounded result thus obtained, Qw[ek], is stored in the storage memory 1 so as to feed the calculation step for the following phase φk+1.





During sub-step βk,1, the random number lk can be generated by a pseudo-random number generator, known to the person skilled in the art. To generate this random number lk, it is also possible to use a batch of w bits truncated by the rounding operator Qw[·] in the previous calculation step βk−1, and more precisely in sub-step βk−1,4. In fact, in the previous calculation step βk−1, the rounding operator has calculated two rounded results: one on the real part and the other on the imaginary part. The rounding operator therefore produces two batches of w truncated bits. To generate the random number lk, it is possible to use one of these two batches or even a concatenation of w/2 bits of one of the batches and of w/2 bits of the other batch. The value represented is determined by the batch of w bits truncated in the reference interval Iref, here Iref=[0,1]. For example, if we take w=4 and 4 truncated bits equalling 1 0 1 1, the value represented by these bits in the interval [0,1] is 2−1+2−3+2−4=0.6875. Stated otherwise, the w truncated bits are translated into a value included in the reference interval Iref. This value constitutes the random number lk of index k.


The calculation step βk is thus repeated for consecutive phases φk separated pairwise by a phase gap φS so long as a digital signal of frequency fc has to be generated. A test step τk for verifying whether the frequency fc still has to be generated is therefore carried out at the end of each step βk. If it is appropriate to continue the generation of frequency fc, step βk+1 is executed. Otherwise, the method is interrupted.


A particular form of realization of the device for generating a digital frequency, able to implement the method which has just been described, will now be described with reference to FIG. 1.


The device represented in FIG. 1 comprises a storage memory 1, a selection module 2, a multiplier 3 and a rounding operator 4.


The storage memory 1 is here a shift register intended to receive and to provisionally store the result of each calculation step βk, stated otherwise the rounding Qw[ek], obtained on completion of calculation step βk. The result Qw[ek] of a calculation step βk is stored in the memory 1 instead of the result Qw[ek−1] of the previous calculation step βk−1. On initialization, that is to say in step β0, the storage memory 1 is reinitialized so as to store the rounding of the complex exponential function for the initial phase φ0, that is to say Qw[ek].


The selection module 2 comprises

    • a sub-module 20 for determining a selection index j;
    • a sub-module 21 for providing an approximate result of the complex exponential function for the phase gap φS.


The sub-module 20 for determining a selection index j comprises

    • N memories 200-203, with N=4, for storing the respective probabilities p1, p2, p3, p4 of selecting the four approximate results of the complex exponential function for the phase gap φS;
    • a pseudo-random generator 204 intended to generate the random number lk uniformly distributed over the reference interval Iref=[0,1];
    • a block 205 for determining a selection index j linked to the four memories 200 to 203 and to the output of the pseudo-random generator 204.


The sub-module 20 is designed to implement sub-step βk,1. During operation, in each calculation step βk, the generator 204 generates the random number lk uniformly distributed over the reference interval [0,1] and provides it to the block 205 for determining a selection index j. The block 205 determines the sub-interval to which the number lk belongs from among the four sub-intervals I1, I2, I3 and I4 of the reference interval [0,1] which are defined by the probabilities p1, p2, p3, p4 in the following manner:





I1=[0,p1[; I2=[p1,p1+p2[; I3=[p1+p2,p1+p2+p3[; I4=[p1+p2+p3,p1+p2+p3+p4]


The random number lk belonging to the interval Ij, the sub-module 20 allocates the value j to the selection index and provides the latter to the sub-module 21.


In the case where the random number lk is generated from the w truncated bits in the previous calculation step βk−1, the device comprises a connection between an additional output of the rounding operator, intended to deliver the w bits truncated by the rounding operator in each calculation step βk, and an additional input of the sub-module 20 for determining the selection index j. Furthermore, the sub-module 20 comprises a memory for storing the w truncated bits provided at each calculation step by the rounding operator 4 and means for determining the value represented by these w truncated bits, which corresponds to the random number used during the following calculation step to determine the selection index j.


Furthermore, during the initial step β0 of the calculation loop (that is to say for k=0), the module 20 for determining a selection index j is designed to allocate to the selection index j the value of the index i of the highest probability pi out of the four probabilities p1, p2, p3, p4.


The sub-module 21 for providing an approximate result of the complex exponential function for the phase gap φS comprises

    • four memories 210-213 for storing the four approximations r1eS1, r2eS2, r3eS3, r4eS4 of the complex exponential function for the phase gap φS, modeled by the four approximation vectors r{right arrow over (v1)}, r{right arrow over (v2)}, r{right arrow over (v3)}, r{right arrow over (v4)}
    • a multiplexer 214 connected at input, on the one hand, to the four memories 200-203 and, on the other hand, to the module 20 for determining a selection index j, and at output to the multiplier 3.


The multiplexer 214 is designed to select one of the four approximations of the complex exponential function for the phase gap φS stored in the memories 210 to 213, as a function of the value of the selection index j transmitted by the sub-module 20. During operation, the multiplexer selects the approximation rjeS corresponding to the index j received.


During operation, in calculation sub-step βk, the approximate result of the complex exponential function for the phase φk−1, stored in the memory 1, and the approximate result of the complex exponential function for the phase gap φS, provided by the sub-module 21, are fed as input to the multiplier 3. It multiplies the two approximate results (Qw[ek−1]·Qw[es] with Qw[es]=r{right arrow over (vj)}) and provides the result obtained to the rounding operator 4. The latter determines the rounding of the result of the multiplication by truncating the w lowest order bits of the fractional part so as to obtain an approximate result of ek with a precision of w bits on its fractional part, denoted Qw[ek]. This result is output by the device and recorded in parallel in the memory 1, for the following calculation sub-step βk+1, instead of Qw[ek−1].


The digital frequency generation device also comprises a configuration module 5 and a control module 6, in this instance a microprocessor.


The configuration module 5 is designed to implement the two steps Φ1, Φ2 of the preliminary phase Φ, so as to determine, on the basis of a phase gap φS provided, the four approximations r1eS1, r2eS2, r3eS3, r4eS4 of the complex exponential function for the phase gap φS (modeled by the four approximation vectors {right arrow over (rv1)}, {right arrow over (rv2)}, {right arrow over (rv3)}, {right arrow over (rv4)}) and to calculate the four corresponding selection probabilities p1, p2, p3, p4. The four approximations of the complex exponential function for the phase gap φS are stored in the memories 210 to 213 respectively and their corresponding probabilities are stored in the memories 200 to 203.


Furthermore, the configuration module 5 is designed to reinitialize the memory 1, by recording therein the approximate result, stored in memory, of the complex exponential function for the initial phase φ0, at the start of each new calculation loop. The frequency generation device could itself be adapted for calculating the initialization value Qw[e0], for example by implementing the so-called “CORDIC” procedure which makes it possible to calculate trigonometric functions to the desired precision.


All the elements of the device are connected to the control module 6 which is designed to control the operation thereof.


The elements 204 and 205 of the selection module, the multiplexer 214, the multiplier 3, the rounding operator 4 and the configuration module 5 are, in the particular example described, software modules forming a computer program. The invention therefore also relates to a computer program for a device for numerically generating a given frequency comprising software instructions for implementing the method described above, when said program is executed by the device. The program can be stored in or transmitted by a data medium. The latter can be a hardware storage medium, for example a CD-ROM, a magnetic diskette or a hard disk, or else a transmissible medium such as an electrical, optical or radio signal. The invention also relates to a recording medium readable by a computer on which the program is recorded.


As a variant, these software modules could at least partially be replaced with hardware means.


The digital frequency generation device described above can be integrated into radiocommunication equipment.


In the preceding description, the number N of rounded results of the complex exponential function for the phase gap is equal to four. The invention is not however limited to this particular exemplary embodiment. Of course, the invention could use a number N of rounded results that is less than or greater than four.


The invention applies to all the techniques requiring the numerical generation of a frequency: digital musical instruments, audio synthesis, radiocommunication. In the field of radiocommunications, the invention can be used within the framework of the following operations:

    • frequency translation (modulation, demodulation),
    • slaving of the carrier frequency at reception,
    • generation of the FFT coefficients,
    • multiband filtering, etc.


In the preceding description, a new procedure for generating random numbers has been explained. According to this new procedure, to generate a succession of random numbers, use is made of the w bits truncated by the rounding operator of the fractional part of the results successively obtained, for consecutive phases φk (with k=1, 2, . . . ) separated by the phase gap φS, by multiplication between the two rounded results of a trigonometric function respectively for the phase φk and for the phase gap φS. Such a procedure for generating random numbers can be used in applications requiring the generation of random numbers, apart from frequency generation. It can be implemented in a pseudo-random generator having the initial phase φ0 and the phase gap φS as configuration parameters.

Claims
  • 1. A computer implemented method of numerically generating a given frequency, comprising: calculating at least one trigonometric function for consecutive phases separated by a phase gap φS which is dependent on the frequency to be generated is repeated, during the calculating of said trigonometric function for a phase of index k, k representing a phase incrementation index according to the phase gap φS, a result of the trigonometric function for the phase of index k is calculated on the basis of rounded results of the trigonometric function for the previous phase of index k−1 and for said phase gap respectively;wherein, a number N of rounded results of the trigonometric function for said phase gap φS and respective probabilities pi of selecting said N rounded results being provided, one of the N rounded results for the phase gap φS is selected, taking account of the determined selection probabilities pi, to calculate the result of the trigonometric function for the phase of index k.
  • 2. The method as claimed in claim 1, in which, to select one of the N rounded results for the phase gap φS taking account of the determined selection probabilities pi, a random number (l) uniformly distributed over a reference interval is generated;the reference interval being divided into N disjoint intervals In of respective lengths proportional to the probabilities pi with 1≦i≦N, the interval Ij, from among said N intervals In, to which the generated random number (l) belongs, is determined;and, from among the N rounded results of the trigonometric function for the phase gap φS, that having the selection probability pj corresponding to the length of the determined interval Ij is selected.
  • 3. The method as claimed in claim 2, in which the rounded results being calculated with a finite precision of w bits on the fractional parts, the result of the trigonometric function for the phase of index k, obtained by multiplication of the rounded results of the trigonometric function for the previous phase of index k−1 and for the phase gap respectively, is rounded by truncating the fractional part of said result for the phase of index k by a portion of w bits and the value represented by said portion of w bits truncated in the reference interval is determined so as to generate the random number.
  • 4. The method as claimed in claim 1, in which there is provided a preliminary phase comprising: determining the N rounded results of the trigonometric function for said phase gap φS;determining respective probabilities pi of selecting the N possible approximated values, with 1≦i≦N.
  • 5. The method as claimed in claim 4, in which the number N of rounded results of the trigonometric function for the phase gap φS is equal to four and the four rounded results correspond to the four vertices of a square containing a point of the trigonometric circle representing the phase gap φS.
  • 6. The method as claimed in claim 4, in which the N respective probabilities pi with 1≦i≦N of selecting the N rounded results are determined in such a way that the mean of the rounding error is zero.
  • 7. The method as claimed in claim 4, in which the N respective probabilities pi with 1≦i≦N of selecting the N rounded results are determined so as to minimize the variance of the error.
  • 8. The method as claimed in claim 4, in which the N respective probabilities pi with 1≦i≦N of selecting the N rounded results are determined in such ways that the sum of the respective probabilities of selecting the N rounded results is equal to 1.
  • 9. The method as claimed in claim 4, in which, to determine the N respective probabilities pi with 1≦i≦N of selecting the N rounded results, the following system of equations is solved:
  • 10. A device for numerically generating a given frequency comprising iterative calculation means designed to repeat the calculation of at least one trigonometric function for consecutive phases separated by a phase gap φS which is dependent on the frequency to be generated, the calculation of said trigonometric function for a phase of index k, k representing a phase incrementation index according to the phase gap φS, being carried out on the basis of a rounded result of the trigonometric function for the previous phase of index k−1 and of a rounded result of the trigonometric function for said phase gap respectively, comprising: means for storing a number N of rounded results of the trigonometric function for said phase gap φS means for storing respective probabilities pi of selecting said N rounded resultsmeans for selecting one of the N rounded results for the phase gap φS, taking account of the determined selection probabilities pi, to calculate the result of the trigonometric function for the phase of index k.
  • 11. An item of radiocommunication equipment integrating the digital frequency generation device as claimed in claim 10.
  • 12. A computer readable storage medium encoded with computer program instructions which cause a computer to implement a method of numerically generating a given frequency, comprising: calculating at least one trigonometric function for consecutive phases separated by a phase gap φS which is dependent on the frequency to be generated is repeated, during the calculating of said trigonometric function for a phase of index k, k representing a phase incrementation index according to the phase gap φS, a result of the trigonometric function for the phase of index k is calculated on the basis of rounded results of the trigonometric function for the previous phase of index k−1 and for said phase gap respectively;wherein, a number N of rounded results of the trigonometric function for said phase gap φS and respective probabilities pi of selecting said N rounded results being provided, one of the N rounded results for the phase gap φS is selected, taking account of the determined selection probabilities pi, to calculate the result of the trigonometric function for the phase of index k.
Priority Claims (1)
Number Date Country Kind
07 56038 Jun 2007 FR national