Main Content

addDesignRangeSpecification

Class: coder.FixPtConfig
Namespace: coder

Add design range specification to parameter

Syntax

addDesignRangeSpecification(fcnName,paramName,designMin, designMax)

Description

addDesignRangeSpecification(fcnName,paramName,designMin, designMax) specifies the minimum and maximum values allowed for the parameter, paramName, in function, fcnName. The fixed-point conversion process uses this design range information to derive ranges for downstream variables in the code.

Input Arguments

expand all

Function name, specified as a string.

Data Types: char

Parameter name, specified as a string.

Data Types: char

Minimum value allowed for this parameter, specified as a scalar double.

Data Types: double

Maximum value allowed for this parameter, specified as a scalar double.

Data Types: double

Examples

expand all

Set up the fixed-point configuration object.

cfg = coder.config('fixpt');
cfg.TestBenchName = 'dti_test';
cfg.addDesignRangeSpecification('dti', 'u_in', -1.0, 1.0)
cfg.ComputeDerivedRanges = true;

Derive ranges and generate fixed-point code.

fiaccel -float2fixed cfg dti;