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 hardwarefriendly control signals, optional reset signal, optional valid input 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. You can use the lookup table compression option to significantly reduce the lookup table size with less than one LSB loss in precision. The System object does not support the property that allows the block to synthesize the LUT to a ROM on an FPGA.
returns
a numerically controlled oscillator (NCO) System object, HDLNCO
= dsp.HDLNCOHDLNCO
,
that generates a real or complex sinusoidal signal. The amplitude
of the generated signal is always 1.
returns
an HDL NCO System object, HDLNCO
= dsp.HDLNCO(Name,Value
)HDLNCO
, 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 namevalue
pair arguments in any order as Name1,Value1,...,NameN,ValueN
.
Properties not specified retain their default values.
returns
an HDL NCO System object, HDLNCO
= dsp.HDLNCO(Inc,'PhaseIncrementSource','Property'
)HDLNCO
, with the PhaseIncrement
property
set to Inc
. Inc
is an integer
scalar. To use the PhaseIncrement
property, set
the PhaseIncrementSource
property to Property
.
You can add other Name,Value
pairs before or
after PhaseIncrementSource
.

An integer scalar value for the Default: 100 
This object supports double
for simulation
but not for HDL code generation. When a data input is fixed point,
or when no data input ports are enabled, the object computes the output
waveform based on the fixedpoint property settings. When a data input
is floatingpoint, the object ignores NumDitherBits
, PhaseQuantization
, NumQuantizerAccumulatorBits
, LUTCompress
,
and the fixedpoint data type properties, and computes a doubleprecision
output waveform.

Select which phase increment the object uses. Set hnco = dsp.HDLNCO(...,'PhaseIncrementSource','Property','PhaseIncrement',phIncr, ...) 

Specify the phase increment as an integer scalar. This property
is applicable when you set the 

Select which phase offset the object uses. Set hnco = dsp.HDLNCO(...,'PhaseOffsetSource','Property','PhaseOffset',phOffset,...) 

Specify the phase offset as an integer scalar. This property
is applicable when you set the 

Select which dither size the object uses. Set hnco = dsp.HDLNCO(...,'DitherSource','Property','NumDitherBits',ditherBits,...) 

Specify the number of dither bits as a positive integer. This
property is applicable when you set the 

Set this property to hnco = dsp.HDLNCO(...,'PhaseQuantization',true,'NumQuantizerAccumulatorBits',accumBits,...) 

Specify the number of quantizer accumulator bits as an integer
scalar greater than 1 and less than the accumulator word length. 

Set this property to 

Choose whether the output of the object is 

Set 

Set 

Set 

Overflow
mode for fixedpoint operations. 

Rounding
mode for fixedpoint operations. 

Accumulator data type description. This property is a constant
with value 

Select signed or unsigned accumulator data format. This property is a constant. All output is signed format. 

Accumulator word length. Default is 16 bits. 

Accumulator fraction length. This property is a constant with value 0 bits. 

Specify the output signal data type. Options are: 

Select signed or unsigned output data. This property is a constant. All output is signed format. 

Output data word length. The default is 16 bits. 

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:
$$\mathrm{sin}(A+B+C)=\mathrm{sin}(A+B)\mathrm{cos}C+\mathrm{cos}A\mathrm{cos}B\mathrm{cos}C\mathrm{sin}A\mathrm{sin}B\mathrm{sin}C$$
If the phase has 12 bits, the components are defined as:
A, the four most significant bits
$$(0\le A\le \frac{\pi}{2})$$
B, the following four bits
$$(0\le B\le \frac{\pi}{2}\times {2}^{4})$$
C, the four least significant bits
$$(0\le C\le \frac{\pi}{2}\times {2}^{}{}^{8})$$
Because C is small enough that sin(C)≅1 and cos(C)≅0, the equation is approximated by:
$$\mathrm{sin}(A+B+C)\approx \mathrm{sin}(A+B)+\mathrm{cos}A\mathrm{sin}C$$
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.