Main Content

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 BlocksKeywords Data TypeMinimum Output LatencyMaximum Output LatencyCustom Latency Support
AddADDSUBDouble611Yes
Single611
Half48
SubtractADDSUBDouble611Yes
Single611
Half48
Product or GainMULDouble69Yes
Single68
Half47
DivideDIVDouble3161Yes
Single1732
Half1019
ReciprocalRECIPDouble3060Yes
Single1631
Half1019
Multiply-AddMULTADDSingle814No
SqrtSQRTDouble3358Yes
Single1628
Half612
HDL ReciprocalHDLRECIPSingle1421No
Rounding FunctionROUNDINGDouble35Yes
Single35
Gain(Power of 2)GAINPOW2Double12Yes
Single12
Half14

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 BlocksKeywordsData TypeMinimum Output LatencyMaximum Output LatencyCustom Latency Support
RemREMSingle1524No
ModMODSingle1626No
Reciprocal SqrtRSQRTSingle1630Yes
HypotHYPOTSingle1733No
Magnitude Square-Double69Yes
Single68

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.

Exponent/Logarithm/Power

Simulink BlocksKeywordsData TypeMinimum Output LatencyMaximum Output LatencyCustom Latency Support
ExpEXPSingle1626No
PowPOWSingle3354No
Pow10POW10Single1626No
LogLOGDouble3444No
Single2027
Half917
Log10LOG10Single1727No
Half1018

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 BlocksKeywordsData TypeMinimum Output LatencyMaximum Output LatencyCustom Latency Support
SinSINDouble3434No
Single2727
Half814
CosCOSDouble4848No
Single2727
Half914
TanTANSingle3333No
SincosSINCOSSingle2727No
AsinASINSingle1723No
AcosACOSSingle1723No
AtanATANSingle3636No
Atan2ATAN2Single4242No
SinhSINHSingle1830No
CoshCOSHSingle1727No
TanhTANHSingle2543No
AsinhASINHSingle9494No
AcoshACOSHSingle9393No
AtanhATANHSingle6767No

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 BlocksKeywordsData TypeMinimum Output LatencyMaximum Output LatencyCustom Latency Support
Data Type ConversionCONVERTDOUBLE_TO_NUMERICTYPE36Yes
DOUBLE_TO_SINGLE36
HALF_TO_NUMERICTYPE23
HALF_TO_SINGLE12
NUMERICTYPE_TO_DOUBLE36
NUMERICTYPE_TO_HALF24
NUMERICTYPE_TO_SINGLE66
SINGLE_TO_DOUBLE35
SINGLE_TO_HALF23
SINGLE_TO_NUMERICTYPE66
Relational OperatorRELOPDouble13Yes
Single13
Half12
MinMaxMINMAXSingle33No

See Also

Modeling Guidelines

Functions

Related Examples

More About