Fixed-Point Blockset    

Signal Conversions

Consider the conversion of a real-world value from one Fixed-Point Blockset data type to another. Ideally, the values before and after the conversion are equal

where Vb is the input value and Va is the output value. To see how the conversion is implemented, the two ideal values are replaced by the general [Slope Bias] encoding scheme described in Scaling:

Solving for the output data type's stored integer value, Qa is obtained:

where Fs is the adjusted fractional slope and Bnet is the net bias. The offline conversions and online conversions and operations are discussed below.

Offline Conversions

Both Fs and Bnet are computed offline using round-to-nearest and saturation. Bnet is then stored using the output data type and Fs is stored using an automatically selected data type.

Online Conversions and Operations

The remaining conversions and operations are performed online by the fixed-point processor, and depend on the slopes and biases for the input and output data types. The conversions and operations are given by these steps:

  1. The initial value for Qa is given by the net bias, Bnet:
  1. The input integer value, Qb, is multiplied by the adjusted slope, Fs:
  1. The result of step 2 is converted to the modified output data type where the slope is one and bias is zero:
  1. This conversion includes any necessary bit shifting, rounding, or overflow handling.

  1. The summation operation is performed:
  1. This summation includes any necessary overflow handling.

Streamlining Simulations and Generated Code

Note that the maximum number of conversions and operations is performed when the slopes and biases of the input signal and output signal differ (are mismatched). If the scaling of these signals is identical (matched), the number of operations is reduced from the worst (most inefficient) case. For example, when an input has the same fractional slope and bias as the output, only step 3 is required:

Exclusive use of radix point-only scaling for both input signals and output signals is a common way to eliminate the occurrence of mismatched slopes and biases, and results in the most efficient simulations and generated code.


  Parameter Conversions Rules for Arithmetic Operations