2.5. Widget Real to Complex¶
The DSPLib contains a Widget Real to Complex solution, which provides a utility to convert real data to complex or vice versa.
2.5.1. Entry Point¶
The graph entry point is the following:
xf::dsp::aie::widget::real2complex::widget_real2complex_graph
2.5.2. Supported Types¶
The widget_real2complex supports int16, cint16, int32, cint32, float and cfloat on input. The corresponding TT_OUT_DATA must be set to the real or complex partner of the input type, e.g. if TT_DATA = int16, TT_OUT_DATA must be set to cint16.
2.5.3. Template Parameters¶
To see details on the template parameters for the Widget Real to Complex, see API Reference Overview.
2.5.4. Access functions¶
To see details on the access functions for the Widget Real to Complex, see API Reference Overview.
2.5.5. Ports¶
To see details on the ports for the Widget Real to Complex, see API Reference Overview.
2.5.6. Design Notes¶
The widget_real2complex library element converts real to complex or complex to real. An example of its use is that it can be used to enable real-only FFT operation despite the fact that the FFT currently supports only complex data types.
2.5.7. Code Example including constraints¶
The following code example shows how the widget_real2complex graph class may be used within a user super-graph, including how to set the runtime<ratio> of internal kernels. This example shows the widget configured to convert a window of int16 samples to cint16 samples.
#include <adf.h> #include "widget_real2complex_graph.hpp" #define DATA_TYPE int16 #define DATA_OUT_TYPE cint16 #define WINDOW_VSIZE 1024 class myWidget : public adf::graph { public: adf::port<input> in; adf::port<output> out; xf::dsp::aie::widget::real2complex::widget_real2complex_graph<DATA_TYPE, DATA_OUT_TYPE, WINDOW_VSIZE> widget; myWidget() { adf::connect<> net0(in , widget.in); adf::connect<> net1(widget.out , out); adf::kernel *kernels = widget.getKernels(); adf::runtime<ratio>(*kernels) = 0.5; } };