addDesignRangeSpecification

Class: coder.FixptConfig
Package: 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

Add a Design Range Specification

% Set up the fixed-point configuration object
fixptcfg = coder.config('fixpt');
fixptcfg.TestBenchName = 'dti_test';
fixptcfg.addDesignRangeSpecification('dti', 'u_in', -1.0, 1.0)
fixptcfg.ComputeDerivedRanges = true;

%Set up C code configuration object
cfg = coder.config('lib'); 
% Derive ranges  and generate fixed-point C code
codegen -config cfg -float2fixed fixptcfg dti -report