DSP Builder for Intel® FPGAs (Advanced Blockset): Handbook

ID 683337
Date 5/27/2022

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents Output Data Types on Primitive Blocks

Set the output data type with Specify via dialog on any(except Convert) DSP Builder Primitive library block. For example you can use a zero-length sample delay. Specifying the output type with the dialog box is a casting operation. This operation does not preserve the numerical value, it just preserves the underlying bits, This operation never adds hardware to a block—it just changes the interpretation of the output bits. DSP Builder implements this reinterpretation by aligning the LSBs of the old and new data types. For example, if the new data type has fewer fractional bits than the old data type, the new numerical value is larger than the old numerical value.
Figure 23. SampleDelay Block with number of delays set to 0

For example, a Mult block with both input data types specified as sfix16_En15 naturally has an output type of sfix32_En30. The specified output data type has two fewer fractional bits than the natural input data type. Therefore, if you specify the output data type as sfix32_En28, the output numerical value is effectively multiplied by four, and a 1*1 input gives an output value of 4.

If you specify output data type of sfix32_En31, the output numerical value is effectively divided by two and a 1*1 input gives an output value of 0.5.

If you want to change the data type format in a way that preserves the numerical value, use a Convert block, which adds the corresponding hardware. Adding a Convert block directly after a Primitive library block allows you to specify the data type in a way that preserves the numerical value. For example, a Mult block followed by a Convert block, with input values 1*1 always gives output value 1.

To reinterpret the bit pattern and also discard bits, if the type you specify with the Output data type is smaller than the natural (inherited) output type, DSP Builder discards the MSBs (most significant bits).

Never set Specify via dialog to be bigger than the natural (inherited) bit pattern—DSP Builder performs no zero-padding or sign extension, and the result may generate hardware errors due to signal width mismatches. Use the Convert block for any sign extension or zero padding.

Figure 24. SampleDelay Block and Reducing Bit Width

If you want to use sign extends and zero pads to reinterpret the bit pattern, you can combine these methods.

To set a specific format so that DSP Builder can resolve types, for example, in feedback loops, set Specify via dialog on an existing Primitive library block or insert a zero-cycle sample delay (which generates no hardware and just casts the type interpretation).

To ensure the data type is equal to some other signal data type, force the data type propagation with a Simulink data type propagation block.