MATLAB: Does the overflow bit for FI objects not get added while using the TI C6000 hardware implementation in Simulink Fixed Point 6.2 (R2009b)

simulink fixed point

If I utilize the TI 6000 Hardware Implementation and do an addition of two fixed point number and set the addition block output type to be "inherit by internal rule", I expect the output type to account for the overflow bit or a least utilize 16-bits.
Why does this not work?
Please see the attached model for an example. If I change the Hardware Implementation to ASIC I do get the expected output.
In the example model attached, I am performing the addition of two fi(0,8,3) numbers and am setting the addition block output type to be "inherit by internal rule" .To account for the overflow bit, I expect the output data type to be fi(0,9,3) but it is not.

Best Answer

  • This way to manage overflow is the expected behavior in Simulink Fixed Point 6.2 (R2009b).
    The data type rule for selecting the Sum block output type tries to follow the C rules. It will select the input type with the greatest positive range for the output. In this case it will be uint8_En3.
    You cannot compare data type rules for ASIC/FPGA to CPU rules. These are different set of rules. They do share some common logic, but they are different rules, with different goals in mind.
    To work around the issue, in your model, if you change Output Data Type of the Sum block to be "inherit: same as accumulator”, you will see that the output data type becomes ufix32_En3 data type. Note that this feature is not available in older versions of MATLAB.
    The best approach to workaround this issue if you would not like to upgrade your MATLAB version would be to decide what you want the output to be, and set it explicitly.
    Also, note that if you are trying to build a model that will perform the same on both TI and ASIC, relying on internal rules in not recommended, and will yield different numerics on different platforms.