A high precision method for mapping phase to amplitude in direct digital synthesis and its hardware implementation Zhang Cao, Wei Song, Zhicong Peng, and Lijun Xu Citation: Review of Scientific Instruments 85, 114704 (2014); doi: 10.1063/1.4900949 View online: http://dx.doi.org/10.1063/1.4900949 View Table of Contents: http://scitation.aip.org/content/aip/journal/rsi/85/11?ver=pdfcov Published by the AIP Publishing Articles you may be interested in A high-field magnetic resonance imaging spectrometer using an oven-controlled crystal oscillator as the local oscillator of its radio frequency transceiver Rev. Sci. Instrum. 85, 094705 (2014); 10.1063/1.4894657 A hybrid analog-digital phase-locked loop for frequency mode non-contact scanning probe microscopy Rev. Sci. Instrum. 85, 013707 (2014); 10.1063/1.4862818 Accurate and low jitter time-interval generators based on phase shifting method Rev. Sci. Instrum. 83, 034701 (2012); 10.1063/1.3690383 Precision optical trapping via a programmable direct-digital-synthesis-based controller for acousto-optic deflectors Rev. Sci. Instrum. 80, 016101 (2009); 10.1063/1.3053122 Application of Direct Digital Synthesis and Cross Correlation Solution in Phase Noise Measurement System AIP Conf. Proc. 922, 411 (2007); 10.1063/1.2759710

This article is copyrighted as indicated in the article. Reuse of AIP content is subject to the terms at: http://scitationnew.aip.org/termsconditions. Downloaded to IP: 193.0.65.67 On: Fri, 19 Dec 2014 12:36:21

REVIEW OF SCIENTIFIC INSTRUMENTS 85, 114704 (2014)

A high precision method for mapping phase to amplitude in direct digital synthesis and its hardware implementation Zhang Cao,a) Wei Song, Zhicong Peng, and Lijun Xu Key Laboratory of Precision Opto-Mechatronics Technology of Ministry of Education, School of Instrument Science and Opto-Electronic Engineering, Beihang University, Beijing 100191, China

(Received 25 August 2014; accepted 21 October 2014; published online 7 November 2014) There exist a number of algorithms to map the phase to amplitude in direct digital synthesis (DDS). For DDS with more than 14 output bits, the Coordinate Rotation Digital Computer (CORDIC) algorithm is well known for its high precision. Also, it is effective in solutions where there is the need of in-phase and quadrature components simultaneously because the algorithm calculates both. In this paper, a Taylor expansion based method was proposed to calculate both in-phase and quadrature at the same time. Numerical simulations for different data format, e.g., double and finite bits, were carried out in Matlab and Quartus, which were followed by the hardware implementation in Field Programmable Gate Array. The results demonstrated that the proposed method possessed higher precision and exhausted less logic elements than the CORDIC algorithm. © 2014 AIP Publishing LLC. [http://dx.doi.org/10.1063/1.4900949] I. INTRODUCTION

Sinusoidal signal generators with fast switching and superior quality are necessary in a variety of communication systems and electronic instruments.1 Compared with traditional frequency synthesis methods, Direct Digital Synthesis (DDS) techniques have many advantages, such as extremely fast frequency switching, fine tuning, low phase noise, and a coherent phase relationship.2–4 Typically, the DDS system consists of a phase accumulator, a phase to amplitude converter and a DAC, which are depicted in Figure 1.5 The phase accumulator exports the phase based on the frequency control word θ that determines the output frequency per clock cycle. The phase to amplitude converter is the core component of the DDS system. It generates the wave amplitude for the phase received from the phase accumulator and outputs the digital amplitude to the DAC where an analog wave was generated. DDS can be implemented on either dedicated DDS chips or integrated in some universal chips, e.g., Field Programmable Gate Array (FPGA) to generate sine/cosine waveforms. The dedicated DDS chips are simple to implement and possess high frequency and superior quality; however, they usually have high energy consumption and are expensive, and are not flexible enough to implement certain functions. The use of FPGA provides an alternative way to generate stable, high-precision, more efficient, and complex DDS signals,6 and it is cooperative with other parts in the system.7 In the literature, many algorithms have been reported to convert phase to amplitude of a sine/cosine wave, for example, the lookup table algorithm, the Coordinate Rotation Digital Computer (CORDIC) algorithm, Taylor series and quadratic approximations, etc. Among all these methods, CORDIC algorithm is well known for its high precision for high output bit, e.g., 14 bits or higher. Also, it is effective in solutions where there is the need of in-phase and quadrature a) Author to whom correspondence should be addressed. Electronic mail:

[email protected] 0034-6748/2014/85(11)/114704/6/$30.00

components simultaneously, because the algorithm calculates both.8 In this paper, a high precision algorithm for the calculations of both sine and cosine amplitudes simultaneously was proposed. It possessed the merits of efficient memory storage and small latency. The methods produced almost exact values of the sine function when it is digitalized to N bits. Two typical algorithms, e.g., the look-up table method and the CORDIC algorithm were employed for comparison. Both simulation and experimental results validated the effectiveness of the proposed methods. II. THE HIGH PRECISION ALGORITHMS FOR PHASE TO AMPLITUDE CONVERTOR A. The look-up table method and CORDIC algorithm

In the look-up table method, N-bit digital phase n is generated by the address counters ranging in [0, 2N ]. The amplitudes of the sine function can be looked up in the previously stored table in a ROM, for example, the nth value of sine function can be determined as the nth element in the table, namely, S(n) = sin (2nπ /2N ). The phase quantization error and amplitude quantization error are decided by the number of words and the number of bits in ROM.9 To achieve an acceptable precision for DDS output, the size of ROM needs to be increased, with power consumption and chip area increased.10 In the literature, many techniques have been proposed to reduce the size of the ROM lookup table. The most effective compression techniques are able to achieve very small ROMs, but the compression techniques inevitably lead to output distortion.6, 11 Another way to design small ROM phase to amplitude converter is using CORDIC algorithm that is famous for only involving shift and add operations to calculate the sine/cosine values.12, 13 It can be efficiently implemented in general purposed hardware circuits, such as FPGA. The CORDIC starts from a known vector and proceeds with coordinate rotations

85, 114704-1

© 2014 AIP Publishing LLC

This article is copyrighted as indicated in the article. Reuse of AIP content is subject to the terms at: http://scitationnew.aip.org/termsconditions. Downloaded to IP: 193.0.65.67 On: Fri, 19 Dec 2014 12:36:21

114704-2

Cao et al.

Rev. Sci. Instrum. 85, 114704 (2014)

FIG. 1. Block diagram of a typical DDS system.

only using shift and add operations, until the phase sufficiently close to the desired phase.14 According to the coordinate transformation formula, the rotation phase θ from vector (xn , yn ) to (xn+1 , yn+1 ) can be drawn as ⎧ −n ⎪ ⎨ xn+1 = xn − Sn 2 yn yn+1 = yn + Sn 2−n xn . (1) ⎪  −n  ⎩ zn+1 = zn − Sn arctan 2 Here, n is the number of iteration, xn , yn , zn are variables at the nth iteration, and Sn satisfies  −1, zn < 0 . (2) Sn = +1, zn ≥ 0 If the iteration starts at

FIG. 2. Flowchart of iteration process to calculate sine/cosine in N steps.

⎧ ⎪ ⎨ x0 y0 ⎪ ⎩ z0

K 0 . θ

(3)

Then, after n iterations, the values of sine and cosine functions can be approximated by the following formula, i.e., ⎧ ⎪ ⎨ xn = cos θ yn = sin θ , (4) ⎪ ⎩ zn → 0 where θ ranges from −π /2 to π /2. K=

n−1 i−0

cos θi =

n−1

cos[arctan(2−i )],

(5)

i−0

here if n → ∞, K is about 0.607253. Since the CORDIC exhibits linear-rate convergence, cascade iterations are needed to achieve satisfactory accuracy.15 Usually, in the hardware implementations, the CORDIC algorithm results inherently in large latency.16 B. Taylor expansion based algorithm for phase-to-amplitude conversion

The sine/cosine values could be expended in the form of the Taylor series as  3 5 sin θ = θ − θ3! + θ5! − . . . , (6) 2 4 6 cos θ = 1 − θ2! + θ4! − θ6! + . . . where the phase θ ranges within [0, 2π ]. In practical implementations, only the first few terms of the Taylor series can be applied in the calculation. To reduce the residual error caused by only choosing finite terms of the Taylor expansion, a new treatment was proposed as follows. If the phase θ in the range of [0, 2π ] is given, it could be divided into 2N parts, then the value of each divided part is

only τ = θ /2N . Obviously, the sine and cosine value of τ can be expanded in Taylor series, namely, ⎧ τ5 τ3 ⎪ ⎪ ⎨ S1 = sin τ = τ − + − ··· 3! 5! . (7) 2 ⎪ τ4 τ ⎪ ⎩ C1 = cos τ − 1 = − + − ··· 2! 4! To calculate the values of sine and cosine of θ , we have the following deduction, namely,  S2 = sin 2τ = 2 sin τ cos τ = 2S1 (1 + C1 ) . (8) 1 + C2 = cos 2τ = 1 − 2 sin2 τ = 1 − 2S12 Follow the same procedure shown in Eqs. (7) and (8), we have the following iterations, see Figure 2, where S1 and C1 is the initial value of the iterations. Finally, after N iterations, the values of sine and cosine functions at θ are sin θ = SN and cos θ = 1 + CN , respectively. III. RESULTS AND DISCUSSIONS

As depicted in Figure 1, both phase accumulator and phase to amplitude converter contribute to the error of the required sine/cosine value. Usually, the targeted phase can be calculated without any phase truncation. As a result, the phase to amplitude converter determines the intrinsic error of a DDS system implemented on FPGA. The amplitude error of proposed algorithm includes error of Taylor expansion and truncation error. According to Eq. (6), error of sine and cosine functions caused by using only n terms of the Taylor series can be represented as sin (θ ) and cos (θ ), i.e., ⎧ 2n+1 2n+3 ⎪ n+1 θ ⎪ n θ ⎪ ⎨sin (θ ) = (−1) (2n + 1)! + (−1) (2n + 3)! + . . . . . . . 2n+2 2n+4 ⎪ ⎪ n+2 θ n+1 θ ⎪ + (−1) +...... ⎩cos (θ ) = (−1) (2n+2)! (2n + 4)! (9)

This article is copyrighted as indicated in the article. Reuse of AIP content is subject to the terms at: http://scitationnew.aip.org/termsconditions. Downloaded to IP: 193.0.65.67 On: Fri, 19 Dec 2014 12:36:21

114704-3

Cao et al.

Rev. Sci. Instrum. 85, 114704 (2014)

Therefore the error will reduce to less than 1/2N(2n−1) of its original. However, the error increases when the phase rises. One way to decrease error is to increase the number of iterations or the number of Taylor series. It comes at the expense of more computing time and consumption of hardware resources. Alternatively, the symmetrical property of the sine and cosine values in [0, 2π ] could be utilized. Only the sine and cosine values within [0, π /4] need to be calculated, which makes the quantization error smaller according to Eq. (11). The values of sine and cosine at other phases could be calculated as follows:

Here n is the number of terms used in Taylor series for sine/cosine functions. The initial values of phase could be divided into 2N parts. Then the subdivided phase is τ0 = θ/2N , then

⎧ ⎪ ⎪ ⎨ sin (τ0 ) < ⎪ ⎪ ⎩ cos (τ0 )

A high precision method for mapping phase to amplitude in direct digital synthesis and its hardware implementation.

There exist a number of algorithms to map the phase to amplitude in direct digital synthesis (DDS). For DDS with more than 14 output bits, the Coordin...
783KB Sizes 0 Downloads 8 Views