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.

CLA intrinsic __msetflg



To set/clear flags in the CLA status register MSTF, we can use something like this assembly

 MSETFLG RNDF32=1

but there is also a CLA intrinsic

__msetflg(unsigned short, unsigned short)

that we can call in C code according to spru514.  But the compiler guide doesn't really explain what the arguments signify.

I am unsure of the arguments to __msetflg and how to specify the RNDF32 flag of the MSTF register.

I thought maybe it was by bit position so __msetflg(9, 1) but that doesn't seem to work.

  • The MSETFLG instruction is documented in the CLA Reference Guide.  The intrinsic is modeled on that.  The bits in the MSTF register are laid out as follows:

    Flag name RNDF32 TF Reserved Reserved ZF NF LUF LVF
    Bit number 7 6 5 4 3 2 1 0

    (Sorry the table formatting is not so great.)

    The first argument is a bit mask which indicates which bits are modified.  The second argument says what value is assigned.  A 0 in a given bit position means 0 is assigned.  Similarly, a 1 in a given bit position means 1 is assigned.

    Here is an example ...

       __msetflg(0b11000100, 0b00000100);

    Note the 0b prefix means these are binary numbers.  This is a language extension borrowed from GCC which the TI compiler supports.  

    The first argument indicates the flags RNDF32, TF, and NF are modified.  The second argument means RNDF32=0, TF=0, NF=1.

    Thanks and regards,

    -George