Silence compiler warnings; reformmat some source code.

This commit is contained in:
Joe Taylor 2020-03-19 13:13:33 -04:00
parent d4d37c49ab
commit d5e92202d0
5 changed files with 256 additions and 254 deletions

View File

@ -33,6 +33,7 @@ do j=1,M
enddo
ncnt=0
nclast=0
do iter=0,maxiterations

View File

@ -102,7 +102,7 @@ contains
if(nsubmode.ge.100) then
! This is QRA64 mode
mode64=2**(nsubmode-100)
call qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
call qra64a(dd,npts,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
emedelay,mycall,hiscall,hisgrid,sync,nsnr,dtx,nfreq,decoded,nft)
if (associated(this%callback)) then
ndrift=0

View File

@ -1,27 +1,27 @@
subroutine osd128_90(llr,apmask,ndeep,message77,cw,nhardmin,dmin)
!
! An ordered-statistics decoder for the (128,90) code.
!
integer, parameter:: N=128, K=90, M=N-K
integer*1 apmask(N),apmaskr(N)
integer*1 gen(K,N)
integer*1 genmrb(K,N),g2(N,K)
integer*1 temp(K),m0(K),me(K),mi(K),misub(K),e2sub(N-K),e2(N-K),ui(N-K)
integer*1 r2pat(N-K)
integer indices(N),nxor(N)
integer*1 cw(N),ce(N),c0(N),hdec(N)
integer*1 decoded(K)
integer*1 message77(77)
integer indx(N)
real llr(N),rx(N),absrx(N)
include "ldpc_128_90_generator.f90"
! Ordered-statistics decoder for the (128,90) code.
logical first,reset
data first/.true./
save first,gen
integer, parameter:: N=128, K=90, M=N-K
integer*1 apmask(N),apmaskr(N)
integer*1 gen(K,N)
integer*1 genmrb(K,N),g2(N,K)
integer*1 temp(K),m0(K),me(K),mi(K),misub(K),e2sub(N-K),e2(N-K),ui(N-K)
integer*1 r2pat(N-K)
integer indices(N),nxor(N)
integer*1 cw(N),ce(N),c0(N),hdec(N)
integer*1 decoded(K)
integer*1 message77(77)
integer indx(N)
real llr(N),rx(N),absrx(N)
if( first ) then ! fill the generator matrix
include "ldpc_128_90_generator.f90"
logical first,reset
data first/.true./
save first,gen
if( first ) then ! fill the generator matrix
gen=0
do i=1,M
do j=1,23
@ -37,29 +37,34 @@ if( first ) then ! fill the generator matrix
do irow=1,K
gen(irow,irow)=1
enddo
first=.false.
endif
first=.false.
endif
rx=llr
apmaskr=apmask
rx=llr
apmaskr=apmask
d1=0.
ntheta=0
npre1=0
npre2=0
nt=0
! Hard decisions on the received word.
hdec=0
where(rx .ge. 0) hdec=1
hdec=0
where(rx .ge. 0) hdec=1
! Use magnitude of received symbols as a measure of reliability.
absrx=abs(rx)
call indexx(absrx,N,indx)
absrx=abs(rx)
call indexx(absrx,N,indx)
! Re-order the columns of the generator matrix in order of decreasing reliability.
do i=1,N
! Re-order columns of generator matrix in order of decreasing reliability.
do i=1,N
genmrb(1:K,i)=gen(1:K,indx(N+1-i))
indices(i)=indx(N+1-i)
enddo
enddo
! Do gaussian elimination to create a generator matrix with the most reliable
! received bits in positions 1:K in order of decreasing reliability (more or less).
do id=1,K ! diagonal element indices
do id=1,K ! diagonal element indices
do icol=id,K+20 ! The 20 is ad hoc - beware
iflag=0
if( genmrb(id,icol) .eq. 1 ) then
@ -80,9 +85,9 @@ do id=1,K ! diagonal element indices
exit
endif
enddo
enddo
enddo
g2=transpose(genmrb)
g2=transpose(genmrb)
! The hard decisions for the K MRB bits define the order 0 message, m0.
! Encode m0 using the modified generator matrix to find the "order 0" codeword.
@ -90,58 +95,58 @@ g2=transpose(genmrb)
! codewords. Return the member of the list that has the smallest Euclidean
! distance to the received word.
hdec=hdec(indices) ! hard decisions from received symbols
m0=hdec(1:K) ! zero'th order message
absrx=absrx(indices)
rx=rx(indices)
apmaskr=apmaskr(indices)
hdec=hdec(indices) ! hard decisions from received symbols
m0=hdec(1:K) ! zero'th order message
absrx=absrx(indices)
rx=rx(indices)
apmaskr=apmaskr(indices)
call mrbencode90(m0,c0,g2,N,K)
nxor=ieor(c0,hdec)
nhardmin=sum(nxor)
dmin=sum(nxor*absrx)
call mrbencode90(m0,c0,g2,N,K)
nxor=ieor(c0,hdec)
nhardmin=sum(nxor)
dmin=sum(nxor*absrx)
cw=c0
ntotal=0
nrejected=0
cw=c0
ntotal=0
nrejected=0
if(ndeep.eq.0) goto 998 ! norder=0
if(ndeep.gt.5) ndeep=5
if( ndeep.eq. 1) then
if(ndeep.eq.0) goto 998 ! norder=0
if(ndeep.gt.5) ndeep=5
if( ndeep.eq. 1) then
nord=1
npre1=0
npre2=0
nt=12
ntheta=3
elseif(ndeep.eq.2) then
elseif(ndeep.eq.2) then
nord=1
npre1=1
npre2=0
nt=18
ntheta=4
elseif(ndeep.eq.3) then
elseif(ndeep.eq.3) then
nord=1
npre1=1
npre2=0
nt=12
ntheta=4
elseif(ndeep.eq.4) then
elseif(ndeep.eq.4) then
nord=1
npre1=1
npre2=1
nt=12
ntheta=4
ntau=15
elseif(ndeep.eq.5) then
elseif(ndeep.eq.5) then
nord=1
npre1=1
npre2=1
nt=12
ntheta=4
ntau=5
endif
endif
do iorder=1,nord
do iorder=1,nord
misub(1:K-iorder)=0
misub(K-iorder+1:K)=1
iflag=K-iorder+1
@ -189,9 +194,9 @@ do iorder=1,nord
! when the last pattern with weight iorder has been generated.
call nextpat90(misub,k,iorder,iflag)
enddo
enddo
enddo
if(npre2.eq.1) then
if(npre2.eq.1) then
reset=.true.
ntotal=0
do i1=K,1,-1
@ -240,22 +245,22 @@ if(npre2.eq.1) then
enddo
call nextpat90(misub,K,nord,iflag)
enddo
endif
endif
998 continue
! Re-order the codeword to [message bits][parity bits] format.
cw(indices)=cw
hdec(indices)=hdec
decoded=cw(1:K)
call chkcrc13a(decoded,nbadcrc)
message77=decoded(1:77)
if(nbadcrc.eq.1) nhardmin=-nhardmin
cw(indices)=cw
hdec(indices)=hdec
decoded=cw(1:K)
call chkcrc13a(decoded,nbadcrc)
message77=decoded(1:77)
if(nbadcrc.eq.1) nhardmin=-nhardmin
return
return
end subroutine osd128_90
subroutine mrbencode90(me,codeword,g2,N,K)
integer*1 me(K),codeword(N),g2(N,K)
integer*1 me(K),codeword(N),g2(N,K)
! fast encoding for low-weight test patterns
codeword=0
do i=1,K
@ -263,7 +268,7 @@ integer*1 me(K),codeword(N),g2(N,K)
codeword=ieor(codeword,g2(1:N,i))
endif
enddo
return
return
end subroutine mrbencode90
subroutine nextpat90(mi,k,iorder,iflag)
@ -368,4 +373,3 @@ subroutine fetchit90(reset,e2,ntau,i1,i2)
lastpat=ipat
return
end subroutine fetchit90

View File

@ -1,4 +1,4 @@
subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
subroutine qra64a(dd,npts,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
emedelay,mycall_12,hiscall_12,hisgrid_6,sync,nsnr,dtx,nfreq,decoded,nft)
use packjt
@ -151,8 +151,5 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
endif
call timer('qra64a ',1)
! write(71,3001) nutc,dtx,f0,sync,sync2,width,minsync,decoded
!3001 format(i4.4,f7.2,4f8.1,i3,2x,a22)
return
end subroutine qra64a

View File

@ -39,7 +39,7 @@ program qratest
if(nfqso0.ne.-1) nfqso=nfqso0
if(ntol0.ne.-1) ntol=ntol0
call qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
call qra64a(dd,npts,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
mycall,hiscall,hisgrid,sync,nsnr,dtx,nfreq,decoded,nft)
c='a'
if(mode64.eq.2) c='b'