Fixed-Point Blockset    

Common Block Features

For convenience, all the common block features are described in this section. These common features include:

Block Parameters

Many Fixed-Point Blockset blocks use the same parameters, which you configure through the block dialog box. The common block parameters are associated with these blockset features:

Block-specific parameters are described in the block reference pages.

Selecting the Data Type

For many fixed-point blocks, you need to associate data type information with numerical parameters and the output. You can associate data type information in these ways:

The supported data types and default scaling are shown below.

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

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(TotalBits,ExpBits) where TotalBits is the total number of physical bits and ExpBits is the number of exponent bits.

For more information about supported data types and their default scaling, refer to Chapter 3, Data Types and Scaling.

Selecting the Scaling

For generalized fixed-point data types, you need to associate scaling information with numerical parameters and the output. You can associate scaling information in these ways:

The supported scaling modes for generalized fixed-point data types are given below. Default scaling is used for all other fixed-point data types.

Table 9-2: 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 so autoscaling tool can't change it check box is checked, then the automatic scaling tool autofixexp will not change the Output scaling parameter value. 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 Blockset Interface tool, fxptdlg.

Rounding

You can choose the rounding mode for the block operation with the Round toward parameter list. The available rounding modes are shown below.

Table 9-3: 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 to max or min when overflows occur check box. 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 data type(s) with doubles check box is checked, then the Parameter data type and Output data type parameter values are ignored. Instead, parameters and outputs are represented using double-precision floating-point numbers. Also, any calculations are performed using floating-point arithmetic.

An exception to this rule is when parameters or outputs 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 check box is not available.

Logging Simulation Results

The minimum and maximum values produced by the simulation are logged if the Log minimums and maximums check box is checked. The logged values are stored in the FixPtSimRanges global cell array in the MATLAB workspace. You can access these values with the showfixptsimranges script or with the Fixed-Point Blockset Interface tool, fxptdlg.

In addition to logging the minimum and maximum simulation values, overflow information is also logged. If an overflow occurs, then a warning, an error, or nothing occurs depending on how the Data Overflow parameter of Simulink's Simulation Parameters dialog box is configured.


 The Block Dialog Box Block Icon Labels