Known ada compiler problems, Comparing results to systembuild’s simulator – National Instruments AutoCode NI MATRIX User Manual

Page 97

Advertising
background image

Chapter 3

Ada Language Reference

© National Instruments Corporation

3-35

AutoCode Reference

Known Ada Compiler Problems

The architecture of AutoCode/Ada Fixed-Point heavily relies upon
overloaded operators and generic function instantiation. For a large and
complex model, the number of overloads and instantiations might
overwhelm some older Ada compilers. Also, problems might occur when
compiling source code from many different models into the same Ada
Library. NI suggests that code from different models be compiled into
separate libraries.

Another problem area might be the declaration of unsigned fixed-point
types. The Ada’83 standard does not include unsigned data types. Newer
Ada compilers do support unsigned types as extensions to the language
definition. If your compiler fails to handle unsigned fixed-point types,
one solution is to avoid using unsigned fixed-point types in the model.
Or, upgrade to a newer Ada compiler.

Another problem might occur with a

pragma

directive. NI strongly

suggests that the overloaded operators and conversion functions be
specified with the inline directive. This eliminates function call overhead.
However, because those functions are instantiated from generics, older Ada
compilers might not work properly.

Comparing Results to SystemBuild’s Simulator

The SystemBuild Simulator can simulate a model with fixed-point types.
If you compare the stand-alone simulations from an Ada executable, the
results might not match. The following examples are possible reasons and
solutions for the problem:

Round and Truncation—By default, the SystemBuild Simulator
performs fixed-point data conversions using truncation as the rounding
mode. The Ada language always uses some type of rounding mode
other than truncation. SystemBuild includes a special default
parameter,

fixpt_round

, which when set to the value of 1, uses a

round to nearest, with midpoint rounded away from zero mode.

Different Rounding Modes at Midpoint—The Ada language
specifically states rounding mode is to nearest. However, the
specification does not specify rounding when at a midpoint. Table 3-1
shows the possible choices. SystemBuild uses a round to nearest and
away from zero at midpoint. Therefore, if your Ada compiler does not
round away from zero at midpoint, the results from the simulator and
the stand-alone simulation will differ. There is no workaround. The
new Ada standard, Ada’95 specifies round away from zero at
midpoint.

Advertising