Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Set data type and scaling of propagated signal based on information from reference signals

Signal Attributes

The 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 **Output
data type** parameter configured to ```
Inherit:
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. If the parameter list is configured as ```
Inherit via
propagation rule
```

, then you must use the parameters described
in Parameters.

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. If the parameter list is configured
as `Inherit via propagation rule`

, then you must
use the parameters described in Parameters.

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 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 vice versa.

The 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.

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.

The Data Type Propagation block accepts signals of the following data types:

Floating-point

Built-in integer

Fixed-point

Boolean

For more information, see Data Types Supported by Simulink.

**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.

**If any reference input is double, output is**Specify

`single`

or`double`

. This parameter makes it easier to create designs that are easily retargeted from fixed-point chips to floating-point chips or vice versa.This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.**If any reference input is single, output is**Specify

`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.This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.**Is-Signed**Specify the sign of Prop as one of the following values:

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.

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.This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.**Number-of-bits: Base**Specify the number of bits used by Prop for the base data type as one of the following values:

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.

For more information about the base data type, refer to Targeting an Embedded Processor (Fixed-Point Designer).

This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.**Number-of-bits: Multiplicative adjustment**Specify the number of bits used by Prop by including a multiplicative adjustment that uses a data type of

`double`

. 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`

.This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.**Number-of-bits: Additive adjustment**Specify the number of bits used by Prop by including an additive adjustment that uses a data type of

`double`

. For example, if you are performing multiple additions during a MAC operation, the result might overflow. To prevent overflow, you can associate guard bits with the propagated data type. To associate four guard bits, you specify the value`4`

.This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.**Number-of-bits: Allowable final values**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`

.This parameter is visible only when you set

**Propagated data type**to`Inherit via propagation rule`

.

**Propagated scaling**Use the parameter list to propagate the scaling via the dialog box, inherit the scaling from the reference signals, or calculate the scaling to obtain best precision.

**Propagated scaling (Slope or [Slope Bias])**Specify the scaling as either a slope or a slope and bias.

This parameter is visible only when you set

**Propagated scaling**to`Specify via dialog`

.**Values used to determine best precision scaling**Specify any values to be used to constrain the precision, such as the upper and lower limits on the propagated input. Based on the data type, the scaling will automatically be selected such that these values can be represented with no overflow error and minimum quantization error.

This parameter is visible only when you set

**Propagated scaling**to`Obtain via best precision`

.**Slope: Base**Specify the slope used by Prop for the base data type as one of the following values:

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.

You control the precision of Prop with

`Slope1`

and`Slope2`

, and you control the range of Prop with`PosRange1`

and`PosRange2`

. Additionally,`PosRange1`

and`PosRange2`

are one bit higher than the maximum positive range of the associated reference signal.This parameter is visible only when you set

**Propagated scaling**to`Inherit via propagation rule`

.**Slope: Multiplicative adjustment**Specify the slope used by Prop by including a multiplicative adjustment that uses a data type of

`double`

. For example, if you want 3 bits of additional precision (with a corresponding decrease in range), the multiplicative adjustment is`2^-3`

.This parameter is visible only when you set

**Propagated scaling**to`Inherit via propagation rule`

.**Slope: Additive adjustment**Specify the slope used by Prop by including an additive adjustment that uses a data type of

`double`

. 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.This parameter is visible only when you set

**Propagated scaling**to`Inherit via propagation rule`

.**Bias: Base**Specify the bias used by Prop for the base data type. The parameter values are described as follows:

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.

This parameter is visible only when you set

**Propagated scaling**to`Inherit via propagation rule`

.**Bias: Multiplicative adjustment**Specify the bias used by Prop by including a multiplicative adjustment that uses a data type of

`double`

.This parameter is visible only when you set

**Propagated scaling**to`Inherit via propagation rule`

.**Bias: Additive adjustment**Specify the bias used by Prop by including an additive adjustment that uses a data type of

`double`

.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`

.This parameter is visible only when you set

**Propagated scaling**to`Inherit via propagation rule`

.

Data Types | Double | Single | Boolean | Base Integer | Fixed-Point |

Direct Feedthrough | Yes |

Multidimensional Signals | Yes |

Variable-Size Signals | Ye |

Zero-Crossing Detection | No |

Code Generation | Yes |

Was this topic helpful?