[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How to calculate loops?

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] How to calculate loops?
Date: Fri, 6 Aug 2004 09:45:17 +0200 (MET DST)

Laszlo <address@hidden> wrote:

> If (and I'm speculating here) _delay_loop_1() takes a 8 bit
> parameter and simply counts down clock ticks, you would be looking
> at a loop of about 3 clock cycles per count:

That's exactly the case.

Likewise, _delay_loop_2 takes a 16-bit count, and executes 4 cycles
per counter value.

> If _delay_loop_1() is actually a subroutine (rather than a macro),
> add to that about another 7 cycles for the RCALL/RET.

It's an inlined function, so no CALL/RET overhead.  There's a minor
overhead for initializing the loop counter though.  It's not part of
the inline asm code itself but done by GCC prior to executing the
loop, so it's arguable whether you'd count that to the loop execution
time or not. :-)

J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]