Fixed-Point Conversion

Convert floating-point code to fixed-point code, optimize fixed-point data types

Functions

codegen Generate HDL code from MATLAB code
coder.config Create HDL Coder code generation configuration objects
coder.approximation Create function replacement configuration object

Classes

coder.FixptConfig Floating-point to fixed-point conversion configuration object

Examples and How To

Floating-Point to Fixed-Point Conversion

This example shows how to start with a floating-point design in MATLAB, iteratively converge on an efficient fixed-point design in MATLAB, and verify the numerical accuracy of the generated fixed-point design.

Fixed-Point Type Conversion and Refinement

This example shows how to achieve your desired numerical accuracy when converting fixed-point MATLAB® code to floating-point code using the HDL Workflow Advisor.

Working with Generated Fixed-Point Files

This example shows how to work with the files generated during floating-point to fixed-point conversion.

Specify Type Proposal Options

Fixed-point type proposal mode

Log Data for Histogram

To log data for histograms:

View and Modify Variable Information

View and modify variable information for fixed-point conversion.

Enable Plotting Using the Simulation Data Inspector

You can use the Simulation Data Inspector to inspect and compare floating-point and fixed-point logged input and output data.

Inspecting Data Using the Simulation Data Inspector

The Simulation Data Inspector allows you to view data logged during the fixed-point conversion process.

Replace a Custom Function with a Lookup Table

With HDL Coder™, you can generate lookup table approximations for functions that do not support fixed-point types, and replace your own functions.

Replace the exp Function with a Lookup Table

With HDL Coder, you can handle functions that are not supported for fixed point and replace your own functions.

Visualize Differences Between Floating-Point and Fixed-Point Results

This example shows how to configure the fiaccelcodegen function to use a custom plot function to compare the behavior of the generated fixed-point code against the behavior of the original floating-point MATLAB® code.

Concepts

Automated Fixed-Point Conversion

Convert floating-point MATLAB code to fixed-point code.

Primary Function Input Specification

Specify properties of entry-point function inputs.

Replacing Functions Using Lookup Table Approximations

The Fixed-Point Designer™ MATLAB Coder™ software provides an option to generate lookup table approximations for continuous and stateless single-input, single-output functions in your original MATLAB code.

Custom Plot Functions

Use a custom plotting function to visualize the differences between the floating-point and fixed-point results

Data Type Issues in Generated Code

Highlight potential data type issues in report.

Fixed-Point Bitwise Functions

Generating HDL code for MATLAB fixed-point bitwise functions

Fixed-Point Run-Time Library Functions

Fixed-point run-time library function language support for HDL code generation

Was this topic helpful?