mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
Bring ldpcsim40.f90 up to date and add coherent averaging option to both ldpcsim144 and ldpcsim40. These routines simulate only the performance of the code and the hash/CRC.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7580 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
9a895361cf
commit
fa45380b51
@ -14,7 +14,7 @@ integer*1 i1hash(4)
|
|||||||
integer*1 msgbits(80)
|
integer*1 msgbits(80)
|
||||||
integer*4 i4Msg6BitWords(13)
|
integer*4 i4Msg6BitWords(13)
|
||||||
integer ihash
|
integer ihash
|
||||||
real*8, allocatable :: lratio(:), rxdata(:)
|
real*8, allocatable :: lratio(:), rxdata(:), rxavgd(:)
|
||||||
real, allocatable :: yy(:), llr(:)
|
real, allocatable :: yy(:), llr(:)
|
||||||
equivalence(ihash,i1hash)
|
equivalence(ihash,i1hash)
|
||||||
|
|
||||||
@ -24,14 +24,14 @@ enddo
|
|||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.4) then
|
if(nargs.ne.4) then
|
||||||
print*,'Usage: ldpcsim niter ndither #trials s '
|
print*,'Usage: ldpcsim niter navg #trials s '
|
||||||
print*,'eg: ldpcsim 10 1 1000 0.75'
|
print*,'eg: ldpcsim 10 1 1000 0.75'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call getarg(1,arg)
|
call getarg(1,arg)
|
||||||
read(arg,*) max_iterations
|
read(arg,*) max_iterations
|
||||||
call getarg(2,arg)
|
call getarg(2,arg)
|
||||||
read(arg,*) max_dither
|
read(arg,*) navg
|
||||||
call getarg(3,arg)
|
call getarg(3,arg)
|
||||||
read(arg,*) ntrials
|
read(arg,*) ntrials
|
||||||
call getarg(4,arg)
|
call getarg(4,arg)
|
||||||
@ -44,10 +44,10 @@ rate=real(K)/real(N)
|
|||||||
|
|
||||||
write(*,*) "rate: ",rate
|
write(*,*) "rate: ",rate
|
||||||
|
|
||||||
write(*,*) "niter= ",max_iterations," ndither= ",max_dither," s= ",s
|
write(*,*) "niter= ",max_iterations," navg= ",navg," s= ",s
|
||||||
|
|
||||||
allocate ( codeword(N), decoded(K), message(K) )
|
allocate ( codeword(N), decoded(K), message(K) )
|
||||||
allocate ( lratio(N), rxdata(N), yy(N), llr(N) )
|
allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) )
|
||||||
|
|
||||||
msg="K9AN K1JT EN50"
|
msg="K9AN K1JT EN50"
|
||||||
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||||
@ -95,11 +95,16 @@ do idb = -6, 14
|
|||||||
nbadhash=0
|
nbadhash=0
|
||||||
|
|
||||||
do itrial=1, ntrials
|
do itrial=1, ntrials
|
||||||
call sgran()
|
rxavgd=0d0
|
||||||
|
do iav=1,navg
|
||||||
|
call sgran()
|
||||||
! Create a realization of a noisy received word
|
! Create a realization of a noisy received word
|
||||||
do i=1,N
|
do i=1,N
|
||||||
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
|
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
|
||||||
|
enddo
|
||||||
|
rxavgd=rxavgd+rxdata
|
||||||
enddo
|
enddo
|
||||||
|
rxdata=rxavgd
|
||||||
|
|
||||||
! Correct signal normalization is important for this decoder.
|
! Correct signal normalization is important for this decoder.
|
||||||
rxav=sum(rxdata)/N
|
rxav=sum(rxdata)/N
|
||||||
|
@ -7,39 +7,41 @@ use packjt
|
|||||||
character*22 msg,msgsent,msgreceived
|
character*22 msg,msgsent,msgreceived
|
||||||
character*8 arg
|
character*8 arg
|
||||||
integer*1, allocatable :: codeword(:), decoded(:), message(:)
|
integer*1, allocatable :: codeword(:), decoded(:), message(:)
|
||||||
real*8, allocatable :: lratio(:), rxdata(:)
|
real*8, allocatable :: rxdata(:), rxavgd(:)
|
||||||
real, allocatable :: llr(:)
|
real, allocatable :: llr(:)
|
||||||
integer ihash
|
integer ihash
|
||||||
integer*1 hardbits(32)
|
integer*1 hardbits(32)
|
||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.4) then
|
if(nargs.ne.4) then
|
||||||
print*,'Usage: ldpcsim niter ndither #trials s '
|
print*,'Usage: ldpcsim niter navg #trials s '
|
||||||
print*,'eg: ldpcsim 10 1 1000 0.75'
|
print*,'eg: ldpcsim 10 1 1000 0.75'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call getarg(1,arg)
|
call getarg(1,arg)
|
||||||
read(arg,*) max_iterations
|
read(arg,*) max_iterations
|
||||||
call getarg(2,arg)
|
call getarg(2,arg)
|
||||||
read(arg,*) max_dither
|
read(arg,*) navg
|
||||||
call getarg(3,arg)
|
call getarg(3,arg)
|
||||||
read(arg,*) ntrials
|
read(arg,*) ntrials
|
||||||
call getarg(4,arg)
|
call getarg(4,arg)
|
||||||
read(arg,*) s
|
read(arg,*) s
|
||||||
|
|
||||||
n=32
|
K=16
|
||||||
|
N=32
|
||||||
!rate=real(K)/real(N)
|
!rate=real(K)/real(N)
|
||||||
! don't count hash bits as data bits
|
! don't count hash bits as data bits
|
||||||
rate=4.0/real(N)
|
rate=4.0/real(N)
|
||||||
write(*,*) "rate: ",rate
|
write(*,*) "rate: ",rate
|
||||||
write(*,*) "niter= ",max_iterations," ndither= ",max_dither," s= ",s
|
write(*,*) "niter= ",max_iterations,"navg= ",navg," s= ",s
|
||||||
|
|
||||||
allocate ( codeword(N), decoded(K), message(K) )
|
allocate ( codeword(N), decoded(K), message(K) )
|
||||||
allocate ( lratio(N), rxdata(N), llr(N) )
|
allocate ( rxdata(N), rxavgd(N), llr(N) )
|
||||||
|
|
||||||
msg="K1JT K9AN"
|
msg="K1JT K9AN"
|
||||||
irpt=14
|
call fmtmsg(msg,iz)
|
||||||
call hash(msg,22,ihash)
|
call hash(msg,22,ihash)
|
||||||
|
irpt=14
|
||||||
ihash=iand(ihash,4095) !12-bit hash
|
ihash=iand(ihash,4095) !12-bit hash
|
||||||
ig=16*ihash + irpt !4-bit report
|
ig=16*ihash + irpt !4-bit report
|
||||||
write(*,*) irpt,ihash,ig
|
write(*,*) irpt,ihash,ig
|
||||||
@ -62,11 +64,16 @@ do idb = 0, 30
|
|||||||
|
|
||||||
itsum=0
|
itsum=0
|
||||||
do itrial=1, ntrials
|
do itrial=1, ntrials
|
||||||
call sgran()
|
rxavgd=0d0
|
||||||
|
do iav=1,navg
|
||||||
|
call sgran()
|
||||||
! Create a realization of a noisy received word
|
! Create a realization of a noisy received word
|
||||||
do i=1,N
|
do i=1,N
|
||||||
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
|
rxdata(i) = 2.0*codeword(i)-1.0 + sigma*gran()
|
||||||
|
enddo
|
||||||
|
rxavgd=rxavgd+rxdata
|
||||||
enddo
|
enddo
|
||||||
|
rxdata=rxavgd
|
||||||
|
|
||||||
! Correct signal normalization is important for this decoder.
|
! Correct signal normalization is important for this decoder.
|
||||||
rxav=sum(rxdata)/N
|
rxav=sum(rxdata)/N
|
||||||
@ -80,7 +87,6 @@ do idb = 0, 30
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
llr=2.0*rxdata/(ss*ss)
|
llr=2.0*rxdata/(ss*ss)
|
||||||
lratio=exp(llr)
|
|
||||||
|
|
||||||
call bpdecode40(llr, max_iterations, decoded, niterations)
|
call bpdecode40(llr, max_iterations, decoded, niterations)
|
||||||
! If the decoder finds a valid codeword, niterations will be .ge. 0.
|
! If the decoder finds a valid codeword, niterations will be .ge. 0.
|
||||||
|
Loading…
Reference in New Issue
Block a user