HDL Coder™ native floating-point support can generate HDL code from your floating-point design. HDL Coder supports several Simulink® blocks and math and trigonometric functions in native floating-point mode. These tables show the default latency values of these floating-point operations. You can customize these latency values. You can also customize the latency settings for most blocks and design for trade-offs between latency and Fmax by specifying custom latency values. To learn more, see Latency Considerations with Native Floating Point.
You can see the latency of these floating point operators in MATLAB® by entering these commands.
nfpconfig = hdlcoder.createFloatingPointTargetConfig('NativeFloatingPoint');
nfpconfig.IPConfig
This table shows the list of basic math operations that are supported with native
floating-point in HDL Coder and their latency information. The basic math operations include addition,
subtraction, multiplication, and so on. You can use most of these blocks with both
single
and double
data types. If you do not see an
entry of double
data type corresponding to a block, it means that the
block does not support double
types.
Basic Math Operators
Simulink Blocks | Data Type | Minimum Output Latency | Maximum Output Latency |
---|---|---|---|
Add | Double | 6 | 11 |
Single | 6 | 11 | |
Half | 4 | 8 | |
Subtract | Double | 6 | 11 |
Single | 6 | 11 | |
Half | 4 | 8 | |
Product | Double | 6 | 9 |
Single | 6 | 8 | |
Half | 4 | 6 | |
Divide | Double | 31 | 61 |
Single | 17 | 32 | |
Half | 10 | 19 | |
Math Function | Double | 30 | 60 |
Single | 16 | 31 | |
Multiply-Add | Single | 8 | 14 |
Rounding Function | Double | 3 | 5 |
Single | 3 | 5 | |
Unary Minus | Double | – | – |
Single | – | – | |
Half | – | – | |
Sign | Double | – | – |
Single | – | – | |
Abs | Double | – | – |
Single | – | – |
This table shows the math functions that are supported with native floating-point in
HDL Coder and their latency information. You can select the function using the
Function setting of the Math
Function block. You can use these blocks with single
data
types. Double
types are unsupported for the blocks.
Math Functions
Simulink Blocks | Minimum Output Latency | Maximum Output Latency |
---|---|---|
HDL Reciprocal | 14 | 21 |
Rem | 15 | 24 |
Mod | 16 | 26 |
Sqrt | 16 | 28 |
Reciprocal Sqrt | 16 | 30 |
Hypot | 17 | 33 |
This table shows the trigonometric operations that are supported with native
floating-point in HDL Coder and their latency information. You can select the function using the
Function setting of the Trigonometric Function block. You can use these blocks with
single
data types. Double
types are unsupported for
the blocks. The Sin block has a minimum latency
of 8 and a maximum latency of 14.
Trigonometric Functions
This table shows the exponential operations that are supported with native
floating-point in HDL Coder and their latency information. You can select the function using the
Function setting of the Math
Function block. You can use these blocks with single
data
types. Double
types are unsupported for the blocks except Log.
This table shows operations related to comparing of numbers and data type conversions
that are supported with native floating-point in HDL Coder and their latency information. You can use these blocks with both
single
and double
data types except for the MinMax block. This block does not support double
data types.
For the Data Type Conversion block, you can convert between
double
, half
, and single
data
types, and between floating-point and other fixed-point data types.
Comparisons and Conversions
Simulink Blocks | Data Type | Minimum Output Latency | Maximum Output Latency |
---|---|---|---|
Data Type Conversion | Double | 3 | 6 |
Single | 6 | 6 | |
Half | 3 | 2 | |
Relational Operator | Double | 1 | 3 |
Single | 1 | 3 | |
Half | 1 | 2 | |
MinMax | Single | 3 | 3 |