Table 6.4 (continued )
C Compiler Intrinsic
(a,b,c are 16-bit and d,e,f are 32-bit data)
Description
f _lsneg(long d);
Negates the 32-bit value with saturation.
f À d, _lsneg(0x80000000) >
0x7FFFFFFF
c _smpyr(int a, int b);
Multiplies a and b, shifts the result left by 1,
and rounds the result c. (SATD and FRCT set)
c _smacr(long d, int a, int b);
Multiplies a and b, shifts the result left by 1,
adds the result to d, and then rounds the
result c. (SATD, SMUL and FRCT set)
c _smasr(long d, int a, int b);
Multiplies a and b, shifts the result left by 1,
subtracts the result from d, and then rounds
the result c. (SATD, SMUL and FRCT set)
c _norm(int a);
Produces the number of left shifts needed to
normalize a and places the result in c.
c _lnorm(long d);
Produces the number of left shifts needed to
normalize d and places the result in c.
c _rnd(long d);
Rounds d to produces the 16-bit saturated
result c. (SATD set)
c _sshl(int a, int b);
Shifts a left by b and produces a 16-bit result
c. The result is saturated if b is greater than or
equal to 8. (SATD set)
f _lsshl(long d, int a);
Shifts a left by b and produces a 32-bit result
f. The result is saturated if a is greater than or
equal to 8. (SATD set)
c _shrs(int a, int b);
Shifts a right by b and produces a 16-bit result
c. (SATD set)
f _lshrs(long d, int a);
Shifts d right by a and produces a 32-bit result
f. (SATD set)
c _addc(int a, int b);
Adds a, b, and Carry bit and produces a
16-bit result c.
f _laddc(long d, int a);
Adds d, a, and Carry bit and produces a
32-bit result f.
The floating-point IIR filter function given in the previous experiment can be con-
verted to the fixed-point C implementation using these intrinsics. To prevent inter-
mediate overflow, we scale the input samples to Q14 format in the fixed-point
implementation. Since the largest filter coefficient is between 1 and 2, we use Q14
representation for the fixed-point filter coefficients defined in (6.7.1). The implementa-
tion of the IIR filter in the fixed-point Q14 format is given as follows:
SOFTWARE DEVELOPMENTS AND EXPERIMENTS USING THE TMS320C55X
291