This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: Time Optimized implementation for Sin and Cos functionality for C code generation

Part Number: TMS320F28379D


Tool/software:

I am trying to create 2 optimized function Sin and Cos in Simulink MBD environment so that it takes minimum amount of exeution time.

I can think of following solutions but I am not sure which one of these will be most efficient for embedded target controller. Any guidance will be appreciated.

  • Solution 1: Use 1D lookup table for both Sin and Cos
  • Solution 2: Use 1D lookup table for Sin and use cos formula 

  • Solution 3: Use 1D table for 0-90 degree and then use the quadrature symmetry formula for both sin and cos

  • Solution 4: Use tailor series approximation

  • From a device standpoint the TMU instruction set extension will be the fastest sin/cos. The TMU will be used if the call is a sin(float32) or cos(float32), the compiler switches have TMU is enabled and floating point relaxed mode enabled. So whichever block generates a simple 32-bit sin() or cos() call. and set the compiler switches appropriately.

  • Currently only option I have is to model the implementation in Simulink and pass it though model inspection and code inspection test and then generate c code, since I don't want the implementation to be processor family dependent since i am working on library creation, do you have any guidance how should i target this problem?

  • If you select approximation method as none then a sin or cos call is made. The C28x compiler will turn this into the appropriate TMU code as mentioned before. This is the fastest on a F2837x.