beautypg.com

National Instruments AutoCode NI MATRIX User Manual

Page 44

background image

Chapter 2

C Language Reference

© National Instruments Corporation

2-27

AutoCode Reference

number—for each integer item and the sign are managed by the code
generator. Arithmetic expressions are scaled to emulate a fixed-point
capability, and all expressions involving the item are coded to be consistent
with the chosen radix position.

AutoCode supports a fixed-point library that implements all of the
fixed-point operations (algebraic, relational, conversion). There are
two different interfaces to the fixed-point library.

The default and most commonly used one is the macro interface where
the fixed-point operations are encoded as macros.

The other interface is the function interface where all the fixed-point
operations are implemented as functions. In this interface every
fixed-point operation can result in a function call.

Note

If you are using the function interface, compile the AutoCode-generated source file

using the compiler flag

FX_FUNC_INTERFACE

.

For example, if your platform is Solaris and you are using the fixed-point
function interface, the command line might appear as:

% acc -o gen_ap -DSOLARIS -DFX_FUNC_INTERFACE

gen_ap.c

sa_*.o -lm

where

gen_ap.c

represents any AutoCode generated source file.

Because fixed-point operations get inlined while using the macro interface,
an application linked with the macro interface will execute at a faster rate
than the same application linked with the function interface.

All the files needed for the macro interface library are present in the
directory

$CASE/ACC/macro_interface

while the files needed for

the function interface are present in the directory

$CASE/ACC/

function_interface

. By default, the system-specific source directory

(

src

) is a link to the

macro_interface

directory. By linking and working

in the directory

src

, the user gets to work with the macro interface. In order

to work with the function interface, the user must make the

src

directory a

link to the function interface. Files common to both directories are present
in both directories.

The supplied macros and functions are written in C. C neither allows
efficient coding of multiplication/division of 32-bit variables, nor does it
take advantage of processor-specific capabilities, such as trapping of
overflows, which can be detected in assembly code by checking the
processor’s status flag. However, you can write functions in assembly