[Tinyos-devel] One should make limited use of the "%" operator
Eric Decker
cire831 at gmail.com
Thu Jun 25 13:05:26 PDT 2009
That would be good. I've noticed the problem.
I've also noticed that when there is an array of say message_t's that
referencing them calls libary routines because the message
buffer isn't a nice multiple of 2. What I've done is created an array of
ptrs to those buffers which get loaded at compile time so
they are static (and in code space).
On Thu, Jun 25, 2009 at 12:56 PM, Vlado Handziski <handzisk at tkn.tu-berlin.de
> wrote:
> I did not propose that we go and change all platform independent code, I
> just wanted to point to an important optimization for the msp430 platforms.
>
> Vlado
>
>
>
> On Thu, Jun 25, 2009 at 21:44, Philip Levis <pal at cs.stanford.edu> wrote:
>
>>
>> On Jun 25, 2009, at 12:06 PM, Eric Decker wrote:
>>
>>
>>>
>>> On Thu, Jun 25, 2009 at 11:54 AM, Philip Levis <pal at cs.stanford.edu>
>>> wrote:
>>>
>>> On Jun 25, 2009, at 11:42 AM, Vlado Handziski wrote:
>>>
>>> Speaking about optimization, and looking at your example snippet: For the
>>> msp430 platforms, it is always much more efficient to use word size array
>>> indices. The code is a lot simpler and some nasty gcc bugs can be avoided
>>> more easy.
>>>
>>> But this is platform independent code. The cost ratio of an inequality
>>> and jump compared to a hardware modulo is much less than a software modulo
>>> and an inequality and jump.
>>>
>>> Phil
>>>
>>> I'm not following the analysis because I'm not sure what is meant by
>>> hardware vs. software modulo. % on the MSP430 is implemented by a library
>>> routine that takes a significant number of instructions. Whereas the
>>> comparsion, jump, assignment take much fewer.
>>>
>>
>> By "software modulo" I mean "a library routine." By "hardware modulo" I
>> mean an ALU that computes modulo, e.g., as the iMote2 has. The point is that
>> making an iMote2 do a compare and jump is not a big overhead over a hardware
>> modulo, while making an msp430 (or other MCUs) do a software modulo is a big
>> overhead over a compare and jump. But starting to set the width of variables
>> in platform-independent code due to some particulars of a popular MCU's
>> compiler (as Vlado suggested) seems like a bad idea.
>>
>> Phil
>>
>
>
--
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20090625/36a46f12/attachment-0001.htm
More information about the Tinyos-devel
mailing list