Generate Code from Fixed-Point Multirate Filters
- Updated2025-10-10
- 3 minute(s) read
Generate Code from Fixed-Point Multirate Filters
After obtaining an appropriate fixed-point filter model, the resulting fixed-point filter can be implemented on target hardware.
The fixed-point integer coefficients can be exported from the filter and then used in a filter execution engine. A LabVIEW FPGA code can be generated and then used the LabVIEW FPGA Module to target and deploy the resulting FPGA code to an NI Reconfigurable I/O (RIO) target.
Exporting Fixed-Point Integer Coefficients
When using a filter execution engine for which you need only filter coefficients, you can export the fixed-point multirate filter coefficients to a text file using the DFD Save to Text File VI. You can save the multirate filter coefficients to a text file and load them to the execution target. The text file contains a section that provides all information about the fixed-point integer coefficients and corresponding quantizers.
Generating LabVIEW FPGA Code
Use the Start IP Generator dialog box or the DFD FXP MRate Code Generator VI to generate LabVIEW field-programmable gate array (FPGA) code from a multirate filter.
The Digital Filter Design Toolkit uses LabVIEW projects to manage the resulting LabVIEW FPGA code. The following figure shows an example project file that contains LabVIEW FPGA code:
In the previous figure, the filtername.lvproj file, where filtername denotes the name of the fixed-point filter, contains the following folder and VI in addition to the default items:
- Right-click filtername_DataOut.
- Choose Properties from the shortcut menu.
- Choose Target to Host-DMA from the Type menu.
- Click OK.
The way the LabVIEW FPGA code is used is different from the way a general LabVIEW VI is used. The following figure shows an example of a block diagram that uses LabVIEW FPGA code generated from the filtername_Filter VI.
In the previous figure, the filtername_Filter VI is not connected to any other items on the block diagram. However, this VI actually communicates with the items in the loop structures by processing the input signal from the filtername_DataIn FIFO and returning the output signal to the filtername_DataOut FIFO.
You can generate LabVIEW FPGA code from a fixed-point single-stage multirate filter by using the Start IP Generator dialog box or the DFD FXP MRate Code Generator VI.
You can generate LabVIEW FPGA code from a fixed-point multistage multirate filter by using the Start IP Generator dialog box or the DFD FXP NStage MRate Code Generator VI.
You also can generate LabVIEW FPGA code from a fixed-point moving average filter by using the Start IP Generator dialog box or the DFD FXP Moving Average Code Generator VI.
Postprocessing Filtered Signals
After you deploy fixed-point filter coefficients to the target hardware, you can postprocess the filtered signal using the DFD FXP MRate Postprocessing VI.