Digital Signal Processing Reference
In-Depth Information
Statistics:
VarName
Mean StdDev Skewness Kurtosis
R99.9%
R100% Update
iir1/Ydly -0.1133 +1.3076
+0.0220
-0.0258 +4.2638 +4.4214
3001
iir1/Yout -0.1134 +1.3078
+0.0220
-0.0268 +4.2638 +4.4214
3000
Integer word-lengths:
VarName
Range
IWL
iir1/Ydly
+5.309891
+3
iir1/Yout
+5.309515
+3
Fig. 8
The result of the range estimator for the IIR filter
The elements of an array variable are assumed to have the same IWL for simple
code generation. If it is not, the scaled integer codes need to check the array index,
which can slow down program execution significantly. For a pointer variable, the
IWL is defined as that of the pointed variables. For example, when the pointer
variables p and q have the IWL of 2 and 3, respectively, the expression
=
q
p can
=
be converted to
1. Since the IWL of a pointer variable is not changed
at runtime, a pointer cannot support two variables having different IWL's. In this
case, the IWL's of these pointers are equalized automatically at the integer C code
generation step that will be described in the next section.
q
p
4
Floating-Point to Integer C Code Conversion
C language is most frequently used for developing digital signal processing pro-
grams. Although C language is very flexible for describing algorithms with complex
control flows, it does not support fixed-point data formats. In this section, a floating-
point to integer C program conversion procedure is explained [ 13 , 24 ] . As shown in
Fig. 9 , the conversion flow utilizes the simulation based range estimation results for
determining the number of shift operations for scaling. In addition, the number of
shift operations is minimized by equalizing the IWL's of corresponding variables or
constants for the purpose of reducing the execution time.
4.1
Fixed-Point Arithmetic Rules in C Programs
As summarized in Table 1 , the addition or subtraction of two input data with
different IWL's needs arithmetic shift before conducting the operation. Fixed-point
multiplication in C language needs careful treatment because integer multiplication
in ANSI C only stores the lower-half of the multiplied result, while fixed-point
multiplication needs the upper-half part. Integer multiplication is intended to prevent
any loss of accuracy in multiplication of small numbers, and hence it can generate an
overflow when large input data are applied. However, for signal processing purpose,
the upper part of the result is needed to prevent overflows and keep accuracy. Integer
and fixed-point multiplication operations are compared in Fig. 10 a ,b [ 14 , 15 ] .
 
 
Search WWH ::




Custom Search