1
\$\begingroup\$

I want to calculate MIPs of a function on a microcontroller. Here is how I do it.
1. keil setting. Use Simulator and Xtal = 25MHz enter image description here

enter image description here

  1. Run simulator in debug mode.
    enter image description here As you can see, it takes 200ms to run fun() once.
    200ms(0.2s) * 25MHz = 5M. Does it mean that running fun() takes 5MIPs?
    One thing to note that the MIPs of fun() is independent of platform or crystal's oscillation frequency.
    Thank you.
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Where is the code to review? Please stick to the topic of this forum/choose the right forum. \$\endgroup\$
    – greybeard
    Commented Oct 26, 2017 at 10:44

1 Answer 1

1
\$\begingroup\$

As you may know, MIPS means Mega Instructions Per Second. So the formula would be

CHIP_MIPS = number_of_mega_instructions / number_of_seconds.

If your chip is running at 25 MHz, it means that it performs 25 mega instructions per seconds, so knowing the number of seconds and the CHIP_MIPS, the formula would be

number_of_seconds * CHIP_MIPS = number_of_mega_instructions

So fun needs 5 Mega Intructions

\$\endgroup\$
4
  • 1
    \$\begingroup\$ After reading this and your answer, I think you are correct. fun needs 5 Mega Instructions not 5 MIPs. \$\endgroup\$ Commented Oct 26, 2017 at 9:47
  • \$\begingroup\$ That right, sometimes even I say (improperly) I use 5 MIPS on my 25 budget, but it's not correct... and thanks for the link :-) \$\endgroup\$
    – Bebs
    Commented Oct 26, 2017 at 9:51
  • \$\begingroup\$ The question is blatantly off-topic: Please don't answer off-topic questions. \$\endgroup\$
    – greybeard
    Commented Oct 26, 2017 at 10:42
  • \$\begingroup\$ Sorry @greybeard, it was my first answering attempt. I though questions about good practices were on-topic. I'll be more careful next time. \$\endgroup\$
    – Bebs
    Commented Oct 26, 2017 at 10:50

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.