FixPt Data Type Propagation

Configure the data type and scaling of the propagated signal based on information from the reference signals.

Description

The FixPt Data Type Propagation block allows you to control the data type and scaling of signals in your model. You can use this block in conjunction with fixed-point blocks that have their Specify data type and scaling parameter configured to Inherit via back propagation.

The block has three inputs: Ref1 and Ref2 are the reference inputs, while the Prop input back propagates the data type and scaling information gathered from the reference inputs. This information is then passed on to other fixed-point blocks.

The block provides you with many choices for propagating data type and scaling information. For example, you can:

  • Use the number of bits from the Ref1 reference signal, or use the number of bits from widest reference signal.

  • Use the range from the Ref2 reference signal, or use the range of the reference signal with the greatest range.

  • Use a bias of zero, regardless of the biases used by the reference signals.

  • Use the precision of the reference signal with the least precision.

You specify how data type information is propagated with the Propagated data type parameter list. If the parameter list is configured as Specify via dialog, then you manually specify the data type via the Propagated data type edit field. Refer to Selecting the Data Type to learn how to specify the data type. If the parameter list is configured as Inherit via propagation rule, then you must use the parameters described in Inheriting Data Type Information.

You specify how scaling information is propagated with the Propagated scaling parameter list. If the parameter list is configured as Specify via dialog, then you manually specify the scaling via the Propagated scaling edit field. Refer to Selecting the Scaling to learn how to specify the scaling. If the parameter list is configured as Inherit via propagation rule, then you must use the parameters described in Inheriting Scaling Information.

Remarks

After you use the information from the reference signals, you can apply a second level of adjustments to the data type and scaling by using individual multiplicative and additive adjustments. This flexibility has a variety of uses. For example, if you are targeting a DSP, then you can configure the block so that the number of bits associated with a MAC (multiply and accumulate) operation is twice as wide as the input signal, and has a certain number of guard bits added to it.

The FixPt Data Type Propagation block also provides a mechanism to force the computed number of bits to a useful value. For example, if you are targeting a 16-bit micro, then the target C compiler is likely to support sizes of only 8 bits, 16 bits, and 32 bits. The block will force these three choices to be used. For example, suppose the block computes a data type size of 24 bits. Since 24 bits is not directly usable by the target chip, the signal is forced up to 32 bits, which is natively supported.
There is also a method for dealing with floating-point reference signals. This makes it easier to create designs that are easily retargeted from fixed-point chips to floating-point chips or visa versa.

The FixPt Data Type Propagation block allows you to set up libraries of useful subsystems that will be properly configured based on the connected signals. Without this data type propagation process, a subsystem that you use from a library will almost certainly not work as desired with most integer or fixed-point signals, and manual intervention to configure the data type and scaling would be required. This block can eliminate the manual intervention in many situations.

Precedence Rules

The precedence of the dialog box parameters decreases from top to bottom. Additionally:

  • Double-precision reference inputs have precedence over all other data types.

  • Single-precision reference inputs have precedence over integer and fixed-point data types.

  • Multiplicative adjustments are carried out before additive adjustments.

  • The number of bits is determined before the precision or positive range is inherited from the reference inputs.

Parameters and Dialog Box

 

  • Propagated data type - Use the parameter list to propagate the data type via the dialog box, or inherit the data type from the reference signals. Use the edit field to specify the data type via the dialog box.

  • Propagated scaling - Use the parameter list to propagate the scaling via the dialog box, or inherit the scaling from the reference signals. Use the edit field to specify the scaling via the dialog box.

  • Override data type(s) with doubles - If checked, the data type is overridden with doubles.

Inheriting Data Type Information

If the Propagated data type parameter is Inherit via propagation rule, then these dialog box parameters are available to you.

  • If any reference input is single output is - Can be single or double. This parameter makes it easier to create designs that are easily retargeted from fixed-point chips to floating-point chips or visa versa.

  • Is-Signed - Specifies the sign of Prop. The parameter values are described below. For example, if the Ref1 signal is ufix(16), the Ref2 signal is sfix(16), and the Is-Signed parameter is IsSigned1 or IsSigned2, then Prop is forced to be a signed data type.

Parameter Value

Description

IsSigned1

Prop is a signed data type if Ref1 is a signed data type.

IsSigned2

Prop is a signed data type if Ref2 is a signed data type.

IsSigned1 or IsSigned2

Prop is a signed data type if either Ref1 or Ref2 are signed data types.

TRUE

Ref1 and Ref2 are ignored, and Prop is always a signed data type.

FALSE

Ref1 and Ref2 are ignored, and Prop is always an unsigned data type.

  • Number of bits: base - Specifies the number of bits used by Prop for the base data type. The parameter values are described below.

Parameter Value

Description

NumBits1

The number of bits for Prop is given by the number of bits for Ref1.

NumBits2

The number of bits for Prop is given by the number of bits for Ref2.

max([NumBits1 NumBits2])

The number of bits for Prop is given by the reference signal with largest number of bits.

min([NumBits1 NumBits2])

The number of bits for Prop is given by the reference signal with smallest number of bits.

NumBits1+NumBits2

The number of bits for Prop is given by the sum of the reference signal bits.

  • Number of bits: Multiplicative adjustment - Allows you to adjust the number of bits used by Prop by including a multiplicative adjustment. For example, suppose you want to guarantee that the number of bits associated with a multiply and accumulate (MAC) operation is twice as wide as the input signal. To do this, you configure this parameter to the value 2.

  • Number of bits: Additive adjustment - Allows you to adjust the number of bits used by Prop by including an additive adjustment. For example, if you are performing multiple additions during a MAC operation, the result may overflow. To prevent overflow, you can associate guard bits with the propagated data type. To associate four guard bits, you specify the value 4.

  • Number of bits: Allowable final values - Allows you to force the computed number of bits used by Prop to a useful value. For example, if you are targeting a processor that supports only 8, 16, and 32 bits, then you configure this parameter to [8,16,32]. The block always propagates the smallest specified value that fits. If you want to allow all fixed-point data types, you would specify the value 1:128.

Inheriting Scaling Information

If the Propagated scaling parameter is Inherit via propagation rule, then these dialog box parameters are available to you.

  • Slope: Base - Specifies the slope used by Prop for the base data type. The parameter values are described below. You control the precision of Prop with Slope1 and Slope2, and you control the range of Prop with PosRange1 and PosRange2. Additionally, PosRang1 and PosRange2 are one bit higher than the maximum positive range of the associated reference signal.

Parameter Value

Description

Slope1

The slope of Prop is given by the slope of Ref1.

Slope2

The slope of Prop is given by the slope of Ref2.

max([Slope1 Slope2])

The slope of Prop is given by the maximum slope of the reference signals.

min([Slope1 Slope2])

The slope of Prop is given by the minimum slope of the reference signals.

Slope1*Slope2

The slope of Prop is given by the product of the reference signal slopes.

Slope1/Slope2

The slope of Prop is given by the ratio of the Ref1 slope to the Ref2 slope.

PosRange1

The range of Prop is given by the range of Ref1.

PosRange2

The range of Prop is given by the range of Ref2.

max([PosRange1 PosRange2])

The range of Prop is given by the maximum range of the reference signals.

min([PosRange1 PosRange2])

The range of Prop is given by the minimum range of the reference signals.

PosRange1*PosRange2

The range of Prop is given by the product of the reference signal ranges.

PosRange1/PosRange2

The range of Prop is given by the ratio of the Ref1 range to the Ref2 range.

  • Slope: Multiplicative adjustment - Allows you to adjust the slope used by Prop by including a multiplicative adjustment. For example, if you want 3 bits of additional precision (with a corresponding decrease in range), the multiplicative adjustment is 2^-3.

  • Slope: Additive adjustment - Allows you to adjust the slope used by Prop by including an additive adjustment. An additive slope adjustment is often not needed. The most likely use is to set the multiplicative adjustment to 0, and set the additive adjustment to force the final slope to a specified value.

  • Bias: Base - Specifies the bias used by Prop for the base data type. The parameter values are described below.

Parameter Value

Description

Bias1

The bias of Prop is given by the bias of Ref1.

Bias2

The bias of Prop is given by the bias of Ref2.

max([Bias1 Bias2])

The bias of Prop is given by the maximum bias of the reference signals.

min([Bias1 Bias2])

The bias of Prop is given by the minimum bias of the reference signals.

Bias1*Bias2

The bias of Prop is given by the product of the reference signal biases.

Bias1/Bias2

The bias of Prop is given by the ratio of the Ref1 bias to the Ref2 bias.

Bias1+Bias2

The bias of Prop is given by the sum of the reference biases.

Bias1-Bias2

The bias of Prop is given by the difference of the reference biases.

  • Bias: Multiplicative adjustment - Allows you to adjust the bias used by Prop by including a multiplicative adjustment.

  • Bias: Additive adjustment - Allows you to adjust the bias used by Prop by including an additive adjustment. If you want to guarantee that the bias associated with Prop is zero, you should configure both the multiplicative adjustment and the additive adjustment to 0.

Characteristics

Input Ports

Any data type supported by the blockset

Direct Feedthrough

Yes

Sample Time

Inherited

Scalar Expansion

Yes 

States

0

Â