Other Parts Discussed in Thread: C2000WARE
Dear Champs,
I am asking this for our customer.
The user used to use fixed-point code and want to migrate the fixed-point code onto our C2000 MCU.
We are aware that floating-point division is done by TMU and fixed-point division is done by FINTDIV.
From the app note "Fast Integer Division – A Differentiated Offering From C2000 Product Family"
https://www.ti.com/lit/an/spracn6/spracn6.pdf?ts=1622433172943
It takes 13-16 cycle for a traditional fixed-point division.
For TMU, it takes about 5 cycles for a floating-point division.
It appears floating-point division by TMU is faster than fixed-point division by FINTDIV.
Therefore,
The user wonders which one of below is faster for division?
Do you have any suggestion or preference or comment for the user when they consider implementation?
1) By fixed-point division and using FINTDIV only
Int a, b, c;
c = a/b;
2) By converting to floating-point division and using TMU.
Int a, b, c;
float a1, b1, c1;
a1 = (float)a;
b1 = (float)b;
c1 = a1/b1;
c = (int)(c1*scaling_value);
Wayne Huang