Main Content

Floating point tolerance check based on

Specify the floating-point tolerance check option

Model Configuration Pane: Test Bench

Description

When you map your design to the native floating-point libraries or the floating-point target libraries, specify the floating-point tolerance check option.

Dependencies

This option is disabled if you select the entire model. Select the DUT instead for Generate HDL for setting.

Settings

relative error (default) | ulp error
relative error

This is the default option. When you verify the generated code by using HDL Testbench, HDL Coder™ checks for the floating-point tolerance of the native floating-point library or the floating-point target library that your design mapped to based on the relative error.

ulp error

When you verify the generated code by using HDL Testbench, HDL Coder checks for the floating-point tolerance of the native floating-point library or the floating-point target library that your design mapped to based on the ULP error.

Tips

To set this property, use hdlset_param or makehdltb. To view the property value, use hdlget_param.

For example, to specify the floating-point tolerance value for a model, use the hdlset_param function to specify the tolerance strategy, and then enter the tolerance value. For example, to check the floating-point tolerance based on ULP error and enter the tolerance value:

% Check for floating-point tolerance based on ULP
hdlset_param('sfir_single', 'FPToleranceStrategy', 'ULP');   

% When using ULP, optionally enter tolerance value >= 0       
hdlset_param('FP_test_16a', 'FPToleranceValue', 1);

% Generate HDL testbench with specified tolerance setting
makehdltb('sfir_single/symmetric_fir')

Recommended Settings

No recommendations.

Programmatic Use

Parameter: FPToleranceStrategy
Type: character vector
Value: 'relative' | 'ULP'
Default: 'relative'

Version History

Introduced in R2017a