Digital Signal Processing Reference
In-Depth Information
for (i=0; i < size; i++)
{
if (!fin.eof())
{
fin >> fp_value;
fx_value = fp_value;
cout << "double = " << fp_value"\t fixpt = " << fx_value << endl;
fout << fx_value << endl;
}
}
}
Table 3.6 shows the output of the program.
Table 3.6 Output of the program in the text
double ¼ 0.324612
fixpt ¼ 0.3242
double ¼ 0.243331
fixpt ¼ 0.2432
double ¼ 0.0892605
fixpt ¼ 0.0889
double ¼ 0.8
fixpt ¼ 0.7998
double ¼ 0.9
fixpt ¼ 0.9004
3.6 Floating-point to Fixed-point Conversion
Declaring all variables as single- or double-precision floating-point numbers is the most convenient
way of implementing any DSP algorithm, but from a digital design perspective the implementation
takes much more area and dissipates a lot more power than its equivalent fixed-point implementa-
tion. Although floating-point to fixed-point conversion is a difficult aspect of algorithmmapping on
architecture, to preserve area and power this option is widely chosen by designers.
For fixed-point implementation on a programmable digital signal processor, the code is converted
to a mix of standard data types consisting of 8-bit char, 16-bit short and 32-bit long. Hence, defining
the word lengths of different variables and intermediate values of all computations in the results,
which are not assigned to defined variables, is very simple. This is because inmost cases the option is
only to define them as char, short or long. In contrast, if designer's intention is to map the algorithm
on an application-specific processor then a run of optimization on these data types can further
improve the implementation. This optimization step tailors all variables to any arbitrary length
variables that just meet the specification and yields a design that is best from area, power and speed.
It is important to understand that a search for an optimal world length for all variables is an NP-
hard problem. An exhaustive exploration of world lengths for all variables may take hours for
a moderately complex design. Here, user experience with an insight into the design along with
industrial practices can be very handy. The system-level design tools are slowly incorporating
optimization to seamlessly evaluate a near-optimal solution for word lengths [12].
Conversion of a floating-point algorithm to fixed-point format requires the following steps [6].
S0 Serialize the floating-point code to separate each floating-point computation into an independent
statement assigned to a distinct variable var i .
S1 Insert range directives after each serial floating-point computation in the serialized code of S0 to
measure the range of values each distinct variable takes in a set of simulations.
Search WWH ::




Custom Search