1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
module fil6521_mod
implicit none
contains
subroutine fil6521(c1, n1, c2, n2)
implicit none
!--------------------------------------------------------------------
! Arguments
!--------------------------------------------------------------------
integer, intent(in) :: n1
integer, intent(out) :: n2
complex, intent(in) :: c1(n1)
complex, intent(out) :: c2(n1/4) ! NDOWN = 4
!--------------------------------------------------------------------
! Parameters
!--------------------------------------------------------------------
integer, parameter :: NTAPS = 21
integer, parameter :: NH = (NTAPS - 1)/2
integer, parameter :: NDOWN = 4
!--------------------------------------------------------------------
! Locals
!--------------------------------------------------------------------
integer :: i, j, k, k0
real :: a(-NH:NH)
!--------------------------------------------------------------------
! Filter coefficients (ScopeFIR)
!--------------------------------------------------------------------
data a / &
-0.011958606980, -0.013888627387, -0.015601306443, -0.010602249570, &
0.003804023436, 0.028320058273, 0.060903935217, 0.096841904411, &
0.129639871228, 0.152644580853, 0.160917511283, 0.152644580853, &
0.129639871228, 0.096841904411, 0.060903935217, 0.028320058273, &
0.003804023436, -0.010602249570, -0.015601306443, -0.013888627387, &
-0.011958606980 /
!--------------------------------------------------------------------
! Compute output length and starting offset
!--------------------------------------------------------------------
n2 = (n1 - NTAPS + NDOWN) / NDOWN
k0 = NH - NDOWN + 1
!--------------------------------------------------------------------
! FIR filtering + decimation by 4
!--------------------------------------------------------------------
do i = 1, n2
c2(i) = (0.0, 0.0)
k = k0 + NDOWN * i
do j = -NH, NH
c2(i) = c2(i) + c1(j + k) * a(j)
end do
end do
end subroutine fil6521
end module fil6521_mod
|