Documentation Center

  • Trial Software
  • Product Updates

Contents

Specify Type Proposal Options

You specify whether to propose fraction lengths or word lengths in the Fixed-Point Conversion window Type Proposal options. By default, the software proposes fraction lengths for a default word length of 16.

To customize fixed-point type proposals, use the Advanced settings.

Advanced SettingValuesDescription

When proposing types

    Note:   Manually-entered static ranges always take precedence over simulation ranges.

ignore simulation ranges

Propose data types based only on derived ranges.

ignore derived ranges

Propose data types based on simulation ranges.

use all collected data (default)

Propose data types based on both simulation and derived ranges.

Propose target container types

Yes

Propose data type with the smallest word length that can represent the range and is suitable for C code generation ( 8,16,32, 64 … ). For example, for a variable with range [0..7], propose a word length of 8 rather than 3.

No (default)

Propose data types with the minimum word length needed to represent the value.

Optimize whole numbers

No

Do not use integer scaling for variables that were whole numbers during simulation.

Yes (default)

Use integer scaling for variables that were whole numbers during simulation.

Signedness

Automatic (default)

Proposes signed and unsigned data types depending on the range information for each variable.

Signed

Propose signed data types.

Unsigned

Propose unsigned data types.

Safety margin for sim min/max (%)

0 (default)

Specify safety factor for simulation minimum and maximum values.

The simulation minimum and maximum values are adjusted by the percentage designated by this parameter, allowing you to specify a range different from that obtained from the simulation run. For example, a value of 55 specifies that you want a range at least 55 percent larger. A value of -15 specifies that a range up to 15 percent smaller is acceptable.

Generated fixed-point file name suffix

 

_fixpt (default)

Specify the suffix to add to the generated fixed-point file names.

Transform for-loop index variables

 

No (default)

Do not convert loop index variables to fixed point. Convert instances of the index variable used in the main body of the code as appropriate.

Consider the following code.

k = zeros(1,100);
for ii=1:100
  k(ii) = u;
end

In the generated fixed-point code, ii is not converted to fixed point.

k = fi(zeros(1,100),0,4,0,fm);
for ii = 1:100
  k(ii) = u;
end

Next, consider this code.

y = zeros(1,100);
for ii=1:100
  y(ii) = u + ii;
end

Here, when ii is used as an operand of a fixed-point expression, it is converted to fixed point. When it is used as a loop index variable, it is not converted.

y = fi(zeros(1,100),0,7,0,fm);
for ii = 1:100
  y(ii) = u + fi(ii,0,7,0,fm);
end
  

Yes

Convert for-loop index variables to fixed point.

Consider the following code.

k = zeros(1,100);
for ii=1:100
  k(ii) = u;
end

In the generated fixed-point code, ii is converted to fixed point.

k = fi(zeros(1,100),0,4,0,fm);
for ii_iter = 1:100
  ii = fi(ii_iter,0,7,0,fm);
  k(ii) = u;
end

Next, consider this code.

y = zeros(1,100);
for ii=1:100
  y(ii) = u + ii;
end

In the generated fixed-point code, ii is converted to fixed point.

y = fi(zeros(1,100),0,7,0,fm);
for ii_iter = 1:100
  ii = fi(ii_iter,0,7,0,fm);
  y(ii) = u + ii;
end

fimath

Rounding method

Ceiling

Specify the fimath properties for the generated fixed-point data types.

The default fixed-point math properties use the Floor rounding and Wrap overflow. These settings generate the most efficient code but might cause problems with overflow.

After code generation, if required, modify these settings to optimize the generated code, or example, avoid overflow or eliminate bias, and then rerun the verification.

Convergent

Floor (default)

Nearest

Round

Zero

Overflow action

Saturate

Wrap (default)

Product mode

FullPrecision (default)

KeepLSB

KeepMSB

SpecifyPrecision

Sum mode

FullPrecision (default)

KeepLSB

KeepMSB

SpecifyPrecision

Was this topic helpful?