The direct digital synthesis (DDS) is used to generate sine-waves on a clock(referenced to sampling clock).
Typically, in the reference designs each HDL DAC interface IP has a DDS for every channel.
The resulting sine-wave can be changed at run time by 3 parameters:
A generic DDS consists of a phase accumulator and a phase to amplitude converter.
The phase accumulator is basically a counter that increments by a frequency word which determines a timely overflow(the actual period of the signal).
The phase to amplitude convertor is a bit more complex and is the main consumer of FPGA resources out of the DDS modules.
Currently in the reference designs there are support two types of phase to amplitude converters, polynomial and CORDIC. The polynomial type uses more DSPs and less LUTs and FFs than the CORDIC, but at the cost of precision compared to the CORDIC.
| ||Disable DDS||0|
| ||DDS out data bus width range 8-24||16|
| ||DDS phase accumulator data width.||16|
| ||1 for CORDIC or 2 for Polynomial.||1|
| ||CORDIC stages data width, range 8-24||16|
| ||Number of CORDIC stages, range 8-24 (make sure CORDIC_PHASE_DW < CORDIC_DW)||16|
| ||The clock radtio between the device clock(sample rate) and the dac_core clock.||0|
| || ||Input clock|
| || ||Two's complement(0) or offset binary(1)|
| || ||Data sync/external phase sync|
| || ||Valid signal(ready for new data)|
| || ||Tone 1 scale|
| || ||Tone 2 scale|
| || ||Tone 1 initial offset(phase shift)|
| || ||Tone 2 initial offset(phase shift)|
| || ||Tone 1 frequency word|
| || ||Tone 2 frequency word|
| || ||Out sine-wave|
In the reference designs the DDS is controlled through the register map(dac channel section). In the register map you cand find the formulas for:
Below is the hierarchical structure of the modules.
ad_dds is the main module, it contains the phase accumulators and the phase to amplitude converters.
ad_dds_2 contains two phase to amplitude converters. The resulting wave-forms will be summed. The resulting wave-form must have a maximum amplitude level of 0x8000 -1. When only one tone is desired both tones must have the same frequency word and shift, there is no constraint for the amplitude, but if is equal for both channels, it should not be more than 0x400 -1 for each channel.
ad_dds_1 contains the phase to amplitude converter and an “amplifier”. The phase to amplitude converter is always generating a full scale sine-wave. Because the data format is two's complement, for a 16 bit data angle, min value will be -(2^16)/2 and max (2^16)/2-1.
The clock ratio (number data paths processed in parallel) instantiates more DDS logic, but it it is controlled by the same register map for all CLOCK_RATIO/DATA_PATH parameters.
Where is the CLOCK_RATIO > 1? This scenario can be found in every high speed DAC design. It is required because the FPGA fabric can't work at the same speed than that of a high speed converter(typically > 250M).
Let's take the daq2(AD9144) as an example, where the clock ratio is 4, this ratio is chosen for the maximum sampling frequency 1GSPS, this results in an internal clock of 250MHz(device clock), which is closer to the upper limit of what some FPGAs can handle. So, in one clock cycle(250M) it needs to generate 4 consecutive samples in order to keep up with the DAC. This is done by 4 DDS modules. The phase accumulator part is all in one place and the phase to amplitude converters have dedicated sub-modules, as described above. When the frequency is changed by software the 4 phases accumulator are align for the new frequency word and/or frequency phase shift. The counter increment value will be multiplied with clock ratio(4), to get a continuity of the 4 consecutive samples generated at t, t+1, t+2, and so on.
For scenarios where the synchronization signal comes from an external source and it is high for a longer period of time, the phase accumulator stages will be hold in reset, in order to avoid a noise like signal, caused by sending all the summed outputs of each DDS stage.
There is a minimum synchronization pulse width(delay) of n clock cycles, that is required to synchronize all phase accumulator stages, where n is equal to the CLK_RATIO.
In the above diagram example:
Each “i” is on 16 bits and each “s”(0-3) is on 64 bits. i(t)+ is the value of the previous i(t) plus the increment(FW*CLOCK_RATIO).
It should be mentioned that after the phase init fall-edge, until the first valid sample, there is a delay caused by the phase to angle converter type and in the case of the CORDIC type, number of rotation stages will also have a direct impact on this clock period delay.