Update an ldpc-code simulation tool.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7569 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Steven Franke 2017-02-20 16:45:35 +00:00
parent 94b4475957
commit 08d1c63bb2
3 changed files with 12 additions and 10 deletions

View File

@ -28,7 +28,6 @@ subroutine genmsk40(msg,msgsent,ichk,itone,itype)
10 irpt=i !Report index, 0-15 10 irpt=i !Report index, 0-15
if(ichk.lt.10000) then if(ichk.lt.10000) then
! hashmsg=msg(2:i1-1)//' '//crpt
hashmsg=msg(2:i1-1) hashmsg=msg(2:i1-1)
call hash(hashmsg,22,ihash) call hash(hashmsg,22,ihash)
ihash=iand(ihash,4095) !12-bit hash ihash=iand(ihash,4095) !12-bit hash

View File

@ -4,20 +4,24 @@ use, intrinsic :: iso_c_binding
use iso_c_binding, only: c_loc,c_size_t use iso_c_binding, only: c_loc,c_size_t
use hashing use hashing
use packjt use packjt
parameter(NRECENT=10)
character*12 recent_calls(NRECENT)
character*22 msg,msgsent,msgreceived character*22 msg,msgsent,msgreceived
character*80 prefix
character*8 arg character*8 arg
integer*1, allocatable :: codeword(:), decoded(:), message(:) integer*1, allocatable :: codeword(:), decoded(:), message(:)
integer*1, target:: i1Msg8BitBytes(10) integer*1, target:: i1Msg8BitBytes(10)
integer*1 i1hash(4) integer*1 i1hash(4)
integer*1 msgbits(80) integer*1 msgbits(80)
integer*1 bitseq(144)
integer*4 i4Msg6BitWords(13) integer*4 i4Msg6BitWords(13)
integer ihash integer ihash
real*8, allocatable :: lratio(:), rxdata(:) real*8, allocatable :: lratio(:), rxdata(:)
real, allocatable :: yy(:), llr(:) real, allocatable :: yy(:), llr(:)
equivalence(ihash,i1hash) equivalence(ihash,i1hash)
do i=1,NRECENT
recent_calls(i)=' '
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 ndither #trials s '
@ -33,9 +37,10 @@ read(arg,*) ntrials
call getarg(4,arg) call getarg(4,arg)
read(arg,*) s read(arg,*) s
!rate=real(K)/real(N)
! don't count hash bits as data bits ! don't count hash bits as data bits
rate=72.0/real(N) N=128
K=72
rate=real(K)/real(N)
write(*,*) "rate: ",rate write(*,*) "rate: ",rate
@ -78,11 +83,10 @@ msg="K9AN K1JT EN50"
msgbits(mbit)=iand(1,ishft(i1,ibit-8)) msgbits(mbit)=iand(1,ishft(i1,ibit-8))
enddo enddo
enddo enddo
call encode_msk144(msgbits,codeword) call encode_msk144(msgbits,codeword)
call init_random_seed() call init_random_seed()
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadhash" write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadhash sigma"
do idb = -6, 14 do idb = -6, 14
db=idb/2.0-1.0 db=idb/2.0-1.0
sigma=1/sqrt( 2*rate*(10**(db/10.0)) ) sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
@ -124,7 +128,7 @@ do idb = -6, 14
! If the decoder finds a valid codeword, niterations will be .ge. 0. ! If the decoder finds a valid codeword, niterations will be .ge. 0.
if( niterations .ge. 0 ) then if( niterations .ge. 0 ) then
call extractmessage144(decoded,msgreceived,nhashflag) call extractmessage144(decoded,msgreceived,nhashflag,recent_calls,nrecent)
if( nhashflag .ne. 1 ) then if( nhashflag .ne. 1 ) then
nbadhash=nbadhash+1 nbadhash=nbadhash+1
endif endif
@ -144,7 +148,7 @@ do idb = -6, 14
endif endif
enddo enddo
snr2500=db-4.0 snr2500=db-4.0
write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,1x,f5.2)") db,snr2500,ngood,nue,nbadhash,ss write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,8x,f5.2)") db,snr2500,ngood,nue,nbadhash,ss
enddo enddo

View File

@ -83,7 +83,6 @@ subroutine msk144spd(cbig,n,ntol,nsuccess,msgreceived,fc,fret,tret,navg,ct, &
! Coarse carrier frequency sync - seek tones at 2000 Hz and 4000 Hz in ! Coarse carrier frequency sync - seek tones at 2000 Hz and 4000 Hz in
! squared signal spectrum. ! squared signal spectrum.
! search range for coarse frequency error is +/- 100 Hz
ctmp=ctmp**2 ctmp=ctmp**2
ctmp(1:12)=ctmp(1:12)*rcw ctmp(1:12)=ctmp(1:12)*rcw