COMPUTATIONALLY EFFICIENT MIXED PRECISION FLOATING POINT WAVEFORM GENERATION
20200409660 · 2020-12-31
Inventors
Cpc classification
G06F7/483
PHYSICS
G06F9/3887
PHYSICS
G06F7/60
PHYSICS
G06F1/0321
PHYSICS
G06F7/57
PHYSICS
International classification
G06F7/483
PHYSICS
G06F7/57
PHYSICS
G06F7/60
PHYSICS
G06F9/30
PHYSICS
G06F9/38
PHYSICS
Abstract
Computationally efficient mixed precision floating point waveform generation takes advantage of the high-speed generation of waveforms with single-precision floating point numbers while reducing the generally unacceptable loss of precision of pure single-precision floating point to generate any waveform that repeats in 2. This approaches computes a reference phase in double precision as the modulus of the phase with 2 and then computes offsets to that value in single precision. The double precision reference phase is recomputed as needed depending on how quickly the phase grows and how large a machine epsilon is desired.
Claims
1. A method of generating a waveform, comprising: for each sample number n and a reference sample number r, using a single-precision floating point unit (FPU) to compute a single-precision phase as an offset from a single-precision reference phase by a phase kernel indexed by the reference sample number r; using the single-precision FPU to compute a single-precision value for a waveform that repeats in 2 as a function of the single-precision phase for the current sample number n; incrementing the sample number n and the reference sample number r; if the reference sample number r does not meet a threshold, returning control to the single-precision FPU to compute the single-precision phase for the next sample number n; and if the threshold is met, using a double-precision FPU to compute a double-precision reference phase as a modulus of 2 of the phase kernel indexed by the sample number n, converting the double-precision reference phase to single-precision to update the single-precision reference phase and resetting the reference sample number r, and returning control to the single-precision FPU to compute the single-precision phase for the next sample number n.
2. The method of claim 1, wherein the phase kernel indexed by the reference sample number r is
3. The method of claim 1, wherein the threshold is set to ensure that a machine epsilon of the single-precision phase value does not exceed a specified maximum.
4. The method of claim 3, wherein the threshold
5. The method of claim 1, wherein the threshold is at least 1,000.
6. The method of claim 1, wherein all subsequent processing of the waveform is performed with single-precision floating point.
7. An apparatus for generating a waveform, comprising: a single-precision floating point unit (FPU) to compute a single-precision phase based as an offset from a single-precision reference phase by a phase kernel indexed by a reference sample number r and compute single-precision values for a waveform that repeats in 2 as a function of the single-precision phase for a sample number n; an arithmetic logic unit (ALU) configured to increment the sample number n and the reference sample number r and determine whether the reference sample number r meets a threshold, if not the ALU returns control to the single-precision FPU to compute the next phase and waveform value; and a double-precision FPU to compute a double-precision reference phase as a modulus of 2 of the phase kernel indexed by the sample number n and convert the double-precision reference phase to single-precision to update the single-precision reference phase, said ALU configured to reset the reference sample number r, and return control to the single-precision FPU to compute the next phase and waveform value.
8. The apparatus of claim 7, wherein the phase kernel indexed by the reference sample number r is
9. The apparatus of claim 7, wherein the threshold is set to ensure that a machine epsilon of the single-precision phase value does not exceed a specified maximum.
10. The apparatus of claim 9, wherein the threshold
11. The apparatus of claim 7, wherein the threshold is at least 1,000.
12. The apparatus of claim 7, further comprising additional single-precision FPU that perform all subsequent processing of the waveform in single-precision floating point.
13. A method of generating a waveform, comprising: for each sample number n and a reference sample number r, using an L-bit floating point unit (FPU) to compute an L-bit phase as an offset from an L-bit reference phase by a phase kernel indexed by the reference sample number r; using the an L-bit FPU to compute an L-bit value for a waveform that repeats in 2 as a function of the L-bit phase for the current sample number n; incrementing the sample number n and the reference sample number r; if the reference sample number r does not meet a threshold, returning control to the L-bit FPU to compute the L-bit phase for the next sample number n; and if the threshold is met, using an M-bit FPU, where M>L, to compute an M-bit reference phase as a modulus of 2 of the phase kernel indexed by the sample number n, converting the M-bit reference phase to L-bits to update the L-bit reference phase and resetting the reference sample number r, and returning control to the L-bit FPU to compute the L-bit phase for the next sample number n.
14. The method of claim 13, wherein the threshold is set to ensure that a machine epsilon of the L-bit phase value does not exceed a specified maximum.
15. The method of claim 13, wherein M is at least twice L.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
DETAILED DESCRIPTION OF THE INVENTION
[0022] The problem with known approaches for waveform generation is that the linear phase grows unbounded for waveforms that repeat in 2. Every time the phase value doubles, the machine epsilon doubles. In many applications, with single-precision floating point the machine epsilon is unacceptably large. Although the machine epsilon continues to grow with phase for double-precision, the number of bits allocated to the significand, 53 as compared to 24 for single-precision, keeps the machine epsilon acceptably small for almost all applications. However, the system must bear the burden of generating the waveform with double-precision and performing all subsequent processing with double-precision.
[0023] Computationally efficient mixed precision floating point waveform generation takes advantage of the high-speed generation of waveforms with single-precision floating point numbers while reducing the generally unacceptable loss of precision of pure single-precision floating point to generate any waveform that repeats in 2. This approaches computes a reference phase in double precision as the modulus of the phase with 2 and then computes offsets to that value in single precision. The double precision reference phase is recomputed as needed depending on how quickly the phase grows and how large a machine epsilon is desired. The waveform value is represented with single-precision. Thus, all downstream process can be performed with single-precision resulting in considerable computational savings. This approach can be generalized to use an L-bit FPU to compute the phase and waveform values and an M-bit FPU, where M>L, to compute the reference phase.
[0024] Without loss of generality the mixed-precision approach for waveform generation will be described using the IEEE standard definitions of single and double-precision. This mixed-precision technique is valid for any waveform that repeats in 2, which includes any sinusoidal signal. Therefore, any waveform that repeats in 2 may be represented as one or more sinusoidal signals to represent, for example, continuous wave (CW), Amplitude Modulation (AM), Single-Sideband Modulation (SSB), Frequency Modulation (FM), Pulse Modulation (PM), and Quadrature Amplitude Modulation (QAM). Any signal of interest may be represented using the mixed-precision technique. For simplicity, the exemplary embodiment generates a single sinusoid.
[0025] As shown in
[0026] For each sample number n and a reference sample number r and initial ref=0, the single-precision floating point unit 204 computes a single-precision phase
(step 250) as an offset of a phase kernel
indexed by the reference sample number r from a single-precision reference phase ref where f.sub.c is the signal frequency and f.sub.s is the sampling frequency and then computes the waveform value 205 S=A*cos(B) or S=A*e.sup.i (step 252) based on that phase. An arithmetic logic unit (ALU) increments the sample number n and the reference sample number r (step 254) and if the reference sample number does not meet a threshold (step 256) returns control to the single-precision floating point unit 204 to compute a next phase (step 250). If the threshold is met, the double-precision floating point unit 202 updates the reference phase
(step 258) by computing the phase kernel indexed by the incremented sample number n and taking the modulus with 2. The ALU resets the reference sample number r=0 and FPU 204 casts the double-precision reference phase to single-precision (step 260) and returns control to the single-precision floating point unit 204 to compute the phase for the next sample number (step 250). The threshold is determined by a maximum machine epsilon to keep the phase value bounded.
[0027] It is worth noting that if FPUs of equal precision were employed to perform all of the calculations of
[0028] The approach of computing a reference phase in double precision as the modulus of the phase with 2 and then computing offsets to that value in single precision until the reference phase needs to be updated is illustrated in
[0029] In an exemplary calculation, as shown in
[0030] As previously described, for any floating point representation of a number, the smallest difference between any two numbers is known as the machine epsilon. The machine epsilon is dependent on the base of the number system, the magnitude of the value, and the size of the significand. The machine epsilon of a base-2 floating point number () of value n with significand size p is
Solving for a desired machine epsilon .sub.max with precision p, the upper limit for phase value is .sub.max=2.sup.log.sup.
[0031] The enhanced accuracy of mixed precision floating point waveform generation is illustrated in comparison to straight single-precision and double precision in
[0032] As shown in
[0033] As shown in
[0034] While several illustrative embodiments of the invention have been shown and described, numerous variations and alternate embodiments will occur to those skilled in the art. Such variations and alternate embodiments are contemplated, and can be made without departing from the spirit and scope of the invention as defined in the appended claims.