Reply by Jim Granville December 4, 20072007-12-04
faz 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??
What are you actually trying to do ? If it is your design, then the short-cut is to simply look at your design notes, and it will, of course, be clearly detailed there :) Of course, if you designed a CPU, you WILL need to run each instruction, in order to confirm it DOES work as you hoped. I'm curious: How can you design a CPU, and NOT know the cycles per instruction ? =jg
Reply by Paul E. Bennett December 4, 20072007-12-04
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.
I have seen processors that figure from several instructions per cycle down to several cycles per instruction. The information is all in the data manual for the processor concerned. If you need to be accurate you have no short-cut to counting each type of instruction, multiplying by the cycles each takes and totallising for all instruction types. If you just want an approximate average then look at the mix of instructions you use and how long they take. Whilst not a very precise method it will get you a feel for the ballpark. -- ******************************************************************** Paul E. Bennett...............<email://Paul_E.Bennett@topmail.co.uk> Forth based HIDECS Consultancy Mob: +44 (0)7811-639972 Tel: +44 (0)1235-811095 Going Forth Safely ..... EBA. www.electric-boat-association.org.uk.. ********************************************************************
Reply by Tim Wescott December 4, 20072007-12-04
On Tue, 04 Dec 2007 00:07:27 -0800, faz 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 design 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 the one hand, the operations a CPU needs to undertake to execute an instruction are built in pretty early in the CPU design; this isn't some superficial thing like paint color. On the other hand, while in a non-pipelined CPU an instruction's execution time would be fixed by the operations, in pipelined CPUs a particular instruction's total time is not only longer than it's average cycle time, but both the total time and the 'average' cycle time are heavily dependent on the instructions that are executed before and after the instruction in question. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by CBFalconer December 4, 20072007-12-04
faz wrote:
> > 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.
I can. But u hasn't posted here for years. Read the chip specification. Study the spelling. Put blanks after punctuation. Look up the proper spelling for 'pls', 'r'. Learn not to confuse posts for no reason. -- Chuck F (cbfalconer at maineline dot net) <http://cbfalconer.home.att.net> Try the download section. -- Posted via a free Usenet account from http://www.teranews.com
Reply by dk December 4, 20072007-12-04
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
Reply by spartan3wiz December 4, 20072007-12-04
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??
Reply by karthikbalaguru December 4, 20072007-12-04
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
Reply by Deep Reset December 4, 20072007-12-04
"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.
Reply by Deep Reset December 4, 20072007-12-04
"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...?
Reply by faz December 4, 20072007-12-04
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??