EmbeddedRelated.com
Forums
Memfault Beyond the Launch

performance calculation

Started by Johannes Findorf April 6, 2005
Johannes, 
yes, I have used this same source (along others). Maybe I made a mistake in
the math. I shall review the code soon.
Thanks for the reply.
-Augusto


-----Original Message-----
From: Johannes Findorf [mailto:johannes@joha...] 
Sent: Wednesday, April 06, 2005 11:22 AM
To: msp430@msp4...
Subject: +RE: [msp430] Re: performance calculation




This articel from Embedded.com gives a realy good intro to the
algoritm: http://www.embedded.com/showArticle.jhtml?articleID00722

There are also some sample code that I migth use to get an approximation on
the cycle use.

It also introduces an simplified algoritm that can be used when you dont
need to know anything about the phase of the signal.

.johannes


--- In msp430@msp4..., "augusto einsfeldt" <aee@t...> wrote:
> Johannes,
> Is there a simple Goertzel implementation using integers? I have 
> failed trying a translation using simple fixed point integer (in order 
> to
implement
> a faster solution for MSP).
> -Augusto
> 
> 
> -----Original Message-----
> From: Johannes Findorf [mailto:johannes@f...]
> Sent: Wednesday, April 06, 2005 10:40 AM
> To: msp430@msp4...
> Subject: [msp430] Re: performance calculation
> 
> 
> 
> 
> Thx Augusto, I will look at that feature when I have implemented my
filter,
> the problem is that I have skided that part till
next week. I just
need an
> approximation, shall I use 4MHz or shall I go up
to 8MHz (I think
that 4MHz
> is enough, but I dont want to be delayed by some
small preformance 
> problems). So still, any datasheet that tells how many cycles needed 
> to preforme ?
> 
> 
> .johannes
> 
> --- In msp430@msp4..., "augusto einsfeldt" <aee@t...>
wrote:
> > IAR's C-Spy debugger has a cycle counter (in the Register's
window).
> You can
> > use it in a simulation mode and, using break points, carefully run
> > your filter once, getting how many cycles were used from that
counter. 
> > Don't know if other tools have similar
feature.
> > 
> > -Augusto
> > 
> > 
> > -----Original Message-----
> > From: Johannes Findorf [mailto:johannes@f...]
> > Sent: Wednesday, April 06, 2005 10:16 AM
> > To: msp430@msp4...
> > Subject: [msp430] performance calculation
> > 
> > 
> > 
> > 
> > Hi
> > 
> > I have a filter (Goertzel algorithm) that I like to add to some
> samples from
> > my ADC. I'm trying to look into what clock freq my MSP need to be
> able to
> > preforme the filter before next set of samples arrive. Does someone
> have a
> > link to a resource where I can lookup how many cycles are needed for
> some
> > given operation.
> > 
> > The adc makes 80 samples each 10ms, the filter have about 4000
> operations.
> > 
> > Best regards.
> > 
> > Johannes Findorf
> > 
> > 
> > 
> > 
> > 
> > .
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> > 
> > 
> > --
> > Internal Virus Database is out-of-date.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.8.5 - Release Date: 29/3/2005
> 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
> --
> Internal Virus Database is out-of-date.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.8.5 - Release Date: 29/3/2005





.

 
Yahoo! Groups Links



 




-- 
Internal Virus Database is out-of-date.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.5 - Release Date: 29/3/2005
 


Beginning Microcontrollers with the MSP430

You're sick, you know that Al?

:) 


On Wednesday 06 April 2005 07:09 am, Onestone wrote:
> You can do the same thing in real code:-
>
> ROUTINE START:
>        CLR      &OVERFLOW
>        MOV   &TBR  ,&LOWCOUNT
>     ...
>     ...
> ROUTINE END:
>        MOV   &TBR,&HIGHCOUNT
>
> Simply enable Timer overflwo interrupts and increment a counter. Of
> course the real fun way is to sit and count cycles in code, remembering
> to accounbt for Constant generator use, emulated instructions etc etc.
>
> Al
>
> augusto einsfeldt wrote:
> >No, you can set a breakpoint in the end of your code, run it free and
> >subtract the total cycle counter from the value you had in the
beggining
> > of the code.
> >Of course you cannot have ISR handlings during the execution or your
end
> >counting will be different.
> >-Augusto
> >
> >
> >
> >
> >-----Original Message-----
> >From: Bruno Galli [mailto:bruno.galli@brun...]
> >Sent: Wednesday, April 06, 2005 10:40 AM
> >To: msp430@msp4...
> >Subject: Re: [msp430] performance calculation
> >
> >
> >
> >Augusto,
> >
> >am I missing something or it works only in single stepping mode?
> >
> >Cheers,
> >br1
> >
> >-----Messaggio Originale-----
> >Da: "augusto einsfeldt" <aee@aee@...>
> >A: <msp430@msp4...>
> >Data invio: mercoledi 6 aprile 2005 15.30
> >Oggetto: RE: [msp430] performance calculation
> >
> >>IAR's C-Spy debugger has a cycle counter (in the
Register's window).
> >>You
> >>can
> >>use it in a simulation mode and, using break points, carefully run
your
> >>filter once, getting how many cycles were used from that counter.
> >>Don't know if other tools have similar feature.
> >>
> >>-Augusto
> >
> >.
> >
> >
> >Yahoo! Groups Links
>
> .
>
>
> Yahoo! Groups Links
>
>
>

The sickest thing is that I've actually sat and done this, not once 
either! My oyster machine is quite a nasty beast. It will become 
simplified later. But first time out it had to work, so is a little over 
engineered! There are 4 sets of narrow beam high power IR emitters at 45 
degree to each other, opposite matched detectors. they sit about 20" 
apart behind heavy glass. 128 per set. because of crosstalk only 1 in 8 
emitters can be on at any time. Detectors require a certain period to 
saturate. I power up, scan and then read all 512 detectors in juts 
200useconds, giving me excellent rsolution, and anough data to build an 
accurate 3D model. because of crosstalk I can't easily read the bits in 
a nice tidy sequence, so I read 8 bits at a time from each set, 2 reads 
per set, each scan line,  because of the lack of RAM I must also sort 
the bits into their real world positions, eliminate 'shrapnel' from
the 
image, and quantize the 4 images to create a virtual 3d model; of the 
oyster. All of theis must happen in real time as the thing is scanning, 
so things like detector delays are achieved by sorting part of the last 
read, etc. This is incredibly convoluted. Since I also need to create a 
graphic of each of the 4 'images' I need to draw that in real time to.

To achieve this all in 200usecs, and allow 50 usecs for the positional 
servo motor controller as well means tight control of every processor 
cycle. that's why I can count them in my head, I don't need the book
any 
more!

yes, I'm truly one sick puppy, probably distemper.

Al

Micah Stevens wrote:

>You're sick, you know that Al?
>
>:) 
>
>
>On Wednesday 06 April 2005 07:09 am, Onestone wrote:
>  
>
>>You can do the same thing in real code:-
>>
>>ROUTINE START:
>>       CLR      &OVERFLOW
>>       MOV   &TBR  ,&LOWCOUNT
>>    ...
>>    ...
>>ROUTINE END:
>>       MOV   &TBR,&HIGHCOUNT
>>
>>Simply enable Timer overflwo interrupts and increment a counter. Of
>>course the real fun way is to sit and count cycles in code, remembering
>>to accounbt for Constant generator use, emulated instructions etc etc.
>>
>>Al
>>
>>augusto einsfeldt wrote:
>>    
>>
>>>No, you can set a breakpoint in the end of your code, run it free
and
>>>subtract the total cycle counter from the value you had in the
beggining
>>>of the code.
>>>Of course you cannot have ISR handlings during the execution or your
end
>>>counting will be different.
>>>-Augusto
>>>
>>>
>>>
>>>
>>>-----Original Message-----
>>>From: Bruno Galli [mailto:bruno.galli@brun...]
>>>Sent: Wednesday, April 06, 2005 10:40 AM
>>>To: msp430@msp4...
>>>Subject: Re: [msp430] performance calculation
>>>
>>>
>>>
>>>Augusto,
>>>
>>>am I missing something or it works only in single stepping mode?
>>>
>>>Cheers,
>>>br1
>>>
>>>-----Messaggio Originale-----
>>>Da: "augusto einsfeldt" <aee@aee@...>
>>>A: <msp430@msp4...>
>>>Data invio: mercoledi 6 aprile 2005 15.30
>>>Oggetto: RE: [msp430] performance calculation
>>>
>>>      
>>>
>>>>IAR's C-Spy debugger has a cycle counter (in the
Register's window).
>>>>You
>>>>can
>>>>use it in a simulation mode and, using break points, carefully
run your
>>>>filter once, getting how many cycles were used from that
counter.
>>>>Don't know if other tools have similar feature.
>>>>
>>>>-Augusto
>>>>        
>>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>      
>>>
>>.
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>    
>>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>
>  
>


Augusto,

I checked again and it doesn't works in run mode. Well, not in the
kickstart 
version of IAR.
SLAU138A, FET User's Guide, states at page A-11, FAQ #28: " The cycle 
counter is only active while single stepping. The count is reset when the 
device is reset, or the device is run (GO)."

Cheers,
br1

-----Messaggio Originale----- 
Da: "augusto einsfeldt" <aee@aee@...>
A: <msp430@msp4...>
Data invio: mercoledi 6 aprile 2005 16.02
Oggetto: RE: [msp430] performance calculation


>
> No, you can set a breakpoint in the end of your code, run it free and
> subtract the total cycle counter from the value you had in the beggining 
> of
> the code.
> Of course you cannot have ISR handlings during the execution or your end
> counting will be different.
> -Augusto
>
>
>
>
> -----Original Message-----
> From: Bruno Galli [mailto:bruno.galli@brun...]
> Sent: Wednesday, April 06, 2005 10:40 AM
> To: msp430@msp4...
> Subject: Re: [msp430] performance calculation
>
>
>
> Augusto,
>
> am I missing something or it works only in single stepping mode?
>
> Cheers,
> br1
>
> -----Messaggio Originale----- 
> Da: "augusto einsfeldt" <aee@aee@...>
> A: <msp430@msp4...>
> Data invio: mercoledi 6 aprile 2005 15.30
> Oggetto: RE: [msp430] performance calculation
>
>
>>
>> IAR's C-Spy debugger has a cycle counter (in the Register's
window).
>> You
>> can
>> use it in a simulation mode and, using break points, carefully run your
>> filter once, getting how many cycles were used from that counter.
>> Don't know if other tools have similar feature.
>>
>> -Augusto


The cycle count works in run mode, but only for the simulator. This is
true of all MSP430 development tools, AFAIK. The chip does not have an
internal cycle counter, so the only way to count cycles is either to
execute the instructions one by one through JTAG, or to simulate them
(or to count them in your head, if you live in Oz...)

Michel

--- In msp430@msp4..., "Bruno Galli" <bruno.galli@g...> wrote:
> Augusto,
> 
> I checked again and it doesn't works in run mode. Well, not in the
kickstart 
> version of IAR.
> SLAU138A, FET User's Guide, states at page A-11, FAQ #28: " The
cycle 
> counter is only active while single stepping. The
count is reset
when the 
> device is reset, or the device is run (GO)."
> 
> Cheers,
> br1
> 
> -----Messaggio Originale----- 
> Da: "augusto einsfeldt" <aee@t...>
> A: <msp430@msp4...>
> Data invio: mercoledi 6 aprile 2005 16.02
> Oggetto: RE: [msp430] performance calculation
> 
> 
> >
> > No, you can set a breakpoint in the end of your code, run it free
and
> > subtract the total cycle counter from the
value you had in the
beggining 
> > of
> > the code.
> > Of course you cannot have ISR handlings during the execution or
your end
> > counting will be different.
> > -Augusto
> >
> >
> >
> >
> > -----Original Message-----
> > From: Bruno Galli [mailto:bruno.galli@g...]
> > Sent: Wednesday, April 06, 2005 10:40 AM
> > To: msp430@msp4...
> > Subject: Re: [msp430] performance calculation
> >
> >
> >
> > Augusto,
> >
> > am I missing something or it works only in single stepping mode?
> >
> > Cheers,
> > br1
> >
> > -----Messaggio Originale----- 
> > Da: "augusto einsfeldt" <aee@t...>
> > A: <msp430@msp4...>
> > Data invio: mercoledi 6 aprile 2005 15.30
> > Oggetto: RE: [msp430] performance calculation
> >
> >
> >>
> >> IAR's C-Spy debugger has a cycle counter (in the
Register's
window).
> >> You
> >> can
> >> use it in a simulation mode and, using break points, carefully
run your
> >> filter once, getting how many cycles were
used from that counter.
> >> Don't know if other tools have similar feature.
> >>
> >> -Augusto




You're right.
I'm used to work with real micro so I never look at the simulator.
Thanks Michel.

Cheers,
br1

-----Messaggio Originale----- 
Da: "michelqv" <michel@mich...>
A: <msp430@msp4...>
Data invio: gioved7 aprile 2005 13.21
Oggetto: [msp430] Re: performance calculation


>
>
> The cycle count works in run mode, but only for the simulator. This is
> true of all MSP430 development tools, AFAIK. The chip does not have an
> internal cycle counter, so the only way to count cycles is either to
> execute the instructions one by one through JTAG, or to simulate them
> (or to count them in your head, if you live in Oz...)
>
> Michel


michelqv wrote:
> The cycle count works in run mode, but only for
the simulator. This is
> true of all MSP430 development tools, AFAIK. The chip does not have an
> internal cycle counter, so the only way to count cycles is either to
> execute the instructions one by one through JTAG, or to simulate them
> (or to count them in your head, if you live in Oz...)

Another trick is to toggle an output pin at the beginning and end of the 
code segment you're interested in and measure the pulse length with a
scope.

-- 
------------ Alex Holden - http://www.alexholden.net/ ------------
If it doesn't work, you're not hitting it with a big enough hammer

Bruno,
Yes and No.
You are right if you are using it in emulation mode (running in the device)
since emulation machine in the MSP has no cycle counter.
But if you are using it in the simulation mode you have cycle counter
allways, kickstart included.
Since the idea is to measure how long a routine takes using simulation is
the best and faster way (you don't need to implement special anciliary
routines or schemes to measure it in realtime - a thing impossible to do
when you are already using all resources in a device).
Other way to do this, in real life, is to set a port bit in the beggining of
the routine and clear that bit in the end. A regular osciloscope will give
the answer, not very accurate but the precision is fixed, no matter the
length of the routine.

When Al suggested a possible way doing this would be sitting in front of
source's listing and counting by hand it did remind me that long time ago I
used to programm a Z80 in hexadecimal by hand, doing all compilation by mind
in a way that at some point I could think only in opcodes, no more
mnemonics. It was funny, timming optimizations could be done while walking.
Cheers,
-Augusto



-----Original Message-----
From: Bruno Galli [mailto:bruno.galli@brun...] 
Sent: Thursday, April 07, 2005 5:11 AM
To: msp430@msp4...
Subject: Re: [msp430] performance calculation



Augusto,

I checked again and it doesn't works in run mode. Well, not in the
kickstart

version of IAR.
SLAU138A, FET User's Guide, states at page A-11, FAQ #28: " The cycle 
counter is only active while single stepping. The count is reset when the 
device is reset, or the device is run (GO)."

Cheers,
br1

-----Messaggio Originale----- 
Da: "augusto einsfeldt" <aee@aee@...>
A: <msp430@msp4...>
Data invio: mercoledi 6 aprile 2005 16.02
Oggetto: RE: [msp430] performance calculation


>
> No, you can set a breakpoint in the end of your code, run it free and 
> subtract the total cycle counter from the value you had in the 
> beggining of the code.
> Of course you cannot have ISR handlings during the execution or your end
> counting will be different.
> -Augusto
>
>
>
>
> -----Original Message-----
> From: Bruno Galli [mailto:bruno.galli@brun...]
> Sent: Wednesday, April 06, 2005 10:40 AM
> To: msp430@msp4...
> Subject: Re: [msp430] performance calculation
>
>
>
> Augusto,
>
> am I missing something or it works only in single stepping mode?
>
> Cheers,
> br1
>
> -----Messaggio Originale-----
> Da: "augusto einsfeldt" <aee@aee@...>
> A: <msp430@msp4...>
> Data invio: mercoledi 6 aprile 2005 15.30
> Oggetto: RE: [msp430] performance calculation
>
>
>>
>> IAR's C-Spy debugger has a cycle counter (in the Register's
window). 
>> You can
>> use it in a simulation mode and, using break points, carefully run your
>> filter once, getting how many cycles were used from that counter.
>> Don't know if other tools have similar feature.
>>
>> -Augusto



.

 
Yahoo! Groups Links



 




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 6/4/2005
 


augusto einsfeldt wrote:

>When Al suggested a possible way doing this would
be sitting in front of
>source's listing and counting by hand it did remind me that long time
ago I
>used to programm a Z80 in hexadecimal by hand, doing all compilation by mind
>in a way that at some point I could think only in opcodes, no more
>mnemonics. It was funny, timming optimizations could be done while walking.
>Cheers,
>-Augusto
>
>  
>
See, that's the only difference between us. You grew up and I
didn't! 
(Though I hated the Z80, I loved the 6502 and 6809).

Al


6800 was my first micro, just before Z80.
In fact I hated any kind of micro because I saw them as black boxes where
someone else did create his own instructions ans architecture - and I wanted
to make my own. So, for several years, while teenager, I did play around
designing and building my own CPUs with standard TTL chips or drawing them
and simulating by hand (no computers that time, and no money to buy CPUs).
It was funny to find that the very same scheme I was using to clock my
CPU's
sections (giving one clock per instruction) were being used by Morotola's
68000 few years later. Because lack of money my fastest CPU was a bit-slice
one (one bit at a time - in fact).
Great time there. 
Today I do still playing around now with FPGAs and soon (I hope) building my
own silicon.
So, no one here did grew up. If I do it I die.
-Augusto


-----Original Message-----
From: Onestone [mailto:onestone@ones...] 
Sent: Thursday, April 07, 2005 11:06 AM
To: msp430@msp4...
Subject: Re: [msp430] performance calculation



augusto einsfeldt wrote:

>When Al suggested a possible way doing this would
be sitting in front 
>of source's listing and counting by hand it did remind me that long 
>time ago I used to programm a Z80 in hexadecimal by hand, doing all 
>compilation by mind in a way that at some point I could think only in 
>opcodes, no more mnemonics. It was funny, timming optimizations could 
>be done while walking. Cheers, -Augusto
>
>  
>
See, that's the only difference between us. You grew up and I
didn't! 
(Though I hated the Z80, I loved the 6502 and 6809).

Al



.

 
Yahoo! Groups Links



 




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.4 - Release Date: 6/4/2005
 



Memfault Beyond the Launch