EmbeddedRelated.com
Forums

processor clock cycle per instructions

Started by faz December 4, 2007
Hai all,

Can u pls suggest the method or formula to calculate number of
processor clock cycles for each instructions ?It will be greatful to
knew this as i have referred the Intel data sheets which includes.I am
eager to knew how they r calculating it.

regards,
fazal
faz wrote:

> Hai all, > > Can u pls suggest the method or formula to calculate number of > processor clock cycles for each instructions ?It will be greatful to > knew this as i have referred the Intel data sheets which includes.I am > eager to knew how they r calculating it.
The first, and most important, step is to figure out what CPU you are using.
On Dec 4, 12:34 pm, Arlet Ottens <usene...@c-scape.nl> wrote:
> faz wrote: > > Hai all, > > > Can u pls suggest the method or formula to calculate number of > > processor clock cycles for each instructions ?It will be greatful to > > knew this as i have referred the Intel data sheets which includes.I am > > eager to knew how they r calculating it. > > The first, and most important, step is to figure out what CPU you are using.
My CPU clock frequency is 33Mhz,It has 16bit data and 20 bit address lines
Am Mon, 03 Dec 2007 21:18:36 -0800 schrieb faz:
> Can u pls suggest the method or formula to calculate number of > processor clock cycles for each instructions ?It will be greatful to > knew this as i have referred the Intel data sheets which includes.I am > eager to knew how they r calculating it.
They don't calculate it, they design the cpu accordingly. /Christof
On Dec 4, 12:39 pm, Christof Klaiber <christof.klai...@merath-
maschinen.de> wrote:
> Am Mon, 03 Dec 2007 21:18:36 -0800 schrieb faz: > > > Can u pls suggest the method or formula to calculate number of > > processor clock cycles for each instructions ?It will be greatful to > > knew this as i have referred the Intel data sheets which includes.I am > > eager to knew how they r calculating it. > > They don't calculate it, they design the cpu accordingly. > > /Christof
Suppose if i have the CPU deisgn then to verify clock cycles per instructions...I have to run the instruction am i right??I am thinking of some short cut method without running each instruction since it is my design i knew all the parameters...Is there any method available??
"faz" <fazulu.vlsi@gmail.com> wrote in message 
news:7cde5c3e-0208-4638-b608-1e7203774b8d@e23g2000prf.googlegroups.com...
> On Dec 4, 12:34 pm, Arlet Ottens <usene...@c-scape.nl> wrote: >> faz wrote: >> > Hai all, >> >> > Can u pls suggest the method or formula to calculate number of >> > processor clock cycles for each instructions ?It will be greatful to >> > knew this as i have referred the Intel data sheets which includes.I am >> > eager to knew how they r calculating it. >> >> The first, and most important, step is to figure out what CPU you are >> using. > > My CPU clock frequency is 33Mhz,It has 16bit data and 20 bit address > lines
And the name of the processor is...?
"faz" <fazulu.vlsi@gmail.com> wrote in message 
news:a36c2453-1a60-4451-b1e4-75cd4ef8b2c5@a39g2000pre.googlegroups.com...
> On Dec 4, 12:39 pm, Christof Klaiber <christof.klai...@merath- > maschinen.de> wrote: >> Am Mon, 03 Dec 2007 21:18:36 -0800 schrieb faz: >> >> > Can u pls suggest the method or formula to calculate number of >> > processor clock cycles for each instructions ?It will be greatful to >> > knew this as i have referred the Intel data sheets which includes.I am >> > eager to knew how they r calculating it. >> >> They don't calculate it, they design the cpu accordingly. >> >> /Christof > > Suppose if i have the CPU deisgn then to verify clock cycles per > instructions...I have to run the instruction am i right??I am thinking > of some short cut method without running each instruction since it is > my design i knew all the parameters...Is there any method available??
Cycle counts for instructions are usually included in the manual. RTFM early, RTFM often.
On Dec 4, 1:07 pm, faz <fazulu.v...@gmail.com> wrote:
> On Dec 4, 12:39 pm, Christof Klaiber <christof.klai...@merath- > > maschinen.de> wrote: > > Am Mon, 03 Dec 2007 21:18:36 -0800 schrieb faz: > > > > Can u pls suggest the method or formula to calculate number of > > > processor clock cycles for each instructions ?It will be greatful to > > > knew this as i have referred the Intel data sheets which includes.I am > > > eager to knew how they r calculating it. > > > They don't calculate it, they design the cpu accordingly. > > > /Christof > > Suppose if i have the CPU deisgn then to verify clock cycles per > instructions...I have to run the instruction am i right??I am thinking > of some short cut method without running each instruction since it is > my design i knew all the parameters...Is there any method available??
Aare you trying to calculate without running each(any) instruction ? Karthik Balaguru
If you have your own CPU-design, this is trivial if you know whare you
are doing...

The operating frequency and the word-width have nothing to do with the
value you are looking for. If you want to use this value to compare it
against other CPU-designs, then the compete facts are of course nice
to have.

The number of clock cycles per instructions depends on how you have
implemented your CPU and only you know that. If you are looking for an
average number just look into your design. I'll give you a hint on
what you are looking for.

You do NOT have to run the CPU to find out this value.

For a simple example: if your machine has 5 instructions: LOAD, STORE,
ADD, CMP, BNE
Each instruction can either be a single-cycle instructions or multi-
cycle instructions. If all your instructions are trivial and does not
use multiple memory accesses to external memory probably they can all
be single-cycle instructions. In this case the average "clock cycle/
instruction" will of course be 1.

For another example lets say we use the same machine as above but the
LOAD and STORE instructions does external memory access so they need
wait-states/delay-states and uses 5 clockcycles each the calculation
is:

LOAD => 5cc
STORE => 5cc
ADD => 1cc
CMP => 1cc
BNE => 1cc

To get the average "clock cycles/instruction" we first sum those and
then divide the sum with the number of instructions:

5+5+1+1+1 = 13

13/5 => 2.6 clockcycles/instruction is the value for this imaginary
CPU.

So just look into your RTL-code (verilog or VHDL) and calculate this
value by hand.

Another method you could use (more statistical) would be to instead
run a bigger "standard" program where you would get the average usge
for each instructions of your instruction set. Then calculate the same
type of average as above but taking into account how often each
instructions is used. This would give you a more correct value on
programs running.

Anyone elsem how does the tow methods above sound?

Best Regards
Magnus Wedmark

> Suppose if i have the CPU deisgn then to verify clock cycles per > instructions...I have to run the instruction am i right??I am thinking > of some short cut method without running each instruction since it is > my design i knew all the parameters...Is there any method available??
On Dec 4, 6:18 am, faz <fazulu.v...@gmail.com> wrote:
> Hai all, > > Can u pls suggest the method or formula to calculate number of > processor clock cycles for each instructions ?It will be greatful to > knew this as i have referred the Intel data sheets which includes.I am > eager to knew how they r calculating it. > > regards, > fazal
Hi Fazal, Each instruction cycle is made up of no. of machine cycles and each machine cycle is made of of processor clock cycles. So, to calculate no. of clock cycles for an instruction, first you need to know what kind of addressing the instruction is for e.g. you have immediate addressing, indirect addressing , implicit addressing and so on. And each addressing will take fixed no. of machine cycles. Hope it helps -Dk