Release 11 New Features |
Fixed-Point Blockset 2.0
Release 11 contains two versions of the Fixed-Point Blockset: Version 1.2, which was included with Release 10 (MATLAB 5.2), and Version 2.0. The 2.0 blockset is located in/toolbox/fixpoint
and the 1.2 blockset is located in /toolbox/fixpoint/obsolete
.
The Fixed-Point Blockset 2.0 features are discussed below.
Fixed-Point Blocks
The Fixed-Point Blockset 2.0 includes a number of building blocks to assist you in designing and simulating dynamic systems using fixed-point arithmetic. The fixed-point blocks are grouped together as shown below.Arithmetic Blocks
Block Name
Description
FixPt Constant
Generate a constant value
FixPt Gain
Multiply the input by a constant
FixPt Matrix Gain
Multiply the input by a constant matrix
FixPt Product
Multiply or divide inputs
FixPt Sum
Add or subtract inputs
Conversion Blocks
Block Name
Description
FixPt Conversion
Convert from one Fixed-Point Blockset data type to another
FixPt Conversion Inherited
Convert input two to the data type of input one
FixPt Gateway In
Convert a Simulink data type to a Fixed-Point Blockset data type
FixPt Gateway Out
Convert a Fixed-Point Blockset data type to a Simulink data type
Look-Up Table Blocks
Block Name
Description
FixPt Look-Up Table
Approximate a one-dimensional function using a selected look-up method
FixPt Look-Up Table (2D)
Approximate a two-dimensional function using a selected look-up method
Logical and Comparison Blocks
Block Name
Description
FixPt Logical Operator
Perform the specified logical operation on the inputs
FixPt Relational Operator
Perform the specified relational operation on the inputs
FixPt Relay
Switch output between two constants
FixPt Saturation
Bound the range of the input
FixPt Switch
Switch output between input one or input three based on the value of input two
Discrete-Time Blocks
Block Name
Description
FixPt FIR
Implement a fixed-point finite impulse response (FIR) filter
FixPt Unit Delay
Delay a signal one sample period
FixPt Zero-Order Hold
Implement a zero-order hold of one sample period
Filters and Systems
The Fixed-Point Blockset 2.0 provides several useful fixed-point filter and system realizations. These realizations are intended to be used as design templates so you can easily see how to build filters and systems suited to your particular needs. The filters and systems are described below.Data Types
The Fixed-Point Blockset 2.0 supports several fixed-point and floating-point data types, which are collectively referred to as the "Fixed-Point Blockset data types." The supported data types and related features are described below.Fixed-Point Data Types
Floating-Point Data Types
A nonstandard IEEE-style data type is supported. For this data type, the fraction (mantissa) can range from 1 to 52 bits and the exponent can range from 1 to 11 bits.
Scaling
The Fixed-Point Blockset 2.0 supports two general scaling modes: radix point-only scaling and slope/bias scaling. Additionally, some blocks support scaling modes that maximize the precision for constant vectors or matrices. These scaling modes are described below.General Scaling Modes
Fixed-point numbers can be scaled in these ways:This is "powers-of-two" scaling since it only involves moving the radix point. Radix point-only scaling does not require the radix point to be contiguous with the data word. The advantage of this scaling mode is the number of processor arithmetic operations are minimized.
With this scaling mode, you can provide a slope and a bias. The advantage of slope/bias scaling is that it typically provides more efficient use of a finite number of bits.
Constant Scaling for Best Precision
In addition to the general scaling modes described above, the Fixed-Point Blockset provides you with block-specific scaling modes for constant vectors and constant matrices. These scaling modes are based on radix point-only scaling and are designed to maximize precision.With this mode, you have the option of scaling a constant vector such that the precision is maximized for each element, or a common radix point can be found based on the maximum precision for the largest value of the vector.
With this mode, you have the option of scaling a constant matrix such that the precision is maximized for each element, or a common radix point can be found based on the maximum precision for the largest value of each row, each column, or the whole matrix.
Automatic Scaling Tool
A script is provided that automatically changes the scaling for each block that has generalized fixed-point output and does not have its scaling locked. The script uses the maximum and minimum values logged during the last simulation run. The scaling is changed such that the simulation range is covered and the precision is maximized. As an alternative to (and extension of) the automatic scaling script, an automatic scaling GUI is provided. This interface allows you to easily control the parameters associated with automatic scaling and display the simulation results for a given model. With the automatic scaling GUI, you can:Locking the Output Scaling
If the output data type is a generalized fixed-point number, then you have the option of locking its scaling. When locked, the automatic scaling tool will not change the output scaling. Otherwise, the automatic scaling tool is free to adjust the scaling.Rounding
Fixed-point numbers can be rounded in these ways:This mode rounds toward zero and is equivalent to MATLAB's fix
command.
This mode rounds toward the nearest representable number, with the exact midpoint rounded toward positive infinity. Rounding toward nearest is equivalent to the MATLAB round
command.
This mode rounds toward positive infinity and is equivalent to MATLAB's ceil
command.
This mode rounds toward negative infinity and is equivalent to MATLAB's floor
command.
Overflow Handling
Operations on fixed-point numbers that produce an overflow condition can be dealt with in these ways:Overflows are set to either the maximum or minimum value represented by the word.
Overflows can be set to any value represented by the word.
Overriding with Doubles
The fixed-point data type can be overridden with doubles either globally or for individual blocks. This feature is useful when debugging a simulation.Specialized Storage Capabilities
The maximum and minimum values encountered during a simulation can be logged to the MATLAB workspace. These values can then be accessed by the automatic scaling tool.Standardization with Simulink
The fixed-point blocks are feature-compatible with standard Simulink blocks. Standardization with Simulink provides these expanded capabilities:Enhanced Model Construction
The Fixed-Point Blockset 2.0 makes it easier to construct models of systems due to these main blockset features:Updating Obsolete Fixed-Point Blocks
Obsolete fixed-point blocks from previous Fixed-Point Blockset releases can be updated to current fixed-point blocks using thefpupdate
command.
Code Generation
With the Real-Time Workshop, you can generate C code for execution on a fixed-point embedded processor. The generated code uses only integer types and automatically includes all operations, such as shifts, needed to account for differences in fixed-point locations. The code is structured so that key operations can be readily replaced by optimized target-specific libraries that you supply. You can also use the Target Language Compiler to customize the generated code. All fixed-point blocks support code generation, but not every simulation feature is supported. For example, 13-bit numbers can be used for simulation but not for code generation.Demos
The Fixed-Point Blockset 2.0 provides several demos that illustrate the main product features. You can access these demos via the fixed-point library's Demos block.Online Help
Each Fixed-Point Blockset block, system, and filter has online HTML-based help. The help is accessed through the dialog box Help button.