Fixed-Point Blockset
  Go to block: 
    Search    Help Desk 

Block Reference


The Block Dialog Box
Fixed-Point Blockset blocks are configured with a parameter dialog box. The parameter dialog box provides you with:

Simulink stores the strings entered in these fields and passes them to MATLAB for evaluation when a simulation is started. If MATLAB variables are used, the simulation uses the values that exist in the workspace at the start of the simulation. These variables are not necessarily the same as when the variables are entered into the dialog box fields. If a simulation is running when a parameter is changed, MATLAB evaluates the parameter as soon as the OK or Apply button is pressed.

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:

Each of these features is described below.

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.
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(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:

Default scaling is used for all other fixed-point data types.

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.
Table 9-2: Rounding Modes 
Rounding Mode Description
zero Round the result towards zero
nearest Round the result towards the nearest representable number (the exact midpoint is rounded towards positive infinity)
ceiling Round the result towards positive infinity
floor Round the result towards negative infinity

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.
Table 9-3: Icon Display Information 
FixDispPref Value Explanation
0 Display no information
1 Display data type, radix, fractional slope, and bias information
2 Display data type and slope/bias information
3 Display data type, and maximum and minimum scaled values

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

If FixDispPref = 2, then the data type information is displayed as If FixDispPref = 3, then the data type information is displayed as

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. 


[ Help Desk | Next ]