Digital Signal Processing Reference
In-Depth Information
Tabl e 2 Implementation of fixed-point multiplication
Target processor Implementation
TMS320C50 #define mulh(x,y) ((x) * (y)>>16)
TMS320C60 #define mulh(x,y) _mpyh(x,y)
Motorola 56000
__inline int mulh(int x, int y) {
int z;
__asm("mpy %1,%2,%0":"=D"(z):"R"(x),"R"(y));
return z;
}
Fig. 11 An example of
expression conversion
4.2
Expression Conversion Using Shift Operations
The most frequently used expression in digital signal processing is the accumulation
of product terms, which can be generally modeled as follows.
x i = j , k x j × x k + l
x l
(6)
Complex expressions in C programs are converted to several expressions having
this form. Figure 11 shows one example.
Assuming that there is no shifter at the output of the adder, the IWL of the added
result is determined by the maximum value of two input operands and the result,
as shown in Table 1 . From this, the IWL of the right hand side expression, I rhs ,is
represented by the maximum IWL of the terms as shown in Eq. ( 7 ) .
I rhs =
max
j
l (
I x j +
I x k +
1
,
I x l ,
I x i ) ,
(7)
,
k
,
where I x +
1 represents the IWL of the multiplied results. The number of scaling
shifts for the product, addition, or assignment, which is represented as, s j , k , s l or s i ,
respectively, is determined as follows.
I y +
s j , k =
I rhs (
I x j +
I x k +
1
)
(8)
s l =
I rhs
I x l
(9)
s i =
I rhs
I x i
(10)
Equation ( 6 ) is now converted to the scaled expression as follows.
x i = { j , k (( x j × x k ) s j , k )+ l ( x l ) s l ) } s i
(11)
 
 
 
 
 
Search WWH ::




Custom Search