Chapter 3
Ada Language Reference
3-16
ni.com
Ada Fixed-Point Arithmetic
This section describes the implementation of fixed-point arithmetic in
AutoCode/Ada. It is assumed that you are familiar with the Ada
programming language.
Note
The
SystemBuild User Guide
has a fixed-point arithmetic chapter that explains the
basics of fixed-point arithmetic and the use of fixed-point arithmetic in SystemBuild
models.
How to Generate Real-Time Code
Using AutoCode, you can generate Ada high-level language code. Refer to
the
Template Programming Language User Guide
or to Chapter 2,
Using
AutoCode
, of the
AutoCode User Guide
for additional information. To
generate code to run on your local host, you can generate code from one of
the following:
•
SystemBuild, which lets you automatically generate a real-time file
(
.rtf
) and then source code from a model, using a Graphical User
Interface. This is the recommended method of generating code to run
on your local host.
•
Xmath, which lets you automatically generate an
.rtf
file and then
source code from a model, using an Xmath command.
•
The operating system prompt, which lets you generate source code
from an already-existing
.rtf
file, using the
autostar
command
from the operating system prompt.
Fixed-Point AutoCode/Ada Architecture
This section describes the architecture of Fixed-Point AutoCode/Ada.
Consult an Ada language reference manual if you are not familiar with any
of the terms in this section. The basis for this architecture is the use of the
fixed-point type mechanism provided in Ada. This basis enables the use of
generic functions to implement the functionality of standard operations,
such as addition and subtraction. Overloaded operators are created as
instances of the generic functions for only those combinations of
fixed-point data types used in the model. The use of overloaded operators
maximizes code readability.