Speed up gen_fst280wave() by nearly x10 for longest FST280 transmissions.

This commit is contained in:
Joe Taylor 2020-06-23 15:08:56 -04:00
parent c709b349ba
commit 344b9c11f3

View File

@ -1,21 +1,31 @@
subroutine gen_fst280wave(itone,nsym,nsps,nwave,fsample,hmod,f0, &
icmplx,cwave,wave)
parameter(NTAB=65536)
real wave(nwave)
complex cwave(nwave)
complex cwave(nwave),ctab(0:NTAB-1)
real, allocatable, save :: pulse(:)
real, allocatable :: dphi(:)
integer hmod
integer itone(nsym)
! integer*8 count0,count1,clkfreq
logical first
data first/.true./
data nsps0/-99/
save first,twopi,dt,tsym,nsps0
save first,twopi,dt,tsym,nsps0,ctab
! call system_clock(count0,clkfreq)
if(first) then
twopi=8.0*atan(1.0)
do i=0,NTAB-1
phi=i*twopi/NTAB
ctab(i)=cmplx(cos(phi),sin(phi))
enddo
endif
if(first.or.nsps.ne.nsps0) then
if(allocated(pulse)) deallocate(pulse)
allocate(pulse(1:3*nsps))
twopi=8.0*atan(1.0)
dt=1.0/fsample
tsym=nsps/fsample
! Compute the smoothed frequency-deviation pulse
@ -46,12 +56,15 @@ subroutine gen_fst280wave(itone,nsym,nsps,nwave,fsample,hmod,f0, &
k=0
do j=0,(nsym+2)*nsps-1
k=k+1
i=phi*float(NTAB)/twopi
i=iand(i,NTAB-1)
if(icmplx.eq.0) then
wave(k)=sin(phi)
wave(k)=real(ctab(i))
else
cwave(k)=cmplx(cos(phi),sin(phi))
cwave(k)=ctab(i)
endif
phi=mod(phi+dphi(j),twopi)
phi=phi+dphi(j)
if(phi.gt.twopi) phi=phi-twopi
enddo
! Compute the ramp-up and ramp-down symbols
@ -73,5 +86,10 @@ subroutine gen_fst280wave(itone,nsym,nsps,nwave,fsample,hmod,f0, &
(1.0+cos(twopi*(/(i,i=0,nsps/2-1)/)/real(nsps)))/2.0
endif
! call system_clock(count1,clkfreq)
! tt=float(count1-count0)/float(clkfreq)
! write(*,3001) tt
!3001 format('Tgen:',f8.3)
return
end subroutine gen_fst280wave