WadamotoWayne1987

CALIFORNIA STATE UNIVERSITY, NORTHRIDGE
FIR DIGITAL FILTER DESIGN
A graduate project submitted in partial satisfaction of the
requirements for the degree of Master of Science in
Electrical Engineering
by
Wayne Wadamoto
MAY 1987
The Graduate Project of Wayne Wadamoto is approved:
Prof.
RaYPi t
Prof. Tarek Shraibati
Prof. J a P r h (
California State University, Northridge
ii
Table of Contents
Page
List of Figures
iv
Abstract
v
Chapter
1.0
2.0
2.1
2.2
3.0
4.0
5.0
5.1
5.2
5.3
5.4
6.0
GENERAL DIGITAL FILTER BACKGROUND.................
1
DETAILED FIR LINEAR PHASE THEORY •..•••.••..•..•...
3
THE APPROXIMATION PROBLEM ..••.••..•...••..•..•.... 4
OTHER LINEAR PHASE FORMS •..•••.....•...••.....••.•
9
DIFFERENTIATION FILTER .....•.••.••••••.•.•.••.•... 11
HILBERT TRANSFORMER •.•.••...•.••.••••..••.•.••.•.. 15
COMPUTER IMPLEMENTATION •••..••.•..••.•••......•..• 20
LI~T AND WRITE FACILITIES ..•.••..••.••..•••.••..•.
21
LIST LIMIT FACILITY ••••.••..••.•...•..••..••..•... 21
FILTER DESIGN PROGRAM .•••.••.••.•..•.•.•••.•••.... 22
SPECTRUM ANALYSIS FACILITY ••.•••••••••.••••..•.•.. 22
PROGRAM EXTENSION ....•.••.••.•••••.•••..•••....... 23
7. 0
SUMMARY • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •
25
Bibliography ...............................................
26
Appendix
Appendix
Appendix
Appendix
Appendix
A FIRDSGN User•s Guide .••..•.•••••..••.•••.••••..•
B FIRDSGN OUTPUT PLOTS .•••••.••.•..•...•...•.•.•..
C CYBER 750 FORTRAN Listings .••.•.....••....•...•.
D Hilbert transform design ••.•..•.....••..••.•.•..
E TMS32020 Listings .•.••..••.••.......••...•..••..
iii
27
36
41
56
65
List of F.i gures
1.
2.
3.
4.
5.
6.
7.
8.
9.
Magnitude response for the second and third iteration...
Magnitude response for the third and fourth iteration...
Response of the 32 and 64 point differentiator •.........
Absolute error of the 32 and 64 point differentiator ..•.
Differentiation filter input .....•.•....•...••.•..•.•...
Output of the 32 and 64 point differentiator ••••..•.••..
Direct Form 1 for a Hilbert transformer •••.•.••.........
Hilbert transformer with a
symmetrical frequency response ..••.•..•••..•.•••....•...
Filter design with a variable frequency response •.....•.
iv
8
8
13
13
14
14
18
18
24
ABSTRACT
FIR DIGITAL FILTER DESIGN
by
Wayne Henry Wadamoto
Master of Science in Electrical Engineering
This paper describes an
implementation of a computer program to
design FIR digital filters on
University, Northridge.
passband/stopband
CYBER 750 at the California State
The basic
filter program can design multiple
filters,
Differentiation
Chapters 1 and
transformers.
program to
the
design·
differentiation
and
and Hilbert
2 describe the mathematics used by the
multiple
filter
filters,
passband/stopband
Hilbert
filters.
transformer are
The
introduced in
chapters 3 and 4, respectively.
The CYBER 750 software implementation
of the filter design program is
given
software products such as
tools, and
in
chapters 5 and 6.
Layered
a user-friendly interface, related analysis
program extensions,
provide a complete environment for
designing FIR digital filters.
v
CHAPTER 1
1.
GENERAL DIGITAL FILTER BACKGROUND [5]
Manipulation of a discrete-time
common operation in digital signal
series
by a digital filter is a
processing.
Digital filtering can
be thought of as a mathematical operation on an array of sampled data.
Digital filters
are divided
into two distinct groups.
impulse response (IIR) filters calculate an
weighted sum of past
Infinite
output sample based on a
input and past output samples.
Mathematically
stated, an IIR filter is described by the following equation.
N
N
y (n) = 2: h (k) x (n-k)
k=-N
Finite impulse response
filters.
(FIR)
+
2:
g(k)y(n-k)
(1)
k=-N
filters
are special cases of IIR
The difference between the two filter structures is that the
FIR filter calculates output points
past input samples.
certain conditions
based only on a weighted sum of
The FIR digital filter is always stable and under
can be designed
Mathematically stated, the FIR filter
to
have constant group delay.
is described by the following
equation.
N
y(n)
2:
h(k)x(n-k)
k=-N
1
(2)
2
The frequency response of an FIR digital filter with impulse response,
h(n), of length N, is given by
N-1
H ( ej2?rf )
=
2:
n=O
h(n)e-j2?rnf.
(3)
CHAPTER 2
2.
DETAILED FIR LINEAR PHASE THEORY
If h(n) is constrained to meet certain symmetry conditions, the
resulting FIR filter exhibits a linear phase response.
a linear phase
frequencies.
response
has
a
A filter with
constant group delay for all
Consider the case where
the impulse response is of odd
length and exhibits even symmetry, that is,
N
=
2M + 1,
(4)
h(n) = h(-n).
(5)
Given these constraints, the frequency
response of the FIR filter can
be rewritten in the form of a zero phase FIR filter.
M
H ( ej2w-f) =
2:
h(n)e-j2?rnf
(6)
n=-M
The sum of the exponential terms for n and -n, when expanded using the
Euler identity is a real cosine function.
h(n)e-j 2w-nf+ h(-n)e-j 2w-(-n)f=
h(n)[cos(-2w-nf) + jsin(-2w-nf)]
+ h(-n)[cos(-2w-(-n)f) + jsin(-2w-(-n)f)]
=
h(n)[cos(2w-nf) - jsin(2w-nf)]
+ h(n)[cos(2w-nf) + jsin(2w-nf)]
= 2h(n)cos(2w-nf)
3
(7)
4
In order to realize a causal
system,
the summation must be shifted M
samples, resulting in the following frequency response.
H(ej2~f) = e-j 2 ~fM
[ h(O) +
~ 2h(n)cos(2~nf)
]
(8)
n=l
The requirement for linear phase
is satisfied because the phase angle
of the frequency response is a linear function of frequency.
2.1
THE APPROXIMATION PROBLEM
Given equation (8) which describes
an odd-length linear phase FIR
filter, we define two additional quantities:
D(ej 2 ~f) --magnitude of the ideal filter,
W(ej 2 ~f) -- weight function.
The weighted error function ( Equation
9 ) is the weighted difference
between the ideal response and the actual filter response.
In order to design a filter
found such that
in an equiripple manner, h(n)•s must be
the maximum weighted error is minimized
frequency range of interest (Equation 10 ).
in the
5
The unique solution to
the equiripple approximation is summarized by
the alternation theorem [2].
The alternation theorem describes the
conditions for the unique best approximation in terms of an alternant
of the error function
fN+1}
points {far f1 r
The alternant
;.
extremal points are
where fi
the
are called extremal points.
The
the frequencies where the error function goes
through a local minimum or local
states that
is defined as the set of
maximum.
unique best approximation
The alternation theorem
to the error function
displays at least N + 2 alternations on a compact subset, S, from zero
to 0.5 cycles per sample.
That is, the best approximation is achieved
when
(11)
The locations of maximum error deviation occur at the extremal points
with alternating sign.
(12)
with
fi ( fi + 1, e S, i
= 0,1, ••• Nand also FN+ 1e S
The unique solution can be obtained
the REMEZ exchange algorithm
[2]-[4].
points, the error function is derived
in an iterative manner by using
For a given set of extremal
from Equation 13 where p is the
error function value.
[
h(O) +
~
j=1
2h(n)cos2Knf - D(e; 27 f)
l
= -(-1) rp
(13)
6
Expanding equation (13) into matrix form:
1
COS21ffO
COS41ffO
• • •
COS21fNfO
1
w(f o)
1
COS21ff 1
COS41ff 1
• • •
COS21fNf 1
-1
W(f 1)
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
COS21ffN+ 1 COS41ffN+ 1 •
1
••
cos21rNfN+ 1
h(O)
D(f 0)
2h (1)
D(f 1)
•
•
•
•
•
2h (N)
D(fN)
•
X
p
~
N+1
(14)
D(fN+1)
Equation (14) is solved for the first column matrix which contains the
filter weight function, and the error function
filter weight function, the error function
evaluated at a finite
range 0
~
f
~
number of points,
~
value p.
Given the
( Equation 15 ) can be
sufficiently dense, in the
0.5.
N
+
2:
n=1
(15)
7
If the error function magnitude
criterion is satisfied.
is
If the error function magnitude is greater
than IPI for any frequency in the
range of 0 to 0.5, a new set of
extremal frequencies shall be chosen.
at least N zeros in the
extremal
points
in
IPir the equiripple
less than
Since the error function ¢has
range of 0 to 0.5,
the
range
of
0
stopband/passband filter has additional
it has at most, N + 1
to
0.5.
A multiple
extremal frequencies located
at those frequencies which define the passband or stopband edges.
new set of N + 1 extremal
points is chosen with points located at the
local minima or local maxima of the error function.
frequencies at 0 or 0.5,
bandlimits,
remain
iteratively until
Figures
plus
the
the same.
The extremal
frequencies which define the
The matrix equation
the error function magnitude
1 and 2 illustrate
approximation.
A
is
the convergence to
is
solved
less than IPI·
the equiripple
The passband portion of a bandpass filter is plotted
for each iteration of the REMEZ algorithm.
The endpoints of the plot
represent the band edges of the passband.
These points are not
shifted when selecting a new set of extremal points.
though the third
iteration appears
to
have more
Note that even
ripple than the
second, the second iteration has more ripple because the deviation of
the frequency response at the band edges is higher than for the third
iteration.
8
DB
.6000~--------------~----~----------~--~-----.
.4000
.2000
+
Third iteration
0.0
-.2000
+
DB
Second iteration
Figure 1. Second and third iterations.
.6000~--~----~----~----~----~----~--~-----,
.4000
.2000
~
Fourth iteration
-.4000
Figure 2. Third and fourth iterations.
9
2.2 OTHER LINEAR PHASE FORMS
even
In addition to the~~ymmetry,
odd length FIR filter, there are
three other FIR filters which have a linear phase response.
They are:
1. Even symmetry, even length,
M
H(ej 2,-f) =
2:
b(n)cos(2?r(n-.5)f).
(16)
n=1
2. Odd symmetry, odd length,
M
H(ej 2,-f) = j
2:
c(n)sin(2,-nf).
(17)
d(n)sin(2?r(n-.5)f).
(18)
n=1
3. Odd symmetry, even length,
M
H(ej 2;rf) = j
2:
n=1
Given the sum angle formulas for sine and cosine,
sin (a+ b) =sin (a) cos (b) +cos (a) sin (b),
cos (a+ b) =cos (a) cos (b) +sin (a) sin (b).
(19)
(20)
The three equations (16-18) can be written in the form of the positive
symmetry, odd length linear phase filter
[4]. Thus, the algorithm is
extended to handle four cases of linear phase FIR filters.
1. Even symmetry, even length,
M
H(ej 2,-f) = cos(1rf)
2:
n=O
b(n)cos(2,-nf),
(21)
10
where
b(1) = b(O) +
i b(1),
b(k) = ! [ b(k-1) + b(k) ] ,
k = 2, 3, •• n-1,
b(n) =! b(n-1).
(22)
2. Odd symmetry, odd length,
M
2
H(ej ~f) = jsin(2~f)
c(n)cos(2~nf),
2
(23)
n=O
where
1
c (1) = c(O) - 2 c(1),
N
N
]
c(k) = 21 [ c(k-1) - c (k+1)
N
.
k = 2, 3, • • n-2,
1
c(n-1) = 2 c(n-2),
N
1
c (n) = 2 c(n-1).
N
(24)
3. Odd symmetry, even length,
M
H(ej 2?rf) = jsin(~f)
2 d(n)cos(2~nf),
(25)
n=O
where
d(1) = d(O) d(k) =
i d(1),
i [ d(k-1)
d(n) =! d(n-1).
- d(k) ].
k = 2, 3, •• n-1,
(26)
CHAPTER 3
3.
DIFFERENTIATION FILTER
Filters
used
to
estimate
differentiation filters.
the
slope
of data are called
If we differentiate the complex exponential
(26)
The desired transfer function for the ideal differentiation filter is
H(2~f) = j2~f.
If we assume that
the
filter
(27)
coefficients of the differentiation
filter exhibit odd symmetry, that is,
h(n)
=
-h(-n).
(28)
The frequency response of the differentiation filter is
M
H(ej2~f)
=
2
h(n)e-j2~fn.
(29)
n=-M
Closer examination of the odd
symmetry complex number pairs for a
particular value of n reveals
that
the
real
term is
zero.
The
summation becomes purely imaginary.
h(n)ej2~fn + [-h(n)]e-j2~fn = h(n)[ej2~fn _ e-j2~fn]
= 2jh(n)sin(2~fn)
H(2~f)
= j[2h(l)sin(2~f)
+ 2h(2)sin(4~f) +
• • •
(30)
+ 2h(N)sin(2~fN)]
(31)
11
12
The coefficients of the filter are a linear combination of differences
of symmetrically placed values of the function.
The resulting filter
estimates the derivative of the input sequence.
(32)
h(m) [ x ( n + m ) - x ( n - m ) ]
The response (31) is of the form of the odd symmetry, odd length
filter.
Thus, the
same filter design algorithm used for designing
multiple passband/stopband filters
can
be
differentiation filter.
The differentiation
frequencies
than
applications,
(27)
the
more
low
used
filter amplifies high
frequencies.
higher frequencies
to design a
In practical
consists of noise and most
·differentiation filters are designed to
have an upper passband limit
below 0.5 cycles per sample (Figure 3).
The use of frequency response
in this context limits the ability of the differentiation filter to
measure changes in slope but does
limit its ability to measure
not
slope.
Figure 6 illustrate two examples of the differentiation
filter.
Each example uses
the same
input vector (Figure 5).
output vectors differ because a different
filter was used.
length differentiation
For the 32 point differentiation
filter, the time
delay is less than of the 64 point differentiation filter.
multiple passband/stopband filters,
the
The
As with
use of different filter
lengths and different transition bandwidths allow the designer to meet
the specified error tolerance
in the frequencies
of interest.
The
absolute error of the differentiator in the passband is an increasing
function with frequency
(Figure 4).
The
relative error, which is
equal to the absolute error divided by the value at that point is
constant.
13
VALUE
3.000~--~----~----~----~--~----~----~--~
2.500
2.000
1.500
Xl0-1
+
32 pt differentiator
1.000
64 pt differentiator
~
.5000
.0625
.1250
.1875 .2500
FREQ
.3125
.3750
.4375
.5000
VALUEFigure 3. Response of the 32 and 64 point differentiator
.6000;.----.----~----------~----~----~--~----~
.4000
.2000
-.2000
-.4000
-.60001L----J-----L----~----L---~-----L----~--~
0.0
.0625
.1250
.1875 .2500
FREQ
.3125
.3750
Figure 4. Absolute error in the passband
.4375
.5000
14
VALUE
600~--~----~----~----~----~----~--~-----,
500
400
300
200
100
VALUE
.2000
Figure 5. Differentiation filter input
I
I
I
I
I
I
I
-
.1000
-
0.0 :"1
A
-.1000
.2000
= 32 points
-+ ...
I
I
I
I
I
I
I
I
I
I
I
I
I
I
.1000
0.0 --1
-.1000
0. 0
I
I
I
.1250
. 2500
• 3750
_j
• 5000
TIME
I
I
I
• 6250
. 7500
. 8750
1. 000
Figure 6. Output of the 32 and 64 point differentiator
CHAPTER 4
4.
HILBERT TRANSFORMER
The Hilbert
transformer is
a
digital
implemented as an IIR or FIR filter [6].
an all-pass network with
network that can be
These networks approximate
a 90 degree phase
shift.
A complex time
series whose real and imaginary components are related by the Hilbert
transform relations is analytic.
The analytic signal has the property
that its spectrum is zero for frequencies along the bottom half of the
unit circle
(
<
~
f
< 2~
).
Evaluating the inverse Z-transform
where the spectrum is defined as
H(2~f) =
+j
for 0.0
<2~f <0.5,
(33)
H(2~f) =
-j
for 0.5
<2~f <1.0.
(34)
The impulse response is
1
h(n)
=
j2~
1
h(n)
=
j2~
§ H(z)zn- 1dz,
2~
~
{J
jej 0do
-
0
J jej 9do }•
~
1-ej~n
=
for
n
¢
0,
for
n
=
0.
~n
=
0
15
(35)
t' '
16
We can calculate the
input-output
relations by using the convolution
theorem.
y(n)
(36)
= ~
(n-m)
m=-oo
m#n
Using the fact that
X(z) = H* (z)Y(z),
x(n)
(37)
(38)
=
~
(n-m)
m=-oo
m#n
The resulting complex signal,
= x(n)
s(n)
+ jy(n)
(39)
is called the analytic signal.
The usage of the Hilbert transformer in an FIR structure, whose
coefficients are calculated by the filter design program, form the
real part of the complex time series.
complex time series is the original
phase delay of the filter.
number of samples.
to the
input time series delayed by the
The Hilbert transformer is usually
designed such that the filter length
delay that is applied
The imaginary portion of the
is odd.
This forces the phase
imaginary channel
to be an integral
As with multiple passband/stopband filters, the
transition bandwidth controls the length of the filter [9].
A finite
transition is required because the ideal all-pass Hilbert transformer
17
(zero transition bandwidth)
cannot
in general, be implemented by a
FIR structure.
Usage of this program requires that the response be
zero at w = 0.
The response at w = 0 must be zero because the weight
function has negative symmetry.
That
is, the sum of the coefficients
is equal to the response at D.C ••
A special case of the odd length Hilbert transformer occurs when a
symmetric frequency
sample.
response
is
specified about 0.25 cycles per
The symmetric frequency response implies that given
(40)
The frequency response is:
(N-1)/2
H*(ejw) =
2: c(n)sin(wn)
. n=1
(N-1)/2
= 2: c(n)sin((?r-w)n)
n=1
(N-1)/2
=
2:
c(n) (-1)n+ 1sin(wn) r
n=1
(N-1)/2
2: c(n)sin(wn) [1 - (-1)n+ 1]
n=1
=
o.
(41)
For n even, this requires that c(n) =) 0 to satisfy equation (41).
When the length of the filter
is
a multiple of 5 + 4N, zero valued
coefficients occur at the first and last point in the weight function.
The resulting filter
is
equivalent to the
type designed when the
length of the filter is a multiple of 3 + 4N.
The presence of zero
18
value weight coefficients can reduce the amount of processing required
to realize a given error specification as compared to the equivalent
filter designed with an even number of coefficients.
A Hilbert
transformer designed with an odd number of coefficients has the form
of:
. . . - - - - - - - - - - - - - - ) Imag
•
•
•
-)~)Real
->[QFigure 7.
Direct form 1 for a Hilbert transformer
When the constraint of symmetrical
frequency
response about 0.25
-----------)
1>EJ
cycles per sample is imposed, the filter structure reduces to:
....._-)~
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Imag
-)~)Real
Figure 8. Hilbert transformer with a symmetrical frequency response
19
Different hardware
implementations of the filter
indicated in
Figure 8 can yield a system which executes faster depending on the
filter structure.
Appendix 0 illustrates this by using coefficients
generated by the filter design program in a Texas
TMS32020.
Instruments
CHAPTER 5
5.
COMPUTER IMPLEMENTATION
The filter design program as
parameters from a ASCII
file
published
in
parameters the program calculates
the best
achieve a desired passband and
Therefore,
derives its input
a defined order.
sense and prints the filter coefficients.
approximated.
[4],
filter
in a equiripple
Filter orders required to
stopband response
one must be able to
iteratively, changing parameters
one at a time
response is achieved.
rerun
Clearly to
parameters in a rigid fashion can
Given these
can only be
run the program
until the desired
the program and to enter all
be cumbersome at best.
A solution
to this problem was to change the filter design program into a FORTRAN
callable subroutine.
allows the
change.
A user-friendly interface was then created and
filter designer to
Unchanged parameters
enter only those
parameters which
are maintained as state information.
State information is used for the next invocation of the filter design
program.
The technique for
handling parameter changes is based on a
modified FORTRAN namelist scheme.
scalar, vector,
fashion.
logical,
The user•s
which parameters
and
guide
This technique allows data entry of
string quantities
support facilities.
In addition
invoke different
These functions include the
a free format
( Appendix A ) illustrates the ease at
are changed.
keywords are used to
in
to parameter changes,
functions within the program.
filter design program and its various
The support
facilities include commands to write
20
21
filter coefficients to a local
file, list parameters, display program
limits, and perform frequency analysis.
5.1
LIST AND WRITE FACILITIES
Two keywords are available.
*LISTFIR lists the design parameters
used by the filter design program.
In
addition to listing design
parameters, a character string containing the file
storing the filter weight function
is also
listed.
name used for
The keyword
*WRTCOEF writes the entire impulse response to a disk file using a
FORTRAN E13.7 format.
Since the filters designed by this program are
linear phase, the weight functions exhibit even or odd symmetry and in
an actual filter realization only half of the coefficients need to be
stored.
It was decided to write the entire weight function in order
to avoid encoding the symmetry and filter length along with the weight
function.
*LISTPLT lists
the plot parameters
used by the DFT plot
program.
5.2
LIST LIMIT FACILITY
The keyword *LIMITS lists the design limits of the design package.
Limits are set depending on the sizes of the internally allocated
buffers within the executable module.
The limits may be increased up
to the physical or virtual limits of the particular host.
22
5.3
FILTER DESIGN PROGRAM
The keyword *DESIGN calls the filter design program which has been
rewritten as a FORTRAN callable subroutine.
5.4 SPECTRUM ANALYSIS FACILITY
The characteristics of the filter are contained in the impulse
response.
The response of the
filter
in the frequency domain can be
obtained by taking the Fourier transform of the impulse response.
In
order to allow the user to examine any portion of the frequency
response to any
program ) the
resolution,
Fourier analysis was
Fourier transform.
plot where each
(Appendix B).
( within the buffer limits of the
The plot output
implemented using the discrete
is
in the form of an ASCII dot
row of the output represents one frequency bin
Options
user defined limits
for autoscaling the response axis or using
are available.
Normalization of the frequency
response to the highest point in the response curve may be selected by
the user.
Q '
CHAPTER 6
6.
PROGRAM EXTENSION
When designing multiple
program,
response characteristics for
stopband are fixed for those
In certain
passband/stopband filters
situations,
frequencies
with
a particular passband or
between the two band edges.
it may be desirable to design a multiple
passband/stopband filter where the response characteristics vary.
filter design program has
response.
the response to vary logarithmically
fact
that most
filter
response in decibels.
The decision to allow
rather than linearly is based on
specifications
specify the
frequency
The user specifies the endpoints which define a
frequency band and the program calculates
function and/or the desired frequency
that frequency band.
Adjustments
frequency response are
the required error weight
response at each grid point in
for the error weighting function or
required depending on whether the frequency
band represents a passband or a stopband.
usually zero.
The
been modified to allow the designer to
logarithmically vary the frequency
the
this
The ideal stopband response
In order to vary the response in a stopband, the error
weighting function must be adjusted such that the weighting is highest
in the region where the amplitude
is desired
to be the lowest.
The
passband response is usually adjusted by varying the desired frequency
response
in the
function constant.
the passband,
response.
the
frequency
band,
while
keeping
the error weight
If the error weight function is allowed to vary in
ripple
varies
Two FORTRAN functions
instead of the actual passband
called by the filter design program
23
24
( EFF, WATE )
have been modified
( Appendix B ) to accommodate a
variable magnitude and/or variable weight function.
In order to
specify a constant magnitude and/or weight function for a frequency
band, the user specifies a positive value representing the magnitude
and/or weight function
in the magnitude and/or weight arrays.
order to specify a variable weight
user enters a pair of numbers
In
functions and/or magnitude, the
into the magnitude and/or weight array
representing the magnitude and/or weight at the edges of the frequency
bands where the sign of these pairs of numbers
modified EFF and WATE functions will
is negative.
The
scan the array for the negative
pairs and apply the appropriate interpolation where required.
Figure
9 illustrates a filter design where a variable passband and stopband
were specified.
DB
Or---.----.--~r-~~~-.----.----,--~
-100
Figure 14. Filter design with a variable frequency response
CHAPTER 7
7.
SUMMARY
This project presented a computer program capable of designing
multiple passband/stopband filters,
Hilbert transformers.
differentiation
Specific design
design program were presented
filters,
and
techniques used by the filter
for
the
case of the multiple
passband/stopband filter.
The utility of the
addition of layered
interface and
filter design program is
software products
supplementary analysis
structure is very modular and open.
tools.
as
the user-friendly
The software control
It is easy to add new parameters
and new functions to the existing software.
25
such
enhanced by the
26
Bibliography
[1] A. V.
Oppenheim, and R. W. Shafer, Digital Signal Processing.
Englewood Cliffs, New Jersey: Prentice-Hall, 1975.
[2] N. K. Bose, Digital Filters, Theory and Applications. New York:
Elsevier Science Publishing Co., Inc., 1985.
[3] R. W.
Hamming, Digital Filters.
Prentice-Hall, 1977.
Englewood Cliffs, New Jersey:
[4] J. H. McClellan, T. W. Parks, and
program for designing Optimum
Filters", IEEE Transactions on
AU-21, No.6, (December 1973 ),
L. R. Rabiner, "A Computer
FIR Linear Phase Digital
Audio and Electroacoustics,
506- 526.
[5] Application Note No. 2 Digital Filtering, Signal Technology Inc.,
1985.
[6]
B.
Gold, A. V. Oppenheim,
and c. M. Radar, "Theory and
Implementation of the discrete Hilbert transform", Proc.
Symp. Computer Process Communications, Brooklyn, New York:
Polytechnic Press, 1970.
[7] TMS32020 Users Guide, Texas Instruments Inc., SPRU0004B, 1986.
[8] Digital Signal Processing Applications with
Texas Instruments Inc., SPRA012, 1986.
[9] F. J.
the TMS320 Family,
Harris, Lecture Notes from a seminar on Digital Signal
Processing presented at Allied Bendix Oceanics Division,
July 1986.
Appendix A
FIRDSGN User•s Guide
Vl. 040
27
28
Program FIRDSGN is an
implementation of the McClellan, Parks, and
Rabiner finite impulse response filter program on the CSUN CYBER 750
computer.
Along with
the filter design program,
facilities are
provided to create frequency response plots and to write filter weight
No database preparation is necessary
coefficients to a disk file.
prior to running the program and
required.
All
knowledge of a text editor is not
runtime parameters are created
( if necessary),
modified, and stored while running the program.
Your instructor will give you the command to invoke FIRDSGN.
When you
run the program for the very first time, the following error message
will be printed on the screen.
*** PARAMETER SAVE FILE IS FAULTY
BAD VALUES WILL BE DEFAULTED
This message is printed because the program uses a parameter save
file.
The use of a parameter save file allows one to save all runtime
data from a previous
session
( except filter coefficients), and
restart the program with the exact parameter values from the previous
session.
When you use
the
filter design program for the very first
time a parameter save file will
all of the values
to
not exist.
the bandpass
McClellan, Parks and Rabiner paper.
The program will default
filter example presented in the
The next message you will receive
is a welcome message.
WELCOME TO THE FIR FILTER DESIGN PROGRAM ON _ _ _ __
ENTER COMMAND OR *HELP
29
At this point the program will wait
Commands are
or variable change.
perform a specific
used
to direct the software to
*HELP lists all
function.
functions in the program.
for you to enter either a command
All commands are prefixed by a*
changes are based on a modified
FORTRAN namelist scheme.
list the
runtime parameters type the following
terminal.
Note that the? is
indicates that the
of the available
return
Variable
In order to
command on the
the prompt given by the program.
(cr)
key should be hit after the command is
typed.
?*LISTFIR(cr)
It is recommended that you always list the runtime parameters prior to
running the FIR filter program to insure that the program is using the
proper input parameters.
The software responds to the list command by
printing the parameters in the form listed below.
-$FIR
ONFILT = 32,
OJTYPE = 1,
ONBANDS = 3,
OLGRID = 16,
OEDGE
= 0.0,
.lE+OO, .2E+OO, .35E+OO, .425E+OO, .5E+OO,
0.0, o.o, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
o.o, 0.0,
ORESP
= 0.0, .lE+Ol, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
o.o,
OWEIGHT = .1E+02, .lE+Ol, .1E+02, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0,
OFIRFILE = FIRFILE•,
O$END
1
In the CYBER implementation,
printout.
o•s
precede all
variable names in the
The actual variables used in the program do not include the
30
In
0 ( NFILT not ONFILT ).
order to
run the program, issue the
following command.
?*DESIGN(cr)
The program calculates the filter coefficients and prints the results
in the following format •
DEVIATION = • 002046911
DEVIATION =
.010957743
DEVIATION = .014889743
.015131176
DEVIATION =
*********************************************************************
FINITE IMPULSE RESPONSE (FIR)
LINEAR PHASE DIGITAL FILTER DESIGN
REMEZ EXCHANGE ALGORITHM
BANDPASS FILTER
FILTER LENGTH
= 32
***** IMPULSE RESPONSE *****
H( 1)
H( 2)
H( 3)
H( 4)
H( 5)
H( 6)
H( 7)
H( 8)
H( 9)
H(10)
H(ll)
H(12)
H(13)
H(14)
H(15)
H(16)
LOWER BAND EDGE
UPPER BAND EDGE
DESIRED VALUE
WEIGHTING
DEVIATION
DEVIATION IN DB
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
-.57534118E-02
.99027300E-03
.75733537E-02
-.65141202E-02
.13960526E-01
.22951463E-02
-.19994065E-01
.71369578E-02
-.39657363E-01
.11260113E-01
.66233640E-01
-.10497221E-01
.85136137E-01
-.12024993E+OO
-.29678577E+OO
.30410917E+OO
.0000000
.1000000
.0000000
10.0000000
.0015131
-56.4025464
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
= H(
=
=
.2000000
.3500000
1.0000000
1.0000000
.0151312
.1304433
32)
31)
30)
29)
28)
27)
26)
25)
24)
23)
22)
21)
20)
19)
H( 18)
H( 17)
.4250000
.5000000
.0000000
10.0000000
.0015131
-56.4025464
31
EXTREMAL FREQUENCIES--MAXIMA OF THE ERROR CURVE
.0000000
.0273438
.0527344
.0761719
.1000000
.2000000
.2195313
.2527344
.3132813
.3386719
.3500000
.4250000
.4503906
.4796875
.0937500
.2839844
.4328125
**********************************************************************
The command to list the frequency response program parameters is
?*LISTPLT(cr).
The design program replys with the following listing.
-$PLOT
OFMAX
= .5E+OO,
OFMIN
= 0.0,
OFNPTS
= 65,
ONORM
= 1 N1 1
OASCALE = Y
OYPLTMAX = 0.0,
OYPLTMIN = -.4E+02,
OPLTFILE = PLTFILE
$END
1
1
1
1
1
,
Plots created by this program will
PLTFILE.
The frequency
reside
in a local file named
response curve will consist of 65 frequency
bins from 0 to .5 cycles per sample with the autoscale option on and
the normalization option "off".
The command to plot the frequency
response is
?*FPLOT(cr).
The command to create a local file containing the filter coefficients
is
?*WRTCOEF(cr).
All thirty-two coefficients will be written in E13.7 format in a local
file named FIRFILE.
The command to exit the program and return to the
operating system is
?*EXIT.
At this point you should have three
PLTFILE, and
FIRFILE.
local
files
named RUNTIME,
File RUNTIME contains all
of the runtime
32
parameters prior to exiting such that
should you decide to run the
program again, the same parameters will
be loaded into the program at
startup.
File PLTFILE contains a frequency
response plot in a 132
character per line ASCII dot plot format which can be printed on most
printers.
File FIRFILE contains coefficients which can be printed or
passed to another program.
saved when you logoff.
Remember that all
local files are not
This data must be saved as an indirect file if
you wish to save the data for another terminal session.
Parameter Modification
Eventually you will want to experiment with the filter design program
using different parameters.
based on a modified
The method used to change parameters is
FORTRAN namelist
scheme.
namelist scheme allows parameter changes
In order to change a parameter,
The modified FORTRAN
using a free format method.
type desired parameter followed by an
= and then the numeric value or alphabetic string.
For example, to
change the number of filter weights to 45, simply type
?NFILT=45(cr).
More than one variable can be changed on one line.
important.
Order is not
Each variable change should be separated by a comma.
?NFILT=45,NBANDS=4(cr)
The maximum line length that can be correctly parsed by the program is
80 characters.
Some of the parameters are character strings.
order to change
single quotes.
those values,
For example,
?PLTFILE= RUN123•(cr).
1
In
enclose the alphanumeric string in
33
Some of the parameters are arrays
( EDGE,
RESP, WEIGHT).
You can
enter an array by typing
?EDGE=0.0,0.11,0.23,0.4(cr).
The above command has the effect of changing the first four parameters
in the array EDGE.
To change a specific array element, you must also
include the index.
EDGE(5)=0.45(cr)
Detailed description of the runtime parameters
NFILT
The number of filter weights to generate. The maximum
number of filter weights supported in this implementation
is 128.
JTYPE
Selects the type of filter to generate.
Choices are
multiple passband I stopband ( JTYPE=1 ), differentiator
( JTYPE=2 ), and Hilbert transformer ( JTYPE=3 ).
NBANDS
The number of frequency bands to use in the filter design.
The software supports up to ten frequency bands.
LGRID
The grid density used by the approximation routine (16).
EDGE
Lower and upper cutoff frequencies
for each frequency band.
RESP
Desired frequency response in
specify a variable response,
representing the response at
where the sign of the responses
WEIGHT --
Positive weighting factor used for adjusting the error
function in each frequency band.
In order to specify a
variable weight function,
enter a pair of numbers
representing the weighting at the frequency band edges
where the sign of the weights are negative
( cycles per sample )
each band.
In order to
enter a pair of numbers
the frequency band edges
are negative.
FIRFILE -- An alphanumeric string ( up to seven characters ) which
specifies the name of the local file used for storing the
filter coefficients.
FMAX
Maximum frequency ( cycles per sample ) plotted.
34
{l
FMIN
Minimum frequency ( cycles per sample ) plotted.
FNPTS
Number of frequency points to generate between FMIN and
FMAX.
NORM
Alphabetic option which will map the maximum response to
0.0 DB ( NORM='Y' ).
The default is no normalization
( NORM='N' ).
ASCALE -- Autoscale option which will calculate the maximum and
minimum values of the frequency response. These values
will be used to set the limits for the response axis.
Possible values for ASCALE is •y• for autoscale and 'N'.
When autoscaling is disabled, the displayed limits used
will be YPLTMIN and YPLTMAX.
YPLTMIN -- YPLTMIN is used to specify the lower display limit when
the autoscaling option is off.
Any points below YPLTMIN
will be mapped to YPLTMIN. When the autoscaling option is
on, the minimum point computed encountered is returned in
YPLTMIN.
YPLTMAX -- YPLTMAX is used to specify the upper display limit when
the autoscaling option is off.
Any points above YPLTMAX
will be mapped into YPLTMAX. When the autoscaling option
is on, the maximum point encountered is returned in
YPLTMAX.
PLTFILE -- An alphanumeric string ( up to seven characters ) which
specifies the name of the local file used to store the
frequency response plot.
Operational considerations
The program is designed to be used
can change parameters and
run
iteratively.
In other words, you
the filter design program many times
within one invocation of FIRDSGN.
append results to the end of the
Routines which write local files
file
successively without changing the output
if the routines are called
file name.
supports a dot plot with up to 1024 frequency bins.
The plot routine
Keep in mind when
you specify FNPTS, the standard paper form size is 66 lines per page
( 11 inches at 6 characters per inch,
page).
hence 66 frequency bins per
'
35
If a parameter save file becomes corrupted, the faulty values will be
set to syntactically correct but not necessarily a contextually
correct value.
The
user should
running the filter design
list all
program to
filter values prior to
insure that the correct filter
will be designed.
Caveats
The parser raises an exception when
it encounters a null string.
In
simple terms do not hit a (cr) directly after a ? or the program will
abnormally terminate.
Appendix B
FIRDSGN OUTPUT PLOTS
36
37
...............................................................................................................................
87/81/27
FIR FILTER DESIGN
17 .66.16.
...............................................................................................................................
FREU,UENCY
DB IIAG
8.88888 -66.48223
11.88781 -68.76689
8.81663 -67.88311
11.82344 -66.98813
8.83126 -67.88672
8.83986 -88.16618
8.84688 -68.68722
8.86469 -66.82682
8. 86268 -69 .16336
8.87831 -68.98978
8.87813 -67.12888
8.88694 -73.48871
8.89376 -66.48162
8.18166 -49.48888
8.18938 -32.67446
8.11719 -23.47868
1!.1261!1! -17 .1!6268
1!.13281 -12.31221
1!.14863 -8. 7391!6
1!.14844 -6.1!6476
1!.16626 -4.frl9912
1!.1641!6 -2.69229
1!.17188 -1.71386
1!.17969 -1.1!4681
1!.18761! -1!.69161!
1!.19631 -8.27466
1!.21!313 -1!.1!6496
ll. 211!94 ll. 881!1!7
ll. 21876 1!.131!86
1!.22666 8.11!1!47
ll. 23438 1!.1!1639
1!.24219 -1!.1!7788
1!.2681!8 -1!.1381!6
1!.26781 -1!.11266
ll. 26663 -1!.1!3326
8.27344 1!.1!6446
1!.28126 1!.12649
1!.289116 1!.11381
1!.29688 8.1!3311!
1!.31!469 -1!.1!7887
ll. 31261! -8.1311!7
1!.321!31 -1!.1!9974
ll. 32813 8.1!1118
ll. 33694 1!.11791!
1!.34376 8.88793
8.36166 -8.22411!
1!.36938 -8.96278
8.36719 -2.21669
ll. 37681! -4.12766
1!.38281 -6.88683
ll. 39863 -18.48666
ll. 39844 -16.16764
1!.48626 -21.46768
1!.41486 -38.22628
1!.42188 -44.69731
1!.42969 -67 .9021!0
0.43760 -63.16494
1!.44631 -69.26646
0.46313 -66.83833
1!.46894 -67 .1!6667
1!.46876 -61.86130
1!.47666 -66.64766
1!.48438 -67 .2381!4
1!.49219 -62.12316
ll.60808-133.9141l8
-133.91
-188.48
-33.38
-66.89
•
..
..
8.13
•
•
•
••
• •
•
..••..
•
••
..••
..
• •
•
Full bandwidth response using the autoscale option
·I
38
...............................................................................................................................
87/81/27
FIR FILTER DESIGN
17 .66.43.
...............................................................................................................................
FRE~UENCY
8.1l01lllll
8.88196
8.88391
8.88686
1!.88781
8.88977
8.81172
8 .1!1367
8.1!1663
8 .1!1768
8.1!1963
8.1!2148
1!.82344
8.82639
8.1!2734
ll.ll2931l
ll.ll3126
8.83328
ll.ll3616
ll.ll3711
ll.ll391l6
8.1!411!2
1!.84297
ll.ll4492
8.1!4688
ll.ll4883
8.1!6878
ll.IJ6273
1!.86469
1!.86664
ll.IJ6869
ll.ll61l66
ll.ll6268
., •86446
8.86641
ll.ll6836
8.871!31
!1.87227
1!.87422
ll.ll7617
ll.ll7813
ll.ll81lll8
ll.ll821l3
8.1!8398
ll.ll8694
ll.ll8789
ll.ll8984
ll.ll9181l
ll.ll9376
8.1l9671l
8.89766
ll.ll9961
1!.18166
1!.18362
1!.11!647
1!.11!742
8.11!938
1!.11133
1!.11328
1!.11623
1!.11719
1!.11914
ll.1211l9
0.12306
ll.12600
DB IIAG
-66.48223
-66.63381
-67.36614
-68.66748
-61!.76689
-64.18787
-71!.88922
-84.11879
-67 .81!311
-62.71969
-69.86464
-68.1!6936
-66.98813
-66.46317
-66.48291!·
-66.83491
-67 .81!672
-69.46312
-62.16262
-66. 88361!
-81!.16618
-71.69349
-64.27666
-61!.67121
-68.61!722
-67 .1991!7
-66.62628
-66.48223
-66.82682
-67 .871!22
-69. 731!22
-62.98811!
-69.16336
-86.48388
-67.1!3393
-61.76147
-68.98978
-67.26676
-66.46611!
-66. 41!283
-67 .121l81l
-68.84611
-62.24768
-71l.23947
-73.481!71
-62.71181!
-68.64892
-66.61873
-66.41!162
-68.67634
-69.2841!4
-68.94464
-49.48888
-43.64387
-39.29269
-36.72614
-32.67446
-29.99669
-27. 61!464
-26.44612
-23.47861l
-21.67624
-21!.01683
-18.48346
-17.86268
-61.77
-69.13
-86.48
-17.86
-34.42
•
••
•
*•
•
•
•
•
•
•
•
•
..
•
••
•
..•
Selected portion of the stopband
39
...............................................................................................................................
87/81/27
FIR FILTER DESIGN
17.67 .16.
...............................................................................................................................
FRE~UENCY
1!.88888
8.88196
8.88391
8.88686
8. 88781
8.88977
8.81172
8.81367
8. 81663
8.81768
8.111963
11.112148
II. 82344
8.112639
8.82734
11.1129311
11.113126
11.113328
1!.83616
11.113711
II. 113986
11.84182
11.84297
8. 84492
11.114688
8.114883
11.86878
11.116273
8.86469
11.86664
8.86869
". 86866
11.862611
8.811446
8.8111141
8.116836
8.87831
8. 87227
8.87422
8.87617
8.87813
8.88888
8.88283
8.88398
8.88694
8.118789
8.118984
8.89188
8.89376
8.89678
". 89766
8.89961
8.18166
".18362
8.18647
11.18742
8.18938
8.11133
8.11328
8.11623
".11719
8.11914
8.12189
8.12386
8.12688
DB IIAG
-39.33966
-39.67113
-48.29246
-41.69472
-43.69321
-47.12439
-63.82664
-67.86611
-68.7 4843
-46.66691
-42.79196
-41.886117
-39.92646
-39.391149
-39.341123
-39.77223
-411.744114
-42.481144
-46.88994
-49.82882
-63. 89268
-64.63881
-47.21288
-43.68863
-41.44464
-48.13639
-39.46268
-39.33966
-39.76314
-48.88764
-42.66764
-46.84642
-62.18867
-69.42128
-49.97126
-44.69879
-41.84718
-48.28388
-39.48342
-39.34816
-48.116612
-41.78343
-46.18498
-63.17679
-66.41883
-46.64912
-41.48624
-39.66686
-39.33884
-41.612116
-62.22136
-41.88197
-32.346211
-26.68839
-22.23881
-18.66346
-16.61177
-12.93381
-18.64186
-8.38244
-6. 41682
-4.61366
-2.96416
-1.42877
ll.llll81lll
-62.87
-69.42
-34.71
Ull
-11.36
• •
•
••
••
•
•
•
• •
•
..
••
••
• •
•
•
..
•
••
Selected portion of the stopband using the normalize option
40
...............................................................................................................................
17.67.38.
87/81/27
FIR FILTER DESIGN
...............................................................................................................................
FR~UENCY
8.28888
8.28234
8.28469
8.28783
8.28938
8.21172
8.21486
8.21641
8.21876
8.22189
8.22344
8.22678
8.22813
8.23847
8.23281
8.23616
8.23768
8.23984
8.24219
8.24463
8.24688
8.24922
8.26166
8.26391
8.26626
8.26869
8.26894
8.26328
8.26663
8.26797
8.27831
8.27266
11.271i811
8.27734
8.27969
8.282113
8.28438
11.28672
8.289116
11.29141
8.29376
8.296119
8.29844
9.381178
8.38312
8.38647
0.311781
8.31816
8.31268
8.31484
11.31719
8.31963
11.32188
11.32422
8.32666
8.32891
11.33126
8.33369
11.33694
11.33828
8.34862
8.34297
8.34631
8.34766
ll.36881l
DB IIAG
-8.13243
-8.87386
-(1.(12124
fll.ll23ll8
(1.(16982
8.88891
8.11829
8.12396
(1.13886
8.12884
8.12877
8.18647
8.88681
8.116279
8.83661
8.88668
-8.82288
-11.86117
-8.81787
-11.89919
-8.11637
-8.12778
-8.13264
-8.13862
-8.12196
-8.18781
-8.88649
-8.86147
-11.83326
-8.88338
11.82688
8.86648
(1.(18128
8.18267
11.11843
11.12789
11.131136
11.12661
(1.11381
11.89649
U711i6
U4326
8.81212
-ll.ll21l07
-8.86142
-8.87996
-8.18381
-11.12131
-8.13187
-11.13216
-11.12416
-11.18724
-8.88222
-8.861166
-11.81429
8.112396
11.1161119
11.89366
11.11789
8.12991
8.12678
ll.llll26
ll.ll6264
-8.82482
-8.13241
-8.48
8.28
8.88
-8.28
8.48
-----------------------------------------------------------------------------------------------------
•
•
•
•
•
..
•
•
•
••
••
•
•
•
••
••
.. • •
••
•
------ .. ----------------------------------------------------------------------------------------------
Passband response using user defined magnitude limits
Appendix C
CYBER 750 FORTRAN Listings
41
42
PROGRAM FIRDSGN
74/760 OPT=3,ROUND= A/ S/ W/-D,-DS
FTN6 6.1•617
86/12/14. 23.62.41
DO=-LONGf-OT ,ARG=-COUIION/-FIXED,CS= USER/-FIXED,DB=-TB/-SBf-SL/-ER/- ID/-PMD/-ST, PL=6000
FTN6, l=FIRDSGN, B=OBJl, L=LIS, OPT =3
1
PROGRAU FIRDSGN
2
c
3
4
6
6
7
8
9
lll
11
12
13
14
16
16
17
18
19
21l
21
22
23
24
26
26
27
28
29
30
C
C
C
C
C
C
C
WRITIEN BY WAYNE WADAMOTO JULY 1986
CALIFORNIA STATE UNIVERSITY NORTHRIDGE
FOR THE CYBER 170/760
PLEASE SUBUIT SOmARE PERFORIIANCE REPORTS TO THE AUTHOR AT :
ALLIED SIGNAL BENDIX AEROSPACE OCEANICS DIVISION
16826 ROXFORD ST
SYLWAR, CALIFORNIA 91342-3697
(818) 357-0111
C
C
THIS PROGRAII IS PROTECTED AS AN UNPUBLISHED COMPUTER WORK UNDER
THE COPYRIGHT LAW OF 1978
c
c
c
C TYPE DECLARATIONS -------------------------------------------------c
n
32
33
34
36
36
37
38
39
40
41
42
43
44
46
46
47
48
49
60
61
62
63
64
66
c
LOGICAL
LOGICAL
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
CHARACTER•!
CHARACTER•lll
CHARACTER•7
CHARACTER•4
CHARACTER•!
CHARACTER•7
CHARACTER•8
CHARACTER•80
CHARACTERd0
C DEFAULT
c
DATA
DATA.
DATA
DATA
DATA
DATA
DATA
DATA
DATA
HIT
IIFLAG
FNPTS
I
J
K
NFILT
JTYPE
NBANDS
LGRID
EDGE ( 20 )
FIIAX
FIIIN
RESP ( lll )
WlliHT(~)
FIRFCN ( 129 )
YPLTIIIN
YPLTIIAX
ASCALE
DATE
FIRFILE
NLEND
NORII
PLTFILE
NLSTART
STRING
TillE
VALUES FOR PARAMETERS ------------------------------------NFILE, JTYPE, NBANDS, LGRID / 32, 1, 3, 16 /
EDGE I 0.1l, 0.1, ll.2, 0.36, 0.426, ll.6, 14•0.0 I
RESP I 0.0, 1.0, 0.0, 7•0.0 I
WEIGHT I lll.' 1.0, 10.0, 7•0.1l I
FIIIN, FIIAX, YPLTIIIN, YPLTIIAX /ll., ll.6, -41l., ll. /
FNPTS, ASCALE, NORII / 66, 'Y', 'N' /
FIRFILE / 'FIRFILE' /
PLTFILE / 'PLTFILE' /
NLSTART / 'SRUNTIIIE' /
PAGE
43
PROGRAII FIRDSGN
66
67
68
69
60
61
62
63
64
66
66
67
68
69
70
71
72
73
74
76
76
77
78
79
80
81
82
83
84
86
86
87
88
89
90
91
92
93
94
96
96
97
98
99
H'l0
1111
102
103
104
H'l6
106
107
108
109
110
111
112
c
74/760 OPT=3,ROUND= A/ S/11/-D,-DS
DATA NLEND
FTN6 6.1•617
/ 'SEND' /
C NAIIELIST DECLARATION ----------------------------------------------
c
C
C
c
C
c
60
c
80
90
c
NAIIELIST / RUNTIIIE /
1 NFILE, JTYPE, NBANDS, LGRID, EDGE, RESP, WEIGHT, FIRFILE,
2 FIIAX, FIIIN, FNPTS, NORII, ASCALE, YPLTIIAX, YPLTIIIN, PLTFILE
NAIIELIST / FIR /
•
I FIR I
1 NFILT, JTYPE, NBANDS, LGRID, EDGE, RESP, WEIGHT 1 FIRFILE
NAIIELIST I FFT I
•
IFFTI
1 FIIAX, FIIIN, FNPTS, NORII, ASCALE, YPLTIIAX, YPLTIIIN, PLTFILE
EXECUTABLE -------------------------------------------------------OPEN ( 6, FILE = 'INPUT' )
OPEN ( 6, FILE = 'OUTPUT' )
OPEN ( 9, FILE = 'RUNTIIIE ' )
REIIND ( 9 )
READ ( 9, RUNTIIIE, ERR =60, END =60 )
GO TO 80
PRINT *• '*** PARAUETER SAVE FILE IS FAULTY.'
PRINT *• '
BAD VALUES WILL BE DEFAULTED.'
WRITE ( 6, 90 ) DATE(), TillE()
FORIIAT ( ' WELCOIIE TO THE FIR FILTER DESIGN PROGRAII ON', 2A12, /,
' ENTER COII~AND OR •HELP' )
100 READ ( 6, 191, ERR = 400 ) STRING
101 FORIIAT ( A80 )
c
IIFLAG = •TRUE.
HIT = •FALSE.
KSTART = -1
DO 200 I = 1, 80
IF ( STRING ( I : I ) • E~. ' ' ) THEN
IF ( HIT .EQV •• TRUE. ) IIFLAG = .FALSE.
ELSE
IF ( HIT •EQV. • FALSE. ) KSTART = I
HIT = •TRUE.
IF ( II FLAG • EQY. •TRUE. ) KENO = I
END IF
200 CONTINUE
C
C NOW WHAT IE HAVE IDENTIFIED THE STRING LOCATION LETS SEE WHAT IT IS
c
IF ( STRING ( KSTART : KENO ) .EQ. '•LISTFIR' ) THEN
WRITE ( 6, FIR )
GO TO 600
ELSE IF ( STRING ( KSTART : KENO ) .EQ. '•DESIGN' ) THEN
CALL FIRLPFD ( NFILT, JTYPE, NBANDS, LGRID,
EDGE, RESP, WEIGHT, FIRFCN )
K = NFILT
J = ( NFILT • 1 ) / 2
DO 209 I = 1, J
FIRFCN ( K ) = FIRFCN ( I )
86112/14. 23.62.41
PAGE
2
44
PROGRAW FIRDSGN
113
114
116
116
117
118
119
128
121
122
123
124
126
126
127
128
129
130
131
132
133
134
136
136
137
138
139
148
141
142
143
144
146
149
160
161
162
163
164
166
166
167
168
169
160
161
162
163
164
166
166
167
168
169
FTN6 6.1•617
74/768 OPT=3,ROUND= A/ S/ W/-0,-DS
K=K-1
CONTINUE
GO TO 680
ELSE IF ( STRING ( KSTART : KEND ) .E~. '•EXIT' ) THEN
REWIND ( 9 )
WRITE ( 9, RUNTIWE )
R~~D (9)
CLOSE ( 9 )
CALL EXIT
ELSE IF ( STRING ( KSTART : KEND ) .~. '•HELP' ) THEN
PRINT
AVAILABLE COIII.!ANDS AND THEIR !.lEANINGS'
PRINT
"•LISTFIR" LISTS THE FIR DESIGN VARIABLES'
PRINT
"•DESIGN" RUNS THE FIR FILTER DESIGN PROGRAW'
PRINT •, ' "•EXIT"
EXITS AND R~RITES THE SAVE FILE'
PRINT •, ' "•LIIIITS" LISTS THE PROGRAW LIIIITS'
PRINT t, ' "•LISTFFT" LISTS THE FFT VARIABLES'
PRINT •, ' "•FFT"
RUNS THE FFT/PLOT PROGRAII'
PRINT *• ' "•IRTCOEF" WRITES THE WEIGHT FCN TO A FILE'
GO TO 580
ELSE IF ( STRING ( KSTART : KENO ) .E~. '•LIIIITS' ) THEN
PRINT •, ' 3 =< NFILT =< 128'
PRINT •, ' 1 =< JTYPE =< 3'
PRINT *, ' 1 =< NBANDS =< 10'
PRINT •, ' 8 =< FRE~ =< 8.6'
PRINT •, ' 1 =< FNPTS =< 1824'
GO TO 688
ELSE IF ( STRING ( KSTART : KEND ) .E~. '•LISTFFT' ) THEN
WRITE ( 6, FFT )
GO TO 608
ELSE IF ( STRING ( KSTART : KENO ) .E~. '•FFT' ) THEN
CALL PLOTI ( FIIIN, FIIAX, FNPTS, NFILT, NORII, ASCALE,
YPLTWIN, YPLTWAX, PLTFILE, FIRFCN )
GO TO 600
ELSE IF ( STRING ( KSTART : KENO ) .E~. '•IRTCOEF' ) THEN
OPEN ( 4, FILE = FIRFILE )
DO 260 I = 1, NFILT
WRITE ( 4, 261 ) FIRFCN ( I )
260
CONTINUE
261
FORIIAT ( ' ', E13. 7 )
GO TO 600
END IF
IF ( STRING ( KSTART : KENO ) .E~. '•' .OR.
1
STRING ( KSTART : KENO ) .E~. ' ' ) THEN
PRINT •, '*** INVALID COIIIIAND '
GO TO 488
END IF
209
*, '
*• '
*• '
c
C
c
ADD ONE COIIWA
KENO = KENO • 1
STRING ( KENO : KENO ) = ','
REWIND ( 9 )
WRITE ( 9, FliT = * ) NLSTART
WRITE ( 9, FliT = * ) STRING ( KSTART : KEND
l.
86/12/14. 23.62.41
PAGE
45
PROGRAW FIRDSGN
74/760 OPT=3,ROUND= A/ S/11/-D,-DS
FTN6 6.1•617
86/12/14. 23.62.41
4
PAGE
WRITE ( 9, FliT = • ) NLEND
REWIND ( 9 )
READ ( 9, RUNTIWE, END = 301, ERR = 301 )
GO TO 400
301 PRINT •,
ERROR IN PARAIIETER INPUT'
400 CONTINUE
170
171
172
173
174
176
176
177
178
179
180
'***
c
600 DO 601 I = 1, 80
601 STRING ( I : I ) = ' '
GO TO 100
END
--VARIABLE IIAP--(LO=A)
-NAIIE- --ADDRESS --BLOCK-----PROPERTIES------TYPE---------SIZE
ASCALE
EDGE
FIRFCN
FIRFILE
FilA X
FIIIN
FNPTS
HIT
I
J
JTYPE
K
KENO
KSTART
CHARd
REAL
REAL
CHAW
REAL
REAL
INTEGER
LOGICAL
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
13668
11118
11638
13678
11368
11368
lHllB
10778
11028
1Hl3B
11068
11048
14068
14048
20
129
-NAIIE---ADDRESS --BLOCK-----PROPERTIES------TYPE---------SIZE
LGRID
IIFLAG
NBANDS
NFILT
NLEND
NLSTART
NORII
PLTFILE
RESP
STRING
lEIGHT
YPLTIIAX
YPLTIIIN
INTEGER
LOGICAL
INTEGER
INTEGER
CHAR•4
CHAR•8
CHARd
CHAR•7
REAL
CHAR•80
REAL
REAL
REAL
11108
11008
11078
11068
1370B
1373B
13718
13728
11378
13748
11618
13668
13648
--PROCEDURES-- (LO=A)
-NA!.IE------TYPE------- ARGS------CLASS----DATE
0
0
8
10
0
CHAR•Hl
EXIT
FIRLPFD
PLOTI
TillE
CHAR•10
FUNCTION
SUBROUTINE
SUBROUTINE
SUBROUTINE
FUNCTION
--STATEIIENT LABELS-- (LO=A)
-LABEL- ADDRESS---- PROPERTIES----DEF
60
811
90
100
1111
20B
24B
4618
328
463B
FORIIAT
FORIIAT
78
81
82
86
86
-LABEL-ADDRESS----PROPERTIES--- -DEF
2011 INACTIVE DO-TERII
2119 INACTIVE DO-TERII
260 INACTIVE DO-TERII
FORWAT
261
466B
99
114
163
164
-LABEL -ADDRESS--- -PRO PERT IES----DEF
301
316B
32118
4011
3298
400
601 INACTIVE DO-TERW
174
176
177
178
10
10
46
PROGRAII FIRDSGN
74/760 OPT=3,ROUND= A/ S/11/-D,-DS
--ENTRY POINTS-- (LO=A)
-NAIIE- --ADDRESS--ARCS--FIRDSGN
48
ll
- -NAIIELISTS-- (LO=A)
-NAIIE---ADDRESS
FFT
10668
FIR
111368
RUNTIIIE 7748
-- I/0 UNITS-- (LO=A)
-NAIIE--- PROPERTIES------------TAPE4
TAPED
TAPE6
TAPE9
AUX/M /SEQ
AUX/M /SEQ
AUX/M /SEQ
AUX/M/SEQ
--STATISTICS-PROGRAII-UNIT LENGTH
Cll STORAGE USED
COIIPILE TillE
14078 = 776
614008 = 26344
2.277 SECONDS
FTN6 6.1• 617
86/12/14. 23.62.41
PAGE
47
PROGRAII PLOTl
74/760 OPT=3,ROUND= A/ S/11/-D,-DS
FTN6 6.1·617
86/12/14. 23.62.67
DO:-LONG/-OT ,ARG=-COIIIION/-FIXED,CS= USER/-FIXED,DB=-TB/-SBI-SLI-ERI- IDI-PIIDI-ST, PL=6000
FTN6, I=PLOTl ,B=OBJ2, L:LIS, OPT =3
1
2
3
4
6
6
7
8
9
10
11
12
13
14
16
16
17
18
19
20
21
. 22
23
24
26
26
27
28
29
30
SUBROUTINE PLOTl ( FIIIN, FIIAX, FNPTS, TIIIEPT, NORII,
1
ASCALE, YPLTIIIN, YPLTIIAX, PLTFILE, X )
c
C
C
C
C
C
C
C
c
C
C
THIS PROGRAII IS PROTECTED AS AN UNPUBLISHED COIIPUTER WORK UNDER
THE COPYRIGHT LAW OF 1978
c
C TYPE DECLARATIONS
c
31
32
33
34
36
36
37
38
39
48
41
42
43
44
46
46
47
48
49
60
61
62
63
64
66
WRITTEN BY WAYNE WADAIIOTO NOVEIIBER 1986
CALIFORNIA STATE UNIVERSITY NORTHRIDGE
FOR THE CYBER 1701768
PLEASE SUBIIIT SOFTlARE PERFORIIANCE REPORT TO THE AUTHOR AT
ALLIED SIGNAL BENDIX AEROSPACE OCEANICS DIVISION
16826 ROXFORD ST
SYLIIAR, CALIFORNIA 91342-3697
c
CHARACTER•!
CHARACTER$!
CHARACTER•18
CHARACTER$!
CHARACTER$!
CHARACTER•7
CHARACTER•!
CHARACTERd8
COIIPLEX
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
--------------------------------------------------
ASCALE
BUF ( 101 )
DATE
GRID ( 181 )
NORII
PLTFILE
STAR
TillE
SUII
BIN ( 1824 )
DELF
DELY
FIIAX
FIIIN
FREI{
WFREI{
YAXIS ( 3 )
YIIAX
YIIIN
YPLTDEL
YPLTIIAX
YPLTIIIN
X( 1)
FNPTS
I
K
TIWEPT
ZVAL
C DATA INITIALIZATION -----------------------------------------------
c
c
DATA GRID I '. ', 24•' ', '. ', 24•' ',
1
'. ', 24•' ', '. ', 24•' ',
DATA STAR / '•' I
'.'
I
C EXECUTABLE --------------------------------------------------------
c
c
C OPEN THE OUTPUT FILE
PAGE
48
74/76e OPT=3,ROUND= A/ S/ 11/-0,-0S
PROGRAII PLOT'f
66
67
68
69
6e
61
62
63
64
66
66
67
68
69
c
OPEN ( 8, FILE=PLTFILE )
c
C CHECK
c
IF THE USER ASKED FOR TOO IIANY POINTS ( LIIIIT IS 1e24 )
IF ( FNPTS •GT. 1e24 ) THEN
PRINT •, ' *** THE IIAXIIIUII NUIIBER OF FRE~UENCY BINS IS 1e24. '
PRINT *• '
FNPTS = ', FNPTS
RETURN
END IF
c
C CHECK
c
IF THE USER ENTERED THE
FRE~UENCY
LIIIITS CORRECTLY
IF ( FIIIN •GT. FVAX ) THEN
PRINT
*** ERROR IN FRE~UENCY LIIIITS'
PRINT
FIIIN = ', FIIIN
PRINT
FIIAX = ', FIIAX
RETURN
END IF
*, '
*, '
*• '
1e
71
72
73
74
76
76
77
78
79
8e
81
82
83
84
86
86
87
88
89
9e
91
92
93
94
96
96
97
98
99
100
1e1
1e2
1e3
11l4
lll6
1e6
1117
11l8
lll9
11e
111
112
FTN6 6.1•617
c
DELF = ( FIIAX - FIIIN ) / ( FNPTS - 1 )
FRE~ = FIIIN
DO 6e I = 1, FNPTS
SUII = ( e., e. )
DO 4e K = 1, TIIIEPT
IFRE~ = 6. 2831863e8 • FRE~ • ( K - 1 )
SUII=SUII•(X(K)
1
* CIIPLX ( COS ( IFRE~ ) , - SIN ( IFRE~ ) )
4e
CONTINUE
FRE~ = FRE~ • DELF
BIN ( I ) = 20. • ALOG1e ( CABS ( SUII ) )
6e CONTINUE
c
C FIND THE IIINIIIUII AND
c
60
c
YIIAX = BIN (
YIIIN = BIN (
DO 60 I = 2,
IF ( BIN (
IF ( BIN (
CONTINUE
IIAXIIIUII PARTS OF THE DATA
1)
1)
FNPTS
I ) .GT. YIIAX ) YIIAX = BIN ( I )
I ) •LT. YIIIN ) YIIIN = BIN ( I )
C SHALL IE NORIIALIZE THE DATA? THE DEFAULT IS YES
c
61
c
IF ( NORII .NE. 'N' .AND. NORII .NE.
DO 61 I = 1, FNPTS
BIN ( I ) = BIN ( I ) - YIIAX
CONTINUE
YIIIN = YIIIN - YIIAX
YIIAX = ll.
END IF
'n' ) THEN
C SHALL IE AUTOSCALE THE DATA? THE DEFAULT IS YES
c
IF ( ASCALE .NE. 'N' .AND. ASCALE .NE.
YPLTIIAX = YIIAX
YPLTIIIN = YIIIN
'n' ) THEN
86/12/14. 23.62.67
PAGE
2
49
74/760 OPT=3,ROUND= A/ S/11/-D,-DS
PROGRAII PLOTW
113
114
116
116
117
118
119
120
121
122
123
124
126
126
127
128
129
130
131
132
133
134
136
136
137
138
139
140
141
142
143
144
146
146
147
c
END IF
C CHECK THE AXIS SCALING. THE ROUTINE SHOULD NOT ERROR ON THE AUTO
C SCALING OPTION. WE ONLY WANT TO KEEP AN EYE ON THE USER IF HE
C SPECIFIES THE Y AXIS MANUALLY.
c
IF ( YPLTIIIN .GT. YPLTIIAX ) THEN
PRINT •, '
ERROR IN YAXIS SCALING'
PRINT •, '
YPLTIIIN = ', YPLTIIIN
PRINT • , '
YPLTIIAX = ' , YPLTIIAX
RETURN
END IF
***
c
C DRAW A LINE
c
WRITE ( 8,
c
802 )
C WRITE THE TITLE FOR THE TABULAR DATA
c
WRITE ( 8, 806 )
c
C WRITE ANOTHER LINE
c
WRITE ( 8, 802 )
c
C WRITE SOliE LABELS
c
DATE(), TillE()
WRITE ( 8, 804 )
c
C WRITE THE AXIS
c
YPLTDEL
YAXIS (
YAXIS (
YAXIS (
WRITE (
148
149
160
161
162
163
164
166
166
167
168
169
169
161
162
163
164
166
166
167
168
169
FTN6 6.1•617
VALUES
= YPLTIIAX - YPLTIIIN
1 ) = YPLTIIIN • YPLTDEL •
2 ) = YPLTIIIN • YPLTDEL •
3 ) = YPLTIIIN • YPLTDEL •
8, 803 ) YPLTIIIN, ( YAXIS
!!.26
0.60
0.76
( I ) , I = 1, 3 ) , YPLTIIAX
c
C WRITE THE STARTING BORDER FOR THE PLOT
c
c
c
WRITE ( 8, 801 )
DO 79 I = 1, FNPTS
ZVAL = ( ( BIN ( I ) - YPLTIIIN ) / YPLTDEL ) • 190. • .6
IF ( ZVAL .LT. 9) ZVAL = 0
IF ( ZVAL .GT. 100 ) ZVAL = lll0
C CREATE THE OUTPUT PLOT
c
80
c
DO 80 K = 1, 101
BUF ( K ) = GRID ( K )
CONTINUE
C IIODIFY THE POINT
c
BUF ( ZVAL • 1 ) = STAR
WRITE ( 8, 8811 ) ( DELF • ( I - 1 ) ) • FIIIN, BIN ( I ) ,
( BUF ( K ) , K = 1, 191 )
86/12/14. 23.62.67
PAGE
50
PROGRAW PLOTI
171l
171
172
173
174
m
176
177
178
179
181l
181
182
183
184
186
186
187
188
189
190
71l
74/761l OPT=3 1 ROUND= A/ Sf Wf-D 1 -DS
FTN6 6.1•617
FRE~
GRID
I
NORW
cos
4
FOR THE PLOT
1
81lll FORIIAT ( I ' ' 2Flll.6, 11lX, 11l1A1 )
Sill FORIIAT ( '
'I
1
--------------------------------------------------I I
1
'---------------------------------------------------' )
c
81l2 FORI.tAT ( • ***************************************************I I
1
I$$UU$U$UUUUU$$UUU*UHUU$U$UUUUH' I
1
'*******************************'I I )
c
893 FORI.IAT ( ' ', 26X, F7 .2, 18X 1 F7 .2 1
1
18X 1 F7 .2 1 18X 1 F7 .2 1 18X 1 F7 .2 )
81l4 FORI.tAT ( I • I ' FRE~UENCY
DB IIAG' )
1
81l6 FORIIAT ( // 1 1
FIR FILTER DESIGN
1 31lX 1 2Al2 1
RETURN
END
6
646B
616B
2646B
NONE
2
1
3
2647B
630B
2667B
0
DUIIWY-ARG
UNUSED/•S•
DUIIIIY-ARG
DUIIIIY-ARG
DUIIWY-ARG
DUIIWY-ARG
--PROCEDURES-- (LO=A)
-NAIIE------TYPE------- ARCS- -----CLASS----ALOG11l
CABS
CliP LX
PAGE
CONTINUE
c
C WRITE THE ENDING BORDER
c
WRITE ( 8 Sill )
c
--VARIABLE IIAP--(LO=A)
-NAIIE--- ADDRESS --BLOCK-----PROPERTIES------TYPE-------- -SIZE
ASCALE
BIN
BUF
DELF
DELY
FilA X
FIIIN
FNPTS
86/12/14. 23.62.67
REAL
REAL
GENERIC
GENERIC
1
1
2
1
INTRINSIC
INTRINSIC
INTRINSIC
INTRINSIC
CHARd
REAL
CHARd
REAL
REAL
REAL
REAL
INTEGER
REAL
CHARd
INTEGER
CHARd
lll24
llll
11ll
/// )
-NAIIE-- -ADDRESS --BLOCK-- ---PROPERTIES------TYPE---------SIZE
PLTFILE
STAR
SUI.!
TIIIEPT
WFREq
X
YAXIS
YI!AX
YIIIN
YPLTDEL
YPLTIIAX
ZVAL
9
643B
644B
4
2651l8
lll
26618
26648
26668
26668
8
2661
DUMIIY-ARG
DUIIWY-ARG
DUIIIIY-ARG
DUIIIIY-ARG
DUIIIIY-ARG
-NAIIE-- ----TYPE---- ---ARGS-- ----CLASS----DATE
SIN
TillE
CHAR•lll
GENERIC
CHARdll
ll
1
ll
FUNCTION
INTRINSIC
FUNCTION
CHAR•7
CHARd
COI.IPLEX
INTEGER
REAL
REAL
REAL
REAL
REAL
REAL
REAL
INTEGER
51
PROGRAW PLOTI
74/760 OPT=8,ROUND= A/ Sf W/-D,-DS
--STATEliENT LABELS-- (LO=A)
-LABEL-ADDRESS---- PROPERTIES----DEF
4e
60
6e
61
INACTIVE
INACTIVE
INACTIVE
INACTIVE
DO-TERW
DO-TERW
DO-TERW
DO-TERII
-LABEL-ADDRESS----PROPERTIES--- -DEF
84
87
96
1e8
--ENTRY POINTS-- (LO=A)
-NAWE---ADDRESS--ARGS--PLOTI
3B
1e
-- I/0 UNITS-- (LO=A)
-NAIIE--- PROPERTIES------------TAPES
AUX/FIIT /SE~
--STATISTICS-PROGRAW-UNIT LENGTH
Cll STORAGE USED
COIIPILE TillE
FTN6 6.1•617
2667B = 1463
614e9B = 26344
2. 062 SECONDS
7e INACTIVE DO-TERW
se INACTIVE DO-TERW
see
84eB
FORWAT
801
844B
FORWAT
l7ll
163
176
177
86/12/14. 28.62.67
PAGE
4
-LABEL-ADDRESS----PROPERTIES--- -DEF
8e2
se3
Se4
se6
864B
494B
412B
416B
FORIIAT
FORWAT
FORWAT
FORWAT
181
186
187
188
52
FUNCTION EFF
74/760 OPT=3,ROUND= A/ S/11/-D,-DS
FTN6 6.1•617
86/12/14. 23.64.77
DO=-LONG/-OT ,ARG=-COIJUON/-FIXED,CS= USER/-FIXED,DB=-TB/-SB/-SL/-ER/- ID/-PIID/-ST, -AL, PL:6000
FTN6, I=FIRLPFD,B=OB.J2, L=LIS, OPT =3
1
2
3
4
6
6
7
8
9
10
11
12
13
14
16
16
17
18
19
20
21
22
23
24
26
26
27
28
29
3e
31
32
33
34
36
36
37
38
39
4e
41
42
43
44
46
46
47
48
c
c----------------------------------------------------------------------C FUNCTION: EFF
C FUNCTION TO CALCULATE THE DESIRED IIAGNITUDE RESPONSE
C AS A FUNCTION OF FRE~UENCY.
C AN ARBITRARY FUNCTION OF FRE~UENCY CAN BE
C APPROXIIIATED IF THE USER REPLACES THIS FUNCTION
C liTH THE APPROPRIATE CODE TO EVALUATE THE IDEAL
C NAGNITUDE. NOTE THAT THE PARAIIETER FREq IS THE
C VALUE OF NORMALIZED FREqUENCY NEEDED FOR EVALUATION.
c----------------------------------------------------------------------c
2
c
C
FUNCTION EFF (FREq, FX, 'fTX, LBAND,JTYPE, EDGE)
DIIIENSION FX(6) ,'fTX(6) ,EDGE ( 1 )
IF(JTYPE.Eq.2) GO TO 1
J =1
DO 2 I = 1, LBAND
IF ( FX ( J ) .LT. 0. ) THEN
FXLOW=-FX(J)
J=J•1
IF ( FX ( J ) .LT. e. ) THEN
FXHIGH = - FX ( J )
J=J•1
ELSE
PRINT •, ' ERROR IN COIIPUTING IIAGNITUDE FUNCTION '
RETURN
END IF
ELSE
FXLOW =FX ( J )
FXHIGH = FX ( J )
J =J • 1
END IF
CONTINUE
IF ( FXLOW .Eq. e•• OR. FXHIGH .E~. e. ) THEN
EFF = e.
ELSE
DELR = ALOG1e ( FXHIGH ) - ALOG1e ( FXLOW )
DELF = EDGE ( 2 * LBAND ) - EDGE ( ( 2 • LBAND ) - 1 )
SLOPE = DELR / DELF
SINTER = ALOG1e ( FXLOW ) - EDGE ( ( 2 • LBAND ) - 1 ) • SLOPE
EFF = 1e •• ( ( FREq • SLOPE ) • BINTER
END IF
EFF=FX(LBAND)
RETURN
1 EFF=FX (LBAND) •FREq
RETURN
END
PAGE
53
FUNCTION EFF
74/760 OPT=S,ROUND= A/ S/ 11/-D,-DS
--VARIABLE IIAP-- (LO=A)
-NAIIE---ADDRESS --BLOCK-----PROPERTIES------TYPE-------- -SIZE
SINTER
DELF
DELR
EDGE
EFF
FRE~
FX
FXHIGH
REAL
REAL
REAL
REAL
REAL
REAL
REAL
REAL
NONE
NONE
NONE
6 DUIIIIY -ARG
NONE
1 DUIIIIY-ARG
2 DUIIIIY-ARG
1828
--PROCEDURES-- (LO=A)
-NAIIE------TYPE- ------ARCS---- --CLASS----ALOG10
REAL
INTRINSIC
--STATEIIENT LABELS-- (LO=A)
-LABEL-ADDRESS---- PROPERTIES----DEF
1
66B
2 INACTIVE DO-TERII
46
33
--ENTRY POINTS-- (LO=A)
-NAIIE---ADDRESS--ARGS--EFF
4B
6
--STATISTICS-PROGRAII-UNIT LENGTH
Cll STORAGE USED
COIIPILE TillE
1838 = 67
613088 = 26288
8.643 SECONDS
FTN6 6.1· 617
PAGE
4
-NAIIE--- ADDRESS --BLOCK-----PROPERTIES------TYPE---------SIZE
FXLOW
I
J
JTYPE
LBAND
SLOPE
6
86/12/H. 23.64. 77
ITX
1018
778
768
6 DUIIIIY-ARG
4 DUIIIIY-ARG
NONE
3 DUYIIY-ARG
REAL
INTEGER
INTEGER
INTEGER
INTEGER
REAL
REAL
6
54
FUNCTION WATE
74/768 OPT=3,ROUND= A/ S/11/-D,-DS
FTN6 6.1•617
86/12/14. 23.64.77
DO=-LONGJ-OT, ARG=-COIIIION/-FIXED,CS= USER/-FIXED,DB=-TB/-SB/-SL/-ER/- ID/-PIID/-ST, -AL,PL=6888
FTN6, I=FIRLPFD, B=OBJ2, L=LIS,OPT =3
1
2
c
c-----------------------------------------------------------------------
3
4
6
6
7
8
9
18
11
12
13
14
16
16
17
18
19
28
C FUNCTION: WATE
C FUNCTION TO CALCULATE THE WEIGHT FUNCTION AS A FUNCTION
C OF FREQUENCY. SIIIILIAR TO THE FUNCTION EFF, THIS FUNCTION CAN
C BE REPLACE BY A USER-WRITTEN ROUTINE TO CALCULATE ANY
C DESIRED WEIGHTING FUNCTION.
C-- ---------------------------------------------------------------------
1
c
c
n
FUNCTION WATE(FREQ,FX,WTX,LBAND,JTYPE,EDGE)
DIIIENSION FX(6) ,WTX(6), EDGE ( 1 )
IF (JTYPE. EQ. 2) GO TO 1
J =1
DO 3 I = 1, LBAND
IF ( WTX ( J ) .LT. 8. ) THEN
WTXLOW = - WTX ( J )
J =J + 1
IF ( WTX ( J ) .LT. 8. ) THEN
WTXHIGH = - WTX ( J )
J=J•1
22
RSE
23
24
26
26
27
28
29
38
31
32
33
34
36
36
37
38
39
40
41
42
43
44
46
PRINT •, ' ERROR IN COIIPUTING WEIGHT FUNCTION '
RETURN
END IF
ELSE
3
c
C
WTXLOW = WTX ( J )
WTXHIGH = WTX ( J )
J=J·l
END IF
CONTINUE
DELR = ALOG18 ( WTXHIGH ) - ALOG10 ( WTXLOW )
OaF = EDGE ( 2 * LBAND ) - EDGE ( ( 2 • LBAND ) - 1 )
SLOPE = DELR / DaF
BINTER = ALOG18 ( WTXLOW ) - EDGE ( ( 2 * LBAND ) - 1 ) • SLOPE
lATE = 18 •• ( ( FREQ • SLOPE ) • BINTER
WATE=WTX (LBAND)
RETURN
1 IF(FX(LBAND).LT.0.0001) GO TO 2
WATE=WTX (LBAND) /FREQ
RETURN
2 WATE=WTX(LBAND)
RETURN
END
--VARIABLE IIAP-- (LO=A)
-NAIIE---ADDRESS --BLOCK -----PROPERTIES------TYPE-------- -SIZE
BINTER
OaF
DELR
EDGE
FREQ
PAGE
NONE
NONE
NONE
6
1
DUIIIIY-ARG
DUIIIIY-ARG
REAL
REAL
REAL
REAL
REAL
1
-NAIIE---ADDRESS --BLOCK---- -PROPERTIES------TYPE---------SIZE
FX
I
J
JTYPE
L8AND
2 DUIIIIY-ARG
1008
778
6 DUIIIIY-ARG
4 DUIIIIY-ARG
REAL
INTEGER
INTEGER
INTEGER
INTEGER
6
55
FUNCTION lATE
74/760 OPT=S,ROUND= A/ S/11/-D,-DS
--VARIABLE IIAP-- (LO=A)
-NAIIE- --ADDRESS --BLOCK-----PROPERTIES------TYPE-- -------SIZE
SLOPE
lATE
WTX
NONE
NONE
3
REAL
REAL
REAL
DUIIIIY-ARG
--PROCEDURES-- (LO=A)
-NAIIE------TYPE--- ----ARCS------CLASS----ALOG10
REAL
INTRINSIC
--STATEIIENT LABELS--(LO=A)
-LABEL-ADDRESS----PROPERTIES----DEF
1
608
2
67B
3 INACTIVE DO-TERII
40
43
31
--ENTRY POINTS--(LO=A)
-NAIIE---ADDRESS--ARGS--lATE
48
6
--STATISTICS-PROGRAII-UN IT LENGTH
Cll STORAGE USED
COIIPILE TillE
1048 = 68
61300B = 26280
0. 630 SECONDS
FTN6 6.1•617
86/12/14. 23.64.77
PAGE
-NAIIE- --ADDRESS --BLOCK-----PROPERTIES------TYPE---------SIZE
WTXHIGH
ITXLOI
103B
102B
REAL
REAL
Appendix D
Hilbert transform design
56
57
This
section
illustrates
coefficients generated by
Instruments TMS32020.
In
processor architecture must
filter structure.
the
the
implementation of a filter
filter design
order to design
be
taken
In our example we
into
program
in
using
a Texas
an efficient system, the
account when selecting a
shall use filter coefficients
generated by the filter design program where all even numbered weights
are zero.
The filter design is listed below.
**********************************************************************
FINITE IMPULSE RESPONSE (FIR)
LINEAR PHASE DIGITAL FILTER DESIGN
REMEZ EXCHANGE ALGORITHM
HILBERT TRANSFORMER
FILTER LENGTH
=
35
***** IMPULSE RESPONSE *****
1) = 0.23116698E-02 = -H(
2) = -0.22630682E-05 = -H(
3) = 0.54979441E-02 = -H(
4) = -0.25509983E-05 = -H(
5) = 0.11538464E-01 = -H(
6) = -0.34073028E-05 = -H(
7) = 0.21476556E-01 = -H(
8) = -0.35446828E-05 = -H(
9) = 0.37189338E-01 = -H(
10) = -0.55907085E-05 = -H(
11) = 0.62193289E-01 = -H(
12) = -0.58701225E-05 = -H(
13) = 0.10521287E+OO = -H(
14) = -0.43803084E-05 = -H(
15) = 0.19826448E+OO = -H(
16) = -0.34141267E-05 = -H(
17) = 0.63185513E+OO = -H(
H( 18) - 0.0
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
H(
LOWER BAND EDGE
UPPER BAND EDGE
DESIRED VALUE
WEIGHTING
DEVIATION
BAND 1
0.050000001
0.449999988
1.000000000
1.000000000
0.001349066
35)
34)
33)
32)
31)
30)
29)
28)
27)
26)
25)
24)
23)
22)
21)
20)
19)
58
EXTREMA FREQUENCIES
0.0500000
0.0555147
0.1419118
0.1676472
0.2779414
0.3055149
0.4084562
0.4286768
0.1161765
0.2503678
0.3845591
0.0922794
0.2227943
0.3588238
0.0720588
0.1952207
0.3312503
0.4433827
**********************************************************************
We shall introduce and examine polyphase
filters in our search for an
efficient Hilbert transform filter structure.
POLYPHASE FILTERS
Polyphase filter structures have
been
are very computationally efficient.
recognized as filters that
They are
used
in multirate
systems to change the sampling rate of a signal.
Interpolation is the process
of
increasing
the sampling rate by
calculating sample values between existing data points.
to interpolation
is
to
"zero pack"
the original
lowpass filter the resulting sequence.
means that one or more
points.
zeros
are
One approach
time series and
The process of "zero packing"
inserted between existing data
This causes the sampling
rate to increase from T samples per
second to ( P + 1 ) * T samples
per second where P is the number of
zeros inserted between sample points.
the frequency domain is that
P + 1 times.
If the
The result of "zero packing" in
the original spectrum becomes replicated
resulting sequence is lowpass filtered such that
the higher spectral copies are
removed,
interpolation of the original
time
filter is applied
sequence with
to
a time
the resulting sequence is an
sequence.
When
a FIR lowpass
interleaved zeros, the
59
convolution sum has many products which are equal
to zero.
We can
divide the lowpass filter into a group of subfilters, where the set of
filter coefficients required to calculate an output point are those
which intersect the non-zero data points
filter's impulse response.
As
the
in
the span of the lowpass
input data is convolved with the
lowpass filter's impulse response, the non-zero data samples intersect
a different subset of the filter's
impulse response.
of these subfilters
a polyphase filter.
is
known
as
The collection
Figure 1
illustrates a 1-to-2 polyphase interpolator.
Each data point is fed
into two different subfilters ( ;1 and ;2 ).
The commutator samples
the output of both subfilters for each input data point resulting in a
sampling rate increase of two.
I
0
0
I
Figure 1.
A
I
v
•
Output
Polyphase interpolator
Decimation is the reverse operation of interpolation.
The polyphase
structure for a decimator has a commutator on the input and a summing
node on the output.
The polyphase
minimizes the amount of data movement.
not moved by the structure.
filter
is efficient because it
That is, interleaved zeros are
60
In our Hilbert transform example,
interleaved zeros.
we have a weight function with
A filter structure based on polyphase filters can
be created which only uses
those data points that intersect the non-
zero values of the weight function.
Since we are shuffling input data
points as opposed to filter weight coefficients, the filter phases
(¢•s) are the same for all branches.
The modified polyphase structure
is illustrated in Figure 2.
¢
1
I
Input--•
I
" 0
0
"
v
0
v
I
0
I
Figure 2.
I
¢
•
Output
1
Modified Polyphase structure
The operation of the commutators
is
data movement of a seven-point filter
( Figure 3 ) versus
I
illustrated by comparing the
implemented in the direct form
the modified polyphase structure ( Figure 4 ).
The modified polyphase structure
is more efficient than the direct
form because data movement has been minimized.
61
Q
h7
h6= 0
h5
h4= 0
h3
h2= 0
hl
x(n)
x7
x6
x5
x4
x3
x2
xl
y(n)
x(n+l)
xa
x7
x6
x5
x4
x3
x2
y(n+l)
x(n+2)
Xg
xa
x7
x6
x5
x4
x3
y(n+2)
Direct Form
Figure 3.
Input
A
0!
- · vI 0I
Figure 4.
h7
h5
h3
hl
x7
x5
x3
xl
x8
x6
x4
x2
6I
A
0
I
•--Output
v
Modified Polyphase structure
PROGRAMMABLE SIGNAL PROCESSORS
The Texas Instruments TMS32020
introduced within
the
last
is one of several microprocessors
five
years whose architecture is
specifically designed for arithmetic operations that occur frequently
in digital
signal
processing applications.
We shall
use this
processor to implement a filter whose coefficients have been generated
by the filter design program.
'
62
ARCHITECTURAL ASPECTS
The TMS32020
multiplication.
uses a
dedicated
hardware element to perform
This feature
allows
it to perform multiplication in
the same time that is required to do an add or data move ( z-1 ).
addition, the
instruction
set
operations to occur during one
the MACD instruction.
The
has
In
been tailored to allow several
instruction.
use of this
One such instruction is
instruction along with the
repeat instruction allows the calculation of a sum of products with
data move
( z-1
).
A digital
instructions has an execution time
filter realization
that
is determined by the maximum
of either the sum of products or data moves.
example
(Appendix D),
Program execution is
In our Hilbert transform
every other filter coefficient
limited by the
z-2
of the zero coefficients
The modified polyphase
used in the TMS32020 to take advantage
in the weight function.
implement the direct form filter
( Figure 3 )
polyphase structure for the Hilbert transformer
written, assembled, and linked
and
linker
(Appendix E).
is zero.
terms when the filter is
implemented in the direct form ( Figure 3 ).
structure ( Figure 4 ) can be
using these
using
The software to
and the modified
( Figure 4 ) was
the Texas Instruments assembler
A TMS32020
software simulator
resident ) was used to filter input data sets.
( VAX
The modified polyphase
implementation results in a saving of (N-1)/2 + 1 machine instructions
as opposed to the direct form
implementation
( Figure 5 ).
The
penalty paid for the modified polyphase structure is a slightly more
complex software program.
63
Set address pointer
1
1
Fetch data point
1
1
Prepare for sum of products
3
3
Sum of products
N+ 3
Three bit shift
3
3
Output data point
2
2
Loop
2
1
Total
N + 15
Figure 5.
note that the finite
(N+1)/2 + 3
(N+1)/2 + 14
Instruction cycle count
When using a fixed point machine
output.
Polyphase
Standard
Operation
such
as the TMS32020, one must
arithmetic can add computational noise to the
Coefficient quantization to
of one part in 16383 or less
have been normalized.
The
sixteen bits result in an error
than 0.01 percent for coefficients that
instruction
set of the TMS32020 is
efficient for implementing filter in direct form 1.
While other forms
yield lower computational noise, the
hardware registers are such that
the computational
is
noise generated
negligible
for most cases.
Filter implementation of direct form 1 is a sum of products operation.
In a fixed point machine, filter coefficients are normalized such that
the binary point is located after bit 15.
format.
Data is also assumed to be
resulting product is a 830 number.
This is known as the 815
in the 815 format and the
Prior to adding the product to the
64
accumulator, the product is shifted right
six bits (824).
The right
shift allows up to 127 sums to be taken without accumulator overflow.
Prior to storing the accumulator in an external register, the sum can
be shifted left four bits
in the
store instruction.
When the upper
sixteen bits are saved, the resulting value is a 812 number resulting
in an overall gain of 0.125 unless additional machine instructions are
used to shift an additional three bits for a gain of unity.
Appendix E
TMS32020 Listings
65
66
HILBERTT
TMS32020 MACRO ASSEMBLER
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 0000
0035 0000 FF80 1
0001 0025
0036 0002
0037 0002 FFB4
0038 0003 0000
0039 0004 FF4C
0040 0005 0000
0041 0006 FE86
0042 0007 0000
0043 0008 FD40
0044 0009 0000
0045 OOOA FB3D
0046 OOOB 0000
0047 OOOC F80A
0048 OOOD 0000
0049 OOOE F288
0050 OOOF 0000
0051 0010 E69F
0052 0011 0000
0053 0012 AFlF
0054 0013 0000
0055 0014 50El
0056 0015 0000
1.0 85.155
14:12:42 12/29/86
PAGE 0001
IDT
HILBERTT
************************************************************
1
1
*
*
* Wayne Wadamoto 29-DEC-1986
*
* Abstract:
*
* This program calculates the imaginary portion of the
* Modification History:
* Hilbert transform using coeffic1ents calculated by the
*McClellan I Parks filter design program. The filter
*design coefficients are as follows
*
*
*
*
*
*
*
Length
Type
Nbands
Grid
Lo edge
Hi edge
Resp
Weight
-
35
3 ( Hilbert transformer )
1
16 ( default )
0.05
0.45
1.0
1.0
*
*
*
* Coefficients are read into internal program memory in
* reverse order along with the necessary 1nstructions
* to perform the filtering operation. Input data is
* comes from port PAO and the imaginary portion goes to
*port PAl. The real portion of the Hilbert transform
* can be extracted by tapping the value at the
*appropriate location in the delay line. The filter
* is implemented in direct form 1
*
************************************************************
B
COEFOO
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
BEGIN
FFB4
000
FF4C
000
FE86
000
FD40
000
FB3D
000
F80A
000
F288
000
E69F
000
FlF
000
OEl
000
-0.002311669756
0.000000000000
-0.005497944076
0.000000000000
-0.011538463645
0.000000000000
-0.021476555616
0.000000000000
-0.037189338356
0.000000000000
-0.062193289399
0.000000000000
-0.105212867260
0.000000000000
-0.198264479637
0.000000000000
-0.631855130196
0.000000000000
0.631855130196
0.000000000000
67
HILBERTT
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
008Z
0083
0084
0085
0086
0087
TMS3ZOZO MACRO ASSEMBLER
1961
0000
OD78
0000
07F6
0000
04C3
0000
02CO
0000
017A
0000
oozz 0084
0023 0000
OOZ4 004C
OOZ5
0023
0200
0300
FFOO
FFOO
0004
0028
OOZ8 0400
OOZ9 0324
0088 002A 7400
0089 OOZB
0090
0091 OOZB
0092 0028 0400
ooze 0200
0093 OOZD
0094 OOZD CBZZ
0095 OOZE FCAO
OOZF OOOZ'
0096 0030
0097
0098 0030
0099 0030 CBOC
0100 0031 FCAO
003Z 0036'
0101 0033
0102
0103 0033
0104 0033 CE05
0105
0106 0034
FFZ3
0107
0108 0034
0109 0034 FF80
COEFCT
BLKBO
BLKB1
BLKBOP
COEFST
SHIFT
*
BEGIN
EQU
EQU
EQU
EQU
EQU
EQU
LARP
LDPK
SPM
14:1Z:4Z 1Z/Z9/86
PAGE OOOZ
0.198Z64479637
0.000000000000
0.105Z12867260
0.000000000000
0.06Z193289399
0.000000000000
0.037189338356
0.000000000000
O.OZ1476555616
0.000000000000
0.011538463645
0.000000000000
0.005497944076
0.000000000000
O.OOZ311669756
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
0016
0017
0018
0019
OOlA
0018
001C
0010
001E
001F
OOZO
OOZ1
OOZ5
OOZ5 558C
0026 C806
OOZ7 CEOB
0028
1.0 85.155
$-COEFOO
~200
300
FFOO
BLKBOP
~
AR4
6
3
* define some addresses and move them on-chip
LRLK
AR4,ADDRO
SAR
AR4,POADDR
* move the coefficients to on-chip memory
LRLK
AR4,BLKBO
RPTK
BLKP
COEFCT-1
COEFOO,*+
* move the filtering kernal to on-chip memory
RPTK
BLKP
KERNAL
START,*+
* configure the block as program memory
CNFP
* go to the kernal
AGAIN EQU
B
BLKBOP+COEFCT
AGAIN
68
Q
HILBERTT
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
TMS32020 MACRO ASSEMBLER
0035 FF23
0036
0036
0036
0036
0037
0037
0038
0038
0039
003A
003B
003C
0030
003E
003F
0040
0040
0041
0042
0128
0129
0130 0042
0131
0132 0042
0133 0300
0134
0135 0300
0136 0301
0137
0138 0301
0139 0302
0140
0141 0302
0142
0143 0325
0144
NO ERRORS,
1.0 85.155
*
0036' START EQU
$
3400
LAR
AR4,POADDR
8002
IN
INPUTO,PAO
AOOO
CAOO
CB22
5C90
FFOO
CE15
6C01
E201
MPYK
ZAC
RPTK
MACD
0
APAC
SACH
OUT
IMAG,SHIFT
IMAG,PA2
FF80
FF23
B
AGAIN
oooc
KERNAL EQU
COEFCT-1
COEFST,*-
$-START
* define on chip block B1
OORG
0000 POADDR EQU
BSS
BLKB1
$-BLKB1
1
BSS
EQU
$-BLKB1
1
0002 INPUTO EQU
BSS
0324 ADDRO EQU
$-BLKB1
COEFCT
$-1
0001 IMAG
NO WARNINGS
END
14:12:42 12/29/86
PAGE 0003
'
69
POLYHILB
TMS32020 MACRO ASSEMBLER
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 0000
0035 0000 FF80
0001 0014'
0036 0002
0037 0002 FF84
0038 0003 FF4C
0039 0004 FE86
0040 0005 FD40
0041 0006 FB3D
0042 0007 F80A
0043 0008 F288
0044 0009 E69F
0045 OOOA AFlF
0046 OOOB 50El
0047 oooc 1961
0048 OOOD OD78
0049 OOOE 07F6
0050 OOOF 04C3
0051 0010 02CO
0052 0011 017A
0053 0012 0084
0054 0013 004C
0055 0014
0056
0012
1.0 85.155
14:12:24 12/29/86
PAGE 0001
IDT
'POLYHILB'
************************************************************
*
* Modification History:
*
* Wayne Wadamoto 29-DEC-1986
*
* Abstract:
*
* This program calculates the imaginary portion of the
* Hilbert transform using coeffic1ents calculated by the
*McClellan I Parks filter design program. The filter
*design coefficients are as follows
*
Length
*
Type
*
Nbands
*
Grid
*
Lo edge
*
Hi edge
*
Resp
*
Weight
*
*
* Coefficients
-
35
3 ( Hilbert transformer )
1
16 ( default )
0.05
0.45
1.0
1.0
are read into internal program merory in
* reverse order along with the necessary 1nstructions
* to perform the filtering operation. Input data is
* comes from port PAO and the imaginary portion goes to
* port PAl. The real portion of the Hilbert transform
* can be extracted by tapping the value at the
*appropriate location in the delay line. The filter
* implementation is the oodified polyphase structure.
*
************************************************************
B
COEFOO
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
DATA
COEFCT EQU
BEGIN
FF84
FF4C
FE86
FD40
FB3D
F80A
F288
E69F
FlF
OEl
1961
D78
7F6
4C3
2CO
17A
084
04C
$-COEFOO
-0.002311669756
-0.005497944076
-0.011538463645
-0.021476555616
-0.037189338356
-0.062193289399
-0.105212867260
-0.198264479637
-0.631855130196
0.631855130196
0.198264479637
0.105212867260
0.062193289399
0.037189338356
0.021476555616
0.011538463645
0.005497944076
0.002311669756
70
POLYHILB
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
TMS32020 MACRO ASSEMBLER
0200
0300
FFOO
FFOO
0004
BLKBO
BLKB1
BLKBOP
COEFST
SHIFT
*
EQU
EQU
EQU
EQU
EQU
~
1.0 85.155
14:12:24 12/29/86
PAGE 0002
200
300
FOO
BLKBOP
~
BEGIN
0014
AR4
LARP
0014 558C
LDPK
6
0015 C806
SPM
3
0016 CEOB
0017
* define some addresses and move them on-chip
0017
LRLK
AR4,ADDRO
0017 0400
0018 0314
SAR
AR4,POADDR
0019 7400
AR4,ADDR1
LRLK
001A 0400
001B 0326
AR4,P1ADDR
SAR
001C 7401
0010
* move the coefficients to on-chip memory
0010
AR4,BLKBO
LRLK
0010 0400
001E 0200
001F
COEFCT-1
RPTK
001F CBll
COEFOO,*+
BLKP
0020 FCAO
0021 0002'
0022
*move the filtering kernal to on-chip memory
0022
KERNAL
RPTK
0022 CB16
START,*+
BLKP
0023 FCAO
0024 0028'
0025
* configure the b1ock as program memory
0025
CNFP
0025 CE05
* go to the kernal
0026
BLKBOP+COEFCT
FF12 AGAIN EQU
0026
AGAIN
B
0026 FF80
0027 FF12
0028
* phase 0
0028
$
0028' START EQU
0028
AR4,POADDR
LAR
0028 3400
0029
INPUTO,PAO
IN
0029 8003
002A
MPYK
0
002A AOOO
ZAC
002B CAOO
COEFCT-1
RPTK
002C CBll
COEFST,*MACD
0020 5C90
71
POLYHILB
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
002E
002F
0030
0031
0032
0032
0032
0033
0033
0034
0034
0035
0036
0037
0038
0039
003A
0038
003C
003C
0030
003E
0127
0128
0129 003E
0130
0131 003E
0132 0300
0133
0134 0300
0135
0136 0301
0137 0302
0138
0139 0302
0140 0303
0141
0142 0303
0143
0144 030C
0145
0146 0315
0147
0148 0315
0149
0150 031E
0151
0152
NO ERRORS,
TMS32020 MACRO ASSEMBLER
FFOO
CE15
6C02
E202
APAC
SACH
OUT
1.0 85.155
IMAG,SHIFT
IMAG,PA2
* phase 1
3401
LAR
AR4,P1ADDR
8015
IN
INPUTl,PAO
AOOO
CAOO
CB11
5C90
FFOO
CE15
6C02
E202
MPYK
ZAC
RPTK
MACD
0
FF80
FF12
COEFCT-1
COEFST,*-
APAC
SACH
OUT
IMAG,SHIFT
IMAG,PA2
B
AGAIN
0016 KERNAL EQU
$-START
* define on chip block 81
OORG
0000 POADDR EQU
BSS
0001 P1ADDR EQU
BSS
BLKB1
$-BLKB1
1
$-BLKB1
1
0002 IMAG
$-BLKB1
1
EQU
BSS
0003 INPUTO EQU
BSS
oooc REALI EQU
BSS
0314 ADDRO EQU
$-BLKB1
COEFCT/2
$-BLKB1
COEFCT/2
$-1
0015 INPUTl EQU
BSS
001E REALO EQU
BSS
0326 ADDR1 EQU
END
NO WARNINGS
$-BLKB1
COEFCT/2
$-BLKB1
COEFCT/2
$-1
14:12:24 12/29/86
PAGE 0003