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.

Status register SXM, OVM and PM fields

How can I know the current value the compiler is setting for the SXM, OVM and PM bits of status register ?

The only infomation I found was on section 7.2.2 of spru514d.pdf. There it is written that the compiler modifies these fields, but it does not explain how or when.

Unfortunately, I do not feel comfortable to use signed/usigned types and mathematical equations in C without knowing the configuration of these bits.

Thanks,

Denise

  • DG44 said:
    Unfortunately, I do not feel comfortable to use signed/usigned types and mathematical equations in C without knowing the configuration of these bits.

    The compiler's job is to allow you to program at a higher level of abstraction precisely so you don't have to worry about details of the hardware such as status bits.  So, feel comfortable using standard features of C such as signed/unsigned types and all manner of math equations.  

    So, if you don't have to worry about it, why have these tables on the status bits in the book?  That is for those who write hand-coded assembly which interacts with C code.  This table tells you which status bits the compiler cares about, and whether your hand-coded assembly must preserve those bits.  Let's take the SXM bit as an example.  There is no presumed value, and it is modified by the compiler.  So, a hand coded assembly function does not have to preserve SXM.  But, a hand-coded assembly interrupt service routine does.

    Thanks and regards,

    -George

  • Hi George,

    I have being applying your advice for one year, but once in a while the result of some equation does not saturates as I would expect. Then I have to use the " asm (" SETC OVM");" to be sure I get the result I need.

    Am I doing something wrong on my C language programming "style" that the compiler does not recognize what it should set on the status register ?

    Thank you very much for your attention and Happy Holidays

    Denise

  • Rather than adding asm(" SETC OVM"), you should use saturate intrinsics instead.  Read about those intrinsics in the section titled Using Intrinsics to Access Assembly Language Statements in the C2000 compiler manual.

    Thanks and regards,

    -George

  • Using intrinsics is fine, but especially for saturated add as DG44 requests, there are no intrinsics available.

    There is a pending enhancement request (SDSCM00039491) for nearly 2 years now, but no update on this.

    See also this forum post:

    http://e2e.ti.com/support/development_tools/compiler/f/343/p/96844/338619.aspx#338619

    Regards, Stephan