Latency Values of Floating-Point Operators
HDL Coder™ native floating-point support can generate HDL code from your floating-point design. HDL Coder supports several Simulink® blocks, Math and Trigonometric Functions blocks in native floating-point mode. The tables list the default latency values of these floating-point operations.
You can customize the latency settings for the blocks and design for trade-offs between latency and maximum frequency. For more information, see NFPCustomLatency.
You can also set the global custom latency of native floating-point IPs. Use the keywords listed in the tables to specify the global custom latency of the floating-point IPs. For more information on setting the custom latency of floating-point IPs, 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
Math Operations
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 | Keywords | Data Type | Minimum Output Latency | Maximum Output Latency | Custom Latency Support |
---|---|---|---|---|---|
Sum | ADDSUB | Double | 6 | 11 | Yes |
Single | 6 | 11 | |||
Half | 4 | 8 | |||
Product, Matrix Multiply or Gain | MUL | Double | 6 | 9 | Yes |
Single | 6 | 8 | |||
Half | 4 | 7 | |||
Divide | DIV | Double | 31 | 61 | Yes |
Single | 17 | 32 | |||
Half | 10 | 19 | |||
Product, Matrix MultiplyReciprocal | RECIP | Double | 30 | 60 | Yes |
Single | 16 | 31 | |||
Half | 10 | 19 | |||
Multiply-Add | MULTADD | Single | 8 | 14 | No |
Sqrt | SQRT | Double | 33 | 58 | Yes |
Single | 16 | 28 | |||
Half | 6 | 12 | |||
HDL Reciprocal | HDLRECIP | Single | 14 | 21 | No |
Rounding Function | ROUNDING | Double | 3 | 5 | Yes |
Single | 3 | 5 | |||
Gain(Power of 2) | GAINPOW2 | Double | 1 | 2 | Yes |
Single | 1 | 2 | |||
Half | 1 | 4 |
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.
Math Functions
Simulink Blocks | Keywords | Data Type | Minimum Output Latency | Maximum Output Latency | Custom Latency Support |
---|---|---|---|---|---|
Rem | REM | Single | 15 | 24 | No |
Mod | MOD | Single | 16 | 26 | No |
Reciprocal Sqrt | RSQRT | Single | 16 | 30 | Yes |
Hypot | HYPOT | Single | 17 | 33 | No |
Reciprocal | RECIP | Double | 30 | 60 | Yes |
Single | 16 | 31 | |||
Half | 10 | 19 | |||
Magnitude Square | - | Double | 6 | 9 | Yes |
Single | 6 | 8 |
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.
Trigonometric Operations
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.
Trigonometric Functions
Simulink Blocks | Keywords | Data Type | Minimum Output Latency | Maximum Output Latency | Custom Latency Support |
---|---|---|---|---|---|
Sin | SIN | Double | 34 | 34 | No |
Single | 27 | 27 | |||
Half | 8 | 14 | |||
Cos | COS | Double | 48 | 48 | No |
Single | 27 | 27 | |||
Half | 9 | 14 | |||
Tan | TAN | Single | 33 | 33 | No |
Sincos | SINCOS | Single | 27 | 27 | No |
Asin | ASIN | Single | 17 | 23 | No |
Acos | ACOS | Single | 17 | 23 | No |
Atan | ATAN | Single | 36 | 36 | No |
Atan2 | ATAN2 | Single | 42 | 42 | No |
Sinh | SINH | Single | 18 | 30 | No |
Cosh | COSH | Single | 17 | 27 | No |
Tanh | TANH | Single | 25 | 43 | No |
Asinh | ASINH | Single | 94 | 94 | No |
Acosh | ACOSH | Single | 93 | 93 | No |
Atanh | ATANH | Single | 67 | 67 | No |
Comparisons and Conversions
This table shows operations related to relational operators 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 type.
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 | Keywords | Data Type | Minimum Output Latency | Maximum Output Latency | Custom Latency Support |
---|---|---|---|---|---|
Data Type Conversion | CONVERT | DOUBLE_TO_NUMERICTYPE | 3 | 6 | Yes |
DOUBLE_TO_SINGLE | 3 | 6 | |||
HALF_TO_NUMERICTYPE | 2 | 3 | |||
HALF_TO_SINGLE | 1 | 2 | |||
NUMERICTYPE_TO_DOUBLE | 3 | 6 | |||
NUMERICTYPE_TO_HALF | 2 | 4 | |||
NUMERICTYPE_TO_SINGLE | 6 | 6 | |||
SINGLE_TO_DOUBLE | 3 | 5 | |||
SINGLE_TO_HALF | 2 | 3 | |||
SINGLE_TO_NUMERICTYPE | 6 | 6 | |||
Relational Operator | RELOP | Double | 1 | 3 | Yes |
Single | 1 | 3 | |||
Half | 1 | 2 | |||
MinMax | MINMAX | Single | 3 | 3 | No |