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.

yet another 28xx missing intrinsic: RPT NOP

I'd like to be able to call __rpt_nop(k) where k is a compile-time constant (either an enum, or a #define, or a constant value computed by at compile time e.g. 3*2+7), and have it translate to "RPT #k || NOP" in assembly.

Could you please add this to the intrinsic wishlist for the 28xx compiler?

I can't find a workaround; I don't think it's possible to convert a compile-time constant to a string value for use in inline assembly. >:(

So the only other alternative (besides automatically generated code) is to explicitly state asm("RPT #13 || NOP") or whatever in the code at each point of use. We use compile-time computed constants all the time and it's rather inconvenient not to be able to use it here for ultrashort delays.

  • You might be able to get by with the following:

    #define RPT_NOP0(n)  __asm(" RPT #(" #n ") || NOP")
    #define RPT_NOP(n)   RPT_NOP0(n)

    #define N 4
    #define N6 (6*N)
    #define K  (N6+3)

    RPT_NOP(5);     /* expands to "RPT #(5) || NOP"           and assembles to "RPT #5  || NOP" */
    RPT_NOP(N6);    /* expands to "RPT #((6*N)) || NOP"       and assembles to "RPT #24 || NOP" */
    RPT_NOP(K-1);   /* expands to "RPT #(((6*4)+3)-1) || NOP" and assembles to "RPT #26 || NOP" */

  • thanks -- that works if I have constants that are computable by the preprocessor. In my specific application, though, I have compile-time constants that are accessible only by the compiler, not the preprocessor.

  • Also the "RPT loc16" instruction isn't accessable via inline assembly, since there's no way to pass information between C and inline assembly. (Well, that's 99% true, the only workaround is to use global variables and pass data through fixed addresses.)

  • I added SDSCM00041697 to the SDOWP system to request this intrinsic.  Feel free to track it with the SDOWP link in my sig.

    Thanks and regards,

    -George