Fixed-point data types, Generic functions, Instantiated functions – National Instruments AutoCode NI MATRIX User Manual

Page 79

Advertising
background image

Chapter 3

Ada Language Reference

© National Instruments Corporation

3-17

AutoCode Reference

Fixed-Point Data Types

Fixed-point type declarations exist in the file named:

sa_fxptypes_.a

and is provided in the System-Specific Files

src

(source) directory.

1

This file contains the specification of the

SA_FIXED

package. The package

specification contains all of the type declarations with the appropriate
delta and range for each type. Refer to the AutoCode Reference for more
information about the fixed-point type sizes, radix ranges and naming
conventions.

Note

Ada uses the term delta to describe the accuracy of a fixed-point type.

AutoCode/Ada uses the term radix to denote a type’s accuracy. The relationship between
the two is: delta = 2

radix

. Thus, a fixed-point type with a delta of 0.125 is a fixed-point type

with radix 3.

Generic Functions

Generic functions that implement functionality of standard operations
are found in the two files named:

sa_fxpgenerics_.a

and

sa_fxpgenerics.a

. These files provide the specification and body for

the

SA_FIXED_GENERICS

package. These files are also provided in the

System-Specific Files

src

directory. These generic functions are the basis

for the creation of the overloaded operators to perform the appropriate
arithmetic operation.

Instantiated Functions

Due to the large number of combinations of operations and fixed-point
types, only those operations that are used in the model are
instantiated—that is, only the instances of the functions that are required by
a model are actually created. Thus, an additional file is created by the code
generator when generating code for a model that uses fixed-point types.
This file is generated from the template. The default template generates one
additional file that contains a package specification containing all of the
instantiated functions for the model. The package name is

RT_FIXED_OPERATORS

and the file is named

fxp_

outputfile_.a

,

where

outputfile

is the name of the model or other name as specified in

a command option to AutoCode.

1

The file name convention uses an underscore before the extension to denote a file containing a package specification.
The

.a

extension is arbitrary as different platforms use different extensions, like

.ada

.

Advertising