Echelon Neuron Uživatelský manuál Strana 47

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 237
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 46
more compact code; see PUSHS (Push Short) for a description of the PUSHS
instruction.
Note that the stacks and all data registers are 8 bits wide. Operations on larger
scalars typically require the combination of more than one instruction. Chapter
8, System-Provided Functions, describes system functions that can be used to
accomplish many common tasks, including arithmetic with 16-bit operands.
Designing a Neuron Assembly Function
A general approach to writing Neuron Assembly functions is to push arguments
for a called function onto the stack, call the function, push more arguments, call
another function, and so on, and then finally, after the last operation, clean up
the stack frame. This approach, however, can lead to suboptimal code and larger
than necessary stack frames. For more efficient Neuron assembly programming,
it often helps to look ahead into the remainder of the algorithm, and to get the
stack layout correct as soon as possible.
Optimized assembly functions can often consume stack arguments rather than
work with copies of the function arguments (which the caller would later dispose
of).
Note that different rules might apply when interfacing Neuron C functions; see
Chapter 4, Interfacing with a Neuron C Application, for more information.
One way to create a correct stack layout that is suited for postfix arithmetic is to
create a prefix formula, and then read that formula in reverse to generate a
postfix formula that is appropriate for creating the stack frames. This technique
generally applies to mathematical problems, but also applies to other types of
problems, and is often easier for programmers who not used to postfix notation.
Generate a prefix form of the algorithm, using function names for the operators.
For example, use “add(A,B)” for the more conventional infix form “(A + B)”.
Then, read the expression from right-to-left to generate the postfix form
“(B,A,add)”. From the postfix form, you can generate the necessary stack frames:
push A, push B, add.
Example:
For this extended example, assume that you need to write a function that
computes a circular area, given a radius R. That is, the function has the
following characteristics:
• Input: radius, R
• Output: area, πR
2
Assume that this function will be part of a mathematics library that you plan to
write in Neuron assembly language.
The first decision to make is whether the function will be called from Neuron C
applications or only from other Neuron assembly functions. For this example,
the function will be called from Neuron C applications.
If you name the function “carea”, its function prototype in C is:
// carea(radius) returns pi * radius^2
unsigned long carea(unsigned long radius);
The following tools are available to help you write this function:
Neuron Assembly Language Reference 37
Zobrazit stránku 46
1 2 ... 42 43 44 45 46 47 48 49 50 51 52 ... 236 237

Komentáře k této Příručce

Žádné komentáře

AEG LAVATHERM T37400 manuali

Manuali dei proprietari e guide per l'utente per Asciugatrici AEG LAVATHERM T37400.
We fornisce 1 manuali pdf AEG LAVATHERM T37400 per scaricare gratuitamente in base al tipo di documento: Manuale Utente






Più prodotti e manuali per Asciugatrici AEG

Modelli Tipo di Documento
T76485AH Manuale Utente   AEG T76485AH Benutzerhandbuch, 32 pagine
L16850A3 Manuale Utente   AEG L16850A3 Benutzerhandbuch, 52 pagine
T86585IH Manuale Utente   AEG T86585IH Benutzerhandbuch, 32 pagine
T76285AC Manuale Utente   AEG T76285AC Benutzerhandbuch, 60 pagine
T96685IH Manuale Utente   AEG T96685IH Benutzerhandbuch, 36 pagine
T76287AC Manuale Utente   AEG T76287AC Benutzerhandbuch, 24 pagine
LAVATHERM 57700 Manuale Utente   AEG LAVATHERM 57700 User Manual, 40 pagine
T75380AH3 Manuale Utente   AEG T75380AH3 Manual del usuario, 24 pagine
T76280AC Manuale Utente   AEG T76280AC Manual del usuario, 52 pagine
L69480FL Manuale Utente   AEG L69480FL Manual del usuario, 48 pagine
L69480VFL Manuale Utente   AEG L69480VFL Manual del usuario, 24 pagine
T76385AH3 Manuale Utente   AEG T76385AH3 Manual del usuario, 48 pagine
L61460TL Manuale Utente   AEG L61460TL Manual del usuario, 28 pagine
L75670WD Manuale Utente    AEG L75670WD User Manual, 76 pagine
T61270AC Manuale Utente   AEG T61270AC Manual del usuario, 48 pagine
L68276FL Manuale Utente   AEG L68276FL Manual del usuario, 48 pagine
T75280AC Manuale Utente   AEG T75280AC Manual del usuario, 48 pagine
T75380AH3 Manuale Utente   AEG T75380AH3 Manual del usuario, 48 pagine
L75480WD Manuale Utente   AEG L75480WD Manual del usuario, 68 pagine
T75380AH3 Manuale Utente   AEG T75380AH3 Manual del usuario, 44 pagine