mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-03-24 13:08:34 -04:00
More work on (128,90) code. ldpcsim128_90 works now.
This commit is contained in:
parent
3ac119fb99
commit
5da3986f0a
@ -13,20 +13,16 @@ subroutine extractmessage128_90(decoded,msgreceived,ncrcflag)
|
||||
! Write decoded bits into cbits: 77-bit message plus 13-bit CRC
|
||||
write(cbits,1000) decoded
|
||||
1000 format(90i1)
|
||||
write(*,*) cbits
|
||||
read(cbits,1001) i1Dec8BitBytes
|
||||
1001 format(12b8)
|
||||
read(cbits,1002) ncrc13 !Received CRC12
|
||||
1002 format(77x,b13)
|
||||
|
||||
i1Dec8BitBytes(10)=iand(i1Dec8BitBytes(10),128+64+32+16+8)
|
||||
write(*,*) i1Dec8BitBytes
|
||||
i1Dec8BitBytes(11:12)=0
|
||||
icrc13=crc13(c_loc(i1Dec8BitBytes),12) !CRC13 computed from 77 msg bits
|
||||
|
||||
write(*,'(b13,3x,b13)') ncrc13,icrc13
|
||||
|
||||
if(ncrc13.eq.icrc13 .or. sum(decoded(57:87)).eq.0) then !### Kludge ### ???
|
||||
if(ncrc13.eq.icrc13) then !### Kludge ### ???
|
||||
! CRC13 checks out --- unpack 72-bit message
|
||||
read(cbits,'(12b6)') i4Dec6BitWords
|
||||
call unpackmsg(i4Dec6BitWords,msgreceived,.false.,' ')
|
||||
|
@ -12,22 +12,21 @@ character*8 arg
|
||||
integer*1, allocatable :: codeword(:), decoded(:), message(:)
|
||||
integer*1, target:: i1Msg8BitBytes(12)
|
||||
integer*1 apmask(N),cw(N)
|
||||
integer*1 i1hash(4)
|
||||
integer*1 msgbits(90)
|
||||
integer*2 checksum
|
||||
integer*4 i4Msg6BitWords(13)
|
||||
integer ihash
|
||||
integer nerrtot(0:N),nerrdec(0:N),nmpcbad(0:K)
|
||||
integer nerrtot(0:N),nerrdec(0:N),nmpcbad(0:K),nbadwt(0:N)
|
||||
logical checksumok
|
||||
real*8, allocatable :: lratio(:), rxdata(:), rxavgd(:)
|
||||
real, allocatable :: yy(:), llr(:)
|
||||
equivalence(ihash,i1hash)
|
||||
|
||||
do i=1,NRECENT
|
||||
recent_calls(i)=' '
|
||||
enddo
|
||||
nerrtot=0
|
||||
nerrdec=0
|
||||
nmpcbad=0
|
||||
nbadwt=0
|
||||
|
||||
nargs=iargc()
|
||||
if(nargs.ne.4) then
|
||||
@ -60,15 +59,11 @@ msg="G4WJS K1JT FN20"
|
||||
write(*,*) "message sent ",msgsent
|
||||
|
||||
tmpchar=' '
|
||||
write(tmpchar,'(12b6)') i4Msg6BitWords(1:12)
|
||||
write(tmpchar,'(12b6.6)') i4Msg6BitWords(1:12)
|
||||
tmpchar(73:77)="00000" !i5bit
|
||||
|
||||
read(tmpchar,'(10b8)') i1Msg8BitBytes(1:10)
|
||||
write(*,*) i1Msg8BitBytes
|
||||
|
||||
i1Msg8BitBytes(10:12)=0
|
||||
checksum = crc13 (c_loc (i1Msg8BitBytes), 12)
|
||||
write(*,'(i6,3x,b13)') checksum,checksum
|
||||
|
||||
write(tmpchar(78:90),'(b13)') checksum
|
||||
read(tmpchar,'(90i1)') msgbits(1:90)
|
||||
@ -80,13 +75,13 @@ msg="G4WJS K1JT FN20"
|
||||
|
||||
call init_random_seed()
|
||||
|
||||
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadhash sigma"
|
||||
do idb = -6, 14
|
||||
write(*,*) "Eb/N0 SNR2500 ngood nundetected nbadcrc sigma"
|
||||
do idb = 14,-6,-1
|
||||
db=idb/2.0-1.0
|
||||
sigma=1/sqrt( 2*rate*(10**(db/10.0)) )
|
||||
ngood=0
|
||||
nue=0
|
||||
nbadhash=0
|
||||
nbadcrc=0
|
||||
|
||||
do itrial=1, ntrials
|
||||
rxavgd=0d0
|
||||
@ -127,29 +122,22 @@ do idb = -6, 14
|
||||
|
||||
! If the decoder finds a valid codeword, nharderrors will be .ge. 0.
|
||||
if( nharderrors .ge. 0 ) then
|
||||
call extractmessage128_90(decoded,msgreceived,ncrcflag)
|
||||
write(*,*) 'crc check flag ',ncrcflag
|
||||
if( ncrcflag .ne. 1 ) then
|
||||
nbadcrc=nbadcrc+1
|
||||
endif
|
||||
|
||||
nueflag=0
|
||||
nerrmpc=0
|
||||
do i=1,K
|
||||
if( msgbits(i) .ne. decoded(i) ) then
|
||||
nueflag=1
|
||||
nerrmpc=nerrmpc+1
|
||||
endif
|
||||
enddo
|
||||
nmpcbad(nerrmpc)=nmpcbad(nerrmpc)+1
|
||||
if( ncrcflag .eq. 1) then
|
||||
ngood=ngood+1
|
||||
nerrdec(nerr)=nerrdec(nerr)+1
|
||||
else if(nueflag .eq. 1 ) then
|
||||
nue=nue+1;
|
||||
endif
|
||||
call extractmessage128_90(decoded,msgreceived,ncrcflag)
|
||||
nhw=count(cw.ne.codeword)
|
||||
if(ncrcflag.eq.1) then
|
||||
if(nhw.eq.0) then ! this is a good decode
|
||||
ngood=ngood+1
|
||||
nerrdec(nerr)=nerrdec(nerr)+1
|
||||
else ! this is an undetected error
|
||||
nue=nue+1
|
||||
nbadwt(nhw)=nbadwt(nhw)+1 ! store the weight of the error vector
|
||||
endif
|
||||
else
|
||||
nbadcrc=nbadcrc+1
|
||||
endif
|
||||
endif
|
||||
enddo
|
||||
|
||||
snr2500=db-3.5
|
||||
pberr=real(nerr)/real(ntrials*N)
|
||||
write(*,"(f4.1,4x,f5.1,1x,i8,1x,i8,1x,i8,8x,f5.2,8x,e10.3)") db,snr2500,ngood,nue,nbadcrc,ss,pberr
|
||||
@ -157,13 +145,13 @@ write(*,*) 'crc check flag ',ncrcflag
|
||||
enddo
|
||||
|
||||
open(unit=23,file='nerrhisto.dat',status='unknown')
|
||||
do i=1,N
|
||||
do i=0,N
|
||||
write(23,'(i4,2x,i10,i10,f10.2)') i,nerrdec(i),nerrtot(i),real(nerrdec(i))/real(nerrtot(i)+1e-10)
|
||||
enddo
|
||||
close(23)
|
||||
open(unit=25,file='nmpcbad.dat',status='unknown')
|
||||
do i=1,K
|
||||
write(25,'(i4,2x,i10)') i,nmpcbad(i)
|
||||
open(unit=25,file='undetected_error_hamming_weight.dat',status='unknown')
|
||||
do i=0,N
|
||||
write(25,'(i4,2x,i10)') i,nbadwt(i)
|
||||
enddo
|
||||
close(25)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user