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.

Configuring Status Register 0 (ST0) on TMS320F28335

Dear Experts,

In my project, I want to set the OVM bit of Status Register 0 (ST0) of the 28335 device to ensure that saturation occurs on overflow. However, I am unable to find this register in the 28335 header files that are part of my project.

Any assistance in helping find this will be much appreciated.

Thanks,

Sira

  • Hi Sira,I think you can accomplish this in C by using asm(" SETC OVM");
    That being said, I am not sure if this is very safe thing to do. This may cause unintended side affects, as the C compiler may assume that the HW is operating one way, while it actually operates differently.
  • Hi Devin,
    Thank you for the quick reply. I have a follow-up question. Are you saying setting the OVM to 1 is not safe. If yes, why is this so? It is a well-defined setting for what the ACC should do if an overflow occurs. By default, the OVM appears to be 0. The reason I want to set it to 1 in my code is because I have division operations, but no exception handling for conditions such as division by 0. My thinking was setting the OVM to 1 would help by saturating on overflow e.g. if a divide by 0 occurs.

    Thanks,
    Sira
  • Hi Sira,

    The C compiler may not consistently use the ACC in a way that guarantees saturation of high level C operations. See these posts for some idea of how this can occur:

    e2e.ti.com/.../245988
    e2e.ti.com/.../338619
  • Hi Devin,

    Thank you, this is very helpful. A few more questions and comments, just to make sure I have everything down right:

    1. It appears that if Optimization is enabled in the project, all bets are off as to whether the compiler will properly use the OVM setting to saturate on overflows in the ACC. If Optimization is Disabled, it should work properly. Correct?

    2. The above would probably hold true regardless of the specific mathematical operation e.g. add, sub, divide. Correct?

    My plan is to place this setting (asm(" SETC OVM");) in main(), in the initialization code, and my division operations etc. occur much later. My project also has optimization disabled.

    Thanks,

    Sira