Chapter 2 c language reference, Stand-alone simulation, Compiling on various supported platforms – National Instruments AutoCode NI MATRIX User Manual

Page 18: Stand-alone simulation -1, Compiling on various supported platforms -1, Er 2, C language reference

Advertising
background image

© National Instruments Corporation

2-1

AutoCode Reference

2

C Language Reference

This chapter discusses files used to interface AutoCode and the generated
C code to your specific platform and target processor. This chapter also
describes target-specific utilities needed for simulation and testing.

Stand-Alone Simulation

The template provided for C code generation produces code that, when
compiled and linked with stand-alone files, forms a stand-alone simulation.
This simulation can be executed with MATRIXx-style data as input, and
produces results that can be loaded back into Xmath for analysis. You must
compile the generated code along with the stand-alone library to produce
the simulation executable.

Chapter 2, Using AutoCode, of the AutoCode User Guide describes how to
compile the code and stand-alone library, generate sample input data, and
load the data into Xmath for analysis.

Compiling on Various Supported Platforms

The generated code usually includes platform-specific code. Most of this
code is not generated by AutoCode; rather, that code exists in the template.
Also, the stand-alone library has platform-specific code to deal with file I/O
and floating-point numerics. You must compile the generated code and the
stand-alone library with a defined preprocessor symbol appropriate for
your platform (refer to Table 2-1). For example, on the Solaris platform,
the compile statement is similar to:

% acc -DSOLARIS -o simulation simmodel.c sa_*.o -lm

Note

This example assumes the stand-alone library was compiled into separate object

files into the current working directory and that the stand-alone header files also exist in
the current working directory.

Advertising