Documentation Center |
Package: dsp
Generate real or complex sinusoidal signals—optimized for HDL code generation
The HDL NCO System object™ generates real or complex sinusoidal signals. In addition, the HDL NCO System object provides hardware-friendly control signals, optional reset signal, optional phase output signal, and an optional external dither input signal. It uses the same phase accumulation and lookup table technology as implemented in the NCO System object. The lookup table in the generated HDL is mapped to a ROM. You can use the lookup table compression option to significantly reduce the lookup table size with less than one LSB loss in precision.
HNCO = dsp.HDLNCO returns a numerically controlled oscillator (NCO) System object, HNCO, that generates a real or complex sinusoidal signal. The amplitude of the generated signal is always 1.
HNCO = dsp.HDLNCO(Name,Value) returns an HDL NCO System object, HNCO, with additional options specified by one or more Name,Value pair arguments. Name is a property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN
HNCO = dsp.HDLNCO(Inc, 'PhaseIncrementSource','Property') returns an HDL NCO System object, HNCO, with the PhaseIncrement property set to Inc. Inc is an integer scalar. To use the PhaseIncrement property, you must also set the PhaseIncrementSource property to Property. You can add other Name,Value pairs before or after PhaseIncrementSource.
Inc |
An integer scalar value for the PhaseIncrement property. To use this value, you must set the PhaseIncrementSource property to Property. Default: 100 |
PhaseIncrementSource |
Select which phase increment the object uses. Set PhaseIncrementSource to Property to use the PhaseIncrement property. Set PhaseIncrementSource to Input port to use an input argument of the step method. The default is Input port. hnco = dsp.HDLNCO(..., 'PhaseIncrementSource', 'Property', 'PhaseIncrement', phIncr, ...) |
PhaseIncrement |
Specify the phase increment as an integer scalar. This property is applicable when you set the PhaseIncrementSource property to Property. The default value of this property is 100. |
PhaseOffsetSource |
Select which phase offset the object uses. Set PhaseOffsetSource property to Property to use the PhaseOffset property. Set PhaseOffsetSource property to Input port to use an input argument of the step method. The default is Property. hnco = dsp.HDLNCO(...,'PhaseOffsetSource', 'Property', 'PhaseOffset', phOffset,...) |
PhaseOffset |
Specify the phase offset as an integer scalar. This property is applicable when you set the PhaseOffsetSource property to Property. The default value of PhaseOffset is 0. |
DitherSource |
Select which dither size the object uses. Set DitherSource property to Property to use the NumDitherBits property. Other options are Input port to use an input argument of the step method, or None to disable dithering. The default is Property. hnco = dsp.HDLNCO(...,'DitherSource', 'Property', 'NumDitherBits', ditherBits,...) |
NumDitherBits |
Specify the number of dither bits as a positive integer. This property is applicable when you set the DitherSource property to Property. The default value of NumDitherBits is 4. |
PhaseQuantization |
Set this property to true to enable quantization of the accumulated phase. The default value of PhaseQuantization is true. hnco = dsp.HDLNCO(...,'PhaseQuantization', true, 'NumQuantizerAccumulatorBits', accumBits,...) |
NumQuantizerAccumulatorBits |
Specify the number of quantizer accumulator bits as an integer scalar greater than 1 and less than the accumulator word length. NumQuantizerAccumulatorBits determines the number of entries in the lookup table of sine values. This property is applicable when you set PhaseQuantization to true. The default value of this property is 12. |
LUTCompress |
Set this property to true to enable lookup table compression. The object uses the Sunderland compression method to reduce the size of the lookup table. The default value of this property is false. |
Waveform |
Choose whether the object's output is Sine, Cosine, Complex exponential, or Sine and cosine signals. If you select complex exponential, the output is of the form sine + j*cosine. If you select Sine and cosine, the step method returns an additional output. The default is Sine. |
PhasePort |
Set PhasePort to true to return the current phase along with the output from the step method. The default value of this property is false. |
ResetAction |
Set ResetAction to true to enable a reset argument to the step method. The default value of this property is false. |
OverflowAction |
Overflow mode for fixed-point operations. OverflowAction is a constant property with value Wrap. |
RoundingMethod |
Rounding mode for fixed-point operations. RoundingMethod is a constant property with value Floor. |
AccumulatorDataType |
Accumulator data type description. This property is a constant with value Binary point scaling. |
AccumulatorSigned |
Select signed or unsigned accumulator data format. This property is a constant. All output is signed format. |
AccumulatorWL |
Accumulator word length. Default is 16 bits. |
AccumulatorFL |
Accumulator fraction length. This property is a constant with value 0 bits. |
OutputDataType |
Specify the output signal data type. Options are: double, single, and Binary point scaling. If this property is set to Binary point scaling, the output sign, word length, and fraction length are taken from the following three properties. The default is Binary point scaling. |
OutputSigned |
Select signed or unsigned output data. This property is a constant. All output is signed format. |
OutputWL |
Output data word length. The default is 16 bits. |
OutputFL |
Output data fraction length. The default is 14 bits. |
clone | Create HDLNCO System object with same property values |
isLocked | Locked status (logical) |
release | Allow property value and input characteristics change |
step | Process inputs using the HDL optimized NCO (Numerically Controlled Oscillator) |
When you enable lookup table (LUT) compression, the HDL NCO System object applies the Sunderland compression method. Sunderland techniques use trigonometric identities to divide each phase of the quarter sine wave into three components and express it as:
If the phase has 12 bits, the components are defined as:
A , the four most significant bits
B, the following four bits
C, the four least significant bits
Because C is small enough that sin(C)≅1 and cos(C)≅0 , the equation is approximated by:
The HDL NCO System object implements this equation with one LUT for sin(A+B) and one LUT for cos(A)sin(C). The second term is a fine correction factor and can be truncated to fewer bits without losing precision. With the default accumulator size of 16 bits, and the example phase width of 12 bits, the LUTs use only 2^{8}×16 plus 2^{8}×4 bits (5kb). A quarter sine lookup table would use 2^{12}×16 bits (65kb). This approximation is accurate within 1 LSB which gives an SNR of at least 60 dB on the output. See L. Cordesses, "Direct Digital Synthesis: A Tool for Periodic Wave Generation (Part 1)", IEEE Signal Processing Magazine, DSP Tips & Tricks column, pp. 50–54, Vol. 21, No. 4 July 2004.