| Fixed-Point Blockset | Search Help Desk |
The Block Dialog Box
Fixed-Point Blockset blocks are configured with
a parameter dialog box. The parameter dialog box provides you with:
Common Block Features
Many Fixed-Point Blockset blocks display the
same parameters through their dialog boxes and display similar information
through their block icon. For convenience, all the common block features
are described in this section.
Block Parameters
The common block parameters are associated with
these blockset features:
Data Type Selection
The parameter and output data type and word size
are specified with the Parameter data type and
Output data type parameters, respectively. The supported
output data types are shown below.
The word size in bits of fixed-point data types is given as an argument to the data type. For example, sfix(16) specifies a 16-bit signed generalized fixed-point number. Word sizes from 1 to 128 bits are supported. Floating-point data types are IEEE-style and are specified as float('single') for single precision numbers and float('double') for double precision numbers. Nonstandard IEEE-style numbers are specified as float(x,y) where x is the total number of physical bits and y is the number of exponent bits.Note:
A default radix point is not included with the generalized fixed-point data type. Instead, the scaling must be explicitly specified as described belowFor more information about supported data types and their default scaling, refer to Chapter 3, "Data Types and Scaling" in the Fixed-Point Blockset User's Guide.
Scaling
If the parameter or output data type is specified
as generalized fixed-point, then you must select a scaling mode with the
Parameter scaling and Output scaling parameters, respectively.
The scaling modes are:
Lock Output Scaling
If the Lock output scaling checkbox is
checked, then the automatic scaling tool will not change the Output
scaling parameter value. Otherwise, the automatic scaling tool is free
to adjust the scaling.
Rounding
You can choose the rounding mode for the block
operation with the Round toward pull-down menu. The available rounding
modes are shown below.
Overflow Handling
Overflow handling for fixed-point numbers is
specified with the Saturate to max or min when overflows occur checkbox.
If checked, fixed-point overflow results saturate. Otherwise, overflow
results wrap.Whenever a result saturates, a warning is displayed.
Overriding with Doubles
If the Override with doubles checkbox
is checked, then the Parameter data type and Output data type
selection is ignored. Instead, parameters and outputs are represented using
double precision floating-point numbers. Also, any calculations will be
performed using floating-point arithmetic. An
exception to above rule is when parameters or output contain a bias. In
this case, the bias is not ignored in subsequent fixed-point operations. If
the parameter and output data types are both floating-point, the Override
with doubles checkbox is not available.
Logging Simulation Results
The minimum and maximum values produced by the
simulation are logged if the Log minimums and maximums checkbox
is checked. The logged values are stored in the FixPtSimRanges
cell array in the MATLAB workspace. You can access these values with the
showfixptsimranges script or the fixed-point GUI.
In addition to logging the minimum and maximum simulation values, the maximum absolute error for each block is also logged. If the maximum absolute error exceeds 50% of the output range, then a warning, an error, or nothing is issued depending on the setting of the Integer Overflow mode under Simulation>Parameters>Diagnostics. The maximum absolute error represents error due to online calculations within a block. The maximum absolute error excludes effects due to quantization of the parameters and inputs.
The automatic scaling tool will not adjust blocks that have not logged min/max information.
Block Icon Display
Many blockset icons look like those of built-in
Simulink blocks. For this reason, all block icons have an "F" (for "Fixed-Point")
associated with them. An "F" in the lower right (upper left) corner of
the icon means the block output (input) is a Fixed-Point Blockset data
type. Some blocks have additional labels, which are described in their
reference pages.For blocks that allow you to choose
the output data type, you can control the information displayed below the
icon with the global variable FixDispPref. The icon display choices
are explained below.
When a scaling property takes a trivial value, that information is not displayed. This occurs when:
Fixed-Point Output
If a block is configured for fixed-point output
and FixDispPref = 1 or 2, then the block icon displays the data
type format. Scaling information is displayed for all fixed-point data
types. Also, if the output has a non-zero bias and the Override with
doubles checkbox is checked, then the bias is still displayed.For
example, suppose the output data type is a 16-bit signed generalized fixed
point number with slope/bias scaling specified as [2.5 10]. If
FixDispPref = 1, then the data type information is displayed as
S16 2^1 Fslope 1.25 Bias 10If FixDispPref = 2, then the data type information is displayed as
S16 Slope 2.5 Bias 10If FixDispPref = 3, then the data type information is displayed as
S16 Min -81910 Max 81927.5
Floating-Point Output
If the block is configured for standard floating-point
output, and FixDispPref = 1, 2, or 3, the block icon displays
either single or double. Nonstandard floating-point output
is indicated by the number of mantissa and exponent bits. For example,
float(16,8) is displayed as 7 MantBits and 8 ExpBits.If
the block is configured for fixed-point output, has a non-zero bias, and
the Override with doubles checkbox is checked, then the bias will
still be displayed.