LUT Based Numerically Controlled Oscillator

A numerically controlled oscillator (NCO) is used for on-chip generation of major signals like cosine, sine, linear frequency modulated (LFM), Gaussian etc. in system on chips (SoCs). These signals can be generated by two ways, either by analog circuitry or by digital circuitry. In a digital system, these signals are generated using numerically controlled oscillator (NCO) and then they are converted by an digital to analog converter (DAC).

An NCO block is a digital counter part of an analog oscillator circuit. There are two types of NCO designs available. In one type of NCO block, sinusoidal values are computed by a dedicated hardware like coordinate rotation digital computer (CORDIC). In another type of NCO block, a look up table (LUT) is used to store a sinusoidal signal of fundamental frequency (f_0) and sinusoidal signals of other frequencies are generated using the sinusoidal signal which is stored.

LUT based NCO blocks are very simple but have some disadvantages. Like they are not capable of generating sinusoidal signals of any frequency. But LUT based NCOs are hardware efficient than the other type of NCO block. Thus LUT based NCOs are mostly used because of their simplicity. In this work, we will be focusing on designing an efficient LUT based NCO block to generate cosine or sinusoidal signals. The LUT based NCO block is implemented on Artix 7 field programmable gate array (FPGA)

Numerically Controlled Oscillator Block Operation

The principle of operation of a LUT based NCO is based on generating the cosine signal as per the following equation

(1)   \begin{equation*} wav\_out = cos(\frac{-2*\pi*(clm\_cnt-1)*(rw\_cnt - 1)}{N}) \end{equation*}

where N is the length of the signal and it varies from 1 to 1024 in this design. The cosine signal of fundamental frequency (f_0) can be obtained by putting clm\_cnt=2 in equation (1). This cosine signal of fundamental frequency (f_0) is stored in a LUT. Other cosine signals with frequencies 2f_0, 2f_0, 3f_0 etc. can be generated easily from the stored cosine signal. The fundamental cosine signal is shown in Figure 1.

Numerically Controlled Oscillator
Figure 1: Fundamental cosine pulse or the fundamental component of a real FFT dictionary

The cosine signal with fundamental frequency (f_0) can be stored in the LUT in three ways. Either by storing the whole length of the signal, or storing half of the signal, or by storing only one fourth of the cosine signal. This is possible due to symmetric and antisymmetric property of the cosine pulse. The third option is chosen here to design the NCO as to reduce the memory storage elements from N to (N/4+1).

Sinusoidal signals of different frequencies can be easily generated if the whole fundamental cosine signal is stored in LUT. But it is difficult to generate cosine signals if only N/4 elements of the fundamental cosine signal is stored. The algorithm to generate cosine signals of different frequencies from the fundamental cosine signal is shown in Algorithm 1. In LUT, N/4+1 elements of fundamental cosine signal is stored. The variable rw\_cnt varies from 1 to N and clm\_cnt can be varied from 0 to (N-1). The phs180 signal is used to get 180 degree out of phase cosine signals. Algorithm to generate sinusoidal signal is very similar to Algorithm 1.

Numerically Controlled Oscillator algorithm

Architecture of the Numerically Controlled Oscillator

The block diagram of the NCO is shown in Figure 2. The major inputs to the block diagram are N, phase, start, stop, wav\_type and phs180 signal. N (=2^n) denotes the required period of the waveform, phase signal is used to apply required phase shift, start pulse starts the NCO and a pulse at stop input can stop the NCO. Two types of signal generation are possible with this NCO, one is sine and another is cosine. The type of the signal is given at wav\_type input. If this signal is high then sine signal is output and if low then cosine signal is out. If instant 180 degree phase shift is required then it is possible by making the phs180 signal high.

Figure 2: The block diagram of the numerically controlled oscillator

Major outputs are wav\_start, wav\_out and wav\_stop. The wav\_start pulse indicates that the waveform is getting out of the NCO block. NCO outputs the wave form through the wav\_out signal and it is of 18-bit width. The wav\_stop signal when delayed by two clock cycles, indicates the end of a cycle. If only one cycle is required then wav\_stop signal can be connected to the stop input.

The architecture of the NCO block is very simple and it is shown in Figure 3. The start pulse starts the phase counter (ph\_cnt) and then if the required phase count is reached, another pulse is generated which starts the row counter (rw\_cnt). Then the row counter starts counting and it counts upto N. The output of the row counter and the input clm\_cnt is multiplied.

Numerically Controlled Oscillator Architecture
Figure 3: The proposed data path of the numerically controlled oscillator.

After the multiplication operation, a modular operation is carried out. The modular operation on the output of the multiplier is carried out by taking only 10-bits from the output of the multiplier. This output is then goes to the multiplexers and the output of the multiplexers are fed to a subtracter. The values of the constants for cosine signal are c_1 = 0, c_2=512, c_3=512 and c_4=0. Value of these constants for sinusoidal signal generation are c_1 = 256, c_2=256, c_3=768 and c_4=768.

The multiplexers are used to generate the correct address locations for the LUT. The control signals for the multiplexers are generated from the control signal generator (CSG) block. At the last stage, an inverter is placed to invert the output of the LUT when it is required. This inverter is implemented by a adder/subtracter block. The output of the NCO is of 18-bit as many designs uses 18-bit data width.

Simulation Results

The NCO block is implemented using the XILINX ISE EDA software. The simulation results are shown in Figure 4 and 5. In the Figure 4, it is shown that the cosine signal is generated when the wav\_start signal is asserted. Here no phase shift is given. In Figure 5, the value of the phase is 4 and this is why the cosine signal started after 4 clock cycles from the time when wav\_start signal asserted. Precision of the NCO block is of 10-bit as most of the designs are using this precision.

Figure 4: XILINX test bench simulation when phase is zero
Figure 5: XILINX test bench simulation when phase is 4.
Figure 6: Different signal generation by the NCO block when N = 128 and clm\_cnt is varied from 0 to 7.

Generation of signals with frequency difference f_0/m is also possible when N is less than 1024. For example, when N is 128, the frequency of the fundamental signal is f_0/8 for clm\_cnt = 0, the frequency of the second signal is 2f_0/8 for clm\_cnt = 1, and so on. Thus we can get complete cosine signal when clm\_cnt = 7 with frequency of f_0. This scenario is shown in Figure 6 for N = 128. The case when N<1024 is very useful in generating atoms of sampling matrix in compressed sensing.

Conclusion

In this work, efficient design of a LUT based NCO block is discussed. The NCO block is hardware efficient in terms of memory elements as it stores only one fourth part of the fundamental cosine signal. This NCO block has the capability to generate both sine or cosine signals. Signals can be phase shifted by any phase from 1 to N-1. This block is also capable of generating 180 degree out of phase signals without delaying. Besides generating sine or cosine signals of frequency difference f_0, this NCO block is also capable of generating signals with frequency difference f_0/m for N<1024. The proposed design of NCO is scalable thus can be used in any complex digital system easily.

Reference

  1. D. Hummels, “Numerically controlled oscillators.” [Online]. Available: https://web.eece.maine.edu/~hummels/classes/ece486/docs/NCO_tutorial.pdf
(Visited 303 times, 1 visits today)

Leave a Comment

Your email address will not be published.