Fixed-Point Blockset | ![]() ![]() |
Many Fixed-Point Blockset blocks use the same parameters, which you configure through the block dialog box. Some common block parameters are associated with these blockset features:
Block-specific parameters are described in the block reference pages.
Selecting the Data Type and Scaling
For many fixed-point blocks, you need to associate data type and scaling information with numerical parameters and output signals. Fixed-Point Blockset blocks often provide you with the option of inheriting information from an input signal, from the next block downstream, or by an internal rule. Alternatively, you can often specify the data type and scaling yourself in the dialog. You control this option with the Output data type mode and Parameter data type mode parameters. These drop-down lists often support one or more of the following four choices:
Specify via dialog
--You explicitly specify the output data type and scaling with the Output data type and Output scaling value parameters, or the parameter data type and scaling with the Parameter data type and Parameter scaling value parameters.
Inherit via back propagation
--Specified data type and scaling information is inherited by backpropagation from the next block downstream. In many cases, you will find that the Data Type Propagation block provides you with the most flexibility when back propagating the data type.
Inherit via internal rule
--The specified data type information is inherited from the input(s). The goal of the inheritance rule is to select the "natural" data type and scaling for the output. The specific rule that is used depends on the block operation.
If you are adding signals, two natural choices for the output data type and scaling are possible: to preserve the precision or to prevent overflow. However, blocks only support one rule. For example, the Sum block preserves precision. If your goal is to prevent overflow, then you should manually configure the data type and scaling.
In addition, the Output data type mode and Parameter data type mode parameters often include built-in data types in their drop-down lists for easy selection. Built-in data types can also be entered into the Output data type or Parameter data type parameter if Specify via dialog
is selected for the Output data type mode or Parameter data type mode parameter.
The supported fixed-point data types that may be entered into the Output data type or Parameter data type parameter and their default scalings are shown below.
In the Fixed-Point Blockset, 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 in simulation.
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(TotalBits,ExpBits)
where TotalBits
is the total number of physical bits and ExpBits
is the number of exponent bits.
For more information about supported fixed-point data types and their default scaling, refer to Data Types and Scaling.
If you select Specify via dialog
for the Output data type mode or Parameter data type mode parameter, you must also explicitly specify the output or parameter scaling with the Output scaling value or Parameter scaling value parameter. The supported scaling modes for generalized fixed-point data types are given below. Default scaling is used for all other fixed-point data types.
Note that some blocks provide a form of radix point-only scaling for constant vectors and constant matrices. Refer to Example: Constant Scaling for Best Precision for more information.
Locking the Output Scaling
If the Lock output scaling against changes by the autoscaling tool check box is selected, then the automatic scaling tool autofixexp
will not change the Output scaling value parameter. Otherwise, the automatic scaling tool is free to adjust the scaling. You can run autofixexp
directly from the command line, or through the Fixed-Point Settings interface, fxptdlg
.
Rounding
You can choose the rounding mode for the block operation with the Round integer calculations toward parameter list. The available rounding modes are shown below.
Handling Overflows
Overflow handling for fixed-point numbers is specified with the Saturate on integer overflow check box. If selected, fixed-point overflow results saturate. Otherwise, overflow results wrap. Whenever a result saturates, a warning is displayed.
![]() | Common Block Features | Block Icon Labels | ![]() |