Xilinx V2.1 manual Precision, Number of Bits, Overflow and Quantization, Override with Doubles

Models: V2.1

1 148
Download 148 pages 48.7 Kb
Page 21
Image 21
Precision

Xilinx Blockset Overview

Precision

The fundamental computational mode in the Xilinx Blockset is arbitrary precision fixed point arithmetic. Most blocks give you the option of choosing the precision, i.e. the number of bits and binary point position.

By default, the output of Xilinx blocks is full precision; that is, sufficient precision to represent the result without error. Most blocks have a User-Definedprecision option that fixes the number of total and fractional bits.

Number of Bits

When you have specify user-defined precision, you will be asked to specify how many bits the output should have.

Binary Point

You will also be asked to specify how many bits are to the right of the binary point (i.e., the size of the fraction). The binary point position must be between zero and the number of bits in the number’s container.

Overflow and Quantization

When user-defined precision is selected, errors may result from overflow or quantization. Overflow occurs if a value lies outside the representable range. Quantization error occurs if the number of fractional bits is insufficient to represent the fractional portion of a value.

The Xilinx fixed point data type supports several options for user-defined precision. In the case of overflow, the options are to saturate to the largest positive (or smallest negative) value, wrap the value (i.e., discard any significant bits beyond the most- significant bit in the fixed point number), or flag an overflow as a Simulink error during simulation.

In the case of quantization, the options are to round to the nearest representable value or to the value farthest from zero if there are two equidistant nearest representable values, or to truncate the data (i.e., discard bits to the right of the least significant bit).

It is important to realize that whatever option is selected, the generated HDL model and Simulink model will behave identically.

Override with Doubles

An Override with Doubles message appears on many Xilinx Blocks, with some variations. Variations are:

Override Computation with Doubles

Override Constant with Double

Override Output with Doubles

Override Storage with Doubles

Most Simulink blocks use double precision floating point signals and arithmetic. However, when such a signal passes through Xilinx Gateway In block, it is converted to a fixed point signal. Later, when passing through a Xilinx Gateway Out block, the signals are converted back into double precision floating point.

Common Options in Block Parameters Dialog Box

21

Page 21
Image 21
Xilinx V2.1 manual Precision, Number of Bits, Overflow and Quantization, Override with Doubles, Binary Point