Fixed-Point Conversion Workflows
Choosing a Conversion Workflow
MathWorks® provides a number of solutions for fixed-point conversion. Which conversion method you use depends on your end goal and your level of fixed-point expertise.
Goal | Conversion Method | See Also |
---|---|---|
Use generated fixed-point MATLAB® code for simulation purposes. | If you are new to fixed-point modeling, use the Fixed-Point Converter app. | |
If you are familiar with fixed-point modeling, and want to quickly explore design tradeoffs, convert your code manually. | ||
Generate fixed-point C code (requires MATLAB Coder™) | MATLAB Coder Fixed-Point Conversion tool | Convert MATLAB Code to Fixed-Point C Code (MATLAB Coder) |
Generated HDL code (requires HDL Coder™) | HDL Coder Workflow Advisor | Floating-Point to Fixed-Point Conversion (HDL Coder) |
Integrate fixed-point MATLAB code in larger applications for system-level simulation. | Generate a MEX function from the fixed-point algorithm and call the MEX function instead of the original MATLAB function. | Propose Data Types Based on Simulation Ranges Using the Fixed-Point Converter App and Propose Data Types Based on Derived Ranges Using the Fixed-Point Converter App |
Automated Workflow
If you are new to fixed-point modeling and you are looking for a direct path from floating-point MATLAB to fixed-point MATLAB code, use the automated workflow. Using this automated workflow, you can obtain data type proposals based on simulation ranges, static ranges, or both. For more information, see Automated Fixed-Point Conversion, Propose Data Types Based on Simulation Ranges Using the Fixed-Point Converter App, and Propose Data Types Based on Derived Ranges Using the Fixed-Point Converter App.
Manual Workflow
If you have a baseline understanding of fixed-point implementation details and an interest in exploring design tradeoffs to achieve optimized results, use the separate algorithm/data type workflow. Separating algorithmic code from data type specifications allows you to quickly explore design tradeoffs. This approach provides readable, portable fixed-point code that you can easily integrated into other projects. For more information, see Manual Fixed-Point Conversion Workflow and Implement FIR Filter Algorithm for Floating-Point and Fixed-Point Types Using cast and zeros.