This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not use a specified intruction

Hi all.
I'm using a modified 8051 cpu, and it don't have some instructions (in this case MUL). In Keil IDE, when I do some like: foo = bar << 1;
Compiler translate as: MUL AB
And it produce a reset of the software.
My question is very simple: how I do to indicate the compiler that not to use that instruction?
Thanks.

  • The full 8051 (complete with peripherials) was implemented with a minimum of transistors. It hurts to hear about a 8051 that doesn't even have a full core. I leave it to someone else to figure out if there even is support for that.

    Does the C51 compatibility list contain any other 8051 chip with MUL removed? If not, then there would be zero reason for Keil to include such a setting in their compiler. And if that's the case, then you would either have to settle for assembler programming, or download and modify SDCC or some other compiler that is available complete with source code.

  • I'm using a modified 8051 cpu, and it don't have some instructions
    the least, such a thingy should have would be a trap for unsupported instructions that would allow you to emulate them soft.

    Erik

  • My question is very simple: how I do to indicate the compiler that not to use that instruction?

    As far as I know, you cannot do this with C51.

    You can try to take an open-source compiler (SDCC) and modify it to suit your needs.

    http://sdcc.sf.net

  • in ancient times when embedded was done with a minicomputer (visualize a chip weighing 40 pounds) there was, at least, one brand where the "economy model" missed some instructions the "full model" had. In tbe "economy model" the unsupported instructions trapped to an ISR where you installed a piece of company provided software that emulated the missing instructions. I recall another case where we handled some atomicity issues by replacing a call with an invalid instruction, the trap disabled all interrupts for the time "the code called" processed.

    Erik

  • I'm using a modified 8051 cpu, and it don't have some instructions...how I do to indicate the compiler that not to use that instruction?

    you can't, an excellent example of "the law of unintended consequences"

    Erik

  • "I'm using a modified 8051 cpu, and it don't have some instructions (in this case MUL)"

    And you didn't think to consider, before choosing this CPU, what tools would be able to support that?

    Perhaps you should reconsider the decision - is the saving of a few instructions really worth the the pain that it causes...?

    "how I do to indicate the compiler that not to use that instruction?"

    You study the compiler manual very carefully to see if there is an option to support this derivative - or one that has the same (or sufficiently similar) limitations.

    You could contact Keil to see if they would be prepared to add support - though I think you'd need to make a very compelling case indeed.

    You could check other compilers.

    You could take an open-source compiler such as SDCC and modify it to your requirements.

    You just write in assembler.

  • More likely, an excellent example of a false economy!!

    And/or an illustration of, "premature optimisation is a root of all kinds of evil"

  • "premature optimisation is a root of all kinds of evil"
    I like that one

    maybe tha analogy is "give a man a log and he is warm for a day, set him on fire and he is warm for the rest of his life"

    Erik