Generate real or complex sinusoidal signals—optimized for HDL code generation
DSP System Toolbox / Signal Operations
DSP System Toolbox / Sources
DSP System Toolbox HDL Support / Signal Operations
DSP System Toolbox HDL Support / Sources
The NCO HDL Optimized block generates real or complex sinusoidal signals, while providing hardwarefriendly control signals. The block uses the same phase accumulation and lookup table algorithm as implemented in the NCO block. When you use integer or fixedpoint input signals, or use the block as a source with no input signal, the block uses quantized integer accumulation to create a sinusoid signal.
The NCO HDL Optimized block provides these features:
A lookup table compression option to reduce the lookup table size. This compression results in less than one LSB loss in precision. See Lookup Table Compression for more information.
An option to synthesize the lookup table to a ROM when using HDL Coder™ with an FPGA target. To enable this feature, rightclick the
block, select HDL Code > HDL Block Properties, and set LUTRegisterResetType
to none
.
An optional input port for external dither.
An optional reset port that triggers a reset of the phase to its initial value during the sinusoid output generation.
An optional output port for the current NCO phase.
Given a desired output frequency F_{0}, calculate the phase increment input value using
$$phaseincrement=(\frac{{F}_{0}\cdot {2}^{N}}{{F}_{s}})$$
, where N is the accumulator word length and
$${F}_{s}=\frac{1}{{T}_{s}}=\frac{1}{sampletime}$$
You can specify the phase increment using a parameter or an input port.
The frequency resolution of an NCO is defined by
$$\Delta f=\frac{1}{{T}_{s}\cdot {2}^{N}}\text{Hz}$$
Given a desired phase offset (in radians), calculate the phase offset input value using
$$phaseoffset=\frac{{2}^{N}\cdot desiredphaseoffset}{2\pi}$$
You can specify the phase offset using a parameter or an input port.
When you use floatingpoint input signals, the block does not quantize the accumulation. Therefore, you must choose increment and offset values to represent a fraction of 2π without quantization, see Compute FloatingPoint Phase Increment for NCO HDL Optimized.
This block appears in the Sources libraries with
Phase increment source parameter set to
Property
. The only input port is
validIn.
This block appears in the Signal Operations libraries
with Phase increment source parameter set to
Input port
. This configuration shows the
optional input port inc.
This icon shows the optional ports of the NCO HDL Optimized block.
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

[1] Cordesses, L., "Direct Digital Synthesis: A Tool for Periodic Wave Generation (Part 1)." IEEE Signal Processing Magazine. Volume 21, Issue 4, July 2004, pp. 50–54.