Fixed-Point Blockset | ![]() ![]() |
Set the data type and scaling of the propagated signal based on information from the reference signals
Library
Description
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 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:
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 and Scaling 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 Data Type and 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 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 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:
Parameters and Dialog Box
Inheriting Data Type Information
If the Propagated data type parameter is Inherit via propagation rule
, then these dialog box parameters are available to you.
The If any reference input is single, output is parameter list 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.
The Is-Signed parameter list 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.
The Number-of-bits: base parameter list specifies the number of bits used by Prop for the base data type. The parameter values are described below.
Refer to Targeting an Embedded Processor for more information about the base data type.
The Number-of-bits: Multiplicative adjustment parameter 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
.
The Number-of-bits: Additive adjustment parameter 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
.
The Number-of-bits: Allowable final values parameter 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.
The Slope: Base parameter list 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, PosRange1
and PosRange2
are one bit higher than the maximum positive range of the associated reference signal.
The Slope: Multiplicative adjustment parameter 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
.
The Slope: Additive adjustment parameter 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.
The Bias: Base parameter list specifies the bias used by Prop for the base data type. The parameter values are described below.
The Bias: Multiplicative adjustment parameter allows you to adjust the bias used by Prop by including a multiplicative adjustment.
The Bias: Additive adjustment parameter 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
.
If the Propagated scaling parameter is Obtain via best precision
, then the following dialog box parameters are available to you.
You specify any values, such as the upper and lower limits on the propagated input, for the Values used to determine best precision scaling, which constrains the precision chosen to apply to those limits. Based on the data type, the scaling will automatically be selected such that these values can be represent with no overflow error and minimum quantization error.
Characteristics
Input Ports |
Any data type supported by the blockset |
Direct Feedthrough |
Yes |
Scalar Expansion |
Yes |
![]() | Data Type Duplicate | Dead Zone | ![]() |