Take the 2-minute tour ×

I want to know what will be execution time for Flat (no loops, no jumps, no dynamic memory allocation) code running on processor with speed 16MHZ. Does it depends on code length. If P1 have N1 instructions and P2 with N2 instructions such that N2 > N1. Is Execution time of processor is in range of nano seconds.

share|improve this question
is this homework? –  Raoul May 26 '11 at 12:07
Rephrase your question and add more details. Not sure it can be answered in its current form, the answer would be so generic that it would be useless to you. Better to ask for links to material you can read up on. –  Tedd Hansen May 26 '11 at 12:08
add comment

1 Answer

The only thing you can really say about a 16MHz CPU is that the clock signal is flipping sixteen million times per second, and I'm not entirely sure of that! :-)

Execution time depends on so many variables:

  • number of instructions.
  • number of clock cycles for each of those instructions.
  • what sort of pipeline, if any.
  • whether instructions can be processed concurrently by multiple elements within the CPU.

and so on.

In other words, there's a huge number of factors to take into account other than the raw clockspeed.

For a very simple CPU with every instruction taking one clock cycle, no delays due to memory accesses or other I/O, no pipelining, no concurrent execution, and nothing else that will affect the one instruction per clock cycle nature, then yes, it depends just on the length of the code.

But I don't think I've seen CPUs that simple since the 8080/6502 days :-)

share|improve this answer
add comment

Your Answer


