Fixed-Point Blockset    

Block Parameters

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:

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.

Output Data Types and Default Scaling
Data Type
Description
Default Scaling
float
Floating-point number
None
sfix
Signed generalized fixed-point number
None
sfrac
Signed fractional number
Right of the sign bit
sint
Signed integer
Right of the least significant bit
ufix
Unsigned generalized fixed-point number
None
uint
Unsigned integer
Right of the least significant bit
ufrac
Unsigned fractional number
Left of the most significant bit

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.

Scaling Modes for Generalized Fixed-Point Data Types 
Scaling Mode
Description
Radix point-only
Specify radix point-only (powers-of-two) scaling. For example, a scaling of 2^-10 (or pow2(-10)) places the radix point at a location 10 places to the left of the least significant bit.
[Slope Bias]
Specify [Slope Bias] scaling. For example, a scaling of
[5/9 10] specifies a slope of 5/9 and a bias of 10. When using this mode, you must specify a positive slope.

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.

Rounding Modes  
Rounding Mode
Description
Zero
Round the output towards zero.
Nearest
Round the output towards the nearest representable number, with the exact midpoint rounded towards positive infinity.
Ceiling
Round the output towards positive infinity.
Floor
Round the output towards negative infinity.

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