How the Fixed-Point Tool Proposes Data Types
To use the Fixed-Point Tool to propose word lengths, you must specify the
fraction length requirements for data types in the model. Select the fraction lengths based on
the precision required for the system that you are modeling. If you do not specify fraction
lengths, the Fixed-Point Tool sets the Default fraction
length to 4
. The Fixed-Point Tool uses these
specified fraction lengths to recommend the minimum word length for objects in the selected
model or subsystem to avoid overflow for the collected range information.
The proposed word length is based on:
Design range information and range information that the Fixed-Point Tool collects. This collected range information can be either simulation range data, derived range data, or simulation with derived range data.
The signedness and fraction lengths of data types that you specify on blocks, signal objects.
The production hardware implementation settings specified in the Configuration Parameters.
How the Fixed-Point Tool Uses Range Information
The Fixed-Point Tool determines whether to use different types of range information based on its availability and on the Fixed-Point Tool setting.
Design range information always takes precedence over both simulation and derived range data. When there is no design range information, the Fixed-Point Tool uses either simulation or derived range data. If you specify a safety margin, the Fixed-Point Tool takes the safety margin into account.
For example, if a signal has a design range of [-10,10]
, the
Fixed-Point Tool uses this range for the proposal and ignores all simulation
and derived range information.
If the signal has no specified design information, but does have a simulation range of
[-8,8]
and a derived range of [-2,2]
, the proposal
uses the union of the ranges, [-8,8]
. If you specify a safety margin of
50%, the proposal uses a range of [-12, 12]
.
How the Fixed-Point Tool Uses Target Hardware Information
The Fixed-Point Tool calculates the ideal word length and then checks this length against the production hardware implementation settings for the target hardware.
If the target hardware is an FPGA/ASIC, then the Fixed-Point Tool proposes the ideal word length. If the ideal word length is greater than 65,535, then the Fixed-Point Tool proposes 65,535.
If the target hardware is an embedded processor, then the Fixed-Point Tool rounds the ideal word length up and proposes the nearest supported data type of your processor.
How to Get Proposals for Objects That Use an Inherited Output Data Type
Blocks can inherit data types from a variety of sources, including signals to which they are connected and particular block parameters. The following table lists the types of inheritance rules that a block might specify.
Inheritance Rule | Description |
---|---|
| Simulink® automatically determines the output data type of the block during data type propagation. In this case, the block uses the data type of a downstream block or signal object. |
| The block uses the data type of its sole input signal for its output signal. |
| The block uses the data type of its first input signal for its output signal. |
| The block uses the data type of its second input signal for its output signal. |
| The block uses an internal rule to determine its output data type. The internal rule chooses a data type that optimizes numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. It is not always possible for the software to optimize efficiency and numerical accuracy at the same time. |
To enable proposals for results that specify an inherited output data type, in the
Fixed-Point Tool, in the Convert section of the
toolstrip, under Settings, set the Convert inherited
types setting to Yes
.
For objects that specify an inherited output data type, the Fixed-Point Tool proposes a new data type based on collected ranges and the specified proposal settings.
When the Fixed-Point Tool Will Not Propose for Inherited Data Types
The Fixed-Point Tool proposes data types only for the Output data type parameter of a block or model object. It will not propose for other block data types, such as the Accumulator data type of a Sum block, or the Gain parameter in a Gain block.
The Fixed-Point Tool will also not propose for the following model objects if they use an inherited output data type.
Signal objects
Stateflow® charts
Bus objects
MATLAB® variables