Native Floating Point Support for Simulink Blocks - MATLAB & Simulink (original) (raw)
You can use HDL Coder™ native floating-point to generate target-independent HDL code from a floating-point design. Floating-point designs have better precision, higher dynamic range, and a shorter development cycle than fixed-point designs. If your design has complex math and trigonometric operations, use native floating-point technology.
This page lists the Simulink® blocks and parameter settings that you can use with HDL Coder native floating point.
HDL Floating Point Operations Library
In the HDL Floating Point Operations library, HDL Coder supports blocks that havesingle
and double
data types in the native floating-point mode. For certain blocks, such as Discrete-Time Integrator andDiscrete PID Controller, use zero latency strategy.
When you use half
types, HDL Coder supports native floating-point for these blocks:
- Add
- Bus to Vector
- Divide
- Dot Product
- Float Typecast
- Gain
- Logical Operator
- Multiply-Add
- Probe
- Product
- Product of Elements
- Reciprocal
- Relational Operator
- Subtract
- Sum of Elements
- Signal Conversion
- Terminator
- Transpose
- Unary Minus
Support for Simulink Blocks in Math Operations Library
In the Math Operations library, HDL Coder supports native floating-point for these blocks and data types:
Support for Functions in Math Function Block
In the Math Function block, HDL Coder supports native floating-point for these functions:
Math Functions | Floating-Point Support | Complex Data Support | ||
---|---|---|---|---|
Half Data Type | Single Data Type | Double Data Type | ||
exp | No | Yes | No | No |
log | No | Yes | Yes | No |
10^u | No | Yes | No | No |
log10 | No | Yes | No | No |
magnitude^2 | No | Yes | Yes | Yes |
square | No | Yes | No | Yes |
pow | No | Yes | No | No |
conj | No | Yes | No | Yes |
reciprocal | Yes | Yes | Yes | No |
hypot | No | Yes | No | No |
rem | No | Yes | No | No |
mod | No | Yes | No | No |
transpose | Yes | Yes | Yes | Yes |
hermitian | No | Yes | No | Yes |
Support for Simulink Blocks in Other Libraries
HDL Coder supports native floating-point for these HDL Coder block libraries.
Block Library | Half Data Type Support | Single Data Type Support | Double Data Type Support |
---|---|---|---|
Discrete | The set of delay blocks including the synchronous blocksInteger DelayTapped Delay | Zero Order HoldSet of delay blocks including the synchronous blocks, and Integer Delay, and Tapped Delay. | Zero Order HoldSet of delay blocks including the synchronous blocks, and Integer Delay, and Tapped Delay. |
HDL Operations | Blocks in this library are not supported. | All blocks are supported. | All blocks are supported. |
HDL RAMs | Blocks in this library are not supported. | All blocks are supported. | All blocks are supported. |
HDL Subsystems | All blocks are supported. | All blocks are supported. | All blocks are supported. |
Logic and Bit Operations | Compare to ConstantRelational OperatorLogical OperatorDetect ChangeDetect IncreaseDetect Decrease | All blocks are supported. | All blocks are supported. |
Lookup Tables | Blocks in this library are not supported. | All blocks are supported. | All blocks are supported. |
Model Verification | Blocks in this library are not supported. | All blocks are supported. | All blocks are supported. |
Model-Wide Utilities | Blocks in this library are not supported. | All blocks are supported. | All blocks are supported. |
Ports & Subsystems | Enable, reset, input, and output portsModel referencesSubsystems | Enable, reset, input, and output portsModel referencesSubsystems | Enable, reset, input, and output portsModel referencesSubsystems |
Signal Attributes | Data Type ConversionData Type DuplicateRate TransitionSignal SpecificationSignal ConversionBus to VectorProbe | All blocks are supported. | All blocks are supported. |
Signal Routing | All blocks are supported. | All blocks are supported. | All blocks are supported. |
Sources | Inport, Constant, andGround blocks. | Inport, Constant, andGround blocks. | Inport, Constant, andGround blocks. |
Sinks | All blocks are supported. | All blocks are supported. | All blocks are supported. |
User-Defined Functions | MATLAB Function blocks. | MATLAB Function blocks. | MATLAB Function blocks. |
Support for Stateflow Charts
HDL Coder supports Stateflow® charts with these data types when generating code in native floating-point mode:
- Floating-point constants
- Floating-point inputs
- Function calls with floating-point arguments
- Floating-point arithmetic operations
These chart types are supported:
- Classic charts
- Mealy charts
- State transition tables
- Truth tables
- Requirement tables
Stateflow charts and Moore charts with conditional transitions are not supported. For more information on conditional transitions in Stateflow charts, see Transition Between Operating Modes (Stateflow).
Simulink Block Restrictions
HDL Coder does not support native floating-point for these blocks or block architectures:
- Dot Product blocks that have complex-valued input or output data with the Architecture parameter set to
Tree
orLinear
- Dead Zone and Dead Zone Dynamic blocks
- Polar to Cartesian blocks
For the Data Type Conversion block:
- The Input and output to have equal parameter cannot be set to
Stored Integer (SI)
. - The Saturate on integer overflow check box must be left cleared.