Convert Data Types (Alternative) - 2020.2 English

Vivado Design Suite Tutorial: Model-Based DSP Design using Add-on for MATLAB and Simulink (UG1498)

Document ID
UG1498
Release Date
2021-01-22
Version
2020.2 English
Model Composer supports Data Type Expressions that make it easier to change data types and quickly explore the results from your design.
  1. Double-click ColorSpace_Conversion_Expression.slx in the Current Folder to open the design.
  2. Notice that the Data Type Conversion blocks at the Input of the RGB to YCbCr Subsystem, the Gain blocks and Constant blocks within the Subsystem have Output data type and Gain data type set to data type expression.

    This enables HLS blocks to control the data types in the design using workspace variables, in this case InputDataType and FDataType that you can easily change from the MATLAB command prompt.

  3. Update the model (Ctrl+D) and observe the fixed-point data types propagated through the blocks.

    The other HLS blocks in the design will automatically take care of the bit-growth in the design. If you want more control over the fixed point data types at other intermediate portions of the design, you can insert Data Type Conversion blocks wherever necessary.

  4. To change the fixed point types in the Gain, Constant, and DTC blocks, and Input data type in DTC blocks, type the following at the MATLAB command prompt:
    >> FDataType = 'x_sfix8_En6'
    >> InputDataType = 'x_ufix8_En6'
    

    'x_sfix8_En6' represents a signed fixed point number with Word Length 8 and Fractional Length 6.

    Now update the model (Ctrl+D) and observe how the fixed-point data types have changed in the design.

  5. Simulate the model and observe the results from the design. Try further changing InputDataType and FDataType variables through command line and iterate through multiple word lengths and fractional lengths. See the Additional Details section below for information on specifying rounding and overflow modes.