Download Fixed-Point Blockset User's Guide

Transcript
4
Arithmetic Operations
Recommendations for Arithmetic and Scaling
This section describes the relationship between arithmetic operations and
fixed-point scaling, and some basic recommendations that may be appropriate
for your fixed-point design. For each arithmetic operation:
• The general slope/bias encoding scheme described in “Scaling” on page 3-5 is
used.
• The scaling of the result is automatically selected based on the scaling of the
two inputs. In other words, the scaling is inherited.
• Scaling choices are based on:
- Minimizing the number of arithmetic operations of the result.
- Maximizing the precision of the result.
Additionally, radix point-only scaling is presented as a special case of the
general encoding scheme.
In embedded systems, the scaling of variables at the hardware interface (the
ADC or DAC) is fixed. However for most other variables, the scaling is
something you can choose to give the best design. When scaling fixed-point
variables, it is important to remember that:
• Your scaling choices depend on the particular design you are simulating.
• There is no best scaling approach. All choices have associated advantages
and disadvantages. It is the goal of this section to expose these advantages
and disadvantages to you.
Addition
Consider the addition of two real-world values.
Va = Vb + Vc
These values are represented by the general slope/bias encoding scheme
described in “Scaling” on page 3-5.
Ei
Vi = Fi 2 Qi + Bi
In a fixed-point system, the addition of values results in finding the variable
Qa.
4-16