Main Content

Fixed-Point Code Generation Support


All fixed-point blocks support code generation, except particular simulation features. The sections that follow describe the code generation support that the Fixed-Point Designer™ software provides. You must have a Simulink® Coder™ license to generate C code or a HDL Coder™ license to generate HDL code.


C code generation is supported with the use of Simulink Coder. HDL code generation is supported with the use of HDL Coder.

Data Types

Fixed-point code generation supports all integer and fixed-point data types that are supported by simulation. Word sizes of up to 128 bits are supported in simulation. See Supported Data Types.

Rounding Modes

All rounding modes — Ceiling, Convergent, Floor, Nearest, Round, Simplest, and Zero — are supported.

Overflow Handling

  • Saturation and wrapping are supported.

  • Wrapping generates the most efficient code.

  • Currently, you cannot choose to exclude saturation code automatically when hardware saturation is available. Select wrapping in order for the Simulink Coder product to exclude saturation code.


All blocks generate code for all operations with a few exceptions. The Lookup Table Dynamic block generates code for all lookup methods except Interpolation-Extrapolation.

The Simulink Block Data Type Support table summarizes characteristics of blocks in the Simulink block library, including whether they support fixed-point data types and any limitations that apply for C code generation. To view the table, enter the following command at the MATLAB® command line:

For information on block support for HDL code generation, see Display Blocks for HDL Code Generation in Library Browser (HDL Coder). You can also use the HDL Workflow Advisor to check your model for blocks not supported for HDL code generation.


Any binary-point-only scaling and [Slope Bias] scaling that is supported in simulation is supported, bit-true, in code generation.

Related Topics