Automotive Math library function execution time

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automotive Math library function execution time

678 Views
pratibhasurabhi
Contributor V

Dear Team,

I want to know the execution time of math library function(MUL,Div etc.) as compare to normal multiplication, division operation. Is the MLIB library execution time is less than normal math operation?

I have observed that MLIB_Div function takes more execution time than normal division. Is it correct?

I want to know that what are the advantages if I use the library function(MUL,Div) instead of normal operation.

Thank You in advance.

 

0 Kudos
1 Reply

657 Views
petrz_
NXP Employee
NXP Employee

Hi Pratibhasurabhi,

AMMCLib fixed-point functions calculate in saturated fractional arithmetic whereas the standard C language multiplications and divisions are calculated in integer modulo arithmetic. The result of an integer multiplication can overflow which causes loss of the most significant bits. On the other hand, the fractional multiplication loses only the least significant bits of the result (i.e. rounding error) and the additional saturation operation ensures that the result never overflows. While modulo arithmetic may be faster, it is not really usable in motor control and DSP applications because overflows can cause catastrophic failure leading to a possible physical damage or safety risk. Such risk can be eliminated by using the saturated fractional arithmetic instead. MLIB functions are highly optimized and take full advantage of the capabilities of the core (e.g. hardware QMULS instruction).