Using the link map – Echelon Neuron C User Manual

Page 221

Advertising
background image

Neuron C Programmer’s Guide

209

For example, if a program has two input network variables, and has a single task

executed when either variable is updated, it is more efficient to code it as shown
in the After example, below. Likewise, use of a single when clause with the

nv_update_occurs event referencing just an array name is more efficient than

using multiple when clauses, one for each element of an array.

Before (compiles to 6 bytes of code):

when (nv_update_occurs(var1))
when (nv_update_occurs(var2))
{
...
}

After (compiles to 3 bytes of code):

// Use "unqualified" event to cover all variables
when (nv_update_occurs)
{
...
}

However, if you need to use specific nv_update_occurs events without the use of

the unqualified event shown above, the following guidelines can be used.
Consider a program that declares two network variables nviA and nviB:

network input SNVT_switch nviA, nviB;

The following code fragments are all functionally equivalent, because they all
respond to incoming network variable updates for either of these two network

variables. The first of these implementations is the least efficient of the three,

and the last one (equivalent to the Before example above) is the most efficient of
the three:
Variant 1 (compiles to 15 bytes of code):

when (nv_update_occurs(nviA) || nv_update_occurs(nviB))
{
...
}

Variant 2 (compiles to 9 bytes of code):

when (nv_update_occurs(nviA..nviB))
{
...
}

Variant 3 (compiles to 6 bytes of code):

when (nv_update_occurs(nviA))
when (nv_update_occurs(nviB))
{
...
}

Using the Link Map

Compiling an application for various models of Neuron Chips and Smart

Transceivers generally results in different application footprints, because a

Advertising