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