- Double-click ColorSpace_Conversion_Expression.slx in the Current Folder to open the design.
- 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
FDataTypethat you can easily change from the MATLAB command prompt.
- 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.
- 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
>> 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.
- Simulate the model and observe the results from the design. Try further
FDataTypevariables 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.
Model Composer supports Data Type Expressions that make it easier to change data types and quickly explore the results from your design.