Generating DDS tables was the topic of a previous post. I decided to go a bit further with my analysis. I decided to compare the two quarter-table generating methods to see which one had better properties in terms of robustness to truncation of the phase accumulator. The result were interesting, though easily explained.
Forward
The two tables referred to here are generated by:
- non-offset:
- offset :
And is is assumed the table entries are read out 0,1,2,3,3,2,1,0,0,1,2,3,3,2,1,0 with the latter half’s outputs negated.
The first thing to re-iterate is that the standard quarter table method described above (and published in some textbooks and thesis) does not generate the same values as using a larger table that stores one full cycle. This is very obvious for small table sizes. Likewise, some of the outputs have error that isn’t due to quantization of the coefficients. This error is bounded, and affects samples by up to 1.5 lsb’s of a value based on the depth of the table — not the coefficient width.
Analysis
The non-offset table actually does have an offset. The offset is just hidden a bit better. The main criticism of the non-offset table in the last post was that the resulting values appeared to be from different sine waves in each quadrant, specifically, quadrants 2 and 4 appear to have an advanced phase. The result is that the best fit sine wave ends up having a half-step phase offset. This is the same as the offset table.
In terms of error, choosing slightly larger values for the non-offset table worked better. No single scaling factor would be exactly correct, as the generated waveform is not an exact sine wave. Eg, there is no way to exactly represent the output of the non-offset DDS table using any single sine wave. The amplitude/phase shift can be found easily by using the Fourier transform.
The next part of the analysis assumes that the DDS will read out all table entries, and that the reference would be a signal with a phase offset of less than one table address. In such a case, the correct value would not be read out because the desired phase has no exact entry in the table. The most common method for addressing the table is equivalent to truncation of the phase accumulator. This ends up working out well for both tables, as the phase error due to quantization of the phase accumulator can range from 0 to 1 addresses.
Results
Not surprisingly, the offset table wins out huge in the best case — that of a 0.5 address phase offset. It exactly matches, to within the system’s numerical accuracy. In the worst case, the offset table still has less error by a healthy 3dB margin.
In the end, averaging the results from 17 test cases between phase errors of 0 and 1.0 addresses shows the offset table has, on average, 6dB less error dues to truncating the phase accumulator. This is similar to doubling the size of the table. If the non-offset table has an amplitude correction factor included, this is reduced to around 4.5dB. Numbers are for a 1024pt quarter table without amplitude quantization error included. I suspect that the amplitude quantization will reduce the differences between the two methods.