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.

RND A Invalid instruction for specified processor version

Other Parts Discussed in Thread: TMS320VC5402

I am bringing in some old code for a TMS320VC5402 from CCS3.3 to CCS5.1. It all seems to be working accept the RND instruction (Round accumulator) is being flagged as a bad mnemonic. It is listed in the instruction set manual. The only setting I have in CCS5.1 for a processor is either "Generic C54xx" or "Custom C54xx" and neither works.

Anyone run into this?

Thanks,

Traver

  • The assembler will only accept the "RND" instruction for certain versions of C54x.  Use the command-line switch -v5440 to get the assembler to accept this instruction.

  • I did figure out how to get the compiler to accept the instruction. However, as I dug into this a bit more, all versions of the 5402 in the silicon errata have a bug in the RND instruction, which leads me to believe I should use the workaround they suggest.

    Thanks for the info.

  • Is there a document which explains the -v options (silicon versions) that are available in the compiler?

  • The TMS320C54x Optimizing C/C++ Compiler User's Guide http://www.ti.com/lit/pdf/spru103 is the only official documentation I know about.  It says:

    [-v value] determines the processor for which instructions are built. Use one of the following for value: 541, 542, 543, 545, 545lp, 546lp, 548, 549

    As far as the compiler is concerned, these are not very different.  I answered a very related question in an internal forum, but nothing ever came of it.  Below is what I said there; it all still seems to be true.   I know it does not list all possible C54x devices; the compiler doesn't know about them, and all possible C54x devices are just like one of the below choices, as far as the compiler is concerned.  I do not know C54x well enough to explain this any further; we'll need a C54x device expert to fill in the gaps.

    The problem is that I don't know the answer well enough to document anything about it. Internally, the compiler considers all devices to be aliases for one of (C54, C545LP, C548, C5440), mainly distinguished by instruction set. (The compiler works around a silicon bug on C5440.) The biggest difference is 548 vs. non-548, which means large-memory-model capable vs. not. The object files are marked one of (C54, C545LP, or C548). Here's my quick reading of what the compiler does:

    DeviceOptionInternallyObject fileAssembly pre-defined symbol
    ?? -v541 541 C54 .TMS320C541
    ?? -v541A 545 C545LP .TMS320C541A
    .TMS320C545LP
    ?? -v542 542 C54 .TMS320C542
    ?? -v543 543 C54 .TMS320C543
    ?? -v545LP 545 C545LP .TMS320C541A
    .TMS320C545LP
    ?? -v546LP 546 C545LP .TMS320C546LP
    ?? -v548 548 C548 .TMS320C548
    .TMS320C549
    ?? -v549 548 C548 .TMS320C548
    .TMS320C549
    TMS320C5440 -v5440 5440 C548 .TMS320C548
    .TMS320C549

    Note that there are some entries missing (-v545, -v546), and there is some weirdness with "a" and "lp" I haven't been able to figure out. The code also mentions some  devices which it doesn't accept as arguments to -v (5402, 5410).

    Regarding identifying an old C54x object file: Use ofd500 and look for TAG_ISA. It will be one of (C54, C545LP, C548). The default is C54. You can mix C54 and C548, the result is C548. You can mix C54 and C545LP, the result is C545LP. Use ofd500 and look for TAG_Memory_Model. It will be one of (extended, non-extended, or "don't care"). You can't mix extended(-mf) with non-extended.  You need to use a newer version [of ofd500], at least 4.2.0. If you don't have that version of ofd500, use ofd6x. You must run ofd on an unlinked object file, because the tags are not present in the executable file.

    Regarding the difference between C54 and C548: For what I need to use the compiler for, the only difference between C54x devices is that if I want to use large memory model (-mf), I have to use -v548. If you're not using large memory model, there is almost no difference between "C54" and "C548".

  • Thanks for the detailed answer. When I looked into the old CCS3.3 project (I actually re-installed CCS3.3 and loaded the project) I found the setting to be -v548.

    I rebuilt the CCS5 project from scratch because it wouldn't import correctly, and I left the -v setting blank. That caused the RND instruction not to be recognized. I thought the compiler was somehow aware of the RND bug in some processors and was not allowing the instruction to be used, but in reality, some 54x devices must not have a RND instruction and that is why the compiler showed an error. Although, looking at the C54x instruction set summary, they list a RND instruction, so I'm still not sure why a setting of -v541, for example, would cause the compiler would reject it.

    The bottom line is that I should use -v548 for a compatible instruction set for the 5402 memory model, but I should not use the RND instruction because it has a bug per the 5402 silicon errata. The fact that I became aware of the bug by the compiler rejecting the RND instruction was a matter of luck.

    Thanks,

    Traver