Tolerance Value - Enter the tolerance value based on the floating-point tolerance check setting that

     you specify - MATLAB ([original](https://in.mathworks.com/help/hdlcoder/ref/hlstolerancevalue.html)) ([raw](?raw))

Main Content

Enter the tolerance value based on the floating-point tolerance check setting that you specify

Since R2024b

Model Configuration Pane: Test Bench

Description

Enter the tolerance value based on the floating-point tolerance check setting that you specify.

Dependencies

Generate test bench enables this parameter. Enable this parameter by clicking Generate Test Bench in the Verification > Verify with HLS Test Bench > Output Settings pane of the HDL Workflow Advisor.

Settings

1e-07 (default) | 0

When you use this floating-point tolerance check setting, specify the tolerance value as a double.

Examples

expand all

For example, this MATLABĀ® code configures the HDL configuration object for High Level Synthesis and uses mlhdlc_sfir_tb as the test bench to verify the generated code. It also specifies the FPToleranceStrategy as ULP Error and sets the FPToleranceValue to 1.

% Create HDLConfig object and set the workflow as "High Level Synthesis" cfg = coder.config("hdl"); cfg.Workflow = "High Level Synthesis";

% Test bench options cfg.TestBenchName = "mlhdlc_sfir_tb"; cfg.GenerateHDLTestBench = true;

% Specify the FPToleranceStrategy as "ULP Error" cfg.FPToleranceStrategy = "ULP Error";

% Specify the FPToleranceValue as an integer for "ULP Error" strategy cfg.FPToleranceValue = 1;

codegen -config cfg mlhdlc_sfir -report

Begin MATLAB to HLS Code Generation...

Working on DUT: mlhdlc_sfir.

Using TestBench: mlhdlc_sfir_tb.

Begin HLS Code Generation

Generating Resource Utilization Report resource_report.html.

Working on mlhdlc_sfirClass.hpp as mlhdlc_sfirClass.hpp.

Working on mlhdlc_sfirModule.hpp as mlhdlc_sfirModule.hpp.

To rerun codegen evaluate the following commands...


cgi = load('/tmp/Bdoc25a_2864802_2731108/tp7486429d/hdlcoder-ex34814788/codegen/mlhdlc_sfir/hdlsrc/codegen_info.mat'); inVals = cgi.CodeGenInfo.inVals; cfg = cgi.CodeGenInfo.codegenSettings; codegen -config cfg -args inVals -report

Begin TestBench generation.

Code generation successful.

Figure mlhdlc_sfir_tb_plot contains 3 axes objects. Axes object 1 with title Input Signal (with noise), xlabel Time (ms), ylabel Amplitude contains an object of type line. Axes object 2 with title Output Signal (filtered), xlabel Time (ms), ylabel Amplitude contains an object of type line. Axes object 3 with title Input and Output Signals (Frequency domain), xlabel Frequency (Hz), ylabel Amplitude (dB) contains 2 objects of type line. These objects represent FilterIn, FilterOut.

Collecting data...

Begin HLS test bench file generation with logged samples

Generating test bench data file: x_in.dat.

Generating test bench data file: y_out_expected.dat.

Generating test bench data file: delayed_xout_expected.dat.

Generating test bench file: mlhdlc_sfirClass_tb.hpp

Generating test bench module file: mlhdlc_sfirModule_tb.hpp

Generating HLS Conformance Report mlhdlc_sfir_hdl_conformance_report.html.

HLS Conformance check complete with 0 errors, 0 warnings, and 0 messages.

Code generation successful: View report

No recommendations.

Programmatic Use

Parameter: FPToleranceValue
Type: double | integer
Default: 1e-07

Version History

Introduced in R2024b